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