@nemme/js-sdk 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as x from "react";
2
- import fe, { createContext as ye, useContext as Ve, useMemo as de, useRef as Je, useCallback as K, useState as pe, useEffect as Rt, createElement as we, forwardRef as un } from "react";
2
+ import fe, { createContext as ye, useContext as Ve, useMemo as de, useRef as Je, useCallback as q, useState as pe, useEffect as Rt, createElement as we, forwardRef as un } from "react";
3
3
  import { createRoot as dn } from "react-dom/client";
4
4
  const L = (n) => typeof n == "string", ie = () => {
5
5
  let n, e;
@@ -409,16 +409,16 @@ class ke extends Ee {
409
409
  for (let C = 0; C < ee.length; C++)
410
410
  j.push(ee[C]);
411
411
  else this.options.saveMissingTo === "all" ? j = this.languageUtils.toResolveHierarchy(a.lng || this.language) : j.push(a.lng || this.language);
412
- const q = (C, V, Z) => {
412
+ const K = (C, V, Z) => {
413
413
  const te = E && Z !== p ? Z : P;
414
414
  this.options.missingKeyHandler ? this.options.missingKeyHandler(C, c, V, te, D, a) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(C, c, V, te, D, a), this.emit("missingKey", C, c, V, p);
415
415
  };
416
416
  this.options.saveMissing && (this.options.saveMissingPlurals && k ? j.forEach((C) => {
417
417
  const V = this.pluralResolver.getSuffixes(C, a);
418
418
  R && a[`defaultValue${this.options.pluralSeparator}zero`] && V.indexOf(`${this.options.pluralSeparator}zero`) < 0 && V.push(`${this.options.pluralSeparator}zero`), V.forEach((Z) => {
419
- q([C], o + Z, a[`defaultValue${Z}`] || N);
419
+ K([C], o + Z, a[`defaultValue${Z}`] || N);
420
420
  });
421
- }) : q(j, o, N));
421
+ }) : K(j, o, N));
422
422
  }
423
423
  p = this.extendTranslation(p, e, a, m, r), O && p === o && this.options.appendNamespaceToMissingKey && (p = `${c}${d}${o}`), (O || M) && this.options.parseMissingKeyHandler && (p = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${c}${d}${o}` : o, M ? p : void 0, a));
424
424
  }
@@ -1415,7 +1415,7 @@ const Un = (n) => {
1415
1415
  Bn(n.options.react), Un(n);
1416
1416
  }
1417
1417
  }, Dt = ye();
1418
- class qn {
1418
+ class Kn {
1419
1419
  constructor() {
1420
1420
  this.usedNamespaces = {};
1421
1421
  }
@@ -1439,7 +1439,7 @@ var Pe = { exports: {} }, je = {};
1439
1439
  * LICENSE file in the root directory of this source tree.
1440
1440
  */
1441
1441
  var gt;
1442
- function Kn() {
1442
+ function qn() {
1443
1443
  if (gt) return je;
1444
1444
  gt = 1;
1445
1445
  var n = fe;
@@ -1481,7 +1481,7 @@ function Kn() {
1481
1481
  }
1482
1482
  var ft;
1483
1483
  function Zn() {
1484
- return ft || (ft = 1, Pe.exports = Kn()), Pe.exports;
1484
+ return ft || (ft = 1, Pe.exports = qn()), Pe.exports;
1485
1485
  }
1486
1486
  var Wn = Zn();
1487
1487
  const Gn = (n, e) => Q(e) ? e : In(e) && Q(e.defaultValue) ? e.defaultValue : Array.isArray(n) ? n[n.length - 1] : n, Yn = {
@@ -1495,7 +1495,7 @@ const Gn = (n, e) => Q(e) ? e : In(e) && Q(e.defaultValue) ? e.defaultValue : Ar
1495
1495
  i18n: r,
1496
1496
  defaultNS: a
1497
1497
  } = Ve(Dt) || {}, s = t || r || Vn();
1498
- s && !s.reportNamespaces && (s.reportNamespaces = new qn()), s || jt(s, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
1498
+ s && !s.reportNamespaces && (s.reportNamespaces = new Kn()), s || jt(s, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
1499
1499
  const i = de(() => ({
1500
1500
  ...zn(),
1501
1501
  ...s?.options?.react,
@@ -1508,7 +1508,7 @@ const Gn = (n, e) => Q(e) ? e : In(e) && Q(e.defaultValue) ? e.defaultValue : Ar
1508
1508
  return Q(k) ? [k] : k || ["translation"];
1509
1509
  }, [n, a, s]);
1510
1510
  s?.reportNamespaces?.addUsedNamespaces?.(c);
1511
- const d = Je(0), u = K((k) => {
1511
+ const d = Je(0), u = q((k) => {
1512
1512
  if (!s) return Jn;
1513
1513
  const {
1514
1514
  bindI18n: E,
@@ -1519,7 +1519,7 @@ const Gn = (n, e) => Q(e) ? e : In(e) && Q(e.defaultValue) ? e.defaultValue : Ar
1519
1519
  return E && s.on(E, F), A && s.store.on(A, F), () => {
1520
1520
  E && E.split(" ").forEach((R) => s.off(R, F)), A && A.split(" ").forEach((R) => s.store.off(R, F));
1521
1521
  };
1522
- }, [s, i]), f = Je(), m = K(() => {
1522
+ }, [s, i]), f = Je(), m = q(() => {
1523
1523
  if (!s)
1524
1524
  return Yn;
1525
1525
  const k = !!(s.isInitialized || s.initializedStoreOnce) && c.every((T) => jn(T, s, i)), E = e.lng || s.language, A = d.current, F = f.current;
@@ -1729,7 +1729,7 @@ const tr = ({ step: n, form: e, formState: t, onDismiss: r, onNextStep: a, onPre
1729
1729
  responses: {},
1730
1730
  currentStep: 0,
1731
1731
  startedAt: /* @__PURE__ */ new Date()
1732
- }), l = K((f, m) => {
1732
+ }), l = q((f, m) => {
1733
1733
  o((p) => ({
1734
1734
  ...p,
1735
1735
  responses: {
@@ -1737,12 +1737,12 @@ const tr = ({ step: n, form: e, formState: t, onDismiss: r, onNextStep: a, onPre
1737
1737
  [f]: m
1738
1738
  }
1739
1739
  }));
1740
- }, []), c = K((f) => {
1740
+ }, []), c = q((f) => {
1741
1741
  o((m) => ({
1742
1742
  ...m,
1743
1743
  currentStep: f
1744
1744
  }));
1745
- }, []), d = K(() => {
1745
+ }, []), d = q(() => {
1746
1746
  if (i.currentStep < s)
1747
1747
  c(i.currentStep + 1);
1748
1748
  else {
@@ -1752,13 +1752,13 @@ const tr = ({ step: n, form: e, formState: t, onDismiss: r, onNextStep: a, onPre
1752
1752
  };
1753
1753
  t(f);
1754
1754
  }
1755
- }, [i, s, c, t]), u = K(() => {
1755
+ }, [i, s, c, t]), u = q(() => {
1756
1756
  i.currentStep > 0 && c(i.currentStep - 1);
1757
1757
  }, [i.currentStep, c]);
1758
1758
  return /* @__PURE__ */ S.jsx(
1759
1759
  "div",
1760
1760
  {
1761
- className: "flex flex-col justify-center items-center absolute inset-0 bg-overlay-background-default-light dark:bg-overlay-background-default-dark",
1761
+ className: "flex flex-col justify-center items-center fixed inset-0 bg-overlay-background-default-light dark:bg-overlay-background-default-dark",
1762
1762
  style: { zIndex: r },
1763
1763
  children: /* @__PURE__ */ S.jsx(
1764
1764
  tr,
@@ -2002,11 +2002,11 @@ function Vt(n) {
2002
2002
  } else for (t in n) n[t] && (r && (r += " "), r += t);
2003
2003
  return r;
2004
2004
  }
2005
- function qe() {
2005
+ function Ke() {
2006
2006
  for (var n, e, t = 0, r = "", a = arguments.length; t < a; t++) (n = arguments[t]) && (e = Vt(n)) && (r && (r += " "), r += e);
2007
2007
  return r;
2008
2008
  }
2009
- const _ = qe, J = ({
2009
+ const _ = Ke, J = ({
2010
2010
  variant: n = "primary",
2011
2011
  size: e = "medium",
2012
2012
  text: t,
@@ -2015,23 +2015,25 @@ const _ = qe, J = ({
2015
2015
  className: s,
2016
2016
  disabled: i = !1,
2017
2017
  loading: o = !1,
2018
- ...l
2018
+ round: l = !1,
2019
+ ...c
2019
2020
  }) => /* @__PURE__ */ $.jsx(
2020
2021
  "button",
2021
2022
  {
2022
2023
  className: _(
2023
- "flex gap-2 justify-center items-center rounded-lg disabled:pointer-events-none",
2024
+ "flex gap-2 justify-center items-center disabled:pointer-events-none",
2025
+ l ? "rounded-full" : "rounded-lg",
2024
2026
  ur(n),
2025
2027
  dr(e),
2026
2028
  s
2027
2029
  ),
2028
2030
  disabled: i,
2029
- ...l,
2031
+ ...c,
2030
2032
  children: /* @__PURE__ */ $.jsx(
2031
2033
  _t.Provider,
2032
2034
  {
2033
2035
  value: {
2034
- size: e === "xsmall" ? 8 : 16,
2036
+ size: e === "xsmall" ? 12 : 16,
2035
2037
  weight: "regular",
2036
2038
  className: _($e(n, i))
2037
2039
  },
@@ -2048,7 +2050,9 @@ const _ = qe, J = ({
2048
2050
  case "primary":
2049
2051
  return "border border-grey-0/0 bg-primary-action-button-light dark:bg-primary-action-button-dark hover:bg-primary-action-button-hover-light dark:hover:bg-primary-action-button-hover-dark disabled:bg-primary-action-disabled-light dark:disabled:bg-primary-action-disabled-dark";
2050
2052
  case "secondary":
2051
- return "border border-grey-0/0 bg-secondary-action-base-light dark:bg-secondary-action-base-dark hover:bg-system-neutral-grey-8-light dark:hover:bg-system-neutral-grey-8-dark disabled:bg-secondary-action-disabled-light dark:disabled:bg-secondary-action-disabled-dark";
2053
+ return "border border-grey-0/0 bg-secondary-action-button-light dark:bg-secondary-action-button-dark hover:bg-secondary-action-button-hover-light dark:hover:bg-secondary-action-button-hover-dark disabled:bg-secondary-action-disabled-light dark:disabled:bg-secondary-action-disabled-dark";
2054
+ case "tertiary":
2055
+ return "border border-grey-0/0 bg-tertiary-action-button-light dark:bg-tertiary-action-button-dark hover:bg-tertiary-action-button-hover-light dark:hover:bg-tertiary-action-button-hover-dark disabled:bg-tertiary-action-disabled-light dark:disabled:bg-tertiary-action-disabled-dark";
2052
2056
  case "neutral":
2053
2057
  return "border border-separator-regular-light dark:border-separator-regular-dark hover:bg-background-universal-overlay-light dark:hover:bg-background-universal-overlay-dark disabled:bg-secondary-action-disabled-light dark:disabled:bg-secondary-action-disabled-dark disabled:border-separator-opaque-light dark:disabled:border-separator-opaque-dark";
2054
2058
  case "subtle":
@@ -2061,6 +2065,8 @@ const _ = qe, J = ({
2061
2065
  return "text-nonadaptable-text-light";
2062
2066
  case "secondary":
2063
2067
  return "text-label-quaternary-light dark:text-label-quaternary-dark";
2068
+ case "tertiary":
2069
+ return "text-label-primary-light dark:text-label-primary-dark";
2064
2070
  case "neutral":
2065
2071
  return "text-label-primary-light dark:text-label-primary-dark";
2066
2072
  case "subtle":
@@ -2085,20 +2091,20 @@ const _ = qe, J = ({
2085
2091
  return "text-[15px] leading-[16px] -tracking-0,1";
2086
2092
  }
2087
2093
  };
2088
- var gr = Object.create, Fe = Object.defineProperty, fr = Object.defineProperties, hr = Object.getOwnPropertyDescriptor, mr = Object.getOwnPropertyDescriptors, Ht = Object.getOwnPropertyNames, Se = Object.getOwnPropertySymbols, yr = Object.getPrototypeOf, Ke = Object.prototype.hasOwnProperty, qt = Object.prototype.propertyIsEnumerable, wt = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, G = (n, e) => {
2094
+ var gr = Object.create, Fe = Object.defineProperty, fr = Object.defineProperties, hr = Object.getOwnPropertyDescriptor, mr = Object.getOwnPropertyDescriptors, Ht = Object.getOwnPropertyNames, Se = Object.getOwnPropertySymbols, yr = Object.getPrototypeOf, qe = Object.prototype.hasOwnProperty, Kt = Object.prototype.propertyIsEnumerable, wt = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, G = (n, e) => {
2089
2095
  for (var t in e || (e = {}))
2090
- Ke.call(e, t) && wt(n, t, e[t]);
2096
+ qe.call(e, t) && wt(n, t, e[t]);
2091
2097
  if (Se)
2092
2098
  for (var t of Se(e))
2093
- qt.call(e, t) && wt(n, t, e[t]);
2099
+ Kt.call(e, t) && wt(n, t, e[t]);
2094
2100
  return n;
2095
- }, Ae = (n, e) => fr(n, mr(e)), Kt = (n, e) => {
2101
+ }, Ae = (n, e) => fr(n, mr(e)), qt = (n, e) => {
2096
2102
  var t = {};
2097
2103
  for (var r in n)
2098
- Ke.call(n, r) && e.indexOf(r) < 0 && (t[r] = n[r]);
2104
+ qe.call(n, r) && e.indexOf(r) < 0 && (t[r] = n[r]);
2099
2105
  if (n != null && Se)
2100
2106
  for (var r of Se(n))
2101
- e.indexOf(r) < 0 && qt.call(n, r) && (t[r] = n[r]);
2107
+ e.indexOf(r) < 0 && Kt.call(n, r) && (t[r] = n[r]);
2102
2108
  return t;
2103
2109
  }, br = (n, e) => function() {
2104
2110
  return e || (0, n[Ht(n)[0]])((e = { exports: {} }).exports, e), e.exports;
@@ -2108,7 +2114,7 @@ var gr = Object.create, Fe = Object.defineProperty, fr = Object.defineProperties
2108
2114
  }, wr = (n, e, t, r) => {
2109
2115
  if (e && typeof e == "object" || typeof e == "function")
2110
2116
  for (let a of Ht(e))
2111
- !Ke.call(n, a) && a !== t && Fe(n, a, { get: () => e[a], enumerable: !(r = hr(e, a)) || r.enumerable });
2117
+ !qe.call(n, a) && a !== t && Fe(n, a, { get: () => e[a], enumerable: !(r = hr(e, a)) || r.enumerable });
2112
2118
  return n;
2113
2119
  }, vr = (n, e, t) => (t = n != null ? gr(yr(n)) : {}, wr(
2114
2120
  // If the importer is in node compatibility mode or this is not an ESM
@@ -2569,14 +2575,14 @@ var gr = Object.create, Fe = Object.defineProperty, fr = Object.defineProperties
2569
2575
  if (T) {
2570
2576
  if (j = l(M, B, p, N), !j || j.index >= p.length)
2571
2577
  break;
2572
- var V = j.index, ee = j.index + j[0].length, q = B;
2573
- for (q += O.value.length; V >= q; )
2574
- O = O.next, q += O.value.length;
2575
- if (q -= O.value.length, B = q, O.value instanceof o)
2578
+ var V = j.index, ee = j.index + j[0].length, K = B;
2579
+ for (K += O.value.length; V >= K; )
2580
+ O = O.next, K += O.value.length;
2581
+ if (K -= O.value.length, B = K, O.value instanceof o)
2576
2582
  continue;
2577
- for (var C = O; C !== g.tail && (q < ee || typeof C.value == "string"); C = C.next)
2578
- D++, q += C.value.length;
2579
- D--, P = p.slice(B, q), j.index -= B;
2583
+ for (var C = O; C !== g.tail && (K < ee || typeof C.value == "string"); C = C.next)
2584
+ D++, K += C.value.length;
2585
+ D--, P = p.slice(B, K), j.index -= B;
2580
2586
  } else if (j = l(M, 0, P, N), !j)
2581
2587
  continue;
2582
2588
  var V = j.index, Z = j[0], te = P.slice(0, V), Ye = P.slice(V + Z.length), Ne = B + P.length;
@@ -2907,7 +2913,7 @@ xr(Sr, {
2907
2913
  oneLight: () => aa,
2908
2914
  palenight: () => zr,
2909
2915
  shadesOfPurple: () => Vr,
2910
- synthwave84: () => qr,
2916
+ synthwave84: () => Kr,
2911
2917
  ultramin: () => Zr,
2912
2918
  vsDark: () => Zt,
2913
2919
  vsLight: () => Yr
@@ -3990,7 +3996,7 @@ var Er = {
3990
3996
  }
3991
3997
  }
3992
3998
  ]
3993
- }, qr = Hr, Kr = {
3999
+ }, Kr = Hr, qr = {
3994
4000
  plain: {
3995
4001
  color: "#282a2e",
3996
4002
  backgroundColor: "#ffffff"
@@ -4015,7 +4021,7 @@ var Er = {
4015
4021
  }
4016
4022
  }
4017
4023
  ]
4018
- }, Zr = Kr, Wr = {
4024
+ }, Zr = qr, Wr = {
4019
4025
  plain: {
4020
4026
  color: "#9CDCFE",
4021
4027
  backgroundColor: "#1E1E1E"
@@ -4732,17 +4738,17 @@ var Er = {
4732
4738
  }
4733
4739
  }
4734
4740
  ]
4735
- }, la = oa, ca = (n) => K(
4741
+ }, la = oa, ca = (n) => q(
4736
4742
  (e) => {
4737
- var t = e, { className: r, style: a } = t, s = Kt(t, ["className", "style", "line"]);
4743
+ var t = e, { className: r, style: a } = t, s = qt(t, ["className", "style", "line"]);
4738
4744
  const i = Ae(G({}, s), {
4739
- className: qe("token-line", r)
4745
+ className: Ke("token-line", r)
4740
4746
  });
4741
4747
  return typeof n == "object" && "plain" in n && (i.style = n.plain), typeof a == "object" && (i.style = G(G({}, i.style || {}), a)), i;
4742
4748
  },
4743
4749
  [n]
4744
4750
  ), ua = (n) => {
4745
- const e = K(
4751
+ const e = q(
4746
4752
  ({ types: t, empty: r }) => {
4747
4753
  if (n != null) {
4748
4754
  {
@@ -4759,11 +4765,11 @@ var Er = {
4759
4765
  },
4760
4766
  [n]
4761
4767
  );
4762
- return K(
4768
+ return q(
4763
4769
  (t) => {
4764
- var r = t, { token: a, className: s, style: i } = r, o = Kt(r, ["token", "className", "style"]);
4770
+ var r = t, { token: a, className: s, style: i } = r, o = qt(r, ["token", "className", "style"]);
4765
4771
  const l = Ae(G({}, o), {
4766
- className: qe("token", ...a.types, s),
4772
+ className: Ke("token", ...a.types, s),
4767
4773
  children: a.content,
4768
4774
  style: e(a)
4769
4775
  });
@@ -5099,7 +5105,7 @@ const Jt = {
5099
5105
  onClick: () => l(g.id),
5100
5106
  className: _(
5101
5107
  "flex items-center gap-2 p-3 justify-end rounded-lg border shrink",
5102
- c.includes(g.id) ? "text-label-quaternary-light dark:text-label-quaternary-dark border-label-quaternary-light dark:border-label-quaternary-dark bg-secondary-action-base-light dark:bg-secondary-action-base-dark" : "text-label-primary-light dark:text-label-primary-dark border-separator-regular-light dark:border-separator-regular-dark"
5108
+ c.includes(g.id) ? "text-label-quaternary-light dark:text-label-quaternary-dark border-label-quaternary-light dark:border-label-quaternary-dark bg-secondary-action-button-light dark:bg-secondary-action-button-dark" : "text-label-primary-light dark:text-label-primary-dark border-separator-regular-light dark:border-separator-regular-dark"
5103
5109
  ),
5104
5110
  children: /* @__PURE__ */ S.jsx(
5105
5111
  X,
@@ -5509,7 +5515,7 @@ const Ma = {
5509
5515
  evening: "in the evening",
5510
5516
  night: "at night"
5511
5517
  }
5512
- }, qa = (n, e) => {
5518
+ }, Ka = (n, e) => {
5513
5519
  const t = Number(n), r = t % 100;
5514
5520
  if (r > 20 || r < 10)
5515
5521
  switch (r % 10) {
@@ -5521,8 +5527,8 @@ const Ma = {
5521
5527
  return t + "rd";
5522
5528
  }
5523
5529
  return t + "th";
5524
- }, Ka = {
5525
- ordinalNumber: qa,
5530
+ }, qa = {
5531
+ ordinalNumber: Ka,
5526
5532
  era: ce({
5527
5533
  values: Ma,
5528
5534
  defaultWidth: "wide"
@@ -5733,7 +5739,7 @@ const us = {
5733
5739
  formatDistance: $a,
5734
5740
  formatLong: gs,
5735
5741
  formatRelative: _a,
5736
- localize: Ka,
5742
+ localize: qa,
5737
5743
  match: ls,
5738
5744
  options: {
5739
5745
  weekStartsOn: 1,
@@ -6388,6 +6394,7 @@ class Bs {
6388
6394
  eventDefinitions = [];
6389
6395
  onPageView;
6390
6396
  onEvent;
6397
+ trackUrlParamChanges = !0;
6391
6398
  // Batching
6392
6399
  backlog = [];
6393
6400
  flushTimeout = null;
@@ -6401,8 +6408,18 @@ class Bs {
6401
6408
  // Page view tracking
6402
6409
  originalHistoryMethods = null;
6403
6410
  EVENT_PAGE_VIEW = "page_view";
6404
- constructor({ logger: e, headers: t, sessionId: r, eventDefinitions: a, batchConfig: s, onPageView: i, onEvent: o }) {
6405
- this.logger = e, this.headers = t, this.sessionId = r, this.eventDefinitions = a, this.onPageView = i, this.onEvent = o, this.flushEvents = this.flushEvents.bind(this), this.handlePopState = this.handlePopState.bind(this), this.handleVisibilityChange = this.handleVisibilityChange.bind(this), this.setupBatching(s);
6411
+ lastTrackedPageKey;
6412
+ constructor({
6413
+ logger: e,
6414
+ headers: t,
6415
+ sessionId: r,
6416
+ eventDefinitions: a,
6417
+ batchConfig: s,
6418
+ onPageView: i,
6419
+ onEvent: o,
6420
+ trackUrlParamChanges: l
6421
+ }) {
6422
+ this.logger = e, this.headers = t, this.sessionId = r, this.eventDefinitions = a, this.onPageView = i, this.onEvent = o, typeof l == "boolean" && (this.trackUrlParamChanges = l), this.flushEvents = this.flushEvents.bind(this), this.handlePopState = this.handlePopState.bind(this), this.handleVisibilityChange = this.handleVisibilityChange.bind(this), this.setupBatching(s);
6406
6423
  }
6407
6424
  setupBatching(e) {
6408
6425
  typeof e == "boolean" ? this.batchConfig.enabled = e : e && (this.batchConfig = {
@@ -6442,13 +6459,30 @@ class Bs {
6442
6459
  this.validateEvent(s), this.batchConfig.enabled ? (this.backlog.push(s), this.scheduleFlush()) : await this.sendEvents([s]), t === this.EVENT_PAGE_VIEW ? this.onPageView?.(window.location.href) : this.onEvent?.(s, a);
6443
6460
  }
6444
6461
  async trackPageView() {
6445
- typeof window > "u" || await this.track({
6462
+ if (typeof window > "u") return;
6463
+ const e = window.location.href;
6464
+ if (!this.trackUrlParamChanges) {
6465
+ const t = this.getPageKeyWithoutQuery(e);
6466
+ if (this.lastTrackedPageKey === t)
6467
+ return;
6468
+ this.lastTrackedPageKey = t;
6469
+ }
6470
+ await this.track({
6446
6471
  eventKey: this.EVENT_PAGE_VIEW,
6447
6472
  data: {
6448
6473
  title: document.title
6449
6474
  }
6450
6475
  });
6451
6476
  }
6477
+ getPageKeyWithoutQuery(e) {
6478
+ try {
6479
+ const t = new URL(e);
6480
+ return `${t.origin}${t.pathname}${t.hash}`;
6481
+ } catch {
6482
+ const [t] = e.split("?");
6483
+ return t;
6484
+ }
6485
+ }
6452
6486
  /**
6453
6487
  * Manually flush any pending events
6454
6488
  */
@@ -6539,7 +6573,8 @@ class Ge {
6539
6573
  debug: t = !1,
6540
6574
  batch: r,
6541
6575
  formConfig: a,
6542
- deactivate: s = !1
6576
+ deactivate: s = !1,
6577
+ trackUrlParamChanges: i
6543
6578
  }) {
6544
6579
  if (s)
6545
6580
  return this.clientLogger.info("Nemme client deactivated and will stop initialization."), this.initialized = !0, this.clientLogger.configure({ enabled: !1 }), this;
@@ -6552,13 +6587,13 @@ class Ge {
6552
6587
  "X-User-Id": this.userIdentifier
6553
6588
  }, this.formConfig = a;
6554
6589
  try {
6555
- const i = await this.initializeSession();
6556
- await this.initializeManagers(i, r), this.initialized = !0, this.clientLogger.info("Nemme client initialized", {
6590
+ const o = await this.initializeSession();
6591
+ await this.initializeManagers(o, r, i), this.initialized = !0, this.clientLogger.info("Nemme client initialized", {
6557
6592
  clientKey: this.clientKey,
6558
6593
  userIdentifier: this.userIdentifier
6559
6594
  });
6560
- } catch (i) {
6561
- this.clientLogger.error("Error during initialization:", i);
6595
+ } catch (o) {
6596
+ this.clientLogger.error("Error during initialization:", o);
6562
6597
  }
6563
6598
  return this;
6564
6599
  }
@@ -6589,21 +6624,22 @@ class Ge {
6589
6624
  throw this.clientLogger.error("Error during initialization", e), e;
6590
6625
  }
6591
6626
  }
6592
- async initializeManagers(e, t) {
6593
- const r = new Ms(this.clientLogger, this.headers, this.formConfig), a = new Bs({
6627
+ async initializeManagers(e, t, r) {
6628
+ const a = new Ms(this.clientLogger, this.headers, this.formConfig), s = new Bs({
6594
6629
  logger: this.clientLogger,
6595
6630
  headers: this.headers,
6596
6631
  sessionId: e.sessionId,
6597
6632
  eventDefinitions: e.eventDefinitions,
6598
6633
  batchConfig: t,
6599
- onPageView: async (s) => {
6600
- await r.evaluateDeliveryTriggers({ url: s });
6634
+ trackUrlParamChanges: r,
6635
+ onPageView: async (i) => {
6636
+ await a.evaluateDeliveryTriggers({ url: i });
6601
6637
  },
6602
- onEvent: async (s, i) => {
6603
- await r.evaluateDeliveryTriggers({ eventKey: s.eventKey, eventData: s.data, url: i });
6638
+ onEvent: async (i, o) => {
6639
+ await a.evaluateDeliveryTriggers({ eventKey: i.eventKey, eventData: i.data, url: o });
6604
6640
  }
6605
6641
  });
6606
- await r.loadDeliveries(), typeof window < "u" && (await a.setupPageViewTracking(), await a.trackPageView(), await a.flush()), this.trackingManager = a;
6642
+ await a.loadDeliveries(), typeof window < "u" && (await s.setupPageViewTracking(), await s.trackPageView(), await s.flush()), this.trackingManager = s;
6607
6643
  }
6608
6644
  }
6609
6645
  const on = (n) => new Ge(n), ln = ye(void 0), Zs = ({ clientKey: n, config: e, children: t }) => {
@@ -6640,7 +6676,7 @@ const on = (n) => new Ge(n), ln = ye(void 0), Zs = ({ clientKey: n, config: e, c
6640
6676
  throw new Error("useNemmeContext must be used within a NemmeProvider");
6641
6677
  return n;
6642
6678
  }, Ws = () => {
6643
- const { client: n, isInitialized: e, error: t } = zs(), r = K(
6679
+ const { client: n, isInitialized: e, error: t } = zs(), r = q(
6644
6680
  async (s) => {
6645
6681
  if (!n || !e) {
6646
6682
  console.warn("Nemme client not initialized");
@@ -6649,7 +6685,7 @@ const on = (n) => new Ge(n), ln = ye(void 0), Zs = ({ clientKey: n, config: e, c
6649
6685
  return n.track(s);
6650
6686
  },
6651
6687
  [n, e]
6652
- ), a = K(async () => {
6688
+ ), a = q(async () => {
6653
6689
  if (!n || !e) {
6654
6690
  console.warn("Nemme client not initialized");
6655
6691
  return;