@getsoren/shared-module 2.50.0 → 2.51.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/context/QueryProvider.d.ts +27 -0
- package/dist/main.d.ts +2 -1
- package/dist/main.js +93 -88
- package/dist/utils/shouldRetryQuery/shouldRetryQuery.d.ts +8 -0
- package/dist/utils/shouldRetryQuery/shouldRetryQuery.test.d.ts +1 -0
- package/package.json +1 -1
- package/dist/context/QueryClientProviderWithConfig.d.ts +0 -26
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DefaultOptions } from '@tanstack/react-query';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { InjectDependenciesContextProps } from './InjectDependenciesProvider';
|
|
4
|
+
type ReactQueryLibraries = NonNullable<NonNullable<InjectDependenciesContextProps["libraries"]>["reactQuery"]>;
|
|
5
|
+
interface QueryProviderProps extends PropsWithChildren {
|
|
6
|
+
/**
|
|
7
|
+
* QueryClientProvider from react-query, when not injected through InjectDependenciesProvider
|
|
8
|
+
*/
|
|
9
|
+
QueryClientProvider?: ReactQueryLibraries["QueryClientProvider"];
|
|
10
|
+
/**
|
|
11
|
+
* QueryClient from react-query, when not injected through InjectDependenciesProvider
|
|
12
|
+
*/
|
|
13
|
+
QueryClient?: ReactQueryLibraries["QueryClient"];
|
|
14
|
+
/**
|
|
15
|
+
* Default options for queries, merged over the provider's own:
|
|
16
|
+
* - `getNextPageParam` pages by offset: every page is an array, and the next offset is the count of what was
|
|
17
|
+
* loaded so far. A query paged another way (cursor, wrapped object) must set its own
|
|
18
|
+
* - `retry` gives up on an answer the API would give again (400, 401, 403, 404), see `shouldRetryQuery`
|
|
19
|
+
*/
|
|
20
|
+
defaultQueriesOptions?: DefaultOptions["queries"];
|
|
21
|
+
/**
|
|
22
|
+
* Default options for mutations
|
|
23
|
+
*/
|
|
24
|
+
defaultMutationsOptions?: DefaultOptions["mutations"];
|
|
25
|
+
}
|
|
26
|
+
declare const QueryProvider: ({ children, defaultQueriesOptions, defaultMutationsOptions, ...props }: QueryProviderProps) => import("react").JSX.Element;
|
|
27
|
+
export default QueryProvider;
|
package/dist/main.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export * from './context/ChatProvider';
|
|
|
27
27
|
export { default as ChatProvider } from './context/ChatProvider';
|
|
28
28
|
export * from './context/InjectDependenciesProvider';
|
|
29
29
|
export { default as InjectDependenciesProvider } from './context/InjectDependenciesProvider';
|
|
30
|
-
export { default as QueryProvider } from './context/
|
|
30
|
+
export { default as QueryProvider } from './context/QueryProvider';
|
|
31
31
|
export * from './hooks/useAdapter';
|
|
32
32
|
export { default as useAdapter } from './hooks/useAdapter';
|
|
33
33
|
export * from './hooks/useAmplitude';
|
|
@@ -51,3 +51,4 @@ 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
53
|
export { default as lazyWithRetry } from './utils/lazyWithRetry';
|
|
54
|
+
export { default as shouldRetryQuery } from './utils/shouldRetryQuery/shouldRetryQuery';
|
package/dist/main.js
CHANGED
|
@@ -260,8 +260,8 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
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
|
+
})(), L = "user", R = ({ 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 || L, 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
266
|
if (!l?.defaults || I) return null;
|
|
267
267
|
if (typeof window < "u" && window.localStorage) {
|
|
@@ -269,7 +269,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
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
|
+
}, z = [
|
|
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
|
+
], ee = (e) => z.includes(e), te = ({ 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 = ee(o) ? o : "en";
|
|
287
287
|
return r.locale() !== s && r.locale(s), null;
|
|
288
|
-
},
|
|
288
|
+
}, B = "hubspot-messages-iframe-container", V = "hs-show", H = "data-hs-hidden", ne = ({ 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,12 +294,12 @@ 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[${H}] div#${B} { display: none !important; }
|
|
298
|
+
html[${H}] div#${B}.${V} { display: initial !important; }
|
|
299
|
+
`, document.head.appendChild(e), document.documentElement.setAttribute(H, ""), () => {
|
|
300
|
+
e.remove(), document.documentElement.removeAttribute(H);
|
|
301
301
|
};
|
|
302
|
-
}, []), null),
|
|
302
|
+
}, []), null), re = ({ 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
304
|
if (I) 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.");
|
|
@@ -319,7 +319,7 @@ 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
|
-
},
|
|
322
|
+
}, U = { replay: "keep" }, W = (e) => e.tags?.replay === U.replay, ie = ({ dsn: e, integrations: t, tracesSampleRate: n, tracePropagationTargets: r, ignoreErrors: i, debug: s, environment: c, release: l, replaysSessionSampleRate: u = 0, replaysOnErrorSampleRate: d = 1, replayBeforeErrorSampling: f = W, ...p }) => {
|
|
323
323
|
let { libraries: m } = a(y), h = p?.sentry || m?.sentry, g = p?.reactRouter || m?.reactRouter;
|
|
324
324
|
if (!h) throw Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
325
325
|
if (!g) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
@@ -355,12 +355,12 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
355
355
|
tracePropagationTargets: r,
|
|
356
356
|
tracesSampleRate: n ?? 1
|
|
357
357
|
}), 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 ||
|
|
358
|
+
}, G = /* @__PURE__ */ new WeakMap(), ae = "user", oe = ({ 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 || ae;
|
|
360
360
|
if (!f) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
361
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;
|
|
362
362
|
return o(() => {
|
|
363
|
-
p && (
|
|
363
|
+
p && (G.has(p) || (G.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
364
|
}, [
|
|
365
365
|
p,
|
|
366
366
|
m,
|
|
@@ -376,28 +376,28 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
376
376
|
state: { from: x },
|
|
377
377
|
replace: !0
|
|
378
378
|
});
|
|
379
|
-
},
|
|
379
|
+
}, K = /* @__PURE__ */ new Set(), se = () => (o(() => {
|
|
380
380
|
let e = Symbol();
|
|
381
|
-
return
|
|
382
|
-
|
|
381
|
+
return K.add(e), document.documentElement.removeAttribute(H), () => {
|
|
382
|
+
K.delete(e), K.size === 0 && document.documentElement.setAttribute(H, "");
|
|
383
383
|
};
|
|
384
|
-
}, []), null),
|
|
384
|
+
}, []), null), ce = "user", le = {
|
|
385
385
|
client: "/v2/threads/ws",
|
|
386
386
|
supplier: "/v1/threads/ws"
|
|
387
|
-
},
|
|
387
|
+
}, ue = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, de = (e) => {
|
|
388
388
|
try {
|
|
389
389
|
let t = localStorage.getItem(e);
|
|
390
390
|
return t ? JSON.parse(t)?.accessToken ?? null : null;
|
|
391
391
|
} catch {
|
|
392
392
|
return null;
|
|
393
393
|
}
|
|
394
|
-
},
|
|
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 ||
|
|
394
|
+
}, q = n(null), fe = ({ 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 || ce, A = l(null), j = l(/* @__PURE__ */ new Set());
|
|
396
396
|
o(() => {
|
|
397
397
|
if (!E) return;
|
|
398
|
-
let e = r ??
|
|
398
|
+
let e = r ?? le[h], i = n || (D ? ue(D, e) : null);
|
|
399
399
|
if (!i) return;
|
|
400
|
-
let a = () => t ??
|
|
400
|
+
let a = () => t ?? de(k), o = (e) => {
|
|
401
401
|
switch (e.type) {
|
|
402
402
|
case "ready":
|
|
403
403
|
x(!0), C(e.unreadCount ?? 0);
|
|
@@ -445,16 +445,16 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
445
445
|
A.current?.markRead(e);
|
|
446
446
|
}, []), I = i((e, t) => {
|
|
447
447
|
A.current?.listThreads(e, t);
|
|
448
|
-
}, []),
|
|
448
|
+
}, []), L = i((e = 1) => {
|
|
449
449
|
C((t) => t + e);
|
|
450
|
-
}, []),
|
|
450
|
+
}, []), R = {
|
|
451
451
|
decrementUnreadCount: i((e = 1) => {
|
|
452
452
|
C((t) => Math.max(0, t - e));
|
|
453
453
|
}, []),
|
|
454
454
|
disconnect: i(() => {
|
|
455
455
|
A.current?.disconnect(), A.current = null;
|
|
456
456
|
}, []),
|
|
457
|
-
incrementUnreadCount:
|
|
457
|
+
incrementUnreadCount: L,
|
|
458
458
|
isConnected: g,
|
|
459
459
|
isReady: b,
|
|
460
460
|
joinThread: M,
|
|
@@ -470,33 +470,38 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
470
470
|
}), []),
|
|
471
471
|
unreadCount: S
|
|
472
472
|
};
|
|
473
|
-
return /* @__PURE__ */ d(
|
|
474
|
-
value:
|
|
473
|
+
return /* @__PURE__ */ d(q.Provider, {
|
|
474
|
+
value: R,
|
|
475
475
|
children: e
|
|
476
476
|
});
|
|
477
|
-
},
|
|
478
|
-
|
|
477
|
+
}, pe = 3, me = new Set([
|
|
478
|
+
400,
|
|
479
|
+
401,
|
|
480
|
+
403,
|
|
481
|
+
404
|
|
482
|
+
]), he = (e) => e?.response?.status, J = (e, t) => {
|
|
483
|
+
let n = he(t);
|
|
484
|
+
return e < pe && !(n !== void 0 && me.has(n));
|
|
485
|
+
}, ge = (e, t, n) => (Array.isArray(e) ? e.length : 0) + (typeof n == "number" ? n : 0), _e = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...r }) => {
|
|
486
|
+
let { libraries: i } = a(y), o = r.QueryClient || i?.reactQuery?.QueryClient, s = r.QueryClientProvider || i?.reactQuery?.QueryClientProvider;
|
|
479
487
|
if (!o) throw Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
480
488
|
if (!s) throw Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
let c = l(null);
|
|
484
|
-
return c.current ||= new o({ defaultOptions: {
|
|
485
|
-
mutations: { ...n },
|
|
489
|
+
let [c] = u(() => new o({ defaultOptions: {
|
|
490
|
+
mutations: n,
|
|
486
491
|
queries: {
|
|
487
|
-
getNextPageParam:
|
|
488
|
-
|
|
489
|
-
retry: 3,
|
|
492
|
+
getNextPageParam: ge,
|
|
493
|
+
retry: J,
|
|
490
494
|
...t
|
|
491
495
|
}
|
|
492
|
-
} })
|
|
493
|
-
|
|
496
|
+
} }));
|
|
497
|
+
return /* @__PURE__ */ d(s, {
|
|
498
|
+
client: c,
|
|
494
499
|
children: e
|
|
495
500
|
});
|
|
496
|
-
},
|
|
501
|
+
}, Y = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), X = (e, t) => {
|
|
497
502
|
let { fractionDigits: n = 0, metric: r = "km", spacingBetween: i = !0 } = t || {}, a = Number(e), o = i ? " " : "";
|
|
498
503
|
return Number.isNaN(a) ? `0${o}${r}` : `${a.toFixed(n)}${o}${r}`;
|
|
499
|
-
},
|
|
504
|
+
}, ve = (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 }) => {
|
|
500
505
|
if (!e) return "";
|
|
501
506
|
let r = `${n}${ye(e)}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
502
507
|
return typeof t == "number" && i ? `${r.replace("/files", `/thumbs/${t}`)}` : r;
|
|
@@ -512,15 +517,15 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
512
517
|
return {
|
|
513
518
|
dateAdapter: i((e, t) => {
|
|
514
519
|
if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
515
|
-
return
|
|
520
|
+
return Y({
|
|
516
521
|
date: e,
|
|
517
522
|
format: t,
|
|
518
523
|
library: r
|
|
519
524
|
});
|
|
520
525
|
}, [r]),
|
|
521
|
-
distanceAdapter:
|
|
526
|
+
distanceAdapter: X,
|
|
522
527
|
filePathAdapter: o,
|
|
523
|
-
worksiteNameAdapter:
|
|
528
|
+
worksiteNameAdapter: ve
|
|
524
529
|
};
|
|
525
530
|
}, Se = () => {
|
|
526
531
|
let { libraries: e } = a(y), t = e?.amplitude?.analytics, n = i((e, n) => {
|
|
@@ -592,7 +597,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
592
597
|
n.onclick = () => r(e);
|
|
593
598
|
}
|
|
594
599
|
}, Ee = (e) => {
|
|
595
|
-
let t = a(
|
|
600
|
+
let t = a(q);
|
|
596
601
|
if (!t) throw Error("useChat must be used within ChatProvider");
|
|
597
602
|
let { subscribe: n, setEnabled: r, ...i } = t, s = l(e);
|
|
598
603
|
return s.current = e, o(() => {
|
|
@@ -634,15 +639,15 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
634
639
|
break;
|
|
635
640
|
}
|
|
636
641
|
}), [n]), i;
|
|
637
|
-
},
|
|
642
|
+
}, Z = (e, t) => t === "short" ? e.split("-")[0] : e, De = (e, t = "full") => {
|
|
638
643
|
let [n, r] = u(() => {
|
|
639
644
|
let n = e?.language || navigator.language;
|
|
640
|
-
return e && "isInitialized" in e && e.isInitialized,
|
|
645
|
+
return e && "isInitialized" in e && e.isInitialized, Z(n, t);
|
|
641
646
|
});
|
|
642
647
|
return o(() => {
|
|
643
|
-
e && "isInitialized" in e && e.isInitialized && e.language && r(
|
|
648
|
+
e && "isInitialized" in e && e.isInitialized && e.language && r(Z(e.language, t));
|
|
644
649
|
let n = (e) => {
|
|
645
|
-
r(
|
|
650
|
+
r(Z(e, t));
|
|
646
651
|
};
|
|
647
652
|
return e?.on?.("languageChanged", n), () => {
|
|
648
653
|
e?.off?.("languageChanged", n);
|
|
@@ -653,25 +658,25 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
653
658
|
getFilters: () => ({}),
|
|
654
659
|
handleFilter: () => () => {},
|
|
655
660
|
setFilter: () => {}
|
|
656
|
-
},
|
|
661
|
+
}, Ae = (e) => {
|
|
657
662
|
try {
|
|
658
663
|
return JSON.parse(e);
|
|
659
664
|
} catch {
|
|
660
665
|
return e;
|
|
661
666
|
}
|
|
662
|
-
},
|
|
667
|
+
}, je = (e, t, n) => `${n}_${e}=>${t}`, Me = (e) => e.reduce((e, t) => {
|
|
663
668
|
let n = localStorage.getItem(t);
|
|
664
669
|
if (n) try {
|
|
665
670
|
let t = JSON.parse(n), r = Object.keys(t)?.[0];
|
|
666
671
|
r && (e[r] = Object.values(t)?.[0]);
|
|
667
672
|
} catch {}
|
|
668
673
|
return e;
|
|
669
|
-
}, {}),
|
|
674
|
+
}, {}), Ne = (e) => {
|
|
670
675
|
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
676
|
if (I) return ke;
|
|
672
677
|
if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");
|
|
673
678
|
let m = () => Object.keys(localStorage).filter((t) => t.startsWith(d) && t.endsWith(e?.pathname || i)), h = (t, n, r = !0) => {
|
|
674
|
-
let a =
|
|
679
|
+
let a = je(t, e?.pathname || i, d);
|
|
675
680
|
if (!n || Array.isArray(n) && !n.length) {
|
|
676
681
|
f ? (o.delete(t), s(o)) : l((e) => {
|
|
677
682
|
let n = { ...e };
|
|
@@ -691,13 +696,13 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
691
696
|
getFilter: (t, n) => {
|
|
692
697
|
if (f) {
|
|
693
698
|
let e = o.get(t);
|
|
694
|
-
if (e) return
|
|
699
|
+
if (e) return Ae(e);
|
|
695
700
|
} else {
|
|
696
701
|
let e = c[t];
|
|
697
702
|
if (e !== void 0) return e;
|
|
698
703
|
}
|
|
699
704
|
if (p) {
|
|
700
|
-
let n =
|
|
705
|
+
let n = je(t, e?.pathname || i, d), r = localStorage.getItem(n);
|
|
701
706
|
if (r) try {
|
|
702
707
|
let e = JSON.parse(r)[t];
|
|
703
708
|
return !f && e !== void 0 && l((n) => ({
|
|
@@ -709,9 +714,9 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
709
714
|
return n;
|
|
710
715
|
},
|
|
711
716
|
getFilters: () => {
|
|
712
|
-
let e = p ?
|
|
717
|
+
let e = p ? Me(m()) : {};
|
|
713
718
|
if (f) {
|
|
714
|
-
let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] =
|
|
719
|
+
let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] = Ae(n), e), {});
|
|
715
720
|
return {
|
|
716
721
|
...e,
|
|
717
722
|
...t
|
|
@@ -732,7 +737,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
732
737
|
},
|
|
733
738
|
setFilter: h
|
|
734
739
|
};
|
|
735
|
-
},
|
|
740
|
+
}, Pe = () => document.getElementById(B), Fe = () => {
|
|
736
741
|
let [e, t] = u(() => !!window.HubSpotConversations);
|
|
737
742
|
return o(() => {
|
|
738
743
|
if (window.HubSpotConversations) {
|
|
@@ -742,16 +747,16 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
742
747
|
window.hsConversationsOnReady = [() => t(!0)];
|
|
743
748
|
}, []), o(() => {
|
|
744
749
|
e && window.HubSpotConversations?.on("widgetClosed", () => {
|
|
745
|
-
|
|
750
|
+
Pe()?.classList.remove(V);
|
|
746
751
|
});
|
|
747
752
|
}, [e]), {
|
|
748
753
|
isAvailable: e,
|
|
749
754
|
toggle: i(() => {
|
|
750
|
-
let e = window.HubSpotConversations, t =
|
|
751
|
-
e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(
|
|
755
|
+
let e = window.HubSpotConversations, t = Pe();
|
|
756
|
+
e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(V)) : (t.classList.add(V), e.widget.open()));
|
|
752
757
|
}, [])
|
|
753
758
|
};
|
|
754
|
-
},
|
|
759
|
+
}, Ie = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: a, enabled: o = !0 }) => {
|
|
755
760
|
let s = i(async (e) => {
|
|
756
761
|
n || !o || await t({ pageParam: e?.pageParam || e.visibleRowsCount });
|
|
757
762
|
}, [
|
|
@@ -767,7 +772,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
767
772
|
loadingVariant: r ? "skeleton" : "linear-progress",
|
|
768
773
|
rows: l
|
|
769
774
|
};
|
|
770
|
-
},
|
|
775
|
+
}, Le = (e) => {
|
|
771
776
|
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) => {
|
|
772
777
|
if (e && typeof e == "object" && "response" in e) {
|
|
773
778
|
let { response: t } = e || {};
|
|
@@ -791,38 +796,38 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
791
796
|
}, []),
|
|
792
797
|
printError: l
|
|
793
798
|
};
|
|
794
|
-
},
|
|
799
|
+
}, Re = "chunk-reload-timestamp", Q = "chunk-reload", ze = 1e4, $ = 2, Be = !1;
|
|
795
800
|
if (!I && typeof window < "u") {
|
|
796
801
|
try {
|
|
797
802
|
let e = new URL(window.location.href);
|
|
798
|
-
e.searchParams.has(
|
|
803
|
+
e.searchParams.has(Q) && (Be = !0, e.searchParams.delete(Q), window.history.replaceState(null, "", e.toString()));
|
|
799
804
|
} catch {}
|
|
800
805
|
window.addEventListener("vite:preloadError", (e) => {
|
|
801
806
|
e.preventDefault();
|
|
802
807
|
});
|
|
803
808
|
}
|
|
804
|
-
var
|
|
809
|
+
var Ve = (e) => {
|
|
805
810
|
if (!(e instanceof Error)) return !1;
|
|
806
811
|
let t = e.message.toLowerCase();
|
|
807
812
|
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";
|
|
808
|
-
},
|
|
813
|
+
}, He = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, Ue = (e) => e.toString().match(He)?.[2] ?? null, We = (e) => {
|
|
809
814
|
try {
|
|
810
815
|
return sessionStorage.getItem(e);
|
|
811
816
|
} catch {
|
|
812
817
|
return null;
|
|
813
818
|
}
|
|
814
|
-
},
|
|
819
|
+
}, Ge = (e, t) => {
|
|
815
820
|
try {
|
|
816
821
|
sessionStorage.setItem(e, t);
|
|
817
822
|
} catch {}
|
|
818
|
-
},
|
|
819
|
-
for (let t = 0; t <
|
|
820
|
-
return await
|
|
823
|
+
}, Ke = (e) => Function("url", "return import(url)")(e), qe = async (e) => {
|
|
824
|
+
for (let t = 0; t < $; t++) try {
|
|
825
|
+
return await Ke(`${e}?t=${Date.now()}`);
|
|
821
826
|
} catch {
|
|
822
|
-
t <
|
|
827
|
+
t < $ - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
|
|
823
828
|
}
|
|
824
|
-
throw Error(`Failed to import ${e} after ${
|
|
825
|
-
},
|
|
829
|
+
throw Error(`Failed to import ${e} after ${$} retries`);
|
|
830
|
+
}, Je = async () => {
|
|
826
831
|
try {
|
|
827
832
|
if (typeof navigator < "u" && "serviceWorker" in navigator) {
|
|
828
833
|
let e = await navigator.serviceWorker.getRegistrations();
|
|
@@ -833,27 +838,27 @@ var ze = (e) => {
|
|
|
833
838
|
await Promise.all(e.map((e) => caches.delete(e)));
|
|
834
839
|
}
|
|
835
840
|
} catch {}
|
|
836
|
-
},
|
|
837
|
-
await
|
|
841
|
+
}, Ye = async () => {
|
|
842
|
+
await Je();
|
|
838
843
|
let e = new URL(window.location.href);
|
|
839
|
-
e.searchParams.set(
|
|
840
|
-
},
|
|
844
|
+
e.searchParams.set(Q, String(Date.now())), window.location.replace(e.toString());
|
|
845
|
+
}, Xe = (e) => e != null && e.default !== void 0, Ze = (e) => r(async () => {
|
|
841
846
|
let t;
|
|
842
847
|
try {
|
|
843
848
|
let n = await e();
|
|
844
|
-
if (
|
|
849
|
+
if (Xe(n)) return n;
|
|
845
850
|
t = /* @__PURE__ */ Error("Module resolved without a valid default export");
|
|
846
851
|
} catch (e) {
|
|
847
852
|
t = e;
|
|
848
853
|
}
|
|
849
|
-
if (I || !
|
|
850
|
-
let n =
|
|
854
|
+
if (I || !Ve(t)) throw t;
|
|
855
|
+
let n = Ue(e);
|
|
851
856
|
if (n) try {
|
|
852
|
-
let e = await
|
|
853
|
-
if (
|
|
857
|
+
let e = await qe(n);
|
|
858
|
+
if (Xe(e)) return e;
|
|
854
859
|
} catch {}
|
|
855
|
-
let r = Number(
|
|
856
|
-
return Date.now() - r <
|
|
860
|
+
let r = Number(We(Re) || "0");
|
|
861
|
+
return Date.now() - r < ze || Be || (Ge(Re, String(Date.now())), await Ye()), { default: () => null };
|
|
857
862
|
});
|
|
858
863
|
//#endregion
|
|
859
|
-
export { A as AMPLITUDE_FEATURE_SELECTOR, O as AutoReloadOnNewVersion, _ as ChatClient,
|
|
864
|
+
export { A as AMPLITUDE_FEATURE_SELECTOR, O as AutoReloadOnNewVersion, _ as ChatClient, q as ChatContext, fe as ChatProvider, k as GTMSendPageView, F as InitializeAmplitude, R as InitializeAxiosConfig, te as InitializeDaysJSConfig, ne as InitializeHubSpot, re as InitializeI18nConfig, ie as InitializeSentryConfig, y as InjectDependenciesContext, b as InjectDependenciesProvider, v as MaskTextField, _e as QueryProvider, oe as RequireAuth, U as SENTRY_KEEP_REPLAY, z as SUPPORTED_LANGUAGE, se as ShowHubSpotBubble, Y as dateAdapter, X as distanceAdapter, e as getOrvalConfig, W as isReplayKeptForError, Ze as lazyWithRetry, J as shouldRetryQuery, xe as useAdapter, Se as useAmplitude, Ce as useAuth, Ee as useChat, De as useCurrentLanguage, Ne as useFilters, Fe as useHubSpot, Ie as useInfiniteDataGrid, Le as useResponseError, ve as worksiteNameAdapter };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a failed query is asked again, the default `retry` of `QueryProvider`: the three tries of React Query, except for an answer the API would give
|
|
3
|
+
* again, where they only delay the error the screen is waiting for
|
|
4
|
+
* @param failureCount how many times the query has failed so far
|
|
5
|
+
* @param error the last error, an axios one when the API answered
|
|
6
|
+
*/
|
|
7
|
+
declare const shouldRetryQuery: (failureCount: number, error: unknown) => boolean;
|
|
8
|
+
export default shouldRetryQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { InjectDependenciesContextProps } from './InjectDependenciesProvider';
|
|
3
|
-
interface QueryProviderProps extends PropsWithChildren {
|
|
4
|
-
/**
|
|
5
|
-
* QueryClientProvider from react-query
|
|
6
|
-
*/
|
|
7
|
-
QueryClientProvider?: NonNullable<NonNullable<InjectDependenciesContextProps["libraries"]>["reactQuery"]>["QueryClientProvider"];
|
|
8
|
-
/**
|
|
9
|
-
* QueryClient from react-query
|
|
10
|
-
*/
|
|
11
|
-
QueryClient?: NonNullable<NonNullable<InjectDependenciesContextProps["libraries"]>["reactQuery"]>["QueryClient"];
|
|
12
|
-
/**
|
|
13
|
-
* Default options for queries
|
|
14
|
-
*/
|
|
15
|
-
defaultQueriesOptions?: {
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Default options for mutations
|
|
20
|
-
*/
|
|
21
|
-
defaultMutationsOptions?: {
|
|
22
|
-
[key: string]: any;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
declare const QueryProvider: ({ children, defaultQueriesOptions, defaultMutationsOptions, ...props }: QueryProviderProps) => import("react").JSX.Element;
|
|
26
|
-
export default QueryProvider;
|