From f3ce8b9a559dcbf0cff3a63b403271b65ab50962 Mon Sep 17 00:00:00 2001 From: Robert Ing Date: Wed, 23 Oct 2024 12:22:44 -0400 Subject: [PATCH] turn comments --- rollup.test.config.js | 1 + src/BrazeKit-dev.js | 8 +++++--- test/tests.js | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/rollup.test.config.js b/rollup.test.config.js index 68d6240..70f94dc 100644 --- a/rollup.test.config.js +++ b/rollup.test.config.js @@ -1,3 +1,4 @@ +// https://go.mparticle.com/work/SQDSDKS-6875 import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; diff --git a/src/BrazeKit-dev.js b/src/BrazeKit-dev.js index ccb00ee..234a8be 100644 --- a/src/BrazeKit-dev.js +++ b/src/BrazeKit-dev.js @@ -726,9 +726,11 @@ var constructor = function () { userConsentState ); - latestUserBrazeConsentString = JSON.stringify(currentConsentPayload); + if (!isEmpty(currentConsentPayload)) { + latestUserBrazeConsentString = JSON.stringify( + currentConsentPayload + ); - if (latestUserBrazeConsentString.length) { setConsentOnBraze(currentConsentPayload); } } @@ -742,7 +744,7 @@ var constructor = function () { } function maybeSetConsentBeforeEventLogged(event) { - if (latestUserBrazeConsentString && parsedConsentMappings.length) { + if (latestUserBrazeConsentString && !isEmpty(parsedConsentMappings)) { var eventConsentState = getEventConsentState(event.ConsentState); if (!isEmpty(eventConsentState)) { diff --git a/test/tests.js b/test/tests.js index 975e958..59a9c9c 100644 --- a/test/tests.js +++ b/test/tests.js @@ -1920,7 +1920,7 @@ user.getUserIdentities is not a function,\n`; window.braze.user.customAttributeSet.should.equal(false); }); - it('user consent should not be updated if a customer does not change his consent before logging an event', function() { + it('should not update user consent if a customer does not change consent before logging an event', function() { mParticle.forwarder.init({ apiKey: '123456', userIdentificationType: 'MPID', @@ -1968,7 +1968,7 @@ user.getUserIdentities is not a function,\n`; window.braze.user.customAttributeSet.should.equal(false); }); - it('user consent should be updated if an event has a different consent than the previously set consent', function() { + it('should update user consent if an event has a different consent than the previously set consent', function() { mParticle.forwarder.init({ apiKey: '123456', userIdentificationType: 'MPID',