@mparticle/web-rokt-kit 3.8.1 → 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) {
@@ -44,10 +44,10 @@ function g(i) {
44
44
  function U(i) {
45
45
  return typeof i == "function";
46
46
  }
47
- function S(i) {
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"
@@ -243,46 +241,56 @@ const J = [
243
241
  pathname: "/checkout/cart",
244
242
  targetPageIdentifier: "new_confirmation",
245
243
  attributeKeys: [
246
- "email"
247
- ]
244
+ "email",
245
+ "showPlacement",
246
+ "post_purchase_variant"
247
+ ],
248
+ optionalAttributeKeys: [
249
+ "showPlacement",
250
+ "post_purchase_variant"
251
+ ],
252
+ preselectAttributeOverrides: {
253
+ showPlacement: "rokt",
254
+ post_purchase_variant: "treatment"
255
+ }
248
256
  }
249
- ], Ge = 6e4;
250
- function je(i) {
251
- 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);
252
260
  }
253
- function He(i, e) {
261
+ function Je(i, e) {
254
262
  return `activePreselect:${i}:${e}`;
255
263
  }
256
- function Ve(i) {
264
+ function Be(i) {
257
265
  const e = O(h, i);
258
- return je(e) ? e : null;
266
+ return qe(e) ? e : null;
259
267
  }
260
- function We(i, e) {
268
+ function Qe(i, e) {
261
269
  x(h, i, {
262
- expiresAt: Date.now() + Ge,
270
+ expiresAt: Date.now() + $e,
263
271
  attributes: e
264
272
  });
265
273
  }
266
- const ze = 5 * 6e4;
274
+ const Xe = 5 * 6e4;
267
275
  function M() {
268
276
  return window.sessionStorage;
269
277
  }
270
- function $e(i) {
271
- 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);
272
280
  }
273
- function B(i) {
281
+ function X(i) {
274
282
  return `pendingPreselect:${i}`;
275
283
  }
276
- function qe(i) {
277
- const e = B(i), t = O(h, e, M);
278
- 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;
279
287
  }
280
- function Je(i, e, t, n, r) {
288
+ function tt(i, e, t, n, r) {
281
289
  return x(
282
290
  h,
283
- B(i),
291
+ X(i),
284
292
  {
285
- expiresAt: Date.now() + ze,
293
+ expiresAt: Date.now() + Xe,
286
294
  pathname: e,
287
295
  identifier: t,
288
296
  attributes: n,
@@ -292,9 +300,9 @@ function Je(i, e, t, n, r) {
292
300
  );
293
301
  }
294
302
  function L(i) {
295
- Y(h, B(i), M);
303
+ Y(h, X(i), M);
296
304
  }
297
- function A(i, e) {
305
+ function P(i, e) {
298
306
  const t = {
299
307
  fired: "PRESELECT_FIRED",
300
308
  missed: "PRESELECT_MISSED",
@@ -306,7 +314,7 @@ function A(i, e) {
306
314
  code: t[i]
307
315
  };
308
316
  }
309
- function Be(i, e) {
317
+ function it(i, e) {
310
318
  if (!i.includes("*"))
311
319
  return i === e;
312
320
  const t = i.split("/"), n = e.split("/");
@@ -314,31 +322,55 @@ function Be(i, e) {
314
322
  (r, s) => r === "*" ? n[s] !== "" : r === n[s]
315
323
  );
316
324
  }
317
- function Se(i, e) {
325
+ const ke = {};
326
+ function W(i) {
327
+ return i === ke;
328
+ }
329
+ function Re(i, e) {
318
330
  if (i)
319
- return J.find(
320
- (t) => t.accountId === i && Be(t.pathname, e)
331
+ return j.find(
332
+ (t) => t.accountId === i && it(t.pathname, e)
321
333
  );
322
334
  }
323
- function Qe(i, e) {
335
+ function z(i, e) {
324
336
  if (!(!i || !g(e)))
325
- 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 };
326
346
  }
327
- function Xe(i, e) {
328
- 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))];
329
350
  }
330
- 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() {
331
361
  return { pending: [] };
332
362
  }
333
- function j(i, e) {
363
+ function H(i, e) {
334
364
  const t = i.pending.findIndex((n) => n.pathname === e.pathname);
335
365
  if (t >= 0) {
366
+ if (W(e.event) && !W(i.pending[t].event))
367
+ return;
336
368
  i.pending[t] = e;
337
369
  return;
338
370
  }
339
371
  i.pending.push(e);
340
372
  }
341
- function V(i) {
373
+ function $(i) {
342
374
  if (!i?.getUserIdentities)
343
375
  return !1;
344
376
  const e = i.getUserIdentities().userIdentities;
@@ -347,26 +379,26 @@ function V(i) {
347
379
  return g(n) && n.length > 0;
348
380
  }) : !1;
349
381
  }
350
- function Ae(i) {
382
+ function Te(i) {
351
383
  const e = i?.getMPID?.();
352
384
  return e == null ? null : String(e);
353
385
  }
354
- function Pe(i, e) {
386
+ function Le(i, e) {
355
387
  const t = new Set((i.optionalAttributeKeys ?? []).map((n) => n.toLowerCase()));
356
- return i.attributeKeys.filter((n) => !t.has(n.toLowerCase()) && S(e[n]));
388
+ return i.attributeKeys.filter((n) => !t.has(n.toLowerCase()) && A(e[n]));
357
389
  }
358
- function re(i, e, t) {
390
+ function le(i, e, t) {
359
391
  const n = i.filteredUser?.getAllUserAttributes?.() || {}, r = {};
360
392
  for (const s of t.attributeKeys) {
361
- const o = i.getEventAttributeValue(e, s), c = S(o) ? i.userAttributes[s] ?? n[s] : o;
362
- S(c) || (r[s] = c);
393
+ const o = i.getEventAttributeValue(e, s), c = A(o) ? i.userAttributes[s] ?? n[s] : o;
394
+ A(c) || (r[s] = c);
363
395
  }
364
396
  return {
365
397
  collected: r,
366
- missingKeys: Pe(t, r)
398
+ missingKeys: Le(t, r)
367
399
  };
368
400
  }
369
- function et(i, e) {
401
+ function at(i, e) {
370
402
  Promise.resolve(i.selectPlacements(e)).catch((t) => {
371
403
  const n = t instanceof Error ? t.message : String(t);
372
404
  i.log({
@@ -375,18 +407,21 @@ function et(i, e) {
375
407
  });
376
408
  });
377
409
  }
378
- function be(i, e, t, n, r, s) {
379
- const o = He(e, t), c = Ve(o), u = !!c && JSON.stringify(c.attributes) === JSON.stringify(r);
380
- if (c && c.expiresAt > Date.now() && u) {
381
- i.logPlacementDiagnostic(A("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"));
382
417
  return;
383
418
  }
384
- We(o, r), i.logPlacementDiagnostic(A("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 });
385
420
  }
386
- function tt(i, e) {
421
+ function lt(i, e) {
387
422
  if (!e.accountId || !e.isKitReady())
388
423
  return;
389
- const t = qe(e.accountId);
424
+ const t = et(e.accountId);
390
425
  if (!t)
391
426
  return;
392
427
  if (i.pending.some((o) => o.pathname === t.pathname)) {
@@ -397,91 +432,91 @@ function tt(i, e) {
397
432
  L(e.accountId);
398
433
  return;
399
434
  }
400
- if (!V(e.filteredUser) || (L(e.accountId), Ae(e.filteredUser) !== t.mpid))
435
+ if (!$(e.filteredUser) || (L(e.accountId), Te(e.filteredUser) !== t.mpid))
401
436
  return;
402
- const n = Se(e.accountId, t.pathname);
437
+ const n = Re(e.accountId, t.pathname);
403
438
  if (!n || n.targetPageIdentifier !== t.identifier)
404
439
  return;
405
- const r = y(t.attributes), s = Pe(n, r);
440
+ const r = y(t.attributes), s = Le(n, r);
406
441
  if (s.length > 0) {
407
442
  for (const o of s)
408
- e.logPlacementDiagnostic(A("missed", `missing_persisted_attribute:${o}`));
443
+ e.logPlacementDiagnostic(P("missed", `missing_persisted_attribute:${o}`));
409
444
  return;
410
445
  }
411
- be(e, e.accountId, t.identifier, t.identifier, r, "recovered");
446
+ Oe(e, e.accountId, t.identifier, t.identifier, r, "recovered");
412
447
  }
413
- function Re(i, e, t, n = window.location.pathname) {
414
- const r = Se(e.accountId, n);
448
+ function Z(i, e, t, n = window.location.pathname) {
449
+ const r = Re(e.accountId, n);
415
450
  if (!r)
416
451
  return;
417
452
  if (!e.isKitReady()) {
418
- const c = [], u = Ae(e.filteredUser);
419
- if (e.accountId && u && V(e.filteredUser)) {
420
- 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);
421
456
  if (f.length === 0) {
422
457
  const k = y(l);
423
- Je(
458
+ tt(
424
459
  e.accountId,
425
460
  n,
426
461
  r.targetPageIdentifier,
427
462
  k,
428
463
  u
429
- ) || c.push(A("queued", "persist_failed"));
464
+ ) || c.push(P("queued", "persist_failed"));
430
465
  }
431
466
  }
432
- j(i, { event: t, pathname: n, storedDiagnostics: c });
467
+ H(i, { event: t, pathname: n, storedDiagnostics: c });
433
468
  return;
434
469
  }
435
470
  if (!e.isPreselectionEnabled())
436
471
  return;
437
- if (!V(e.filteredUser)) {
438
- e.logPlacementDiagnostic(A("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 });
439
474
  return;
440
475
  }
441
- const { collected: s, missingKeys: o } = re(e, t, r);
476
+ const { collected: s, missingKeys: o } = le(e, t, r);
442
477
  if (o.length > 0) {
443
478
  for (const c of o)
444
- e.logPlacementDiagnostic(A("missed", `missing_attribute:${c}`));
445
- j(i, { event: t, pathname: n });
479
+ e.logPlacementDiagnostic(P("missed", `missing_attribute:${c}`));
480
+ H(i, { event: t, pathname: n });
446
481
  return;
447
482
  }
448
- be(e, e.accountId || "", n, r.targetPageIdentifier, s, "fired");
483
+ Oe(e, e.accountId || "", n, r.targetPageIdentifier, s, "fired");
449
484
  }
450
- function it(i, e, t = window.location.pathname) {
451
- 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)
452
487
  return;
453
488
  const n = i.pending;
454
489
  i.pending = [], n.forEach(({ event: r, pathname: s, storedDiagnostics: o }) => {
455
- 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));
456
491
  });
457
492
  }
458
- function nt() {
493
+ function dt() {
459
494
  return {
460
495
  context: null,
461
496
  lifecycle: "idle",
462
497
  recreateInFlight: null
463
498
  };
464
499
  }
465
- function rt(i, e) {
500
+ function ht(i, e) {
466
501
  i.context = {
467
502
  accountId: e.accountId,
468
503
  launcherOptions: { ...e.launcherOptions },
469
504
  legacyRoktExtensions: [...e.legacyRoktExtensions]
470
505
  };
471
506
  }
472
- function st(i) {
507
+ function gt(i) {
473
508
  i.lifecycle = "attached";
474
509
  }
475
- function ot(i) {
510
+ function ft(i) {
476
511
  i.lifecycle !== "idle" && (i.lifecycle = "terminated");
477
512
  }
478
- function ct(i) {
513
+ function pt(i) {
479
514
  i.lifecycle = "terminated";
480
515
  }
481
- function at(i) {
516
+ function mt(i) {
482
517
  i.context = null, i.lifecycle = "idle", i.recreateInFlight = null;
483
518
  }
484
- function lt(i, e, t) {
519
+ function Et(i, e, t) {
485
520
  if (i.recreateInFlight)
486
521
  return i.recreateInFlight;
487
522
  if (i.lifecycle !== "terminated" || !i.context || !e)
@@ -492,37 +527,37 @@ function lt(i, e, t) {
492
527
  i.recreateInFlight = null;
493
528
  }), i.recreateInFlight;
494
529
  }
495
- 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", St = "mparticle_session_id", At = "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 = {
496
531
  UNKNOWN_ERROR: "UNKNOWN_ERROR",
497
532
  UNHANDLED_EXCEPTION: "UNHANDLED_EXCEPTION",
498
533
  IDENTITY_REQUEST: "IDENTITY_REQUEST",
499
534
  LOG_DELIVERY_FAILURE: "LOG_DELIVERY_FAILURE"
500
- }, P = {
535
+ }, b = {
501
536
  ERROR: "ERROR",
502
537
  INFO: "INFO",
503
538
  WARNING: "WARNING"
504
- }, 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;
505
540
  function a() {
506
541
  return window.mParticle;
507
542
  }
508
- function oe(i, e) {
543
+ function de(i, e) {
509
544
  const n = [G(i), "/wsdk/integrations/launcher.js"].join("");
510
545
  return !e || e.length === 0 ? n : n + "?extensions=" + e.join(",");
511
546
  }
512
- function ce(i) {
547
+ function he(i) {
513
548
  return [G(i), "/rokt-elements/rokt-element-thank-you.js"].join("");
514
549
  }
515
550
  function G(i) {
516
- const e = i !== void 0 ? i : Pt;
551
+ const e = i !== void 0 ? i : Ot;
517
552
  return e.includes("://") ? e.replace(/\/+$/, "") : ["https://", e].join("");
518
553
  }
519
- function ke(i, e, t) {
554
+ function Ne(i, e, t) {
520
555
  if (i)
521
556
  return i.startsWith("http://") || i.startsWith("https://") ? i : "https://" + i;
522
557
  const r = e?.includes("://") && !/^https?:\/\//i.test(e) ? void 0 : e;
523
558
  return G(r) + t;
524
559
  }
525
- function ae(i, e, t) {
560
+ function ge(i, e, t) {
526
561
  if (document.getElementById(i)) return;
527
562
  const n = document.head || document.body, r = document.createElement("script");
528
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);
@@ -537,12 +572,12 @@ function C(i) {
537
572
  }
538
573
  return [];
539
574
  }
540
- function le(i) {
575
+ function fe(i) {
541
576
  const e = i ? C(i) : [], t = [], n = [];
542
577
  let r = !1;
543
578
  for (let s = 0; s < e.length; s++) {
544
579
  const o = e[s].value;
545
- 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);
546
581
  }
547
582
  return {
548
583
  roktExtensionsQueryParams: t,
@@ -550,14 +585,14 @@ function le(i) {
550
585
  loadThankYouElement: r
551
586
  };
552
587
  }
553
- async function vt(i, e) {
588
+ async function Ct(i, e) {
554
589
  const t = [];
555
590
  if (e)
556
591
  for (const n of i)
557
592
  t.push(e.use(n));
558
593
  return Promise.all(t);
559
594
  }
560
- function ue(i) {
595
+ function pe(i) {
561
596
  if (!i)
562
597
  return {};
563
598
  const e = {};
@@ -567,7 +602,7 @@ function ue(i) {
567
602
  }
568
603
  return e;
569
604
  }
570
- function de(i) {
605
+ function me(i) {
571
606
  const e = {};
572
607
  if (!Array.isArray(i))
573
608
  return e;
@@ -583,14 +618,14 @@ function de(i) {
583
618
  }
584
619
  return e;
585
620
  }
586
- function he(i, e, t) {
621
+ function Ee(i, e, t) {
587
622
  return a().generateHash([i, e, t].join(""));
588
623
  }
589
- function wt(i) {
590
- let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "3.8.1";
624
+ function Dt(i) {
625
+ let n = "mParticle_wsdkv_" + a().getVersion() + "_kitv_" + "3.9.0";
591
626
  return i && (n += "_" + i), n;
592
627
  }
593
- function W(i) {
628
+ function q(i) {
594
629
  const e = document.createElement("iframe");
595
630
  e.style.display = "none", e.setAttribute("sandbox", "allow-scripts allow-same-origin"), e.src = i, e.onload = function() {
596
631
  e.onload = null, e.parentNode && e.parentNode.removeChild(e);
@@ -598,41 +633,41 @@ function W(i) {
598
633
  const t = document.body || document.head;
599
634
  t && t.appendChild(e);
600
635
  }
601
- function ge(i, e) {
602
- const t = Ee(window.location.origin);
603
- 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)
604
639
  return;
605
640
  const r = window.__rokt_li_guid__;
606
641
  if (!r || i && i.includes("://") && !/^https:\/\//i.test(i))
607
642
  return;
608
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";
609
- W(c + "/v1/wsdk-init/index.html?" + o), W(
610
- "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"
611
646
  );
612
647
  }
613
- function Tt() {
648
+ function Mt() {
614
649
  return typeof window < "u" && !!window.location?.search?.toLowerCase().includes("mp_enable_logging=true");
615
650
  }
616
- function Lt() {
651
+ function Ft() {
617
652
  return typeof window < "u" ? window.location?.href : void 0;
618
653
  }
619
- function Ot() {
654
+ function xt() {
620
655
  return typeof window < "u" ? window.navigator?.userAgent : void 0;
621
656
  }
622
- class ve {
657
+ class Ue {
623
658
  constructor() {
624
659
  this._logCount = {};
625
660
  }
626
661
  incrementAndCheck(e) {
627
662
  const n = (this._logCount[e] || 0) + 1;
628
- return this._logCount[e] = n, n > kt;
663
+ return this._logCount[e] = n, n > Kt;
629
664
  }
630
665
  }
631
666
  class F {
632
667
  constructor(e, t, n, r, s) {
633
668
  this._reporter = "mp-wsdk";
634
669
  const o = e.isLoggingEnabled;
635
- 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;
636
671
  }
637
672
  send(e, t, n, r, s, o) {
638
673
  if (!(!this._isEnabled || this._rateLimiter.incrementAndCheck(t)))
@@ -643,9 +678,9 @@ class F {
643
678
  version: this._integrationName
644
679
  },
645
680
  severity: t,
646
- code: r || Q.UNKNOWN_ERROR,
647
- url: Lt(),
648
- deviceInfo: Ot(),
681
+ code: r || ee.UNKNOWN_ERROR,
682
+ url: Ft(),
683
+ deviceInfo: xt(),
649
684
  stackTrace: s,
650
685
  reporter: this._reporter,
651
686
  integration: this._integrationName
@@ -672,24 +707,24 @@ class F {
672
707
  }
673
708
  }
674
709
  }
675
- class fe {
710
+ class Ie {
676
711
  constructor(e, t, n, r, s) {
677
- 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);
678
713
  }
679
714
  report(e) {
680
715
  if (!e) return;
681
- const t = e.severity || P.ERROR;
716
+ const t = e.severity || b.ERROR;
682
717
  this._transport.send(this._errorUrl, t, e.message, e.code, e.stackTrace);
683
718
  }
684
719
  }
685
- class pe {
720
+ class ye {
686
721
  constructor(e, t, n, r, s, o) {
687
722
  this._transport = new F(e, n, r, s, o), this._placementDiagnosticTransport = new F(
688
723
  e,
689
724
  n,
690
725
  r,
691
726
  s
692
- ), this._loggingUrl = ke(e?.loggingUrl, e?.integrationDomain, bt), this._errorReportingService = t;
727
+ ), this._loggingUrl = Ne(e?.loggingUrl, e?.integrationDomain, Nt), this._errorReportingService = t;
693
728
  }
694
729
  log(e) {
695
730
  e && this._send(this._transport, e);
@@ -700,7 +735,7 @@ class pe {
700
735
  _send(e, t) {
701
736
  e.send(
702
737
  this._loggingUrl,
703
- P.INFO,
738
+ b.INFO,
704
739
  t.message,
705
740
  t.code,
706
741
  void 0,
@@ -709,16 +744,16 @@ class pe {
709
744
  const r = typeof n.statusCode == "number";
710
745
  this._errorReportingService.report({
711
746
  message: "LoggingService: Failed to send log: " + n.message,
712
- code: Q.LOG_DELIVERY_FAILURE,
713
- severity: r ? P.ERROR : P.WARNING
747
+ code: ee.LOG_DELIVERY_FAILURE,
748
+ severity: r ? b.ERROR : b.WARNING
714
749
  });
715
750
  }
716
751
  }
717
752
  );
718
753
  }
719
754
  }
720
- function Nt(i) {
721
- 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;
722
757
  return {
723
758
  pageUrl: e,
724
759
  sourceMessageId: i.SourceMessageId,
@@ -730,7 +765,7 @@ function Nt(i) {
730
765
  }
731
766
  const _ = class _ {
732
767
  constructor() {
733
- 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();
734
769
  }
735
770
  // ---- Private helpers ----
736
771
  getEventAttributeValue(e, t) {
@@ -761,7 +796,7 @@ const _ = class _ {
761
796
  const t = Object.keys(this.placementEventAttributeMappingLookup);
762
797
  for (let n = 0; n < t.length; n++) {
763
798
  const r = t[n], s = this.placementEventAttributeMappingLookup[r];
764
- if (S(s))
799
+ if (A(s))
765
800
  continue;
766
801
  let o = !0;
767
802
  for (let c = 0; c < s.length; c++)
@@ -775,12 +810,12 @@ const _ = class _ {
775
810
  capturePageView(e) {
776
811
  let t;
777
812
  try {
778
- t = z(window.location.href);
779
- const n = te(), r = Nt(e);
813
+ t = J(window.location.href);
814
+ const n = oe(), r = Yt(e);
780
815
  n.push(r);
781
- const s = Math.min(n.length, Ie), o = De(n);
816
+ const s = Math.min(n.length, Se), o = Ge(n);
782
817
  if (o === 0) {
783
- const c = H() ? "quota" : "ls_unavailable";
818
+ const c = V() ? "quota" : "ls_unavailable";
784
819
  this.loggingService?.log({
785
820
  message: `Rokt Kit: Failed to persist page view for ${t} [reason: ${c}]`,
786
821
  code: "PAGE_VIEW_CAPTURE_FAILED"
@@ -790,7 +825,7 @@ const _ = class _ {
790
825
  code: "PAGE_VIEW_QUOTA_EVICTION"
791
826
  });
792
827
  } catch (n) {
793
- 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);
794
829
  this.loggingService?.log({
795
830
  message: `Rokt Kit: Failed to capture page view for ${t}: ${s} [reason: ${r}]`,
796
831
  code: "PAGE_VIEW_CAPTURE_FAILED"
@@ -803,9 +838,18 @@ const _ = class _ {
803
838
  buildCacheMatchKeys(e) {
804
839
  if (!this.isPreselectionEnabled())
805
840
  return;
806
- const t = Qe(this.accountId, e);
841
+ const t = z(this.accountId, e);
807
842
  if (t)
808
- 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);
809
853
  }
810
854
  buildPreselectHost() {
811
855
  return {
@@ -821,7 +865,7 @@ const _ = class _ {
821
865
  };
822
866
  }
823
867
  flushPendingPreselectDispatches() {
824
- it(this._preselectState, this.buildPreselectHost());
868
+ ut(this._preselectState, this.buildPreselectHost());
825
869
  }
826
870
  isLauncherReadyToAttach() {
827
871
  return !!window.Rokt && U(window.Rokt.createLauncher);
@@ -843,10 +887,10 @@ const _ = class _ {
843
887
  return n && e[n] && (t[_.EMAIL_SHA256_KEY] = e[n]), n && delete t[n], t;
844
888
  }
845
889
  logSelectPlacementsEvent(e) {
846
- if (!window.mParticle || typeof a().logEvent != "function" || !m(e))
890
+ if (!window.mParticle || typeof a().logEvent != "function" || !p(e))
847
891
  return;
848
892
  const t = a().EventType.Other;
849
- a().logEvent(ut, t, e);
893
+ a().logEvent(_t, t, e);
850
894
  }
851
895
  setRoktSessionId(e) {
852
896
  if (!(!e || typeof e != "string"))
@@ -867,7 +911,7 @@ const _ = class _ {
867
911
  return a()?.getDeviceId?.() || void 0;
868
912
  }
869
913
  attachLauncher(e, t, n = []) {
870
- rt(this._launcherAttachState, {
914
+ ht(this._launcherAttachState, {
871
915
  accountId: e,
872
916
  launcherOptions: t || {},
873
917
  legacyRoktExtensions: n
@@ -878,10 +922,10 @@ const _ = class _ {
878
922
  };
879
923
  let s;
880
924
  return this.isPartnerInLocalLauncherTestGroup() ? s = Promise.resolve(window.Rokt.createLocalLauncher(r)) : s = window.Rokt.createLauncher(r), s.then(async (o) => {
881
- await vt([...n], o), this.initRoktLauncher(o);
925
+ await Ct([...n], o), this.initRoktLauncher(o);
882
926
  }).catch((o) => {
883
927
  const c = this._launcherAttachState.lifecycle === "attached";
884
- if (ct(this._launcherAttachState), !c) {
928
+ if (pt(this._launcherAttachState), !c) {
885
929
  const u = o instanceof Error ? o.message : String(o);
886
930
  this.loggingService?.log({
887
931
  message: `Rokt Kit: Failed to attach Rokt launcher: ${u}`,
@@ -892,16 +936,25 @@ const _ = class _ {
892
936
  });
893
937
  }
894
938
  recreateLauncherIfTerminated() {
895
- return lt(
939
+ return Et(
896
940
  this._launcherAttachState,
897
941
  this.isLauncherReadyToAttach(),
898
942
  (e) => this.attachLauncher(e.accountId, e.launcherOptions, e.legacyRoktExtensions)
899
943
  );
900
944
  }
901
945
  initRoktLauncher(e) {
902
- 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);
903
947
  const t = a().Rokt?.filters;
904
- 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)));
905
958
  }
906
959
  fetchOptimizely() {
907
960
  const e = a()._getActiveForwarders().filter((t) => t.name === "Optimizely");
@@ -938,30 +991,30 @@ const _ = class _ {
938
991
  */
939
992
  init(e, t, n, r, s) {
940
993
  const o = e, c = o.accountId;
941
- 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;
942
995
  const u = C(o.placementEventMapping);
943
- this.placementEventMappingLookup = ue(u);
996
+ this.placementEventMappingLookup = pe(u);
944
997
  const l = C(
945
998
  o.placementEventAttributeMapping
946
999
  );
947
- this.placementEventAttributeMappingLookup = de(l), o.hashedEmailUserIdentityType && (this._mappedEmailSha256Key = o.hashedEmailUserIdentityType.toLowerCase()), this._workspaceIdSyncApiKey = g(o.workspaceIdSyncApiKey) ? o.workspaceIdSyncApiKey : void 0;
948
- 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(
949
1002
  o.roktExtensions
950
1003
  ), E = {
951
1004
  ...a().Rokt?.launcherOptions || {}
952
1005
  };
953
- 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;
954
1007
  const w = {
955
1008
  loggingUrl: o.loggingUrl,
956
1009
  errorUrl: o.errorUrl,
957
1010
  integrationDomain: f,
958
1011
  isLoggingEnabled: a().config?.isLoggingEnabled === !0
959
- }, I = new fe(
1012
+ }, I = new Ie(
960
1013
  w,
961
1014
  this.integrationName,
962
1015
  window.__rokt_li_guid__,
963
1016
  o.accountId
964
- ), T = new pe(
1017
+ ), T = new ye(
965
1018
  w,
966
1019
  I,
967
1020
  this.integrationName,
@@ -970,57 +1023,57 @@ const _ = class _ {
970
1023
  );
971
1024
  if (this.errorReportingService = I, this.loggingService = T, this.isTargetingDisabled())
972
1025
  try {
973
- ie(), ne();
974
- } catch (p) {
1026
+ ce(), ae();
1027
+ } catch (m) {
975
1028
  this.errorReportingService?.report({
976
1029
  message: "Rokt Kit: Failed to clear page views when targeting is disabled",
977
1030
  code: "PAGE_VIEW_CAPTURE_FAILED",
978
- severity: P.INFO,
979
- stackTrace: p instanceof Error ? p.stack : void 0
1031
+ severity: b.INFO,
1032
+ stackTrace: m instanceof Error ? m.stack : void 0
980
1033
  });
981
1034
  }
982
1035
  return a()._registerErrorReportingService && a()._registerErrorReportingService(I), a()._registerLoggingService && a()._registerLoggingService(T), n ? (this.testHelpers = {
983
- generateLauncherScript: oe,
984
- generateThankYouElementScript: ce,
985
- extractRoktExtensionConfig: le,
986
- hashEventMessage: he,
1036
+ generateLauncherScript: de,
1037
+ generateThankYouElementScript: he,
1038
+ extractRoktExtensionConfig: fe,
1039
+ hashEventMessage: Ee,
987
1040
  parseSettingsString: C,
988
- generateMappedEventLookup: ue,
989
- generateMappedEventAttributeLookup: de,
990
- sendAdBlockMeasurementSignals: ge,
991
- createAutoRemovedIframe: W,
992
- djb2: Ee,
993
- setAllowedOriginHashes: (p) => {
994
- _._allowedOriginHashes = p;
1041
+ generateMappedEventLookup: pe,
1042
+ generateMappedEventAttributeLookup: me,
1043
+ sendAdBlockMeasurementSignals: _e,
1044
+ createAutoRemovedIframe: q,
1045
+ djb2: Pe,
1046
+ setAllowedOriginHashes: (m) => {
1047
+ _._allowedOriginHashes = m;
995
1048
  },
996
1049
  ReportingTransport: F,
997
- ErrorReportingService: fe,
998
- LoggingService: pe,
999
- RateLimiter: ve,
1000
- ErrorCodes: Q,
1001
- WSDKErrorSeverity: P,
1002
- resetLauncherAttachState: () => at(this._launcherAttachState)
1003
- }, 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), {
1004
1057
  onLoad: () => {
1005
1058
  this._isThankYouElementLoaded = !0, this._thankYouElementOnLoadCallback && this._thankYouElementOnLoadCallback();
1006
1059
  },
1007
- onError: (p) => {
1008
- console.error("Error loading Rokt Thank You Element script:", p);
1060
+ onError: (m) => {
1061
+ console.error("Error loading Rokt Thank You Element script:", m);
1009
1062
  }
1010
- })), 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), {
1011
1064
  onLoad: () => {
1012
- 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.");
1013
1066
  },
1014
- onError: (p) => {
1015
- console.error("Error loading Rokt launcher script:", p);
1067
+ onError: (m) => {
1068
+ console.error("Error loading Rokt launcher script:", m);
1016
1069
  }
1017
1070
  }), this.captureTiming(_.PERFORMANCE_MARKS.RoktScriptAppended)), "Successfully initialized: " + d);
1018
1071
  }
1019
1072
  process(e) {
1020
- 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())
1021
1074
  return "Kit not ready for forwarder: " + d;
1022
- if (U(a().Rokt?.setLocalSessionAttribute) && (S(this.placementEventAttributeMappingLookup) || this.applyPlacementEventAttributeMapping(e), !S(this.placementEventMappingLookup))) {
1023
- const t = he(e.EventDataType, e.EventCategory, e.EventName ?? "");
1075
+ if (U(a().Rokt?.setLocalSessionAttribute) && (A(this.placementEventAttributeMappingLookup) || this.applyPlacementEventAttributeMapping(e), !A(this.placementEventMappingLookup))) {
1076
+ const t = Ee(e.EventDataType, e.EventCategory, e.EventName ?? "");
1024
1077
  this.placementEventMappingLookup[String(t)] && a().Rokt.setLocalSessionAttribute?.(this.placementEventMappingLookup[String(t)], !0);
1025
1078
  }
1026
1079
  return "Successfully sent to forwarder: " + d;
@@ -1033,7 +1086,7 @@ const _ = class _ {
1033
1086
  window.Rokt.setExtensionData(e);
1034
1087
  }
1035
1088
  setUserAttribute(e, t) {
1036
- 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;
1037
1090
  }
1038
1091
  removeUserAttribute(e) {
1039
1092
  return delete this.userAttributes[e], "Successfully removed user attribute for forwarder: " + d;
@@ -1112,7 +1165,7 @@ const _ = class _ {
1112
1165
  if (t) {
1113
1166
  const n = this._workspaceSearchInFlightPromise, r = n ? Promise.race([
1114
1167
  n,
1115
- new Promise((s) => setTimeout(s, se))
1168
+ new Promise((s) => setTimeout(s, ue))
1116
1169
  ]) : Promise.resolve();
1117
1170
  return Promise.all([t, r]).then(
1118
1171
  () => this._dispatchPlacements(e)
@@ -1122,7 +1175,7 @@ const _ = class _ {
1122
1175
  const n = this._workspaceSearchInFlightPromise;
1123
1176
  return Promise.race([
1124
1177
  n,
1125
- new Promise((r) => setTimeout(r, se))
1178
+ new Promise((r) => setTimeout(r, ue))
1126
1179
  ]).then(() => this._dispatchPlacements(e));
1127
1180
  }
1128
1181
  return this._dispatchPlacements(e);
@@ -1131,29 +1184,29 @@ const _ = class _ {
1131
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;
1132
1185
  let l;
1133
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);
1134
- 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 = {
1135
1188
  ...k,
1136
- ...l,
1189
+ ...m,
1137
1190
  ...f,
1138
- ...v,
1139
- ...N.length ? { [It]: JSON.stringify(N) } : {},
1140
- ...E ? { [yt]: E } : {},
1141
- ...this.userIdentifiedInWorkspace ? { [mt]: !0 } : {},
1142
- ...w ? { [St]: w } : {},
1143
- ...I ? { [At]: 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 } : {},
1144
1197
  mpid: u
1145
- }, p = this.buildCacheMatchKeys(typeof e.identifier == "string" ? e.identifier : void 0), we = {
1198
+ }, ie = this.buildCacheMatchKeys(T), Ke = {
1146
1199
  ...e,
1147
- attributes: T,
1148
- ...p !== void 0 ? { cacheMatchKeys: p } : {}
1149
- }, X = this.launcher.selectPlacements(we), Z = e.preselect === !0, Te = () => {
1150
- 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);
1151
1204
  };
1152
- return Promise.resolve(X).then((Le) => {
1153
- if (!Z)
1154
- 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));
1155
1208
  }).catch(() => {
1156
- }).finally(Te), X;
1209
+ }).finally(Ce), ne;
1157
1210
  }
1158
1211
  /**
1159
1212
  * Passes attributes to the Rokt Web SDK for client-side hashing.
@@ -1179,7 +1232,7 @@ const _ = class _ {
1179
1232
  * here would flip the kit to not-ready with no drain path for queued calls.
1180
1233
  */
1181
1234
  terminate() {
1182
- 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());
1183
1236
  }
1184
1237
  /**
1185
1238
  * Registers a callback to be invoked once rokt-thank-you-element.js becomes available.
@@ -1191,31 +1244,31 @@ const _ = class _ {
1191
1244
  _._allowedOriginHashes = [-553112570, 549508659], _.PERFORMANCE_MARKS = {
1192
1245
  RoktScriptAppended: "mp:RoktScriptAppended"
1193
1246
  }, _.EMAIL_SHA256_KEY = "emailsha256";
1194
- let b = _;
1195
- function Ut() {
1247
+ let S = _;
1248
+ function jt() {
1196
1249
  return K;
1197
1250
  }
1198
- function Kt(i) {
1251
+ function Gt(i) {
1199
1252
  if (!i) {
1200
1253
  window.console.log("You must pass a config object to register the kit " + d);
1201
1254
  return;
1202
1255
  }
1203
- if (!m(i)) {
1256
+ if (!p(i)) {
1204
1257
  window.console.log("'config' must be an object. You passed in a " + typeof i);
1205
1258
  return;
1206
1259
  }
1207
- m(i.kits) ? i.kits[d] = {
1208
- constructor: b
1260
+ p(i.kits) ? i.kits[d] = {
1261
+ constructor: S
1209
1262
  } : (i.kits = {}, i.kits[d] = {
1210
- constructor: b
1263
+ constructor: S
1211
1264
  }), window.console.log("Successfully registered " + d + " to your mParticle configuration");
1212
1265
  }
1213
1266
  typeof window < "u" && window.mParticle && a().addForwarder && a().addForwarder({
1214
1267
  name: d,
1215
- constructor: b,
1216
- getId: Ut
1268
+ constructor: S,
1269
+ getId: jt
1217
1270
  });
1218
1271
  export {
1219
- Kt as register
1272
+ Gt as register
1220
1273
  };
1221
1274
  //# sourceMappingURL=Rokt-Kit.esm.js.map