@blotoutio/edgetag-sdk-js 1.24.2 → 1.26.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.cjs.js +26 -8
- package/index.mjs +26 -8
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -952,7 +952,7 @@ const getStandardPayload = (destination, payload) => {
|
|
|
952
952
|
referrer: getReferrer(destination),
|
|
953
953
|
search: getSearch(destination),
|
|
954
954
|
locale: getLocale(),
|
|
955
|
-
sdkVersion: "1.
|
|
955
|
+
sdkVersion: "1.26.0" ,
|
|
956
956
|
...(payload || {}),
|
|
957
957
|
};
|
|
958
958
|
let storage = {};
|
|
@@ -1022,6 +1022,9 @@ const getInitURL = (destination) => {
|
|
|
1022
1022
|
const getConsentURL = (destination) => {
|
|
1023
1023
|
return generateUrl(destination, '/consent');
|
|
1024
1024
|
};
|
|
1025
|
+
const getFullConsentURL = (destination) => {
|
|
1026
|
+
return generateUrl(destination, '/full-consent');
|
|
1027
|
+
};
|
|
1025
1028
|
const getUserURL = (destination) => {
|
|
1026
1029
|
return generateUrl(destination, '/user');
|
|
1027
1030
|
};
|
|
@@ -1394,6 +1397,8 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1394
1397
|
destination,
|
|
1395
1398
|
oldConsent: existingConsent,
|
|
1396
1399
|
newConsent: consent,
|
|
1400
|
+
oldConsentCategories: existingConsentCategories,
|
|
1401
|
+
newConsentCategories: consentCategories,
|
|
1397
1402
|
},
|
|
1398
1403
|
}));
|
|
1399
1404
|
}
|
|
@@ -1634,6 +1639,7 @@ const onReady = async (data) => {
|
|
|
1634
1639
|
isNewUser: data.isNewUser,
|
|
1635
1640
|
isNewSession: data.session.isNewSession,
|
|
1636
1641
|
consent: data.consent,
|
|
1642
|
+
consentCategories: data.consentCategories,
|
|
1637
1643
|
consentSetting: data.consentSetting,
|
|
1638
1644
|
};
|
|
1639
1645
|
resolved.add(callbackData);
|
|
@@ -1747,6 +1753,7 @@ const handleInit = (preferences) => {
|
|
|
1747
1753
|
userId: result.userId,
|
|
1748
1754
|
isNewUser: result.isNewUser,
|
|
1749
1755
|
consent: result.consent,
|
|
1756
|
+
consentCategories: result.consentCategories,
|
|
1750
1757
|
consentSetting: result.consentSetting,
|
|
1751
1758
|
session: result.session,
|
|
1752
1759
|
};
|
|
@@ -1847,20 +1854,31 @@ const handleKeys = (callback, options) => {
|
|
|
1847
1854
|
};
|
|
1848
1855
|
|
|
1849
1856
|
const processGetConsent = (destination, callback) => {
|
|
1850
|
-
getRequest(
|
|
1857
|
+
getRequest(getFullConsentURL(destination))
|
|
1851
1858
|
.then((result) => {
|
|
1852
1859
|
// this will try to return the consent data stored in Edge
|
|
1853
1860
|
return result === null || result === void 0 ? void 0 : result.result;
|
|
1854
1861
|
})
|
|
1855
1862
|
.catch(() => undefined)
|
|
1856
1863
|
.then((result) => {
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1864
|
+
var _a, _b;
|
|
1865
|
+
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
|
|
1866
|
+
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
|
|
1867
|
+
const consentArgument = consent || null;
|
|
1868
|
+
const consentCategoriesArgument = consentCategories || null;
|
|
1869
|
+
let errorMessage = null;
|
|
1870
|
+
if (!consentArgument) {
|
|
1871
|
+
if (!consentCategories) {
|
|
1872
|
+
errorMessage =
|
|
1873
|
+
'Consent and ConsentCategories not found for Current User!';
|
|
1874
|
+
}
|
|
1875
|
+
errorMessage = 'Consent not found for Current User!';
|
|
1860
1876
|
}
|
|
1861
|
-
else {
|
|
1862
|
-
|
|
1877
|
+
else if (!consentCategories) {
|
|
1878
|
+
errorMessage = 'ConsentCategories not found for Current User!';
|
|
1863
1879
|
}
|
|
1880
|
+
const errorArgument = errorMessage ? new Error(errorMessage) : undefined;
|
|
1881
|
+
callback(consentArgument, errorArgument, consentCategoriesArgument);
|
|
1864
1882
|
});
|
|
1865
1883
|
};
|
|
1866
1884
|
const handleGetConsent = (callback, options) => {
|
|
@@ -1870,7 +1888,7 @@ const handleGetConsent = (callback, options) => {
|
|
|
1870
1888
|
}
|
|
1871
1889
|
const instances = getInstances();
|
|
1872
1890
|
if (instances.length > 1) {
|
|
1873
|
-
callback(null, new Error('Multiple instances found! Please provide destination.'));
|
|
1891
|
+
callback(null, new Error('Multiple instances found! Please provide destination.'), null);
|
|
1874
1892
|
return;
|
|
1875
1893
|
}
|
|
1876
1894
|
processGetConsent(instances[0], callback);
|
package/index.mjs
CHANGED
|
@@ -950,7 +950,7 @@ const getStandardPayload = (destination, payload) => {
|
|
|
950
950
|
referrer: getReferrer(destination),
|
|
951
951
|
search: getSearch(destination),
|
|
952
952
|
locale: getLocale(),
|
|
953
|
-
sdkVersion: "1.
|
|
953
|
+
sdkVersion: "1.26.0" ,
|
|
954
954
|
...(payload || {}),
|
|
955
955
|
};
|
|
956
956
|
let storage = {};
|
|
@@ -1020,6 +1020,9 @@ const getInitURL = (destination) => {
|
|
|
1020
1020
|
const getConsentURL = (destination) => {
|
|
1021
1021
|
return generateUrl(destination, '/consent');
|
|
1022
1022
|
};
|
|
1023
|
+
const getFullConsentURL = (destination) => {
|
|
1024
|
+
return generateUrl(destination, '/full-consent');
|
|
1025
|
+
};
|
|
1023
1026
|
const getUserURL = (destination) => {
|
|
1024
1027
|
return generateUrl(destination, '/user');
|
|
1025
1028
|
};
|
|
@@ -1392,6 +1395,8 @@ const processConsent = (destination, consent, consentCategories, options) => {
|
|
|
1392
1395
|
destination,
|
|
1393
1396
|
oldConsent: existingConsent,
|
|
1394
1397
|
newConsent: consent,
|
|
1398
|
+
oldConsentCategories: existingConsentCategories,
|
|
1399
|
+
newConsentCategories: consentCategories,
|
|
1395
1400
|
},
|
|
1396
1401
|
}));
|
|
1397
1402
|
}
|
|
@@ -1632,6 +1637,7 @@ const onReady = async (data) => {
|
|
|
1632
1637
|
isNewUser: data.isNewUser,
|
|
1633
1638
|
isNewSession: data.session.isNewSession,
|
|
1634
1639
|
consent: data.consent,
|
|
1640
|
+
consentCategories: data.consentCategories,
|
|
1635
1641
|
consentSetting: data.consentSetting,
|
|
1636
1642
|
};
|
|
1637
1643
|
resolved.add(callbackData);
|
|
@@ -1745,6 +1751,7 @@ const handleInit = (preferences) => {
|
|
|
1745
1751
|
userId: result.userId,
|
|
1746
1752
|
isNewUser: result.isNewUser,
|
|
1747
1753
|
consent: result.consent,
|
|
1754
|
+
consentCategories: result.consentCategories,
|
|
1748
1755
|
consentSetting: result.consentSetting,
|
|
1749
1756
|
session: result.session,
|
|
1750
1757
|
};
|
|
@@ -1845,20 +1852,31 @@ const handleKeys = (callback, options) => {
|
|
|
1845
1852
|
};
|
|
1846
1853
|
|
|
1847
1854
|
const processGetConsent = (destination, callback) => {
|
|
1848
|
-
getRequest(
|
|
1855
|
+
getRequest(getFullConsentURL(destination))
|
|
1849
1856
|
.then((result) => {
|
|
1850
1857
|
// this will try to return the consent data stored in Edge
|
|
1851
1858
|
return result === null || result === void 0 ? void 0 : result.result;
|
|
1852
1859
|
})
|
|
1853
1860
|
.catch(() => undefined)
|
|
1854
1861
|
.then((result) => {
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1862
|
+
var _a, _b;
|
|
1863
|
+
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
|
|
1864
|
+
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
|
|
1865
|
+
const consentArgument = consent || null;
|
|
1866
|
+
const consentCategoriesArgument = consentCategories || null;
|
|
1867
|
+
let errorMessage = null;
|
|
1868
|
+
if (!consentArgument) {
|
|
1869
|
+
if (!consentCategories) {
|
|
1870
|
+
errorMessage =
|
|
1871
|
+
'Consent and ConsentCategories not found for Current User!';
|
|
1872
|
+
}
|
|
1873
|
+
errorMessage = 'Consent not found for Current User!';
|
|
1858
1874
|
}
|
|
1859
|
-
else {
|
|
1860
|
-
|
|
1875
|
+
else if (!consentCategories) {
|
|
1876
|
+
errorMessage = 'ConsentCategories not found for Current User!';
|
|
1861
1877
|
}
|
|
1878
|
+
const errorArgument = errorMessage ? new Error(errorMessage) : undefined;
|
|
1879
|
+
callback(consentArgument, errorArgument, consentCategoriesArgument);
|
|
1862
1880
|
});
|
|
1863
1881
|
};
|
|
1864
1882
|
const handleGetConsent = (callback, options) => {
|
|
@@ -1868,7 +1886,7 @@ const handleGetConsent = (callback, options) => {
|
|
|
1868
1886
|
}
|
|
1869
1887
|
const instances = getInstances();
|
|
1870
1888
|
if (instances.length > 1) {
|
|
1871
|
-
callback(null, new Error('Multiple instances found! Please provide destination.'));
|
|
1889
|
+
callback(null, new Error('Multiple instances found! Please provide destination.'), null);
|
|
1872
1890
|
return;
|
|
1873
1891
|
}
|
|
1874
1892
|
processGetConsent(instances[0], callback);
|