@blotoutio/edgetag-sdk-browser 0.34.0 → 0.35.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.js +32 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
__proto__: null,
|
|
6
6
|
get consent () { return consent; },
|
|
7
7
|
get data () { return data; },
|
|
8
|
+
get getConsent () { return getConsent; },
|
|
8
9
|
get getData () { return getData; },
|
|
9
10
|
get getUserId () { return getUserId; },
|
|
10
11
|
get init () { return init; },
|
|
@@ -335,7 +336,7 @@
|
|
|
335
336
|
referrer: getReferrer(),
|
|
336
337
|
search: getSearch(),
|
|
337
338
|
locale: getLocale(),
|
|
338
|
-
sdkVersion: "0.
|
|
339
|
+
sdkVersion: "0.35.1" ,
|
|
339
340
|
...(payload || {}),
|
|
340
341
|
};
|
|
341
342
|
let storage = {};
|
|
@@ -439,7 +440,7 @@
|
|
|
439
440
|
const setConsent = (newConsent) => {
|
|
440
441
|
memoryConsent = newConsent;
|
|
441
442
|
};
|
|
442
|
-
const getConsent = () => {
|
|
443
|
+
const getConsent$1 = () => {
|
|
443
444
|
const storageConsent = getDataPerKey('local', tagStorage, consentKey);
|
|
444
445
|
if (storageConsent) {
|
|
445
446
|
return storageConsent;
|
|
@@ -615,7 +616,7 @@
|
|
|
615
616
|
const configuredTags = getConfiguredTags();
|
|
616
617
|
const userId = handleGetUserId();
|
|
617
618
|
const providerData = {};
|
|
618
|
-
const consent = getConsent();
|
|
619
|
+
const consent = getConsent$1();
|
|
619
620
|
for (const pkg of Object.values(providerPackages)) {
|
|
620
621
|
if (!pkg || !pkg.name || !pkg.tag) {
|
|
621
622
|
continue;
|
|
@@ -682,7 +683,7 @@
|
|
|
682
683
|
const providerPackages = getProvidersPackage();
|
|
683
684
|
const configuredTags = getConfiguredTags();
|
|
684
685
|
const userId = handleGetUserId();
|
|
685
|
-
const consent = getConsent();
|
|
686
|
+
const consent = getConsent$1();
|
|
686
687
|
for (const pkg of Object.values(providerPackages)) {
|
|
687
688
|
if (!pkg || !pkg.user || !pkg.name) {
|
|
688
689
|
continue;
|
|
@@ -881,7 +882,7 @@
|
|
|
881
882
|
if (result.userId) {
|
|
882
883
|
setUserId(result.userId);
|
|
883
884
|
}
|
|
884
|
-
const consent = getConsent();
|
|
885
|
+
const consent = getConsent$1();
|
|
885
886
|
if (result.consent && !consent) {
|
|
886
887
|
saveConsent(result.consent);
|
|
887
888
|
}
|
|
@@ -900,7 +901,7 @@
|
|
|
900
901
|
});
|
|
901
902
|
const providerPackages = getProvidersPackage();
|
|
902
903
|
const configuredTags = getConfiguredTags();
|
|
903
|
-
const consent = getConsent();
|
|
904
|
+
const consent = getConsent$1();
|
|
904
905
|
const userId = handleGetUserId();
|
|
905
906
|
for (const pkg of Object.values(providerPackages)) {
|
|
906
907
|
if (!pkg || !pkg.name || !pkg.user) {
|
|
@@ -942,6 +943,24 @@
|
|
|
942
943
|
.catch(error);
|
|
943
944
|
};
|
|
944
945
|
|
|
946
|
+
const handleGetConsent = (callback) => {
|
|
947
|
+
getRequest(getConsentURL())
|
|
948
|
+
.then((result) => {
|
|
949
|
+
// this will try to return the consent data stored in Edge
|
|
950
|
+
return result === null || result === void 0 ? void 0 : result.result;
|
|
951
|
+
})
|
|
952
|
+
.catch(() => undefined)
|
|
953
|
+
.then((result) => {
|
|
954
|
+
const consent = result !== null && result !== void 0 ? result : getConsent$1(); // this is a default value i.e. value from local storage and memory incase Edge doesn't have consent
|
|
955
|
+
if (consent) {
|
|
956
|
+
callback(consent);
|
|
957
|
+
}
|
|
958
|
+
else {
|
|
959
|
+
callback(null, new Error('Consent not found for Current User!'));
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
};
|
|
963
|
+
|
|
945
964
|
const init = (preferences) => {
|
|
946
965
|
handleInit(preferences);
|
|
947
966
|
};
|
|
@@ -966,6 +985,9 @@
|
|
|
966
985
|
const getUserId = () => {
|
|
967
986
|
return handleGetUserId();
|
|
968
987
|
};
|
|
988
|
+
const getConsent = (callback) => {
|
|
989
|
+
handleGetConsent(callback);
|
|
990
|
+
};
|
|
969
991
|
|
|
970
992
|
// TODO https://github.com/blotoutio/solutions/issues/826
|
|
971
993
|
|
|
@@ -1001,6 +1023,10 @@
|
|
|
1001
1023
|
getUserId() {
|
|
1002
1024
|
return getUserId()
|
|
1003
1025
|
}
|
|
1026
|
+
|
|
1027
|
+
getConsent(callback, error) {
|
|
1028
|
+
getConsent(callback);
|
|
1029
|
+
}
|
|
1004
1030
|
}
|
|
1005
1031
|
|
|
1006
1032
|
var api = new API();
|