@getsoren/shared-module 2.53.0 → 2.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
+ import { LocaleType } from '../../utils/getCurrentLanguage/getCurrentLanguage';
1
2
  interface useCurrentLanguageParams {
2
3
  language?: string;
3
4
  on?: (event: string, callback: (language: string) => void) => void;
4
5
  off?: (event: string, callback: (language: string) => void) => void;
5
6
  }
6
- type LocaleType = "short" | "full";
7
7
  /**
8
8
  * Hook to get the current language
9
9
  * @param i18
package/dist/main.d.ts CHANGED
@@ -50,5 +50,9 @@ export { default as getOrvalConfig } from './orval/orval';
50
50
  export { default as dateAdapter } from './utils/adapter/dateAdapter';
51
51
  export { default as distanceAdapter } from './utils/adapter/distanceAdapter';
52
52
  export { default as worksiteNameAdapter } from './utils/adapter/worksiteNameAdapter/worksiteNameAdapter';
53
+ export * from './utils/getCurrentLanguage/getCurrentLanguage';
54
+ export { default as getCurrentLanguage } from './utils/getCurrentLanguage/getCurrentLanguage';
53
55
  export { default as lazyWithRetry } from './utils/lazyWithRetry';
56
+ export * from './utils/pageDuration/pageDuration';
54
57
  export { default as shouldRetryQuery } from './utils/shouldRetryQuery/shouldRetryQuery';
58
+ export * from './utils/token/token';
package/dist/main.js CHANGED
@@ -129,17 +129,17 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
129
129
  value: i,
130
130
  children: e
131
131
  });
132
- }, x = 900 * 1e3, S = 60 * 1e3, C = 600 * 1e3, w = "auto-reload-on-new-version-timestamp", T = /<meta[^>]*name="version"[^>]*content="([^"]*)"/, E = (e) => {
132
+ }, x = 900 * 1e3, S = 60 * 1e3, C = 600 * 1e3, w = "auto-reload-on-new-version-timestamp", ee = /<meta[^>]*name="version"[^>]*content="([^"]*)"/, T = (e) => {
133
133
  try {
134
134
  return sessionStorage.getItem(e);
135
135
  } catch {
136
136
  return null;
137
137
  }
138
- }, D = (e, t) => {
138
+ }, E = (e, t) => {
139
139
  try {
140
140
  sessionStorage.setItem(e, t);
141
141
  } catch {}
142
- }, O = ({ version: e, checkInterval: t = x, children: n, ...r }) => {
142
+ }, D = ({ version: e, checkInterval: t = x, children: n, ...r }) => {
143
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
145
  let { useLocation: f, Outlet: p } = s, { pathname: m } = f(), h = l(m);
@@ -151,7 +151,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
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(T)?.[1];
154
+ let n = (await t.text()).match(ee)?.[1];
155
155
  n && n !== "%VERSION%" && n !== e && (c.current = !0);
156
156
  } catch {}
157
157
  }
@@ -164,10 +164,10 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
164
164
  }, [e, t]), o(() => {
165
165
  if (m === h.current || (h.current = m, !c.current)) return;
166
166
  c.current = !1;
167
- let e = Number(E(w) || "0");
168
- Date.now() - e < C || (D(w, String(Date.now())), window.location.reload());
167
+ let e = Number(T(w) || "0");
168
+ Date.now() - e < C || (E(w, String(Date.now())), window.location.reload());
169
169
  }, [m]), n ?? /* @__PURE__ */ d(p, {});
170
- }, k = ({ data: e, ...t }) => {
170
+ }, O = ({ data: e, ...t }) => {
171
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.");
@@ -183,7 +183,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
183
183
  u,
184
184
  f
185
185
  ]), /* @__PURE__ */ d(l, {});
186
- }, A = "[data-amp-track-feature]", j = [
186
+ }, k = "[data-amp-track-feature]", A = [
187
187
  "a",
188
188
  "button",
189
189
  "input",
@@ -195,18 +195,18 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
195
195
  "[contenteditable=\"true\" i]",
196
196
  "[data-amp-default-track]",
197
197
  ".amp-default-track"
198
- ], ee = { defaultMaskLevel: "medium" }, M = (e, t) => {
198
+ ], te = { defaultMaskLevel: "medium" }, j = (e, t) => {
199
199
  if (e === !1) return !1;
200
200
  let n = e === !0 ? {} : e;
201
201
  return {
202
- cssSelectorAllowlist: [...t, A],
202
+ cssSelectorAllowlist: [...t, k],
203
203
  ...n
204
204
  };
205
- }, N = (e, t) => !t || e === !1 ? !1 : {
205
+ }, M = (e, t) => !t || e === !1 ? !1 : {
206
206
  deadClicks: !0,
207
207
  rageClicks: !0,
208
208
  ...e === !0 ? {} : e
209
- }, P = ({ apiKey: e, appVersion: t, sessionReplaySampleRate: n, serverZone: r, elementInteractions: i = !0, frustrationInteractions: c = !0, platform: u = "desktop", sessionReplayPrivacy: d = ee, ...f }) => {
209
+ }, N = ({ apiKey: e, appVersion: t, sessionReplaySampleRate: n, serverZone: r, elementInteractions: i = !0, frustrationInteractions: c = !0, platform: u = "desktop", sessionReplayPrivacy: d = te, ...f }) => {
210
210
  let { libraries: p } = a(y), m = f.amplitude || p?.amplitude, h = l({
211
211
  elementInteractions: i,
212
212
  frustrationInteractions: c,
@@ -221,12 +221,12 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
221
221
  }), o(() => {
222
222
  let i = m?.analytics, a = m?.sessionReplayPlugin;
223
223
  if (!(e && i)) return;
224
- let { elementInteractions: o, frustrationInteractions: s, sessionReplayPrivacy: c } = h.current, l = "platform-enrichment", d = M(o, i.Types?.DEFAULT_CSS_SELECTOR_ALLOWLIST ?? j);
224
+ let { elementInteractions: o, frustrationInteractions: s, sessionReplayPrivacy: c } = h.current, l = "platform-enrichment", d = j(o, i.Types?.DEFAULT_CSS_SELECTOR_ALLOWLIST ?? A);
225
225
  return i.init(e, {
226
226
  appVersion: t,
227
227
  autocapture: {
228
228
  elementInteractions: d,
229
- frustrationInteractions: N(s, d !== !1),
229
+ frustrationInteractions: M(s, d !== !1),
230
230
  pageViews: { trackHistoryChanges: "pathOnly" }
231
231
  },
232
232
  serverZone: r
@@ -254,22 +254,22 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
254
254
  r,
255
255
  n
256
256
  ]), null;
257
- }, F = (() => {
257
+ }, P = (() => {
258
258
  try {
259
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;
260
260
  } catch {
261
261
  return !1;
262
262
  }
263
- })(), I = "user", L = ({ 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 || I, l = r?.axios || o?.axios;
263
+ })(), ne = "user", re = ({ 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 || ne, l = r?.axios || o?.axios;
265
265
  if (!l) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
266
- if (!l?.defaults || F) return null;
266
+ if (!l?.defaults || P) return null;
267
267
  if (typeof window < "u" && window.localStorage) {
268
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;
269
269
  o && (l.defaults.headers.common.Authorization = o);
270
270
  }
271
271
  return l.defaults.baseURL = i, l.defaults.headers.post["Content-Type"] = n, null;
272
- }, R = [
272
+ }, ie = [
273
273
  "ar",
274
274
  "de",
275
275
  "en",
@@ -277,15 +277,15 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
277
277
  "fr",
278
278
  "it",
279
279
  "pt"
280
- ], te = (e) => R.includes(e), ne = ({ language: e, ...t }) => {
280
+ ], ae = (e) => ie.includes(e), oe = ({ language: e, ...t }) => {
281
281
  let { libraries: n } = a(y), r = t?.dayjs || n?.dayjs, i = t?.plugin || n?.dayjsPlugin;
282
282
  if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");
283
283
  r.extend(t.localizedFormat), i && i.forEach((e) => {
284
284
  e && r.extend(e);
285
285
  });
286
- 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 = ae(o) ? o : "en";
287
287
  return r.locale() !== s && r.locale(s), null;
288
- }, z = "hubspot-messages-iframe-container", B = "hs-show", V = "data-hs-hidden", re = ({ hubId: e }) => (o(() => {
288
+ }, F = "hubspot-messages-iframe-container", I = "hs-show", L = "data-hs-hidden", se = ({ hubId: e }) => (o(() => {
289
289
  if (!e) return;
290
290
  let t = document.createElement("script");
291
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), () => {
@@ -294,14 +294,14 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
294
294
  }, [e]), o(() => {
295
295
  let e = document.createElement("style");
296
296
  return e.textContent = `
297
- html[${V}] div#${z} { display: none !important; }
298
- html[${V}] div#${z}.${B} { display: initial !important; }
299
- `, document.head.appendChild(e), document.documentElement.setAttribute(V, ""), () => {
300
- e.remove(), document.documentElement.removeAttribute(V);
297
+ html[${L}] div#${F} { display: none !important; }
298
+ html[${L}] div#${F}.${I} { display: initial !important; }
299
+ `, document.head.appendChild(e), document.documentElement.setAttribute(L, ""), () => {
300
+ e.remove(), document.documentElement.removeAttribute(L);
301
301
  };
302
- }, []), null), ie = ({ debug: e, resources: t, ...n }) => {
302
+ }, []), null), ce = ({ debug: e, resources: t, ...n }) => {
303
303
  let { libraries: r } = a(y), i = n?.i18 || r?.i18, { i18next: o, initReactI18next: s, languageDetector: c } = i || {};
304
- if (F) return null;
304
+ if (P) return null;
305
305
  if (!(i && o && c && s)) throw Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
306
306
  return o.isInitialized ? null : (o.use(c).use(s).init({
307
307
  debug: e,
@@ -319,12 +319,12 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
319
319
  }), o.on("languageChanged", (e) => {
320
320
  document.documentElement.setAttribute("lang", e);
321
321
  }), null);
322
- }, H = { replay: "keep" }, U = (e) => e.tags?.replay === H.replay, W = [/^https:\/\/(api|events)\.mapbox\.com\//], G = (e, t) => t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e)), ae = ({ dsn: e, integrations: t, tracesSampleRate: n, tracePropagationTargets: r, ignoreErrors: i, ignoreRequestUrls: s, debug: c, environment: l, release: u, replaysSessionSampleRate: d = 0, replaysOnErrorSampleRate: f = 1, replayBeforeErrorSampling: p = U, ...m }) => {
322
+ }, R = { replay: "keep" }, z = (e) => e.tags?.replay === R.replay, B = [/^https:\/\/(api|events)\.mapbox\.com\//], V = (e, t) => t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e)), le = ({ dsn: e, integrations: t, tracesSampleRate: n, tracePropagationTargets: r, ignoreErrors: i, ignoreRequestUrls: s, debug: c, environment: l, release: u, replaysSessionSampleRate: d = 0, replaysOnErrorSampleRate: f = 1, replayBeforeErrorSampling: p = z, ...m }) => {
323
323
  let { libraries: h } = a(y), g = m?.sentry || h?.sentry, _ = m?.reactRouter || h?.reactRouter;
324
324
  if (!g) throw Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
325
325
  if (!_) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
326
326
  if (g.isInitialized()) return null;
327
- let { createRoutesFromChildren: v, matchRoutes: b, useLocation: x, useNavigationType: S } = _, C = d > 0 || f > 0, w = [...s || [], ...W];
327
+ let { createRoutesFromChildren: v, matchRoutes: b, useLocation: x, useNavigationType: S } = _, C = d > 0 || f > 0, w = [...s || [], ...B];
328
328
  return (c || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && g.init({
329
329
  debug: c,
330
330
  dsn: e,
@@ -342,7 +342,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
342
342
  g.reactRouterV6BrowserTracingIntegration({
343
343
  createRoutesFromChildren: v,
344
344
  matchRoutes: b,
345
- shouldCreateSpanForRequest: (e) => !G(e, w),
345
+ shouldCreateSpanForRequest: (e) => !V(e, w),
346
346
  useEffect: o,
347
347
  useLocation: x,
348
348
  useNavigationType: S
@@ -356,12 +356,12 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
356
356
  tracePropagationTargets: r,
357
357
  tracesSampleRate: n ?? 1
358
358
  }), null;
359
- }, K = /* @__PURE__ */ new WeakMap(), oe = "user", se = ({ Fallback: e, isLogged: n, loginPath: r = "/login", redirect401Path: i = "/login", ...s }) => {
360
- let { libraries: c, localStorageKeys: l } = a(y), f = s?.reactRouter || c?.reactRouter, p = s?.axios || c?.axios, m = s?.localStorageKey || l?.user || oe;
359
+ }, H = /* @__PURE__ */ new WeakMap(), ue = "user", de = ({ Fallback: e, isLogged: n, loginPath: r = "/login", redirect401Path: i = "/login", ...s }) => {
360
+ let { libraries: c, localStorageKeys: l } = a(y), f = s?.reactRouter || c?.reactRouter, p = s?.axios || c?.axios, m = s?.localStorageKey || l?.user || ue;
361
361
  if (!f) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
362
362
  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;
363
363
  return o(() => {
364
- p && (K.has(p) || (K.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)))));
364
+ 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)))));
365
365
  }, [
366
366
  p,
367
367
  m,
@@ -377,34 +377,34 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
377
377
  state: { from: x },
378
378
  replace: !0
379
379
  });
380
- }, q = /* @__PURE__ */ new Set(), ce = () => (o(() => {
380
+ }, U = /* @__PURE__ */ new Set(), fe = () => (o(() => {
381
381
  let e = Symbol();
382
- return q.add(e), document.documentElement.removeAttribute(V), () => {
383
- q.delete(e), q.size === 0 && document.documentElement.setAttribute(V, "");
382
+ return U.add(e), document.documentElement.removeAttribute(L), () => {
383
+ U.delete(e), U.size === 0 && document.documentElement.setAttribute(L, "");
384
384
  };
385
- }, []), null), le = "user", ue = {
385
+ }, []), null), pe = "user", me = {
386
386
  client: "/v2/threads/ws",
387
387
  supplier: "/v1/threads/ws"
388
- }, de = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, fe = (e) => {
388
+ }, he = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, ge = (e) => {
389
389
  try {
390
390
  let t = localStorage.getItem(e);
391
391
  return t ? JSON.parse(t)?.accessToken ?? null : null;
392
392
  } catch {
393
393
  return null;
394
394
  }
395
- }, J = n(null), pe = ({ children: e, token: t, url: n, wsPath: r, maxReconnectAttempts: s, reconnectBaseDelay: c, maxMessageBodyLength: f = 1e4, reconnect: p = !0, enabled: m = !0, context: h = "client" }) => {
396
- 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 || le, A = l(null), j = l(/* @__PURE__ */ new Set());
395
+ }, W = n(null), _e = ({ children: e, token: t, url: n, wsPath: r, maxReconnectAttempts: s, reconnectBaseDelay: c, maxMessageBodyLength: f = 1e4, reconnect: p = !0, enabled: m = !0, context: h = "client" }) => {
396
+ let [g, v] = u(!1), [b, x] = u(!1), [S, C] = u(0), [w, ee] = u(m), T = m && w, { apiURL: E, localStorageKeys: D } = a(y), O = D?.user || pe, k = l(null), A = l(/* @__PURE__ */ new Set());
397
397
  o(() => {
398
- if (!E) return;
399
- let e = r ?? ue[h], i = n || (D ? de(D, e) : null);
398
+ if (!T) return;
399
+ let e = r ?? me[h], i = n || (E ? he(E, e) : null);
400
400
  if (!i) return;
401
- let a = () => t ?? fe(k), o = (e) => {
401
+ let a = () => t ?? ge(O), o = (e) => {
402
402
  switch (e.type) {
403
403
  case "ready":
404
404
  x(!0), C(e.unreadCount ?? 0);
405
405
  break;
406
406
  }
407
- for (let t of j.current) t(e);
407
+ for (let t of A.current) t(e);
408
408
  }, l = setTimeout(() => {
409
409
  let e = new _({
410
410
  getToken: a,
@@ -418,80 +418,80 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
418
418
  reconnectBaseDelay: c,
419
419
  url: i
420
420
  });
421
- A.current = e, e.connect();
421
+ k.current = e, e.connect();
422
422
  }, 0);
423
423
  return () => {
424
- clearTimeout(l), A.current?.disconnect(), A.current = null;
424
+ clearTimeout(l), k.current?.disconnect(), k.current = null;
425
425
  };
426
426
  }, [
427
- E,
427
+ T,
428
428
  n,
429
429
  r,
430
430
  h,
431
431
  t,
432
432
  p,
433
- D,
434
- k,
433
+ E,
434
+ O,
435
435
  f,
436
436
  s,
437
437
  c
438
438
  ]);
439
- let ee = i((e) => {
440
- A.current?.joinThread(e);
441
- }, []), M = i((e) => {
442
- A.current?.leaveThread(e);
443
- }, []), N = i((e, t) => {
444
- A.current?.sendMessage(e, t);
445
- }, []), P = i((e) => {
446
- A.current?.markRead(e);
447
- }, []), F = i((e, t) => {
448
- A.current?.listThreads(e, t);
449
- }, []), I = i((e = 1) => {
439
+ let te = i((e) => {
440
+ k.current?.joinThread(e);
441
+ }, []), j = i((e) => {
442
+ k.current?.leaveThread(e);
443
+ }, []), M = i((e, t) => {
444
+ k.current?.sendMessage(e, t);
445
+ }, []), N = i((e) => {
446
+ k.current?.markRead(e);
447
+ }, []), P = i((e, t) => {
448
+ k.current?.listThreads(e, t);
449
+ }, []), ne = i((e = 1) => {
450
450
  C((t) => t + e);
451
- }, []), L = {
451
+ }, []), re = {
452
452
  decrementUnreadCount: i((e = 1) => {
453
453
  C((t) => Math.max(0, t - e));
454
454
  }, []),
455
455
  disconnect: i(() => {
456
- A.current?.disconnect(), A.current = null;
456
+ k.current?.disconnect(), k.current = null;
457
457
  }, []),
458
- incrementUnreadCount: I,
458
+ incrementUnreadCount: ne,
459
459
  isConnected: g,
460
460
  isReady: b,
461
- joinThread: ee,
462
- leaveThread: M,
463
- listThreads: F,
464
- markRead: P,
465
- sendMessage: N,
461
+ joinThread: te,
462
+ leaveThread: j,
463
+ listThreads: P,
464
+ markRead: N,
465
+ sendMessage: M,
466
466
  setEnabled: i((e) => {
467
- T(e);
467
+ ee(e);
468
468
  }, []),
469
- subscribe: i((e) => (j.current.add(e), () => {
470
- j.current.delete(e);
469
+ subscribe: i((e) => (A.current.add(e), () => {
470
+ A.current.delete(e);
471
471
  }), []),
472
472
  unreadCount: S
473
473
  };
474
- return /* @__PURE__ */ d(J.Provider, {
475
- value: L,
474
+ return /* @__PURE__ */ d(W.Provider, {
475
+ value: re,
476
476
  children: e
477
477
  });
478
- }, me = 3, he = new Set([
478
+ }, ve = 3, ye = new Set([
479
479
  400,
480
480
  401,
481
481
  403,
482
482
  404
483
- ]), ge = (e) => e?.response?.status, Y = (e, t) => {
484
- let n = ge(t);
485
- return e < me && !(n !== void 0 && he.has(n));
486
- }, _e = (e, t, n) => (Array.isArray(e) ? e.length : 0) + (typeof n == "number" ? n : 0), ve = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...r }) => {
483
+ ]), be = (e) => e?.response?.status, G = (e, t) => {
484
+ let n = be(t);
485
+ return e < ve && !(n !== void 0 && ye.has(n));
486
+ }, xe = (e, t, n) => (Array.isArray(e) ? e.length : 0) + (typeof n == "number" ? n : 0), Se = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...r }) => {
487
487
  let { libraries: i } = a(y), o = r.QueryClient || i?.reactQuery?.QueryClient, s = r.QueryClientProvider || i?.reactQuery?.QueryClientProvider;
488
488
  if (!o) throw Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
489
489
  if (!s) throw Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
490
490
  let [c] = u(() => new o({ defaultOptions: {
491
491
  mutations: n,
492
492
  queries: {
493
- getNextPageParam: _e,
494
- retry: Y,
493
+ getNextPageParam: xe,
494
+ retry: G,
495
495
  ...t
496
496
  }
497
497
  } }));
@@ -499,17 +499,17 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
499
499
  client: c,
500
500
  children: e
501
501
  });
502
- }, X = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), ye = (e, t) => {
502
+ }, K = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), q = (e, t) => {
503
503
  let { fractionDigits: n = 0, metric: r = "km", spacingBetween: i = !0 } = t || {}, a = Number(e), o = i ? " " : "";
504
504
  return Number.isNaN(a) ? `0${o}${r}` : `${a.toFixed(n)}${o}${r}`;
505
- }, be = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((e) => e.length > 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e).join(" "), xe = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, Se = ({ path: e, size: t, apiURL: n }) => {
505
+ }, 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(" "), Ce = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, we = ({ path: e, size: t, apiURL: n }) => {
506
506
  if (!e) return "";
507
- let r = `${n}${xe(e)}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
507
+ let r = `${n}${Ce(e)}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
508
508
  return typeof t == "number" && i ? `${r.replace("/files", `/thumbs/${t}`)}` : r;
509
- }, Ce = (e) => {
509
+ }, Te = (e) => {
510
510
  let { apiURL: t, libraries: n } = a(y), r = e?.dayjs || n?.dayjs, o = i((e, n) => {
511
511
  if (!t) throw Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");
512
- return typeof e == "string" && /^https?:\/\//.test(e) ? e : Se({
512
+ return typeof e == "string" && /^https?:\/\//.test(e) ? e : we({
513
513
  apiURL: t,
514
514
  path: e,
515
515
  size: n
@@ -518,17 +518,17 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
518
518
  return {
519
519
  dateAdapter: i((e, t) => {
520
520
  if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
521
- return X({
521
+ return K({
522
522
  date: e,
523
523
  format: t,
524
524
  library: r
525
525
  });
526
526
  }, [r]),
527
- distanceAdapter: ye,
527
+ distanceAdapter: q,
528
528
  filePathAdapter: o,
529
- worksiteNameAdapter: be
529
+ worksiteNameAdapter: J
530
530
  };
531
- }, we = () => {
531
+ }, Ee = () => {
532
532
  let { libraries: e } = a(y), t = e?.amplitude?.analytics, n = i((e, n) => {
533
533
  if (!t || (t.setUserId(e), !n)) return;
534
534
  let r = new t.Identify();
@@ -552,7 +552,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
552
552
  setGroup: r,
553
553
  track: o
554
554
  };
555
- }, Te = (e) => {
555
+ }, De = (e) => {
556
556
  let { libraries: t, localStorageKeys: n } = a(y), r = e?.axios || t?.axios, s = e?.localStorageKey || n?.user || "user";
557
557
  if (!r) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
558
558
  let c = i(({ tokenType: e, accessToken: t }) => {
@@ -561,7 +561,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
561
561
  r.defaults.headers.common.Authorization = null;
562
562
  }, [r.defaults.headers.common]);
563
563
  return o(() => {
564
- if (F) return;
564
+ if (P) return;
565
565
  let e = ({ newValue: e, key: t }) => {
566
566
  if (t === s) try {
567
567
  let { accessToken: t, tokenType: n } = JSON.parse(e ?? "null") ?? {};
@@ -588,9 +588,9 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
588
588
  clearAuthenticationToken: l,
589
589
  setAuthenticationToken: c
590
590
  };
591
- }, Ee = "New message", De = (e, t) => {
591
+ }, Oe = "New message", ke = (e, t) => {
592
592
  if (!("Notification" in window) || typeof Notification != "function" || Notification.permission !== "granted" || !document.hidden) return;
593
- let n = new Notification(t.title ?? Ee, {
593
+ let n = new Notification(t.title ?? Oe, {
594
594
  badge: t?.badge,
595
595
  body: t?.body || e.bodyPreview,
596
596
  data: t?.data,
@@ -605,8 +605,8 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
605
605
  let { onClick: r } = t;
606
606
  n.onclick = () => r(e);
607
607
  }
608
- }, Oe = (e) => {
609
- let t = a(J);
608
+ }, Ae = (e) => {
609
+ let t = a(W);
610
610
  if (!t) throw Error("useChat must be used within ChatProvider");
611
611
  let { subscribe: n, setEnabled: r, ...i } = t, s = l(e);
612
612
  return s.current = e, o(() => {
@@ -623,7 +623,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
623
623
  r?.(e);
624
624
  break;
625
625
  case "new_message_notification":
626
- i?.(e), t && t.enabled !== !1 && De(e, t);
626
+ i?.(e), t && t.enabled !== !1 && ke(e, t);
627
627
  break;
628
628
  case "presence":
629
629
  a?.(e);
@@ -648,44 +648,44 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
648
648
  break;
649
649
  }
650
650
  }), [n]), i;
651
- }, Z = (e, t) => t === "short" ? e.split("-")[0] : e, ke = (e, t = "full") => {
652
- let [n, r] = u(() => {
653
- let n = e?.language || navigator.language;
654
- return e && "isInitialized" in e && e.isInitialized, Z(n, t);
655
- });
651
+ }, Y = (e, t = "full") => {
652
+ let n = e || navigator.language;
653
+ return t === "short" ? n.split("-")[0] : n;
654
+ }, je = (e, t = "full") => {
655
+ let [n, r] = u(() => Y(e?.language, t));
656
656
  return o(() => {
657
- e && "isInitialized" in e && e.isInitialized && e.language && r(Z(e.language, t));
657
+ e && "isInitialized" in e && e.isInitialized && e.language && r(Y(e.language, t));
658
658
  let n = (e) => {
659
- r(Z(e, t));
659
+ r(Y(e, t));
660
660
  };
661
661
  return e?.on?.("languageChanged", n), () => {
662
662
  e?.off?.("languageChanged", n);
663
663
  };
664
664
  }, [e, t]), n;
665
- }, Ae = "tracktor.filter", je = {
665
+ }, Me = "tracktor.filter", Ne = {
666
666
  getFilter: () => void 0,
667
667
  getFilters: () => ({}),
668
668
  handleFilter: () => () => {},
669
669
  setFilter: () => {}
670
- }, Me = (e) => {
670
+ }, Pe = (e) => {
671
671
  try {
672
672
  return JSON.parse(e);
673
673
  } catch {
674
674
  return e;
675
675
  }
676
- }, Ne = (e, t, n) => `${n}_${e}=>${t}`, Pe = (e) => e.reduce((e, t) => {
676
+ }, Fe = (e, t, n) => `${n}_${e}=>${t}`, Ie = (e) => e.reduce((e, t) => {
677
677
  let n = localStorage.getItem(t);
678
678
  if (n) try {
679
679
  let t = JSON.parse(n), r = Object.keys(t)?.[0];
680
680
  r && (e[r] = Object.values(t)?.[0]);
681
681
  } catch {}
682
682
  return e;
683
- }, {}), Fe = (e) => {
684
- 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 || Ae, f = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, p = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
685
- if (F) return je;
683
+ }, {}), Le = (e) => {
684
+ 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 || Me, f = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, p = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
685
+ if (P) return Ne;
686
686
  if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");
687
687
  let m = () => Object.keys(localStorage).filter((t) => t.startsWith(d) && t.endsWith(e?.pathname || i)), h = (t, n, r = !0) => {
688
- let a = Ne(t, e?.pathname || i, d);
688
+ let a = Fe(t, e?.pathname || i, d);
689
689
  if (!n || Array.isArray(n) && !n.length) {
690
690
  f ? (o.delete(t), s(o)) : l((e) => {
691
691
  let n = { ...e };
@@ -705,13 +705,13 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
705
705
  getFilter: (t, n) => {
706
706
  if (f) {
707
707
  let e = o.get(t);
708
- if (e) return Me(e);
708
+ if (e) return Pe(e);
709
709
  } else {
710
710
  let e = c[t];
711
711
  if (e !== void 0) return e;
712
712
  }
713
713
  if (p) {
714
- let n = Ne(t, e?.pathname || i, d), r = localStorage.getItem(n);
714
+ let n = Fe(t, e?.pathname || i, d), r = localStorage.getItem(n);
715
715
  if (r) try {
716
716
  let e = JSON.parse(r)[t];
717
717
  return !f && e !== void 0 && l((n) => ({
@@ -723,9 +723,9 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
723
723
  return n;
724
724
  },
725
725
  getFilters: () => {
726
- let e = p ? Pe(m()) : {};
726
+ let e = p ? Ie(m()) : {};
727
727
  if (f) {
728
- let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] = Me(n), e), {});
728
+ let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] = Pe(n), e), {});
729
729
  return {
730
730
  ...e,
731
731
  ...t
@@ -746,7 +746,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
746
746
  },
747
747
  setFilter: h
748
748
  };
749
- }, Ie = () => document.getElementById(z), Le = () => {
749
+ }, Re = () => document.getElementById(F), ze = () => {
750
750
  let [e, t] = u(() => !!window.HubSpotConversations);
751
751
  return o(() => {
752
752
  if (window.HubSpotConversations) {
@@ -756,16 +756,16 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
756
756
  window.hsConversationsOnReady = [() => t(!0)];
757
757
  }, []), o(() => {
758
758
  e && window.HubSpotConversations?.on("widgetClosed", () => {
759
- Ie()?.classList.remove(B);
759
+ Re()?.classList.remove(I);
760
760
  });
761
761
  }, [e]), {
762
762
  isAvailable: e,
763
763
  toggle: i(() => {
764
- let e = window.HubSpotConversations, t = Ie();
765
- e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(B)) : (t.classList.add(B), e.widget.open()));
764
+ let e = window.HubSpotConversations, t = Re();
765
+ e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(I)) : (t.classList.add(I), e.widget.open()));
766
766
  }, [])
767
767
  };
768
- }, Re = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: a, enabled: o = !0 }) => {
768
+ }, Be = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: a, enabled: o = !0 }) => {
769
769
  let s = i(async (e) => {
770
770
  n || !o || await t({ pageParam: e?.pageParam || e.visibleRowsCount });
771
771
  }, [
@@ -781,7 +781,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
781
781
  loadingVariant: r ? "skeleton" : "linear-progress",
782
782
  rows: l
783
783
  };
784
- }, ze = (e) => {
784
+ }, Ve = (e) => {
785
785
  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) => {
786
786
  if (e && typeof e == "object" && "response" in e) {
787
787
  let { response: t } = e || {};
@@ -805,38 +805,38 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
805
805
  }, []),
806
806
  printError: l
807
807
  };
808
- }, Be = "chunk-reload-timestamp", Q = "chunk-reload", Ve = 1e4, $ = 2, He = !1;
809
- if (!F && typeof window < "u") {
808
+ }, He = "chunk-reload-timestamp", X = "chunk-reload", Ue = 1e4, Z = 2, Q = !1;
809
+ if (!P && typeof window < "u") {
810
810
  try {
811
811
  let e = new URL(window.location.href);
812
- e.searchParams.has(Q) && (He = !0, e.searchParams.delete(Q), window.history.replaceState(null, "", e.toString()));
812
+ e.searchParams.has(X) && (Q = !0, e.searchParams.delete(X), window.history.replaceState(null, "", e.toString()));
813
813
  } catch {}
814
814
  window.addEventListener("vite:preloadError", (e) => {
815
815
  e.preventDefault();
816
816
  });
817
817
  }
818
- var Ue = (e) => {
818
+ var We = (e) => {
819
819
  if (!(e instanceof Error)) return !1;
820
820
  let t = e.message.toLowerCase();
821
821
  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";
822
- }, We = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, Ge = (e) => e.toString().match(We)?.[2] ?? null, Ke = (e) => {
822
+ }, Ge = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, Ke = (e) => e.toString().match(Ge)?.[2] ?? null, qe = (e) => {
823
823
  try {
824
824
  return sessionStorage.getItem(e);
825
825
  } catch {
826
826
  return null;
827
827
  }
828
- }, qe = (e, t) => {
828
+ }, Je = (e, t) => {
829
829
  try {
830
830
  sessionStorage.setItem(e, t);
831
831
  } catch {}
832
- }, Je = (e) => Function("url", "return import(url)")(e), Ye = async (e) => {
833
- for (let t = 0; t < $; t++) try {
834
- return await Je(`${e}?t=${Date.now()}`);
832
+ }, Ye = (e) => Function("url", "return import(url)")(e), Xe = async (e) => {
833
+ for (let t = 0; t < Z; t++) try {
834
+ return await Ye(`${e}?t=${Date.now()}`);
835
835
  } catch {
836
- t < $ - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
836
+ t < Z - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
837
837
  }
838
- throw Error(`Failed to import ${e} after ${$} retries`);
839
- }, Xe = async () => {
838
+ throw Error(`Failed to import ${e} after ${Z} retries`);
839
+ }, Ze = async () => {
840
840
  try {
841
841
  if (typeof navigator < "u" && "serviceWorker" in navigator) {
842
842
  let e = await navigator.serviceWorker.getRegistrations();
@@ -847,27 +847,71 @@ var Ue = (e) => {
847
847
  await Promise.all(e.map((e) => caches.delete(e)));
848
848
  }
849
849
  } catch {}
850
- }, Ze = async () => {
851
- await Xe();
850
+ }, Qe = async () => {
851
+ await Ze();
852
852
  let e = new URL(window.location.href);
853
- e.searchParams.set(Q, String(Date.now())), window.location.replace(e.toString());
854
- }, Qe = (e) => e != null && e.default !== void 0, $e = (e) => r(async () => {
853
+ e.searchParams.set(X, String(Date.now())), window.location.replace(e.toString());
854
+ }, $e = (e) => e != null && e.default !== void 0, et = (e) => r(async () => {
855
855
  let t;
856
856
  try {
857
857
  let n = await e();
858
- if (Qe(n)) return n;
858
+ if ($e(n)) return n;
859
859
  t = /* @__PURE__ */ Error("Module resolved without a valid default export");
860
860
  } catch (e) {
861
861
  t = e;
862
862
  }
863
- if (F || !Ue(t)) throw t;
864
- let n = Ge(e);
863
+ if (P || !We(t)) throw t;
864
+ let n = Ke(e);
865
865
  if (n) try {
866
- let e = await Ye(n);
867
- if (Qe(e)) return e;
866
+ let e = await Xe(n);
867
+ if ($e(e)) return e;
868
868
  } catch {}
869
- let r = Number(Ke(Be) || "0");
870
- return Date.now() - r < Ve || He || (qe(Be, String(Date.now())), await Ze()), { default: () => null };
871
- });
869
+ let r = Number(qe(He) || "0");
870
+ return Date.now() - r < Ue || Q || (Je(He, String(Date.now())), await Qe()), { default: () => null };
871
+ }), tt = "Page Left", nt = 1800 * 1e3, rt = 1e3, it = (e, t = !0) => {
872
+ let n = 0, r = t ? e : null, i = !1, a = (e) => {
873
+ r !== null && (n += Math.max(0, e - r), r = null);
874
+ };
875
+ return {
876
+ pause: (e) => {
877
+ i || a(e);
878
+ },
879
+ resume: (e) => {
880
+ !i && r === null && (r = e);
881
+ },
882
+ stop: (e) => (i ||= (a(e), !0), Math.min(nt, Math.round(n)))
883
+ };
884
+ }, at = (e, t) => t < 1e3 ? null : {
885
+ duration_ms: Math.round(t),
886
+ page_path: e
887
+ }, ot = (e) => {
888
+ if (typeof e != "object" || !e) return !1;
889
+ let { exp: t, sub: n, entity_id: r, scope: i } = e;
890
+ return typeof t == "number" && typeof n == "string" && typeof r == "number" && Array.isArray(i) && i.every((e) => typeof e == "string");
891
+ }, st = (e) => {
892
+ let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4);
893
+ return decodeURIComponent(Array.from(atob(n), (e) => `%${e.charCodeAt(0).toString(16).padStart(2, "0")}`).join(""));
894
+ }, ct = (e) => {
895
+ let t = e?.split(".")[1];
896
+ if (!t) return null;
897
+ try {
898
+ let e = JSON.parse(st(t));
899
+ return ot(e) ? e : null;
900
+ } catch {
901
+ return null;
902
+ }
903
+ }, $ = (e) => btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), lt = async (e, t) => {
904
+ let n = new TextEncoder(), r = await crypto.subtle.importKey("raw", n.encode(e), {
905
+ hash: "SHA-256",
906
+ name: "HMAC"
907
+ }, !1, ["sign"]), i = await crypto.subtle.sign("HMAC", r, n.encode(t));
908
+ return $(String.fromCharCode(...new Uint8Array(i)));
909
+ }, ut = async (e, t) => {
910
+ let n = `${$(JSON.stringify({
911
+ alg: "HS256",
912
+ typ: "JWT"
913
+ }))}.${$(JSON.stringify(e))}`;
914
+ return `${n}.${await lt(t, n)}`;
915
+ };
872
916
  //#endregion
873
- export { A as AMPLITUDE_FEATURE_SELECTOR, O as AutoReloadOnNewVersion, _ as ChatClient, J as ChatContext, pe as ChatProvider, k as GTMSendPageView, P as InitializeAmplitude, L as InitializeAxiosConfig, ne as InitializeDaysJSConfig, re as InitializeHubSpot, ie as InitializeI18nConfig, ae as InitializeSentryConfig, y as InjectDependenciesContext, b as InjectDependenciesProvider, v as MaskTextField, ve as QueryProvider, se as RequireAuth, W as SENTRY_IGNORED_REQUEST_URLS, H as SENTRY_KEEP_REPLAY, R as SUPPORTED_LANGUAGE, ce as ShowHubSpotBubble, X as dateAdapter, ye as distanceAdapter, e as getOrvalConfig, U as isReplayKeptForError, $e as lazyWithRetry, G as matchesRequestUrl, Y as shouldRetryQuery, Ce as useAdapter, we as useAmplitude, Te as useAuth, Oe as useChat, ke as useCurrentLanguage, Fe as useFilters, Le as useHubSpot, Re as useInfiniteDataGrid, ze as useResponseError, be as worksiteNameAdapter };
917
+ export { k as AMPLITUDE_FEATURE_SELECTOR, D as AutoReloadOnNewVersion, _ as ChatClient, W as ChatContext, _e as ChatProvider, O as GTMSendPageView, N as InitializeAmplitude, re as InitializeAxiosConfig, oe as InitializeDaysJSConfig, se as InitializeHubSpot, ce as InitializeI18nConfig, le as InitializeSentryConfig, y as InjectDependenciesContext, b as InjectDependenciesProvider, v as MaskTextField, nt as PAGE_DURATION_CAP_MS, rt as PAGE_DURATION_MIN_MS, tt as PAGE_LEFT_EVENT, Se as QueryProvider, de as RequireAuth, B as SENTRY_IGNORED_REQUEST_URLS, R as SENTRY_KEEP_REPLAY, ie as SUPPORTED_LANGUAGE, fe as ShowHubSpotBubble, it as createVisibleStopwatch, K as dateAdapter, ct as decodeToken, q as distanceAdapter, ut as encodeToken, Y as getCurrentLanguage, e as getOrvalConfig, z as isReplayKeptForError, et as lazyWithRetry, V as matchesRequestUrl, at as pageLeftProperties, G as shouldRetryQuery, Te as useAdapter, Ee as useAmplitude, De as useAuth, Ae as useChat, je as useCurrentLanguage, Le as useFilters, ze as useHubSpot, Be as useInfiniteDataGrid, Ve as useResponseError, J as worksiteNameAdapter };
@@ -0,0 +1,10 @@
1
+ export type LocaleType = "short" | "full";
2
+ /**
3
+ * The language in the form asked: `short` keeps the language alone ("fr" from "fr-FR"), `full` keeps
4
+ * the regional tag. Falls back on the browser's language when none is given. Usable outside React
5
+ * (API payloads, Treege labels — which are keyed by short codes); components use `useCurrentLanguage`.
6
+ * @param language - A BCP 47 tag, usually `i18next.language`
7
+ * @param type - "short" for "fr", "full" for "fr-FR"
8
+ */
9
+ declare const getCurrentLanguage: (language?: string | null, type?: LocaleType) => string;
10
+ export default getCurrentLanguage;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Time spent on a page, reported to Amplitude as "Page Left" when the user leaves it (route change,
3
+ * tab closed, tab sent to the background). Only the time the tab is visible counts: a page left open
4
+ * behind another window is not a visit. The value is capped so that one forgotten tab does not
5
+ * dominate an average, and very short stays (redirects) are not reported at all.
6
+ */
7
+ export declare const PAGE_LEFT_EVENT = "Page Left";
8
+ /** Beyond 30 minutes on a page, nobody is reading: the visit is capped there. */
9
+ export declare const PAGE_DURATION_CAP_MS: number;
10
+ /** Under a second, the page was a redirect, not a visit. */
11
+ export declare const PAGE_DURATION_MIN_MS = 1000;
12
+ export interface VisibleStopwatch {
13
+ /** The tab went to the background: stop counting. */
14
+ pause(at: number): void;
15
+ /** The tab is visible again: count again. */
16
+ resume(at: number): void;
17
+ /** The page is left: the visible time in ms, capped. Further calls change nothing. */
18
+ stop(at: number): number;
19
+ }
20
+ /**
21
+ * A stopwatch that only counts while the tab is visible.
22
+ * @param startedAt - Timestamp of the arrival on the page (ms)
23
+ * @param visible - Whether the tab is visible at that moment
24
+ */
25
+ export declare const createVisibleStopwatch: (startedAt: number, visible?: boolean) => VisibleStopwatch;
26
+ /** The event properties for a visit, or `null` when the stay was too short to be a visit. */
27
+ export declare const pageLeftProperties: (pathname: string, durationMs: number) => {
28
+ duration_ms: number;
29
+ page_path: string;
30
+ } | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ /** What the API puts in an access token. */
2
+ export interface PayloadToken {
3
+ exp: number;
4
+ sub: string;
5
+ entity_id: number;
6
+ scope: string[];
7
+ sassClient: string;
8
+ }
9
+ export interface Payload {
10
+ [key: string]: string | number | Record<string, unknown> | string[];
11
+ }
12
+ /**
13
+ * The payload of an access token, or null when the token is missing, malformed, or not one of ours.
14
+ * The signature is not checked: this reads a token the API issued, it does not trust it.
15
+ * @param accessToken - A JWT
16
+ */
17
+ export declare const decodeToken: (accessToken?: string) => PayloadToken | null;
18
+ /**
19
+ * A JWT (HS256) carrying the payload, signed with the secret key.
20
+ * @param payload - What the token carries
21
+ * @param secretKey - The HMAC SHA-256 key
22
+ */
23
+ export declare const encodeToken: (payload: Payload, secretKey: string) => Promise<string>;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getsoren/shared-module",
3
- "version": "2.53.0",
3
+ "version": "2.54.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "types": "./dist/main.d.ts",