Skip to content

Commit e53993c

Browse files
jaissica12rmi22186
authored andcommitted
fix: Replace enableHtmlInAppMessages deprecated method with allowUserSuppliedJavascript (v3) (#60)
1 parent 448833f commit e53993c

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
@@ -704,7 +704,7 @@ var constructor = function () {
704704
options.sessionTimeoutInSeconds =
705705
forwarderSettings.ABKSessionTimeoutKey || 1800;
706706
options.sdkFlavor = 'mparticle';
707-
options.enableHtmlInAppMessages =
707+
options.allowUserSuppliedJavascript =
708708
forwarderSettings.enableHtmlInAppMessages == 'True';
709709
options.doNotLoadFontAwesome =
710710
forwarderSettings.doNotLoadFontAwesome == 'True';

test/tests.js

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

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

0 commit comments

Comments
 (0)