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