@blotoutio/edgetag-sdk-browser 1.24.2 → 1.25.0
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 +26 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -953,7 +953,7 @@
|
|
|
953
953
|
referrer: getReferrer(destination),
|
|
954
954
|
search: getSearch(destination),
|
|
955
955
|
locale: getLocale(),
|
|
956
|
-
sdkVersion: "1.
|
|
956
|
+
sdkVersion: "1.25.0" ,
|
|
957
957
|
...(payload || {}),
|
|
958
958
|
};
|
|
959
959
|
let storage = {};
|
|
@@ -1023,6 +1023,9 @@
|
|
|
1023
1023
|
const getConsentURL = (destination) => {
|
|
1024
1024
|
return generateUrl(destination, '/consent');
|
|
1025
1025
|
};
|
|
1026
|
+
const getFullConsentURL = (destination) => {
|
|
1027
|
+
return generateUrl(destination, '/full-consent');
|
|
1028
|
+
};
|
|
1026
1029
|
const getUserURL = (destination) => {
|
|
1027
1030
|
return generateUrl(destination, '/user');
|
|
1028
1031
|
};
|
|
@@ -1395,6 +1398,8 @@
|
|
|
1395
1398
|
destination,
|
|
1396
1399
|
oldConsent: existingConsent,
|
|
1397
1400
|
newConsent: consent,
|
|
1401
|
+
oldConsentCategories: existingConsentCategories,
|
|
1402
|
+
newConsentCategories: consentCategories,
|
|
1398
1403
|
},
|
|
1399
1404
|
}));
|
|
1400
1405
|
}
|
|
@@ -1635,6 +1640,7 @@
|
|
|
1635
1640
|
isNewUser: data.isNewUser,
|
|
1636
1641
|
isNewSession: data.session.isNewSession,
|
|
1637
1642
|
consent: data.consent,
|
|
1643
|
+
consentCategories: data.consentCategories,
|
|
1638
1644
|
consentSetting: data.consentSetting,
|
|
1639
1645
|
};
|
|
1640
1646
|
resolved.add(callbackData);
|
|
@@ -1748,6 +1754,7 @@
|
|
|
1748
1754
|
userId: result.userId,
|
|
1749
1755
|
isNewUser: result.isNewUser,
|
|
1750
1756
|
consent: result.consent,
|
|
1757
|
+
consentCategories: result.consentCategories,
|
|
1751
1758
|
consentSetting: result.consentSetting,
|
|
1752
1759
|
session: result.session,
|
|
1753
1760
|
};
|
|
@@ -1848,20 +1855,31 @@
|
|
|
1848
1855
|
};
|
|
1849
1856
|
|
|
1850
1857
|
const processGetConsent = (destination, callback) => {
|
|
1851
|
-
getRequest(
|
|
1858
|
+
getRequest(getFullConsentURL(destination))
|
|
1852
1859
|
.then((result) => {
|
|
1853
1860
|
// this will try to return the consent data stored in Edge
|
|
1854
1861
|
return result === null || result === void 0 ? void 0 : result.result;
|
|
1855
1862
|
})
|
|
1856
1863
|
.catch(() => undefined)
|
|
1857
1864
|
.then((result) => {
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1865
|
+
var _a, _b;
|
|
1866
|
+
const consent = (_a = result === null || result === void 0 ? void 0 : result.consent) !== null && _a !== void 0 ? _a : getConsent$1(destination); // this is a default value i.e. value from local storage and memory incase Edge doesn't have consent
|
|
1867
|
+
const consentCategories = (_b = result === null || result === void 0 ? void 0 : result.consentCategories) !== null && _b !== void 0 ? _b : getConsentCategories(destination); // this is a default value i.e. value from local storage and memory incase Edge doesn't have consent
|
|
1868
|
+
const consentArgument = consent || null;
|
|
1869
|
+
const consentCategoriesArgument = consentCategories || null;
|
|
1870
|
+
let errorMessage = null;
|
|
1871
|
+
if (!consentArgument) {
|
|
1872
|
+
if (!consentCategories) {
|
|
1873
|
+
errorMessage =
|
|
1874
|
+
'Consent and ConsentCategories not found for Current User!';
|
|
1875
|
+
}
|
|
1876
|
+
errorMessage = 'Consent not found for Current User!';
|
|
1861
1877
|
}
|
|
1862
|
-
else {
|
|
1863
|
-
|
|
1878
|
+
else if (!consentCategories) {
|
|
1879
|
+
errorMessage = 'ConsentCategories not found for Current User!';
|
|
1864
1880
|
}
|
|
1881
|
+
const errorArgument = errorMessage ? new Error(errorMessage) : undefined;
|
|
1882
|
+
callback(consentArgument, errorArgument, consentCategoriesArgument);
|
|
1865
1883
|
});
|
|
1866
1884
|
};
|
|
1867
1885
|
const handleGetConsent = (callback, options) => {
|
|
@@ -1871,7 +1889,7 @@
|
|
|
1871
1889
|
}
|
|
1872
1890
|
const instances = getInstances();
|
|
1873
1891
|
if (instances.length > 1) {
|
|
1874
|
-
callback(null, new Error('Multiple instances found! Please provide destination.'));
|
|
1892
|
+
callback(null, new Error('Multiple instances found! Please provide destination.'), null);
|
|
1875
1893
|
return;
|
|
1876
1894
|
}
|
|
1877
1895
|
processGetConsent(instances[0], callback);
|