@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.
@@ -1,4 +1,4 @@
1
- const Ae = [
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
- ], ve = new Set(Ae);
27
- function le(i) {
28
- return ve.has(i.toLowerCase());
26
+ ], Oe = new Set(Le);
27
+ function me(i) {
28
+ return Oe.has(i.toLowerCase());
29
29
  }
30
- function T(i) {
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
- le(s) || (e[s] = t[s]);
34
+ me(s) || (e[s] = t[s]);
35
35
  }
36
36
  return e;
37
37
  }
38
- function E(i) {
38
+ function m(i) {
39
39
  return typeof i == "object" && i !== null && !Array.isArray(i);
40
40
  }
41
- function m(i) {
41
+ function g(i) {
42
42
  return typeof i == "string";
43
43
  }
44
- function L(i) {
44
+ function U(i) {
45
45
  return typeof i == "function";
46
46
  }
47
- function w(i) {
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 Y(i) {
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 ue(i) {
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 _ = "mp-rokt-kit", q = "__rokt_ls_probe__";
65
- function F() {
64
+ const h = "mp-rokt-kit", ee = "__rokt_ls_probe__";
65
+ function V() {
66
66
  try {
67
- return window.localStorage.setItem(q, "1"), window.localStorage.removeItem(q), !0;
67
+ return window.localStorage.setItem(ee, "1"), window.localStorage.removeItem(ee), !0;
68
68
  } catch {
69
69
  return !1;
70
70
  }
71
71
  }
72
- function j(i) {
72
+ const P = () => window.localStorage;
73
+ function $(i, e = P) {
73
74
  try {
74
- const e = window.localStorage.getItem(i);
75
- return e === null ? null : JSON.parse(e);
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 de(i, e) {
81
+ function _e(i, e, t = P) {
81
82
  try {
82
- return window.localStorage.setItem(i, JSON.stringify(e)), !0;
83
+ return t().setItem(i, JSON.stringify(e)), !0;
83
84
  } catch {
84
85
  return !1;
85
86
  }
86
87
  }
87
- function ke(i) {
88
+ function Ne(i, e = P) {
88
89
  try {
89
- window.localStorage.removeItem(i);
90
+ e().removeItem(i);
90
91
  } catch {
91
92
  }
92
93
  }
93
- function K(i, e) {
94
- const t = j(i);
95
- return E(t) ? t[e] : void 0;
94
+ function T(i, e, t = P) {
95
+ const n = $(i, t);
96
+ return m(n) ? n[e] : void 0;
96
97
  }
97
- function G(i, e, t) {
98
- const n = j(i), r = E(n) ? { ...n } : {};
99
- return r[e] = t, de(i, r);
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 he(i, e) {
102
- const t = j(i);
103
- if (!E(t) || !(e in t))
102
+ function Y(i, e, t = P) {
103
+ const n = $(i, t);
104
+ if (!m(n) || !(e in n))
104
105
  return;
105
- const n = { ...t };
106
- delete n[e], Object.keys(n).length === 0 ? ke(i) : de(i, n);
106
+ const r = { ...n };
107
+ delete r[e], Object.keys(r).length === 0 ? Ne(i, t) : _e(i, r, t);
107
108
  }
108
- const V = "pageViews", U = "utmParams", ge = 25, Pe = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
109
- function pe(i) {
110
- return i.slice(-ge);
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 J() {
113
- const i = K(_, V);
113
+ function te() {
114
+ const i = T(h, q);
114
115
  return Array.isArray(i) ? i : [];
115
116
  }
116
- function Re(i) {
117
- const e = pe(i);
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 (G(_, V, n))
121
+ if (x(h, q, n))
121
122
  return n.length;
122
123
  }
123
124
  return 0;
124
125
  }
125
- function B() {
126
- he(_, V);
126
+ function ie() {
127
+ Y(h, q);
127
128
  }
128
- function be(i) {
129
- const e = pe(i);
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), a = e[n + 1]?.activeTimeOnSite, u = a !== void 0 && Number.isFinite(a), l = s && u ? a - r : void 0;
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 we(i) {
144
- if (K(_, U) !== void 0)
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 Pe) {
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 (!G(_, U, t)) {
155
- const r = F() ? "quota" : "ls_unavailable";
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 Te() {
168
- const i = K(_, U);
169
- return E(i) ? i : null;
168
+ function Me() {
169
+ const i = T(h, D);
170
+ return m(i) ? i : null;
170
171
  }
171
- function Q() {
172
- he(_, U);
172
+ function ne() {
173
+ Y(h, D);
173
174
  }
174
- function Le() {
175
+ function Fe() {
175
176
  const e = document.querySelector('link[rel="canonical"]')?.href;
176
177
  if (e)
177
- return Y(e);
178
+ return z(e);
178
179
  }
179
- const W = [
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
- "country",
196
- "currency",
197
- "language"
195
+ "currency"
198
196
  ]
199
197
  }
200
- ];
201
- function Oe(i, e) {
202
- if (i)
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 De(i, e) {
202
+ function Ge(i, e) {
217
203
  return `activePreselect:${i}:${e}`;
218
204
  }
219
- function Me(i) {
220
- const e = K(_, i);
221
- return Ke(e) ? e : null;
205
+ function je(i) {
206
+ const e = T(h, i);
207
+ return Ye(e) ? e : null;
222
208
  }
223
- function Fe(i, e) {
224
- G(_, i, {
225
- expiresAt: Date.now() + Ce,
209
+ function Ve(i, e) {
210
+ x(h, i, {
211
+ expiresAt: Date.now() + xe,
226
212
  attributes: e
227
213
  });
228
214
  }
229
- function b(i, e) {
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 xe() {
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 M(i, e) {
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 Ye(i) {
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 m(n) && n.length > 0;
286
+ return g(n) && n.length > 0;
259
287
  }) : !1;
260
288
  }
261
- function je(i, e) {
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 fe(i, e, t, n = window.location.pathname) {
271
- const r = Oe(e.accountId, n);
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
- M(i, { event: t, pathname: n }), e.logPlacementDiagnostic(b("queued", "not_ready"));
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 (!Ye(e.filteredUser)) {
281
- e.logPlacementDiagnostic(b("missed", "no_valid_identity")), M(i, { event: t, pathname: n });
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 = e.filteredUser?.getAllUserAttributes?.() || {}, o = {}, a = [];
285
- for (const h of r.attributeKeys) {
286
- const S = e.getEventAttributeValue(t, h), p = w(S) ? e.userAttributes[h] ?? s[h] : S;
287
- if (w(p)) {
288
- a.push(h);
289
- continue;
290
- }
291
- o[h] = p;
292
- }
293
- if (a.length > 0) {
294
- for (const h of a)
295
- e.logPlacementDiagnostic(b("missed", `missing_attribute:${h}`));
296
- M(i, { event: t, pathname: n });
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
- const u = De(e.accountId || "", n), l = Me(u), g = !!l && JSON.stringify(l.attributes) === JSON.stringify(o);
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 Ge(i, e, t = window.location.pathname) {
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 && fe(i, e, r, s);
380
+ s === t && Pe(i, e, r, s);
318
381
  });
319
382
  }
320
- function Ve() {
383
+ function tt() {
321
384
  return {
322
385
  context: null,
323
386
  lifecycle: "idle",
324
387
  recreateInFlight: null
325
388
  };
326
389
  }
327
- function We(i, e) {
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 He(i) {
397
+ function nt(i) {
335
398
  i.lifecycle = "attached";
336
399
  }
337
- function ze(i) {
400
+ function rt(i) {
338
401
  i.lifecycle !== "idle" && (i.lifecycle = "terminated");
339
402
  }
340
- function $e(i) {
403
+ function st(i) {
341
404
  i.lifecycle = "terminated";
342
405
  }
343
- function qe(i) {
406
+ function ot(i) {
344
407
  i.context = null, i.lifecycle = "idle", i.recreateInFlight = null;
345
408
  }
346
- function Je(i, e, t) {
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", O = 181, Be = "selectPlacements", Qe = "apps.roktecommerce.com", Xe = 0.1, Ze = "ThankYouPageJourney", et = "rokt-launcher", tt = "rokt-thank-you-element", it = "userIdentifiedInWorkspace", nt = 3, rt = 2, st = "page_events", ot = "page_view_attributes", ct = "mparticle_session_id", at = "mparticle_device_id", X = 500, H = {
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
- }, A = {
425
+ }, y = {
363
426
  ERROR: "ERROR",
364
427
  INFO: "INFO",
365
428
  WARNING: "WARNING"
366
- }, lt = "apps.rokt-api.com", ut = "/v1/log", dt = "/v1/errors", ht = 10;
367
- function c() {
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 Z(i, e) {
371
- const n = [D(i), "/wsdk/integrations/launcher.js"].join("");
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 ee(i) {
375
- return [D(i), "/rokt-elements/rokt-element-thank-you.js"].join("");
437
+ function ce(i) {
438
+ return [G(i), "/rokt-elements/rokt-element-thank-you.js"].join("");
376
439
  }
377
- function D(i) {
378
- const e = i !== void 0 ? i : lt;
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 me(i, e, t) {
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 D(r) + t;
448
+ return G(r) + t;
386
449
  }
387
- function te(i, e, t) {
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 N(i) {
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 ie(i) {
403
- const e = i ? N(i) : [], t = [], n = [];
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(Ze)) : t.push(o);
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 gt(i, e) {
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 ne(i) {
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 re(i) {
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 || !m(n.value) || !m(n.map))
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 se(i, e, t) {
449
- return c().generateHash([i, e, t].join(""));
511
+ function he(i, e, t) {
512
+ return a().generateHash([i, e, t].join(""));
450
513
  }
451
- function pt(i) {
452
- let n = "mParticle_wsdkv_" + c().getVersion() + "_kitv_" + "3.2.1";
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 x(i) {
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 oe(i, e) {
464
- const t = ue(window.location.origin);
465
- if (v._allowedOriginHashes.indexOf(t) === -1 || Math.random() >= Xe)
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), a = i ? D(i) : "https://apps.rokt.com";
471
- x(a + "/v1/wsdk-init/index.html?" + o), x(
472
- "https://" + Qe + "/v1/wsdk-init/index.html?" + o + "&isControl=true"
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 ft() {
538
+ function vt() {
476
539
  return typeof window < "u" && !!window.location?.search?.toLowerCase().includes("mp_enable_logging=true");
477
540
  }
478
- function mt() {
541
+ function wt() {
479
542
  return typeof window < "u" ? window.location?.href : void 0;
480
543
  }
481
- function Et() {
544
+ function Tt() {
482
545
  return typeof window < "u" ? window.navigator?.userAgent : void 0;
483
546
  }
484
- class Ee {
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 > ht;
553
+ return this._logCount[e] = n, n > Rt;
491
554
  }
492
555
  }
493
- class C {
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 Ee(), this._isEnabled = ft() || o;
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 a = {
565
+ const c = {
503
566
  additionalInformation: {
504
567
  message: n,
505
568
  version: this._integrationName
506
569
  },
507
570
  severity: t,
508
- code: r || H.UNKNOWN_ERROR,
509
- url: mt(),
510
- deviceInfo: Et(),
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(a)
586
+ body: JSON.stringify(c)
524
587
  }).then((l) => {
525
588
  if (!l.ok) {
526
- const g = new Error("HTTP " + l.status + " from log endpoint");
527
- throw g.statusCode = l.status, g;
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 (a) {
533
- console.error("ReportingTransport: Failed to send log", a), o && o(a);
595
+ } catch (c) {
596
+ console.error("ReportingTransport: Failed to send log", c), o && o(c);
534
597
  }
535
598
  }
536
599
  }
537
- class ce {
600
+ class fe {
538
601
  constructor(e, t, n, r, s) {
539
- this._transport = new C(e, t, n, r, s), this._errorUrl = me(e?.errorUrl, e?.integrationDomain, dt);
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 || A.ERROR;
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 ae {
610
+ class pe {
548
611
  constructor(e, t, n, r, s, o) {
549
- this._transport = new C(e, n, r, s, o), this._placementDiagnosticTransport = new C(
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 = me(e?.loggingUrl, e?.integrationDomain, ut), this._errorReportingService = t;
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
- A.INFO,
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: H.LOG_DELIVERY_FAILURE,
575
- severity: r ? A.ERROR : A.WARNING
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 _t(i) {
583
- const e = Y(window.location.href), t = i.EventAttributes?.title || document.title, n = Le(), r = i.ActiveTimeOnSite;
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 I = class I {
656
+ const _ = class _ {
594
657
  constructor() {
595
- this.name = d, this.id = O, this.moduleId = O, this.isInitialized = !1, this.launcher = null, this.filters = {}, this.userAttributes = {}, this.userIdentifiedInWorkspace = !1, this.testHelpers = null, this.placementEventMappingLookup = {}, this.placementEventAttributeMappingLookup = {}, this.integrationName = null, this.errorReportingService = null, this.loggingService = null, this._thankYouElementOnLoadCallback = null, this._isThankYouElementLoaded = !1, this._workspaceSearchInFlightPromise = null, this._launcherAttachState = Ve(), this.accountId = null, this._preselectState = xe();
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 || !m(e.operator))
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 || !m(t.eventAttributeKey))
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 (w(s))
689
+ if (v(s))
627
690
  continue;
628
691
  let o = !0;
629
- for (let a = 0; a < s.length; a++)
630
- if (!this.doesEventMatchRule(e, s[a])) {
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 && c().Rokt.setLocalSessionAttribute?.(r, !0);
697
+ o && a().Rokt.setLocalSessionAttribute?.(r, !0);
635
698
  }
636
699
  }
637
700
  capturePageView(e) {
638
701
  let t;
639
702
  try {
640
- t = Y(window.location.href);
641
- const n = J(), r = _t(e);
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, ge), o = Re(n);
706
+ const s = Math.min(n.length, Ie), o = Ce(n);
644
707
  if (o === 0) {
645
- const a = F() ? "quota" : "ls_unavailable";
708
+ const c = V() ? "quota" : "ls_unavailable";
646
709
  this.loggingService?.log({
647
- message: `Rokt Kit: Failed to persist page view for ${t} [reason: ${a}]`,
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 = F() ? "exception" : "ls_unavailable", s = n instanceof Error ? n.message : String(n);
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 = Ne(this.accountId, e);
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
- Ge(this._preselectState, this.buildPreselectHost());
749
+ et(this._preselectState, this.buildPreselectHost());
687
750
  }
688
751
  isLauncherReadyToAttach() {
689
- return !!window.Rokt && L(window.Rokt.createLauncher);
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 !c().Rokt || typeof c().Rokt.getLocalSessionAttributes != "function" ? {} : c().Rokt.getLocalSessionAttributes();
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[I.EMAIL_SHA256_KEY] = e[n]), n && delete t[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 c().logEvent != "function" || !E(e))
771
+ if (!window.mParticle || typeof a().logEvent != "function" || !m(e))
709
772
  return;
710
- const t = c().EventType.Other;
711
- c().logEvent(Be, t, e);
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 = c().getInstance();
717
- t && L(t.setIntegrationAttribute) && t.setIntegrationAttribute(O, {
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 = c()?.sessionManager, t = e?.getSessionId ?? e?.getSession;
725
- if (L(t))
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 c()?.getDeviceId?.() || void 0;
792
+ return a()?.getDeviceId?.() || void 0;
730
793
  }
731
794
  attachLauncher(e, t, n = []) {
732
- We(this._launcherAttachState, {
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 gt([...n], o), this.initRoktLauncher(o);
806
+ await bt([...n], o), this.initRoktLauncher(o);
744
807
  }).catch((o) => {
745
- $e(this._launcherAttachState), console.error("Error creating Rokt launcher:", o);
808
+ st(this._launcherAttachState), console.error("Error creating Rokt launcher:", o);
746
809
  });
747
810
  }
748
811
  recreateLauncherIfTerminated() {
749
- return Je(
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, He(this._launcherAttachState);
757
- const t = c().Rokt?.filters;
758
- t ? (this.filters = t, t.filteredUser ? this._workspaceSearchInFlightPromise = this.search(t.filteredUser) : console.warn("Rokt Kit: No filtered user has been set.")) : console.warn("Rokt Kit: No filters have been set."), this.isInitialized = !0, oe(this.domain, this.integrationName), c().Rokt.attachKit(this), this.flushPendingPreselectDispatches();
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 = c()._getActiveForwarders().filter((t) => t.name === "Optimizely");
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 c().Rokt?.launcherOptions?.noTargeting === !0;
841
+ return a().Rokt?.launcherOptions?.noTargeting === !0;
779
842
  }
780
843
  isPartnerInLocalLauncherTestGroup() {
781
- return !!(c().config && c().config.isLocalLauncherEnabled && this.isAssignedToSampleGroup());
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 && c() && c().captureTiming && e && c().captureTiming(e);
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, a = o.accountId;
795
- this.accountId = a || null, this.userAttributes = T(s), this._onboardingExpProvider = o.onboardingExpProvider;
796
- const u = N(o.placementEventMapping);
797
- this.placementEventMappingLookup = ne(u);
798
- const l = N(
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 = re(l), o.hashedEmailUserIdentityType && (this._mappedEmailSha256Key = o.hashedEmailUserIdentityType.toLowerCase()), this._workspaceIdSyncApiKey = m(o.workspaceIdSyncApiKey) ? o.workspaceIdSyncApiKey : void 0;
802
- const g = c().Rokt?.domain, { roktExtensionsQueryParams: k, legacyRoktExtensions: h, loadThankYouElement: S } = ie(
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
- ), p = {
805
- ...c().Rokt?.launcherOptions || {}
867
+ ), E = {
868
+ ...a().Rokt?.launcherOptions || {}
806
869
  };
807
- this.integrationName = pt(p.integrationName), p.integrationName = this.integrationName, this.domain = g;
808
- const P = {
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: g,
812
- isLoggingEnabled: c().config?.isLoggingEnabled === !0
813
- }, y = new ce(
814
- P,
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
- ), R = new ae(
819
- P,
820
- y,
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 = y, this.loggingService = R, this.isTargetingDisabled())
888
+ if (this.errorReportingService = I, this.loggingService = b, this.isTargetingDisabled())
826
889
  try {
827
- B(), Q();
828
- } catch (f) {
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: A.INFO,
833
- stackTrace: f instanceof Error ? f.stack : void 0
895
+ severity: y.INFO,
896
+ stackTrace: p instanceof Error ? p.stack : void 0
834
897
  });
835
898
  }
836
- return c()._registerErrorReportingService && c()._registerErrorReportingService(y), c()._registerLoggingService && c()._registerLoggingService(R), n ? (this.testHelpers = {
837
- generateLauncherScript: Z,
838
- generateThankYouElementScript: ee,
839
- extractRoktExtensionConfig: ie,
840
- hashEventMessage: se,
841
- parseSettingsString: N,
842
- generateMappedEventLookup: ne,
843
- generateMappedEventAttributeLookup: re,
844
- sendAdBlockMeasurementSignals: oe,
845
- createAutoRemovedIframe: x,
846
- djb2: ue,
847
- setAllowedOriginHashes: (f) => {
848
- I._allowedOriginHashes = f;
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: C,
851
- ErrorReportingService: ce,
852
- LoggingService: ae,
853
- RateLimiter: Ee,
854
- ErrorCodes: H,
855
- WSDKErrorSeverity: A,
856
- resetLauncherAttachState: () => qe(this._launcherAttachState)
857
- }, this.attachLauncher(a, p), "Successfully initialized: " + d) : (S && (c().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this), te(tt, ee(g), {
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: (f) => {
862
- console.error("Error loading Rokt Thank You Element script:", f);
924
+ onError: (p) => {
925
+ console.error("Error loading Rokt Thank You Element script:", p);
863
926
  }
864
- })), this.isLauncherReadyToAttach() ? this.attachLauncher(a, p, h) : (te(et, Z(g, k), {
927
+ })), this.isLauncherReadyToAttach() ? this.attachLauncher(c, E, O) : (ae(ht, oe(f, L), {
865
928
  onLoad: () => {
866
- this.isLauncherReadyToAttach() ? this.attachLauncher(a, p, h) : console.error("Rokt object is not available after script load.");
929
+ this.isLauncherReadyToAttach() ? this.attachLauncher(c, E, O) : console.error("Rokt object is not available after script load.");
867
930
  },
868
- onError: (f) => {
869
- console.error("Error loading Rokt launcher script:", f);
931
+ onError: (p) => {
932
+ console.error("Error loading Rokt launcher script:", p);
870
933
  }
871
- }), this.captureTiming(I.PERFORMANCE_MARKS.RoktScriptAppended)), "Successfully initialized: " + d);
934
+ }), this.captureTiming(_.PERFORMANCE_MARKS.RoktScriptAppended)), "Successfully initialized: " + d);
872
935
  }
873
936
  process(e) {
874
- if (this.isTargetingDisabled() || (e.EventDataType === nt && (we(this.loggingService), this.capturePageView(e), fe(this._preselectState, this.buildPreselectHost(), e)), e.EventDataType === rt && (B(), Q())), !this.isKitReady())
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 (L(c().Rokt?.setLocalSessionAttribute) && (w(this.placementEventAttributeMappingLookup) || this.applyPlacementEventAttributeMapping(e), !w(this.placementEventMappingLookup))) {
877
- const t = se(e.EventDataType, e.EventCategory, e.EventName ?? "");
878
- this.placementEventMappingLookup[String(t)] && c().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)], !0);
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 le(e) || (this.userAttributes[e] = t), Ue(this.accountId, e) && this.flushPendingPreselectDispatches(), "Successfully set user attribute for forwarder: " + d;
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 = T(e.getAllUserAttributes()), "Successfully called " + t + " for forwarder: " + d;
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 = c().Identity?.search;
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
- m(l) && l.length > 0 && (s[u] = l);
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 a = o.sort().map((u) => `${u}=${s[u]}`).join("&");
921
- return a === this._workspaceLastSearchedIdentitiesKey ? this._workspaceSearchInFlightPromise || Promise.resolve() : (this.userIdentifiedInWorkspace = !1, this._workspaceLastSearchedIdentitiesKey = a, new Promise((u) => {
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, X))
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, X))
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 = { ...T(this.userAttributes), ...t }, s = this.filters || {}, o = s.userAttributeFilters || [], a = s.filteredUser || null, u = a ? a.getMPID() : null;
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 = T(l);
988
- const g = this._onboardingExpProvider === "Optimizely" ? this.fetchOptimizely() : {}, k = this.returnUserIdentities(a), h = this.returnLocalSessionAttributes(), S = be(J()), p = Te(), P = this.readMpSessionId(), y = this.readMpDeviceId(), R = {
989
- ...k,
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
- ...g,
992
- ...h,
993
- ...S.length ? { [st]: JSON.stringify(S) } : {},
994
- ...p ? { [ot]: p } : {},
995
- ...this.userIdentifiedInWorkspace ? { [it]: !0 } : {},
996
- ...P ? { [ct]: P } : {},
997
- ...y ? { [at]: y } : {},
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
- }, f = this.buildCacheMatchKeys(typeof e.identifier == "string" ? e.identifier : void 0), _e = {
1062
+ }, p = this.buildCacheMatchKeys(typeof e.identifier == "string" ? e.identifier : void 0), ke = {
1000
1063
  ...e,
1001
- attributes: R,
1002
- ...f !== void 0 ? { cacheMatchKeys: f } : {}
1003
- }, z = this.launcher.selectPlacements(_e), $ = e.preselect === !0, Ie = () => {
1004
- $ || this.logSelectPlacementsEvent(R);
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(z).then((Se) => {
1007
- if (!$)
1008
- return Se?.context?.sessionId?.then((ye) => this.setRoktSessionId(ye));
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(Ie), z;
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 || !m(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")));
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() ? (ze(this._launcherAttachState), this.launcher.terminate()) : (console.error("Rokt Kit: Not initialized"), Promise.resolve());
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
- I._allowedOriginHashes = [-553112570, 549508659], I.PERFORMANCE_MARKS = {
1108
+ _._allowedOriginHashes = [-553112570, 549508659], _.PERFORMANCE_MARKS = {
1046
1109
  RoktScriptAppended: "mp:RoktScriptAppended"
1047
- }, I.EMAIL_SHA256_KEY = "emailsha256";
1048
- let v = I;
1049
- function It() {
1050
- return O;
1110
+ }, _.EMAIL_SHA256_KEY = "emailsha256";
1111
+ let A = _;
1112
+ function Ot() {
1113
+ return C;
1051
1114
  }
1052
- function St(i) {
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 (!E(i)) {
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
- E(i.kits) ? i.kits[d] = {
1062
- constructor: v
1124
+ m(i.kits) ? i.kits[d] = {
1125
+ constructor: A
1063
1126
  } : (i.kits = {}, i.kits[d] = {
1064
- constructor: v
1127
+ constructor: A
1065
1128
  }), window.console.log("Successfully registered " + d + " to your mParticle configuration");
1066
1129
  }
1067
- typeof window < "u" && window.mParticle && c().addForwarder && c().addForwarder({
1130
+ typeof window < "u" && window.mParticle && a().addForwarder && a().addForwarder({
1068
1131
  name: d,
1069
- constructor: v,
1070
- getId: It
1132
+ constructor: A,
1133
+ getId: Ot
1071
1134
  });
1072
1135
  export {
1073
- St as register
1136
+ Nt as register
1074
1137
  };
1075
1138
  //# sourceMappingURL=Rokt-Kit.esm.js.map