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