@blotoutio/edgetag-sdk-js 0.22.1 → 0.22.3
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 +15 -5
- package/index.esm.js +15 -5
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -276,6 +276,9 @@ const allowProviderWithConsent = (providers, providerId) => {
|
|
|
276
276
|
}
|
|
277
277
|
return true;
|
|
278
278
|
};
|
|
279
|
+
const checkProviderConsent = (providerId) => {
|
|
280
|
+
return checkConsent({ [providerId]: true });
|
|
281
|
+
};
|
|
279
282
|
|
|
280
283
|
const tagStorage = 'edgeTag';
|
|
281
284
|
const consentKey = 'consent';
|
|
@@ -509,7 +512,7 @@ const getStandardPayload = (payload) => {
|
|
|
509
512
|
referrer: getReferrer(),
|
|
510
513
|
search: getSearch(),
|
|
511
514
|
locale: getLocale(),
|
|
512
|
-
sdkVersion: "0.22.
|
|
515
|
+
sdkVersion: "0.22.3" ,
|
|
513
516
|
...(payload || {}),
|
|
514
517
|
};
|
|
515
518
|
let storage = {};
|
|
@@ -557,12 +560,14 @@ const saveConsent = (consent) => {
|
|
|
557
560
|
setConsent(consent);
|
|
558
561
|
savePerKey('local', tagStorage, consent, consentKey);
|
|
559
562
|
};
|
|
560
|
-
const handleConsent = (consent) => {
|
|
563
|
+
const handleConsent = (consent, options) => {
|
|
561
564
|
const payload = {
|
|
562
565
|
consentString: consent,
|
|
563
566
|
};
|
|
564
567
|
saveConsent(consent);
|
|
565
|
-
|
|
568
|
+
if (!(options === null || options === void 0 ? void 0 : options.localSave)) {
|
|
569
|
+
postRequest(getConsentURL(), payload).catch(error);
|
|
570
|
+
}
|
|
566
571
|
};
|
|
567
572
|
const setConsent = (newConsent) => {
|
|
568
573
|
memoryConsent = newConsent;
|
|
@@ -650,6 +655,7 @@ const handleTag = (eventName, data = {}, providers, options) => {
|
|
|
650
655
|
if (!pkg ||
|
|
651
656
|
!pkg.name ||
|
|
652
657
|
!pkg.tag ||
|
|
658
|
+
!checkProviderConsent(pkg.name) ||
|
|
653
659
|
!allowProviderWithConsent(providers, pkg.name)) {
|
|
654
660
|
return;
|
|
655
661
|
}
|
|
@@ -857,6 +863,10 @@ const handleInit = (preferences) => {
|
|
|
857
863
|
if (result.userId) {
|
|
858
864
|
setUserId(result.userId);
|
|
859
865
|
}
|
|
866
|
+
const consent = getConsent();
|
|
867
|
+
if (result.consent && !consent) {
|
|
868
|
+
saveConsent(result.consent);
|
|
869
|
+
}
|
|
860
870
|
handleManifest(result.result);
|
|
861
871
|
})
|
|
862
872
|
.catch(error);
|
|
@@ -908,8 +918,8 @@ const init = (preferences) => {
|
|
|
908
918
|
const tag = (name, data, providers, options) => {
|
|
909
919
|
handleTag(name, data, providers, options);
|
|
910
920
|
};
|
|
911
|
-
const consent = (consent) => {
|
|
912
|
-
handleConsent(consent);
|
|
921
|
+
const consent = (consent, options) => {
|
|
922
|
+
handleConsent(consent, options);
|
|
913
923
|
};
|
|
914
924
|
const user = (key, value, providers, options) => {
|
|
915
925
|
handleUser(key, value, providers, options);
|
package/index.esm.js
CHANGED
|
@@ -274,6 +274,9 @@ const allowProviderWithConsent = (providers, providerId) => {
|
|
|
274
274
|
}
|
|
275
275
|
return true;
|
|
276
276
|
};
|
|
277
|
+
const checkProviderConsent = (providerId) => {
|
|
278
|
+
return checkConsent({ [providerId]: true });
|
|
279
|
+
};
|
|
277
280
|
|
|
278
281
|
const tagStorage = 'edgeTag';
|
|
279
282
|
const consentKey = 'consent';
|
|
@@ -507,7 +510,7 @@ const getStandardPayload = (payload) => {
|
|
|
507
510
|
referrer: getReferrer(),
|
|
508
511
|
search: getSearch(),
|
|
509
512
|
locale: getLocale(),
|
|
510
|
-
sdkVersion: "0.22.
|
|
513
|
+
sdkVersion: "0.22.3" ,
|
|
511
514
|
...(payload || {}),
|
|
512
515
|
};
|
|
513
516
|
let storage = {};
|
|
@@ -555,12 +558,14 @@ const saveConsent = (consent) => {
|
|
|
555
558
|
setConsent(consent);
|
|
556
559
|
savePerKey('local', tagStorage, consent, consentKey);
|
|
557
560
|
};
|
|
558
|
-
const handleConsent = (consent) => {
|
|
561
|
+
const handleConsent = (consent, options) => {
|
|
559
562
|
const payload = {
|
|
560
563
|
consentString: consent,
|
|
561
564
|
};
|
|
562
565
|
saveConsent(consent);
|
|
563
|
-
|
|
566
|
+
if (!(options === null || options === void 0 ? void 0 : options.localSave)) {
|
|
567
|
+
postRequest(getConsentURL(), payload).catch(error);
|
|
568
|
+
}
|
|
564
569
|
};
|
|
565
570
|
const setConsent = (newConsent) => {
|
|
566
571
|
memoryConsent = newConsent;
|
|
@@ -648,6 +653,7 @@ const handleTag = (eventName, data = {}, providers, options) => {
|
|
|
648
653
|
if (!pkg ||
|
|
649
654
|
!pkg.name ||
|
|
650
655
|
!pkg.tag ||
|
|
656
|
+
!checkProviderConsent(pkg.name) ||
|
|
651
657
|
!allowProviderWithConsent(providers, pkg.name)) {
|
|
652
658
|
return;
|
|
653
659
|
}
|
|
@@ -855,6 +861,10 @@ const handleInit = (preferences) => {
|
|
|
855
861
|
if (result.userId) {
|
|
856
862
|
setUserId(result.userId);
|
|
857
863
|
}
|
|
864
|
+
const consent = getConsent();
|
|
865
|
+
if (result.consent && !consent) {
|
|
866
|
+
saveConsent(result.consent);
|
|
867
|
+
}
|
|
858
868
|
handleManifest(result.result);
|
|
859
869
|
})
|
|
860
870
|
.catch(error);
|
|
@@ -906,8 +916,8 @@ const init = (preferences) => {
|
|
|
906
916
|
const tag = (name, data, providers, options) => {
|
|
907
917
|
handleTag(name, data, providers, options);
|
|
908
918
|
};
|
|
909
|
-
const consent = (consent) => {
|
|
910
|
-
handleConsent(consent);
|
|
919
|
+
const consent = (consent, options) => {
|
|
920
|
+
handleConsent(consent, options);
|
|
911
921
|
};
|
|
912
922
|
const user = (key, value, providers, options) => {
|
|
913
923
|
handleUser(key, value, providers, options);
|