@mparticle/web-rokt-kit 3.8.0 → 3.9.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.
@@ -1,4 +1,4 @@
1
- const Ne = [
1
+ const Fe = [
2
2
  "active_time_on_site_ms",
3
3
  "billingaddress1",
4
4
  "billingaddress2",
@@ -23,19 +23,19 @@ const Ne = [
23
23
  "shippingstate",
24
24
  "shippingzipcode",
25
25
  "totalprice"
26
- ], Ue = new Set(Ne);
27
- function me(i) {
28
- return Ue.has(i.toLowerCase());
26
+ ], xe = new Set(Fe);
27
+ function Ae(i) {
28
+ return xe.has(i.toLowerCase());
29
29
  }
30
30
  function y(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
- me(s) || (e[s] = t[s]);
34
+ Ae(s) || (e[s] = t[s]);
35
35
  }
36
36
  return e;
37
37
  }
38
- function m(i) {
38
+ function p(i) {
39
39
  return typeof i == "object" && i !== null && !Array.isArray(i);
40
40
  }
41
41
  function g(i) {
@@ -47,7 +47,7 @@ function U(i) {
47
47
  function A(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 z(i) {
50
+ function J(i) {
51
51
  try {
52
52
  const e = new URL(i);
53
53
  return e.search = "", e.toString();
@@ -55,22 +55,22 @@ function z(i) {
55
55
  return i;
56
56
  }
57
57
  }
58
- function Ee(i) {
58
+ function Pe(i) {
59
59
  let e = 5381;
60
60
  for (let t = 0; t < i.length; t++)
61
61
  e = (e << 5) + e + i.charCodeAt(t), e = e & e;
62
62
  return e;
63
63
  }
64
- const h = "mp-rokt-kit", ee = "__rokt_ls_probe__";
65
- function H() {
64
+ const h = "mp-rokt-kit", se = "__rokt_ls_probe__";
65
+ function V() {
66
66
  try {
67
- return window.localStorage.setItem(ee, "1"), window.localStorage.removeItem(ee), !0;
67
+ return window.localStorage.setItem(se, "1"), window.localStorage.removeItem(se), !0;
68
68
  } catch {
69
69
  return !1;
70
70
  }
71
71
  }
72
- const R = () => window.localStorage;
73
- function $(i, e = R) {
72
+ const v = () => window.localStorage;
73
+ function B(i, e = v) {
74
74
  try {
75
75
  const t = e().getItem(i);
76
76
  return t === null ? null : JSON.parse(t);
@@ -78,56 +78,56 @@ function $(i, e = R) {
78
78
  return null;
79
79
  }
80
80
  }
81
- function _e(i, e, t = R) {
81
+ function be(i, e, t = v) {
82
82
  try {
83
83
  return t().setItem(i, JSON.stringify(e)), !0;
84
84
  } catch {
85
85
  return !1;
86
86
  }
87
87
  }
88
- function Ke(i, e = R) {
88
+ function Ye(i, e = v) {
89
89
  try {
90
90
  e().removeItem(i);
91
91
  } catch {
92
92
  }
93
93
  }
94
- function O(i, e, t = R) {
95
- const n = $(i, t);
96
- return m(n) ? n[e] : void 0;
94
+ function O(i, e, t = v) {
95
+ const n = B(i, t);
96
+ return p(n) ? n[e] : void 0;
97
97
  }
98
- function x(i, e, t, n = R) {
99
- const r = $(i, n), s = m(r) ? { ...r } : {};
100
- return s[e] = t, _e(i, s, n);
98
+ function x(i, e, t, n = v) {
99
+ const r = B(i, n), s = p(r) ? { ...r } : {};
100
+ return s[e] = t, be(i, s, n);
101
101
  }
102
- function Y(i, e, t = R) {
103
- const n = $(i, t);
104
- if (!m(n) || !(e in n))
102
+ function Y(i, e, t = v) {
103
+ const n = B(i, t);
104
+ if (!p(n) || !(e in n))
105
105
  return;
106
106
  const r = { ...n };
107
- delete r[e], Object.keys(r).length === 0 ? Ke(i, t) : _e(i, r, t);
107
+ delete r[e], Object.keys(r).length === 0 ? Ye(i, t) : be(i, r, t);
108
108
  }
109
- const q = "pageViews", D = "utmParams", Ie = 25, Ce = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
110
- function ye(i) {
111
- return i.slice(-Ie);
109
+ const Q = "pageViews", D = "utmParams", Se = 25, je = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
110
+ function ve(i) {
111
+ return i.slice(-Se);
112
112
  }
113
- function te() {
114
- const i = O(h, q);
113
+ function oe() {
114
+ const i = O(h, Q);
115
115
  return Array.isArray(i) ? i : [];
116
116
  }
117
- function De(i) {
118
- const e = ye(i);
117
+ function Ge(i) {
118
+ const e = ve(i);
119
119
  for (let t = 0; t < e.length; t++) {
120
120
  const n = e.slice(t);
121
- if (x(h, q, n))
121
+ if (x(h, Q, n))
122
122
  return n.length;
123
123
  }
124
124
  return 0;
125
125
  }
126
- function ie() {
127
- Y(h, q);
126
+ function ce() {
127
+ Y(h, Q);
128
128
  }
129
- function Me(i) {
130
- const e = ye(i);
129
+ function He(i) {
130
+ const e = ve(i);
131
131
  return e.map((t, n) => {
132
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;
133
133
  return {
@@ -141,11 +141,11 @@ function Me(i) {
141
141
  };
142
142
  });
143
143
  }
144
- function Fe(i) {
144
+ function Ve(i) {
145
145
  if (O(h, D) !== void 0)
146
146
  return;
147
147
  const e = new URLSearchParams(window.location.search), t = {};
148
- for (const r of Ce) {
148
+ for (const r of je) {
149
149
  const s = e.get(r);
150
150
  s && (t[r] = s);
151
151
  }
@@ -153,7 +153,7 @@ function Fe(i) {
153
153
  return;
154
154
  const n = Object.keys(t).join(", ");
155
155
  if (!x(h, D, t)) {
156
- const r = H() ? "quota" : "ls_unavailable";
156
+ const r = V() ? "quota" : "ls_unavailable";
157
157
  i?.log({
158
158
  message: `Rokt Kit: Failed to persist UTM params [reason: ${r}]`,
159
159
  code: "UTM_CAPTURE_FAILED"
@@ -165,19 +165,19 @@ function Fe(i) {
165
165
  code: "UTM_CAPTURE_SUCCESS"
166
166
  });
167
167
  }
168
- function xe() {
168
+ function We() {
169
169
  const i = O(h, D);
170
- return m(i) ? i : null;
170
+ return p(i) ? i : null;
171
171
  }
172
- function ne() {
172
+ function ae() {
173
173
  Y(h, D);
174
174
  }
175
- function Ye() {
175
+ function ze() {
176
176
  const e = document.querySelector('link[rel="canonical"]')?.href;
177
177
  if (e)
178
- return z(e);
178
+ return J(e);
179
179
  }
180
- const J = [
180
+ const j = [
181
181
  {
182
182
  accountId: "2919171670744024290",
183
183
  pathname: "/checkout",
@@ -230,9 +230,7 @@ const J = [
230
230
  pathname: "/checkout/*/review",
231
231
  targetPageIdentifier: "ppx-ad-view-prod",
232
232
  attributeKeys: [
233
- "email",
234
- "firstname",
235
- "lastname"
233
+ "email"
236
234
  ],
237
235
  optionalAttributeKeys: [
238
236
  "email"
@@ -244,51 +242,55 @@ const J = [
244
242
  targetPageIdentifier: "new_confirmation",
245
243
  attributeKeys: [
246
244
  "email",
247
- "firstname",
248
- "lastname"
245
+ "showPlacement",
246
+ "post_purchase_variant"
249
247
  ],
250
248
  optionalAttributeKeys: [
251
- "firstname",
252
- "lastname"
253
- ]
249
+ "showPlacement",
250
+ "post_purchase_variant"
251
+ ],
252
+ preselectAttributeOverrides: {
253
+ showPlacement: "rokt",
254
+ post_purchase_variant: "treatment"
255
+ }
254
256
  }
255
- ], Ge = 6e4;
256
- function je(i) {
257
- return m(i) && typeof i.expiresAt == "number" && m(i.attributes);
257
+ ], $e = 6e4;
258
+ function qe(i) {
259
+ return p(i) && typeof i.expiresAt == "number" && p(i.attributes);
258
260
  }
259
- function He(i, e) {
261
+ function Je(i, e) {
260
262
  return `activePreselect:${i}:${e}`;
261
263
  }
262
- function Ve(i) {
264
+ function Be(i) {
263
265
  const e = O(h, i);
264
- return je(e) ? e : null;
266
+ return qe(e) ? e : null;
265
267
  }
266
- function We(i, e) {
268
+ function Qe(i, e) {
267
269
  x(h, i, {
268
- expiresAt: Date.now() + Ge,
270
+ expiresAt: Date.now() + $e,
269
271
  attributes: e
270
272
  });
271
273
  }
272
- const ze = 5 * 6e4;
274
+ const Xe = 5 * 6e4;
273
275
  function M() {
274
276
  return window.sessionStorage;
275
277
  }
276
- function $e(i) {
277
- return m(i) && typeof i.expiresAt == "number" && g(i.pathname) && g(i.identifier) && m(i.attributes) && g(i.mpid);
278
+ function Ze(i) {
279
+ return p(i) && typeof i.expiresAt == "number" && g(i.pathname) && g(i.identifier) && p(i.attributes) && g(i.mpid);
278
280
  }
279
- function B(i) {
281
+ function X(i) {
280
282
  return `pendingPreselect:${i}`;
281
283
  }
282
- function qe(i) {
283
- const e = B(i), t = O(h, e, M);
284
- return $e(t) ? t.expiresAt <= Date.now() ? (Y(h, e, M), null) : t : null;
284
+ function et(i) {
285
+ const e = X(i), t = O(h, e, M);
286
+ return Ze(t) ? t.expiresAt <= Date.now() ? (Y(h, e, M), null) : t : null;
285
287
  }
286
- function Je(i, e, t, n, r) {
288
+ function tt(i, e, t, n, r) {
287
289
  return x(
288
290
  h,
289
- B(i),
291
+ X(i),
290
292
  {
291
- expiresAt: Date.now() + ze,
293
+ expiresAt: Date.now() + Xe,
292
294
  pathname: e,
293
295
  identifier: t,
294
296
  attributes: n,
@@ -298,9 +300,9 @@ function Je(i, e, t, n, r) {
298
300
  );
299
301
  }
300
302
  function L(i) {
301
- Y(h, B(i), M);
303
+ Y(h, X(i), M);
302
304
  }
303
- function S(i, e) {
305
+ function P(i, e) {
304
306
  const t = {
305
307
  fired: "PRESELECT_FIRED",
306
308
  missed: "PRESELECT_MISSED",
@@ -312,7 +314,7 @@ function S(i, e) {
312
314
  code: t[i]
313
315
  };
314
316
  }
315
- function Be(i, e) {
317
+ function it(i, e) {
316
318
  if (!i.includes("*"))
317
319
  return i === e;
318
320
  const t = i.split("/"), n = e.split("/");
@@ -320,31 +322,55 @@ function Be(i, e) {
320
322
  (r, s) => r === "*" ? n[s] !== "" : r === n[s]
321
323
  );
322
324
  }
323
- function Ae(i, e) {
325
+ const ke = {};
326
+ function W(i) {
327
+ return i === ke;
328
+ }
329
+ function Re(i, e) {
324
330
  if (i)
325
- return J.find(
326
- (t) => t.accountId === i && Be(t.pathname, e)
331
+ return j.find(
332
+ (t) => t.accountId === i && it(t.pathname, e)
327
333
  );
328
334
  }
329
- function Qe(i, e) {
335
+ function z(i, e) {
330
336
  if (!(!i || !g(e)))
331
- return J.find((t) => t.accountId === i && t.targetPageIdentifier === e);
337
+ return j.find((t) => t.accountId === i && t.targetPageIdentifier === e);
338
+ }
339
+ function we(i, e) {
340
+ if (!e)
341
+ return i;
342
+ const t = new Set(Object.keys(e).map((r) => r.toLowerCase())), n = {};
343
+ for (const [r, s] of Object.entries(i))
344
+ t.has(r.toLowerCase()) || (n[r] = s);
345
+ return { ...n, ...e };
332
346
  }
333
- function Xe(i, e) {
334
- return i ? J.some((t) => t.accountId === i && t.attributeKeys.includes(e)) : !1;
347
+ function nt(i) {
348
+ const e = Object.keys(i.preselectAttributeOverrides ?? {});
349
+ return [...i.attributeKeys, ...e.filter((t) => !i.attributeKeys.includes(t))];
335
350
  }
336
- function Ze() {
351
+ function rt(i) {
352
+ return i ? j.some((e) => e.accountId === i) : !1;
353
+ }
354
+ function st(i, e, t = window.location.pathname) {
355
+ i.pending.some((n) => n.pathname === t && !W(n.event)) || Z(i, e, ke, t);
356
+ }
357
+ function ot(i, e) {
358
+ return i ? j.some((t) => t.accountId === i && t.attributeKeys.includes(e)) : !1;
359
+ }
360
+ function ct() {
337
361
  return { pending: [] };
338
362
  }
339
- function j(i, e) {
363
+ function H(i, e) {
340
364
  const t = i.pending.findIndex((n) => n.pathname === e.pathname);
341
365
  if (t >= 0) {
366
+ if (W(e.event) && !W(i.pending[t].event))
367
+ return;
342
368
  i.pending[t] = e;
343
369
  return;
344
370
  }
345
371
  i.pending.push(e);
346
372
  }
347
- function V(i) {
373
+ function $(i) {
348
374
  if (!i?.getUserIdentities)
349
375
  return !1;
350
376
  const e = i.getUserIdentities().userIdentities;
@@ -353,15 +379,15 @@ function V(i) {
353
379
  return g(n) && n.length > 0;
354
380
  }) : !1;
355
381
  }
356
- function Se(i) {
382
+ function Te(i) {
357
383
  const e = i?.getMPID?.();
358
384
  return e == null ? null : String(e);
359
385
  }
360
- function Pe(i, e) {
386
+ function Le(i, e) {
361
387
  const t = new Set((i.optionalAttributeKeys ?? []).map((n) => n.toLowerCase()));
362
388
  return i.attributeKeys.filter((n) => !t.has(n.toLowerCase()) && A(e[n]));
363
389
  }
364
- function re(i, e, t) {
390
+ function le(i, e, t) {
365
391
  const n = i.filteredUser?.getAllUserAttributes?.() || {}, r = {};
366
392
  for (const s of t.attributeKeys) {
367
393
  const o = i.getEventAttributeValue(e, s), c = A(o) ? i.userAttributes[s] ?? n[s] : o;
@@ -369,10 +395,10 @@ function re(i, e, t) {
369
395
  }
370
396
  return {
371
397
  collected: r,
372
- missingKeys: Pe(t, r)
398
+ missingKeys: Le(t, r)
373
399
  };
374
400
  }
375
- function et(i, e) {
401
+ function at(i, e) {
376
402
  Promise.resolve(i.selectPlacements(e)).catch((t) => {
377
403
  const n = t instanceof Error ? t.message : String(t);
378
404
  i.log({
@@ -381,18 +407,21 @@ function et(i, e) {
381
407
  });
382
408
  });
383
409
  }
384
- function be(i, e, t, n, r, s) {
385
- const o = He(e, t), c = Ve(o), u = !!c && JSON.stringify(c.attributes) === JSON.stringify(r);
386
- if (c && c.expiresAt > Date.now() && u) {
387
- i.logPlacementDiagnostic(S("skipped", "active_preselection"));
410
+ function Oe(i, e, t, n, r, s) {
411
+ const o = Je(e, t), c = Be(o), u = we(
412
+ r,
413
+ z(e, n)?.preselectAttributeOverrides
414
+ ), l = !!c && JSON.stringify(c.attributes) === JSON.stringify(u);
415
+ if (c && c.expiresAt > Date.now() && l) {
416
+ i.logPlacementDiagnostic(P("skipped", "active_preselection"));
388
417
  return;
389
418
  }
390
- We(o, r), i.logPlacementDiagnostic(S("fired", s)), et(i, { attributes: r, preselect: !0, identifier: n, omitUrl: !0 });
419
+ Qe(o, u), i.logPlacementDiagnostic(P("fired", s)), at(i, { attributes: r, preselect: !0, identifier: n, omitUrl: !0 });
391
420
  }
392
- function tt(i, e) {
421
+ function lt(i, e) {
393
422
  if (!e.accountId || !e.isKitReady())
394
423
  return;
395
- const t = qe(e.accountId);
424
+ const t = et(e.accountId);
396
425
  if (!t)
397
426
  return;
398
427
  if (i.pending.some((o) => o.pathname === t.pathname)) {
@@ -403,91 +432,91 @@ function tt(i, e) {
403
432
  L(e.accountId);
404
433
  return;
405
434
  }
406
- if (!V(e.filteredUser) || (L(e.accountId), Se(e.filteredUser) !== t.mpid))
435
+ if (!$(e.filteredUser) || (L(e.accountId), Te(e.filteredUser) !== t.mpid))
407
436
  return;
408
- const n = Ae(e.accountId, t.pathname);
437
+ const n = Re(e.accountId, t.pathname);
409
438
  if (!n || n.targetPageIdentifier !== t.identifier)
410
439
  return;
411
- const r = y(t.attributes), s = Pe(n, r);
440
+ const r = y(t.attributes), s = Le(n, r);
412
441
  if (s.length > 0) {
413
442
  for (const o of s)
414
- e.logPlacementDiagnostic(S("missed", `missing_persisted_attribute:${o}`));
443
+ e.logPlacementDiagnostic(P("missed", `missing_persisted_attribute:${o}`));
415
444
  return;
416
445
  }
417
- be(e, e.accountId, t.identifier, t.identifier, r, "recovered");
446
+ Oe(e, e.accountId, t.identifier, t.identifier, r, "recovered");
418
447
  }
419
- function Re(i, e, t, n = window.location.pathname) {
420
- const r = Ae(e.accountId, n);
448
+ function Z(i, e, t, n = window.location.pathname) {
449
+ const r = Re(e.accountId, n);
421
450
  if (!r)
422
451
  return;
423
452
  if (!e.isKitReady()) {
424
- const c = [], u = Se(e.filteredUser);
425
- if (e.accountId && u && V(e.filteredUser)) {
426
- const { collected: l, missingKeys: f } = re(e, t, r);
453
+ const c = [], u = Te(e.filteredUser);
454
+ if (e.accountId && u && $(e.filteredUser)) {
455
+ const { collected: l, missingKeys: f } = le(e, t, r);
427
456
  if (f.length === 0) {
428
457
  const k = y(l);
429
- Je(
458
+ tt(
430
459
  e.accountId,
431
460
  n,
432
461
  r.targetPageIdentifier,
433
462
  k,
434
463
  u
435
- ) || c.push(S("queued", "persist_failed"));
464
+ ) || c.push(P("queued", "persist_failed"));
436
465
  }
437
466
  }
438
- j(i, { event: t, pathname: n, storedDiagnostics: c });
467
+ H(i, { event: t, pathname: n, storedDiagnostics: c });
439
468
  return;
440
469
  }
441
470
  if (!e.isPreselectionEnabled())
442
471
  return;
443
- if (!V(e.filteredUser)) {
444
- e.logPlacementDiagnostic(S("missed", "no_valid_identity")), j(i, { event: t, pathname: n });
472
+ if (!$(e.filteredUser)) {
473
+ e.logPlacementDiagnostic(P("missed", "no_valid_identity")), H(i, { event: t, pathname: n });
445
474
  return;
446
475
  }
447
- const { collected: s, missingKeys: o } = re(e, t, r);
476
+ const { collected: s, missingKeys: o } = le(e, t, r);
448
477
  if (o.length > 0) {
449
478
  for (const c of o)
450
- e.logPlacementDiagnostic(S("missed", `missing_attribute:${c}`));
451
- j(i, { event: t, pathname: n });
479
+ e.logPlacementDiagnostic(P("missed", `missing_attribute:${c}`));
480
+ H(i, { event: t, pathname: n });
452
481
  return;
453
482
  }
454
- be(e, e.accountId || "", n, r.targetPageIdentifier, s, "fired");
483
+ Oe(e, e.accountId || "", n, r.targetPageIdentifier, s, "fired");
455
484
  }
456
- function it(i, e, t = window.location.pathname) {
457
- if (tt(i, e), i.pending.length === 0)
485
+ function ut(i, e, t = window.location.pathname) {
486
+ if (lt(i, e), i.pending.length === 0)
458
487
  return;
459
488
  const n = i.pending;
460
489
  i.pending = [], n.forEach(({ event: r, pathname: s, storedDiagnostics: o }) => {
461
- s === t && (e.isKitReady() && e.isPreselectionEnabled() && o?.forEach((c) => e.logPlacementDiagnostic(c)), Re(i, e, r, s));
490
+ s === t && (e.isKitReady() && e.isPreselectionEnabled() && o?.forEach((c) => e.logPlacementDiagnostic(c)), Z(i, e, r, s));
462
491
  });
463
492
  }
464
- function nt() {
493
+ function dt() {
465
494
  return {
466
495
  context: null,
467
496
  lifecycle: "idle",
468
497
  recreateInFlight: null
469
498
  };
470
499
  }
471
- function rt(i, e) {
500
+ function ht(i, e) {
472
501
  i.context = {
473
502
  accountId: e.accountId,
474
503
  launcherOptions: { ...e.launcherOptions },
475
504
  legacyRoktExtensions: [...e.legacyRoktExtensions]
476
505
  };
477
506
  }
478
- function st(i) {
507
+ function gt(i) {
479
508
  i.lifecycle = "attached";
480
509
  }
481
- function ot(i) {
510
+ function ft(i) {
482
511
  i.lifecycle !== "idle" && (i.lifecycle = "terminated");
483
512
  }
484
- function ct(i) {
513
+ function pt(i) {
485
514
  i.lifecycle = "terminated";
486
515
  }
487
- function at(i) {
516
+ function mt(i) {
488
517
  i.context = null, i.lifecycle = "idle", i.recreateInFlight = null;
489
518
  }
490
- function lt(i, e, t) {
519
+ function Et(i, e, t) {
491
520
  if (i.recreateInFlight)
492
521
  return i.recreateInFlight;
493
522
  if (i.lifecycle !== "terminated" || !i.context || !e)
@@ -498,37 +527,37 @@ function lt(i, e, t) {
498
527
  i.recreateInFlight = null;
499
528
  }), i.recreateInFlight;
500
529
  }
501
- const d = "Rokt", K = 181, ut = "selectPlacements", dt = "apps.roktecommerce.com", ht = 0.1, gt = "ThankYouPageJourney", ft = "rokt-launcher", pt = "rokt-thank-you-element", mt = "userIdentifiedInWorkspace", Et = 3, _t = 2, It = "page_events", yt = "page_view_attributes", At = "mparticle_session_id", St = "mparticle_device_id", se = 500, Q = {
530
+ const d = "Rokt", K = 181, _t = "selectPlacements", It = "apps.roktecommerce.com", yt = 0.1, At = "ThankYouPageJourney", Pt = "rokt-launcher", bt = "rokt-thank-you-element", St = "userIdentifiedInWorkspace", vt = 3, kt = 2, Rt = "page_events", wt = "page_view_attributes", Tt = "mparticle_session_id", Lt = "mparticle_device_id", ue = 500, ee = {
502
531
  UNKNOWN_ERROR: "UNKNOWN_ERROR",
503
532
  UNHANDLED_EXCEPTION: "UNHANDLED_EXCEPTION",
504
533
  IDENTITY_REQUEST: "IDENTITY_REQUEST",
505
534
  LOG_DELIVERY_FAILURE: "LOG_DELIVERY_FAILURE"
506
- }, P = {
535
+ }, b = {
507
536
  ERROR: "ERROR",
508
537
  INFO: "INFO",
509
538
  WARNING: "WARNING"
510
- }, Pt = "apps.rokt-api.com", bt = "/v1/log", Rt = "/v1/errors", kt = 10;
539
+ }, Ot = "apps.rokt-api.com", Nt = "/v1/log", Ut = "/v1/errors", Kt = 10;
511
540
  function a() {
512
541
  return window.mParticle;
513
542
  }
514
- function oe(i, e) {
543
+ function de(i, e) {
515
544
  const n = [G(i), "/wsdk/integrations/launcher.js"].join("");
516
545
  return !e || e.length === 0 ? n : n + "?extensions=" + e.join(",");
517
546
  }
518
- function ce(i) {
547
+ function he(i) {
519
548
  return [G(i), "/rokt-elements/rokt-element-thank-you.js"].join("");
520
549
  }
521
550
  function G(i) {
522
- const e = i !== void 0 ? i : Pt;
551
+ const e = i !== void 0 ? i : Ot;
523
552
  return e.includes("://") ? e.replace(/\/+$/, "") : ["https://", e].join("");
524
553
  }
525
- function ke(i, e, t) {
554
+ function Ne(i, e, t) {
526
555
  if (i)
527
556
  return i.startsWith("http://") || i.startsWith("https://") ? i : "https://" + i;
528
557
  const r = e?.includes("://") && !/^https?:\/\//i.test(e) ? void 0 : e;
529
558
  return G(r) + t;
530
559
  }
531
- function ae(i, e, t) {
560
+ function ge(i, e, t) {
532
561
  if (document.getElementById(i)) return;
533
562
  const n = document.head || document.body, r = document.createElement("script");
534
563
  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);
@@ -543,12 +572,12 @@ function C(i) {
543
572
  }
544
573
  return [];
545
574
  }
546
- function le(i) {
575
+ function fe(i) {
547
576
  const e = i ? C(i) : [], t = [], n = [];
548
577
  let r = !1;
549
578
  for (let s = 0; s < e.length; s++) {
550
579
  const o = e[s].value;
551
- o === "thank-you-journey" ? (r = !0, n.push(gt)) : t.push(o);
580
+ o === "thank-you-journey" ? (r = !0, n.push(At)) : t.push(o);
552
581
  }
553
582
  return {
554
583
  roktExtensionsQueryParams: t,
@@ -556,14 +585,14 @@ function le(i) {
556
585
  loadThankYouElement: r
557
586
  };
558
587
  }
559
- async function vt(i, e) {
588
+ async function Ct(i, e) {
560
589
  const t = [];
561
590
  if (e)
562
591
  for (const n of i)
563
592
  t.push(e.use(n));
564
593
  return Promise.all(t);
565
594
  }
566
- function ue(i) {
595
+ function pe(i) {
567
596
  if (!i)
568
597
  return {};
569
598
  const e = {};
@@ -573,7 +602,7 @@ function ue(i) {
573
602
  }
574
603
  return e;
575
604
  }
576
- function de(i) {
605
+ function me(i) {
577
606
  const e = {};
578
607
  if (!Array.isArray(i))
579
608
  return e;
@@ -589,14 +618,14 @@ function de(i) {
589
618
  }
590
619
  return e;
591
620
  }
592
- function he(i, e, t) {
621
+ function Ee(i, e, t) {
593
622
  return a().generateHash([i, e, t].join(""));
594
623
  }
595
- function wt(i) {
596
- let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "3.8.0";
624
+ function Dt(i) {
625
+ let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "3.9.0";
597
626
  return i && (n += "_" + i), n;
598
627
  }
599
- function W(i) {
628
+ function q(i) {
600
629
  const e = document.createElement("iframe");
601
630
  e.style.display = "none", e.setAttribute("sandbox", "allow-scripts allow-same-origin"), e.src = i, e.onload = function() {
602
631
  e.onload = null, e.parentNode && e.parentNode.removeChild(e);
@@ -604,41 +633,41 @@ function W(i) {
604
633
  const t = document.body || document.head;
605
634
  t && t.appendChild(e);
606
635
  }
607
- function ge(i, e) {
608
- const t = Ee(window.location.origin);
609
- if (b._allowedOriginHashes.indexOf(t) === -1 || Math.random() >= ht)
636
+ function _e(i, e) {
637
+ const t = Pe(window.location.origin);
638
+ if (S._allowedOriginHashes.indexOf(t) === -1 || Math.random() >= yt)
610
639
  return;
611
640
  const r = window.__rokt_li_guid__;
612
641
  if (!r || i && i.includes("://") && !/^https:\/\//i.test(i))
613
642
  return;
614
643
  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";
615
- W(c + "/v1/wsdk-init/index.html?" + o), W(
616
- "https://" + dt + "/v1/wsdk-init/index.html?" + o + "&isControl=true"
644
+ q(c + "/v1/wsdk-init/index.html?" + o), q(
645
+ "https://" + It + "/v1/wsdk-init/index.html?" + o + "&isControl=true"
617
646
  );
618
647
  }
619
- function Tt() {
648
+ function Mt() {
620
649
  return typeof window < "u" && !!window.location?.search?.toLowerCase().includes("mp_enable_logging=true");
621
650
  }
622
- function Lt() {
651
+ function Ft() {
623
652
  return typeof window < "u" ? window.location?.href : void 0;
624
653
  }
625
- function Ot() {
654
+ function xt() {
626
655
  return typeof window < "u" ? window.navigator?.userAgent : void 0;
627
656
  }
628
- class ve {
657
+ class Ue {
629
658
  constructor() {
630
659
  this._logCount = {};
631
660
  }
632
661
  incrementAndCheck(e) {
633
662
  const n = (this._logCount[e] || 0) + 1;
634
- return this._logCount[e] = n, n > kt;
663
+ return this._logCount[e] = n, n > Kt;
635
664
  }
636
665
  }
637
666
  class F {
638
667
  constructor(e, t, n, r, s) {
639
668
  this._reporter = "mp-wsdk";
640
669
  const o = e.isLoggingEnabled;
641
- this._integrationName = t || "", this._launcherInstanceGuid = n, this._accountId = r || null, this._rateLimiter = s || new ve(), this._isEnabled = Tt() || o;
670
+ this._integrationName = t || "", this._launcherInstanceGuid = n, this._accountId = r || null, this._rateLimiter = s || new Ue(), this._isEnabled = Mt() || o;
642
671
  }
643
672
  send(e, t, n, r, s, o) {
644
673
  if (!(!this._isEnabled || this._rateLimiter.incrementAndCheck(t)))
@@ -649,9 +678,9 @@ class F {
649
678
  version: this._integrationName
650
679
  },
651
680
  severity: t,
652
- code: r || Q.UNKNOWN_ERROR,
653
- url: Lt(),
654
- deviceInfo: Ot(),
681
+ code: r || ee.UNKNOWN_ERROR,
682
+ url: Ft(),
683
+ deviceInfo: xt(),
655
684
  stackTrace: s,
656
685
  reporter: this._reporter,
657
686
  integration: this._integrationName
@@ -678,24 +707,24 @@ class F {
678
707
  }
679
708
  }
680
709
  }
681
- class fe {
710
+ class Ie {
682
711
  constructor(e, t, n, r, s) {
683
- this._transport = new F(e, t, n, r, s), this._errorUrl = ke(e?.errorUrl, e?.integrationDomain, Rt);
712
+ this._transport = new F(e, t, n, r, s), this._errorUrl = Ne(e?.errorUrl, e?.integrationDomain, Ut);
684
713
  }
685
714
  report(e) {
686
715
  if (!e) return;
687
- const t = e.severity || P.ERROR;
716
+ const t = e.severity || b.ERROR;
688
717
  this._transport.send(this._errorUrl, t, e.message, e.code, e.stackTrace);
689
718
  }
690
719
  }
691
- class pe {
720
+ class ye {
692
721
  constructor(e, t, n, r, s, o) {
693
722
  this._transport = new F(e, n, r, s, o), this._placementDiagnosticTransport = new F(
694
723
  e,
695
724
  n,
696
725
  r,
697
726
  s
698
- ), this._loggingUrl = ke(e?.loggingUrl, e?.integrationDomain, bt), this._errorReportingService = t;
727
+ ), this._loggingUrl = Ne(e?.loggingUrl, e?.integrationDomain, Nt), this._errorReportingService = t;
699
728
  }
700
729
  log(e) {
701
730
  e && this._send(this._transport, e);
@@ -706,7 +735,7 @@ class pe {
706
735
  _send(e, t) {
707
736
  e.send(
708
737
  this._loggingUrl,
709
- P.INFO,
738
+ b.INFO,
710
739
  t.message,
711
740
  t.code,
712
741
  void 0,
@@ -715,16 +744,16 @@ class pe {
715
744
  const r = typeof n.statusCode == "number";
716
745
  this._errorReportingService.report({
717
746
  message: "LoggingService: Failed to send log: " + n.message,
718
- code: Q.LOG_DELIVERY_FAILURE,
719
- severity: r ? P.ERROR : P.WARNING
747
+ code: ee.LOG_DELIVERY_FAILURE,
748
+ severity: r ? b.ERROR : b.WARNING
720
749
  });
721
750
  }
722
751
  }
723
752
  );
724
753
  }
725
754
  }
726
- function Nt(i) {
727
- const e = z(window.location.href), t = i.EventAttributes?.title || document.title, n = Ye(), r = i.ActiveTimeOnSite;
755
+ function Yt(i) {
756
+ const e = J(window.location.href), t = i.EventAttributes?.title || document.title, n = ze(), r = i.ActiveTimeOnSite;
728
757
  return {
729
758
  pageUrl: e,
730
759
  sourceMessageId: i.SourceMessageId,
@@ -736,7 +765,7 @@ function Nt(i) {
736
765
  }
737
766
  const _ = class _ {
738
767
  constructor() {
739
- this.name = d, this.id = K, this.moduleId = K, 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 = nt(), this.accountId = null, this._preselectState = Ze();
768
+ this.name = d, this.id = K, this.moduleId = K, 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 = dt(), this.accountId = null, this._preselectState = ct();
740
769
  }
741
770
  // ---- Private helpers ----
742
771
  getEventAttributeValue(e, t) {
@@ -781,12 +810,12 @@ const _ = class _ {
781
810
  capturePageView(e) {
782
811
  let t;
783
812
  try {
784
- t = z(window.location.href);
785
- const n = te(), r = Nt(e);
813
+ t = J(window.location.href);
814
+ const n = oe(), r = Yt(e);
786
815
  n.push(r);
787
- const s = Math.min(n.length, Ie), o = De(n);
816
+ const s = Math.min(n.length, Se), o = Ge(n);
788
817
  if (o === 0) {
789
- const c = H() ? "quota" : "ls_unavailable";
818
+ const c = V() ? "quota" : "ls_unavailable";
790
819
  this.loggingService?.log({
791
820
  message: `Rokt Kit: Failed to persist page view for ${t} [reason: ${c}]`,
792
821
  code: "PAGE_VIEW_CAPTURE_FAILED"
@@ -796,7 +825,7 @@ const _ = class _ {
796
825
  code: "PAGE_VIEW_QUOTA_EVICTION"
797
826
  });
798
827
  } catch (n) {
799
- const r = H() ? "exception" : "ls_unavailable", s = n instanceof Error ? n.message : String(n);
828
+ const r = V() ? "exception" : "ls_unavailable", s = n instanceof Error ? n.message : String(n);
800
829
  this.loggingService?.log({
801
830
  message: `Rokt Kit: Failed to capture page view for ${t}: ${s} [reason: ${r}]`,
802
831
  code: "PAGE_VIEW_CAPTURE_FAILED"
@@ -809,9 +838,18 @@ const _ = class _ {
809
838
  buildCacheMatchKeys(e) {
810
839
  if (!this.isPreselectionEnabled())
811
840
  return;
812
- const t = Qe(this.accountId, e);
841
+ const t = z(this.accountId, e);
813
842
  if (t)
814
- return t.attributeKeys;
843
+ return nt(t);
844
+ }
845
+ buildPreselectAttributeOverrides(e) {
846
+ if (!this.isPreselectionEnabled())
847
+ return;
848
+ const t = z(this.accountId, e)?.preselectAttributeOverrides, n = this.filters || {};
849
+ if (!t || !n.filterUserAttributes)
850
+ return t;
851
+ const r = n.userAttributeFilters || [];
852
+ return n.filterUserAttributes(t, r);
815
853
  }
816
854
  buildPreselectHost() {
817
855
  return {
@@ -827,7 +865,7 @@ const _ = class _ {
827
865
  };
828
866
  }
829
867
  flushPendingPreselectDispatches() {
830
- it(this._preselectState, this.buildPreselectHost());
868
+ ut(this._preselectState, this.buildPreselectHost());
831
869
  }
832
870
  isLauncherReadyToAttach() {
833
871
  return !!window.Rokt && U(window.Rokt.createLauncher);
@@ -849,10 +887,10 @@ const _ = class _ {
849
887
  return n && e[n] && (t[_.EMAIL_SHA256_KEY] = e[n]), n && delete t[n], t;
850
888
  }
851
889
  logSelectPlacementsEvent(e) {
852
- if (!window.mParticle || typeof a().logEvent != "function" || !m(e))
890
+ if (!window.mParticle || typeof a().logEvent != "function" || !p(e))
853
891
  return;
854
892
  const t = a().EventType.Other;
855
- a().logEvent(ut, t, e);
893
+ a().logEvent(_t, t, e);
856
894
  }
857
895
  setRoktSessionId(e) {
858
896
  if (!(!e || typeof e != "string"))
@@ -873,7 +911,7 @@ const _ = class _ {
873
911
  return a()?.getDeviceId?.() || void 0;
874
912
  }
875
913
  attachLauncher(e, t, n = []) {
876
- rt(this._launcherAttachState, {
914
+ ht(this._launcherAttachState, {
877
915
  accountId: e,
878
916
  launcherOptions: t || {},
879
917
  legacyRoktExtensions: n
@@ -884,10 +922,10 @@ const _ = class _ {
884
922
  };
885
923
  let s;
886
924
  return this.isPartnerInLocalLauncherTestGroup() ? s = Promise.resolve(window.Rokt.createLocalLauncher(r)) : s = window.Rokt.createLauncher(r), s.then(async (o) => {
887
- await vt([...n], o), this.initRoktLauncher(o);
925
+ await Ct([...n], o), this.initRoktLauncher(o);
888
926
  }).catch((o) => {
889
927
  const c = this._launcherAttachState.lifecycle === "attached";
890
- if (ct(this._launcherAttachState), !c) {
928
+ if (pt(this._launcherAttachState), !c) {
891
929
  const u = o instanceof Error ? o.message : String(o);
892
930
  this.loggingService?.log({
893
931
  message: `Rokt Kit: Failed to attach Rokt launcher: ${u}`,
@@ -898,16 +936,25 @@ const _ = class _ {
898
936
  });
899
937
  }
900
938
  recreateLauncherIfTerminated() {
901
- return lt(
939
+ return Et(
902
940
  this._launcherAttachState,
903
941
  this.isLauncherReadyToAttach(),
904
942
  (e) => this.attachLauncher(e.accountId, e.launcherOptions, e.legacyRoktExtensions)
905
943
  );
906
944
  }
907
945
  initRoktLauncher(e) {
908
- window.Rokt && (window.Rokt.currentLauncher = e), this.launcher = e, st(this._launcherAttachState);
946
+ window.Rokt && (window.Rokt.currentLauncher = e), this.launcher = e, gt(this._launcherAttachState);
909
947
  const t = a().Rokt?.filters;
910
- 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();
948
+ 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, _e(this.domain, this.integrationName), a().Rokt.attachKit(this), this.flushPendingPreselectDispatches();
949
+ }
950
+ // Leaving the hook unset is what keeps History unpatched for workspaces that never
951
+ // preselect.
952
+ armPreselectPathnameTrigger() {
953
+ this.onRouteChange = rt(this.accountId) ? () => this.evaluatePreselectPathname() : void 0;
954
+ }
955
+ evaluatePreselectPathname() {
956
+ const e = window.location.pathname;
957
+ e !== this._lastPreselectPathname && (this.isTargetingDisabled() || (this._lastPreselectPathname = e, st(this._preselectState, this.buildPreselectHost(), e)));
911
958
  }
912
959
  fetchOptimizely() {
913
960
  const e = a()._getActiveForwarders().filter((t) => t.name === "Optimizely");
@@ -944,30 +991,30 @@ const _ = class _ {
944
991
  */
945
992
  init(e, t, n, r, s) {
946
993
  const o = e, c = o.accountId;
947
- this.accountId = c || null, this.userAttributes = y(s), this._onboardingExpProvider = o.onboardingExpProvider;
994
+ this.accountId = c || null, this.userAttributes = y(s), this.armPreselectPathnameTrigger(), this._onboardingExpProvider = o.onboardingExpProvider;
948
995
  const u = C(o.placementEventMapping);
949
- this.placementEventMappingLookup = ue(u);
996
+ this.placementEventMappingLookup = pe(u);
950
997
  const l = C(
951
998
  o.placementEventAttributeMapping
952
999
  );
953
- this.placementEventAttributeMappingLookup = de(l), o.hashedEmailUserIdentityType && (this._mappedEmailSha256Key = o.hashedEmailUserIdentityType.toLowerCase()), this._workspaceIdSyncApiKey = g(o.workspaceIdSyncApiKey) ? o.workspaceIdSyncApiKey : void 0;
954
- const f = a().Rokt?.domain, { roktExtensionsQueryParams: k, legacyRoktExtensions: v, loadThankYouElement: N } = le(
1000
+ this.placementEventAttributeMappingLookup = me(l), o.hashedEmailUserIdentityType && (this._mappedEmailSha256Key = o.hashedEmailUserIdentityType.toLowerCase()), this._workspaceIdSyncApiKey = g(o.workspaceIdSyncApiKey) ? o.workspaceIdSyncApiKey : void 0;
1001
+ const f = a().Rokt?.domain, { roktExtensionsQueryParams: k, legacyRoktExtensions: R, loadThankYouElement: N } = fe(
955
1002
  o.roktExtensions
956
1003
  ), E = {
957
1004
  ...a().Rokt?.launcherOptions || {}
958
1005
  };
959
- this.integrationName = wt(E.integrationName), E.integrationName = this.integrationName, this.domain = f;
1006
+ this.integrationName = Dt(E.integrationName), E.integrationName = this.integrationName, this.domain = f;
960
1007
  const w = {
961
1008
  loggingUrl: o.loggingUrl,
962
1009
  errorUrl: o.errorUrl,
963
1010
  integrationDomain: f,
964
1011
  isLoggingEnabled: a().config?.isLoggingEnabled === !0
965
- }, I = new fe(
1012
+ }, I = new Ie(
966
1013
  w,
967
1014
  this.integrationName,
968
1015
  window.__rokt_li_guid__,
969
1016
  o.accountId
970
- ), T = new pe(
1017
+ ), T = new ye(
971
1018
  w,
972
1019
  I,
973
1020
  this.integrationName,
@@ -976,57 +1023,57 @@ const _ = class _ {
976
1023
  );
977
1024
  if (this.errorReportingService = I, this.loggingService = T, this.isTargetingDisabled())
978
1025
  try {
979
- ie(), ne();
980
- } catch (p) {
1026
+ ce(), ae();
1027
+ } catch (m) {
981
1028
  this.errorReportingService?.report({
982
1029
  message: "Rokt Kit: Failed to clear page views when targeting is disabled",
983
1030
  code: "PAGE_VIEW_CAPTURE_FAILED",
984
- severity: P.INFO,
985
- stackTrace: p instanceof Error ? p.stack : void 0
1031
+ severity: b.INFO,
1032
+ stackTrace: m instanceof Error ? m.stack : void 0
986
1033
  });
987
1034
  }
988
1035
  return a()._registerErrorReportingService && a()._registerErrorReportingService(I), a()._registerLoggingService && a()._registerLoggingService(T), n ? (this.testHelpers = {
989
- generateLauncherScript: oe,
990
- generateThankYouElementScript: ce,
991
- extractRoktExtensionConfig: le,
992
- hashEventMessage: he,
1036
+ generateLauncherScript: de,
1037
+ generateThankYouElementScript: he,
1038
+ extractRoktExtensionConfig: fe,
1039
+ hashEventMessage: Ee,
993
1040
  parseSettingsString: C,
994
- generateMappedEventLookup: ue,
995
- generateMappedEventAttributeLookup: de,
996
- sendAdBlockMeasurementSignals: ge,
997
- createAutoRemovedIframe: W,
998
- djb2: Ee,
999
- setAllowedOriginHashes: (p) => {
1000
- _._allowedOriginHashes = p;
1041
+ generateMappedEventLookup: pe,
1042
+ generateMappedEventAttributeLookup: me,
1043
+ sendAdBlockMeasurementSignals: _e,
1044
+ createAutoRemovedIframe: q,
1045
+ djb2: Pe,
1046
+ setAllowedOriginHashes: (m) => {
1047
+ _._allowedOriginHashes = m;
1001
1048
  },
1002
1049
  ReportingTransport: F,
1003
- ErrorReportingService: fe,
1004
- LoggingService: pe,
1005
- RateLimiter: ve,
1006
- ErrorCodes: Q,
1007
- WSDKErrorSeverity: P,
1008
- resetLauncherAttachState: () => at(this._launcherAttachState)
1009
- }, this.attachLauncher(c, E), "Successfully initialized: " + d) : (N && (a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this), ae(pt, ce(f), {
1050
+ ErrorReportingService: Ie,
1051
+ LoggingService: ye,
1052
+ RateLimiter: Ue,
1053
+ ErrorCodes: ee,
1054
+ WSDKErrorSeverity: b,
1055
+ resetLauncherAttachState: () => mt(this._launcherAttachState)
1056
+ }, this.attachLauncher(c, E), "Successfully initialized: " + d) : (N && (a().Rokt.flushOnShoppableAdsReadyMessageQueue?.(this), ge(bt, he(f), {
1010
1057
  onLoad: () => {
1011
1058
  this._isThankYouElementLoaded = !0, this._thankYouElementOnLoadCallback && this._thankYouElementOnLoadCallback();
1012
1059
  },
1013
- onError: (p) => {
1014
- console.error("Error loading Rokt Thank You Element script:", p);
1060
+ onError: (m) => {
1061
+ console.error("Error loading Rokt Thank You Element script:", m);
1015
1062
  }
1016
- })), this.isLauncherReadyToAttach() ? this.attachLauncher(c, E, v) : (ae(ft, oe(f, k), {
1063
+ })), this.isLauncherReadyToAttach() ? this.attachLauncher(c, E, R) : (ge(Pt, de(f, k), {
1017
1064
  onLoad: () => {
1018
- this.isLauncherReadyToAttach() ? this.attachLauncher(c, E, v) : console.error("Rokt object is not available after script load.");
1065
+ this.isLauncherReadyToAttach() ? this.attachLauncher(c, E, R) : console.error("Rokt object is not available after script load.");
1019
1066
  },
1020
- onError: (p) => {
1021
- console.error("Error loading Rokt launcher script:", p);
1067
+ onError: (m) => {
1068
+ console.error("Error loading Rokt launcher script:", m);
1022
1069
  }
1023
1070
  }), this.captureTiming(_.PERFORMANCE_MARKS.RoktScriptAppended)), "Successfully initialized: " + d);
1024
1071
  }
1025
1072
  process(e) {
1026
- if (this.isTargetingDisabled() || (e.EventDataType === Et && (Fe(this.loggingService), this.capturePageView(e), Re(this._preselectState, this.buildPreselectHost(), e)), e.EventDataType === _t && (ie(), ne(), this.accountId && L(this.accountId))), !this.isKitReady())
1073
+ if (this.isTargetingDisabled() || (e.EventDataType === vt && (Ve(this.loggingService), this.capturePageView(e), Z(this._preselectState, this.buildPreselectHost(), e)), e.EventDataType === kt && (ce(), ae(), this.accountId && L(this.accountId))), !this.isKitReady())
1027
1074
  return "Kit not ready for forwarder: " + d;
1028
1075
  if (U(a().Rokt?.setLocalSessionAttribute) && (A(this.placementEventAttributeMappingLookup) || this.applyPlacementEventAttributeMapping(e), !A(this.placementEventMappingLookup))) {
1029
- const t = he(e.EventDataType, e.EventCategory, e.EventName ?? "");
1076
+ const t = Ee(e.EventDataType, e.EventCategory, e.EventName ?? "");
1030
1077
  this.placementEventMappingLookup[String(t)] && a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)], !0);
1031
1078
  }
1032
1079
  return "Successfully sent to forwarder: " + d;
@@ -1039,7 +1086,7 @@ const _ = class _ {
1039
1086
  window.Rokt.setExtensionData(e);
1040
1087
  }
1041
1088
  setUserAttribute(e, t) {
1042
- return me(e) || (this.userAttributes[e] = t), Xe(this.accountId, e) && this.flushPendingPreselectDispatches(), "Successfully set user attribute for forwarder: " + d;
1089
+ return Ae(e) || (this.userAttributes[e] = t), ot(this.accountId, e) && this.flushPendingPreselectDispatches(), "Successfully set user attribute for forwarder: " + d;
1043
1090
  }
1044
1091
  removeUserAttribute(e) {
1045
1092
  return delete this.userAttributes[e], "Successfully removed user attribute for forwarder: " + d;
@@ -1118,7 +1165,7 @@ const _ = class _ {
1118
1165
  if (t) {
1119
1166
  const n = this._workspaceSearchInFlightPromise, r = n ? Promise.race([
1120
1167
  n,
1121
- new Promise((s) => setTimeout(s, se))
1168
+ new Promise((s) => setTimeout(s, ue))
1122
1169
  ]) : Promise.resolve();
1123
1170
  return Promise.all([t, r]).then(
1124
1171
  () => this._dispatchPlacements(e)
@@ -1128,7 +1175,7 @@ const _ = class _ {
1128
1175
  const n = this._workspaceSearchInFlightPromise;
1129
1176
  return Promise.race([
1130
1177
  n,
1131
- new Promise((r) => setTimeout(r, se))
1178
+ new Promise((r) => setTimeout(r, ue))
1132
1179
  ]).then(() => this._dispatchPlacements(e));
1133
1180
  }
1134
1181
  return this._dispatchPlacements(e);
@@ -1137,29 +1184,29 @@ const _ = class _ {
1137
1184
  const t = e && e.attributes || {}, r = { ...y(this.userAttributes), ...t }, s = this.filters || {}, o = s.userAttributeFilters || [], c = s.filteredUser || null, u = c ? c.getMPID() : null;
1138
1185
  let l;
1139
1186
  s ? s.filterUserAttributes ? l = s.filterUserAttributes(r, o) : l = r : (console.warn("Rokt Kit: No filters available, using user attributes"), l = r), this.userAttributes = y(l);
1140
- const f = this._onboardingExpProvider === "Optimizely" ? this.fetchOptimizely() : {}, k = this.returnUserIdentities(c), v = this.returnLocalSessionAttributes(), N = Me(te()), E = xe(), w = this.readMpSessionId(), I = this.readMpDeviceId(), T = {
1187
+ const f = this._onboardingExpProvider === "Optimizely" ? this.fetchOptimizely() : {}, k = this.returnUserIdentities(c), R = this.returnLocalSessionAttributes(), N = He(oe()), E = We(), w = this.readMpSessionId(), I = this.readMpDeviceId(), T = typeof e.identifier == "string" ? e.identifier : void 0, m = e.preselect === !0 ? we(l, this.buildPreselectAttributeOverrides(T)) : l, te = {
1141
1188
  ...k,
1142
- ...l,
1189
+ ...m,
1143
1190
  ...f,
1144
- ...v,
1145
- ...N.length ? { [It]: JSON.stringify(N) } : {},
1146
- ...E ? { [yt]: E } : {},
1147
- ...this.userIdentifiedInWorkspace ? { [mt]: !0 } : {},
1148
- ...w ? { [At]: w } : {},
1149
- ...I ? { [St]: I } : {},
1191
+ ...R,
1192
+ ...N.length ? { [Rt]: JSON.stringify(N) } : {},
1193
+ ...E ? { [wt]: E } : {},
1194
+ ...this.userIdentifiedInWorkspace ? { [St]: !0 } : {},
1195
+ ...w ? { [Tt]: w } : {},
1196
+ ...I ? { [Lt]: I } : {},
1150
1197
  mpid: u
1151
- }, p = this.buildCacheMatchKeys(typeof e.identifier == "string" ? e.identifier : void 0), we = {
1198
+ }, ie = this.buildCacheMatchKeys(T), Ke = {
1152
1199
  ...e,
1153
- attributes: T,
1154
- ...p !== void 0 ? { cacheMatchKeys: p } : {}
1155
- }, X = this.launcher.selectPlacements(we), Z = e.preselect === !0, Te = () => {
1156
- Z || this.logSelectPlacementsEvent(T);
1200
+ attributes: te,
1201
+ ...ie !== void 0 ? { cacheMatchKeys: ie } : {}
1202
+ }, ne = this.launcher.selectPlacements(Ke), re = e.preselect === !0, Ce = () => {
1203
+ re || this.logSelectPlacementsEvent(te);
1157
1204
  };
1158
- return Promise.resolve(X).then((Le) => {
1159
- if (!Z)
1160
- return Le?.context?.sessionId?.then((Oe) => this.setRoktSessionId(Oe));
1205
+ return Promise.resolve(ne).then((De) => {
1206
+ if (!re)
1207
+ return De?.context?.sessionId?.then((Me) => this.setRoktSessionId(Me));
1161
1208
  }).catch(() => {
1162
- }).finally(Te), X;
1209
+ }).finally(Ce), ne;
1163
1210
  }
1164
1211
  /**
1165
1212
  * Passes attributes to the Rokt Web SDK for client-side hashing.
@@ -1185,7 +1232,7 @@ const _ = class _ {
1185
1232
  * here would flip the kit to not-ready with no drain path for queued calls.
1186
1233
  */
1187
1234
  terminate() {
1188
- return this.isKitReady() ? (ot(this._launcherAttachState), this.launcher.terminate()) : (console.error("Rokt Kit: Not initialized"), Promise.resolve());
1235
+ return this.isKitReady() ? (ft(this._launcherAttachState), this.launcher.terminate()) : (console.error("Rokt Kit: Not initialized"), Promise.resolve());
1189
1236
  }
1190
1237
  /**
1191
1238
  * Registers a callback to be invoked once rokt-thank-you-element.js becomes available.
@@ -1197,31 +1244,31 @@ const _ = class _ {
1197
1244
  _._allowedOriginHashes = [-553112570, 549508659], _.PERFORMANCE_MARKS = {
1198
1245
  RoktScriptAppended: "mp:RoktScriptAppended"
1199
1246
  }, _.EMAIL_SHA256_KEY = "emailsha256";
1200
- let b = _;
1201
- function Ut() {
1247
+ let S = _;
1248
+ function jt() {
1202
1249
  return K;
1203
1250
  }
1204
- function Kt(i) {
1251
+ function Gt(i) {
1205
1252
  if (!i) {
1206
1253
  window.console.log("You must pass a config object to register the kit " + d);
1207
1254
  return;
1208
1255
  }
1209
- if (!m(i)) {
1256
+ if (!p(i)) {
1210
1257
  window.console.log("'config' must be an object. You passed in a " + typeof i);
1211
1258
  return;
1212
1259
  }
1213
- m(i.kits) ? i.kits[d] = {
1214
- constructor: b
1260
+ p(i.kits) ? i.kits[d] = {
1261
+ constructor: S
1215
1262
  } : (i.kits = {}, i.kits[d] = {
1216
- constructor: b
1263
+ constructor: S
1217
1264
  }), window.console.log("Successfully registered " + d + " to your mParticle configuration");
1218
1265
  }
1219
1266
  typeof window < "u" && window.mParticle && a().addForwarder && a().addForwarder({
1220
1267
  name: d,
1221
- constructor: b,
1222
- getId: Ut
1268
+ constructor: S,
1269
+ getId: jt
1223
1270
  });
1224
1271
  export {
1225
- Kt as register
1272
+ Gt as register
1226
1273
  };
1227
1274
  //# sourceMappingURL=Rokt-Kit.esm.js.map