Skip to content

Commit c33c252

Browse files
committed
fix: Set mapped consent name from server to lowercase (#45)
1 parent ba2dbc6 commit c33c252

2 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/consent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ ConsentHandler.prototype.generateConsentStatePayloadFromMappings = function (
9090

9191
for (var i = 0; i <= mappings.length - 1; i++) {
9292
var mappingEntry = mappings[i];
93-
var mpMappedConsentName = mappingEntry.map;
93+
var mpMappedConsentName = mappingEntry.map.toLowerCase();
9494
var googleMappedConsentName = mappingEntry.value;
9595

9696
if (

test/tests.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,37 +1608,37 @@ describe('GoogleTagManager Forwarder', function() {
16081608
var consentMap = [
16091609
{
16101610
jsmap: null,
1611-
map: 'some_consent',
1611+
map: 'Some_consent',
16121612
maptype: 'ConsentPurposes',
16131613
value: 'ad_user_data',
16141614
},
16151615
{
16161616
jsmap: null,
1617-
map: 'storage_consent',
1617+
map: 'Storage_consent',
16181618
maptype: 'ConsentPurposes',
16191619
value: 'analytics_storage',
16201620
},
16211621
{
16221622
jsmap: null,
1623-
map: 'other_test_consent',
1623+
map: 'Other_test_consent',
16241624
maptype: 'ConsentPurposes',
16251625
value: 'ad_storage',
16261626
},
16271627
{
16281628
jsmap: null,
1629-
map: 'test_consent',
1629+
map: 'Test_consent',
16301630
maptype: 'ConsentPurposes',
16311631
value: 'ad_personalization',
16321632
},
16331633
];
16341634

1635-
beforeEach(function () {
1635+
beforeEach(function() {
16361636
mParticle.forwarders = [];
16371637
});
16381638

1639-
afterEach(function () {});
1639+
afterEach(function() {});
16401640

1641-
it('should consolidate consent information', function (done) {
1641+
it('should consolidate consent information', function(done) {
16421642
mParticle.forwarder.init(
16431643
{
16441644
dataLayerName: 'mparticle_data_layer',
@@ -1664,19 +1664,19 @@ describe('GoogleTagManager Forwarder', function() {
16641664
Timestamp: 1557935884509,
16651665
ConsentDocument: 'fake_consent_document',
16661666
Location: 'This is fake',
1667-
HardwareId: '123456'
1668-
}
1667+
HardwareId: '123456',
1668+
},
16691669
};
1670-
}
1671-
}
1670+
},
1671+
},
16721672
};
16731673
var expectedEvent = {
16741674
event: 'Test User Action',
16751675
mp_data: {
16761676
device_application_stamp: '1234567890',
16771677
event: {
16781678
name: 'Test User Action',
1679-
attributes: {}
1679+
attributes: {},
16801680
},
16811681
user: {
16821682
mpid: '8675309',
@@ -1689,12 +1689,12 @@ describe('GoogleTagManager Forwarder', function() {
16891689
Timestamp: 1557935884509,
16901690
ConsentDocument: 'fake_consent_document',
16911691
Location: 'This is fake',
1692-
HardwareId: '123456'
1693-
}
1694-
}
1695-
}
1696-
}
1697-
}
1692+
HardwareId: '123456',
1693+
},
1694+
},
1695+
},
1696+
},
1697+
},
16981698
};
16991699

17001700
mParticle.forwarder.process(event);
@@ -1704,13 +1704,13 @@ describe('GoogleTagManager Forwarder', function() {
17041704
done();
17051705
});
17061706

1707-
it('should construct a Default Consent State Payload from Mappings', function (done) {
1707+
it('should construct a Default Consent State Payload from Mappings', function(done) {
17081708
mParticle.forwarder.init(
17091709
{
17101710
dataLayerName: 'mparticle_data_layer',
17111711
containerId: 'GTM-123123',
17121712
consentMappingWeb:
1713-
'[{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;some_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_user_data&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;storage_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;analytics_storage&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;other_test_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_storage&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;test_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_personalization&quot;}]',
1713+
'[{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;Some_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_user_data&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;Storage_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;analytics_storage&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;Other_test_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_storage&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;Test_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_personalization&quot;}]',
17141714
},
17151715
reportService.cb,
17161716
true

0 commit comments

Comments
 (0)