@blotoutio/edgetag-sdk-js 1.21.0 → 1.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +70 -27
- package/index.mjs +70 -27
- package/internal.d.ts +2 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -23,24 +23,42 @@ const isRecord = (v) => !!v && typeof v == 'object' && !Array.isArray(v);
|
|
|
23
23
|
* It should be used in conjunction with `UserConsent`, not `ProvidersConfig`.
|
|
24
24
|
*/
|
|
25
25
|
const hasUserConsent = (consent, provider, tagName) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if ('all' in providerSpecific && isBool(providerSpecific.all)) {
|
|
37
|
-
allowed = providerSpecific.all;
|
|
26
|
+
var _a, _b;
|
|
27
|
+
let allowed = false;
|
|
28
|
+
if (isRecord(consent.consentChannel)) {
|
|
29
|
+
allowed = isBool(consent.consentChannel.all)
|
|
30
|
+
? consent.consentChannel.all
|
|
31
|
+
: false;
|
|
32
|
+
if (provider in consent.consentChannel) {
|
|
33
|
+
const providerSpecific = consent.consentChannel[provider];
|
|
34
|
+
if (isBool(providerSpecific)) {
|
|
35
|
+
allowed = providerSpecific;
|
|
38
36
|
}
|
|
39
|
-
if (
|
|
40
|
-
|
|
37
|
+
else if (isRecord(providerSpecific)) {
|
|
38
|
+
if ('all' in providerSpecific && isBool(providerSpecific.all)) {
|
|
39
|
+
allowed = providerSpecific.all;
|
|
40
|
+
}
|
|
41
|
+
if (tagName in providerSpecific && isBool(providerSpecific[tagName])) {
|
|
42
|
+
allowed = providerSpecific[tagName];
|
|
43
|
+
}
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
}
|
|
47
|
+
if (allowed) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
if (isRecord(consent.consentCategory) &&
|
|
51
|
+
isRecord((_a = consent.consentSettings) === null || _a === void 0 ? void 0 : _a.channels)) {
|
|
52
|
+
allowed = isBool(consent.consentCategory.all)
|
|
53
|
+
? consent.consentCategory.all
|
|
54
|
+
: false;
|
|
55
|
+
const category = (_b = Object.entries(consent.consentSettings.channels).find(([, value]) => {
|
|
56
|
+
return value.includes(provider);
|
|
57
|
+
})) === null || _b === void 0 ? void 0 : _b[0];
|
|
58
|
+
if (category && consent.consentCategory[category]) {
|
|
59
|
+
allowed = true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
44
62
|
return allowed;
|
|
45
63
|
};
|
|
46
64
|
/**
|
|
@@ -501,6 +519,10 @@ const initSettings = (destination, options) => {
|
|
|
501
519
|
geoCountry: null,
|
|
502
520
|
geoRegion: null,
|
|
503
521
|
isEURequest: false,
|
|
522
|
+
consentSetting: {
|
|
523
|
+
enabled: false,
|
|
524
|
+
channels: {},
|
|
525
|
+
},
|
|
504
526
|
...options,
|
|
505
527
|
};
|
|
506
528
|
};
|
|
@@ -926,7 +948,7 @@ const getStandardPayload = (destination, payload) => {
|
|
|
926
948
|
referrer: getReferrer(destination),
|
|
927
949
|
search: getSearch(destination),
|
|
928
950
|
locale: getLocale(),
|
|
929
|
-
sdkVersion: "1.21.
|
|
951
|
+
sdkVersion: "1.21.2" ,
|
|
930
952
|
...(payload || {}),
|
|
931
953
|
};
|
|
932
954
|
let storage = {};
|
|
@@ -1132,7 +1154,10 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
1132
1154
|
const sessionId = getSetting(destination, 'sessionId');
|
|
1133
1155
|
const userId = getUserId$1(destination);
|
|
1134
1156
|
const providerData = {};
|
|
1135
|
-
const
|
|
1157
|
+
const consentChannel = getConsent$1(destination);
|
|
1158
|
+
const consentCategory = getConsentCategories(destination);
|
|
1159
|
+
const consentSettings = getSetting(destination, 'consentSetting');
|
|
1160
|
+
const userConsent = { consentChannel, consentCategory, consentSettings };
|
|
1136
1161
|
if (skipZeroPurchaseEvent && isZeroPurchaseEvent({ eventName, data })) {
|
|
1137
1162
|
return;
|
|
1138
1163
|
}
|
|
@@ -1153,7 +1178,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
1153
1178
|
logger.log(`Provider instance is not allowed (${pkg.name}: ${variable.tagName})`);
|
|
1154
1179
|
continue;
|
|
1155
1180
|
}
|
|
1156
|
-
if (!hasUserConsent(
|
|
1181
|
+
if (!hasUserConsent(userConsent, pkg.name, variable.tagName)) {
|
|
1157
1182
|
logger.log(`Consent is missing (${pkg.name}: ${variable.tagName})`);
|
|
1158
1183
|
continue;
|
|
1159
1184
|
}
|
|
@@ -1180,7 +1205,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
1180
1205
|
}
|
|
1181
1206
|
providerData[pkg.name] = result;
|
|
1182
1207
|
}
|
|
1183
|
-
if (!hasAllowedManifestTags(configuredTags,
|
|
1208
|
+
if (!hasAllowedManifestTags(configuredTags, userConsent, providers)) {
|
|
1184
1209
|
return;
|
|
1185
1210
|
}
|
|
1186
1211
|
sendTag(destination, {
|
|
@@ -1218,10 +1243,13 @@ const processData = (destination, data, providers, options) => {
|
|
|
1218
1243
|
const providerPackages = getSetting(destination, 'browserPackages');
|
|
1219
1244
|
const configuredTags = getSetting(destination, 'channels');
|
|
1220
1245
|
const userId = getUserId$1(destination);
|
|
1221
|
-
const consent = getConsent$1(destination);
|
|
1222
1246
|
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1223
1247
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1224
1248
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1249
|
+
const consentChannel = getConsent$1(destination);
|
|
1250
|
+
const consentCategory = getConsentCategories(destination);
|
|
1251
|
+
const consentSettings = getSetting(destination, 'consentSetting');
|
|
1252
|
+
const userConsent = { consentChannel, consentCategory, consentSettings };
|
|
1225
1253
|
for (const pkg of providerPackages) {
|
|
1226
1254
|
if (!pkg || !pkg.user || !pkg.name) {
|
|
1227
1255
|
continue;
|
|
@@ -1236,7 +1264,7 @@ const processData = (destination, data, providers, options) => {
|
|
|
1236
1264
|
logger.log(`Data not allowed for ${pkg.name} (${variable.tagName})`);
|
|
1237
1265
|
continue;
|
|
1238
1266
|
}
|
|
1239
|
-
if (!hasUserConsent(
|
|
1267
|
+
if (!hasUserConsent(userConsent, pkg.name, variable.tagName)) {
|
|
1240
1268
|
logger.log(`Consent is missing for ${pkg.name} (${variable.tagName})`);
|
|
1241
1269
|
continue;
|
|
1242
1270
|
}
|
|
@@ -1312,6 +1340,7 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1312
1340
|
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1313
1341
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1314
1342
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1343
|
+
const consentSettings = getSetting(destination, 'consentSetting');
|
|
1315
1344
|
/* Calling Init for all provider instances based on consent check */
|
|
1316
1345
|
for (const pkg of providerPackages) {
|
|
1317
1346
|
if (!pkg || !pkg.name || !pkg.init) {
|
|
@@ -1319,7 +1348,11 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1319
1348
|
}
|
|
1320
1349
|
const variables = getProviderVariables(destination, pkg.name);
|
|
1321
1350
|
for (const variable of variables) {
|
|
1322
|
-
const hasConsent = hasUserConsent(
|
|
1351
|
+
const hasConsent = hasUserConsent({
|
|
1352
|
+
consentChannel: consent,
|
|
1353
|
+
consentCategory: consentCategories,
|
|
1354
|
+
consentSettings,
|
|
1355
|
+
}, pkg.name, variable.tagName);
|
|
1323
1356
|
if (!hasConsent) {
|
|
1324
1357
|
continue;
|
|
1325
1358
|
}
|
|
@@ -1346,6 +1379,7 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1346
1379
|
consentData: {
|
|
1347
1380
|
consent,
|
|
1348
1381
|
categories: { ...consentCategories, necessary: true },
|
|
1382
|
+
consentSettings,
|
|
1349
1383
|
},
|
|
1350
1384
|
});
|
|
1351
1385
|
}
|
|
@@ -1375,6 +1409,7 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1375
1409
|
...consentCategories,
|
|
1376
1410
|
necessary: true,
|
|
1377
1411
|
},
|
|
1412
|
+
consentSettings,
|
|
1378
1413
|
},
|
|
1379
1414
|
variables,
|
|
1380
1415
|
});
|
|
@@ -1529,6 +1564,10 @@ const handleManifest = (destination, response) => {
|
|
|
1529
1564
|
const userId = getUserId$1(destination);
|
|
1530
1565
|
const executionContext = new Map();
|
|
1531
1566
|
const manifest = response.result;
|
|
1567
|
+
const consentChannel = getConsent$1(destination);
|
|
1568
|
+
const consentCategory = getConsentCategories(destination);
|
|
1569
|
+
const consentSettings = getSetting(destination, 'consentSetting');
|
|
1570
|
+
const userConsent = { consentChannel, consentCategory, consentSettings };
|
|
1532
1571
|
manifest.forEach((provider) => {
|
|
1533
1572
|
addChannel(destination, provider.package, provider.tagName);
|
|
1534
1573
|
const pkg = providerPackages.find((pkg) => pkg.name === provider.package);
|
|
@@ -1543,8 +1582,7 @@ const handleManifest = (destination, response) => {
|
|
|
1543
1582
|
});
|
|
1544
1583
|
}
|
|
1545
1584
|
if (pkg && pkg.name && pkg.init) {
|
|
1546
|
-
|
|
1547
|
-
const hasConsent = hasUserConsent(getSetting(destination, 'consent'), pkg.name, provider.tagName);
|
|
1585
|
+
const hasConsent = hasUserConsent(userConsent, pkg.name, provider.tagName);
|
|
1548
1586
|
if (hasConsent &&
|
|
1549
1587
|
doesGeoRequestMatchList(response.geoCountry, response.geoRegion, response.isEURequest, provider.geoRegions)) {
|
|
1550
1588
|
pkg.init({
|
|
@@ -1562,6 +1600,7 @@ const handleManifest = (destination, response) => {
|
|
|
1562
1600
|
consentData: {
|
|
1563
1601
|
consent: response.consent,
|
|
1564
1602
|
categories: response.consentCategories,
|
|
1603
|
+
consentSettings: response.consentSetting,
|
|
1565
1604
|
},
|
|
1566
1605
|
});
|
|
1567
1606
|
}
|
|
@@ -1690,6 +1729,7 @@ const handleInit = (preferences) => {
|
|
|
1690
1729
|
geoCountry: result.geoCountry,
|
|
1691
1730
|
geoRegion: result.geoRegion,
|
|
1692
1731
|
isEURequest: result.isEURequest,
|
|
1732
|
+
consentSetting: result.consentSetting,
|
|
1693
1733
|
});
|
|
1694
1734
|
if (result.storageId != null) {
|
|
1695
1735
|
savePerKey(preferences.edgeURL, 'local', tagStorage, result.storageId, storageIdKey);
|
|
@@ -1722,11 +1762,14 @@ const processUser = (destination, key, value, providers, options) => {
|
|
|
1722
1762
|
});
|
|
1723
1763
|
const providerPackages = getSetting(destination, 'browserPackages');
|
|
1724
1764
|
const configuredTags = getSetting(destination, 'channels');
|
|
1725
|
-
const consent = getConsent$1(destination);
|
|
1726
1765
|
const userId = getUserId$1(destination);
|
|
1727
1766
|
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1728
1767
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1729
1768
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1769
|
+
const consentChannel = getConsent$1(destination);
|
|
1770
|
+
const consentCategory = getConsentCategories(destination);
|
|
1771
|
+
const consentSettings = getSetting(destination, 'consentSetting');
|
|
1772
|
+
const userConsent = { consentChannel, consentCategory, consentSettings };
|
|
1730
1773
|
for (const pkg of providerPackages) {
|
|
1731
1774
|
if (!pkg || !pkg.name || !pkg.user) {
|
|
1732
1775
|
continue;
|
|
@@ -1741,7 +1784,7 @@ const processUser = (destination, key, value, providers, options) => {
|
|
|
1741
1784
|
logger.log(`User not allowed for ${pkg.name} (${variable.tagName})`);
|
|
1742
1785
|
continue;
|
|
1743
1786
|
}
|
|
1744
|
-
if (!hasUserConsent(
|
|
1787
|
+
if (!hasUserConsent(userConsent, pkg.name, variable.tagName)) {
|
|
1745
1788
|
logger.log(`User do not have consent for ${pkg.name} (${variable.tagName})`);
|
|
1746
1789
|
continue;
|
|
1747
1790
|
}
|
|
@@ -1864,8 +1907,8 @@ const init = (preferences) => {
|
|
|
1864
1907
|
const tag = (name, data, providers, options) => {
|
|
1865
1908
|
handleTag(name, data, providers, options);
|
|
1866
1909
|
};
|
|
1867
|
-
const consent = (
|
|
1868
|
-
handleConsent(
|
|
1910
|
+
const consent = (consentChannels, consentCategories, options) => {
|
|
1911
|
+
handleConsent(consentChannels, consentCategories, options);
|
|
1869
1912
|
};
|
|
1870
1913
|
const user = (key, value, providers, options) => {
|
|
1871
1914
|
handleUser(key, value, providers, options);
|
package/index.mjs
CHANGED
|
@@ -21,24 +21,42 @@ const isRecord = (v) => !!v && typeof v == 'object' && !Array.isArray(v);
|
|
|
21
21
|
* It should be used in conjunction with `UserConsent`, not `ProvidersConfig`.
|
|
22
22
|
*/
|
|
23
23
|
const hasUserConsent = (consent, provider, tagName) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if ('all' in providerSpecific && isBool(providerSpecific.all)) {
|
|
35
|
-
allowed = providerSpecific.all;
|
|
24
|
+
var _a, _b;
|
|
25
|
+
let allowed = false;
|
|
26
|
+
if (isRecord(consent.consentChannel)) {
|
|
27
|
+
allowed = isBool(consent.consentChannel.all)
|
|
28
|
+
? consent.consentChannel.all
|
|
29
|
+
: false;
|
|
30
|
+
if (provider in consent.consentChannel) {
|
|
31
|
+
const providerSpecific = consent.consentChannel[provider];
|
|
32
|
+
if (isBool(providerSpecific)) {
|
|
33
|
+
allowed = providerSpecific;
|
|
36
34
|
}
|
|
37
|
-
if (
|
|
38
|
-
|
|
35
|
+
else if (isRecord(providerSpecific)) {
|
|
36
|
+
if ('all' in providerSpecific && isBool(providerSpecific.all)) {
|
|
37
|
+
allowed = providerSpecific.all;
|
|
38
|
+
}
|
|
39
|
+
if (tagName in providerSpecific && isBool(providerSpecific[tagName])) {
|
|
40
|
+
allowed = providerSpecific[tagName];
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
}
|
|
45
|
+
if (allowed) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (isRecord(consent.consentCategory) &&
|
|
49
|
+
isRecord((_a = consent.consentSettings) === null || _a === void 0 ? void 0 : _a.channels)) {
|
|
50
|
+
allowed = isBool(consent.consentCategory.all)
|
|
51
|
+
? consent.consentCategory.all
|
|
52
|
+
: false;
|
|
53
|
+
const category = (_b = Object.entries(consent.consentSettings.channels).find(([, value]) => {
|
|
54
|
+
return value.includes(provider);
|
|
55
|
+
})) === null || _b === void 0 ? void 0 : _b[0];
|
|
56
|
+
if (category && consent.consentCategory[category]) {
|
|
57
|
+
allowed = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
42
60
|
return allowed;
|
|
43
61
|
};
|
|
44
62
|
/**
|
|
@@ -499,6 +517,10 @@ const initSettings = (destination, options) => {
|
|
|
499
517
|
geoCountry: null,
|
|
500
518
|
geoRegion: null,
|
|
501
519
|
isEURequest: false,
|
|
520
|
+
consentSetting: {
|
|
521
|
+
enabled: false,
|
|
522
|
+
channels: {},
|
|
523
|
+
},
|
|
502
524
|
...options,
|
|
503
525
|
};
|
|
504
526
|
};
|
|
@@ -924,7 +946,7 @@ const getStandardPayload = (destination, payload) => {
|
|
|
924
946
|
referrer: getReferrer(destination),
|
|
925
947
|
search: getSearch(destination),
|
|
926
948
|
locale: getLocale(),
|
|
927
|
-
sdkVersion: "1.21.
|
|
949
|
+
sdkVersion: "1.21.2" ,
|
|
928
950
|
...(payload || {}),
|
|
929
951
|
};
|
|
930
952
|
let storage = {};
|
|
@@ -1130,7 +1152,10 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
1130
1152
|
const sessionId = getSetting(destination, 'sessionId');
|
|
1131
1153
|
const userId = getUserId$1(destination);
|
|
1132
1154
|
const providerData = {};
|
|
1133
|
-
const
|
|
1155
|
+
const consentChannel = getConsent$1(destination);
|
|
1156
|
+
const consentCategory = getConsentCategories(destination);
|
|
1157
|
+
const consentSettings = getSetting(destination, 'consentSetting');
|
|
1158
|
+
const userConsent = { consentChannel, consentCategory, consentSettings };
|
|
1134
1159
|
if (skipZeroPurchaseEvent && isZeroPurchaseEvent({ eventName, data })) {
|
|
1135
1160
|
return;
|
|
1136
1161
|
}
|
|
@@ -1151,7 +1176,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
1151
1176
|
logger.log(`Provider instance is not allowed (${pkg.name}: ${variable.tagName})`);
|
|
1152
1177
|
continue;
|
|
1153
1178
|
}
|
|
1154
|
-
if (!hasUserConsent(
|
|
1179
|
+
if (!hasUserConsent(userConsent, pkg.name, variable.tagName)) {
|
|
1155
1180
|
logger.log(`Consent is missing (${pkg.name}: ${variable.tagName})`);
|
|
1156
1181
|
continue;
|
|
1157
1182
|
}
|
|
@@ -1178,7 +1203,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
1178
1203
|
}
|
|
1179
1204
|
providerData[pkg.name] = result;
|
|
1180
1205
|
}
|
|
1181
|
-
if (!hasAllowedManifestTags(configuredTags,
|
|
1206
|
+
if (!hasAllowedManifestTags(configuredTags, userConsent, providers)) {
|
|
1182
1207
|
return;
|
|
1183
1208
|
}
|
|
1184
1209
|
sendTag(destination, {
|
|
@@ -1216,10 +1241,13 @@ const processData = (destination, data, providers, options) => {
|
|
|
1216
1241
|
const providerPackages = getSetting(destination, 'browserPackages');
|
|
1217
1242
|
const configuredTags = getSetting(destination, 'channels');
|
|
1218
1243
|
const userId = getUserId$1(destination);
|
|
1219
|
-
const consent = getConsent$1(destination);
|
|
1220
1244
|
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1221
1245
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1222
1246
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1247
|
+
const consentChannel = getConsent$1(destination);
|
|
1248
|
+
const consentCategory = getConsentCategories(destination);
|
|
1249
|
+
const consentSettings = getSetting(destination, 'consentSetting');
|
|
1250
|
+
const userConsent = { consentChannel, consentCategory, consentSettings };
|
|
1223
1251
|
for (const pkg of providerPackages) {
|
|
1224
1252
|
if (!pkg || !pkg.user || !pkg.name) {
|
|
1225
1253
|
continue;
|
|
@@ -1234,7 +1262,7 @@ const processData = (destination, data, providers, options) => {
|
|
|
1234
1262
|
logger.log(`Data not allowed for ${pkg.name} (${variable.tagName})`);
|
|
1235
1263
|
continue;
|
|
1236
1264
|
}
|
|
1237
|
-
if (!hasUserConsent(
|
|
1265
|
+
if (!hasUserConsent(userConsent, pkg.name, variable.tagName)) {
|
|
1238
1266
|
logger.log(`Consent is missing for ${pkg.name} (${variable.tagName})`);
|
|
1239
1267
|
continue;
|
|
1240
1268
|
}
|
|
@@ -1310,6 +1338,7 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1310
1338
|
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1311
1339
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1312
1340
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1341
|
+
const consentSettings = getSetting(destination, 'consentSetting');
|
|
1313
1342
|
/* Calling Init for all provider instances based on consent check */
|
|
1314
1343
|
for (const pkg of providerPackages) {
|
|
1315
1344
|
if (!pkg || !pkg.name || !pkg.init) {
|
|
@@ -1317,7 +1346,11 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1317
1346
|
}
|
|
1318
1347
|
const variables = getProviderVariables(destination, pkg.name);
|
|
1319
1348
|
for (const variable of variables) {
|
|
1320
|
-
const hasConsent = hasUserConsent(
|
|
1349
|
+
const hasConsent = hasUserConsent({
|
|
1350
|
+
consentChannel: consent,
|
|
1351
|
+
consentCategory: consentCategories,
|
|
1352
|
+
consentSettings,
|
|
1353
|
+
}, pkg.name, variable.tagName);
|
|
1321
1354
|
if (!hasConsent) {
|
|
1322
1355
|
continue;
|
|
1323
1356
|
}
|
|
@@ -1344,6 +1377,7 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1344
1377
|
consentData: {
|
|
1345
1378
|
consent,
|
|
1346
1379
|
categories: { ...consentCategories, necessary: true },
|
|
1380
|
+
consentSettings,
|
|
1347
1381
|
},
|
|
1348
1382
|
});
|
|
1349
1383
|
}
|
|
@@ -1373,6 +1407,7 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1373
1407
|
...consentCategories,
|
|
1374
1408
|
necessary: true,
|
|
1375
1409
|
},
|
|
1410
|
+
consentSettings,
|
|
1376
1411
|
},
|
|
1377
1412
|
variables,
|
|
1378
1413
|
});
|
|
@@ -1527,6 +1562,10 @@ const handleManifest = (destination, response) => {
|
|
|
1527
1562
|
const userId = getUserId$1(destination);
|
|
1528
1563
|
const executionContext = new Map();
|
|
1529
1564
|
const manifest = response.result;
|
|
1565
|
+
const consentChannel = getConsent$1(destination);
|
|
1566
|
+
const consentCategory = getConsentCategories(destination);
|
|
1567
|
+
const consentSettings = getSetting(destination, 'consentSetting');
|
|
1568
|
+
const userConsent = { consentChannel, consentCategory, consentSettings };
|
|
1530
1569
|
manifest.forEach((provider) => {
|
|
1531
1570
|
addChannel(destination, provider.package, provider.tagName);
|
|
1532
1571
|
const pkg = providerPackages.find((pkg) => pkg.name === provider.package);
|
|
@@ -1541,8 +1580,7 @@ const handleManifest = (destination, response) => {
|
|
|
1541
1580
|
});
|
|
1542
1581
|
}
|
|
1543
1582
|
if (pkg && pkg.name && pkg.init) {
|
|
1544
|
-
|
|
1545
|
-
const hasConsent = hasUserConsent(getSetting(destination, 'consent'), pkg.name, provider.tagName);
|
|
1583
|
+
const hasConsent = hasUserConsent(userConsent, pkg.name, provider.tagName);
|
|
1546
1584
|
if (hasConsent &&
|
|
1547
1585
|
doesGeoRequestMatchList(response.geoCountry, response.geoRegion, response.isEURequest, provider.geoRegions)) {
|
|
1548
1586
|
pkg.init({
|
|
@@ -1560,6 +1598,7 @@ const handleManifest = (destination, response) => {
|
|
|
1560
1598
|
consentData: {
|
|
1561
1599
|
consent: response.consent,
|
|
1562
1600
|
categories: response.consentCategories,
|
|
1601
|
+
consentSettings: response.consentSetting,
|
|
1563
1602
|
},
|
|
1564
1603
|
});
|
|
1565
1604
|
}
|
|
@@ -1688,6 +1727,7 @@ const handleInit = (preferences) => {
|
|
|
1688
1727
|
geoCountry: result.geoCountry,
|
|
1689
1728
|
geoRegion: result.geoRegion,
|
|
1690
1729
|
isEURequest: result.isEURequest,
|
|
1730
|
+
consentSetting: result.consentSetting,
|
|
1691
1731
|
});
|
|
1692
1732
|
if (result.storageId != null) {
|
|
1693
1733
|
savePerKey(preferences.edgeURL, 'local', tagStorage, result.storageId, storageIdKey);
|
|
@@ -1720,11 +1760,14 @@ const processUser = (destination, key, value, providers, options) => {
|
|
|
1720
1760
|
});
|
|
1721
1761
|
const providerPackages = getSetting(destination, 'browserPackages');
|
|
1722
1762
|
const configuredTags = getSetting(destination, 'channels');
|
|
1723
|
-
const consent = getConsent$1(destination);
|
|
1724
1763
|
const userId = getUserId$1(destination);
|
|
1725
1764
|
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1726
1765
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1727
1766
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1767
|
+
const consentChannel = getConsent$1(destination);
|
|
1768
|
+
const consentCategory = getConsentCategories(destination);
|
|
1769
|
+
const consentSettings = getSetting(destination, 'consentSetting');
|
|
1770
|
+
const userConsent = { consentChannel, consentCategory, consentSettings };
|
|
1728
1771
|
for (const pkg of providerPackages) {
|
|
1729
1772
|
if (!pkg || !pkg.name || !pkg.user) {
|
|
1730
1773
|
continue;
|
|
@@ -1739,7 +1782,7 @@ const processUser = (destination, key, value, providers, options) => {
|
|
|
1739
1782
|
logger.log(`User not allowed for ${pkg.name} (${variable.tagName})`);
|
|
1740
1783
|
continue;
|
|
1741
1784
|
}
|
|
1742
|
-
if (!hasUserConsent(
|
|
1785
|
+
if (!hasUserConsent(userConsent, pkg.name, variable.tagName)) {
|
|
1743
1786
|
logger.log(`User do not have consent for ${pkg.name} (${variable.tagName})`);
|
|
1744
1787
|
continue;
|
|
1745
1788
|
}
|
|
@@ -1862,8 +1905,8 @@ const init = (preferences) => {
|
|
|
1862
1905
|
const tag = (name, data, providers, options) => {
|
|
1863
1906
|
handleTag(name, data, providers, options);
|
|
1864
1907
|
};
|
|
1865
|
-
const consent = (
|
|
1866
|
-
handleConsent(
|
|
1908
|
+
const consent = (consentChannels, consentCategories, options) => {
|
|
1909
|
+
handleConsent(consentChannels, consentCategories, options);
|
|
1867
1910
|
};
|
|
1868
1911
|
const user = (key, value, providers, options) => {
|
|
1869
1912
|
handleUser(key, value, providers, options);
|
package/internal.d.ts
CHANGED