@mparticle/web-rokt-kit 3.2.2 → 3.3.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.esm.js +302 -284
- package/dist/Rokt-Kit.iife.js +1 -1
- package/package.json +1 -1
package/dist/Rokt-Kit.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Le = [
|
|
2
2
|
"active_time_on_site_ms",
|
|
3
3
|
"billingaddress1",
|
|
4
4
|
"billingaddress2",
|
|
@@ -23,31 +23,31 @@ const we = [
|
|
|
23
23
|
"shippingstate",
|
|
24
24
|
"shippingzipcode",
|
|
25
25
|
"totalprice"
|
|
26
|
-
],
|
|
27
|
-
function
|
|
28
|
-
return
|
|
26
|
+
], Oe = new Set(Le);
|
|
27
|
+
function me(i) {
|
|
28
|
+
return Oe.has(i.toLowerCase());
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function w(i) {
|
|
31
31
|
const e = {}, t = i || {}, n = Object.keys(t);
|
|
32
32
|
for (let r = 0; r < n.length; r++) {
|
|
33
33
|
const s = n[r];
|
|
34
|
-
|
|
34
|
+
me(s) || (e[s] = t[s]);
|
|
35
35
|
}
|
|
36
36
|
return e;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function m(i) {
|
|
39
39
|
return typeof i == "object" && i !== null && !Array.isArray(i);
|
|
40
40
|
}
|
|
41
41
|
function g(i) {
|
|
42
42
|
return typeof i == "string";
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function U(i) {
|
|
45
45
|
return typeof i == "function";
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function T(i) {
|
|
48
48
|
return i == null ? !0 : typeof i == "string" ? i.length === 0 : typeof i == "object" ? Object.keys(i).length === 0 : !1;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function z(i) {
|
|
51
51
|
try {
|
|
52
52
|
const e = new URL(i);
|
|
53
53
|
return e.search = "", e.toString();
|
|
@@ -55,78 +55,79 @@ function W(i) {
|
|
|
55
55
|
return i;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Ee(i) {
|
|
59
59
|
let e = 5381;
|
|
60
60
|
for (let t = 0; t < i.length; t++)
|
|
61
61
|
e = (e << 5) + e + i.charCodeAt(t), e = e & e;
|
|
62
62
|
return e;
|
|
63
63
|
}
|
|
64
|
-
const h = "mp-rokt-kit",
|
|
65
|
-
function
|
|
64
|
+
const h = "mp-rokt-kit", ee = "__rokt_ls_probe__";
|
|
65
|
+
function V() {
|
|
66
66
|
try {
|
|
67
|
-
return window.localStorage.setItem(
|
|
67
|
+
return window.localStorage.setItem(ee, "1"), window.localStorage.removeItem(ee), !0;
|
|
68
68
|
} catch {
|
|
69
69
|
return !1;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
const P = () => window.localStorage;
|
|
73
|
+
function $(i, e = P) {
|
|
73
74
|
try {
|
|
74
|
-
const
|
|
75
|
-
return
|
|
75
|
+
const t = e().getItem(i);
|
|
76
|
+
return t === null ? null : JSON.parse(t);
|
|
76
77
|
} catch {
|
|
77
78
|
return null;
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
+
function _e(i, e, t = P) {
|
|
81
82
|
try {
|
|
82
|
-
return
|
|
83
|
+
return t().setItem(i, JSON.stringify(e)), !0;
|
|
83
84
|
} catch {
|
|
84
85
|
return !1;
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
+
function Ne(i, e = P) {
|
|
88
89
|
try {
|
|
89
|
-
|
|
90
|
+
e().removeItem(i);
|
|
90
91
|
} catch {
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
|
-
function
|
|
94
|
-
const
|
|
95
|
-
return
|
|
94
|
+
function O(i, e, t = P) {
|
|
95
|
+
const n = $(i, t);
|
|
96
|
+
return m(n) ? n[e] : void 0;
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
-
const
|
|
99
|
-
return
|
|
98
|
+
function x(i, e, t, n = P) {
|
|
99
|
+
const r = $(i, n), s = m(r) ? { ...r } : {};
|
|
100
|
+
return s[e] = t, _e(i, s, n);
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
-
const
|
|
103
|
-
if (!
|
|
102
|
+
function Y(i, e, t = P) {
|
|
103
|
+
const n = $(i, t);
|
|
104
|
+
if (!m(n) || !(e in n))
|
|
104
105
|
return;
|
|
105
|
-
const
|
|
106
|
-
delete
|
|
106
|
+
const r = { ...n };
|
|
107
|
+
delete r[e], Object.keys(r).length === 0 ? Ne(i, t) : _e(i, r, t);
|
|
107
108
|
}
|
|
108
|
-
const
|
|
109
|
-
function
|
|
110
|
-
return i.slice(-
|
|
109
|
+
const q = "pageViews", D = "utmParams", Ie = 25, Ue = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
|
|
110
|
+
function ye(i) {
|
|
111
|
+
return i.slice(-Ie);
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
-
const i =
|
|
113
|
+
function te() {
|
|
114
|
+
const i = O(h, q);
|
|
114
115
|
return Array.isArray(i) ? i : [];
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
-
const e =
|
|
117
|
+
function Ce(i) {
|
|
118
|
+
const e = ye(i);
|
|
118
119
|
for (let t = 0; t < e.length; t++) {
|
|
119
120
|
const n = e.slice(t);
|
|
120
|
-
if (
|
|
121
|
+
if (x(h, q, n))
|
|
121
122
|
return n.length;
|
|
122
123
|
}
|
|
123
124
|
return 0;
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
126
|
+
function ie() {
|
|
127
|
+
Y(h, q);
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
-
const e =
|
|
129
|
+
function Ke(i) {
|
|
130
|
+
const e = ye(i);
|
|
130
131
|
return e.map((t, n) => {
|
|
131
132
|
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;
|
|
132
133
|
return {
|
|
@@ -140,19 +141,19 @@ function Ue(i) {
|
|
|
140
141
|
};
|
|
141
142
|
});
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
-
if (
|
|
144
|
+
function De(i) {
|
|
145
|
+
if (O(h, D) !== void 0)
|
|
145
146
|
return;
|
|
146
147
|
const e = new URLSearchParams(window.location.search), t = {};
|
|
147
|
-
for (const r of
|
|
148
|
+
for (const r of Ue) {
|
|
148
149
|
const s = e.get(r);
|
|
149
150
|
s && (t[r] = s);
|
|
150
151
|
}
|
|
151
152
|
if (Object.keys(t).length === 0)
|
|
152
153
|
return;
|
|
153
154
|
const n = Object.keys(t).join(", ");
|
|
154
|
-
if (!
|
|
155
|
-
const r =
|
|
155
|
+
if (!x(h, D, t)) {
|
|
156
|
+
const r = V() ? "quota" : "ls_unavailable";
|
|
156
157
|
i?.log({
|
|
157
158
|
message: `Rokt Kit: Failed to persist UTM params [reason: ${r}]`,
|
|
158
159
|
code: "UTM_CAPTURE_FAILED"
|
|
@@ -164,19 +165,19 @@ function Ce(i) {
|
|
|
164
165
|
code: "UTM_CAPTURE_SUCCESS"
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
-
const i =
|
|
169
|
-
return
|
|
168
|
+
function Me() {
|
|
169
|
+
const i = O(h, D);
|
|
170
|
+
return m(i) ? i : null;
|
|
170
171
|
}
|
|
171
|
-
function
|
|
172
|
-
|
|
172
|
+
function ne() {
|
|
173
|
+
Y(h, D);
|
|
173
174
|
}
|
|
174
|
-
function
|
|
175
|
+
function Fe() {
|
|
175
176
|
const e = document.querySelector('link[rel="canonical"]')?.href;
|
|
176
177
|
if (e)
|
|
177
|
-
return
|
|
178
|
+
return z(e);
|
|
178
179
|
}
|
|
179
|
-
const
|
|
180
|
+
const J = [
|
|
180
181
|
{
|
|
181
182
|
accountId: "2919171670744024290",
|
|
182
183
|
pathname: "/checkout",
|
|
@@ -194,47 +195,55 @@ const $ = [
|
|
|
194
195
|
"currency"
|
|
195
196
|
]
|
|
196
197
|
}
|
|
197
|
-
],
|
|
198
|
-
function
|
|
199
|
-
return
|
|
198
|
+
], xe = 6e4;
|
|
199
|
+
function Ye(i) {
|
|
200
|
+
return m(i) && typeof i.expiresAt == "number" && m(i.attributes);
|
|
200
201
|
}
|
|
201
|
-
function
|
|
202
|
+
function Ge(i, e) {
|
|
202
203
|
return `activePreselect:${i}:${e}`;
|
|
203
204
|
}
|
|
204
|
-
function
|
|
205
|
-
const e =
|
|
206
|
-
return
|
|
205
|
+
function je(i) {
|
|
206
|
+
const e = O(h, i);
|
|
207
|
+
return Ye(e) ? e : null;
|
|
207
208
|
}
|
|
208
|
-
function
|
|
209
|
-
|
|
210
|
-
expiresAt: Date.now() +
|
|
209
|
+
function Ve(i, e) {
|
|
210
|
+
x(h, i, {
|
|
211
|
+
expiresAt: Date.now() + xe,
|
|
211
212
|
attributes: e
|
|
212
213
|
});
|
|
213
214
|
}
|
|
214
|
-
const
|
|
215
|
-
function
|
|
216
|
-
return
|
|
215
|
+
const We = 2 * 6e4;
|
|
216
|
+
function M() {
|
|
217
|
+
return window.sessionStorage;
|
|
217
218
|
}
|
|
218
|
-
function
|
|
219
|
+
function He(i) {
|
|
220
|
+
return m(i) && typeof i.expiresAt == "number" && g(i.pathname) && g(i.identifier) && m(i.attributes) && g(i.mpid);
|
|
221
|
+
}
|
|
222
|
+
function B(i) {
|
|
219
223
|
return `pendingPreselect:${i}`;
|
|
220
224
|
}
|
|
221
|
-
function
|
|
222
|
-
const e =
|
|
223
|
-
return
|
|
224
|
-
}
|
|
225
|
-
function
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
function ze(i) {
|
|
226
|
+
const e = B(i), t = O(h, e, M);
|
|
227
|
+
return He(t) ? t.expiresAt <= Date.now() ? (Y(h, e, M), null) : t : null;
|
|
228
|
+
}
|
|
229
|
+
function $e(i, e, t, n, r) {
|
|
230
|
+
return x(
|
|
231
|
+
h,
|
|
232
|
+
B(i),
|
|
233
|
+
{
|
|
234
|
+
expiresAt: Date.now() + We,
|
|
235
|
+
pathname: e,
|
|
236
|
+
identifier: t,
|
|
237
|
+
attributes: n,
|
|
238
|
+
mpid: r
|
|
239
|
+
},
|
|
240
|
+
M
|
|
241
|
+
);
|
|
233
242
|
}
|
|
234
|
-
function
|
|
235
|
-
|
|
243
|
+
function L(i) {
|
|
244
|
+
Y(h, B(i), M);
|
|
236
245
|
}
|
|
237
|
-
function
|
|
246
|
+
function y(i, e) {
|
|
238
247
|
const t = {
|
|
239
248
|
fired: "PRESELECT_FIRED",
|
|
240
249
|
missed: "PRESELECT_MISSED",
|
|
@@ -246,21 +255,21 @@ function k(i, e) {
|
|
|
246
255
|
code: t[i]
|
|
247
256
|
};
|
|
248
257
|
}
|
|
249
|
-
function
|
|
258
|
+
function qe(i, e) {
|
|
250
259
|
if (i)
|
|
251
|
-
return
|
|
260
|
+
return J.find((t) => t.accountId === i && t.pathname === e);
|
|
252
261
|
}
|
|
253
|
-
function
|
|
262
|
+
function Je(i, e) {
|
|
254
263
|
if (!(!i || !g(e)))
|
|
255
|
-
return
|
|
264
|
+
return J.find((t) => t.accountId === i && t.targetPageIdentifier === e);
|
|
256
265
|
}
|
|
257
|
-
function
|
|
258
|
-
return i ?
|
|
266
|
+
function Be(i, e) {
|
|
267
|
+
return i ? J.some((t) => t.accountId === i && t.attributeKeys.includes(e)) : !1;
|
|
259
268
|
}
|
|
260
|
-
function
|
|
269
|
+
function Qe() {
|
|
261
270
|
return { pending: [] };
|
|
262
271
|
}
|
|
263
|
-
function
|
|
272
|
+
function j(i, e) {
|
|
264
273
|
const t = i.pending.findIndex((n) => n.pathname === e.pathname);
|
|
265
274
|
if (t >= 0) {
|
|
266
275
|
i.pending[t] = e;
|
|
@@ -268,7 +277,7 @@ function Y(i, e) {
|
|
|
268
277
|
}
|
|
269
278
|
i.pending.push(e);
|
|
270
279
|
}
|
|
271
|
-
function
|
|
280
|
+
function W(i) {
|
|
272
281
|
if (!i?.getUserIdentities)
|
|
273
282
|
return !1;
|
|
274
283
|
const e = i.getUserIdentities().userIdentities;
|
|
@@ -277,15 +286,15 @@ function j(i) {
|
|
|
277
286
|
return g(n) && n.length > 0;
|
|
278
287
|
}) : !1;
|
|
279
288
|
}
|
|
280
|
-
function
|
|
289
|
+
function Se(i) {
|
|
281
290
|
const e = i?.getMPID?.();
|
|
282
291
|
return e == null ? null : String(e);
|
|
283
292
|
}
|
|
284
|
-
function
|
|
293
|
+
function re(i, e, t) {
|
|
285
294
|
const n = i.filteredUser?.getAllUserAttributes?.() || {}, r = {}, s = [];
|
|
286
295
|
for (const o of t.attributeKeys) {
|
|
287
|
-
const c = i.getEventAttributeValue(e, o), u =
|
|
288
|
-
if (
|
|
296
|
+
const c = i.getEventAttributeValue(e, o), u = T(c) ? i.userAttributes[o] ?? n[o] : c;
|
|
297
|
+
if (T(u)) {
|
|
289
298
|
s.push(o);
|
|
290
299
|
continue;
|
|
291
300
|
}
|
|
@@ -293,7 +302,7 @@ function ie(i, e, t) {
|
|
|
293
302
|
}
|
|
294
303
|
return { collected: r, missingKeys: s };
|
|
295
304
|
}
|
|
296
|
-
function
|
|
305
|
+
function Xe(i, e) {
|
|
297
306
|
Promise.resolve(i.selectPlacements(e)).catch((t) => {
|
|
298
307
|
const n = t instanceof Error ? t.message : String(t);
|
|
299
308
|
i.log({
|
|
@@ -302,93 +311,102 @@ function Be(i, e) {
|
|
|
302
311
|
});
|
|
303
312
|
});
|
|
304
313
|
}
|
|
305
|
-
function
|
|
306
|
-
const o =
|
|
314
|
+
function Ae(i, e, t, n, r, s) {
|
|
315
|
+
const o = Ge(e, t), c = je(o), u = !!c && JSON.stringify(c.attributes) === JSON.stringify(r);
|
|
307
316
|
if (c && c.expiresAt > Date.now() && u) {
|
|
308
|
-
i.logPlacementDiagnostic(
|
|
317
|
+
i.logPlacementDiagnostic(y("skipped", "active_preselection"));
|
|
309
318
|
return;
|
|
310
319
|
}
|
|
311
|
-
|
|
320
|
+
Ve(o, r), i.logPlacementDiagnostic(y("fired", s)), Xe(i, { attributes: r, preselect: !0, identifier: n, omitUrl: !0 });
|
|
312
321
|
}
|
|
313
|
-
function
|
|
322
|
+
function Ze(i, e) {
|
|
314
323
|
if (!e.accountId || !e.isKitReady())
|
|
315
324
|
return;
|
|
316
|
-
const t =
|
|
325
|
+
const t = ze(e.accountId);
|
|
317
326
|
if (t) {
|
|
318
327
|
if (i.pending.some((n) => n.pathname === t.pathname)) {
|
|
319
|
-
|
|
328
|
+
L(e.accountId);
|
|
320
329
|
return;
|
|
321
330
|
}
|
|
322
331
|
if (!e.isPreselectionEnabled()) {
|
|
323
|
-
|
|
332
|
+
L(e.accountId);
|
|
324
333
|
return;
|
|
325
334
|
}
|
|
326
|
-
|
|
335
|
+
W(e.filteredUser) && (L(e.accountId), Se(e.filteredUser) === t.mpid && Ae(e, e.accountId, t.identifier, t.identifier, t.attributes, "recovered"));
|
|
327
336
|
}
|
|
328
337
|
}
|
|
329
|
-
function
|
|
330
|
-
const r =
|
|
338
|
+
function Pe(i, e, t, n = window.location.pathname) {
|
|
339
|
+
const r = qe(e.accountId, n);
|
|
331
340
|
if (!r)
|
|
332
341
|
return;
|
|
333
342
|
if (!e.isKitReady()) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
343
|
+
const c = [y("queued", "not_ready")], u = Se(e.filteredUser);
|
|
344
|
+
if (e.accountId && u && W(e.filteredUser)) {
|
|
345
|
+
const { collected: l, missingKeys: f } = re(e, t, r);
|
|
346
|
+
if (f.length === 0) {
|
|
347
|
+
const R = w(l);
|
|
348
|
+
$e(
|
|
349
|
+
e.accountId,
|
|
350
|
+
n,
|
|
351
|
+
r.targetPageIdentifier,
|
|
352
|
+
R,
|
|
353
|
+
u
|
|
354
|
+
) || c.push(y("queued", "persist_failed"));
|
|
355
|
+
}
|
|
339
356
|
}
|
|
357
|
+
j(i, { event: t, pathname: n, storedDiagnostics: c });
|
|
340
358
|
return;
|
|
341
359
|
}
|
|
342
360
|
if (!e.isPreselectionEnabled())
|
|
343
361
|
return;
|
|
344
|
-
if (!
|
|
345
|
-
e.logPlacementDiagnostic(
|
|
362
|
+
if (!W(e.filteredUser)) {
|
|
363
|
+
e.logPlacementDiagnostic(y("missed", "no_valid_identity")), j(i, { event: t, pathname: n });
|
|
346
364
|
return;
|
|
347
365
|
}
|
|
348
|
-
const { collected: s, missingKeys: o } =
|
|
366
|
+
const { collected: s, missingKeys: o } = re(e, t, r);
|
|
349
367
|
if (o.length > 0) {
|
|
350
368
|
for (const c of o)
|
|
351
|
-
e.logPlacementDiagnostic(
|
|
352
|
-
|
|
369
|
+
e.logPlacementDiagnostic(y("missed", `missing_attribute:${c}`));
|
|
370
|
+
j(i, { event: t, pathname: n });
|
|
353
371
|
return;
|
|
354
372
|
}
|
|
355
|
-
|
|
373
|
+
Ae(e, e.accountId || "", n, r.targetPageIdentifier, s, "fired");
|
|
356
374
|
}
|
|
357
|
-
function
|
|
358
|
-
if (
|
|
375
|
+
function et(i, e, t = window.location.pathname) {
|
|
376
|
+
if (Ze(i, e), i.pending.length === 0)
|
|
359
377
|
return;
|
|
360
378
|
const n = i.pending;
|
|
361
|
-
i.pending = [], n.forEach(({ event: r, pathname: s }) => {
|
|
362
|
-
s === t &&
|
|
379
|
+
i.pending = [], n.forEach(({ event: r, pathname: s, storedDiagnostics: o }) => {
|
|
380
|
+
s === t && (e.isKitReady() && e.isPreselectionEnabled() && o?.forEach((c) => e.logPlacementDiagnostic(c)), Pe(i, e, r, s));
|
|
363
381
|
});
|
|
364
382
|
}
|
|
365
|
-
function
|
|
383
|
+
function tt() {
|
|
366
384
|
return {
|
|
367
385
|
context: null,
|
|
368
386
|
lifecycle: "idle",
|
|
369
387
|
recreateInFlight: null
|
|
370
388
|
};
|
|
371
389
|
}
|
|
372
|
-
function
|
|
390
|
+
function it(i, e) {
|
|
373
391
|
i.context = {
|
|
374
392
|
accountId: e.accountId,
|
|
375
393
|
launcherOptions: { ...e.launcherOptions },
|
|
376
394
|
legacyRoktExtensions: [...e.legacyRoktExtensions]
|
|
377
395
|
};
|
|
378
396
|
}
|
|
379
|
-
function
|
|
397
|
+
function nt(i) {
|
|
380
398
|
i.lifecycle = "attached";
|
|
381
399
|
}
|
|
382
|
-
function
|
|
400
|
+
function rt(i) {
|
|
383
401
|
i.lifecycle !== "idle" && (i.lifecycle = "terminated");
|
|
384
402
|
}
|
|
385
|
-
function
|
|
403
|
+
function st(i) {
|
|
386
404
|
i.lifecycle = "terminated";
|
|
387
405
|
}
|
|
388
|
-
function
|
|
406
|
+
function ot(i) {
|
|
389
407
|
i.context = null, i.lifecycle = "idle", i.recreateInFlight = null;
|
|
390
408
|
}
|
|
391
|
-
function
|
|
409
|
+
function ct(i, e, t) {
|
|
392
410
|
if (i.recreateInFlight)
|
|
393
411
|
return i.recreateInFlight;
|
|
394
412
|
if (i.lifecycle !== "terminated" || !i.context || !e)
|
|
@@ -399,7 +417,7 @@ function st(i, e, t) {
|
|
|
399
417
|
i.recreateInFlight = null;
|
|
400
418
|
}), i.recreateInFlight;
|
|
401
419
|
}
|
|
402
|
-
const d = "Rokt",
|
|
420
|
+
const d = "Rokt", C = 181, at = "selectPlacements", lt = "apps.roktecommerce.com", ut = 0.1, dt = "ThankYouPageJourney", ht = "rokt-launcher", gt = "rokt-thank-you-element", ft = "userIdentifiedInWorkspace", pt = 3, mt = 2, Et = "page_events", _t = "page_view_attributes", It = "mparticle_session_id", yt = "mparticle_device_id", se = 500, Q = {
|
|
403
421
|
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
|
404
422
|
UNHANDLED_EXCEPTION: "UNHANDLED_EXCEPTION",
|
|
405
423
|
IDENTITY_REQUEST: "IDENTITY_REQUEST",
|
|
@@ -408,33 +426,33 @@ const d = "Rokt", O = 181, ot = "selectPlacements", ct = "apps.roktecommerce.com
|
|
|
408
426
|
ERROR: "ERROR",
|
|
409
427
|
INFO: "INFO",
|
|
410
428
|
WARNING: "WARNING"
|
|
411
|
-
},
|
|
429
|
+
}, St = "apps.rokt-api.com", At = "/v1/log", Pt = "/v1/errors", Rt = 10;
|
|
412
430
|
function a() {
|
|
413
431
|
return window.mParticle;
|
|
414
432
|
}
|
|
415
|
-
function
|
|
416
|
-
const n = [
|
|
433
|
+
function oe(i, e) {
|
|
434
|
+
const n = [G(i), "/wsdk/integrations/launcher.js"].join("");
|
|
417
435
|
return !e || e.length === 0 ? n : n + "?extensions=" + e.join(",");
|
|
418
436
|
}
|
|
419
|
-
function
|
|
420
|
-
return [
|
|
437
|
+
function ce(i) {
|
|
438
|
+
return [G(i), "/rokt-elements/rokt-element-thank-you.js"].join("");
|
|
421
439
|
}
|
|
422
|
-
function
|
|
423
|
-
const e = i !== void 0 ? i :
|
|
440
|
+
function G(i) {
|
|
441
|
+
const e = i !== void 0 ? i : St;
|
|
424
442
|
return e.includes("://") ? e.replace(/\/+$/, "") : ["https://", e].join("");
|
|
425
443
|
}
|
|
426
|
-
function
|
|
444
|
+
function Re(i, e, t) {
|
|
427
445
|
if (i)
|
|
428
446
|
return i.startsWith("http://") || i.startsWith("https://") ? i : "https://" + i;
|
|
429
447
|
const r = e?.includes("://") && !/^https?:\/\//i.test(e) ? void 0 : e;
|
|
430
|
-
return
|
|
448
|
+
return G(r) + t;
|
|
431
449
|
}
|
|
432
|
-
function
|
|
450
|
+
function ae(i, e, t) {
|
|
433
451
|
if (document.getElementById(i)) return;
|
|
434
452
|
const n = document.head || document.body, r = document.createElement("script");
|
|
435
453
|
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);
|
|
436
454
|
}
|
|
437
|
-
function
|
|
455
|
+
function K(i) {
|
|
438
456
|
if (!i)
|
|
439
457
|
return [];
|
|
440
458
|
try {
|
|
@@ -444,12 +462,12 @@ function N(i) {
|
|
|
444
462
|
}
|
|
445
463
|
return [];
|
|
446
464
|
}
|
|
447
|
-
function
|
|
448
|
-
const e = i ?
|
|
465
|
+
function le(i) {
|
|
466
|
+
const e = i ? K(i) : [], t = [], n = [];
|
|
449
467
|
let r = !1;
|
|
450
468
|
for (let s = 0; s < e.length; s++) {
|
|
451
469
|
const o = e[s].value;
|
|
452
|
-
o === "thank-you-journey" ? (r = !0, n.push(
|
|
470
|
+
o === "thank-you-journey" ? (r = !0, n.push(dt)) : t.push(o);
|
|
453
471
|
}
|
|
454
472
|
return {
|
|
455
473
|
roktExtensionsQueryParams: t,
|
|
@@ -457,14 +475,14 @@ function ce(i) {
|
|
|
457
475
|
loadThankYouElement: r
|
|
458
476
|
};
|
|
459
477
|
}
|
|
460
|
-
async function
|
|
478
|
+
async function bt(i, e) {
|
|
461
479
|
const t = [];
|
|
462
480
|
if (e)
|
|
463
481
|
for (const n of i)
|
|
464
482
|
t.push(e.use(n));
|
|
465
483
|
return Promise.all(t);
|
|
466
484
|
}
|
|
467
|
-
function
|
|
485
|
+
function ue(i) {
|
|
468
486
|
if (!i)
|
|
469
487
|
return {};
|
|
470
488
|
const e = {};
|
|
@@ -474,7 +492,7 @@ function ae(i) {
|
|
|
474
492
|
}
|
|
475
493
|
return e;
|
|
476
494
|
}
|
|
477
|
-
function
|
|
495
|
+
function de(i) {
|
|
478
496
|
const e = {};
|
|
479
497
|
if (!Array.isArray(i))
|
|
480
498
|
return e;
|
|
@@ -490,14 +508,14 @@ function le(i) {
|
|
|
490
508
|
}
|
|
491
509
|
return e;
|
|
492
510
|
}
|
|
493
|
-
function
|
|
511
|
+
function he(i, e, t) {
|
|
494
512
|
return a().generateHash([i, e, t].join(""));
|
|
495
513
|
}
|
|
496
|
-
function
|
|
497
|
-
let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "3.
|
|
514
|
+
function kt(i) {
|
|
515
|
+
let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "3.3.0";
|
|
498
516
|
return i && (n += "_" + i), n;
|
|
499
517
|
}
|
|
500
|
-
function
|
|
518
|
+
function H(i) {
|
|
501
519
|
const e = document.createElement("iframe");
|
|
502
520
|
e.style.display = "none", e.setAttribute("sandbox", "allow-scripts allow-same-origin"), e.src = i, e.onload = function() {
|
|
503
521
|
e.onload = null, e.parentNode && e.parentNode.removeChild(e);
|
|
@@ -505,41 +523,41 @@ function V(i) {
|
|
|
505
523
|
const t = document.body || document.head;
|
|
506
524
|
t && t.appendChild(e);
|
|
507
525
|
}
|
|
508
|
-
function
|
|
509
|
-
const t =
|
|
510
|
-
if (
|
|
526
|
+
function ge(i, e) {
|
|
527
|
+
const t = Ee(window.location.origin);
|
|
528
|
+
if (A._allowedOriginHashes.indexOf(t) === -1 || Math.random() >= ut)
|
|
511
529
|
return;
|
|
512
530
|
const r = window.__rokt_li_guid__;
|
|
513
531
|
if (!r || i && i.includes("://") && !/^https:\/\//i.test(i))
|
|
514
532
|
return;
|
|
515
|
-
const s = window.location.href.split("?")[0].split("#")[0], o = "version=" + encodeURIComponent(e ?? "") + "&launcherInstanceGuid=" + encodeURIComponent(r) + "&pageUrl=" + encodeURIComponent(s), c = i ?
|
|
516
|
-
|
|
517
|
-
"https://" +
|
|
533
|
+
const s = window.location.href.split("?")[0].split("#")[0], o = "version=" + encodeURIComponent(e ?? "") + "&launcherInstanceGuid=" + encodeURIComponent(r) + "&pageUrl=" + encodeURIComponent(s), c = i ? G(i) : "https://apps.rokt.com";
|
|
534
|
+
H(c + "/v1/wsdk-init/index.html?" + o), H(
|
|
535
|
+
"https://" + lt + "/v1/wsdk-init/index.html?" + o + "&isControl=true"
|
|
518
536
|
);
|
|
519
537
|
}
|
|
520
|
-
function
|
|
538
|
+
function vt() {
|
|
521
539
|
return typeof window < "u" && !!window.location?.search?.toLowerCase().includes("mp_enable_logging=true");
|
|
522
540
|
}
|
|
523
|
-
function
|
|
541
|
+
function wt() {
|
|
524
542
|
return typeof window < "u" ? window.location?.href : void 0;
|
|
525
543
|
}
|
|
526
|
-
function
|
|
544
|
+
function Tt() {
|
|
527
545
|
return typeof window < "u" ? window.navigator?.userAgent : void 0;
|
|
528
546
|
}
|
|
529
|
-
class
|
|
547
|
+
class be {
|
|
530
548
|
constructor() {
|
|
531
549
|
this._logCount = {};
|
|
532
550
|
}
|
|
533
551
|
incrementAndCheck(e) {
|
|
534
552
|
const n = (this._logCount[e] || 0) + 1;
|
|
535
|
-
return this._logCount[e] = n, n >
|
|
553
|
+
return this._logCount[e] = n, n > Rt;
|
|
536
554
|
}
|
|
537
555
|
}
|
|
538
|
-
class
|
|
556
|
+
class F {
|
|
539
557
|
constructor(e, t, n, r, s) {
|
|
540
558
|
this._reporter = "mp-wsdk";
|
|
541
559
|
const o = e.isLoggingEnabled;
|
|
542
|
-
this._integrationName = t || "", this._launcherInstanceGuid = n, this._accountId = r || null, this._rateLimiter = s || new
|
|
560
|
+
this._integrationName = t || "", this._launcherInstanceGuid = n, this._accountId = r || null, this._rateLimiter = s || new be(), this._isEnabled = vt() || o;
|
|
543
561
|
}
|
|
544
562
|
send(e, t, n, r, s, o) {
|
|
545
563
|
if (!(!this._isEnabled || this._rateLimiter.incrementAndCheck(t)))
|
|
@@ -550,9 +568,9 @@ class C {
|
|
|
550
568
|
version: this._integrationName
|
|
551
569
|
},
|
|
552
570
|
severity: t,
|
|
553
|
-
code: r ||
|
|
554
|
-
url:
|
|
555
|
-
deviceInfo:
|
|
571
|
+
code: r || Q.UNKNOWN_ERROR,
|
|
572
|
+
url: wt(),
|
|
573
|
+
deviceInfo: Tt(),
|
|
556
574
|
stackTrace: s,
|
|
557
575
|
reporter: this._reporter,
|
|
558
576
|
integration: this._integrationName
|
|
@@ -568,8 +586,8 @@ class C {
|
|
|
568
586
|
body: JSON.stringify(c)
|
|
569
587
|
}).then((l) => {
|
|
570
588
|
if (!l.ok) {
|
|
571
|
-
const
|
|
572
|
-
throw
|
|
589
|
+
const f = new Error("HTTP " + l.status + " from log endpoint");
|
|
590
|
+
throw f.statusCode = l.status, f;
|
|
573
591
|
}
|
|
574
592
|
}).catch((l) => {
|
|
575
593
|
console.error("ReportingTransport: Failed to send log", l), o && o(l);
|
|
@@ -579,9 +597,9 @@ class C {
|
|
|
579
597
|
}
|
|
580
598
|
}
|
|
581
599
|
}
|
|
582
|
-
class
|
|
600
|
+
class fe {
|
|
583
601
|
constructor(e, t, n, r, s) {
|
|
584
|
-
this._transport = new
|
|
602
|
+
this._transport = new F(e, t, n, r, s), this._errorUrl = Re(e?.errorUrl, e?.integrationDomain, Pt);
|
|
585
603
|
}
|
|
586
604
|
report(e) {
|
|
587
605
|
if (!e) return;
|
|
@@ -589,14 +607,14 @@ class he {
|
|
|
589
607
|
this._transport.send(this._errorUrl, t, e.message, e.code, e.stackTrace);
|
|
590
608
|
}
|
|
591
609
|
}
|
|
592
|
-
class
|
|
610
|
+
class pe {
|
|
593
611
|
constructor(e, t, n, r, s, o) {
|
|
594
|
-
this._transport = new
|
|
612
|
+
this._transport = new F(e, n, r, s, o), this._placementDiagnosticTransport = new F(
|
|
595
613
|
e,
|
|
596
614
|
n,
|
|
597
615
|
r,
|
|
598
616
|
s
|
|
599
|
-
), this._loggingUrl =
|
|
617
|
+
), this._loggingUrl = Re(e?.loggingUrl, e?.integrationDomain, At), this._errorReportingService = t;
|
|
600
618
|
}
|
|
601
619
|
log(e) {
|
|
602
620
|
e && this._send(this._transport, e);
|
|
@@ -616,7 +634,7 @@ class ge {
|
|
|
616
634
|
const r = typeof n.statusCode == "number";
|
|
617
635
|
this._errorReportingService.report({
|
|
618
636
|
message: "LoggingService: Failed to send log: " + n.message,
|
|
619
|
-
code:
|
|
637
|
+
code: Q.LOG_DELIVERY_FAILURE,
|
|
620
638
|
severity: r ? S.ERROR : S.WARNING
|
|
621
639
|
});
|
|
622
640
|
}
|
|
@@ -624,8 +642,8 @@ class ge {
|
|
|
624
642
|
);
|
|
625
643
|
}
|
|
626
644
|
}
|
|
627
|
-
function
|
|
628
|
-
const e =
|
|
645
|
+
function Lt(i) {
|
|
646
|
+
const e = z(window.location.href), t = i.EventAttributes?.title || document.title, n = Fe(), r = i.ActiveTimeOnSite;
|
|
629
647
|
return {
|
|
630
648
|
pageUrl: e,
|
|
631
649
|
sourceMessageId: i.SourceMessageId,
|
|
@@ -637,7 +655,7 @@ function wt(i) {
|
|
|
637
655
|
}
|
|
638
656
|
const _ = class _ {
|
|
639
657
|
constructor() {
|
|
640
|
-
this.name = d, this.id =
|
|
658
|
+
this.name = d, this.id = C, this.moduleId = C, 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 = tt(), this.accountId = null, this._preselectState = Qe();
|
|
641
659
|
}
|
|
642
660
|
// ---- Private helpers ----
|
|
643
661
|
getEventAttributeValue(e, t) {
|
|
@@ -668,7 +686,7 @@ const _ = class _ {
|
|
|
668
686
|
const t = Object.keys(this.placementEventAttributeMappingLookup);
|
|
669
687
|
for (let n = 0; n < t.length; n++) {
|
|
670
688
|
const r = t[n], s = this.placementEventAttributeMappingLookup[r];
|
|
671
|
-
if (
|
|
689
|
+
if (T(s))
|
|
672
690
|
continue;
|
|
673
691
|
let o = !0;
|
|
674
692
|
for (let c = 0; c < s.length; c++)
|
|
@@ -682,12 +700,12 @@ const _ = class _ {
|
|
|
682
700
|
capturePageView(e) {
|
|
683
701
|
let t;
|
|
684
702
|
try {
|
|
685
|
-
t =
|
|
686
|
-
const n =
|
|
703
|
+
t = z(window.location.href);
|
|
704
|
+
const n = te(), r = Lt(e);
|
|
687
705
|
n.push(r);
|
|
688
|
-
const s = Math.min(n.length,
|
|
706
|
+
const s = Math.min(n.length, Ie), o = Ce(n);
|
|
689
707
|
if (o === 0) {
|
|
690
|
-
const c =
|
|
708
|
+
const c = V() ? "quota" : "ls_unavailable";
|
|
691
709
|
this.loggingService?.log({
|
|
692
710
|
message: `Rokt Kit: Failed to persist page view for ${t} [reason: ${c}]`,
|
|
693
711
|
code: "PAGE_VIEW_CAPTURE_FAILED"
|
|
@@ -697,7 +715,7 @@ const _ = class _ {
|
|
|
697
715
|
code: "PAGE_VIEW_QUOTA_EVICTION"
|
|
698
716
|
});
|
|
699
717
|
} catch (n) {
|
|
700
|
-
const r =
|
|
718
|
+
const r = V() ? "exception" : "ls_unavailable", s = n instanceof Error ? n.message : String(n);
|
|
701
719
|
this.loggingService?.log({
|
|
702
720
|
message: `Rokt Kit: Failed to capture page view for ${t}: ${s} [reason: ${r}]`,
|
|
703
721
|
code: "PAGE_VIEW_CAPTURE_FAILED"
|
|
@@ -710,7 +728,7 @@ const _ = class _ {
|
|
|
710
728
|
buildCacheMatchKeys(e) {
|
|
711
729
|
if (!this.isPreselectionEnabled())
|
|
712
730
|
return;
|
|
713
|
-
const t =
|
|
731
|
+
const t = Je(this.accountId, e);
|
|
714
732
|
if (t)
|
|
715
733
|
return t.attributeKeys;
|
|
716
734
|
}
|
|
@@ -728,10 +746,10 @@ const _ = class _ {
|
|
|
728
746
|
};
|
|
729
747
|
}
|
|
730
748
|
flushPendingPreselectDispatches() {
|
|
731
|
-
|
|
749
|
+
et(this._preselectState, this.buildPreselectHost());
|
|
732
750
|
}
|
|
733
751
|
isLauncherReadyToAttach() {
|
|
734
|
-
return !!window.Rokt &&
|
|
752
|
+
return !!window.Rokt && U(window.Rokt.createLauncher);
|
|
735
753
|
}
|
|
736
754
|
/**
|
|
737
755
|
* Returns the user identities from the filtered user, if any.
|
|
@@ -750,16 +768,16 @@ const _ = class _ {
|
|
|
750
768
|
return n && e[n] && (t[_.EMAIL_SHA256_KEY] = e[n]), n && delete t[n], t;
|
|
751
769
|
}
|
|
752
770
|
logSelectPlacementsEvent(e) {
|
|
753
|
-
if (!window.mParticle || typeof a().logEvent != "function" || !
|
|
771
|
+
if (!window.mParticle || typeof a().logEvent != "function" || !m(e))
|
|
754
772
|
return;
|
|
755
773
|
const t = a().EventType.Other;
|
|
756
|
-
a().logEvent(
|
|
774
|
+
a().logEvent(at, t, e);
|
|
757
775
|
}
|
|
758
776
|
setRoktSessionId(e) {
|
|
759
777
|
if (!(!e || typeof e != "string"))
|
|
760
778
|
try {
|
|
761
779
|
const t = a().getInstance();
|
|
762
|
-
t &&
|
|
780
|
+
t && U(t.setIntegrationAttribute) && t.setIntegrationAttribute(C, {
|
|
763
781
|
roktSessionId: e
|
|
764
782
|
});
|
|
765
783
|
} catch {
|
|
@@ -767,14 +785,14 @@ const _ = class _ {
|
|
|
767
785
|
}
|
|
768
786
|
readMpSessionId() {
|
|
769
787
|
const e = a()?.sessionManager, t = e?.getSessionId ?? e?.getSession;
|
|
770
|
-
if (
|
|
788
|
+
if (U(t))
|
|
771
789
|
return t.call(e) || void 0;
|
|
772
790
|
}
|
|
773
791
|
readMpDeviceId() {
|
|
774
792
|
return a()?.getDeviceId?.() || void 0;
|
|
775
793
|
}
|
|
776
794
|
attachLauncher(e, t, n = []) {
|
|
777
|
-
|
|
795
|
+
it(this._launcherAttachState, {
|
|
778
796
|
accountId: e,
|
|
779
797
|
launcherOptions: t || {},
|
|
780
798
|
legacyRoktExtensions: n
|
|
@@ -785,22 +803,22 @@ const _ = class _ {
|
|
|
785
803
|
};
|
|
786
804
|
let s;
|
|
787
805
|
return this.isPartnerInLocalLauncherTestGroup() ? s = Promise.resolve(window.Rokt.createLocalLauncher(r)) : s = window.Rokt.createLauncher(r), s.then(async (o) => {
|
|
788
|
-
await
|
|
806
|
+
await bt([...n], o), this.initRoktLauncher(o);
|
|
789
807
|
}).catch((o) => {
|
|
790
|
-
|
|
808
|
+
st(this._launcherAttachState), console.error("Error creating Rokt launcher:", o);
|
|
791
809
|
});
|
|
792
810
|
}
|
|
793
811
|
recreateLauncherIfTerminated() {
|
|
794
|
-
return
|
|
812
|
+
return ct(
|
|
795
813
|
this._launcherAttachState,
|
|
796
814
|
this.isLauncherReadyToAttach(),
|
|
797
815
|
(e) => this.attachLauncher(e.accountId, e.launcherOptions, e.legacyRoktExtensions)
|
|
798
816
|
);
|
|
799
817
|
}
|
|
800
818
|
initRoktLauncher(e) {
|
|
801
|
-
window.Rokt && (window.Rokt.currentLauncher = e), this.launcher = e,
|
|
819
|
+
window.Rokt && (window.Rokt.currentLauncher = e), this.launcher = e, nt(this._launcherAttachState);
|
|
802
820
|
const t = a().Rokt?.filters;
|
|
803
|
-
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,
|
|
821
|
+
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, ge(this.domain, this.integrationName), a().Rokt.attachKit(this), this.flushPendingPreselectDispatches();
|
|
804
822
|
}
|
|
805
823
|
fetchOptimizely() {
|
|
806
824
|
const e = a()._getActiveForwarders().filter((t) => t.name === "Optimizely");
|
|
@@ -837,89 +855,89 @@ const _ = class _ {
|
|
|
837
855
|
*/
|
|
838
856
|
init(e, t, n, r, s) {
|
|
839
857
|
const o = e, c = o.accountId;
|
|
840
|
-
this.accountId = c || null, this.userAttributes =
|
|
841
|
-
const u =
|
|
842
|
-
this.placementEventMappingLookup =
|
|
843
|
-
const l =
|
|
858
|
+
this.accountId = c || null, this.userAttributes = w(s), this._onboardingExpProvider = o.onboardingExpProvider;
|
|
859
|
+
const u = K(o.placementEventMapping);
|
|
860
|
+
this.placementEventMappingLookup = ue(u);
|
|
861
|
+
const l = K(
|
|
844
862
|
o.placementEventAttributeMapping
|
|
845
863
|
);
|
|
846
|
-
this.placementEventAttributeMappingLookup =
|
|
847
|
-
const
|
|
864
|
+
this.placementEventAttributeMappingLookup = de(l), o.hashedEmailUserIdentityType && (this._mappedEmailSha256Key = o.hashedEmailUserIdentityType.toLowerCase()), this._workspaceIdSyncApiKey = g(o.workspaceIdSyncApiKey) ? o.workspaceIdSyncApiKey : void 0;
|
|
865
|
+
const f = a().Rokt?.domain, { roktExtensionsQueryParams: R, legacyRoktExtensions: b, loadThankYouElement: N } = le(
|
|
848
866
|
o.roktExtensions
|
|
849
867
|
), E = {
|
|
850
868
|
...a().Rokt?.launcherOptions || {}
|
|
851
869
|
};
|
|
852
|
-
this.integrationName =
|
|
853
|
-
const
|
|
870
|
+
this.integrationName = kt(E.integrationName), E.integrationName = this.integrationName, this.domain = f;
|
|
871
|
+
const k = {
|
|
854
872
|
loggingUrl: o.loggingUrl,
|
|
855
873
|
errorUrl: o.errorUrl,
|
|
856
|
-
integrationDomain:
|
|
874
|
+
integrationDomain: f,
|
|
857
875
|
isLoggingEnabled: a().config?.isLoggingEnabled === !0
|
|
858
|
-
}, I = new
|
|
859
|
-
|
|
876
|
+
}, I = new fe(
|
|
877
|
+
k,
|
|
860
878
|
this.integrationName,
|
|
861
879
|
window.__rokt_li_guid__,
|
|
862
880
|
o.accountId
|
|
863
|
-
),
|
|
864
|
-
|
|
881
|
+
), v = new pe(
|
|
882
|
+
k,
|
|
865
883
|
I,
|
|
866
884
|
this.integrationName,
|
|
867
885
|
window.__rokt_li_guid__,
|
|
868
886
|
o.accountId
|
|
869
887
|
);
|
|
870
|
-
if (this.errorReportingService = I, this.loggingService =
|
|
888
|
+
if (this.errorReportingService = I, this.loggingService = v, this.isTargetingDisabled())
|
|
871
889
|
try {
|
|
872
|
-
|
|
873
|
-
} catch (
|
|
890
|
+
ie(), ne();
|
|
891
|
+
} catch (p) {
|
|
874
892
|
this.errorReportingService?.report({
|
|
875
893
|
message: "Rokt Kit: Failed to clear page views when targeting is disabled",
|
|
876
894
|
code: "PAGE_VIEW_CAPTURE_FAILED",
|
|
877
895
|
severity: S.INFO,
|
|
878
|
-
stackTrace:
|
|
896
|
+
stackTrace: p instanceof Error ? p.stack : void 0
|
|
879
897
|
});
|
|
880
898
|
}
|
|
881
|
-
return a()._registerErrorReportingService && a()._registerErrorReportingService(I), a()._registerLoggingService && a()._registerLoggingService(
|
|
882
|
-
generateLauncherScript:
|
|
883
|
-
generateThankYouElementScript:
|
|
884
|
-
extractRoktExtensionConfig:
|
|
885
|
-
hashEventMessage:
|
|
886
|
-
parseSettingsString:
|
|
887
|
-
generateMappedEventLookup:
|
|
888
|
-
generateMappedEventAttributeLookup:
|
|
889
|
-
sendAdBlockMeasurementSignals:
|
|
890
|
-
createAutoRemovedIframe:
|
|
891
|
-
djb2:
|
|
892
|
-
setAllowedOriginHashes: (
|
|
893
|
-
_._allowedOriginHashes =
|
|
899
|
+
return a()._registerErrorReportingService && a()._registerErrorReportingService(I), a()._registerLoggingService && a()._registerLoggingService(v), n ? (this.testHelpers = {
|
|
900
|
+
generateLauncherScript: oe,
|
|
901
|
+
generateThankYouElementScript: ce,
|
|
902
|
+
extractRoktExtensionConfig: le,
|
|
903
|
+
hashEventMessage: he,
|
|
904
|
+
parseSettingsString: K,
|
|
905
|
+
generateMappedEventLookup: ue,
|
|
906
|
+
generateMappedEventAttributeLookup: de,
|
|
907
|
+
sendAdBlockMeasurementSignals: ge,
|
|
908
|
+
createAutoRemovedIframe: H,
|
|
909
|
+
djb2: Ee,
|
|
910
|
+
setAllowedOriginHashes: (p) => {
|
|
911
|
+
_._allowedOriginHashes = p;
|
|
894
912
|
},
|
|
895
|
-
ReportingTransport:
|
|
896
|
-
ErrorReportingService:
|
|
897
|
-
LoggingService:
|
|
898
|
-
RateLimiter:
|
|
899
|
-
ErrorCodes:
|
|
913
|
+
ReportingTransport: F,
|
|
914
|
+
ErrorReportingService: fe,
|
|
915
|
+
LoggingService: pe,
|
|
916
|
+
RateLimiter: be,
|
|
917
|
+
ErrorCodes: Q,
|
|
900
918
|
WSDKErrorSeverity: S,
|
|
901
|
-
resetLauncherAttachState: () =>
|
|
902
|
-
}, this.attachLauncher(c, E), "Successfully initialized: " + d) : (
|
|
919
|
+
resetLauncherAttachState: () => ot(this._launcherAttachState)
|
|
920
|
+
}, this.attachLauncher(c, E), "Successfully initialized: " + d) : (N && (a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this), ae(gt, ce(f), {
|
|
903
921
|
onLoad: () => {
|
|
904
922
|
this._isThankYouElementLoaded = !0, this._thankYouElementOnLoadCallback && this._thankYouElementOnLoadCallback();
|
|
905
923
|
},
|
|
906
|
-
onError: (
|
|
907
|
-
console.error("Error loading Rokt Thank You Element script:",
|
|
924
|
+
onError: (p) => {
|
|
925
|
+
console.error("Error loading Rokt Thank You Element script:", p);
|
|
908
926
|
}
|
|
909
|
-
})), this.isLauncherReadyToAttach() ? this.attachLauncher(c, E,
|
|
927
|
+
})), this.isLauncherReadyToAttach() ? this.attachLauncher(c, E, b) : (ae(ht, oe(f, R), {
|
|
910
928
|
onLoad: () => {
|
|
911
|
-
this.isLauncherReadyToAttach() ? this.attachLauncher(c, E,
|
|
929
|
+
this.isLauncherReadyToAttach() ? this.attachLauncher(c, E, b) : console.error("Rokt object is not available after script load.");
|
|
912
930
|
},
|
|
913
|
-
onError: (
|
|
914
|
-
console.error("Error loading Rokt launcher script:",
|
|
931
|
+
onError: (p) => {
|
|
932
|
+
console.error("Error loading Rokt launcher script:", p);
|
|
915
933
|
}
|
|
916
934
|
}), this.captureTiming(_.PERFORMANCE_MARKS.RoktScriptAppended)), "Successfully initialized: " + d);
|
|
917
935
|
}
|
|
918
936
|
process(e) {
|
|
919
|
-
if (this.isTargetingDisabled() || (e.EventDataType ===
|
|
937
|
+
if (this.isTargetingDisabled() || (e.EventDataType === pt && (De(this.loggingService), this.capturePageView(e), Pe(this._preselectState, this.buildPreselectHost(), e)), e.EventDataType === mt && (ie(), ne(), this.accountId && L(this.accountId))), !this.isKitReady())
|
|
920
938
|
return "Kit not ready for forwarder: " + d;
|
|
921
|
-
if (
|
|
922
|
-
const t =
|
|
939
|
+
if (U(a().Rokt?.setLocalSessionAttribute) && (T(this.placementEventAttributeMappingLookup) || this.applyPlacementEventAttributeMapping(e), !T(this.placementEventMappingLookup))) {
|
|
940
|
+
const t = he(e.EventDataType, e.EventCategory, e.EventName ?? "");
|
|
923
941
|
this.placementEventMappingLookup[String(t)] && a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)], !0);
|
|
924
942
|
}
|
|
925
943
|
return "Successfully sent to forwarder: " + d;
|
|
@@ -932,13 +950,13 @@ const _ = class _ {
|
|
|
932
950
|
window.Rokt.setExtensionData(e);
|
|
933
951
|
}
|
|
934
952
|
setUserAttribute(e, t) {
|
|
935
|
-
return
|
|
953
|
+
return me(e) || (this.userAttributes[e] = t), Be(this.accountId, e) && this.flushPendingPreselectDispatches(), "Successfully set user attribute for forwarder: " + d;
|
|
936
954
|
}
|
|
937
955
|
removeUserAttribute(e) {
|
|
938
956
|
return delete this.userAttributes[e], "Successfully removed user attribute for forwarder: " + d;
|
|
939
957
|
}
|
|
940
958
|
handleIdentityComplete(e, t) {
|
|
941
|
-
return this.userAttributes =
|
|
959
|
+
return this.userAttributes = w(e.getAllUserAttributes()), "Successfully called " + t + " for forwarder: " + d;
|
|
942
960
|
}
|
|
943
961
|
onUserIdentified(e) {
|
|
944
962
|
const t = e;
|
|
@@ -977,7 +995,7 @@ const _ = class _ {
|
|
|
977
995
|
return this.handleIdentityComplete(e, "onLoginComplete");
|
|
978
996
|
}
|
|
979
997
|
onLogoutComplete(e, t) {
|
|
980
|
-
return this.userIdentifiedInWorkspace = !1, this._workspaceSearchInFlightPromise = null, this._workspaceLastSearchedIdentitiesKey = void 0, this.handleIdentityComplete(e, "onLogoutComplete");
|
|
998
|
+
return this.userIdentifiedInWorkspace = !1, this._workspaceSearchInFlightPromise = null, this._workspaceLastSearchedIdentitiesKey = void 0, this.accountId && L(this.accountId), this.handleIdentityComplete(e, "onLogoutComplete");
|
|
981
999
|
}
|
|
982
1000
|
onModifyComplete(e, t) {
|
|
983
1001
|
return this.handleIdentityComplete(e, "onModifyComplete");
|
|
@@ -1011,7 +1029,7 @@ const _ = class _ {
|
|
|
1011
1029
|
if (t) {
|
|
1012
1030
|
const n = this._workspaceSearchInFlightPromise, r = n ? Promise.race([
|
|
1013
1031
|
n,
|
|
1014
|
-
new Promise((s) => setTimeout(s,
|
|
1032
|
+
new Promise((s) => setTimeout(s, se))
|
|
1015
1033
|
]) : Promise.resolve();
|
|
1016
1034
|
return Promise.all([t, r]).then(
|
|
1017
1035
|
() => this._dispatchPlacements(e)
|
|
@@ -1021,38 +1039,38 @@ const _ = class _ {
|
|
|
1021
1039
|
const n = this._workspaceSearchInFlightPromise;
|
|
1022
1040
|
return Promise.race([
|
|
1023
1041
|
n,
|
|
1024
|
-
new Promise((r) => setTimeout(r,
|
|
1042
|
+
new Promise((r) => setTimeout(r, se))
|
|
1025
1043
|
]).then(() => this._dispatchPlacements(e));
|
|
1026
1044
|
}
|
|
1027
1045
|
return this._dispatchPlacements(e);
|
|
1028
1046
|
}
|
|
1029
1047
|
_dispatchPlacements(e) {
|
|
1030
|
-
const t = e && e.attributes || {}, r = { ...
|
|
1048
|
+
const t = e && e.attributes || {}, r = { ...w(this.userAttributes), ...t }, s = this.filters || {}, o = s.userAttributeFilters || [], c = s.filteredUser || null, u = c ? c.getMPID() : null;
|
|
1031
1049
|
let l;
|
|
1032
|
-
s ? s.filterUserAttributes ? l = s.filterUserAttributes(r, o) : l = r : (console.warn("Rokt Kit: No filters available, using user attributes"), l = r), this.userAttributes =
|
|
1033
|
-
const
|
|
1034
|
-
...
|
|
1050
|
+
s ? s.filterUserAttributes ? l = s.filterUserAttributes(r, o) : l = r : (console.warn("Rokt Kit: No filters available, using user attributes"), l = r), this.userAttributes = w(l);
|
|
1051
|
+
const f = this._onboardingExpProvider === "Optimizely" ? this.fetchOptimizely() : {}, R = this.returnUserIdentities(c), b = this.returnLocalSessionAttributes(), N = Ke(te()), E = Me(), k = this.readMpSessionId(), I = this.readMpDeviceId(), v = {
|
|
1052
|
+
...R,
|
|
1035
1053
|
...l,
|
|
1036
|
-
...
|
|
1037
|
-
...
|
|
1038
|
-
...
|
|
1039
|
-
...E ? { [
|
|
1040
|
-
...this.userIdentifiedInWorkspace ? { [
|
|
1041
|
-
...
|
|
1042
|
-
...I ? { [
|
|
1054
|
+
...f,
|
|
1055
|
+
...b,
|
|
1056
|
+
...N.length ? { [Et]: JSON.stringify(N) } : {},
|
|
1057
|
+
...E ? { [_t]: E } : {},
|
|
1058
|
+
...this.userIdentifiedInWorkspace ? { [ft]: !0 } : {},
|
|
1059
|
+
...k ? { [It]: k } : {},
|
|
1060
|
+
...I ? { [yt]: I } : {},
|
|
1043
1061
|
mpid: u
|
|
1044
|
-
},
|
|
1062
|
+
}, p = this.buildCacheMatchKeys(typeof e.identifier == "string" ? e.identifier : void 0), ke = {
|
|
1045
1063
|
...e,
|
|
1046
|
-
attributes:
|
|
1047
|
-
...
|
|
1048
|
-
},
|
|
1049
|
-
|
|
1064
|
+
attributes: v,
|
|
1065
|
+
...p !== void 0 ? { cacheMatchKeys: p } : {}
|
|
1066
|
+
}, X = this.launcher.selectPlacements(ke), Z = e.preselect === !0, ve = () => {
|
|
1067
|
+
Z || this.logSelectPlacementsEvent(v);
|
|
1050
1068
|
};
|
|
1051
|
-
return Promise.resolve(
|
|
1052
|
-
if (!
|
|
1053
|
-
return
|
|
1069
|
+
return Promise.resolve(X).then((we) => {
|
|
1070
|
+
if (!Z)
|
|
1071
|
+
return we?.context?.sessionId?.then((Te) => this.setRoktSessionId(Te));
|
|
1054
1072
|
}).catch(() => {
|
|
1055
|
-
}).finally(
|
|
1073
|
+
}).finally(ve), X;
|
|
1056
1074
|
}
|
|
1057
1075
|
/**
|
|
1058
1076
|
* Passes attributes to the Rokt Web SDK for client-side hashing.
|
|
@@ -1078,7 +1096,7 @@ const _ = class _ {
|
|
|
1078
1096
|
* here would flip the kit to not-ready with no drain path for queued calls.
|
|
1079
1097
|
*/
|
|
1080
1098
|
terminate() {
|
|
1081
|
-
return this.isKitReady() ? (
|
|
1099
|
+
return this.isKitReady() ? (rt(this._launcherAttachState), this.launcher.terminate()) : (console.error("Rokt Kit: Not initialized"), Promise.resolve());
|
|
1082
1100
|
}
|
|
1083
1101
|
/**
|
|
1084
1102
|
* Registers a callback to be invoked once rokt-thank-you-element.js becomes available.
|
|
@@ -1090,31 +1108,31 @@ const _ = class _ {
|
|
|
1090
1108
|
_._allowedOriginHashes = [-553112570, 549508659], _.PERFORMANCE_MARKS = {
|
|
1091
1109
|
RoktScriptAppended: "mp:RoktScriptAppended"
|
|
1092
1110
|
}, _.EMAIL_SHA256_KEY = "emailsha256";
|
|
1093
|
-
let
|
|
1094
|
-
function
|
|
1095
|
-
return
|
|
1111
|
+
let A = _;
|
|
1112
|
+
function Ot() {
|
|
1113
|
+
return C;
|
|
1096
1114
|
}
|
|
1097
|
-
function
|
|
1115
|
+
function Nt(i) {
|
|
1098
1116
|
if (!i) {
|
|
1099
1117
|
window.console.log("You must pass a config object to register the kit " + d);
|
|
1100
1118
|
return;
|
|
1101
1119
|
}
|
|
1102
|
-
if (!
|
|
1120
|
+
if (!m(i)) {
|
|
1103
1121
|
window.console.log("'config' must be an object. You passed in a " + typeof i);
|
|
1104
1122
|
return;
|
|
1105
1123
|
}
|
|
1106
|
-
|
|
1107
|
-
constructor:
|
|
1124
|
+
m(i.kits) ? i.kits[d] = {
|
|
1125
|
+
constructor: A
|
|
1108
1126
|
} : (i.kits = {}, i.kits[d] = {
|
|
1109
|
-
constructor:
|
|
1127
|
+
constructor: A
|
|
1110
1128
|
}), window.console.log("Successfully registered " + d + " to your mParticle configuration");
|
|
1111
1129
|
}
|
|
1112
1130
|
typeof window < "u" && window.mParticle && a().addForwarder && a().addForwarder({
|
|
1113
1131
|
name: d,
|
|
1114
|
-
constructor:
|
|
1115
|
-
getId:
|
|
1132
|
+
constructor: A,
|
|
1133
|
+
getId: Ot
|
|
1116
1134
|
});
|
|
1117
1135
|
export {
|
|
1118
|
-
|
|
1136
|
+
Nt as register
|
|
1119
1137
|
};
|
|
1120
1138
|
//# sourceMappingURL=Rokt-Kit.esm.js.map
|