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