@getsoren/shared-module 2.47.2 → 2.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -53,7 +53,7 @@ export default App;
53
53
  | GTMSendPageView | React Component | Send page view event to Google Tag Manager | @getsoren/react-google-tag-manager & react-router-dom |
54
54
  | InitializeAxiosConfig | React Component | Initialize Axios with custom default config options | Axios |
55
55
  | InitializeI18nConfig | React Component | Initialize i18n with custom config options | i18next & react-i18next & i18next-browser-languagedetector |
56
- | InitializeSentryConfig | React Component | Initialize Sentry | @sentry/react & react-router-dom |
56
+ | InitializeSentryConfig | React Component | Initialize Sentry (tracing + buffered replay) | @sentry/react & react-router-dom |
57
57
  | InitializeMapBoxConfig | React Component | Initialize MapBox | mapbox-gl |
58
58
  | InitializeDaysJSConfig | React Component | Initialize DayJS | dayjs |
59
59
  | InitializeHubSpot | React Component | Initialize HubSpot chat widget | - |
@@ -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;
@@ -1,3 +1,4 @@
1
+ import { ErrorEvent } from '@sentry/react';
1
2
  import { InjectDependenciesContextProps } from '../../context/InjectDependenciesProvider';
2
3
  interface InitializeSentryConfigProps {
3
4
  /**
@@ -13,10 +14,7 @@ interface InitializeSentryConfigProps {
13
14
  */
14
15
  dsn: string;
15
16
  /**
16
- * List of integrations that should be installed after SDK was initialized.
17
- */
18
- /**
19
- * List of integrations that should be installed after SDK was initialized.
17
+ * Extra integrations installed after the SDK is initialized, on top of the built-in browser tracing and replay ones.
20
18
  */
21
19
  integrations?: any[];
22
20
  /**
@@ -25,15 +23,21 @@ interface InitializeSentryConfigProps {
25
23
  */
26
24
  tracesSampleRate?: number;
27
25
  /**
28
- * The sample rate for session-long replays.
29
- * 1.0 will record all sessions and 0 will record none.
26
+ * The sample rate for session-long replays. 1.0 records every session, 0 records none.
27
+ * Defaults to `0`: replays stay in memory (buffer mode) and are only uploaded for errors, see `replaysOnErrorSampleRate`.
30
28
  */
31
29
  replaysSessionSampleRate?: number;
32
30
  /**
33
- * The sample rate for sessions that has had an error occur.
34
- * This is independent of sessionSampleRate. 1.0 will record all sessions and 0 will record none.
31
+ * The sample rate for sessions that had an error occur, independent of `replaysSessionSampleRate`.
32
+ * Defaults to `1.0`. Which errors flush the buffered replay is decided by `replayBeforeErrorSampling`.
35
33
  */
36
34
  replaysOnErrorSampleRate?: number;
35
+ /**
36
+ * Decides, per error, whether the buffered replay is uploaded. Defaults to keeping only errors tagged with
37
+ * `SENTRY_KEEP_REPLAY` (`sentry.captureException(error, { tags: SENTRY_KEEP_REPLAY })`). Pass `() => true` to
38
+ * upload a replay for every error. Only applies in buffer mode; session-long replays are always sent.
39
+ */
40
+ replayBeforeErrorSampling?: (event: ErrorEvent) => boolean;
37
41
  /**
38
42
  * List of strings/regex controlling to which outgoing requests the SDK will attach tracing headers.
39
43
  * By default, the SDK will attach those headers to all requests to localhost and same origin. If this option is provided, the SDK will match the request URL of outgoing requests against the items in this array, and only attach tracing headers if a match was found.
@@ -71,11 +75,12 @@ interface InitializeSentryConfigProps {
71
75
  * @param tracesSampleRate
72
76
  * @param replaysSessionSampleRate
73
77
  * @param replaysOnErrorSampleRate
78
+ * @param replayBeforeErrorSampling
74
79
  * @param tracePropagationTargets
75
80
  * @param ignoreErrors
76
81
  * @param debug
77
82
  * @param environment
78
83
  * @constructor
79
84
  */
80
- declare const InitializeSentryConfig: ({ dsn, integrations, tracesSampleRate, replaysSessionSampleRate, replaysOnErrorSampleRate, tracePropagationTargets, ignoreErrors, debug, environment, release, ...props }: InitializeSentryConfigProps) => null;
85
+ declare const InitializeSentryConfig: ({ dsn, integrations, tracesSampleRate, tracePropagationTargets, ignoreErrors, debug, environment, release, replaysSessionSampleRate, replaysOnErrorSampleRate, replayBeforeErrorSampling, ...props }: InitializeSentryConfigProps) => null;
81
86
  export default InitializeSentryConfig;
@@ -0,0 +1,13 @@
1
+ import { ErrorEvent } from '@sentry/react';
2
+ /**
3
+ * Tag opting an error into a replay upload when replays run in buffer mode (session sample rate at 0).
4
+ * Spread it into the capture context: `sentry.captureException(error, { tags: SENTRY_KEEP_REPLAY })`.
5
+ */
6
+ export declare const SENTRY_KEEP_REPLAY: {
7
+ readonly replay: "keep";
8
+ };
9
+ /**
10
+ * Default `beforeErrorSampling` of the replay integration: only errors tagged with `SENTRY_KEEP_REPLAY` flush the
11
+ * buffered replay, so a noisy error never burns the replay quota by itself.
12
+ */
13
+ export declare const isReplayKeptForError: (event: ErrorEvent) => boolean;
package/dist/main.d.ts CHANGED
@@ -22,6 +22,7 @@ export * from './components/Utils/RequireAuth';
22
22
  export { default as RequireAuth } from './components/Utils/RequireAuth';
23
23
  export * from './components/Utils/ShowHubSpotBubble';
24
24
  export { default as ShowHubSpotBubble } from './components/Utils/ShowHubSpotBubble';
25
+ export * from './constants/sentry';
25
26
  export * from './context/ChatProvider';
26
27
  export { default as ChatProvider } from './context/ChatProvider';
27
28
  export * from './context/InjectDependenciesProvider';
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="([^"]*)"/, ee = (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
- }, T = (e, t) => {
138
+ }, D = (e, t) => {
139
139
  try {
140
140
  sessionStorage.setItem(e, t);
141
141
  } catch {}
142
- }, E = ({ 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(ee(C) || "0");
168
- Date.now() - e < S || (T(C, String(Date.now())), window.location.reload());
169
- }, [m]), n ?? /* @__PURE__ */ u(p, {});
170
- }, D = ({ 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
- }, O = "[data-amp-track-feature]", k = [
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
- ], A = { defaultMaskLevel: "medium" }, j = (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, O],
202
+ cssSelectorAllowlist: [...t, A],
203
203
  ...n
204
204
  };
205
- }, M = (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 = A, 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 = j(n, a.Types?.DEFAULT_CSS_SELECTOR_ALLOWLIST ?? k);
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: M(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,18 +319,18 @@ 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
- }, ae = ({ dsn: e, integrations: t, tracesSampleRate: n, replaysSessionSampleRate: r, replaysOnErrorSampleRate: i, tracePropagationTargets: s, ignoreErrors: c, debug: l, environment: u, release: d, ...f }) => {
316
- let { libraries: p } = a(v), m = f?.sentry || p?.sentry, h = f?.reactRouter || p?.reactRouter;
317
- if (!m) throw Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
318
- if (!h) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
319
- if (m.isInitialized()) return null;
320
- let { createRoutesFromChildren: g, matchRoutes: _, useLocation: y, useNavigationType: b } = h;
321
- return (l || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && m.init({
322
- debug: l,
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;
324
+ if (!h) throw Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
325
+ if (!g) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
326
+ if (h.isInitialized()) return null;
327
+ let { createRoutesFromChildren: _, matchRoutes: v, useLocation: b, useNavigationType: x } = g, S = u > 0 || d > 0;
328
+ return (s || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && h.init({
329
+ debug: s,
323
330
  dsn: e,
324
- environment: u || "production",
331
+ environment: c || "production",
325
332
  ignoreErrors: [
326
- ...c || [],
333
+ ...i || [],
327
334
  /dynamically imported module/,
328
335
  /Cannot read properties of undefined \(reading 'default'\)/,
329
336
  /Loading chunk \d+ failed/,
@@ -331,146 +338,150 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
331
338
  /Failed to fetch dynamically imported module/,
332
339
  /vite:preloadError/
333
340
  ],
334
- integrations: [m.reactRouterV6BrowserTracingIntegration({
335
- createRoutesFromChildren: g,
336
- matchRoutes: _,
337
- useEffect: o,
338
- useLocation: y,
339
- useNavigationType: b
340
- }), ...t || []],
341
- release: d,
342
- replaysOnErrorSampleRate: i ?? 1,
343
- replaysSessionSampleRate: r ?? .1,
344
- tracePropagationTargets: s,
341
+ integrations: [
342
+ h.reactRouterV6BrowserTracingIntegration({
343
+ createRoutesFromChildren: _,
344
+ matchRoutes: v,
345
+ useEffect: o,
346
+ useLocation: b,
347
+ useNavigationType: x
348
+ }),
349
+ ...S ? [h.replayIntegration({ beforeErrorSampling: f })] : [],
350
+ ...t || []
351
+ ],
352
+ release: l,
353
+ replaysOnErrorSampleRate: d,
354
+ replaysSessionSampleRate: u,
355
+ tracePropagationTargets: r,
345
356
  tracesSampleRate: n ?? 1
346
357
  }), null;
347
- }, V = /* @__PURE__ */ new WeakMap(), oe = "user", se = ({ Fallback: e, isLogged: n, loginPath: r = "/login", redirect401Path: i = "/login", ...s }) => {
348
- 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;
349
360
  if (!f) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
350
- 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;
351
362
  return o(() => {
352
- p && (V.has(p) || (V.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)))));
353
364
  }, [
354
365
  p,
355
366
  m,
356
367
  i
357
- ]), C && !h ? /* @__PURE__ */ u(t, {
368
+ ]), C && !h ? /* @__PURE__ */ d(t, {
358
369
  fallback: e,
359
- 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, {
360
371
  to: x.state.from.state.from.pathname + x.state.from.state.from.search,
361
372
  replace: !0
362
- }) : /* @__PURE__ */ u(b, {})
363
- }) : /* @__PURE__ */ u(y, {
373
+ }) : /* @__PURE__ */ d(b, {})
374
+ }) : /* @__PURE__ */ d(v, {
364
375
  to: r + x.search,
365
376
  state: { from: x },
366
377
  replace: !0
367
378
  });
368
- }, H = /* @__PURE__ */ new Set(), ce = () => (o(() => {
379
+ }, U = /* @__PURE__ */ new Set(), ue = () => (o(() => {
369
380
  let e = Symbol();
370
- return H.add(e), document.documentElement.removeAttribute(B), () => {
371
- H.delete(e), H.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, "");
372
383
  };
373
- }, []), null), le = "user", ue = {
384
+ }, []), null), de = "user", fe = {
374
385
  client: "/v2/threads/ws",
375
386
  supplier: "/v1/threads/ws"
376
- }, 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) => {
377
388
  try {
378
389
  let t = localStorage.getItem(e);
379
390
  return t ? JSON.parse(t)?.accessToken ?? null : null;
380
391
  } catch {
381
392
  return null;
382
393
  }
383
- }, U = 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" }) => {
384
- let [_, y] = l(!1), [b, x] = l(!1), [S, C] = l(0), [w, ee] = l(m), T = m && w, { apiURL: E, localStorageKeys: D } = a(v), O = D?.user || le, k = c(null), A = 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());
385
396
  o(() => {
386
- if (!T) return;
387
- let e = r ?? ue[h], i = n || (E ? de(E, e) : null);
397
+ if (!E) return;
398
+ let e = r ?? fe[h], i = n || (D ? pe(D, e) : null);
388
399
  if (!i) return;
389
- let a = () => t ?? fe(O), o = (e) => {
400
+ let a = () => t ?? me(k), o = (e) => {
390
401
  switch (e.type) {
391
402
  case "ready":
392
403
  x(!0), C(e.unreadCount ?? 0);
393
404
  break;
394
405
  }
395
- for (let t of A.current) t(e);
396
- }, c = setTimeout(() => {
397
- let e = new g({
406
+ for (let t of j.current) t(e);
407
+ }, l = setTimeout(() => {
408
+ let e = new _({
398
409
  getToken: a,
399
410
  maxMessageBodyLength: f,
400
411
  maxReconnectAttempts: s,
401
412
  onConnectionChange: (e) => {
402
- y(e), e || x(!1);
413
+ v(e), e || x(!1);
403
414
  },
404
415
  onEvent: o,
405
416
  reconnect: p,
406
- reconnectBaseDelay: d,
417
+ reconnectBaseDelay: c,
407
418
  url: i
408
419
  });
409
- k.current = e, e.connect();
420
+ A.current = e, e.connect();
410
421
  }, 0);
411
422
  return () => {
412
- clearTimeout(c), k.current?.disconnect(), k.current = null;
423
+ clearTimeout(l), A.current?.disconnect(), A.current = null;
413
424
  };
414
425
  }, [
415
- T,
426
+ E,
416
427
  n,
417
428
  r,
418
429
  h,
419
430
  t,
420
431
  p,
421
- E,
422
- O,
432
+ D,
433
+ k,
423
434
  f,
424
435
  s,
425
- d
436
+ c
426
437
  ]);
427
- let j = i((e) => {
428
- k.current?.joinThread(e);
429
- }, []), M = i((e) => {
430
- k.current?.leaveThread(e);
431
- }, []), N = i((e, t) => {
432
- k.current?.sendMessage(e, t);
433
- }, []), P = i((e) => {
434
- k.current?.markRead(e);
435
- }, []), F = i((e, t) => {
436
- k.current?.listThreads(e, t);
437
- }, []), I = i((e = 1) => {
438
+ let M = i((e) => {
439
+ A.current?.joinThread(e);
440
+ }, []), N = i((e) => {
441
+ A.current?.leaveThread(e);
442
+ }, []), P = i((e, t) => {
443
+ A.current?.sendMessage(e, t);
444
+ }, []), F = i((e) => {
445
+ A.current?.markRead(e);
446
+ }, []), I = i((e, t) => {
447
+ A.current?.listThreads(e, t);
448
+ }, []), ee = i((e = 1) => {
438
449
  C((t) => t + e);
439
- }, []), L = {
450
+ }, []), te = {
440
451
  decrementUnreadCount: i((e = 1) => {
441
452
  C((t) => Math.max(0, t - e));
442
453
  }, []),
443
454
  disconnect: i(() => {
444
- k.current?.disconnect(), k.current = null;
455
+ A.current?.disconnect(), A.current = null;
445
456
  }, []),
446
- incrementUnreadCount: I,
447
- isConnected: _,
457
+ incrementUnreadCount: ee,
458
+ isConnected: g,
448
459
  isReady: b,
449
- joinThread: j,
450
- leaveThread: M,
451
- listThreads: F,
452
- markRead: P,
453
- sendMessage: N,
460
+ joinThread: M,
461
+ leaveThread: N,
462
+ listThreads: I,
463
+ markRead: F,
464
+ sendMessage: P,
454
465
  setEnabled: i((e) => {
455
- ee(e);
466
+ T(e);
456
467
  }, []),
457
- subscribe: i((e) => (A.current.add(e), () => {
458
- A.current.delete(e);
468
+ subscribe: i((e) => (j.current.add(e), () => {
469
+ j.current.delete(e);
459
470
  }), []),
460
471
  unreadCount: S
461
472
  };
462
- return /* @__PURE__ */ u(U.Provider, {
463
- value: L,
473
+ return /* @__PURE__ */ d(W.Provider, {
474
+ value: te,
464
475
  children: e
465
476
  });
466
- }, me = (e) => e && typeof e == "function", he = (e) => e && typeof e == "function", ge = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...r }) => {
467
- 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;
468
479
  if (!o) throw Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
469
480
  if (!s) throw Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
470
- if (!me(s)) throw Error("Provided QueryClientProvider dependencies are not valid.");
471
- if (!he(o)) throw Error("Provided QueryClient dependencies are not valid.");
472
- let l = c(null);
473
- 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: {
474
485
  mutations: { ...n },
475
486
  queries: {
476
487
  getNextPageParam: (e, t, n) => e.length + (n || 0),
@@ -478,41 +489,41 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
478
489
  retry: 3,
479
490
  ...t
480
491
  }
481
- } }), /* @__PURE__ */ u(s, {
482
- client: l.current,
492
+ } }), /* @__PURE__ */ d(s, {
493
+ client: c.current,
483
494
  children: e
484
495
  });
485
- }, W = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), G = (e, t) => {
496
+ }, G = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), K = (e, t) => {
486
497
  let { fractionDigits: n = 0, metric: r = "km", spacingBetween: i = !0 } = t || {}, a = Number(e), o = i ? " " : "";
487
498
  return Number.isNaN(a) ? `0${o}${r}` : `${a.toFixed(n)}${o}${r}`;
488
- }, K = (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 }) => {
489
500
  if (!e) return "";
490
- 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;
491
502
  return typeof t == "number" && i ? `${r.replace("/files", `/thumbs/${t}`)}` : r;
492
- }, ye = (e) => {
493
- 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;
494
505
  return {
495
506
  dateAdapter: (e, t) => {
496
507
  if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
497
- return W({
508
+ return G({
498
509
  date: e,
499
510
  format: t,
500
511
  library: r
501
512
  });
502
513
  },
503
- distanceAdapter: G,
514
+ distanceAdapter: K,
504
515
  filePathAdapter: (e, n) => {
505
516
  if (!t) throw Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");
506
- return typeof e == "string" && /^https?:\/\//.test(e) ? e : ve({
517
+ return typeof e == "string" && /^https?:\/\//.test(e) ? e : be({
507
518
  apiURL: t,
508
519
  path: e,
509
520
  size: n
510
521
  });
511
522
  },
512
- worksiteNameAdapter: K
523
+ worksiteNameAdapter: q
513
524
  };
514
- }, be = () => {
515
- 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) => {
516
527
  if (!t || (t.setUserId(e), !n)) return;
517
528
  let r = new t.Identify();
518
529
  Object.entries(n).forEach(([e, t]) => {
@@ -535,14 +546,14 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
535
546
  setGroup: r,
536
547
  track: o
537
548
  };
538
- }, xe = (e) => {
539
- 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";
540
551
  if (!r) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
541
552
  let c = i(({ tokenType: e, accessToken: t }) => {
542
553
  r.defaults.headers.common.Authorization = `${e} ${t}`;
543
554
  }, [r.defaults.headers.common]);
544
555
  return o(() => {
545
- if (P) return;
556
+ if (I) return;
546
557
  let e = ({ newValue: e, key: t }) => {
547
558
  if (t === s && e) try {
548
559
  let { accessToken: t, tokenType: n } = JSON.parse(e);
@@ -563,9 +574,9 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
563
574
  },
564
575
  setAuthenticationToken: c
565
576
  };
566
- }, Se = "New message", Ce = (e, t) => {
577
+ }, we = "New message", Te = (e, t) => {
567
578
  if (!("Notification" in window) || typeof Notification != "function" || Notification.permission !== "granted" || !document.hidden) return;
568
- let n = new Notification(t.title ?? Se, {
579
+ let n = new Notification(t.title ?? we, {
569
580
  badge: t?.badge,
570
581
  body: t?.body || e.bodyPreview,
571
582
  data: t?.data,
@@ -580,10 +591,10 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
580
591
  let { onClick: r } = t;
581
592
  n.onclick = () => r(e);
582
593
  }
583
- }, we = (e) => {
584
- let t = a(U);
594
+ }, Ee = (e) => {
595
+ let t = a(W);
585
596
  if (!t) throw Error("useChat must be used within ChatProvider");
586
- let { subscribe: n, setEnabled: r, ...i } = t, s = c(e);
597
+ let { subscribe: n, setEnabled: r, ...i } = t, s = l(e);
587
598
  return s.current = e, o(() => {
588
599
  e?.enabled !== void 0 && r(e.enabled);
589
600
  }, [e?.enabled, r]), o(() => {
@@ -598,7 +609,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
598
609
  r?.(e);
599
610
  break;
600
611
  case "new_message_notification":
601
- i?.(e), t && t.enabled !== !1 && Ce(e, t);
612
+ i?.(e), t && t.enabled !== !1 && Te(e, t);
602
613
  break;
603
614
  case "presence":
604
615
  a?.(e);
@@ -623,46 +634,46 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
623
634
  break;
624
635
  }
625
636
  }), [n]), i;
626
- }, q = (e, t) => t === "short" ? e.split("-")[0] : e, Te = (e, t = "full") => {
627
- let [n, r] = l(() => {
637
+ }, J = (e, t) => t === "short" ? e.split("-")[0] : e, De = (e, t = "full") => {
638
+ let [n, r] = u(() => {
628
639
  let n = e?.language || navigator.language;
629
- return e && "isInitialized" in e && e.isInitialized, q(n, t);
640
+ return e && "isInitialized" in e && e.isInitialized, J(n, t);
630
641
  });
631
642
  return o(() => {
632
- e && "isInitialized" in e && e.isInitialized && e.language && r(q(e.language, t));
643
+ e && "isInitialized" in e && e.isInitialized && e.language && r(J(e.language, t));
633
644
  let n = (e) => {
634
- r(q(e, t));
645
+ r(J(e, t));
635
646
  };
636
647
  return e?.on?.("languageChanged", n), () => {
637
648
  e?.off?.("languageChanged", n);
638
649
  };
639
650
  }, [e, t]), n;
640
- }, Ee = "tracktor.filter", De = {
651
+ }, Oe = "tracktor.filter", ke = {
641
652
  getFilter: () => void 0,
642
653
  getFilters: () => ({}),
643
654
  handleFilter: () => () => {},
644
655
  setFilter: () => {}
645
- }, J = (e) => {
656
+ }, Y = (e) => {
646
657
  try {
647
658
  return JSON.parse(e);
648
659
  } catch {
649
660
  return e;
650
661
  }
651
- }, Y = (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) => {
652
663
  let n = localStorage.getItem(t);
653
664
  if (n) try {
654
665
  let t = JSON.parse(n), r = Object.keys(t)?.[0];
655
666
  r && (e[r] = Object.values(t)?.[0]);
656
667
  } catch {}
657
668
  return e;
658
- }, {}), ke = (e) => {
659
- 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;
660
- 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;
661
672
  if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");
662
673
  let m = () => Object.keys(localStorage).filter((t) => t.startsWith(d) && t.endsWith(e?.pathname || i)), h = (t, n, r = !0) => {
663
- let a = Y(t, e?.pathname || i, d);
674
+ let a = Ae(t, e?.pathname || i, d);
664
675
  if (!n || Array.isArray(n) && !n.length) {
665
- f ? (o.delete(t), s(o)) : u((e) => {
676
+ f ? (o.delete(t), s(o)) : l((e) => {
666
677
  let n = { ...e };
667
678
  return delete n[t], n;
668
679
  }), p && localStorage.removeItem(a);
@@ -671,7 +682,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
671
682
  p && r && n && localStorage.setItem(a, JSON.stringify({
672
683
  ...o,
673
684
  [t]: n
674
- })), 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) => ({
675
686
  ...e,
676
687
  [t]: n
677
688
  }));
@@ -680,16 +691,16 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
680
691
  getFilter: (t, n) => {
681
692
  if (f) {
682
693
  let e = o.get(t);
683
- if (e) return J(e);
694
+ if (e) return Y(e);
684
695
  } else {
685
696
  let e = c[t];
686
697
  if (e !== void 0) return e;
687
698
  }
688
699
  if (p) {
689
- let n = Y(t, e?.pathname || i, d), r = localStorage.getItem(n);
700
+ let n = Ae(t, e?.pathname || i, d), r = localStorage.getItem(n);
690
701
  if (r) try {
691
702
  let e = JSON.parse(r)[t];
692
- return !f && e !== void 0 && u((n) => ({
703
+ return !f && e !== void 0 && l((n) => ({
693
704
  ...n,
694
705
  [t]: e
695
706
  })), e;
@@ -698,9 +709,9 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
698
709
  return n;
699
710
  },
700
711
  getFilters: () => {
701
- let e = p ? Oe(m()) : {};
712
+ let e = p ? je(m()) : {};
702
713
  if (f) {
703
- let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] = J(n), e), {});
714
+ let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] = Y(n), e), {});
704
715
  return {
705
716
  ...e,
706
717
  ...t
@@ -721,8 +732,8 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
721
732
  },
722
733
  setFilter: h
723
734
  };
724
- }, X = () => document.getElementById(R), Ae = () => {
725
- let [e, t] = l(() => !!window.HubSpotConversations);
735
+ }, Ne = () => document.getElementById(L), Pe = () => {
736
+ let [e, t] = u(() => !!window.HubSpotConversations);
726
737
  return o(() => {
727
738
  if (window.HubSpotConversations) {
728
739
  t(!0);
@@ -731,33 +742,33 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
731
742
  window.hsConversationsOnReady = [() => t(!0)];
732
743
  }, []), o(() => {
733
744
  e && window.HubSpotConversations?.on("widgetClosed", () => {
734
- X()?.classList.remove(z);
745
+ Ne()?.classList.remove(R);
735
746
  });
736
747
  }, [e]), {
737
748
  isAvailable: e,
738
749
  toggle: i(() => {
739
- let e = window.HubSpotConversations, t = X();
740
- 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()));
741
752
  }, [])
742
753
  };
743
- }, je = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: a, enabled: o = !0 }) => {
744
- 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) => {
745
756
  n || !o || await t({ pageParam: e?.pageParam || e.visibleRowsCount });
746
757
  }, [
747
758
  o,
748
759
  t,
749
760
  n
750
- ]), l = s(() => {
761
+ ]), l = c(() => {
751
762
  if (e) return e.pages.reduce((e, t) => [...e, ...t], []);
752
763
  }, [e]);
753
764
  return {
754
- fetchNextPageOnRowsScrollEnd: c,
765
+ fetchNextPageOnRowsScrollEnd: s,
755
766
  isLoading: n || a,
756
767
  loadingVariant: r ? "skeleton" : "linear-progress",
757
768
  rows: l
758
769
  };
759
- }, Me = (e) => {
760
- 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) => {
761
772
  if (e && typeof e == "object" && "response" in e) {
762
773
  let { response: t } = e || {};
763
774
  if (t && typeof t == "object" && "reason" in t && t.reason) return String(t.reason);
@@ -780,38 +791,38 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
780
791
  }, []),
781
792
  printError: l
782
793
  };
783
- }, Z = "chunk-reload-timestamp", Q = "chunk-reload", Ne = 1e4, $ = 2, Pe = !1;
784
- 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") {
785
796
  try {
786
797
  let e = new URL(window.location.href);
787
- e.searchParams.has(Q) && (Pe = !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()));
788
799
  } catch {}
789
800
  window.addEventListener("vite:preloadError", (e) => {
790
801
  e.preventDefault();
791
802
  });
792
803
  }
793
- var Fe = (e) => {
804
+ var ze = (e) => {
794
805
  if (!(e instanceof Error)) return !1;
795
806
  let t = e.message.toLowerCase();
796
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";
797
- }, Ie = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, Le = (e) => e.toString().match(Ie)?.[2] ?? null, Re = (e) => {
808
+ }, Be = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, Ve = (e) => e.toString().match(Be)?.[2] ?? null, He = (e) => {
798
809
  try {
799
810
  return sessionStorage.getItem(e);
800
811
  } catch {
801
812
  return null;
802
813
  }
803
- }, ze = (e, t) => {
814
+ }, Ue = (e, t) => {
804
815
  try {
805
816
  sessionStorage.setItem(e, t);
806
817
  } catch {}
807
- }, Be = (e) => Function("url", "return import(url)")(e), Ve = async (e) => {
808
- for (let t = 0; t < $; t++) try {
809
- return await Be(`${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()}`);
810
821
  } catch {
811
- t < $ - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
822
+ t < Z - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
812
823
  }
813
- throw Error(`Failed to import ${e} after ${$} retries`);
814
- }, He = async () => {
824
+ throw Error(`Failed to import ${e} after ${Z} retries`);
825
+ }, Ke = async () => {
815
826
  try {
816
827
  if (typeof navigator < "u" && "serviceWorker" in navigator) {
817
828
  let e = await navigator.serviceWorker.getRegistrations();
@@ -822,27 +833,27 @@ var Fe = (e) => {
822
833
  await Promise.all(e.map((e) => caches.delete(e)));
823
834
  }
824
835
  } catch {}
825
- }, Ue = async () => {
826
- await He();
836
+ }, qe = async () => {
837
+ await Ke();
827
838
  let e = new URL(window.location.href);
828
- e.searchParams.set(Q, String(Date.now())), window.location.replace(e.toString());
829
- }, We = (e) => e != null && e.default !== void 0, Ge = (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 () => {
830
841
  let t;
831
842
  try {
832
843
  let n = await e();
833
- if (We(n)) return n;
844
+ if ($(n)) return n;
834
845
  t = /* @__PURE__ */ Error("Module resolved without a valid default export");
835
846
  } catch (e) {
836
847
  t = e;
837
848
  }
838
- if (P || !Fe(t)) throw t;
839
- let n = Le(e);
849
+ if (I || !ze(t)) throw t;
850
+ let n = Ve(e);
840
851
  if (n) try {
841
- let e = await Ve(n);
842
- if (We(e)) return e;
852
+ let e = await Ge(n);
853
+ if ($(e)) return e;
843
854
  } catch {}
844
- let r = Number(Re(Z) || "0");
845
- return Date.now() - r < Ne || Pe || (ze(Z, String(Date.now())), await Ue()), { 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 };
846
857
  });
847
858
  //#endregion
848
- export { O as AMPLITUDE_FEATURE_SELECTOR, E as AutoReloadOnNewVersion, g as ChatClient, U as ChatContext, pe as ChatProvider, D 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, L as SUPPORTED_LANGUAGE, ce as ShowHubSpotBubble, W as dateAdapter, G as distanceAdapter, e as getOrvalConfig, Ge as lazyWithRetry, ye as useAdapter, be as useAmplitude, xe as useAuth, we as useChat, Te as useCurrentLanguage, ke as useFilters, Ae as useHubSpot, je as useInfiniteDataGrid, Me as useResponseError, K 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.47.2",
3
+ "version": "2.49.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "types": "./dist/main.d.ts",