@blotoutio/edgetag-sdk-js 1.5.0 → 1.6.1
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 +111 -18
- package/index.mjs +111 -18
- package/internal.d.ts +1 -0
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -378,24 +378,111 @@ const isoCountries = new Map([
|
|
|
378
378
|
['ZM', 'Zambia'],
|
|
379
379
|
['ZW', 'Zimbabwe'],
|
|
380
380
|
]);
|
|
381
|
-
|
|
381
|
+
/**
|
|
382
|
+
* ISO-3166 US state ISO codes
|
|
383
|
+
* @see https://en.wikipedia.org/wiki/ISO_3166-2:US
|
|
384
|
+
* */
|
|
385
|
+
const usStates = new Map([
|
|
386
|
+
['US-AL', 'Alabama'],
|
|
387
|
+
['US-AK', 'Alaska'],
|
|
388
|
+
['US-AZ', 'Arizona'],
|
|
389
|
+
['US-AR', 'Arkansas'],
|
|
390
|
+
['US-CA', 'California'],
|
|
391
|
+
['US-CO', 'Colorado'],
|
|
392
|
+
['US-CT', 'Connecticut'],
|
|
393
|
+
['US-DE', 'Delaware'],
|
|
394
|
+
['US-FL', 'Florida'],
|
|
395
|
+
['US-GA', 'Georgia'],
|
|
396
|
+
['US-HI', 'Hawaii'],
|
|
397
|
+
['US-ID', 'Idaho'],
|
|
398
|
+
['US-IL', 'Illinois'],
|
|
399
|
+
['US-IN', 'Indiana'],
|
|
400
|
+
['US-IA', 'Iowa'],
|
|
401
|
+
['US-KS', 'Kansas'],
|
|
402
|
+
['US-KY', 'Kentucky'],
|
|
403
|
+
['US-LA', 'Louisiana'],
|
|
404
|
+
['US-ME', 'Maine'],
|
|
405
|
+
['US-MD', 'Maryland'],
|
|
406
|
+
['US-MA', 'Massachusetts'],
|
|
407
|
+
['US-MI', 'Michigan'],
|
|
408
|
+
['US-MN', 'Minnesota'],
|
|
409
|
+
['US-MS', 'Mississippi'],
|
|
410
|
+
['US-MO', 'Missouri'],
|
|
411
|
+
['US-MT', 'Montana'],
|
|
412
|
+
['US-NE', 'Nebraska'],
|
|
413
|
+
['US-NV', 'Nevada'],
|
|
414
|
+
['US-NH', 'New Hampshire'],
|
|
415
|
+
['US-NJ', 'New Jersey'],
|
|
416
|
+
['US-NM', 'New Mexico'],
|
|
417
|
+
['US-NY', 'New York'],
|
|
418
|
+
['US-NC', 'North Carolina'],
|
|
419
|
+
['US-ND', 'North Dakota'],
|
|
420
|
+
['US-OH', 'Ohio'],
|
|
421
|
+
['US-OK', 'Oklahoma'],
|
|
422
|
+
['US-OR', 'Oregon'],
|
|
423
|
+
['US-PA', 'Pennsylvania'],
|
|
424
|
+
['US-RI', 'Rhode Island'],
|
|
425
|
+
['US-SC', 'South Carolina'],
|
|
426
|
+
['US-SD', 'South Dakota'],
|
|
427
|
+
['US-TN', 'Tennessee'],
|
|
428
|
+
['US-TX', 'Texas'],
|
|
429
|
+
['US-UT', 'Utah'],
|
|
430
|
+
['US-VT', 'Vermont'],
|
|
431
|
+
['US-VA', 'Virginia'],
|
|
432
|
+
['US-WA', 'Washington'],
|
|
433
|
+
['US-WV', 'West Virginia'],
|
|
434
|
+
['US-WI', 'Wisconsin'],
|
|
435
|
+
['US-WY', 'Wyoming'],
|
|
436
|
+
['US-DC', 'District of Columbia'],
|
|
437
|
+
['US-AS', 'American Samoa'],
|
|
438
|
+
['US-GU', 'Guam'],
|
|
439
|
+
['US-MP', 'Northern Mariana Islands'],
|
|
440
|
+
['US-PR', 'Puerto Rico'],
|
|
441
|
+
['US-UM', 'United States Minor Outlying Islands'],
|
|
442
|
+
['US-VI', 'Virgin Islands, U.S.'],
|
|
443
|
+
]);
|
|
444
|
+
new Set([...isoCountries.keys(), ...usStates.keys()]);
|
|
382
445
|
const parseCache = new Map();
|
|
383
|
-
const
|
|
384
|
-
|
|
446
|
+
const parseRegions = (regionString) => {
|
|
447
|
+
const include = new Set();
|
|
448
|
+
const exclude = new Set();
|
|
449
|
+
if (regionString) {
|
|
450
|
+
const [a = '', b = ''] = regionString.split('|');
|
|
451
|
+
for (const item of a.split(',')) {
|
|
452
|
+
if (item) {
|
|
453
|
+
include.add(item);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
for (const item of b.split(',')) {
|
|
457
|
+
if (item) {
|
|
458
|
+
exclude.add(item);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return { include, exclude };
|
|
463
|
+
};
|
|
464
|
+
const doesGeoRequestMatchList = (requestCountry, requestRegion, isEUCountry, geoRegions) => {
|
|
465
|
+
if (!requestCountry || !geoRegions) {
|
|
385
466
|
return true;
|
|
386
467
|
}
|
|
387
|
-
let
|
|
388
|
-
if (!
|
|
389
|
-
|
|
390
|
-
parseCache.set(geoRegions,
|
|
468
|
+
let parsed = parseCache.get(geoRegions);
|
|
469
|
+
if (!parsed) {
|
|
470
|
+
parsed = parseRegions(geoRegions);
|
|
471
|
+
parseCache.set(geoRegions, parsed);
|
|
391
472
|
}
|
|
392
|
-
|
|
393
|
-
|
|
473
|
+
const entries = [requestCountry, `${requestCountry}-${requestRegion}`];
|
|
474
|
+
if (isEUCountry) {
|
|
475
|
+
entries.push('EU');
|
|
394
476
|
}
|
|
395
|
-
if (
|
|
396
|
-
|
|
477
|
+
if (parsed.include.size &&
|
|
478
|
+
entries.every((entry) => !parsed.include.has(entry))) {
|
|
479
|
+
return false;
|
|
397
480
|
}
|
|
398
|
-
|
|
481
|
+
if (parsed.exclude.size &&
|
|
482
|
+
entries.some((entry) => parsed.exclude.has(entry))) {
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
return true;
|
|
399
486
|
};
|
|
400
487
|
|
|
401
488
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
@@ -410,6 +497,7 @@ const initSettings = (destination, options) => {
|
|
|
410
497
|
stubs: [],
|
|
411
498
|
browserPackages: [],
|
|
412
499
|
channels: new Map(),
|
|
500
|
+
geoCountry: null,
|
|
413
501
|
geoRegion: null,
|
|
414
502
|
isEURequest: false,
|
|
415
503
|
...options,
|
|
@@ -833,7 +921,7 @@ const getStandardPayload = (destination, payload) => {
|
|
|
833
921
|
referrer: getReferrer(destination),
|
|
834
922
|
search: getSearch(destination),
|
|
835
923
|
locale: getLocale(),
|
|
836
|
-
sdkVersion: "1.
|
|
924
|
+
sdkVersion: "1.6.1" ,
|
|
837
925
|
...(payload || {}),
|
|
838
926
|
};
|
|
839
927
|
let storage = {};
|
|
@@ -1008,6 +1096,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
1008
1096
|
const providerPackages = getSetting(destination, 'browserPackages');
|
|
1009
1097
|
const configuredTags = getSetting(destination, 'channels');
|
|
1010
1098
|
const skipZeroPurchaseEvent = getSetting(destination, 'skipZeroPurchaseEvent') || false;
|
|
1099
|
+
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1011
1100
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1012
1101
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1013
1102
|
const userId = getUserId$1(destination);
|
|
@@ -1037,7 +1126,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
1037
1126
|
logger.log(`Consent is missing (${pkg.name}: ${variable.tagName})`);
|
|
1038
1127
|
continue;
|
|
1039
1128
|
}
|
|
1040
|
-
if (!doesGeoRequestMatchList(requestRegion, isEURequest, variable.geoRegions)) {
|
|
1129
|
+
if (!doesGeoRequestMatchList(requestCountry, requestRegion, isEURequest, variable.geoRegions)) {
|
|
1041
1130
|
logger.log('GEO request region does not match the filter, skiping');
|
|
1042
1131
|
continue;
|
|
1043
1132
|
}
|
|
@@ -1122,6 +1211,7 @@ const processData = (destination, data, providers, options) => {
|
|
|
1122
1211
|
const configuredTags = getSetting(destination, 'channels');
|
|
1123
1212
|
const userId = getUserId$1(destination);
|
|
1124
1213
|
const consent = getConsent$1(destination);
|
|
1214
|
+
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1125
1215
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1126
1216
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1127
1217
|
for (const pkg of providerPackages) {
|
|
@@ -1142,7 +1232,7 @@ const processData = (destination, data, providers, options) => {
|
|
|
1142
1232
|
logger.log(`Consent is missing for ${pkg.name} (${variable.tagName})`);
|
|
1143
1233
|
continue;
|
|
1144
1234
|
}
|
|
1145
|
-
if (!doesGeoRequestMatchList(requestRegion, isEURequest, variable.geoRegions)) {
|
|
1235
|
+
if (!doesGeoRequestMatchList(requestCountry, requestRegion, isEURequest, variable.geoRegions)) {
|
|
1146
1236
|
logger.log(`GEO request region does not match list, skipping`);
|
|
1147
1237
|
continue;
|
|
1148
1238
|
}
|
|
@@ -1211,6 +1301,7 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1211
1301
|
const userId = getUserId$1(destination);
|
|
1212
1302
|
const providerPackages = getSetting(destination, 'browserPackages');
|
|
1213
1303
|
const executionContext = new Map();
|
|
1304
|
+
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1214
1305
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1215
1306
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1216
1307
|
/* Calling Init for all provider instances based on consent check */
|
|
@@ -1224,7 +1315,7 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1224
1315
|
if (!hasConsent) {
|
|
1225
1316
|
continue;
|
|
1226
1317
|
}
|
|
1227
|
-
if (!doesGeoRequestMatchList(requestRegion, isEURequest, variable.geoRegions)) {
|
|
1318
|
+
if (!doesGeoRequestMatchList(requestCountry, requestRegion, isEURequest, variable.geoRegions)) {
|
|
1228
1319
|
continue;
|
|
1229
1320
|
}
|
|
1230
1321
|
pkg.init({
|
|
@@ -1447,7 +1538,7 @@ const handleManifest = (destination, response) => {
|
|
|
1447
1538
|
/* this defines if the consent is given for a specific instance of a provider */
|
|
1448
1539
|
const hasConsent = hasUserConsent(getSetting(destination, 'consent'), pkg.name, provider.tagName);
|
|
1449
1540
|
if (hasConsent &&
|
|
1450
|
-
doesGeoRequestMatchList(response.geoRegion, response.isEURequest, provider.geoRegions)) {
|
|
1541
|
+
doesGeoRequestMatchList(response.geoCountry, response.geoRegion, response.isEURequest, provider.geoRegions)) {
|
|
1451
1542
|
pkg.init({
|
|
1452
1543
|
userId,
|
|
1453
1544
|
isNewUser: !!response.isNewUser,
|
|
@@ -1551,6 +1642,7 @@ const handleInit = (preferences) => {
|
|
|
1551
1642
|
storageId: result.storageId,
|
|
1552
1643
|
currency: result.currency,
|
|
1553
1644
|
skipZeroPurchaseEvent: result.skipZeroPurchaseEvent,
|
|
1645
|
+
geoCountry: result.geoCountry,
|
|
1554
1646
|
geoRegion: result.geoRegion,
|
|
1555
1647
|
isEURequest: result.isEURequest,
|
|
1556
1648
|
});
|
|
@@ -1585,6 +1677,7 @@ const processUser = (destination, key, value, providers, options) => {
|
|
|
1585
1677
|
const configuredTags = getSetting(destination, 'channels');
|
|
1586
1678
|
const consent = getConsent$1(destination);
|
|
1587
1679
|
const userId = getUserId$1(destination);
|
|
1680
|
+
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1588
1681
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1589
1682
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1590
1683
|
for (const pkg of providerPackages) {
|
|
@@ -1605,7 +1698,7 @@ const processUser = (destination, key, value, providers, options) => {
|
|
|
1605
1698
|
logger.log(`User do not have consent for ${pkg.name} (${variable.tagName})`);
|
|
1606
1699
|
continue;
|
|
1607
1700
|
}
|
|
1608
|
-
if (!doesGeoRequestMatchList(requestRegion, isEURequest, variable.geoRegions)) {
|
|
1701
|
+
if (!doesGeoRequestMatchList(requestCountry, requestRegion, isEURequest, variable.geoRegions)) {
|
|
1609
1702
|
logger.log(`GEO request region does not match list, skipping`);
|
|
1610
1703
|
continue;
|
|
1611
1704
|
}
|
package/index.mjs
CHANGED
|
@@ -376,24 +376,111 @@ const isoCountries = new Map([
|
|
|
376
376
|
['ZM', 'Zambia'],
|
|
377
377
|
['ZW', 'Zimbabwe'],
|
|
378
378
|
]);
|
|
379
|
-
|
|
379
|
+
/**
|
|
380
|
+
* ISO-3166 US state ISO codes
|
|
381
|
+
* @see https://en.wikipedia.org/wiki/ISO_3166-2:US
|
|
382
|
+
* */
|
|
383
|
+
const usStates = new Map([
|
|
384
|
+
['US-AL', 'Alabama'],
|
|
385
|
+
['US-AK', 'Alaska'],
|
|
386
|
+
['US-AZ', 'Arizona'],
|
|
387
|
+
['US-AR', 'Arkansas'],
|
|
388
|
+
['US-CA', 'California'],
|
|
389
|
+
['US-CO', 'Colorado'],
|
|
390
|
+
['US-CT', 'Connecticut'],
|
|
391
|
+
['US-DE', 'Delaware'],
|
|
392
|
+
['US-FL', 'Florida'],
|
|
393
|
+
['US-GA', 'Georgia'],
|
|
394
|
+
['US-HI', 'Hawaii'],
|
|
395
|
+
['US-ID', 'Idaho'],
|
|
396
|
+
['US-IL', 'Illinois'],
|
|
397
|
+
['US-IN', 'Indiana'],
|
|
398
|
+
['US-IA', 'Iowa'],
|
|
399
|
+
['US-KS', 'Kansas'],
|
|
400
|
+
['US-KY', 'Kentucky'],
|
|
401
|
+
['US-LA', 'Louisiana'],
|
|
402
|
+
['US-ME', 'Maine'],
|
|
403
|
+
['US-MD', 'Maryland'],
|
|
404
|
+
['US-MA', 'Massachusetts'],
|
|
405
|
+
['US-MI', 'Michigan'],
|
|
406
|
+
['US-MN', 'Minnesota'],
|
|
407
|
+
['US-MS', 'Mississippi'],
|
|
408
|
+
['US-MO', 'Missouri'],
|
|
409
|
+
['US-MT', 'Montana'],
|
|
410
|
+
['US-NE', 'Nebraska'],
|
|
411
|
+
['US-NV', 'Nevada'],
|
|
412
|
+
['US-NH', 'New Hampshire'],
|
|
413
|
+
['US-NJ', 'New Jersey'],
|
|
414
|
+
['US-NM', 'New Mexico'],
|
|
415
|
+
['US-NY', 'New York'],
|
|
416
|
+
['US-NC', 'North Carolina'],
|
|
417
|
+
['US-ND', 'North Dakota'],
|
|
418
|
+
['US-OH', 'Ohio'],
|
|
419
|
+
['US-OK', 'Oklahoma'],
|
|
420
|
+
['US-OR', 'Oregon'],
|
|
421
|
+
['US-PA', 'Pennsylvania'],
|
|
422
|
+
['US-RI', 'Rhode Island'],
|
|
423
|
+
['US-SC', 'South Carolina'],
|
|
424
|
+
['US-SD', 'South Dakota'],
|
|
425
|
+
['US-TN', 'Tennessee'],
|
|
426
|
+
['US-TX', 'Texas'],
|
|
427
|
+
['US-UT', 'Utah'],
|
|
428
|
+
['US-VT', 'Vermont'],
|
|
429
|
+
['US-VA', 'Virginia'],
|
|
430
|
+
['US-WA', 'Washington'],
|
|
431
|
+
['US-WV', 'West Virginia'],
|
|
432
|
+
['US-WI', 'Wisconsin'],
|
|
433
|
+
['US-WY', 'Wyoming'],
|
|
434
|
+
['US-DC', 'District of Columbia'],
|
|
435
|
+
['US-AS', 'American Samoa'],
|
|
436
|
+
['US-GU', 'Guam'],
|
|
437
|
+
['US-MP', 'Northern Mariana Islands'],
|
|
438
|
+
['US-PR', 'Puerto Rico'],
|
|
439
|
+
['US-UM', 'United States Minor Outlying Islands'],
|
|
440
|
+
['US-VI', 'Virgin Islands, U.S.'],
|
|
441
|
+
]);
|
|
442
|
+
new Set([...isoCountries.keys(), ...usStates.keys()]);
|
|
380
443
|
const parseCache = new Map();
|
|
381
|
-
const
|
|
382
|
-
|
|
444
|
+
const parseRegions = (regionString) => {
|
|
445
|
+
const include = new Set();
|
|
446
|
+
const exclude = new Set();
|
|
447
|
+
if (regionString) {
|
|
448
|
+
const [a = '', b = ''] = regionString.split('|');
|
|
449
|
+
for (const item of a.split(',')) {
|
|
450
|
+
if (item) {
|
|
451
|
+
include.add(item);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
for (const item of b.split(',')) {
|
|
455
|
+
if (item) {
|
|
456
|
+
exclude.add(item);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return { include, exclude };
|
|
461
|
+
};
|
|
462
|
+
const doesGeoRequestMatchList = (requestCountry, requestRegion, isEUCountry, geoRegions) => {
|
|
463
|
+
if (!requestCountry || !geoRegions) {
|
|
383
464
|
return true;
|
|
384
465
|
}
|
|
385
|
-
let
|
|
386
|
-
if (!
|
|
387
|
-
|
|
388
|
-
parseCache.set(geoRegions,
|
|
466
|
+
let parsed = parseCache.get(geoRegions);
|
|
467
|
+
if (!parsed) {
|
|
468
|
+
parsed = parseRegions(geoRegions);
|
|
469
|
+
parseCache.set(geoRegions, parsed);
|
|
389
470
|
}
|
|
390
|
-
|
|
391
|
-
|
|
471
|
+
const entries = [requestCountry, `${requestCountry}-${requestRegion}`];
|
|
472
|
+
if (isEUCountry) {
|
|
473
|
+
entries.push('EU');
|
|
392
474
|
}
|
|
393
|
-
if (
|
|
394
|
-
|
|
475
|
+
if (parsed.include.size &&
|
|
476
|
+
entries.every((entry) => !parsed.include.has(entry))) {
|
|
477
|
+
return false;
|
|
395
478
|
}
|
|
396
|
-
|
|
479
|
+
if (parsed.exclude.size &&
|
|
480
|
+
entries.some((entry) => parsed.exclude.has(entry))) {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
return true;
|
|
397
484
|
};
|
|
398
485
|
|
|
399
486
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
@@ -408,6 +495,7 @@ const initSettings = (destination, options) => {
|
|
|
408
495
|
stubs: [],
|
|
409
496
|
browserPackages: [],
|
|
410
497
|
channels: new Map(),
|
|
498
|
+
geoCountry: null,
|
|
411
499
|
geoRegion: null,
|
|
412
500
|
isEURequest: false,
|
|
413
501
|
...options,
|
|
@@ -831,7 +919,7 @@ const getStandardPayload = (destination, payload) => {
|
|
|
831
919
|
referrer: getReferrer(destination),
|
|
832
920
|
search: getSearch(destination),
|
|
833
921
|
locale: getLocale(),
|
|
834
|
-
sdkVersion: "1.
|
|
922
|
+
sdkVersion: "1.6.1" ,
|
|
835
923
|
...(payload || {}),
|
|
836
924
|
};
|
|
837
925
|
let storage = {};
|
|
@@ -1006,6 +1094,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
1006
1094
|
const providerPackages = getSetting(destination, 'browserPackages');
|
|
1007
1095
|
const configuredTags = getSetting(destination, 'channels');
|
|
1008
1096
|
const skipZeroPurchaseEvent = getSetting(destination, 'skipZeroPurchaseEvent') || false;
|
|
1097
|
+
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1009
1098
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1010
1099
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1011
1100
|
const userId = getUserId$1(destination);
|
|
@@ -1035,7 +1124,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
1035
1124
|
logger.log(`Consent is missing (${pkg.name}: ${variable.tagName})`);
|
|
1036
1125
|
continue;
|
|
1037
1126
|
}
|
|
1038
|
-
if (!doesGeoRequestMatchList(requestRegion, isEURequest, variable.geoRegions)) {
|
|
1127
|
+
if (!doesGeoRequestMatchList(requestCountry, requestRegion, isEURequest, variable.geoRegions)) {
|
|
1039
1128
|
logger.log('GEO request region does not match the filter, skiping');
|
|
1040
1129
|
continue;
|
|
1041
1130
|
}
|
|
@@ -1120,6 +1209,7 @@ const processData = (destination, data, providers, options) => {
|
|
|
1120
1209
|
const configuredTags = getSetting(destination, 'channels');
|
|
1121
1210
|
const userId = getUserId$1(destination);
|
|
1122
1211
|
const consent = getConsent$1(destination);
|
|
1212
|
+
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1123
1213
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1124
1214
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1125
1215
|
for (const pkg of providerPackages) {
|
|
@@ -1140,7 +1230,7 @@ const processData = (destination, data, providers, options) => {
|
|
|
1140
1230
|
logger.log(`Consent is missing for ${pkg.name} (${variable.tagName})`);
|
|
1141
1231
|
continue;
|
|
1142
1232
|
}
|
|
1143
|
-
if (!doesGeoRequestMatchList(requestRegion, isEURequest, variable.geoRegions)) {
|
|
1233
|
+
if (!doesGeoRequestMatchList(requestCountry, requestRegion, isEURequest, variable.geoRegions)) {
|
|
1144
1234
|
logger.log(`GEO request region does not match list, skipping`);
|
|
1145
1235
|
continue;
|
|
1146
1236
|
}
|
|
@@ -1209,6 +1299,7 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1209
1299
|
const userId = getUserId$1(destination);
|
|
1210
1300
|
const providerPackages = getSetting(destination, 'browserPackages');
|
|
1211
1301
|
const executionContext = new Map();
|
|
1302
|
+
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1212
1303
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1213
1304
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1214
1305
|
/* Calling Init for all provider instances based on consent check */
|
|
@@ -1222,7 +1313,7 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1222
1313
|
if (!hasConsent) {
|
|
1223
1314
|
continue;
|
|
1224
1315
|
}
|
|
1225
|
-
if (!doesGeoRequestMatchList(requestRegion, isEURequest, variable.geoRegions)) {
|
|
1316
|
+
if (!doesGeoRequestMatchList(requestCountry, requestRegion, isEURequest, variable.geoRegions)) {
|
|
1226
1317
|
continue;
|
|
1227
1318
|
}
|
|
1228
1319
|
pkg.init({
|
|
@@ -1445,7 +1536,7 @@ const handleManifest = (destination, response) => {
|
|
|
1445
1536
|
/* this defines if the consent is given for a specific instance of a provider */
|
|
1446
1537
|
const hasConsent = hasUserConsent(getSetting(destination, 'consent'), pkg.name, provider.tagName);
|
|
1447
1538
|
if (hasConsent &&
|
|
1448
|
-
doesGeoRequestMatchList(response.geoRegion, response.isEURequest, provider.geoRegions)) {
|
|
1539
|
+
doesGeoRequestMatchList(response.geoCountry, response.geoRegion, response.isEURequest, provider.geoRegions)) {
|
|
1449
1540
|
pkg.init({
|
|
1450
1541
|
userId,
|
|
1451
1542
|
isNewUser: !!response.isNewUser,
|
|
@@ -1549,6 +1640,7 @@ const handleInit = (preferences) => {
|
|
|
1549
1640
|
storageId: result.storageId,
|
|
1550
1641
|
currency: result.currency,
|
|
1551
1642
|
skipZeroPurchaseEvent: result.skipZeroPurchaseEvent,
|
|
1643
|
+
geoCountry: result.geoCountry,
|
|
1552
1644
|
geoRegion: result.geoRegion,
|
|
1553
1645
|
isEURequest: result.isEURequest,
|
|
1554
1646
|
});
|
|
@@ -1583,6 +1675,7 @@ const processUser = (destination, key, value, providers, options) => {
|
|
|
1583
1675
|
const configuredTags = getSetting(destination, 'channels');
|
|
1584
1676
|
const consent = getConsent$1(destination);
|
|
1585
1677
|
const userId = getUserId$1(destination);
|
|
1678
|
+
const requestCountry = getSetting(destination, 'geoCountry') || null;
|
|
1586
1679
|
const requestRegion = getSetting(destination, 'geoRegion') || null;
|
|
1587
1680
|
const isEURequest = getSetting(destination, 'isEURequest') || false;
|
|
1588
1681
|
for (const pkg of providerPackages) {
|
|
@@ -1603,7 +1696,7 @@ const processUser = (destination, key, value, providers, options) => {
|
|
|
1603
1696
|
logger.log(`User do not have consent for ${pkg.name} (${variable.tagName})`);
|
|
1604
1697
|
continue;
|
|
1605
1698
|
}
|
|
1606
|
-
if (!doesGeoRequestMatchList(requestRegion, isEURequest, variable.geoRegions)) {
|
|
1699
|
+
if (!doesGeoRequestMatchList(requestCountry, requestRegion, isEURequest, variable.geoRegions)) {
|
|
1607
1700
|
logger.log(`GEO request region does not match list, skipping`);
|
|
1608
1701
|
continue;
|
|
1609
1702
|
}
|
package/internal.d.ts
CHANGED