@blotoutio/edgetag-sdk-browser 0.60.0 → 0.60.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 +25 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -278,6 +278,7 @@
|
|
|
278
278
|
const consentKey = 'consent';
|
|
279
279
|
const keyPrefix = `_worker`;
|
|
280
280
|
const cookieKey = 'tag_user_id';
|
|
281
|
+
const fallbackSessionKey = 'fallback_tag_user_id';
|
|
281
282
|
|
|
282
283
|
const getMessage = (error) => {
|
|
283
284
|
if (error instanceof Error) {
|
|
@@ -549,7 +550,7 @@
|
|
|
549
550
|
referrer: getReferrer(destination),
|
|
550
551
|
search: getSearch(destination),
|
|
551
552
|
locale: getLocale(),
|
|
552
|
-
sdkVersion: "0.60.
|
|
553
|
+
sdkVersion: "0.60.1" ,
|
|
553
554
|
...(payload || {}),
|
|
554
555
|
};
|
|
555
556
|
let storage = {};
|
|
@@ -1097,6 +1098,26 @@
|
|
|
1097
1098
|
if (!browserPackages) {
|
|
1098
1099
|
return;
|
|
1099
1100
|
}
|
|
1101
|
+
let fallbackId;
|
|
1102
|
+
try {
|
|
1103
|
+
fallbackId = preferences.fallbackUserId;
|
|
1104
|
+
if (!fallbackId) {
|
|
1105
|
+
const fallbackSessionValue = sessionStorage.getItem(fallbackSessionKey);
|
|
1106
|
+
if (!fallbackSessionValue) {
|
|
1107
|
+
const randomId = crypto.randomUUID();
|
|
1108
|
+
if (randomId) {
|
|
1109
|
+
fallbackId = `${randomId}-${Date.now()}`;
|
|
1110
|
+
sessionStorage.setItem(fallbackSessionKey, fallbackId);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
else {
|
|
1114
|
+
fallbackId = fallbackSessionValue;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
catch {
|
|
1119
|
+
// do nothing
|
|
1120
|
+
}
|
|
1100
1121
|
if (preferences.afterManifestEvents) {
|
|
1101
1122
|
setSetting(preferences.edgeURL, {
|
|
1102
1123
|
stubs: preferences.afterManifestEvents,
|
|
@@ -1111,6 +1132,9 @@
|
|
|
1111
1132
|
setSetting(preferences.edgeURL, { userId: preferences.userId });
|
|
1112
1133
|
url.searchParams.set('userId', preferences.userId);
|
|
1113
1134
|
}
|
|
1135
|
+
if (fallbackId) {
|
|
1136
|
+
url.searchParams.set('fallbackUserId', fallbackId);
|
|
1137
|
+
}
|
|
1114
1138
|
getRequest(url.href)
|
|
1115
1139
|
.then((result) => {
|
|
1116
1140
|
var _a;
|