Skip to content

Commit 47083a0

Browse files
authored
fix: Replace enableHtmlInAppMessages deprecated method with allowUserSuppliedJavascript (v3) (#60)
1 parent b39ec39 commit 47083a0

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/BrazeKit-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ var constructor = function () {
460460
options.sessionTimeoutInSeconds =
461461
forwarderSettings.ABKSessionTimeoutKey || 1800;
462462
options.sdkFlavor = 'mparticle';
463-
options.enableHtmlInAppMessages =
463+
options.allowUserSuppliedJavascript =
464464
forwarderSettings.enableHtmlInAppMessages == 'True';
465465
options.doNotLoadFontAwesome =
466466
forwarderSettings.doNotLoadFontAwesome == 'True';

test/tests.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -936,10 +936,9 @@ describe('Appboy Forwarder', function () {
936936
window.appboy.getUser().emailSet.should.equal('test2@gmail.com');
937937

938938
// We support $Age as a reserved attribute for Braze. However, since
939-
// Braze's API expects a year from us, this test will break every year,
940-
// since setting the age = 10 in 2021 will mean the user is born in 2011,
941-
// but setting it in 2023 means the year is 2013.
942-
window.appboy.getUser().yearOfBirth.should.equal(2013);
939+
// Braze's API expects a year, so we calculate expected year dynamically.
940+
var expectedYearOfBirth = new Date().getFullYear() - 10;
941+
window.appboy.getUser().yearOfBirth.should.equal(expectedYearOfBirth);
943942
window.appboy.getUser().dayOfBirth.should.equal(1);
944943
window.appboy.getUser().monthOfBirth.should.equal(1);
945944
window.appboy.getUser().phoneSet.should.equal('1234567890');

0 commit comments

Comments
 (0)