@mparticle/web-rokt-kit 1.36.0 → 3.1.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/dist/Rokt-Kit.common.js +1 -1
- package/dist/Rokt-Kit.d.ts +8 -3
- package/dist/Rokt-Kit.esm.js +259 -242
- package/dist/Rokt-Kit.iife.js +1 -1
- package/package.json +60 -61
package/dist/Rokt-Kit.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Ee = [
|
|
2
2
|
"active_time_on_site_ms",
|
|
3
3
|
"billingaddress1",
|
|
4
4
|
"billingaddress2",
|
|
@@ -23,31 +23,31 @@ const Ie = [
|
|
|
23
23
|
"shippingstate",
|
|
24
24
|
"shippingzipcode",
|
|
25
25
|
"totalprice"
|
|
26
|
-
],
|
|
26
|
+
], _e = new Set(Ee);
|
|
27
27
|
function se(i) {
|
|
28
|
-
return
|
|
28
|
+
return _e.has(i.toLowerCase());
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function T(i) {
|
|
31
31
|
const e = {}, t = i || {}, n = Object.keys(t);
|
|
32
32
|
for (let r = 0; r < n.length; r++) {
|
|
33
|
-
const
|
|
34
|
-
se(
|
|
33
|
+
const s = n[r];
|
|
34
|
+
se(s) || (e[s] = t[s]);
|
|
35
35
|
}
|
|
36
36
|
return e;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function E(i) {
|
|
39
39
|
return typeof i == "object" && i !== null && !Array.isArray(i);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function m(i) {
|
|
42
42
|
return typeof i == "string";
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function b(i) {
|
|
45
45
|
return typeof i == "function";
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function C(i) {
|
|
48
48
|
return i == null ? !0 : typeof i == "object" ? Object.keys(i).length === 0 : !1;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function F(i) {
|
|
51
51
|
try {
|
|
52
52
|
const e = new URL(i);
|
|
53
53
|
return e.search = "", e.toString();
|
|
@@ -55,15 +55,15 @@ function x(i) {
|
|
|
55
55
|
return i;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
const
|
|
59
|
-
function
|
|
58
|
+
const H = "__rokt_ls_probe__";
|
|
59
|
+
function K() {
|
|
60
60
|
try {
|
|
61
|
-
return window.localStorage.setItem(
|
|
61
|
+
return window.localStorage.setItem(H, "1"), window.localStorage.removeItem(H), !0;
|
|
62
62
|
} catch {
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function x(i) {
|
|
67
67
|
try {
|
|
68
68
|
const e = window.localStorage.getItem(i);
|
|
69
69
|
return e === null ? null : JSON.parse(e);
|
|
@@ -71,95 +71,82 @@ function N(i) {
|
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function oe(i, e) {
|
|
75
75
|
try {
|
|
76
76
|
return window.localStorage.setItem(i, JSON.stringify(e)), !0;
|
|
77
77
|
} catch {
|
|
78
78
|
return !1;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Se(i) {
|
|
82
82
|
try {
|
|
83
83
|
window.localStorage.removeItem(i);
|
|
84
84
|
} catch {
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const t =
|
|
89
|
-
return
|
|
87
|
+
function Y(i, e) {
|
|
88
|
+
const t = x(i);
|
|
89
|
+
return E(t) ? t[e] : void 0;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const n =
|
|
93
|
-
return r[e] = t,
|
|
91
|
+
function ae(i, e, t) {
|
|
92
|
+
const n = x(i), r = E(n) ? { ...n } : {};
|
|
93
|
+
return r[e] = t, oe(i, r);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
const t =
|
|
97
|
-
if (!
|
|
95
|
+
function ce(i, e) {
|
|
96
|
+
const t = x(i);
|
|
97
|
+
if (!E(t) || !(e in t))
|
|
98
98
|
return;
|
|
99
99
|
const n = { ...t };
|
|
100
|
-
delete n[e], Object.keys(n).length === 0 ?
|
|
100
|
+
delete n[e], Object.keys(n).length === 0 ? Se(i) : oe(i, n);
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
function
|
|
104
|
-
return i.slice(-
|
|
102
|
+
const _ = "mp-rokt-kit", j = "pageViews", O = "utmParams", le = 25, Ie = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
|
|
103
|
+
function ue(i) {
|
|
104
|
+
return i.slice(-le);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
return;
|
|
110
|
-
!(U(p, R) !== void 0) && Array.isArray(e) && (i?.log({
|
|
111
|
-
message: "Rokt Kit: Migrating legacy page-view storage",
|
|
112
|
-
code: "PAGE_VIEW_LEGACY_MIGRATION"
|
|
113
|
-
}), Y(p, R, e) || i?.log({
|
|
114
|
-
message: "Rokt Kit: Failed to migrate legacy page-view storage [reason: migration_retry]",
|
|
115
|
-
code: "PAGE_VIEW_CAPTURE_FAILED"
|
|
116
|
-
})), ce(H);
|
|
117
|
-
}
|
|
118
|
-
function z(i) {
|
|
119
|
-
he(i);
|
|
120
|
-
const e = U(p, R);
|
|
121
|
-
return Array.isArray(e) ? e : [];
|
|
106
|
+
function V() {
|
|
107
|
+
const i = Y(_, j);
|
|
108
|
+
return Array.isArray(i) ? i : [];
|
|
122
109
|
}
|
|
123
|
-
function
|
|
124
|
-
const e =
|
|
110
|
+
function Ae(i) {
|
|
111
|
+
const e = ue(i);
|
|
125
112
|
for (let t = 0; t < e.length; t++) {
|
|
126
113
|
const n = e.slice(t);
|
|
127
|
-
if (
|
|
114
|
+
if (ae(_, j, n))
|
|
128
115
|
return n.length;
|
|
129
116
|
}
|
|
130
117
|
return 0;
|
|
131
118
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
119
|
+
function z() {
|
|
120
|
+
ce(_, j);
|
|
134
121
|
}
|
|
135
|
-
function
|
|
136
|
-
const e =
|
|
122
|
+
function ye(i) {
|
|
123
|
+
const e = ue(i);
|
|
137
124
|
return e.map((t, n) => {
|
|
138
|
-
const r = t.activeTimeOnSite,
|
|
125
|
+
const r = t.activeTimeOnSite, s = r !== void 0 && Number.isFinite(r), c = e[n + 1]?.activeTimeOnSite, u = c !== void 0 && Number.isFinite(c), l = s && u ? c - r : void 0;
|
|
139
126
|
return {
|
|
140
127
|
pageUrl: t.pageUrl,
|
|
141
128
|
sourceMessageId: t.sourceMessageId,
|
|
142
129
|
timestamp: t.timestamp,
|
|
143
130
|
...t.pageTitle !== void 0 ? { pageTitle: t.pageTitle } : {},
|
|
144
131
|
...t.canonicalUrl !== void 0 ? { canonicalUrl: t.canonicalUrl } : {},
|
|
145
|
-
...
|
|
132
|
+
...s ? { activeTimeOnSite: r } : {},
|
|
146
133
|
...l !== void 0 && l >= 0 ? { activeTimeOnPage: l } : {}
|
|
147
134
|
};
|
|
148
135
|
});
|
|
149
136
|
}
|
|
150
|
-
function
|
|
151
|
-
if (
|
|
137
|
+
function ke(i) {
|
|
138
|
+
if (Y(_, O) !== void 0)
|
|
152
139
|
return;
|
|
153
140
|
const e = new URLSearchParams(window.location.search), t = {};
|
|
154
|
-
for (const r of
|
|
155
|
-
const
|
|
156
|
-
|
|
141
|
+
for (const r of Ie) {
|
|
142
|
+
const s = e.get(r);
|
|
143
|
+
s && (t[r] = s);
|
|
157
144
|
}
|
|
158
145
|
if (Object.keys(t).length === 0)
|
|
159
146
|
return;
|
|
160
147
|
const n = Object.keys(t).join(", ");
|
|
161
|
-
if (!
|
|
162
|
-
const r =
|
|
148
|
+
if (!ae(_, O, t)) {
|
|
149
|
+
const r = K() ? "quota" : "ls_unavailable";
|
|
163
150
|
i?.log({
|
|
164
151
|
message: `Rokt Kit: Failed to persist UTM params [reason: ${r}]`,
|
|
165
152
|
code: "UTM_CAPTURE_FAILED"
|
|
@@ -171,33 +158,45 @@ function Re(i) {
|
|
|
171
158
|
code: "UTM_CAPTURE_SUCCESS"
|
|
172
159
|
});
|
|
173
160
|
}
|
|
174
|
-
function
|
|
175
|
-
const i =
|
|
176
|
-
return
|
|
161
|
+
function Re() {
|
|
162
|
+
const i = Y(_, O);
|
|
163
|
+
return E(i) ? i : null;
|
|
177
164
|
}
|
|
178
165
|
function $() {
|
|
179
|
-
|
|
166
|
+
ce(_, O);
|
|
180
167
|
}
|
|
181
|
-
function
|
|
168
|
+
function ve() {
|
|
182
169
|
const e = document.querySelector('link[rel="canonical"]')?.href;
|
|
183
170
|
if (e)
|
|
184
|
-
return
|
|
171
|
+
return F(e);
|
|
185
172
|
}
|
|
186
|
-
function
|
|
173
|
+
function M(i, e) {
|
|
174
|
+
return {
|
|
175
|
+
message: `Rokt Kit: ${i} called [attributeKeys=${e.join(",")}]`,
|
|
176
|
+
code: "ATTRIBUTE_SETTER_CALLED"
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function we(i) {
|
|
180
|
+
return {
|
|
181
|
+
message: `Rokt Kit: selectPlacements dispatched [placementAttributeKeys=${i.join(",")}]`,
|
|
182
|
+
code: "SELECT_PLACEMENTS_DISPATCHED"
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function Te() {
|
|
187
186
|
return {
|
|
188
187
|
context: null,
|
|
189
188
|
lifecycle: "idle",
|
|
190
189
|
recreateInFlight: null
|
|
191
190
|
};
|
|
192
191
|
}
|
|
193
|
-
function
|
|
192
|
+
function be(i, e) {
|
|
194
193
|
i.context = {
|
|
195
194
|
accountId: e.accountId,
|
|
196
195
|
launcherOptions: { ...e.launcherOptions },
|
|
197
196
|
legacyRoktExtensions: [...e.legacyRoktExtensions]
|
|
198
197
|
};
|
|
199
198
|
}
|
|
200
|
-
function
|
|
199
|
+
function Le(i) {
|
|
201
200
|
i.lifecycle = "attached";
|
|
202
201
|
}
|
|
203
202
|
function Pe(i) {
|
|
@@ -220,37 +219,37 @@ function Ue(i, e, t) {
|
|
|
220
219
|
i.recreateInFlight = null;
|
|
221
220
|
}), i.recreateInFlight;
|
|
222
221
|
}
|
|
223
|
-
const d = "Rokt",
|
|
222
|
+
const d = "Rokt", L = 181, Ce = "selectPlacements", Me = "apps.roktecommerce.com", Ke = 0.1, De = "ThankYouPageJourney", Fe = "rokt-launcher", xe = "rokt-thank-you-element", Ye = "userIdentifiedInWorkspace", je = 3, We = 2, Ge = "page_events", He = "page_view_attributes", Ve = "mparticle_session_id", ze = "mparticle_device_id", q = 500, W = {
|
|
224
223
|
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
225
224
|
UNHANDLED_EXCEPTION: "UNHANDLED_EXCEPTION",
|
|
226
225
|
IDENTITY_REQUEST: "IDENTITY_REQUEST",
|
|
227
226
|
LOG_DELIVERY_FAILURE: "LOG_DELIVERY_FAILURE"
|
|
228
|
-
},
|
|
227
|
+
}, A = {
|
|
229
228
|
ERROR: "ERROR",
|
|
230
229
|
INFO: "INFO",
|
|
231
230
|
WARNING: "WARNING"
|
|
232
|
-
},
|
|
231
|
+
}, $e = "apps.rokt-api.com", qe = "/v1/log", Be = "/v1/errors", Je = 10;
|
|
233
232
|
function a() {
|
|
234
233
|
return window.mParticle;
|
|
235
234
|
}
|
|
236
235
|
function B(i, e) {
|
|
237
|
-
const n = [
|
|
236
|
+
const n = [N(i), "/wsdk/integrations/launcher.js"].join("");
|
|
238
237
|
return !e || e.length === 0 ? n : n + "?extensions=" + e.join(",");
|
|
239
238
|
}
|
|
240
|
-
function
|
|
241
|
-
return [
|
|
239
|
+
function J(i) {
|
|
240
|
+
return [N(i), "/rokt-elements/rokt-element-thank-you.js"].join("");
|
|
242
241
|
}
|
|
243
|
-
function
|
|
244
|
-
const e = typeof i < "u" ? i :
|
|
242
|
+
function N(i) {
|
|
243
|
+
const e = typeof i < "u" ? i : $e;
|
|
245
244
|
return e.includes("://") ? e.replace(/\/+$/, "") : ["https://", e].join("");
|
|
246
245
|
}
|
|
247
|
-
function
|
|
246
|
+
function de(i, e, t) {
|
|
248
247
|
if (i)
|
|
249
248
|
return i.startsWith("http://") || i.startsWith("https://") ? i : "https://" + i;
|
|
250
249
|
const r = e?.includes("://") && !/^https?:\/\//i.test(e) ? void 0 : e;
|
|
251
|
-
return
|
|
250
|
+
return N(r) + t;
|
|
252
251
|
}
|
|
253
|
-
function
|
|
252
|
+
function Q(i, e, t) {
|
|
254
253
|
if (document.getElementById(i)) return;
|
|
255
254
|
const n = document.head || document.body, r = document.createElement("script");
|
|
256
255
|
r.id = i, r.type = "text/javascript", r.src = e, r.async = !0, r.crossOrigin = "anonymous", r.fetchPriority = "high", t?.onLoad && (r.onload = t.onLoad), t?.onError && (r.onerror = t.onError), n.appendChild(r);
|
|
@@ -265,12 +264,12 @@ function P(i) {
|
|
|
265
264
|
}
|
|
266
265
|
return [];
|
|
267
266
|
}
|
|
268
|
-
function
|
|
267
|
+
function X(i) {
|
|
269
268
|
const e = i ? P(i) : [], t = [], n = [];
|
|
270
269
|
let r = !1;
|
|
271
|
-
for (let
|
|
272
|
-
const
|
|
273
|
-
|
|
270
|
+
for (let s = 0; s < e.length; s++) {
|
|
271
|
+
const o = e[s].value;
|
|
272
|
+
o === "thank-you-journey" ? (r = !0, n.push(De)) : t.push(o);
|
|
274
273
|
}
|
|
275
274
|
return {
|
|
276
275
|
roktExtensionsQueryParams: t,
|
|
@@ -285,7 +284,7 @@ async function Qe(i, e) {
|
|
|
285
284
|
t.push(e.use(n));
|
|
286
285
|
return Promise.all(t);
|
|
287
286
|
}
|
|
288
|
-
function
|
|
287
|
+
function Z(i) {
|
|
289
288
|
if (!i)
|
|
290
289
|
return {};
|
|
291
290
|
const e = {};
|
|
@@ -295,30 +294,30 @@ function ee(i) {
|
|
|
295
294
|
}
|
|
296
295
|
return e;
|
|
297
296
|
}
|
|
298
|
-
function
|
|
297
|
+
function ee(i) {
|
|
299
298
|
const e = {};
|
|
300
299
|
if (!Array.isArray(i))
|
|
301
300
|
return e;
|
|
302
301
|
for (let t = 0; t < i.length; t++) {
|
|
303
302
|
const n = i[t];
|
|
304
|
-
if (!n || !
|
|
303
|
+
if (!n || !m(n.value) || !m(n.map))
|
|
305
304
|
continue;
|
|
306
|
-
const r = n.value,
|
|
305
|
+
const r = n.value, s = n.map;
|
|
307
306
|
e[r] || (e[r] = []), e[r].push({
|
|
308
|
-
eventAttributeKey:
|
|
307
|
+
eventAttributeKey: s,
|
|
309
308
|
conditions: Array.isArray(n.conditions) ? n.conditions : []
|
|
310
309
|
});
|
|
311
310
|
}
|
|
312
311
|
return e;
|
|
313
312
|
}
|
|
314
|
-
function
|
|
313
|
+
function te(i, e, t) {
|
|
315
314
|
return a().generateHash([i, e, t].join(""));
|
|
316
315
|
}
|
|
317
316
|
function Xe(i) {
|
|
318
|
-
let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "1.
|
|
317
|
+
let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "3.1.0";
|
|
319
318
|
return i && (n += "_" + i), n;
|
|
320
319
|
}
|
|
321
|
-
function
|
|
320
|
+
function he(i) {
|
|
322
321
|
let e = 5381;
|
|
323
322
|
for (let t = 0; t < i.length; t++)
|
|
324
323
|
e = (e << 5) + e + i.charCodeAt(t), e = e & e;
|
|
@@ -332,16 +331,16 @@ function D(i) {
|
|
|
332
331
|
const t = document.body || document.head;
|
|
333
332
|
t && t.appendChild(e);
|
|
334
333
|
}
|
|
335
|
-
function
|
|
336
|
-
const t =
|
|
337
|
-
if (
|
|
334
|
+
function ie(i, e) {
|
|
335
|
+
const t = he(window.location.origin);
|
|
336
|
+
if (y._allowedOriginHashes.indexOf(t) === -1 || Math.random() >= Ke)
|
|
338
337
|
return;
|
|
339
338
|
const r = window.__rokt_li_guid__;
|
|
340
339
|
if (!r || i && i.includes("://") && !/^https:\/\//i.test(i))
|
|
341
340
|
return;
|
|
342
|
-
const
|
|
343
|
-
D(c + "/v1/wsdk-init/index.html?" +
|
|
344
|
-
"https://" + Me + "/v1/wsdk-init/index.html?" +
|
|
341
|
+
const s = window.location.href.split("?")[0].split("#")[0], o = "version=" + encodeURIComponent(e ?? "") + "&launcherInstanceGuid=" + encodeURIComponent(r) + "&pageUrl=" + encodeURIComponent(s), c = i ? N(i) : "https://apps.rokt.com";
|
|
342
|
+
D(c + "/v1/wsdk-init/index.html?" + o), D(
|
|
343
|
+
"https://" + Me + "/v1/wsdk-init/index.html?" + o + "&isControl=true"
|
|
345
344
|
);
|
|
346
345
|
}
|
|
347
346
|
function Ze() {
|
|
@@ -353,22 +352,22 @@ function et() {
|
|
|
353
352
|
function tt() {
|
|
354
353
|
return typeof window < "u" ? window.navigator?.userAgent : void 0;
|
|
355
354
|
}
|
|
356
|
-
class
|
|
355
|
+
class ge {
|
|
357
356
|
constructor() {
|
|
358
357
|
this._logCount = {};
|
|
359
358
|
}
|
|
360
359
|
incrementAndCheck(e) {
|
|
361
360
|
const n = (this._logCount[e] || 0) + 1;
|
|
362
|
-
return this._logCount[e] = n, n >
|
|
361
|
+
return this._logCount[e] = n, n > Je;
|
|
363
362
|
}
|
|
364
363
|
}
|
|
365
|
-
class
|
|
366
|
-
constructor(e, t, n, r,
|
|
364
|
+
class R {
|
|
365
|
+
constructor(e, t, n, r, s) {
|
|
367
366
|
this._reporter = "mp-wsdk";
|
|
368
|
-
const
|
|
369
|
-
this._integrationName = t || "", this._launcherInstanceGuid = n, this._accountId = r || null, this._rateLimiter =
|
|
367
|
+
const o = e.isLoggingEnabled;
|
|
368
|
+
this._integrationName = t || "", this._launcherInstanceGuid = n, this._accountId = r || null, this._rateLimiter = s || new ge(), this._isEnabled = Ze() || o;
|
|
370
369
|
}
|
|
371
|
-
send(e, t, n, r,
|
|
370
|
+
send(e, t, n, r, s, o) {
|
|
372
371
|
if (!(!this._isEnabled || this._rateLimiter.incrementAndCheck(t)))
|
|
373
372
|
try {
|
|
374
373
|
const c = {
|
|
@@ -377,10 +376,10 @@ class W {
|
|
|
377
376
|
version: this._integrationName
|
|
378
377
|
},
|
|
379
378
|
severity: t,
|
|
380
|
-
code: r ||
|
|
379
|
+
code: r || W.UNKNOWN_ERROR,
|
|
381
380
|
url: et(),
|
|
382
381
|
deviceInfo: tt(),
|
|
383
|
-
stackTrace:
|
|
382
|
+
stackTrace: s,
|
|
384
383
|
reporter: this._reporter,
|
|
385
384
|
integration: this._integrationName
|
|
386
385
|
}, u = {
|
|
@@ -399,41 +398,55 @@ class W {
|
|
|
399
398
|
throw g.statusCode = l.status, g;
|
|
400
399
|
}
|
|
401
400
|
}).catch((l) => {
|
|
402
|
-
console.error("ReportingTransport: Failed to send log", l),
|
|
401
|
+
console.error("ReportingTransport: Failed to send log", l), o && o(l);
|
|
403
402
|
});
|
|
404
403
|
} catch (c) {
|
|
405
|
-
console.error("ReportingTransport: Failed to send log", c),
|
|
404
|
+
console.error("ReportingTransport: Failed to send log", c), o && o(c);
|
|
406
405
|
}
|
|
407
406
|
}
|
|
408
407
|
}
|
|
409
|
-
class
|
|
410
|
-
constructor(e, t, n, r,
|
|
411
|
-
this._transport = new
|
|
408
|
+
class ne {
|
|
409
|
+
constructor(e, t, n, r, s) {
|
|
410
|
+
this._transport = new R(e, t, n, r, s), this._errorUrl = de(e?.errorUrl, e?.integrationDomain, Be);
|
|
412
411
|
}
|
|
413
412
|
report(e) {
|
|
414
413
|
if (!e) return;
|
|
415
|
-
const t = e.severity ||
|
|
414
|
+
const t = e.severity || A.ERROR;
|
|
416
415
|
this._transport.send(this._errorUrl, t, e.message, e.code, e.stackTrace);
|
|
417
416
|
}
|
|
418
417
|
}
|
|
419
|
-
class
|
|
420
|
-
constructor(e, t, n, r,
|
|
421
|
-
this._transport = new
|
|
418
|
+
class re {
|
|
419
|
+
constructor(e, t, n, r, s, o) {
|
|
420
|
+
this._transport = new R(e, n, r, s, o), this._diagnosticTransport = new R(e, n, r, s), this._placementDiagnosticTransport = new R(
|
|
421
|
+
e,
|
|
422
|
+
n,
|
|
423
|
+
r,
|
|
424
|
+
s
|
|
425
|
+
), this._loggingUrl = de(e?.loggingUrl, e?.integrationDomain, qe), this._errorReportingService = t;
|
|
422
426
|
}
|
|
423
427
|
log(e) {
|
|
424
|
-
e && this._transport
|
|
428
|
+
e && this._send(this._transport, e);
|
|
429
|
+
}
|
|
430
|
+
logDiagnostic(e) {
|
|
431
|
+
e && this._send(this._diagnosticTransport, e);
|
|
432
|
+
}
|
|
433
|
+
logPlacementDiagnostic(e) {
|
|
434
|
+
e && this._send(this._placementDiagnosticTransport, e);
|
|
435
|
+
}
|
|
436
|
+
_send(e, t) {
|
|
437
|
+
e.send(
|
|
425
438
|
this._loggingUrl,
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
439
|
+
A.INFO,
|
|
440
|
+
t.message,
|
|
441
|
+
t.code,
|
|
429
442
|
void 0,
|
|
430
|
-
(
|
|
443
|
+
(n) => {
|
|
431
444
|
if (this._errorReportingService) {
|
|
432
|
-
const
|
|
445
|
+
const r = typeof n.statusCode == "number";
|
|
433
446
|
this._errorReportingService.report({
|
|
434
|
-
message: "LoggingService: Failed to send log: " +
|
|
435
|
-
code:
|
|
436
|
-
severity:
|
|
447
|
+
message: "LoggingService: Failed to send log: " + n.message,
|
|
448
|
+
code: W.LOG_DELIVERY_FAILURE,
|
|
449
|
+
severity: r ? A.ERROR : A.WARNING
|
|
437
450
|
});
|
|
438
451
|
}
|
|
439
452
|
}
|
|
@@ -441,7 +454,7 @@ class oe {
|
|
|
441
454
|
}
|
|
442
455
|
}
|
|
443
456
|
function it(i) {
|
|
444
|
-
const e =
|
|
457
|
+
const e = F(window.location.href), t = i.EventAttributes?.title || document.title, n = ve(), r = i.ActiveTimeOnSite;
|
|
445
458
|
return {
|
|
446
459
|
pageUrl: e,
|
|
447
460
|
sourceMessageId: i.SourceMessageId,
|
|
@@ -451,9 +464,9 @@ function it(i) {
|
|
|
451
464
|
...Number.isFinite(r) ? { activeTimeOnSite: r } : {}
|
|
452
465
|
};
|
|
453
466
|
}
|
|
454
|
-
const
|
|
467
|
+
const f = class f {
|
|
455
468
|
constructor() {
|
|
456
|
-
this.name = d, this.id =
|
|
469
|
+
this.name = d, this.id = L, this.moduleId = L, this.isInitialized = !1, this.launcher = null, this.filters = {}, this.userAttributes = {}, this.userIdentifiedInWorkspace = !1, this.testHelpers = null, this.placementEventMappingLookup = {}, this.placementEventAttributeMappingLookup = {}, this.integrationName = null, this.errorReportingService = null, this.loggingService = null, this._thankYouElementOnLoadCallback = null, this._isThankYouElementLoaded = !1, this._workspaceSearchInFlightPromise = null, this._launcherAttachState = Te();
|
|
457
470
|
}
|
|
458
471
|
// ---- Private helpers ----
|
|
459
472
|
getEventAttributeValue(e, t) {
|
|
@@ -461,13 +474,13 @@ const m = class m {
|
|
|
461
474
|
return !n || typeof n[t] > "u" ? null : n[t];
|
|
462
475
|
}
|
|
463
476
|
doesEventAttributeConditionMatch(e, t) {
|
|
464
|
-
if (!e || !
|
|
477
|
+
if (!e || !m(e.operator))
|
|
465
478
|
return !1;
|
|
466
479
|
const n = e.operator.toLowerCase(), r = e.attributeValue;
|
|
467
480
|
return n === "exists" ? t !== null : t == null ? !1 : n === "equals" ? String(t) === String(r) : n === "contains" ? String(t).indexOf(String(r)) !== -1 : !1;
|
|
468
481
|
}
|
|
469
482
|
doesEventMatchRule(e, t) {
|
|
470
|
-
if (!t || !
|
|
483
|
+
if (!t || !m(t.eventAttributeKey))
|
|
471
484
|
return !1;
|
|
472
485
|
const n = t.conditions;
|
|
473
486
|
if (!Array.isArray(n))
|
|
@@ -475,53 +488,53 @@ const m = class m {
|
|
|
475
488
|
const r = this.getEventAttributeValue(e, t.eventAttributeKey);
|
|
476
489
|
if (n.length === 0)
|
|
477
490
|
return r !== null;
|
|
478
|
-
for (let
|
|
479
|
-
if (!this.doesEventAttributeConditionMatch(n[
|
|
491
|
+
for (let s = 0; s < n.length; s++)
|
|
492
|
+
if (!this.doesEventAttributeConditionMatch(n[s], r))
|
|
480
493
|
return !1;
|
|
481
494
|
return !0;
|
|
482
495
|
}
|
|
483
496
|
applyPlacementEventAttributeMapping(e) {
|
|
484
497
|
const t = Object.keys(this.placementEventAttributeMappingLookup);
|
|
485
498
|
for (let n = 0; n < t.length; n++) {
|
|
486
|
-
const r = t[n],
|
|
487
|
-
if (
|
|
499
|
+
const r = t[n], s = this.placementEventAttributeMappingLookup[r];
|
|
500
|
+
if (C(s))
|
|
488
501
|
continue;
|
|
489
|
-
let
|
|
490
|
-
for (let c = 0; c <
|
|
491
|
-
if (!this.doesEventMatchRule(e,
|
|
492
|
-
|
|
502
|
+
let o = !0;
|
|
503
|
+
for (let c = 0; c < s.length; c++)
|
|
504
|
+
if (!this.doesEventMatchRule(e, s[c])) {
|
|
505
|
+
o = !1;
|
|
493
506
|
break;
|
|
494
507
|
}
|
|
495
|
-
|
|
508
|
+
o && a().Rokt.setLocalSessionAttribute?.(r, !0);
|
|
496
509
|
}
|
|
497
510
|
}
|
|
498
511
|
capturePageView(e) {
|
|
499
512
|
let t;
|
|
500
513
|
try {
|
|
501
|
-
t =
|
|
502
|
-
const n =
|
|
514
|
+
t = F(window.location.href);
|
|
515
|
+
const n = V(), r = it(e);
|
|
503
516
|
n.push(r);
|
|
504
|
-
const
|
|
505
|
-
if (
|
|
506
|
-
const c =
|
|
517
|
+
const s = Math.min(n.length, le), o = Ae(n);
|
|
518
|
+
if (o === 0) {
|
|
519
|
+
const c = K() ? "quota" : "ls_unavailable";
|
|
507
520
|
this.loggingService?.log({
|
|
508
521
|
message: `Rokt Kit: Failed to persist page view for ${t} [reason: ${c}]`,
|
|
509
522
|
code: "PAGE_VIEW_CAPTURE_FAILED"
|
|
510
523
|
});
|
|
511
|
-
} else
|
|
512
|
-
message: `Rokt Kit: Page view storage reduced from ${
|
|
524
|
+
} else o < s && this.loggingService?.log({
|
|
525
|
+
message: `Rokt Kit: Page view storage reduced from ${s} to ${o} record(s) under quota pressure [reason: quota_eviction]`,
|
|
513
526
|
code: "PAGE_VIEW_QUOTA_EVICTION"
|
|
514
527
|
});
|
|
515
528
|
} catch (n) {
|
|
516
|
-
const r =
|
|
529
|
+
const r = K() ? "exception" : "ls_unavailable", s = n instanceof Error ? n.message : String(n);
|
|
517
530
|
this.loggingService?.log({
|
|
518
|
-
message: `Rokt Kit: Failed to capture page view for ${t}: ${
|
|
531
|
+
message: `Rokt Kit: Failed to capture page view for ${t}: ${s} [reason: ${r}]`,
|
|
519
532
|
code: "PAGE_VIEW_CAPTURE_FAILED"
|
|
520
533
|
});
|
|
521
534
|
}
|
|
522
535
|
}
|
|
523
536
|
isLauncherReadyToAttach() {
|
|
524
|
-
return !!window.Rokt &&
|
|
537
|
+
return !!window.Rokt && b(window.Rokt.createLauncher);
|
|
525
538
|
}
|
|
526
539
|
/**
|
|
527
540
|
* Returns the user identities from the filtered user, if any.
|
|
@@ -537,10 +550,10 @@ const m = class m {
|
|
|
537
550
|
}
|
|
538
551
|
replaceOtherIdentityWithEmailsha256(e) {
|
|
539
552
|
const t = { ...e || {} }, n = this._mappedEmailSha256Key;
|
|
540
|
-
return n && e[n] && (t[
|
|
553
|
+
return n && e[n] && (t[f.EMAIL_SHA256_KEY] = e[n]), n && delete t[n], t;
|
|
541
554
|
}
|
|
542
555
|
logSelectPlacementsEvent(e) {
|
|
543
|
-
if (!window.mParticle || typeof a().logEvent != "function" || !
|
|
556
|
+
if (!window.mParticle || typeof a().logEvent != "function" || !E(e))
|
|
544
557
|
return;
|
|
545
558
|
const t = a().EventType.Other;
|
|
546
559
|
a().logEvent(Ce, t, e);
|
|
@@ -549,7 +562,7 @@ const m = class m {
|
|
|
549
562
|
if (!(!e || typeof e != "string"))
|
|
550
563
|
try {
|
|
551
564
|
const t = a().getInstance();
|
|
552
|
-
t &&
|
|
565
|
+
t && b(t.setIntegrationAttribute) && t.setIntegrationAttribute(L, {
|
|
553
566
|
roktSessionId: e
|
|
554
567
|
});
|
|
555
568
|
} catch {
|
|
@@ -557,14 +570,14 @@ const m = class m {
|
|
|
557
570
|
}
|
|
558
571
|
readMpSessionId() {
|
|
559
572
|
const e = a()?.sessionManager, t = e?.getSessionId ?? e?.getSession;
|
|
560
|
-
if (
|
|
573
|
+
if (b(t))
|
|
561
574
|
return t.call(e) || void 0;
|
|
562
575
|
}
|
|
563
576
|
readMpDeviceId() {
|
|
564
577
|
return a()?.getDeviceId?.() || void 0;
|
|
565
578
|
}
|
|
566
579
|
attachLauncher(e, t, n = []) {
|
|
567
|
-
|
|
580
|
+
be(this._launcherAttachState, {
|
|
568
581
|
accountId: e,
|
|
569
582
|
launcherOptions: t || {},
|
|
570
583
|
legacyRoktExtensions: n
|
|
@@ -573,11 +586,11 @@ const m = class m {
|
|
|
573
586
|
accountId: e,
|
|
574
587
|
...t || {}
|
|
575
588
|
};
|
|
576
|
-
let
|
|
577
|
-
return this.isPartnerInLocalLauncherTestGroup() ?
|
|
578
|
-
await Qe([...n],
|
|
579
|
-
}).catch((
|
|
580
|
-
Oe(this._launcherAttachState), console.error("Error creating Rokt launcher:",
|
|
589
|
+
let s;
|
|
590
|
+
return this.isPartnerInLocalLauncherTestGroup() ? s = Promise.resolve(window.Rokt.createLocalLauncher(r)) : s = window.Rokt.createLauncher(r), s.then(async (o) => {
|
|
591
|
+
await Qe([...n], o), this.initRoktLauncher(o);
|
|
592
|
+
}).catch((o) => {
|
|
593
|
+
Oe(this._launcherAttachState), console.error("Error creating Rokt launcher:", o);
|
|
581
594
|
});
|
|
582
595
|
}
|
|
583
596
|
recreateLauncherIfTerminated() {
|
|
@@ -588,16 +601,16 @@ const m = class m {
|
|
|
588
601
|
);
|
|
589
602
|
}
|
|
590
603
|
initRoktLauncher(e) {
|
|
591
|
-
window.Rokt && (window.Rokt.currentLauncher = e), this.launcher = e,
|
|
604
|
+
window.Rokt && (window.Rokt.currentLauncher = e), this.launcher = e, Le(this._launcherAttachState);
|
|
592
605
|
const t = a().Rokt?.filters;
|
|
593
|
-
t ? (this.filters = t, t.filteredUser ? this._workspaceSearchInFlightPromise = this.search(t.filteredUser) : console.warn("Rokt Kit: No filtered user has been set.")) : console.warn("Rokt Kit: No filters have been set."), this.isInitialized = !0,
|
|
606
|
+
t ? (this.filters = t, t.filteredUser ? this._workspaceSearchInFlightPromise = this.search(t.filteredUser) : console.warn("Rokt Kit: No filtered user has been set.")) : console.warn("Rokt Kit: No filters have been set."), this.isInitialized = !0, ie(this.domain, this.integrationName), a().Rokt.attachKit(this);
|
|
594
607
|
}
|
|
595
608
|
fetchOptimizely() {
|
|
596
609
|
const e = a()._getActiveForwarders().filter((t) => t.name === "Optimizely");
|
|
597
610
|
try {
|
|
598
611
|
if (e.length > 0 && window.optimizely) {
|
|
599
612
|
const t = window.optimizely.get("state");
|
|
600
|
-
return !t || !t.getActiveExperimentIds ? {} : t.getActiveExperimentIds().reduce((
|
|
613
|
+
return !t || !t.getActiveExperimentIds ? {} : t.getActiveExperimentIds().reduce((s, o) => (s["rokt.custom.optimizely.experiment." + o + ".variationId"] = t.getVariationMap()[o].id, s), {});
|
|
601
614
|
}
|
|
602
615
|
} catch (t) {
|
|
603
616
|
console.error("Error fetching Optimizely attributes:", t);
|
|
@@ -625,91 +638,91 @@ const m = class m {
|
|
|
625
638
|
/**
|
|
626
639
|
* Initializes the Rokt forwarder with settings from the mParticle server.
|
|
627
640
|
*/
|
|
628
|
-
init(e, t, n, r,
|
|
629
|
-
const
|
|
630
|
-
this.userAttributes =
|
|
631
|
-
const u = P(
|
|
632
|
-
this.placementEventMappingLookup =
|
|
641
|
+
init(e, t, n, r, s) {
|
|
642
|
+
const o = e, c = o.accountId;
|
|
643
|
+
this.userAttributes = T(s), this._onboardingExpProvider = o.onboardingExpProvider;
|
|
644
|
+
const u = P(o.placementEventMapping);
|
|
645
|
+
this.placementEventMappingLookup = Z(u);
|
|
633
646
|
const l = P(
|
|
634
|
-
|
|
647
|
+
o.placementEventAttributeMapping
|
|
635
648
|
);
|
|
636
|
-
this.placementEventAttributeMappingLookup =
|
|
637
|
-
const g = a().Rokt?.domain, { roktExtensionsQueryParams:
|
|
638
|
-
|
|
639
|
-
),
|
|
649
|
+
this.placementEventAttributeMappingLookup = ee(l), o.hashedEmailUserIdentityType && (this._mappedEmailSha256Key = o.hashedEmailUserIdentityType.toLowerCase()), this._workspaceIdSyncApiKey = m(o.workspaceIdSyncApiKey) ? o.workspaceIdSyncApiKey : void 0;
|
|
650
|
+
const g = a().Rokt?.domain, { roktExtensionsQueryParams: U, legacyRoktExtensions: v, loadThankYouElement: w } = X(
|
|
651
|
+
o.roktExtensions
|
|
652
|
+
), p = {
|
|
640
653
|
...a().Rokt?.launcherOptions || {}
|
|
641
654
|
};
|
|
642
|
-
this.integrationName = Xe(
|
|
643
|
-
const
|
|
644
|
-
loggingUrl:
|
|
645
|
-
errorUrl:
|
|
655
|
+
this.integrationName = Xe(p.integrationName), p.integrationName = this.integrationName, this.domain = g;
|
|
656
|
+
const k = {
|
|
657
|
+
loggingUrl: o.loggingUrl,
|
|
658
|
+
errorUrl: o.errorUrl,
|
|
646
659
|
integrationDomain: g,
|
|
647
660
|
isLoggingEnabled: a().config?.isLoggingEnabled === !0
|
|
648
|
-
},
|
|
649
|
-
|
|
661
|
+
}, S = new ne(
|
|
662
|
+
k,
|
|
650
663
|
this.integrationName,
|
|
651
664
|
window.__rokt_li_guid__,
|
|
652
|
-
|
|
653
|
-
),
|
|
654
|
-
|
|
655
|
-
|
|
665
|
+
o.accountId
|
|
666
|
+
), I = new re(
|
|
667
|
+
k,
|
|
668
|
+
S,
|
|
656
669
|
this.integrationName,
|
|
657
670
|
window.__rokt_li_guid__,
|
|
658
|
-
|
|
671
|
+
o.accountId
|
|
659
672
|
);
|
|
660
|
-
if (this.errorReportingService =
|
|
673
|
+
if (this.errorReportingService = S, this.loggingService = I, this.isTargetingDisabled())
|
|
661
674
|
try {
|
|
662
|
-
|
|
675
|
+
z(), $();
|
|
663
676
|
} catch (h) {
|
|
664
677
|
this.errorReportingService?.report({
|
|
665
678
|
message: "Rokt Kit: Failed to clear page views when targeting is disabled",
|
|
666
679
|
code: "PAGE_VIEW_CAPTURE_FAILED",
|
|
667
|
-
severity:
|
|
680
|
+
severity: A.INFO,
|
|
668
681
|
stackTrace: h instanceof Error ? h.stack : void 0
|
|
669
682
|
});
|
|
670
683
|
}
|
|
671
|
-
return a()._registerErrorReportingService && a()._registerErrorReportingService(
|
|
684
|
+
return a()._registerErrorReportingService && a()._registerErrorReportingService(S), a()._registerLoggingService && a()._registerLoggingService(I), n ? (this.testHelpers = {
|
|
672
685
|
generateLauncherScript: B,
|
|
673
|
-
generateThankYouElementScript:
|
|
674
|
-
extractRoktExtensionConfig:
|
|
675
|
-
hashEventMessage:
|
|
686
|
+
generateThankYouElementScript: J,
|
|
687
|
+
extractRoktExtensionConfig: X,
|
|
688
|
+
hashEventMessage: te,
|
|
676
689
|
parseSettingsString: P,
|
|
677
|
-
generateMappedEventLookup:
|
|
678
|
-
generateMappedEventAttributeLookup:
|
|
679
|
-
sendAdBlockMeasurementSignals:
|
|
690
|
+
generateMappedEventLookup: Z,
|
|
691
|
+
generateMappedEventAttributeLookup: ee,
|
|
692
|
+
sendAdBlockMeasurementSignals: ie,
|
|
680
693
|
createAutoRemovedIframe: D,
|
|
681
|
-
djb2:
|
|
694
|
+
djb2: he,
|
|
682
695
|
setAllowedOriginHashes: (h) => {
|
|
683
|
-
|
|
696
|
+
f._allowedOriginHashes = h;
|
|
684
697
|
},
|
|
685
|
-
ReportingTransport:
|
|
686
|
-
ErrorReportingService:
|
|
687
|
-
LoggingService:
|
|
688
|
-
RateLimiter:
|
|
689
|
-
ErrorCodes:
|
|
690
|
-
WSDKErrorSeverity:
|
|
698
|
+
ReportingTransport: R,
|
|
699
|
+
ErrorReportingService: ne,
|
|
700
|
+
LoggingService: re,
|
|
701
|
+
RateLimiter: ge,
|
|
702
|
+
ErrorCodes: W,
|
|
703
|
+
WSDKErrorSeverity: A,
|
|
691
704
|
resetLauncherAttachState: () => Ne(this._launcherAttachState)
|
|
692
|
-
}, this.attachLauncher(c,
|
|
705
|
+
}, this.attachLauncher(c, p), "Successfully initialized: " + d) : (w && (a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this), Q(xe, J(g), {
|
|
693
706
|
onLoad: () => {
|
|
694
707
|
this._isThankYouElementLoaded = !0, this._thankYouElementOnLoadCallback && this._thankYouElementOnLoadCallback();
|
|
695
708
|
},
|
|
696
709
|
onError: (h) => {
|
|
697
710
|
console.error("Error loading Rokt Thank You Element script:", h);
|
|
698
711
|
}
|
|
699
|
-
})), this.isLauncherReadyToAttach() ? this.attachLauncher(c,
|
|
712
|
+
})), this.isLauncherReadyToAttach() ? this.attachLauncher(c, p, v) : (Q(Fe, B(g, U), {
|
|
700
713
|
onLoad: () => {
|
|
701
|
-
this.isLauncherReadyToAttach() ? this.attachLauncher(c,
|
|
714
|
+
this.isLauncherReadyToAttach() ? this.attachLauncher(c, p, v) : console.error("Rokt object is not available after script load.");
|
|
702
715
|
},
|
|
703
716
|
onError: (h) => {
|
|
704
717
|
console.error("Error loading Rokt launcher script:", h);
|
|
705
718
|
}
|
|
706
|
-
}), this.captureTiming(
|
|
719
|
+
}), this.captureTiming(f.PERFORMANCE_MARKS.RoktScriptAppended)), "Successfully initialized: " + d);
|
|
707
720
|
}
|
|
708
721
|
process(e) {
|
|
709
|
-
if (this.isTargetingDisabled() || (e.EventDataType ===
|
|
722
|
+
if (this.isTargetingDisabled() || (e.EventDataType === je && (ke(this.loggingService), this.capturePageView(e)), e.EventDataType === We && (z(), $())), !this.isKitReady())
|
|
710
723
|
return "Kit not ready for forwarder: " + d;
|
|
711
|
-
if (
|
|
712
|
-
const t =
|
|
724
|
+
if (b(a().Rokt?.setLocalSessionAttribute) && (C(this.placementEventAttributeMappingLookup) || this.applyPlacementEventAttributeMapping(e), !C(this.placementEventMappingLookup))) {
|
|
725
|
+
const t = te(e.EventDataType, e.EventCategory, e.EventName ?? "");
|
|
713
726
|
this.placementEventMappingLookup[String(t)] && a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)], !0);
|
|
714
727
|
}
|
|
715
728
|
return "Successfully sent to forwarder: " + d;
|
|
@@ -722,13 +735,13 @@ const m = class m {
|
|
|
722
735
|
window.Rokt.setExtensionData(e);
|
|
723
736
|
}
|
|
724
737
|
setUserAttribute(e, t) {
|
|
725
|
-
return se(e) || (this.userAttributes[e] = t), "Successfully set user attribute for forwarder: " + d;
|
|
738
|
+
return this.loggingService?.logDiagnostic(M("setUserAttribute", [e])), se(e) || (this.userAttributes[e] = t), "Successfully set user attribute for forwarder: " + d;
|
|
726
739
|
}
|
|
727
740
|
removeUserAttribute(e) {
|
|
728
|
-
return delete this.userAttributes[e], "Successfully removed user attribute for forwarder: " + d;
|
|
741
|
+
return this.loggingService?.logDiagnostic(M("removeUserAttribute", [e])), delete this.userAttributes[e], "Successfully removed user attribute for forwarder: " + d;
|
|
729
742
|
}
|
|
730
743
|
handleIdentityComplete(e, t) {
|
|
731
|
-
return this.userAttributes =
|
|
744
|
+
return this.userAttributes = T(e.getAllUserAttributes()), this.loggingService?.logDiagnostic(M(t, Object.keys(this.userAttributes))), "Successfully called " + t + " for forwarder: " + d;
|
|
732
745
|
}
|
|
733
746
|
onUserIdentified(e) {
|
|
734
747
|
const t = e;
|
|
@@ -741,19 +754,19 @@ const m = class m {
|
|
|
741
754
|
const n = a().Identity?.search;
|
|
742
755
|
if (typeof n != "function")
|
|
743
756
|
return this.userIdentifiedInWorkspace = !1, this._workspaceLastSearchedIdentitiesKey = void 0, Promise.resolve();
|
|
744
|
-
const r = e.getUserIdentities ? e.getUserIdentities().userIdentities : null,
|
|
757
|
+
const r = e.getUserIdentities ? e.getUserIdentities().userIdentities : null, s = {};
|
|
745
758
|
if (r)
|
|
746
759
|
for (const u of Object.keys(r)) {
|
|
747
760
|
const l = r[u];
|
|
748
|
-
|
|
761
|
+
m(l) && l.length > 0 && (s[u] = l);
|
|
749
762
|
}
|
|
750
|
-
const
|
|
751
|
-
if (
|
|
763
|
+
const o = Object.keys(s);
|
|
764
|
+
if (o.length === 0)
|
|
752
765
|
return this.userIdentifiedInWorkspace = !1, this._workspaceLastSearchedIdentitiesKey = void 0, Promise.resolve();
|
|
753
|
-
const c =
|
|
766
|
+
const c = o.sort().map((u) => `${u}=${s[u]}`).join("&");
|
|
754
767
|
return c === this._workspaceLastSearchedIdentitiesKey ? this._workspaceSearchInFlightPromise || Promise.resolve() : (this.userIdentifiedInWorkspace = !1, this._workspaceLastSearchedIdentitiesKey = c, new Promise((u) => {
|
|
755
768
|
try {
|
|
756
|
-
n(t,
|
|
769
|
+
n(t, s, (l) => {
|
|
757
770
|
l?.httpCode === 200 && (this.userIdentifiedInWorkspace = !0), u();
|
|
758
771
|
});
|
|
759
772
|
} catch (l) {
|
|
@@ -799,7 +812,7 @@ const m = class m {
|
|
|
799
812
|
if (t) {
|
|
800
813
|
const n = this._workspaceSearchInFlightPromise, r = n ? Promise.race([
|
|
801
814
|
n,
|
|
802
|
-
new Promise((
|
|
815
|
+
new Promise((s) => setTimeout(s, q))
|
|
803
816
|
]) : Promise.resolve();
|
|
804
817
|
return Promise.all([t, r]).then(
|
|
805
818
|
() => this._dispatchPlacements(e)
|
|
@@ -809,29 +822,33 @@ const m = class m {
|
|
|
809
822
|
const n = this._workspaceSearchInFlightPromise;
|
|
810
823
|
return Promise.race([
|
|
811
824
|
n,
|
|
812
|
-
new Promise((r) => setTimeout(r,
|
|
825
|
+
new Promise((r) => setTimeout(r, q))
|
|
813
826
|
]).then(() => this._dispatchPlacements(e));
|
|
814
827
|
}
|
|
815
828
|
return this._dispatchPlacements(e);
|
|
816
829
|
}
|
|
817
830
|
_dispatchPlacements(e) {
|
|
818
|
-
const t = e && e.attributes || {}, r = { ...
|
|
831
|
+
const t = e && e.attributes || {}, r = { ...T(this.userAttributes), ...t }, s = this.filters || {}, o = s.userAttributeFilters || [], c = s.filteredUser || null, u = c ? c.getMPID() : null;
|
|
819
832
|
let l;
|
|
820
|
-
|
|
821
|
-
const g = this._onboardingExpProvider === "Optimizely" ? this.fetchOptimizely() : {},
|
|
822
|
-
...
|
|
833
|
+
s ? s.filterUserAttributes ? l = s.filterUserAttributes(r, o) : l = r : (console.warn("Rokt Kit: No filters available, using user attributes"), l = r), this.userAttributes = T(l);
|
|
834
|
+
const g = this._onboardingExpProvider === "Optimizely" ? this.fetchOptimizely() : {}, U = this.returnUserIdentities(c), v = this.returnLocalSessionAttributes(), w = ye(V()), p = Re(), k = this.readMpSessionId(), S = this.readMpDeviceId(), I = {
|
|
835
|
+
...U,
|
|
823
836
|
...l,
|
|
824
837
|
...g,
|
|
825
838
|
...v,
|
|
826
|
-
...w.length ? { [
|
|
827
|
-
...
|
|
839
|
+
...w.length ? { [Ge]: JSON.stringify(w) } : {},
|
|
840
|
+
...p ? { [He]: p } : {},
|
|
828
841
|
...this.userIdentifiedInWorkspace ? { [Ye]: !0 } : {},
|
|
829
|
-
...
|
|
830
|
-
...
|
|
842
|
+
...k ? { [Ve]: k } : {},
|
|
843
|
+
...S ? { [ze]: S } : {},
|
|
831
844
|
mpid: u
|
|
832
|
-
}, h = { ...e, attributes:
|
|
833
|
-
|
|
834
|
-
|
|
845
|
+
}, h = { ...e, attributes: I };
|
|
846
|
+
this.loggingService?.logPlacementDiagnostic(
|
|
847
|
+
we(Object.keys(I))
|
|
848
|
+
);
|
|
849
|
+
const G = this.launcher.selectPlacements(h), pe = () => this.logSelectPlacementsEvent(I);
|
|
850
|
+
return Promise.resolve(G).then((fe) => fe?.context?.sessionId?.then((me) => this.setRoktSessionId(me))).catch(() => {
|
|
851
|
+
}).finally(pe), G;
|
|
835
852
|
}
|
|
836
853
|
/**
|
|
837
854
|
* Passes attributes to the Rokt Web SDK for client-side hashing.
|
|
@@ -845,7 +862,7 @@ const m = class m {
|
|
|
845
862
|
* @deprecated This functionality has been internalized and will be removed in a future release.
|
|
846
863
|
*/
|
|
847
864
|
use(e) {
|
|
848
|
-
return this.isKitReady() ? !e || !
|
|
865
|
+
return this.isKitReady() ? !e || !m(e) ? Promise.reject(new Error("Rokt Kit: Invalid extension name")) : this.launcher.use(e) : (console.error("Rokt Kit: Not initialized"), Promise.reject(new Error("Rokt Kit: Not initialized")));
|
|
849
866
|
}
|
|
850
867
|
/**
|
|
851
868
|
* Tears down the Rokt launcher and the placements it rendered.
|
|
@@ -866,31 +883,31 @@ const m = class m {
|
|
|
866
883
|
this._isThankYouElementLoaded ? e() : this._thankYouElementOnLoadCallback = e;
|
|
867
884
|
}
|
|
868
885
|
};
|
|
869
|
-
|
|
886
|
+
f._allowedOriginHashes = [-553112570, 549508659], f.PERFORMANCE_MARKS = {
|
|
870
887
|
RoktScriptAppended: "mp:RoktScriptAppended"
|
|
871
|
-
},
|
|
872
|
-
let
|
|
888
|
+
}, f.EMAIL_SHA256_KEY = "emailsha256";
|
|
889
|
+
let y = f;
|
|
873
890
|
function nt() {
|
|
874
|
-
return
|
|
891
|
+
return L;
|
|
875
892
|
}
|
|
876
893
|
function rt(i) {
|
|
877
894
|
if (!i) {
|
|
878
895
|
window.console.log("You must pass a config object to register the kit " + d);
|
|
879
896
|
return;
|
|
880
897
|
}
|
|
881
|
-
if (!
|
|
898
|
+
if (!E(i)) {
|
|
882
899
|
window.console.log("'config' must be an object. You passed in a " + typeof i);
|
|
883
900
|
return;
|
|
884
901
|
}
|
|
885
|
-
|
|
886
|
-
constructor:
|
|
902
|
+
E(i.kits) ? i.kits[d] = {
|
|
903
|
+
constructor: y
|
|
887
904
|
} : (i.kits = {}, i.kits[d] = {
|
|
888
|
-
constructor:
|
|
905
|
+
constructor: y
|
|
889
906
|
}), window.console.log("Successfully registered " + d + " to your mParticle configuration");
|
|
890
907
|
}
|
|
891
908
|
typeof window < "u" && window.mParticle && a().addForwarder && a().addForwarder({
|
|
892
909
|
name: d,
|
|
893
|
-
constructor:
|
|
910
|
+
constructor: y,
|
|
894
911
|
getId: nt
|
|
895
912
|
});
|
|
896
913
|
export {
|