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