@mparticle/web-rokt-kit 3.2.1 → 3.2.2

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