@getsoren/shared-module 2.48.0 → 2.49.1

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.
@@ -28,12 +28,13 @@ export interface InitializeAmplitudeProps {
28
28
  * "feature usage" charts. Defaults to `true`. Pass `false` to opt out, or an options object to refine
29
29
  * (`pageUrlExcludelist`, `cssSelectorAllowlist`, `shouldTrackEventResolver`...). Our `[data-amp-track-feature]`
30
30
  * selector is always appended to the allowlist unless you provide your own `cssSelectorAllowlist`.
31
- * Object values must be referentially stable (module constant / `useMemo`): they are effect deps and re-init the SDK.
31
+ * Read once at init: an inline object is fine, and changing it afterwards does not re-init the SDK.
32
32
  */
33
33
  elementInteractions?: boolean | ElementInteractionsOptions;
34
34
  /**
35
35
  * Rage / dead click detection (`[Amplitude] Rage Click` / `Dead Click`). Low volume, high UX signal.
36
36
  * Defaults to `true` (both enabled) whenever `elementInteractions` is enabled. Pass `false` to opt out.
37
+ * Read once at init, like `elementInteractions`.
37
38
  */
38
39
  frustrationInteractions?: boolean | FrustrationInteractionsOptions;
39
40
  /**
@@ -48,6 +49,7 @@ export interface InitializeAmplitudeProps {
48
49
  /**
49
50
  * Session replay privacy settings. Defaults to `{ defaultMaskLevel: "medium" }`: every input is masked, page text is
50
51
  * captured. Tag elements with the SDK classes `amp-mask` / `amp-unmask` / `amp-block` for per-element control.
52
+ * Read once at init, like `elementInteractions`.
51
53
  */
52
54
  sessionReplayPrivacy?: SessionReplayOptions["privacyConfig"];
53
55
  /**
@@ -64,5 +66,5 @@ export interface InitializeAmplitudeProps {
64
66
  * - registers the session replay plugin, remote-controlled sample rate by default (Dynamic Sampling ready),
65
67
  * - registers an enrichment plugin that adds `platform` to every event's properties.
66
68
  */
67
- declare const InitializeAmplitude: ({ apiKey, appVersion, elementInteractions, frustrationInteractions, platform, serverZone, sessionReplayPrivacy, sessionReplaySampleRate, ...props }: InitializeAmplitudeProps) => null;
69
+ declare const InitializeAmplitude: ({ apiKey, appVersion, sessionReplaySampleRate, serverZone, elementInteractions, frustrationInteractions, platform, sessionReplayPrivacy, ...props }: InitializeAmplitudeProps) => null;
68
70
  export default InitializeAmplitude;
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./orval-Bf_zcxLE.js";
2
- import { Suspense as t, createContext as n, lazy as r, useCallback as i, useContext as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
3
- import { jsx as u } from "react/jsx-runtime";
2
+ import { Suspense as t, createContext as n, lazy as r, useCallback as i, useContext as a, useEffect as o, useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
3
+ import { jsx as d } from "react/jsx-runtime";
4
4
  import "dayjs/locale/ar";
5
5
  import "dayjs/locale/de";
6
6
  import "dayjs/locale/en";
@@ -9,7 +9,7 @@ import "dayjs/locale/fr";
9
9
  import "dayjs/locale/it";
10
10
  import "dayjs/locale/pt";
11
11
  //#region src/chat/ChatClient.ts
12
- var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.replace(/_([a-z])/g, (e, t) => t.toUpperCase()), m(t)])) : e, h = (e) => Array.isArray(e) ? e.map(h) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`), h(t)])) : e, g = class {
12
+ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.replace(/_([a-z])/g, (e, t) => t.toUpperCase()), h(t)])) : e, g = (e) => Array.isArray(e) ? e.map(g) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`), g(t)])) : e, _ = class {
13
13
  url;
14
14
  getToken;
15
15
  onEvent;
@@ -27,7 +27,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
27
27
  _connected = !1;
28
28
  _ready = !1;
29
29
  constructor(e) {
30
- this.url = e.url, this.getToken = e.getToken, this.onEvent = e.onEvent, this.onConnectionChange = e.onConnectionChange, this.shouldReconnect = e.reconnect ?? !0, this.maxReconnectAttempts = e.maxReconnectAttempts ?? Infinity, this.reconnectBaseDelay = e.reconnectBaseDelay ?? f, this.maxMessageBodyLength = e.maxMessageBodyLength ?? p;
30
+ this.url = e.url, this.getToken = e.getToken, this.onEvent = e.onEvent, this.onConnectionChange = e.onConnectionChange, this.shouldReconnect = e.reconnect ?? !0, this.maxReconnectAttempts = e.maxReconnectAttempts ?? Infinity, this.reconnectBaseDelay = e.reconnectBaseDelay ?? p, this.maxMessageBodyLength = e.maxMessageBodyLength ?? m;
31
31
  }
32
32
  get connected() {
33
33
  return this._connected;
@@ -44,7 +44,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
44
44
  this._connected = !0, this.reconnectAttempt = 0, this.onConnectionChange?.(!0), this.rejoinThreads(), this.flushPendingMessages();
45
45
  }, this.ws.onmessage = (e) => {
46
46
  try {
47
- let t = m(JSON.parse(e.data));
47
+ let t = h(JSON.parse(e.data));
48
48
  t.type === "ready" && (this._ready = !0), this.onEvent?.(t);
49
49
  } catch {}
50
50
  }, this.ws.onclose = () => {
@@ -92,7 +92,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
92
92
  this.pendingMessages.push(e);
93
93
  return;
94
94
  }
95
- this.ws.send(JSON.stringify(h(e)));
95
+ this.ws.send(JSON.stringify(g(e)));
96
96
  }
97
97
  flushPendingMessages() {
98
98
  let e = [...this.pendingMessages];
@@ -107,7 +107,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
107
107
  }
108
108
  scheduleReconnect() {
109
109
  this.clearReconnectTimer();
110
- let e = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt, d);
110
+ let e = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt, f);
111
111
  this.reconnectAttempt++, this.reconnectTimer = setTimeout(() => {
112
112
  this.connect();
113
113
  }, e);
@@ -115,8 +115,8 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
115
115
  clearReconnectTimer() {
116
116
  this.reconnectTimer !== null && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
117
117
  }
118
- }, _ = ({ IMaskMixin: e, ...t }) => /* @__PURE__ */ u(s(() => e(({ TextField: e, ...t }) => /* @__PURE__ */ u(e, { ...t })), [e]), { ...t }), v = n({}), y = ({ children: e, apiURL: t, libraries: n, localStorageKeys: r }) => {
119
- let i = s(() => ({
118
+ }, v = ({ IMaskMixin: e, ...t }) => /* @__PURE__ */ d(c(() => e(({ TextField: e, ...t }) => /* @__PURE__ */ d(e, { ...t })), [e]), { ...t }), y = n({}), b = ({ children: e, apiURL: t, libraries: n, localStorageKeys: r }) => {
119
+ let i = c(() => ({
120
120
  apiURL: t,
121
121
  libraries: n,
122
122
  localStorageKeys: r
@@ -125,34 +125,34 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
125
125
  n,
126
126
  r
127
127
  ]);
128
- return /* @__PURE__ */ u(v.Provider, {
128
+ return /* @__PURE__ */ d(y.Provider, {
129
129
  value: i,
130
130
  children: e
131
131
  });
132
- }, b = 900 * 1e3, x = 60 * 1e3, S = 600 * 1e3, C = "auto-reload-on-new-version-timestamp", w = /<meta[^>]*name="version"[^>]*content="([^"]*)"/, T = (e) => {
132
+ }, x = 900 * 1e3, S = 60 * 1e3, C = 600 * 1e3, w = "auto-reload-on-new-version-timestamp", T = /<meta[^>]*name="version"[^>]*content="([^"]*)"/, E = (e) => {
133
133
  try {
134
134
  return sessionStorage.getItem(e);
135
135
  } catch {
136
136
  return null;
137
137
  }
138
- }, E = (e, t) => {
138
+ }, D = (e, t) => {
139
139
  try {
140
140
  sessionStorage.setItem(e, t);
141
141
  } catch {}
142
- }, D = ({ version: e, checkInterval: t = b, children: n, ...r }) => {
143
- let { libraries: i } = a(v), s = r?.reactRouter || i?.reactRouter, l = c(!1), d = c(0);
142
+ }, O = ({ version: e, checkInterval: t = x, children: n, ...r }) => {
143
+ let { libraries: i } = a(y), s = r?.reactRouter || i?.reactRouter, c = l(!1), u = l(0);
144
144
  if (!s) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of AutoReloadOnNewVersion.");
145
- let { useLocation: f, Outlet: p } = s, { pathname: m } = f(), h = c(m);
145
+ let { useLocation: f, Outlet: p } = s, { pathname: m } = f(), h = l(m);
146
146
  return o(() => {
147
147
  if (!e || typeof window > "u") return;
148
148
  let n = async () => {
149
- if (!(l.current || Date.now() - d.current < x)) {
150
- d.current = Date.now();
149
+ if (!(c.current || Date.now() - u.current < S)) {
150
+ u.current = Date.now();
151
151
  try {
152
152
  let t = await fetch("/index.html", { cache: "no-store" });
153
153
  if (!t.ok) return;
154
- let n = (await t.text()).match(w)?.[1];
155
- n && n !== "%VERSION%" && n !== e && (l.current = !0);
154
+ let n = (await t.text()).match(T)?.[1];
155
+ n && n !== "%VERSION%" && n !== e && (c.current = !0);
156
156
  } catch {}
157
157
  }
158
158
  }, r = () => {
@@ -162,28 +162,28 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
162
162
  clearInterval(i), document.removeEventListener("visibilitychange", r);
163
163
  };
164
164
  }, [e, t]), o(() => {
165
- if (m === h.current || (h.current = m, !l.current)) return;
166
- l.current = !1;
167
- let e = Number(T(C) || "0");
168
- Date.now() - e < S || (E(C, String(Date.now())), window.location.reload());
169
- }, [m]), n ?? /* @__PURE__ */ u(p, {});
170
- }, O = ({ data: e, ...t }) => {
171
- let { libraries: n } = a(v), r = t?.reactRouter || n?.reactRouter, i = t?.gtm || n?.gtm;
165
+ if (m === h.current || (h.current = m, !c.current)) return;
166
+ c.current = !1;
167
+ let e = Number(E(w) || "0");
168
+ Date.now() - e < C || (D(w, String(Date.now())), window.location.reload());
169
+ }, [m]), n ?? /* @__PURE__ */ d(p, {});
170
+ }, k = ({ data: e, ...t }) => {
171
+ let { libraries: n } = a(y), r = t?.reactRouter || n?.reactRouter, i = t?.gtm || n?.gtm;
172
172
  if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
173
173
  if (!i) throw Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
174
- let { useGoogleTagManager: s } = i, { useLocation: c, Outlet: l } = r, { pathname: d } = c(), { sendEvent: f } = s();
174
+ let { useGoogleTagManager: s } = i, { useLocation: c, Outlet: l } = r, { pathname: u } = c(), { sendEvent: f } = s();
175
175
  return o(() => {
176
176
  f({
177
177
  event: "pageView",
178
- pathname: d,
178
+ pathname: u,
179
179
  ...e
180
180
  });
181
181
  }, [
182
182
  e,
183
- d,
183
+ u,
184
184
  f
185
- ]), /* @__PURE__ */ u(l, {});
186
- }, k = "[data-amp-track-feature]", A = [
185
+ ]), /* @__PURE__ */ d(l, {});
186
+ }, A = "[data-amp-track-feature]", j = [
187
187
  "a",
188
188
  "button",
189
189
  "input",
@@ -195,74 +195,81 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
195
195
  "[contenteditable=\"true\" i]",
196
196
  "[data-amp-default-track]",
197
197
  ".amp-default-track"
198
- ], j = { defaultMaskLevel: "medium" }, M = (e, t) => {
198
+ ], M = { defaultMaskLevel: "medium" }, N = (e, t) => {
199
199
  if (e === !1) return !1;
200
200
  let n = e === !0 ? {} : e;
201
201
  return {
202
- cssSelectorAllowlist: [...t, k],
202
+ cssSelectorAllowlist: [...t, A],
203
203
  ...n
204
204
  };
205
- }, ee = (e, t) => !t || e === !1 ? !1 : {
205
+ }, P = (e, t) => !t || e === !1 ? !1 : {
206
206
  deadClicks: !0,
207
207
  rageClicks: !0,
208
208
  ...e === !0 ? {} : e
209
- }, N = ({ apiKey: e, appVersion: t, elementInteractions: n = !0, frustrationInteractions: r = !0, platform: i = "desktop", serverZone: s, sessionReplayPrivacy: c = j, sessionReplaySampleRate: l, ...u }) => {
210
- let { libraries: d } = a(v), f = u.amplitude || d?.amplitude;
211
- return o(() => {
212
- let a = f?.analytics, o = f?.sessionReplayPlugin;
213
- if (!(e && a)) return;
214
- let u = "platform-enrichment", d = M(n, a.Types?.DEFAULT_CSS_SELECTOR_ALLOWLIST ?? A);
215
- return a.init(e, {
209
+ }, F = ({ apiKey: e, appVersion: t, sessionReplaySampleRate: n, serverZone: r, elementInteractions: i = !0, frustrationInteractions: c = !0, platform: u = "desktop", sessionReplayPrivacy: d = M, ...f }) => {
210
+ let { libraries: p } = a(y), m = f.amplitude || p?.amplitude, h = l({
211
+ elementInteractions: i,
212
+ frustrationInteractions: c,
213
+ sessionReplayPrivacy: d
214
+ });
215
+ return s(() => {
216
+ h.current = {
217
+ elementInteractions: i,
218
+ frustrationInteractions: c,
219
+ sessionReplayPrivacy: d
220
+ };
221
+ }), o(() => {
222
+ let i = m?.analytics, a = m?.sessionReplayPlugin;
223
+ if (!(e && i)) return;
224
+ let { elementInteractions: o, frustrationInteractions: s, sessionReplayPrivacy: c } = h.current, l = "platform-enrichment", d = N(o, i.Types?.DEFAULT_CSS_SELECTOR_ALLOWLIST ?? j);
225
+ return i.init(e, {
216
226
  appVersion: t,
217
227
  autocapture: {
218
228
  elementInteractions: d,
219
- frustrationInteractions: ee(r, d !== !1),
229
+ frustrationInteractions: P(s, d !== !1),
220
230
  pageViews: { trackHistoryChanges: "pathOnly" }
221
231
  },
222
- serverZone: s
223
- }), o && a.add(o({
232
+ serverZone: r
233
+ }), a && i.add(a({
224
234
  privacyConfig: c,
225
- ...l === void 0 ? {} : { sampleRate: l }
226
- })), a.add({
235
+ ...n === void 0 ? {} : { sampleRate: n }
236
+ })), i.add({
227
237
  execute: async (e) => ({
228
238
  ...e,
229
239
  event_properties: {
230
240
  ...e.event_properties,
231
- platform: i
241
+ platform: u
232
242
  }
233
243
  }),
234
- name: u,
244
+ name: l,
235
245
  type: "enrichment"
236
246
  }), () => {
237
- o && a.remove("@amplitude/plugin-session-replay-browser"), a.remove(u);
247
+ a && i.remove("@amplitude/plugin-session-replay-browser"), i.remove(l);
238
248
  };
239
249
  }, [
240
250
  e,
241
- f,
251
+ m,
242
252
  t,
243
- n,
253
+ u,
244
254
  r,
245
- i,
246
- s,
247
- c,
248
- l
255
+ n
249
256
  ]), null;
250
- }, P = (() => {
257
+ }, I = (() => {
251
258
  try {
252
259
  return typeof global == "object" && global !== null && ("HermesInternal" in global || "__fbBatchedBridge" in global || "__metro" in global) || typeof window > "u" && typeof global < "u" ? !0 : typeof navigator < "u" && navigator.userAgent ? /react.native|ReactNative/i.test(navigator.userAgent) : !1;
253
260
  } catch {
254
261
  return !1;
255
262
  }
256
- })(), F = "user", I = ({ tokenTypeKey: e = "tokenType", tokenKey: t = "accessToken", postContentType: n = "application/json", ...r }) => {
257
- let { apiURL: i = r.apiURL, libraries: o, localStorageKeys: s } = a(v), c = r?.userLocalStorageKey || s?.user || F, l = r?.axios || o?.axios;
263
+ })(), ee = "user", te = ({ tokenTypeKey: e = "tokenType", tokenKey: t = "accessToken", postContentType: n = "application/json", ...r }) => {
264
+ let { apiURL: i = r.apiURL, libraries: o, localStorageKeys: s } = a(y), c = r?.userLocalStorageKey || s?.user || ee, l = r?.axios || o?.axios;
258
265
  if (!l) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
259
- if (!l?.defaults || P) return null;
266
+ if (!l?.defaults || I) return null;
260
267
  if (typeof window < "u" && window.localStorage) {
261
268
  let n = localStorage.getItem(c), r = n ? JSON.parse(n) : null, i = r?.[e] ? r[e] : null, a = r?.[t] ? r[t] : null, o = n ? `${i} ${a}` : null;
262
269
  o && (l.defaults.headers.common.Authorization = o);
263
270
  }
264
271
  return l.defaults.baseURL = i, l.defaults.headers.post["Content-Type"] = n, null;
265
- }, L = [
272
+ }, ne = [
266
273
  "ar",
267
274
  "de",
268
275
  "en",
@@ -270,15 +277,15 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
270
277
  "fr",
271
278
  "it",
272
279
  "pt"
273
- ], te = (e) => L.includes(e), ne = ({ language: e, ...t }) => {
274
- let { libraries: n } = a(v), r = t?.dayjs || n?.dayjs, i = t?.plugin || n?.dayjsPlugin;
280
+ ], re = (e) => ne.includes(e), ie = ({ language: e, ...t }) => {
281
+ let { libraries: n } = a(y), r = t?.dayjs || n?.dayjs, i = t?.plugin || n?.dayjsPlugin;
275
282
  if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");
276
283
  r.extend(t.localizedFormat), i && i.forEach((e) => {
277
284
  e && r.extend(e);
278
285
  });
279
- let o = e || navigator.language?.slice(0, 2) || "en", s = te(o) ? o : "en";
286
+ let o = e || navigator.language?.slice(0, 2) || "en", s = re(o) ? o : "en";
280
287
  return r.locale() !== s && r.locale(s), null;
281
- }, R = "hubspot-messages-iframe-container", z = "hs-show", B = "data-hs-hidden", re = ({ hubId: e }) => (o(() => {
288
+ }, L = "hubspot-messages-iframe-container", R = "hs-show", z = "data-hs-hidden", ae = ({ hubId: e }) => (o(() => {
282
289
  if (!e) return;
283
290
  let t = document.createElement("script");
284
291
  return t.id = "hs-script-loader", t.src = `//js-eu1.hs-scripts.com/${e}.js`, t.async = !0, t.defer = !0, document.body.appendChild(t), () => {
@@ -287,14 +294,14 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
287
294
  }, [e]), o(() => {
288
295
  let e = document.createElement("style");
289
296
  return e.textContent = `
290
- html[${B}] div#${R} { display: none !important; }
291
- html[${B}] div#${R}.${z} { display: initial !important; }
292
- `, document.head.appendChild(e), document.documentElement.setAttribute(B, ""), () => {
293
- e.remove(), document.documentElement.removeAttribute(B);
297
+ html[${z}] div#${L} { display: none !important; }
298
+ html[${z}] div#${L}.${R} { display: initial !important; }
299
+ `, document.head.appendChild(e), document.documentElement.setAttribute(z, ""), () => {
300
+ e.remove(), document.documentElement.removeAttribute(z);
294
301
  };
295
- }, []), null), ie = ({ debug: e, resources: t, ...n }) => {
296
- let { libraries: r } = a(v), i = n?.i18 || r?.i18, { i18next: o, initReactI18next: s, languageDetector: c } = i || {};
297
- if (P) return null;
302
+ }, []), null), oe = ({ debug: e, resources: t, ...n }) => {
303
+ let { libraries: r } = a(y), i = n?.i18 || r?.i18, { i18next: o, initReactI18next: s, languageDetector: c } = i || {};
304
+ if (I) return null;
298
305
  if (!(i && o && c && s)) throw Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
299
306
  return o.isInitialized ? null : (o.use(c).use(s).init({
300
307
  debug: e,
@@ -312,12 +319,12 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
312
319
  }), o.on("languageChanged", (e) => {
313
320
  document.documentElement.setAttribute("lang", e);
314
321
  }), null);
315
- }, V = { replay: "keep" }, H = (e) => e.tags?.replay === V.replay, ae = ({ dsn: e, integrations: t, tracesSampleRate: n, tracePropagationTargets: r, ignoreErrors: i, debug: s, environment: c, release: l, replaysSessionSampleRate: u = 0, replaysOnErrorSampleRate: d = 1, replayBeforeErrorSampling: f = H, ...p }) => {
316
- let { libraries: m } = a(v), h = p?.sentry || m?.sentry, g = p?.reactRouter || m?.reactRouter;
322
+ }, B = { replay: "keep" }, V = (e) => e.tags?.replay === B.replay, se = ({ dsn: e, integrations: t, tracesSampleRate: n, tracePropagationTargets: r, ignoreErrors: i, debug: s, environment: c, release: l, replaysSessionSampleRate: u = 0, replaysOnErrorSampleRate: d = 1, replayBeforeErrorSampling: f = V, ...p }) => {
323
+ let { libraries: m } = a(y), h = p?.sentry || m?.sentry, g = p?.reactRouter || m?.reactRouter;
317
324
  if (!h) throw Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
318
325
  if (!g) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
319
326
  if (h.isInitialized()) return null;
320
- let { createRoutesFromChildren: _, matchRoutes: y, useLocation: b, useNavigationType: x } = g, S = u > 0 || d > 0;
327
+ let { createRoutesFromChildren: _, matchRoutes: v, useLocation: b, useNavigationType: x } = g, S = u > 0 || d > 0;
321
328
  return (s || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && h.init({
322
329
  debug: s,
323
330
  dsn: e,
@@ -334,7 +341,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
334
341
  integrations: [
335
342
  h.reactRouterV6BrowserTracingIntegration({
336
343
  createRoutesFromChildren: _,
337
- matchRoutes: y,
344
+ matchRoutes: v,
338
345
  useEffect: o,
339
346
  useLocation: b,
340
347
  useNavigationType: x
@@ -348,72 +355,72 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
348
355
  tracePropagationTargets: r,
349
356
  tracesSampleRate: n ?? 1
350
357
  }), null;
351
- }, U = /* @__PURE__ */ new WeakMap(), oe = "user", se = ({ Fallback: e, isLogged: n, loginPath: r = "/login", redirect401Path: i = "/login", ...s }) => {
352
- let { libraries: c, localStorageKeys: d } = a(v), f = s?.reactRouter || c?.reactRouter, p = s?.axios || c?.axios, m = s?.localStorageKey || d?.user || oe;
358
+ }, H = /* @__PURE__ */ new WeakMap(), ce = "user", le = ({ Fallback: e, isLogged: n, loginPath: r = "/login", redirect401Path: i = "/login", ...s }) => {
359
+ let { libraries: c, localStorageKeys: l } = a(y), f = s?.reactRouter || c?.reactRouter, p = s?.axios || c?.axios, m = s?.localStorageKey || l?.user || ce;
353
360
  if (!f) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
354
- let [h, g] = l(null), { useLocation: _, Navigate: y, Outlet: b } = f, x = _(), S = typeof n == "function" ? n() : !!n, C = typeof S == "boolean" ? S : S?.isLogged;
361
+ let [h, g] = u(null), { useLocation: _, Navigate: v, Outlet: b } = f, x = _(), S = typeof n == "function" ? n() : !!n, C = typeof S == "boolean" ? S : S?.isLogged;
355
362
  return o(() => {
356
- p && (U.has(p) || (U.set(p, !0), p.interceptors.response.use((e) => e, (e) => (typeof e == "object" && e && "response" in e && e.response && typeof e.response == "object" && "status" in e.response && e.response && typeof e.response == "object" && "status" in e.response && e?.response?.status === 401 && (typeof e == "object" && e && "config" in e && e.config && typeof e.config == "object" && "headers" in e.config && e.config.headers && typeof e.config.headers == "object" && "Authorization" in e.config.headers && e.config.headers.Authorization && (p.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(m)), g(i)), Promise.reject(e)))));
363
+ p && (H.has(p) || (H.set(p, !0), p.interceptors.response.use((e) => e, (e) => (typeof e == "object" && e && "response" in e && e.response && typeof e.response == "object" && "status" in e.response && e.response && typeof e.response == "object" && "status" in e.response && e?.response?.status === 401 && (typeof e == "object" && e && "config" in e && e.config && typeof e.config == "object" && "headers" in e.config && e.config.headers && typeof e.config.headers == "object" && "Authorization" in e.config.headers && e.config.headers.Authorization && (p.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(m)), g(i)), Promise.reject(e)))));
357
364
  }, [
358
365
  p,
359
366
  m,
360
367
  i
361
- ]), C && !h ? /* @__PURE__ */ u(t, {
368
+ ]), C && !h ? /* @__PURE__ */ d(t, {
362
369
  fallback: e,
363
- children: x.state?.from?.state && x.state?.from?.pathname === r ? /* @__PURE__ */ u(y, {
370
+ children: x.state?.from?.state && x.state?.from?.pathname === r ? /* @__PURE__ */ d(v, {
364
371
  to: x.state.from.state.from.pathname + x.state.from.state.from.search,
365
372
  replace: !0
366
- }) : /* @__PURE__ */ u(b, {})
367
- }) : /* @__PURE__ */ u(y, {
373
+ }) : /* @__PURE__ */ d(b, {})
374
+ }) : /* @__PURE__ */ d(v, {
368
375
  to: r + x.search,
369
376
  state: { from: x },
370
377
  replace: !0
371
378
  });
372
- }, W = /* @__PURE__ */ new Set(), ce = () => (o(() => {
379
+ }, U = /* @__PURE__ */ new Set(), ue = () => (o(() => {
373
380
  let e = Symbol();
374
- return W.add(e), document.documentElement.removeAttribute(B), () => {
375
- W.delete(e), W.size === 0 && document.documentElement.setAttribute(B, "");
381
+ return U.add(e), document.documentElement.removeAttribute(z), () => {
382
+ U.delete(e), U.size === 0 && document.documentElement.setAttribute(z, "");
376
383
  };
377
- }, []), null), le = "user", ue = {
384
+ }, []), null), de = "user", fe = {
378
385
  client: "/v2/threads/ws",
379
386
  supplier: "/v1/threads/ws"
380
- }, de = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, fe = (e) => {
387
+ }, pe = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, me = (e) => {
381
388
  try {
382
389
  let t = localStorage.getItem(e);
383
390
  return t ? JSON.parse(t)?.accessToken ?? null : null;
384
391
  } catch {
385
392
  return null;
386
393
  }
387
- }, G = n(null), pe = ({ children: e, token: t, url: n, wsPath: r, maxReconnectAttempts: s, reconnectBaseDelay: d, maxMessageBodyLength: f = 1e4, reconnect: p = !0, enabled: m = !0, context: h = "client" }) => {
388
- let [_, y] = l(!1), [b, x] = l(!1), [S, C] = l(0), [w, T] = l(m), E = m && w, { apiURL: D, localStorageKeys: O } = a(v), k = O?.user || le, A = c(null), j = c(/* @__PURE__ */ new Set());
394
+ }, W = n(null), he = ({ children: e, token: t, url: n, wsPath: r, maxReconnectAttempts: s, reconnectBaseDelay: c, maxMessageBodyLength: f = 1e4, reconnect: p = !0, enabled: m = !0, context: h = "client" }) => {
395
+ let [g, v] = u(!1), [b, x] = u(!1), [S, C] = u(0), [w, T] = u(m), E = m && w, { apiURL: D, localStorageKeys: O } = a(y), k = O?.user || de, A = l(null), j = l(/* @__PURE__ */ new Set());
389
396
  o(() => {
390
397
  if (!E) return;
391
- let e = r ?? ue[h], i = n || (D ? de(D, e) : null);
398
+ let e = r ?? fe[h], i = n || (D ? pe(D, e) : null);
392
399
  if (!i) return;
393
- let a = () => t ?? fe(k), o = (e) => {
400
+ let a = () => t ?? me(k), o = (e) => {
394
401
  switch (e.type) {
395
402
  case "ready":
396
403
  x(!0), C(e.unreadCount ?? 0);
397
404
  break;
398
405
  }
399
406
  for (let t of j.current) t(e);
400
- }, c = setTimeout(() => {
401
- let e = new g({
407
+ }, l = setTimeout(() => {
408
+ let e = new _({
402
409
  getToken: a,
403
410
  maxMessageBodyLength: f,
404
411
  maxReconnectAttempts: s,
405
412
  onConnectionChange: (e) => {
406
- y(e), e || x(!1);
413
+ v(e), e || x(!1);
407
414
  },
408
415
  onEvent: o,
409
416
  reconnect: p,
410
- reconnectBaseDelay: d,
417
+ reconnectBaseDelay: c,
411
418
  url: i
412
419
  });
413
420
  A.current = e, e.connect();
414
421
  }, 0);
415
422
  return () => {
416
- clearTimeout(c), A.current?.disconnect(), A.current = null;
423
+ clearTimeout(l), A.current?.disconnect(), A.current = null;
417
424
  };
418
425
  }, [
419
426
  E,
@@ -426,35 +433,35 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
426
433
  k,
427
434
  f,
428
435
  s,
429
- d
436
+ c
430
437
  ]);
431
438
  let M = i((e) => {
432
439
  A.current?.joinThread(e);
433
- }, []), ee = i((e) => {
440
+ }, []), N = i((e) => {
434
441
  A.current?.leaveThread(e);
435
- }, []), N = i((e, t) => {
442
+ }, []), P = i((e, t) => {
436
443
  A.current?.sendMessage(e, t);
437
- }, []), P = i((e) => {
444
+ }, []), F = i((e) => {
438
445
  A.current?.markRead(e);
439
- }, []), F = i((e, t) => {
446
+ }, []), I = i((e, t) => {
440
447
  A.current?.listThreads(e, t);
441
- }, []), I = i((e = 1) => {
448
+ }, []), ee = i((e = 1) => {
442
449
  C((t) => t + e);
443
- }, []), L = {
450
+ }, []), te = {
444
451
  decrementUnreadCount: i((e = 1) => {
445
452
  C((t) => Math.max(0, t - e));
446
453
  }, []),
447
454
  disconnect: i(() => {
448
455
  A.current?.disconnect(), A.current = null;
449
456
  }, []),
450
- incrementUnreadCount: I,
451
- isConnected: _,
457
+ incrementUnreadCount: ee,
458
+ isConnected: g,
452
459
  isReady: b,
453
460
  joinThread: M,
454
- leaveThread: ee,
455
- listThreads: F,
456
- markRead: P,
457
- sendMessage: N,
461
+ leaveThread: N,
462
+ listThreads: I,
463
+ markRead: F,
464
+ sendMessage: P,
458
465
  setEnabled: i((e) => {
459
466
  T(e);
460
467
  }, []),
@@ -463,18 +470,18 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
463
470
  }), []),
464
471
  unreadCount: S
465
472
  };
466
- return /* @__PURE__ */ u(G.Provider, {
467
- value: L,
473
+ return /* @__PURE__ */ d(W.Provider, {
474
+ value: te,
468
475
  children: e
469
476
  });
470
- }, me = (e) => e && typeof e == "function", he = (e) => e && typeof e == "function", ge = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...r }) => {
471
- let { libraries: i } = a(v), o = r?.QueryClient || i?.reactQuery?.QueryClient, s = r?.QueryClientProvider || i?.reactQuery?.QueryClientProvider;
477
+ }, ge = (e) => e && typeof e == "function", _e = (e) => e && typeof e == "function", ve = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...r }) => {
478
+ let { libraries: i } = a(y), o = r?.QueryClient || i?.reactQuery?.QueryClient, s = r?.QueryClientProvider || i?.reactQuery?.QueryClientProvider;
472
479
  if (!o) throw Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
473
480
  if (!s) throw Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
474
- if (!me(s)) throw Error("Provided QueryClientProvider dependencies are not valid.");
475
- if (!he(o)) throw Error("Provided QueryClient dependencies are not valid.");
476
- let l = c(null);
477
- return l.current ||= new o({ defaultOptions: {
481
+ if (!ge(s)) throw Error("Provided QueryClientProvider dependencies are not valid.");
482
+ if (!_e(o)) throw Error("Provided QueryClient dependencies are not valid.");
483
+ let c = l(null);
484
+ return c.current ||= new o({ defaultOptions: {
478
485
  mutations: { ...n },
479
486
  queries: {
480
487
  getNextPageParam: (e, t, n) => e.length + (n || 0),
@@ -482,41 +489,41 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
482
489
  retry: 3,
483
490
  ...t
484
491
  }
485
- } }), /* @__PURE__ */ u(s, {
486
- client: l.current,
492
+ } }), /* @__PURE__ */ d(s, {
493
+ client: c.current,
487
494
  children: e
488
495
  });
489
- }, K = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), q = (e, t) => {
496
+ }, G = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), K = (e, t) => {
490
497
  let { fractionDigits: n = 0, metric: r = "km", spacingBetween: i = !0 } = t || {}, a = Number(e), o = i ? " " : "";
491
498
  return Number.isNaN(a) ? `0${o}${r}` : `${a.toFixed(n)}${o}${r}`;
492
- }, J = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((e) => e.length > 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e).join(" "), _e = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, ve = ({ path: e, size: t, apiURL: n }) => {
499
+ }, q = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((e) => e.length > 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e).join(" "), ye = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, be = ({ path: e, size: t, apiURL: n }) => {
493
500
  if (!e) return "";
494
- let r = `${n}${_e(e)}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
501
+ let r = `${n}${ye(e)}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
495
502
  return typeof t == "number" && i ? `${r.replace("/files", `/thumbs/${t}`)}` : r;
496
- }, ye = (e) => {
497
- let { apiURL: t, libraries: n } = a(v), r = e?.dayjs || n?.dayjs;
503
+ }, xe = (e) => {
504
+ let { apiURL: t, libraries: n } = a(y), r = e?.dayjs || n?.dayjs;
498
505
  return {
499
506
  dateAdapter: (e, t) => {
500
507
  if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
501
- return K({
508
+ return G({
502
509
  date: e,
503
510
  format: t,
504
511
  library: r
505
512
  });
506
513
  },
507
- distanceAdapter: q,
514
+ distanceAdapter: K,
508
515
  filePathAdapter: (e, n) => {
509
516
  if (!t) throw Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");
510
- return typeof e == "string" && /^https?:\/\//.test(e) ? e : ve({
517
+ return typeof e == "string" && /^https?:\/\//.test(e) ? e : be({
511
518
  apiURL: t,
512
519
  path: e,
513
520
  size: n
514
521
  });
515
522
  },
516
- worksiteNameAdapter: J
523
+ worksiteNameAdapter: q
517
524
  };
518
- }, be = () => {
519
- let { libraries: e } = a(v), t = e?.amplitude?.analytics, n = i((e, n) => {
525
+ }, Se = () => {
526
+ let { libraries: e } = a(y), t = e?.amplitude?.analytics, n = i((e, n) => {
520
527
  if (!t || (t.setUserId(e), !n)) return;
521
528
  let r = new t.Identify();
522
529
  Object.entries(n).forEach(([e, t]) => {
@@ -539,14 +546,14 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
539
546
  setGroup: r,
540
547
  track: o
541
548
  };
542
- }, xe = (e) => {
543
- let { libraries: t, localStorageKeys: n } = a(v), r = e?.axios || t?.axios, s = e?.localStorageKey || n?.user || "user";
549
+ }, Ce = (e) => {
550
+ let { libraries: t, localStorageKeys: n } = a(y), r = e?.axios || t?.axios, s = e?.localStorageKey || n?.user || "user";
544
551
  if (!r) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
545
552
  let c = i(({ tokenType: e, accessToken: t }) => {
546
553
  r.defaults.headers.common.Authorization = `${e} ${t}`;
547
554
  }, [r.defaults.headers.common]);
548
555
  return o(() => {
549
- if (P) return;
556
+ if (I) return;
550
557
  let e = ({ newValue: e, key: t }) => {
551
558
  if (t === s && e) try {
552
559
  let { accessToken: t, tokenType: n } = JSON.parse(e);
@@ -567,9 +574,9 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
567
574
  },
568
575
  setAuthenticationToken: c
569
576
  };
570
- }, Se = "New message", Ce = (e, t) => {
577
+ }, we = "New message", Te = (e, t) => {
571
578
  if (!("Notification" in window) || typeof Notification != "function" || Notification.permission !== "granted" || !document.hidden) return;
572
- let n = new Notification(t.title ?? Se, {
579
+ let n = new Notification(t.title ?? we, {
573
580
  badge: t?.badge,
574
581
  body: t?.body || e.bodyPreview,
575
582
  data: t?.data,
@@ -584,10 +591,10 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
584
591
  let { onClick: r } = t;
585
592
  n.onclick = () => r(e);
586
593
  }
587
- }, we = (e) => {
588
- let t = a(G);
594
+ }, Ee = (e) => {
595
+ let t = a(W);
589
596
  if (!t) throw Error("useChat must be used within ChatProvider");
590
- let { subscribe: n, setEnabled: r, ...i } = t, s = c(e);
597
+ let { subscribe: n, setEnabled: r, ...i } = t, s = l(e);
591
598
  return s.current = e, o(() => {
592
599
  e?.enabled !== void 0 && r(e.enabled);
593
600
  }, [e?.enabled, r]), o(() => {
@@ -602,7 +609,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
602
609
  r?.(e);
603
610
  break;
604
611
  case "new_message_notification":
605
- i?.(e), t && t.enabled !== !1 && Ce(e, t);
612
+ i?.(e), t && t.enabled !== !1 && Te(e, t);
606
613
  break;
607
614
  case "presence":
608
615
  a?.(e);
@@ -627,46 +634,46 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
627
634
  break;
628
635
  }
629
636
  }), [n]), i;
630
- }, Y = (e, t) => t === "short" ? e.split("-")[0] : e, Te = (e, t = "full") => {
631
- let [n, r] = l(() => {
637
+ }, J = (e, t) => t === "short" ? e.split("-")[0] : e, De = (e, t = "full") => {
638
+ let [n, r] = u(() => {
632
639
  let n = e?.language || navigator.language;
633
- return e && "isInitialized" in e && e.isInitialized, Y(n, t);
640
+ return e && "isInitialized" in e && e.isInitialized, J(n, t);
634
641
  });
635
642
  return o(() => {
636
- e && "isInitialized" in e && e.isInitialized && e.language && r(Y(e.language, t));
643
+ e && "isInitialized" in e && e.isInitialized && e.language && r(J(e.language, t));
637
644
  let n = (e) => {
638
- r(Y(e, t));
645
+ r(J(e, t));
639
646
  };
640
647
  return e?.on?.("languageChanged", n), () => {
641
648
  e?.off?.("languageChanged", n);
642
649
  };
643
650
  }, [e, t]), n;
644
- }, Ee = "tracktor.filter", De = {
651
+ }, Oe = "tracktor.filter", ke = {
645
652
  getFilter: () => void 0,
646
653
  getFilters: () => ({}),
647
654
  handleFilter: () => () => {},
648
655
  setFilter: () => {}
649
- }, X = (e) => {
656
+ }, Y = (e) => {
650
657
  try {
651
658
  return JSON.parse(e);
652
659
  } catch {
653
660
  return e;
654
661
  }
655
- }, Z = (e, t, n) => `${n}_${e}=>${t}`, Oe = (e) => e.reduce((e, t) => {
662
+ }, Ae = (e, t, n) => `${n}_${e}=>${t}`, je = (e) => e.reduce((e, t) => {
656
663
  let n = localStorage.getItem(t);
657
664
  if (n) try {
658
665
  let t = JSON.parse(n), r = Object.keys(t)?.[0];
659
666
  r && (e[r] = Object.values(t)?.[0]);
660
667
  } catch {}
661
668
  return e;
662
- }, {}), ke = (e) => {
663
- let { libraries: t, localStorageKeys: n } = a(v), r = e?.reactRouter || t?.reactRouter, { pathname: i } = r?.useLocation?.() ?? { pathname: "/" }, [o, s] = r?.useSearchParams?.() ?? [new URLSearchParams(), () => {}], [c, u] = l({}), d = n?.filter || Ee, f = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, p = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
664
- if (P) return De;
669
+ }, {}), Me = (e) => {
670
+ let { libraries: t, localStorageKeys: n } = a(y), r = e?.reactRouter || t?.reactRouter, { pathname: i } = r?.useLocation?.() ?? { pathname: "/" }, [o, s] = r?.useSearchParams?.() ?? [new URLSearchParams(), () => {}], [c, l] = u({}), d = n?.filter || Oe, f = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, p = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
671
+ if (I) return ke;
665
672
  if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");
666
673
  let m = () => Object.keys(localStorage).filter((t) => t.startsWith(d) && t.endsWith(e?.pathname || i)), h = (t, n, r = !0) => {
667
- let a = Z(t, e?.pathname || i, d);
674
+ let a = Ae(t, e?.pathname || i, d);
668
675
  if (!n || Array.isArray(n) && !n.length) {
669
- f ? (o.delete(t), s(o)) : u((e) => {
676
+ f ? (o.delete(t), s(o)) : l((e) => {
670
677
  let n = { ...e };
671
678
  return delete n[t], n;
672
679
  }), p && localStorage.removeItem(a);
@@ -675,7 +682,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
675
682
  p && r && n && localStorage.setItem(a, JSON.stringify({
676
683
  ...o,
677
684
  [t]: n
678
- })), f && n ? (o.set(t, JSON.stringify(n)), s(o)) : !f && n && u((e) => ({
685
+ })), f && n ? (o.set(t, JSON.stringify(n)), s(o)) : !f && n && l((e) => ({
679
686
  ...e,
680
687
  [t]: n
681
688
  }));
@@ -684,16 +691,16 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
684
691
  getFilter: (t, n) => {
685
692
  if (f) {
686
693
  let e = o.get(t);
687
- if (e) return X(e);
694
+ if (e) return Y(e);
688
695
  } else {
689
696
  let e = c[t];
690
697
  if (e !== void 0) return e;
691
698
  }
692
699
  if (p) {
693
- let n = Z(t, e?.pathname || i, d), r = localStorage.getItem(n);
700
+ let n = Ae(t, e?.pathname || i, d), r = localStorage.getItem(n);
694
701
  if (r) try {
695
702
  let e = JSON.parse(r)[t];
696
- return !f && e !== void 0 && u((n) => ({
703
+ return !f && e !== void 0 && l((n) => ({
697
704
  ...n,
698
705
  [t]: e
699
706
  })), e;
@@ -702,9 +709,9 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
702
709
  return n;
703
710
  },
704
711
  getFilters: () => {
705
- let e = p ? Oe(m()) : {};
712
+ let e = p ? je(m()) : {};
706
713
  if (f) {
707
- let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] = X(n), e), {});
714
+ let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] = Y(n), e), {});
708
715
  return {
709
716
  ...e,
710
717
  ...t
@@ -725,8 +732,8 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
725
732
  },
726
733
  setFilter: h
727
734
  };
728
- }, Ae = () => document.getElementById(R), je = () => {
729
- let [e, t] = l(() => !!window.HubSpotConversations);
735
+ }, Ne = () => document.getElementById(L), Pe = () => {
736
+ let [e, t] = u(() => !!window.HubSpotConversations);
730
737
  return o(() => {
731
738
  if (window.HubSpotConversations) {
732
739
  t(!0);
@@ -735,33 +742,33 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
735
742
  window.hsConversationsOnReady = [() => t(!0)];
736
743
  }, []), o(() => {
737
744
  e && window.HubSpotConversations?.on("widgetClosed", () => {
738
- Ae()?.classList.remove(z);
745
+ Ne()?.classList.remove(R);
739
746
  });
740
747
  }, [e]), {
741
748
  isAvailable: e,
742
749
  toggle: i(() => {
743
- let e = window.HubSpotConversations, t = Ae();
744
- e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(z)) : (t.classList.add(z), e.widget.open()));
750
+ let e = window.HubSpotConversations, t = Ne();
751
+ e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(R)) : (t.classList.add(R), e.widget.open()));
745
752
  }, [])
746
753
  };
747
- }, Me = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: a, enabled: o = !0 }) => {
748
- let c = i(async (e) => {
754
+ }, Fe = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: a, enabled: o = !0 }) => {
755
+ let s = i(async (e) => {
749
756
  n || !o || await t({ pageParam: e?.pageParam || e.visibleRowsCount });
750
757
  }, [
751
758
  o,
752
759
  t,
753
760
  n
754
- ]), l = s(() => {
761
+ ]), l = c(() => {
755
762
  if (e) return e.pages.reduce((e, t) => [...e, ...t], []);
756
763
  }, [e]);
757
764
  return {
758
- fetchNextPageOnRowsScrollEnd: c,
765
+ fetchNextPageOnRowsScrollEnd: s,
759
766
  isLoading: n || a,
760
767
  loadingVariant: r ? "skeleton" : "linear-progress",
761
768
  rows: l
762
769
  };
763
- }, Ne = (e) => {
764
- let { libraries: t } = a(v), n = e?.i18 || t?.i18, r = e?.i18?.translateFunction || t?.i18?.translateFunction, o = n?.i18next?.t || r || ((e) => e), { unknownErrorTranslationKey: s = "error.unknownError" } = e || {}, c = o(s), l = i((e) => {
770
+ }, Ie = (e) => {
771
+ let { libraries: t } = a(y), n = e?.i18 || t?.i18, r = e?.i18?.translateFunction || t?.i18?.translateFunction, o = n?.i18next?.t || r || ((e) => e), { unknownErrorTranslationKey: s = "error.unknownError" } = e || {}, c = o(s), l = i((e) => {
765
772
  if (e && typeof e == "object" && "response" in e) {
766
773
  let { response: t } = e || {};
767
774
  if (t && typeof t == "object" && "reason" in t && t.reason) return String(t.reason);
@@ -784,38 +791,38 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
784
791
  }, []),
785
792
  printError: l
786
793
  };
787
- }, Pe = "chunk-reload-timestamp", Q = "chunk-reload", Fe = 1e4, $ = 2, Ie = !1;
788
- if (!P && typeof window < "u") {
794
+ }, Le = "chunk-reload-timestamp", X = "chunk-reload", Re = 1e4, Z = 2, Q = !1;
795
+ if (!I && typeof window < "u") {
789
796
  try {
790
797
  let e = new URL(window.location.href);
791
- e.searchParams.has(Q) && (Ie = !0, e.searchParams.delete(Q), window.history.replaceState(null, "", e.toString()));
798
+ e.searchParams.has(X) && (Q = !0, e.searchParams.delete(X), window.history.replaceState(null, "", e.toString()));
792
799
  } catch {}
793
800
  window.addEventListener("vite:preloadError", (e) => {
794
801
  e.preventDefault();
795
802
  });
796
803
  }
797
- var Le = (e) => {
804
+ var ze = (e) => {
798
805
  if (!(e instanceof Error)) return !1;
799
806
  let t = e.message.toLowerCase();
800
807
  return t.includes("dynamically imported module") || t.includes("importing a module script failed") || t.includes("loading chunk") || t.includes("loading css chunk") || t.includes("unable to preload css") || t.includes("failed to fetch") || t.includes("error loading dynamically imported module") || t.includes("load failed") || t.includes("without a valid default export") || e.name === "ChunkLoadError";
801
- }, Re = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, ze = (e) => e.toString().match(Re)?.[2] ?? null, Be = (e) => {
808
+ }, Be = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, Ve = (e) => e.toString().match(Be)?.[2] ?? null, He = (e) => {
802
809
  try {
803
810
  return sessionStorage.getItem(e);
804
811
  } catch {
805
812
  return null;
806
813
  }
807
- }, Ve = (e, t) => {
814
+ }, Ue = (e, t) => {
808
815
  try {
809
816
  sessionStorage.setItem(e, t);
810
817
  } catch {}
811
- }, He = (e) => Function("url", "return import(url)")(e), Ue = async (e) => {
812
- for (let t = 0; t < $; t++) try {
813
- return await He(`${e}?t=${Date.now()}`);
818
+ }, We = (e) => Function("url", "return import(url)")(e), Ge = async (e) => {
819
+ for (let t = 0; t < Z; t++) try {
820
+ return await We(`${e}?t=${Date.now()}`);
814
821
  } catch {
815
- t < $ - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
822
+ t < Z - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
816
823
  }
817
- throw Error(`Failed to import ${e} after ${$} retries`);
818
- }, We = async () => {
824
+ throw Error(`Failed to import ${e} after ${Z} retries`);
825
+ }, Ke = async () => {
819
826
  try {
820
827
  if (typeof navigator < "u" && "serviceWorker" in navigator) {
821
828
  let e = await navigator.serviceWorker.getRegistrations();
@@ -826,27 +833,27 @@ var Le = (e) => {
826
833
  await Promise.all(e.map((e) => caches.delete(e)));
827
834
  }
828
835
  } catch {}
829
- }, Ge = async () => {
830
- await We();
836
+ }, qe = async () => {
837
+ await Ke();
831
838
  let e = new URL(window.location.href);
832
- e.searchParams.set(Q, String(Date.now())), window.location.replace(e.toString());
833
- }, Ke = (e) => e != null && e.default !== void 0, qe = (e) => r(async () => {
839
+ e.searchParams.set(X, String(Date.now())), window.location.replace(e.toString());
840
+ }, $ = (e) => e != null && e.default !== void 0, Je = (e) => r(async () => {
834
841
  let t;
835
842
  try {
836
843
  let n = await e();
837
- if (Ke(n)) return n;
844
+ if ($(n)) return n;
838
845
  t = /* @__PURE__ */ Error("Module resolved without a valid default export");
839
846
  } catch (e) {
840
847
  t = e;
841
848
  }
842
- if (P || !Le(t)) throw t;
843
- let n = ze(e);
849
+ if (I || !ze(t)) throw t;
850
+ let n = Ve(e);
844
851
  if (n) try {
845
- let e = await Ue(n);
846
- if (Ke(e)) return e;
852
+ let e = await Ge(n);
853
+ if ($(e)) return e;
847
854
  } catch {}
848
- let r = Number(Be(Pe) || "0");
849
- return Date.now() - r < Fe || Ie || (Ve(Pe, String(Date.now())), await Ge()), { default: () => null };
855
+ let r = Number(He(Le) || "0");
856
+ return Date.now() - r < Re || Q || (Ue(Le, String(Date.now())), await qe()), { default: () => null };
850
857
  });
851
858
  //#endregion
852
- export { k as AMPLITUDE_FEATURE_SELECTOR, D as AutoReloadOnNewVersion, g as ChatClient, G as ChatContext, pe as ChatProvider, O as GTMSendPageView, N as InitializeAmplitude, I as InitializeAxiosConfig, ne as InitializeDaysJSConfig, re as InitializeHubSpot, ie as InitializeI18nConfig, ae as InitializeSentryConfig, v as InjectDependenciesContext, y as InjectDependenciesProvider, _ as MaskTextField, ge as QueryProvider, se as RequireAuth, V as SENTRY_KEEP_REPLAY, L as SUPPORTED_LANGUAGE, ce as ShowHubSpotBubble, K as dateAdapter, q as distanceAdapter, e as getOrvalConfig, H as isReplayKeptForError, qe as lazyWithRetry, ye as useAdapter, be as useAmplitude, xe as useAuth, we as useChat, Te as useCurrentLanguage, ke as useFilters, je as useHubSpot, Me as useInfiniteDataGrid, Ne as useResponseError, J as worksiteNameAdapter };
859
+ export { A as AMPLITUDE_FEATURE_SELECTOR, O as AutoReloadOnNewVersion, _ as ChatClient, W as ChatContext, he as ChatProvider, k as GTMSendPageView, F as InitializeAmplitude, te as InitializeAxiosConfig, ie as InitializeDaysJSConfig, ae as InitializeHubSpot, oe as InitializeI18nConfig, se as InitializeSentryConfig, y as InjectDependenciesContext, b as InjectDependenciesProvider, v as MaskTextField, ve as QueryProvider, le as RequireAuth, B as SENTRY_KEEP_REPLAY, ne as SUPPORTED_LANGUAGE, ue as ShowHubSpotBubble, G as dateAdapter, K as distanceAdapter, e as getOrvalConfig, V as isReplayKeptForError, Je as lazyWithRetry, xe as useAdapter, Se as useAmplitude, Ce as useAuth, Ee as useChat, De as useCurrentLanguage, Me as useFilters, Pe as useHubSpot, Fe as useInfiniteDataGrid, Ie as useResponseError, q as worksiteNameAdapter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getsoren/shared-module",
3
- "version": "2.48.0",
3
+ "version": "2.49.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "types": "./dist/main.d.ts",
@@ -42,17 +42,17 @@
42
42
  "devDependencies": {
43
43
  "@amplitude/analytics-browser": "^2.11.0",
44
44
  "@amplitude/plugin-session-replay-browser": "^1.8.0",
45
+ "@getsoren/biome-config-react": "^1.4.0",
46
+ "@getsoren/react-google-tag-manager": "^1.4.6",
45
47
  "@sentry/react": "^10.49.0",
46
48
  "@tanstack/react-query": "^5.99.2",
47
49
  "@testing-library/jest-dom": "^5.17.0",
48
50
  "@testing-library/react": "^14.0.0",
49
- "@testing-library/user-event": "^14.5.1",
50
- "@getsoren/biome-config-react": "^1.4.0",
51
- "@getsoren/react-google-tag-manager": "^1.4.6",
52
51
  "@types/react": "^19.0.0",
53
52
  "@types/react-dom": "^19.0.0",
54
53
  "@vitejs/plugin-react": "^6.0.1",
55
54
  "axios": "^1.15.1",
55
+ "commit-and-tag-version": "^12.6.0",
56
56
  "dayjs": "^1.11.20",
57
57
  "husky": "^8.0.3",
58
58
  "i18next": "^26.0.6",
@@ -65,8 +65,7 @@
65
65
  "typescript": "^5.8.3",
66
66
  "unplugin-dts": "1.0.0-beta.6",
67
67
  "vite": "8.0.9",
68
- "vitest": "^1.6.1",
69
- "commit-and-tag-version": "^12.6.0"
68
+ "vitest": "^1.6.1"
70
69
  },
71
70
  "peerDependencies": {
72
71
  "axios": "*",