@getsoren/shared-module 2.52.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.
- package/dist/components/Utils/InitializeSentryConfig.d.ts +7 -1
- package/dist/constants/sentry.d.ts +9 -0
- package/dist/hooks/useCurrentLanguage/useCurrentLanguage.d.ts +1 -1
- package/dist/main.d.ts +4 -0
- package/dist/main.js +204 -159
- package/dist/utils/getCurrentLanguage/getCurrentLanguage.d.ts +10 -0
- package/dist/utils/getCurrentLanguage/getCurrentLanguage.test.d.ts +1 -0
- package/dist/utils/pageDuration/pageDuration.d.ts +30 -0
- package/dist/utils/pageDuration/pageDuration.test.d.ts +1 -0
- package/dist/utils/token/token.d.ts +23 -0
- package/dist/utils/token/token.test.d.ts +1 -0
- package/package.json +1 -1
|
@@ -57,6 +57,11 @@ interface InitializeSentryConfigProps {
|
|
|
57
57
|
* By default, all errors will be sent.
|
|
58
58
|
*/
|
|
59
59
|
ignoreErrors?: Array<string | RegExp>;
|
|
60
|
+
/**
|
|
61
|
+
* Outgoing request URLs that should not get an `http.client` span (a string matches as a substring).
|
|
62
|
+
* Added to `SENTRY_IGNORED_REQUEST_URLS` (Mapbox), which is always ignored.
|
|
63
|
+
*/
|
|
64
|
+
ignoreRequestUrls?: Array<string | RegExp>;
|
|
60
65
|
/**
|
|
61
66
|
* The current environment of your application (e.g. "production").
|
|
62
67
|
*/
|
|
@@ -78,9 +83,10 @@ interface InitializeSentryConfigProps {
|
|
|
78
83
|
* @param replayBeforeErrorSampling
|
|
79
84
|
* @param tracePropagationTargets
|
|
80
85
|
* @param ignoreErrors
|
|
86
|
+
* @param ignoreRequestUrls
|
|
81
87
|
* @param debug
|
|
82
88
|
* @param environment
|
|
83
89
|
* @constructor
|
|
84
90
|
*/
|
|
85
|
-
declare const InitializeSentryConfig: ({ dsn, integrations, tracesSampleRate, tracePropagationTargets, ignoreErrors, debug, environment, release, replaysSessionSampleRate, replaysOnErrorSampleRate, replayBeforeErrorSampling, ...props }: InitializeSentryConfigProps) => null;
|
|
91
|
+
declare const InitializeSentryConfig: ({ dsn, integrations, tracesSampleRate, tracePropagationTargets, ignoreErrors, ignoreRequestUrls, debug, environment, release, replaysSessionSampleRate, replaysOnErrorSampleRate, replayBeforeErrorSampling, ...props }: InitializeSentryConfigProps) => null;
|
|
86
92
|
export default InitializeSentryConfig;
|
|
@@ -11,3 +11,12 @@ export declare const SENTRY_KEEP_REPLAY: {
|
|
|
11
11
|
* buffered replay, so a noisy error never burns the replay quota by itself.
|
|
12
12
|
*/
|
|
13
13
|
export declare const isReplayKeptForError: (event: ErrorEvent) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Outgoing requests that never get an `http.client` span. Mapbox GL fetches its glyph ranges and telemetry in
|
|
16
|
+
* parallel bursts that Sentry flags as "N+1 API Call", while we cannot batch them.
|
|
17
|
+
*/
|
|
18
|
+
export declare const SENTRY_IGNORED_REQUEST_URLS: Array<string | RegExp>;
|
|
19
|
+
/**
|
|
20
|
+
* Whether `url` matches one of `patterns`: a string matches as a substring, a RegExp is tested against the full URL.
|
|
21
|
+
*/
|
|
22
|
+
export declare const matchesRequestUrl: (url: string, patterns: Array<string | RegExp>) => boolean;
|
|
@@ -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",
|
|
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
|
-
},
|
|
138
|
+
}, E = (e, t) => {
|
|
139
139
|
try {
|
|
140
140
|
sessionStorage.setItem(e, t);
|
|
141
141
|
} catch {}
|
|
142
|
-
},
|
|
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(
|
|
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(
|
|
168
|
-
Date.now() - e < C || (
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
],
|
|
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,
|
|
202
|
+
cssSelectorAllowlist: [...t, k],
|
|
203
203
|
...n
|
|
204
204
|
};
|
|
205
|
-
},
|
|
205
|
+
}, M = (e, t) => !t || e === !1 ? !1 : {
|
|
206
206
|
deadClicks: !0,
|
|
207
207
|
rageClicks: !0,
|
|
208
208
|
...e === !0 ? {} : e
|
|
209
|
-
},
|
|
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 =
|
|
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:
|
|
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
|
-
},
|
|
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
|
-
})(),
|
|
264
|
-
let { apiURL: i = r.apiURL, libraries: o, localStorageKeys: s } = a(y), c = r?.userLocalStorageKey || s?.user ||
|
|
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 ||
|
|
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
|
-
},
|
|
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
|
-
],
|
|
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 =
|
|
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
|
-
},
|
|
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[${
|
|
298
|
-
html[${
|
|
299
|
-
`, document.head.appendChild(e), document.documentElement.setAttribute(
|
|
300
|
-
e.remove(), document.documentElement.removeAttribute(
|
|
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),
|
|
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 (
|
|
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,16 +319,16 @@ 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
|
-
},
|
|
323
|
-
let { libraries:
|
|
324
|
-
if (!
|
|
325
|
-
if (!
|
|
326
|
-
if (
|
|
327
|
-
let { createRoutesFromChildren:
|
|
328
|
-
return (
|
|
329
|
-
debug:
|
|
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
|
+
let { libraries: h } = a(y), g = m?.sentry || h?.sentry, _ = m?.reactRouter || h?.reactRouter;
|
|
324
|
+
if (!g) throw Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
325
|
+
if (!_) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
326
|
+
if (g.isInitialized()) return null;
|
|
327
|
+
let { createRoutesFromChildren: v, matchRoutes: b, useLocation: x, useNavigationType: S } = _, C = d > 0 || f > 0, w = [...s || [], ...B];
|
|
328
|
+
return (c || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && g.init({
|
|
329
|
+
debug: c,
|
|
330
330
|
dsn: e,
|
|
331
|
-
environment:
|
|
331
|
+
environment: l || "production",
|
|
332
332
|
ignoreErrors: [
|
|
333
333
|
...i || [],
|
|
334
334
|
/dynamically imported module/,
|
|
@@ -339,28 +339,29 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
339
339
|
/vite:preloadError/
|
|
340
340
|
],
|
|
341
341
|
integrations: [
|
|
342
|
-
|
|
343
|
-
createRoutesFromChildren:
|
|
344
|
-
matchRoutes:
|
|
342
|
+
g.reactRouterV6BrowserTracingIntegration({
|
|
343
|
+
createRoutesFromChildren: v,
|
|
344
|
+
matchRoutes: b,
|
|
345
|
+
shouldCreateSpanForRequest: (e) => !V(e, w),
|
|
345
346
|
useEffect: o,
|
|
346
|
-
useLocation:
|
|
347
|
-
useNavigationType:
|
|
347
|
+
useLocation: x,
|
|
348
|
+
useNavigationType: S
|
|
348
349
|
}),
|
|
349
|
-
...
|
|
350
|
+
...C ? [g.replayIntegration({ beforeErrorSampling: p })] : [],
|
|
350
351
|
...t || []
|
|
351
352
|
],
|
|
352
|
-
release:
|
|
353
|
-
replaysOnErrorSampleRate:
|
|
354
|
-
replaysSessionSampleRate:
|
|
353
|
+
release: u,
|
|
354
|
+
replaysOnErrorSampleRate: f,
|
|
355
|
+
replaysSessionSampleRate: d,
|
|
355
356
|
tracePropagationTargets: r,
|
|
356
357
|
tracesSampleRate: n ?? 1
|
|
357
358
|
}), null;
|
|
358
|
-
},
|
|
359
|
-
let { libraries: c, localStorageKeys: l } = a(y), f = s?.reactRouter || c?.reactRouter, p = s?.axios || c?.axios, m = s?.localStorageKey || l?.user ||
|
|
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;
|
|
360
361
|
if (!f) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
361
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;
|
|
362
363
|
return o(() => {
|
|
363
|
-
p && (
|
|
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)))));
|
|
364
365
|
}, [
|
|
365
366
|
p,
|
|
366
367
|
m,
|
|
@@ -376,34 +377,34 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
376
377
|
state: { from: x },
|
|
377
378
|
replace: !0
|
|
378
379
|
});
|
|
379
|
-
},
|
|
380
|
+
}, U = /* @__PURE__ */ new Set(), fe = () => (o(() => {
|
|
380
381
|
let e = Symbol();
|
|
381
|
-
return
|
|
382
|
-
|
|
382
|
+
return U.add(e), document.documentElement.removeAttribute(L), () => {
|
|
383
|
+
U.delete(e), U.size === 0 && document.documentElement.setAttribute(L, "");
|
|
383
384
|
};
|
|
384
|
-
}, []), null),
|
|
385
|
+
}, []), null), pe = "user", me = {
|
|
385
386
|
client: "/v2/threads/ws",
|
|
386
387
|
supplier: "/v1/threads/ws"
|
|
387
|
-
},
|
|
388
|
+
}, he = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, ge = (e) => {
|
|
388
389
|
try {
|
|
389
390
|
let t = localStorage.getItem(e);
|
|
390
391
|
return t ? JSON.parse(t)?.accessToken ?? null : null;
|
|
391
392
|
} catch {
|
|
392
393
|
return null;
|
|
393
394
|
}
|
|
394
|
-
},
|
|
395
|
-
let [g, v] = u(!1), [b, x] = u(!1), [S, C] = u(0), [w,
|
|
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());
|
|
396
397
|
o(() => {
|
|
397
|
-
if (!
|
|
398
|
-
let e = r ??
|
|
398
|
+
if (!T) return;
|
|
399
|
+
let e = r ?? me[h], i = n || (E ? he(E, e) : null);
|
|
399
400
|
if (!i) return;
|
|
400
|
-
let a = () => t ??
|
|
401
|
+
let a = () => t ?? ge(O), o = (e) => {
|
|
401
402
|
switch (e.type) {
|
|
402
403
|
case "ready":
|
|
403
404
|
x(!0), C(e.unreadCount ?? 0);
|
|
404
405
|
break;
|
|
405
406
|
}
|
|
406
|
-
for (let t of
|
|
407
|
+
for (let t of A.current) t(e);
|
|
407
408
|
}, l = setTimeout(() => {
|
|
408
409
|
let e = new _({
|
|
409
410
|
getToken: a,
|
|
@@ -417,80 +418,80 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
417
418
|
reconnectBaseDelay: c,
|
|
418
419
|
url: i
|
|
419
420
|
});
|
|
420
|
-
|
|
421
|
+
k.current = e, e.connect();
|
|
421
422
|
}, 0);
|
|
422
423
|
return () => {
|
|
423
|
-
clearTimeout(l),
|
|
424
|
+
clearTimeout(l), k.current?.disconnect(), k.current = null;
|
|
424
425
|
};
|
|
425
426
|
}, [
|
|
426
|
-
|
|
427
|
+
T,
|
|
427
428
|
n,
|
|
428
429
|
r,
|
|
429
430
|
h,
|
|
430
431
|
t,
|
|
431
432
|
p,
|
|
432
|
-
|
|
433
|
-
|
|
433
|
+
E,
|
|
434
|
+
O,
|
|
434
435
|
f,
|
|
435
436
|
s,
|
|
436
437
|
c
|
|
437
438
|
]);
|
|
438
|
-
let
|
|
439
|
-
|
|
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);
|
|
440
445
|
}, []), N = i((e) => {
|
|
441
|
-
|
|
446
|
+
k.current?.markRead(e);
|
|
442
447
|
}, []), P = i((e, t) => {
|
|
443
|
-
|
|
444
|
-
}, []),
|
|
445
|
-
A.current?.markRead(e);
|
|
446
|
-
}, []), I = i((e, t) => {
|
|
447
|
-
A.current?.listThreads(e, t);
|
|
448
|
-
}, []), L = i((e = 1) => {
|
|
448
|
+
k.current?.listThreads(e, t);
|
|
449
|
+
}, []), ne = i((e = 1) => {
|
|
449
450
|
C((t) => t + e);
|
|
450
|
-
}, []),
|
|
451
|
+
}, []), re = {
|
|
451
452
|
decrementUnreadCount: i((e = 1) => {
|
|
452
453
|
C((t) => Math.max(0, t - e));
|
|
453
454
|
}, []),
|
|
454
455
|
disconnect: i(() => {
|
|
455
|
-
|
|
456
|
+
k.current?.disconnect(), k.current = null;
|
|
456
457
|
}, []),
|
|
457
|
-
incrementUnreadCount:
|
|
458
|
+
incrementUnreadCount: ne,
|
|
458
459
|
isConnected: g,
|
|
459
460
|
isReady: b,
|
|
460
|
-
joinThread:
|
|
461
|
-
leaveThread:
|
|
462
|
-
listThreads:
|
|
463
|
-
markRead:
|
|
464
|
-
sendMessage:
|
|
461
|
+
joinThread: te,
|
|
462
|
+
leaveThread: j,
|
|
463
|
+
listThreads: P,
|
|
464
|
+
markRead: N,
|
|
465
|
+
sendMessage: M,
|
|
465
466
|
setEnabled: i((e) => {
|
|
466
|
-
|
|
467
|
+
ee(e);
|
|
467
468
|
}, []),
|
|
468
|
-
subscribe: i((e) => (
|
|
469
|
-
|
|
469
|
+
subscribe: i((e) => (A.current.add(e), () => {
|
|
470
|
+
A.current.delete(e);
|
|
470
471
|
}), []),
|
|
471
472
|
unreadCount: S
|
|
472
473
|
};
|
|
473
|
-
return /* @__PURE__ */ d(
|
|
474
|
-
value:
|
|
474
|
+
return /* @__PURE__ */ d(W.Provider, {
|
|
475
|
+
value: re,
|
|
475
476
|
children: e
|
|
476
477
|
});
|
|
477
|
-
},
|
|
478
|
+
}, ve = 3, ye = new Set([
|
|
478
479
|
400,
|
|
479
480
|
401,
|
|
480
481
|
403,
|
|
481
482
|
404
|
|
482
|
-
]),
|
|
483
|
-
let n =
|
|
484
|
-
return e <
|
|
485
|
-
},
|
|
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 }) => {
|
|
486
487
|
let { libraries: i } = a(y), o = r.QueryClient || i?.reactQuery?.QueryClient, s = r.QueryClientProvider || i?.reactQuery?.QueryClientProvider;
|
|
487
488
|
if (!o) throw Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
488
489
|
if (!s) throw Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
489
490
|
let [c] = u(() => new o({ defaultOptions: {
|
|
490
491
|
mutations: n,
|
|
491
492
|
queries: {
|
|
492
|
-
getNextPageParam:
|
|
493
|
-
retry:
|
|
493
|
+
getNextPageParam: xe,
|
|
494
|
+
retry: G,
|
|
494
495
|
...t
|
|
495
496
|
}
|
|
496
497
|
} }));
|
|
@@ -498,17 +499,17 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
498
499
|
client: c,
|
|
499
500
|
children: e
|
|
500
501
|
});
|
|
501
|
-
},
|
|
502
|
+
}, K = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), q = (e, t) => {
|
|
502
503
|
let { fractionDigits: n = 0, metric: r = "km", spacingBetween: i = !0 } = t || {}, a = Number(e), o = i ? " " : "";
|
|
503
504
|
return Number.isNaN(a) ? `0${o}${r}` : `${a.toFixed(n)}${o}${r}`;
|
|
504
|
-
},
|
|
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 }) => {
|
|
505
506
|
if (!e) return "";
|
|
506
|
-
let r = `${n}${
|
|
507
|
+
let r = `${n}${Ce(e)}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
507
508
|
return typeof t == "number" && i ? `${r.replace("/files", `/thumbs/${t}`)}` : r;
|
|
508
|
-
},
|
|
509
|
+
}, Te = (e) => {
|
|
509
510
|
let { apiURL: t, libraries: n } = a(y), r = e?.dayjs || n?.dayjs, o = i((e, n) => {
|
|
510
511
|
if (!t) throw Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");
|
|
511
|
-
return typeof e == "string" && /^https?:\/\//.test(e) ? e :
|
|
512
|
+
return typeof e == "string" && /^https?:\/\//.test(e) ? e : we({
|
|
512
513
|
apiURL: t,
|
|
513
514
|
path: e,
|
|
514
515
|
size: n
|
|
@@ -517,17 +518,17 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
517
518
|
return {
|
|
518
519
|
dateAdapter: i((e, t) => {
|
|
519
520
|
if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
520
|
-
return
|
|
521
|
+
return K({
|
|
521
522
|
date: e,
|
|
522
523
|
format: t,
|
|
523
524
|
library: r
|
|
524
525
|
});
|
|
525
526
|
}, [r]),
|
|
526
|
-
distanceAdapter:
|
|
527
|
+
distanceAdapter: q,
|
|
527
528
|
filePathAdapter: o,
|
|
528
|
-
worksiteNameAdapter:
|
|
529
|
+
worksiteNameAdapter: J
|
|
529
530
|
};
|
|
530
|
-
},
|
|
531
|
+
}, Ee = () => {
|
|
531
532
|
let { libraries: e } = a(y), t = e?.amplitude?.analytics, n = i((e, n) => {
|
|
532
533
|
if (!t || (t.setUserId(e), !n)) return;
|
|
533
534
|
let r = new t.Identify();
|
|
@@ -551,7 +552,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
551
552
|
setGroup: r,
|
|
552
553
|
track: o
|
|
553
554
|
};
|
|
554
|
-
},
|
|
555
|
+
}, De = (e) => {
|
|
555
556
|
let { libraries: t, localStorageKeys: n } = a(y), r = e?.axios || t?.axios, s = e?.localStorageKey || n?.user || "user";
|
|
556
557
|
if (!r) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
557
558
|
let c = i(({ tokenType: e, accessToken: t }) => {
|
|
@@ -560,7 +561,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
560
561
|
r.defaults.headers.common.Authorization = null;
|
|
561
562
|
}, [r.defaults.headers.common]);
|
|
562
563
|
return o(() => {
|
|
563
|
-
if (
|
|
564
|
+
if (P) return;
|
|
564
565
|
let e = ({ newValue: e, key: t }) => {
|
|
565
566
|
if (t === s) try {
|
|
566
567
|
let { accessToken: t, tokenType: n } = JSON.parse(e ?? "null") ?? {};
|
|
@@ -587,9 +588,9 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
587
588
|
clearAuthenticationToken: l,
|
|
588
589
|
setAuthenticationToken: c
|
|
589
590
|
};
|
|
590
|
-
},
|
|
591
|
+
}, Oe = "New message", ke = (e, t) => {
|
|
591
592
|
if (!("Notification" in window) || typeof Notification != "function" || Notification.permission !== "granted" || !document.hidden) return;
|
|
592
|
-
let n = new Notification(t.title ??
|
|
593
|
+
let n = new Notification(t.title ?? Oe, {
|
|
593
594
|
badge: t?.badge,
|
|
594
595
|
body: t?.body || e.bodyPreview,
|
|
595
596
|
data: t?.data,
|
|
@@ -604,8 +605,8 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
604
605
|
let { onClick: r } = t;
|
|
605
606
|
n.onclick = () => r(e);
|
|
606
607
|
}
|
|
607
|
-
},
|
|
608
|
-
let t = a(
|
|
608
|
+
}, Ae = (e) => {
|
|
609
|
+
let t = a(W);
|
|
609
610
|
if (!t) throw Error("useChat must be used within ChatProvider");
|
|
610
611
|
let { subscribe: n, setEnabled: r, ...i } = t, s = l(e);
|
|
611
612
|
return s.current = e, o(() => {
|
|
@@ -622,7 +623,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
622
623
|
r?.(e);
|
|
623
624
|
break;
|
|
624
625
|
case "new_message_notification":
|
|
625
|
-
i?.(e), t && t.enabled !== !1 &&
|
|
626
|
+
i?.(e), t && t.enabled !== !1 && ke(e, t);
|
|
626
627
|
break;
|
|
627
628
|
case "presence":
|
|
628
629
|
a?.(e);
|
|
@@ -647,44 +648,44 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
647
648
|
break;
|
|
648
649
|
}
|
|
649
650
|
}), [n]), i;
|
|
650
|
-
},
|
|
651
|
-
let
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
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));
|
|
655
656
|
return o(() => {
|
|
656
|
-
e && "isInitialized" in e && e.isInitialized && e.language && r(
|
|
657
|
+
e && "isInitialized" in e && e.isInitialized && e.language && r(Y(e.language, t));
|
|
657
658
|
let n = (e) => {
|
|
658
|
-
r(
|
|
659
|
+
r(Y(e, t));
|
|
659
660
|
};
|
|
660
661
|
return e?.on?.("languageChanged", n), () => {
|
|
661
662
|
e?.off?.("languageChanged", n);
|
|
662
663
|
};
|
|
663
664
|
}, [e, t]), n;
|
|
664
|
-
},
|
|
665
|
+
}, Me = "tracktor.filter", Ne = {
|
|
665
666
|
getFilter: () => void 0,
|
|
666
667
|
getFilters: () => ({}),
|
|
667
668
|
handleFilter: () => () => {},
|
|
668
669
|
setFilter: () => {}
|
|
669
|
-
},
|
|
670
|
+
}, Pe = (e) => {
|
|
670
671
|
try {
|
|
671
672
|
return JSON.parse(e);
|
|
672
673
|
} catch {
|
|
673
674
|
return e;
|
|
674
675
|
}
|
|
675
|
-
},
|
|
676
|
+
}, Fe = (e, t, n) => `${n}_${e}=>${t}`, Ie = (e) => e.reduce((e, t) => {
|
|
676
677
|
let n = localStorage.getItem(t);
|
|
677
678
|
if (n) try {
|
|
678
679
|
let t = JSON.parse(n), r = Object.keys(t)?.[0];
|
|
679
680
|
r && (e[r] = Object.values(t)?.[0]);
|
|
680
681
|
} catch {}
|
|
681
682
|
return e;
|
|
682
|
-
}, {}),
|
|
683
|
-
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 ||
|
|
684
|
-
if (
|
|
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;
|
|
685
686
|
if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");
|
|
686
687
|
let m = () => Object.keys(localStorage).filter((t) => t.startsWith(d) && t.endsWith(e?.pathname || i)), h = (t, n, r = !0) => {
|
|
687
|
-
let a =
|
|
688
|
+
let a = Fe(t, e?.pathname || i, d);
|
|
688
689
|
if (!n || Array.isArray(n) && !n.length) {
|
|
689
690
|
f ? (o.delete(t), s(o)) : l((e) => {
|
|
690
691
|
let n = { ...e };
|
|
@@ -704,13 +705,13 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
704
705
|
getFilter: (t, n) => {
|
|
705
706
|
if (f) {
|
|
706
707
|
let e = o.get(t);
|
|
707
|
-
if (e) return
|
|
708
|
+
if (e) return Pe(e);
|
|
708
709
|
} else {
|
|
709
710
|
let e = c[t];
|
|
710
711
|
if (e !== void 0) return e;
|
|
711
712
|
}
|
|
712
713
|
if (p) {
|
|
713
|
-
let n =
|
|
714
|
+
let n = Fe(t, e?.pathname || i, d), r = localStorage.getItem(n);
|
|
714
715
|
if (r) try {
|
|
715
716
|
let e = JSON.parse(r)[t];
|
|
716
717
|
return !f && e !== void 0 && l((n) => ({
|
|
@@ -722,9 +723,9 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
722
723
|
return n;
|
|
723
724
|
},
|
|
724
725
|
getFilters: () => {
|
|
725
|
-
let e = p ?
|
|
726
|
+
let e = p ? Ie(m()) : {};
|
|
726
727
|
if (f) {
|
|
727
|
-
let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] =
|
|
728
|
+
let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] = Pe(n), e), {});
|
|
728
729
|
return {
|
|
729
730
|
...e,
|
|
730
731
|
...t
|
|
@@ -745,7 +746,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
745
746
|
},
|
|
746
747
|
setFilter: h
|
|
747
748
|
};
|
|
748
|
-
},
|
|
749
|
+
}, Re = () => document.getElementById(F), ze = () => {
|
|
749
750
|
let [e, t] = u(() => !!window.HubSpotConversations);
|
|
750
751
|
return o(() => {
|
|
751
752
|
if (window.HubSpotConversations) {
|
|
@@ -755,16 +756,16 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
755
756
|
window.hsConversationsOnReady = [() => t(!0)];
|
|
756
757
|
}, []), o(() => {
|
|
757
758
|
e && window.HubSpotConversations?.on("widgetClosed", () => {
|
|
758
|
-
|
|
759
|
+
Re()?.classList.remove(I);
|
|
759
760
|
});
|
|
760
761
|
}, [e]), {
|
|
761
762
|
isAvailable: e,
|
|
762
763
|
toggle: i(() => {
|
|
763
|
-
let e = window.HubSpotConversations, t =
|
|
764
|
-
e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(
|
|
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()));
|
|
765
766
|
}, [])
|
|
766
767
|
};
|
|
767
|
-
},
|
|
768
|
+
}, Be = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: a, enabled: o = !0 }) => {
|
|
768
769
|
let s = i(async (e) => {
|
|
769
770
|
n || !o || await t({ pageParam: e?.pageParam || e.visibleRowsCount });
|
|
770
771
|
}, [
|
|
@@ -780,7 +781,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
780
781
|
loadingVariant: r ? "skeleton" : "linear-progress",
|
|
781
782
|
rows: l
|
|
782
783
|
};
|
|
783
|
-
},
|
|
784
|
+
}, Ve = (e) => {
|
|
784
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) => {
|
|
785
786
|
if (e && typeof e == "object" && "response" in e) {
|
|
786
787
|
let { response: t } = e || {};
|
|
@@ -804,38 +805,38 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
804
805
|
}, []),
|
|
805
806
|
printError: l
|
|
806
807
|
};
|
|
807
|
-
},
|
|
808
|
-
if (!
|
|
808
|
+
}, He = "chunk-reload-timestamp", X = "chunk-reload", Ue = 1e4, Z = 2, Q = !1;
|
|
809
|
+
if (!P && typeof window < "u") {
|
|
809
810
|
try {
|
|
810
811
|
let e = new URL(window.location.href);
|
|
811
|
-
e.searchParams.has(
|
|
812
|
+
e.searchParams.has(X) && (Q = !0, e.searchParams.delete(X), window.history.replaceState(null, "", e.toString()));
|
|
812
813
|
} catch {}
|
|
813
814
|
window.addEventListener("vite:preloadError", (e) => {
|
|
814
815
|
e.preventDefault();
|
|
815
816
|
});
|
|
816
817
|
}
|
|
817
|
-
var
|
|
818
|
+
var We = (e) => {
|
|
818
819
|
if (!(e instanceof Error)) return !1;
|
|
819
820
|
let t = e.message.toLowerCase();
|
|
820
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";
|
|
821
|
-
},
|
|
822
|
+
}, Ge = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, Ke = (e) => e.toString().match(Ge)?.[2] ?? null, qe = (e) => {
|
|
822
823
|
try {
|
|
823
824
|
return sessionStorage.getItem(e);
|
|
824
825
|
} catch {
|
|
825
826
|
return null;
|
|
826
827
|
}
|
|
827
|
-
},
|
|
828
|
+
}, Je = (e, t) => {
|
|
828
829
|
try {
|
|
829
830
|
sessionStorage.setItem(e, t);
|
|
830
831
|
} catch {}
|
|
831
|
-
},
|
|
832
|
-
for (let t = 0; t <
|
|
833
|
-
return await
|
|
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()}`);
|
|
834
835
|
} catch {
|
|
835
|
-
t <
|
|
836
|
+
t < Z - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
|
|
836
837
|
}
|
|
837
|
-
throw Error(`Failed to import ${e} after ${
|
|
838
|
-
},
|
|
838
|
+
throw Error(`Failed to import ${e} after ${Z} retries`);
|
|
839
|
+
}, Ze = async () => {
|
|
839
840
|
try {
|
|
840
841
|
if (typeof navigator < "u" && "serviceWorker" in navigator) {
|
|
841
842
|
let e = await navigator.serviceWorker.getRegistrations();
|
|
@@ -846,27 +847,71 @@ var Ve = (e) => {
|
|
|
846
847
|
await Promise.all(e.map((e) => caches.delete(e)));
|
|
847
848
|
}
|
|
848
849
|
} catch {}
|
|
849
|
-
},
|
|
850
|
-
await
|
|
850
|
+
}, Qe = async () => {
|
|
851
|
+
await Ze();
|
|
851
852
|
let e = new URL(window.location.href);
|
|
852
|
-
e.searchParams.set(
|
|
853
|
-
},
|
|
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 () => {
|
|
854
855
|
let t;
|
|
855
856
|
try {
|
|
856
857
|
let n = await e();
|
|
857
|
-
if (
|
|
858
|
+
if ($e(n)) return n;
|
|
858
859
|
t = /* @__PURE__ */ Error("Module resolved without a valid default export");
|
|
859
860
|
} catch (e) {
|
|
860
861
|
t = e;
|
|
861
862
|
}
|
|
862
|
-
if (
|
|
863
|
-
let n =
|
|
863
|
+
if (P || !We(t)) throw t;
|
|
864
|
+
let n = Ke(e);
|
|
864
865
|
if (n) try {
|
|
865
|
-
let e = await
|
|
866
|
-
if (
|
|
866
|
+
let e = await Xe(n);
|
|
867
|
+
if ($e(e)) return e;
|
|
867
868
|
} catch {}
|
|
868
|
-
let r = Number(
|
|
869
|
-
return Date.now() - r <
|
|
870
|
-
})
|
|
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
|
+
};
|
|
871
916
|
//#endregion
|
|
872
|
-
export {
|
|
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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 {};
|