@tracktor/shared-module 2.18.1 → 2.18.2
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/CHANGELOG.md +5 -0
- package/dist/config/orval/orval.d.ts +5 -0
- package/dist/main.js +48 -48
- package/dist/main.umd.cjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,3 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
### ✨ Features
|
|
12
12
|
- `UpdateNotifier`: add `autoUpdate` prop to automatically reload the app when an update is detected, bypassing confirmation dialogs and custom UI.
|
|
13
|
+
|
|
14
|
+
## [2.18.2] - 2025-10-03
|
|
15
|
+
|
|
16
|
+
### ✨ Features
|
|
17
|
+
- expose `customAxiosInstancePath` in `CustomOrvalConfig` to allow overriding the default axios instance.
|
|
@@ -32,6 +32,11 @@ interface CustomOrvalConfig {
|
|
|
32
32
|
* Like POST requests that you want to use with useQuery instead of useMutation
|
|
33
33
|
*/
|
|
34
34
|
useQueryIds?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* A custom Axios instance to be used instead of the default one provided by us.
|
|
37
|
+
* This is useful to define dynamic baseUrl in the axios default instance.
|
|
38
|
+
*/
|
|
39
|
+
customAxiosInstancePath?: string;
|
|
35
40
|
}
|
|
36
41
|
interface OrvalConfig {
|
|
37
42
|
[key: string]: CustomOrvalConfig;
|
package/dist/main.js
CHANGED
|
@@ -78,7 +78,7 @@ function ye() {
|
|
|
78
78
|
switch (typeof t.tag == "number" && console.error(
|
|
79
79
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
80
80
|
), t.$$typeof) {
|
|
81
|
-
case
|
|
81
|
+
case I:
|
|
82
82
|
return "Portal";
|
|
83
83
|
case p:
|
|
84
84
|
return (t.displayName || "Context") + ".Provider";
|
|
@@ -161,9 +161,9 @@ function ye() {
|
|
|
161
161
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
162
162
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
163
163
|
}
|
|
164
|
-
function u(t, f, v, E, x, T, Q,
|
|
164
|
+
function u(t, f, v, E, x, T, Q, M) {
|
|
165
165
|
return v = T.ref, t = {
|
|
166
|
-
$$typeof:
|
|
166
|
+
$$typeof: A,
|
|
167
167
|
type: t,
|
|
168
168
|
key: f,
|
|
169
169
|
props: T,
|
|
@@ -190,10 +190,10 @@ function ye() {
|
|
|
190
190
|
configurable: !1,
|
|
191
191
|
enumerable: !1,
|
|
192
192
|
writable: !0,
|
|
193
|
-
value:
|
|
193
|
+
value: M
|
|
194
194
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
195
195
|
}
|
|
196
|
-
function s(t, f, v, E, x, T, Q,
|
|
196
|
+
function s(t, f, v, E, x, T, Q, M) {
|
|
197
197
|
var R = f.children;
|
|
198
198
|
if (R !== void 0)
|
|
199
199
|
if (E)
|
|
@@ -208,10 +208,10 @@ function ye() {
|
|
|
208
208
|
else h(R);
|
|
209
209
|
if (K.call(f, "key")) {
|
|
210
210
|
R = e(t);
|
|
211
|
-
var
|
|
211
|
+
var O = Object.keys(f).filter(function(de) {
|
|
212
212
|
return de !== "key";
|
|
213
213
|
});
|
|
214
|
-
E = 0 <
|
|
214
|
+
E = 0 < O.length ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}", Z[R + E] || (O = 0 < O.length ? "{" + O.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
215
215
|
`A props object containing a "key" prop is being spread into JSX:
|
|
216
216
|
let props = %s;
|
|
217
217
|
<%s {...props} />
|
|
@@ -220,14 +220,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
220
220
|
<%s key={someKey} {...props} />`,
|
|
221
221
|
E,
|
|
222
222
|
R,
|
|
223
|
-
|
|
223
|
+
O,
|
|
224
224
|
R
|
|
225
225
|
), Z[R + E] = !0);
|
|
226
226
|
}
|
|
227
227
|
if (R = null, v !== void 0 && (o(v), R = "" + v), c(f) && (o(f.key), R = "" + f.key), "key" in f) {
|
|
228
228
|
v = {};
|
|
229
|
-
for (var
|
|
230
|
-
|
|
229
|
+
for (var V in f)
|
|
230
|
+
V !== "key" && (v[V] = f[V]);
|
|
231
231
|
} else v = f;
|
|
232
232
|
return R && d(
|
|
233
233
|
v,
|
|
@@ -240,13 +240,13 @@ React keys must be passed directly to JSX without using spread:
|
|
|
240
240
|
r(),
|
|
241
241
|
v,
|
|
242
242
|
Q,
|
|
243
|
-
|
|
243
|
+
M
|
|
244
244
|
);
|
|
245
245
|
}
|
|
246
246
|
function h(t) {
|
|
247
|
-
typeof t == "object" && t !== null && t.$$typeof ===
|
|
247
|
+
typeof t == "object" && t !== null && t.$$typeof === A && t._store && (t._store.validated = 1);
|
|
248
248
|
}
|
|
249
|
-
var g = fe,
|
|
249
|
+
var g = fe, A = Symbol.for("react.transitional.element"), I = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), m = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), p = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), ie = Symbol.for("react.suspense_list"), se = Symbol.for("react.memo"), J = Symbol.for("react.lazy"), ce = Symbol.for("react.activity"), le = Symbol.for("react.client.reference"), z = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, ue = Array.isArray, U = console.createTask ? console.createTask : function() {
|
|
250
250
|
return null;
|
|
251
251
|
};
|
|
252
252
|
g = {
|
|
@@ -290,7 +290,7 @@ function he() {
|
|
|
290
290
|
return ne || (ne = 1, process.env.NODE_ENV === "production" ? D.exports = me() : D.exports = ye()), D.exports;
|
|
291
291
|
}
|
|
292
292
|
var C = he();
|
|
293
|
-
const
|
|
293
|
+
const S = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys: a }) => {
|
|
294
294
|
const r = G(
|
|
295
295
|
() => ({
|
|
296
296
|
apiURL: n,
|
|
@@ -299,20 +299,20 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
299
299
|
}),
|
|
300
300
|
[n, o, a]
|
|
301
301
|
);
|
|
302
|
-
return /* @__PURE__ */ C.jsx(
|
|
302
|
+
return /* @__PURE__ */ C.jsx(S.Provider, { value: r, children: e });
|
|
303
303
|
}, ve = "user", We = ({ Fallback: e, isLogged: n, loginPath: o = "/login", redirect401Path: a = "/login", ...r }) => {
|
|
304
|
-
const { libraries: i, localStorageKeys: c } = j(
|
|
304
|
+
const { libraries: i, localStorageKeys: c } = j(S), d = r?.reactRouter || i?.reactRouter, l = r?.axios || i?.axios, u = r?.localStorageKey || c?.user || ve;
|
|
305
305
|
if (!d)
|
|
306
306
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
307
|
-
const [s, h] = W(null), { useLocation: g, Navigate:
|
|
307
|
+
const [s, h] = W(null), { useLocation: g, Navigate: A, Outlet: I } = d, b = g(), m = ae(!1), y = typeof n == "function" ? n() : !!n, _ = typeof y == "boolean" ? y : y?.isLogged;
|
|
308
308
|
return k(() => {
|
|
309
309
|
m.current || (m.current = !0, l.interceptors.response.use(
|
|
310
310
|
(p) => p,
|
|
311
311
|
async (p) => (typeof p == "object" && p && "response" in p && p.response && typeof p.response == "object" && "status" in p.response && p.response && typeof p.response == "object" && "status" in p.response && p?.response?.status === 401 && (l.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(u), h(a)), Promise.reject(p))
|
|
312
312
|
));
|
|
313
|
-
}, [l.defaults.headers.common, l.interceptors.response, u, a]), _ && !s ? /* @__PURE__ */ C.jsx(ge, { fallback: e, children: b.state?.from?.state && b.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(
|
|
313
|
+
}, [l.defaults.headers.common, l.interceptors.response, u, a]), _ && !s ? /* @__PURE__ */ C.jsx(ge, { fallback: e, children: b.state?.from?.state && b.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(A, { to: b.state.from.state.from.pathname + b.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ C.jsx(I, {}) }) : /* @__PURE__ */ C.jsx(A, { to: o + b.search, state: { from: b }, replace: !0 });
|
|
314
314
|
}, ze = ({ data: e, ...n }) => {
|
|
315
|
-
const { libraries: o } = j(
|
|
315
|
+
const { libraries: o } = j(S), a = n?.reactRouter || o?.reactRouter, r = n?.gtm || o?.gtm;
|
|
316
316
|
if (!a)
|
|
317
317
|
throw new Error(
|
|
318
318
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
@@ -341,18 +341,18 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
341
341
|
postContentType: o = "application/json",
|
|
342
342
|
...a
|
|
343
343
|
}) => {
|
|
344
|
-
const { apiURL: r = a.apiURL, libraries: i, localStorageKeys: c } = j(
|
|
344
|
+
const { apiURL: r = a.apiURL, libraries: i, localStorageKeys: c } = j(S), d = a?.userLocalStorageKey || c?.user || we, l = a?.axios || i?.axios;
|
|
345
345
|
if (!l)
|
|
346
346
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
347
347
|
if (!l?.defaults || $)
|
|
348
348
|
return null;
|
|
349
349
|
if (typeof window < "u" && window.localStorage) {
|
|
350
|
-
const u = localStorage.getItem(d), s = u ? JSON.parse(u) : null, h = s?.[e] ? s[e] : null, g = s?.[n] ? s[n] : null,
|
|
351
|
-
|
|
350
|
+
const u = localStorage.getItem(d), s = u ? JSON.parse(u) : null, h = s?.[e] ? s[e] : null, g = s?.[n] ? s[n] : null, A = u ? `${h} ${g}` : null;
|
|
351
|
+
A && (l.defaults.headers.common.Authorization = A);
|
|
352
352
|
}
|
|
353
353
|
return l.defaults.baseURL = r, l.defaults.headers.post["Content-Type"] = o, null;
|
|
354
354
|
}, Qe = ({ debug: e, resources: n, ...o }) => {
|
|
355
|
-
const { libraries: a } = j(
|
|
355
|
+
const { libraries: a } = j(S), r = o?.i18 || a?.i18, { i18next: i, initReactI18next: c, languageDetector: d } = r || {};
|
|
356
356
|
if ($)
|
|
357
357
|
return null;
|
|
358
358
|
if (!r)
|
|
@@ -375,7 +375,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
375
375
|
}), i.on("languageChanged", (l) => {
|
|
376
376
|
document.documentElement.setAttribute("lang", l);
|
|
377
377
|
})), null;
|
|
378
|
-
},
|
|
378
|
+
}, Me = ({
|
|
379
379
|
dsn: e,
|
|
380
380
|
integrations: n,
|
|
381
381
|
tracesSampleRate: o,
|
|
@@ -388,14 +388,14 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
388
388
|
release: u,
|
|
389
389
|
...s
|
|
390
390
|
}) => {
|
|
391
|
-
const { libraries: h } = j(
|
|
391
|
+
const { libraries: h } = j(S), g = s?.sentry || h?.sentry, A = s?.reactRouter || h?.reactRouter;
|
|
392
392
|
if (!g)
|
|
393
393
|
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
394
|
-
if (!
|
|
394
|
+
if (!A)
|
|
395
395
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
396
396
|
if (g.isInitialized())
|
|
397
397
|
return null;
|
|
398
|
-
const { createRoutesFromChildren:
|
|
398
|
+
const { createRoutesFromChildren: I, matchRoutes: b, useLocation: m, useNavigationType: y } = A;
|
|
399
399
|
return (d || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && g.init({
|
|
400
400
|
debug: d,
|
|
401
401
|
dsn: e,
|
|
@@ -411,7 +411,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
411
411
|
],
|
|
412
412
|
integrations: [
|
|
413
413
|
g.reactRouterV6BrowserTracingIntegration({
|
|
414
|
-
createRoutesFromChildren:
|
|
414
|
+
createRoutesFromChildren: I,
|
|
415
415
|
matchRoutes: b,
|
|
416
416
|
useEffect: k,
|
|
417
417
|
useLocation: m,
|
|
@@ -425,7 +425,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
425
425
|
tracePropagationTargets: i,
|
|
426
426
|
tracesSampleRate: o || 1
|
|
427
427
|
}), null;
|
|
428
|
-
},
|
|
428
|
+
}, Ve = ({ IMaskMixin: e, ...n }) => {
|
|
429
429
|
const o = G(
|
|
430
430
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
431
431
|
() => e(({ TextField: a, ...r }) => /* @__PURE__ */ C.jsx(a, { ...r })),
|
|
@@ -433,7 +433,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
433
433
|
);
|
|
434
434
|
return /* @__PURE__ */ C.jsx(o, { ...n });
|
|
435
435
|
}, Ge = ({ language: e, ...n }) => {
|
|
436
|
-
const { libraries: o } = j(
|
|
436
|
+
const { libraries: o } = j(S), a = n?.dayjs || o?.dayjs, r = n?.plugin || o?.dayjsPlugin;
|
|
437
437
|
if (!a)
|
|
438
438
|
throw new Error(
|
|
439
439
|
"Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
|
|
@@ -499,7 +499,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
499
499
|
defaultMutationsOptions: o,
|
|
500
500
|
...a
|
|
501
501
|
}) => {
|
|
502
|
-
const { libraries: r } = j(
|
|
502
|
+
const { libraries: r } = j(S), i = a?.QueryClient || r?.reactQuery?.QueryClient, c = a?.QueryClientProvider || r?.reactQuery?.QueryClientProvider;
|
|
503
503
|
if (!i)
|
|
504
504
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
505
505
|
if (!c)
|
|
@@ -523,7 +523,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
523
523
|
});
|
|
524
524
|
return /* @__PURE__ */ C.jsx(c, { client: d, children: e });
|
|
525
525
|
}, Be = (e) => {
|
|
526
|
-
const { libraries: n } = j(
|
|
526
|
+
const { libraries: n } = j(S), o = e?.i18 || n?.i18, a = e?.i18?.translateFunction || n?.i18?.translateFunction, r = o?.i18next?.t || a || ((u) => u), { unknownErrorTranslationKey: i = "error.unknownError" } = e || {}, c = r(i), d = L(
|
|
527
527
|
(u) => {
|
|
528
528
|
if (u && typeof u == "object" && "response" in u) {
|
|
529
529
|
const { response: s } = u || {};
|
|
@@ -574,7 +574,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
574
574
|
rows: d
|
|
575
575
|
};
|
|
576
576
|
}, Xe = (e) => {
|
|
577
|
-
const { libraries: n } = j(
|
|
577
|
+
const { libraries: n } = j(S), o = e?.axios || n?.axios, a = e?.localStorageKey || "user";
|
|
578
578
|
if (!o)
|
|
579
579
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
580
580
|
const r = L(
|
|
@@ -604,7 +604,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
604
604
|
clearAuthenticationToken: i,
|
|
605
605
|
setAuthenticationToken: r
|
|
606
606
|
};
|
|
607
|
-
},
|
|
607
|
+
}, Ae = ({ library: e, date: n, format: o = "ll" }) => e(n).format(o), Se = (e, n) => {
|
|
608
608
|
const { fractionDigits: o = 0, metric: a = "km", spacingBetween: r = !0 } = n || {}, i = Number(e), c = r ? " " : "";
|
|
609
609
|
return Number.isNaN(i) ? `0${c}${a}` : `${i.toFixed(o)}${c}${a}`;
|
|
610
610
|
}, je = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((o) => o.length > 0 ? o.charAt(0).toUpperCase() + o.slice(1) : o).join(" "), _e = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, Pe = ({ path: e, size: n, apiURL: o }) => {
|
|
@@ -613,18 +613,18 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
613
613
|
const a = _e(e), r = `${o}${a}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
614
614
|
return typeof n == "number" && i ? `${r.replace("/files", `/thumbs/${n}`)}` : r;
|
|
615
615
|
}, Ze = (e) => {
|
|
616
|
-
const { apiURL: n, libraries: o } = j(
|
|
616
|
+
const { apiURL: n, libraries: o } = j(S), a = e?.dayjs || o?.dayjs;
|
|
617
617
|
return {
|
|
618
618
|
dateAdapter: (c, d) => {
|
|
619
619
|
if (!a)
|
|
620
620
|
throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
621
|
-
return
|
|
621
|
+
return Ae({
|
|
622
622
|
date: c,
|
|
623
623
|
format: d,
|
|
624
624
|
library: a
|
|
625
625
|
});
|
|
626
626
|
},
|
|
627
|
-
distanceAdapter:
|
|
627
|
+
distanceAdapter: Se,
|
|
628
628
|
filePathAdapter: (c, d) => {
|
|
629
629
|
if (!n)
|
|
630
630
|
throw new Error(
|
|
@@ -670,7 +670,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
670
670
|
}
|
|
671
671
|
return n;
|
|
672
672
|
}, {}), tt = (e) => {
|
|
673
|
-
const { libraries: n, localStorageKeys: o } = j(
|
|
673
|
+
const { libraries: n, localStorageKeys: o } = j(S), a = e?.reactRouter || n?.reactRouter, { pathname: r } = a?.useLocation?.() ?? { pathname: "/" }, [i, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
|
|
674
674
|
}], [d, l] = W({}), u = o?.filter || Te, s = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl;
|
|
675
675
|
if ($)
|
|
676
676
|
return ke;
|
|
@@ -740,11 +740,11 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
740
740
|
},
|
|
741
741
|
setFilter: g
|
|
742
742
|
};
|
|
743
|
-
}, xe = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(),
|
|
743
|
+
}, xe = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), Ie = (e) => {
|
|
744
744
|
const a = e.split("/").filter((r) => r.length > 0).map((r) => r.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join("")).join("");
|
|
745
745
|
return a.charAt(0).toLowerCase() + a.slice(1);
|
|
746
|
-
},
|
|
747
|
-
const r =
|
|
746
|
+
}, Oe = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), Le = (e, n, o, a) => {
|
|
747
|
+
const r = Ie(n), i = xe(o), c = `${r}${i}`;
|
|
748
748
|
return e && typeof e == "object" && "operationId" in e && a?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
|
|
749
749
|
}, Ne = (e, n) => {
|
|
750
750
|
const o = {};
|
|
@@ -764,7 +764,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
764
764
|
};
|
|
765
765
|
}), Object.keys(o).length ? o : void 0;
|
|
766
766
|
}, rt = (e) => (Array.isArray(e) ? e : [e]).reduce((o, a) => {
|
|
767
|
-
const { output: r, useInfiniteIds: i, useQueryIds: c, input: d = "./openapi.json" } = a || {}, l =
|
|
767
|
+
const { output: r, useInfiniteIds: i, useQueryIds: c, input: d = "./openapi.json" } = a || {}, l = Oe(d);
|
|
768
768
|
return {
|
|
769
769
|
...o,
|
|
770
770
|
[l]: {
|
|
@@ -787,7 +787,7 @@ const A = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
|
|
|
787
787
|
],
|
|
788
788
|
mutator: {
|
|
789
789
|
name: "axiosCustomInstance",
|
|
790
|
-
path: "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"
|
|
790
|
+
path: a?.customAxiosInstancePath || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"
|
|
791
791
|
},
|
|
792
792
|
operationName: (u, s, h) => Le(u, s, h, c),
|
|
793
793
|
query: {
|
|
@@ -806,17 +806,17 @@ export {
|
|
|
806
806
|
Ue as InitializeAxiosConfig,
|
|
807
807
|
Ge as InitializeDaysJSConfig,
|
|
808
808
|
Qe as InitializeI18nConfig,
|
|
809
|
-
|
|
810
|
-
|
|
809
|
+
Me as InitializeSentryConfig,
|
|
810
|
+
S as InjectDependenciesContext,
|
|
811
811
|
Ye as InjectDependenciesProvider,
|
|
812
|
-
|
|
812
|
+
Ve as MaskTextField,
|
|
813
813
|
Je as PreloadErrorHandler,
|
|
814
814
|
qe as QueryClientProviderWithConfig,
|
|
815
815
|
We as RequireAuth,
|
|
816
816
|
Ke as UpdateNotifier,
|
|
817
817
|
De as axiosCustomInstance,
|
|
818
|
-
|
|
819
|
-
|
|
818
|
+
Ae as dateAdapter,
|
|
819
|
+
Se as distanceAdapter,
|
|
820
820
|
rt as getOrvalConfig,
|
|
821
821
|
Ze as useAdapter,
|
|
822
822
|
Xe as useAuth,
|
package/dist/main.umd.cjs
CHANGED
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,R,S,N,S),oe[S+R]=!0)}if(S=null,w!==void 0&&(o(w),S=""+w),c(p)&&(o(p.key),S=""+p.key),"key"in p){w={};for(var V in p)V!=="key"&&(w[V]=p[V])}else w=p;return S&&d(w,typeof t=="function"?t.displayName||t.name||"Unknown":t),u(t,S,T,I,r(),w,M,Q)}function E(t){typeof t=="object"&&t!==null&&t.$$typeof===j&&t._store&&(t._store.validated=1)}var y=f,j=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),m=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),Qe=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Ve=Symbol.for("react.activity"),Ge=Symbol.for("react.client.reference"),z=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,Je=Array.isArray,U=console.createTask?console.createTask:function(){return null};y={"react-stack-bottom-frame":function(t){return t()}};var ee,te={},re=y["react-stack-bottom-frame"].bind(y,s)(),ne=U(a(s)),oe={};F.Fragment=C,F.jsx=function(t,p,w,R,I){var T=1e4>z.recentlyCreatedOwnerStacks++;return i(t,p,w,!1,R,I,T?Error("react-stack-top-frame"):re,T?U(a(t)):ne)},F.jsxs=function(t,p,w,R,I){var T=1e4>z.recentlyCreatedOwnerStacks++;return i(t,p,w,!0,R,I,T?Error("react-stack-top-frame"):re,T?U(a(t)):ne)}}()),F}var K;function ce(){return K||(K=1,process.env.NODE_ENV==="production"?Y.exports=se():Y.exports=ie()),Y.exports}var k=ce();const A=f.createContext({}),le=({children:e,apiURL:n,libraries:o,localStorageKeys:a})=>{const r=f.useMemo(()=>({apiURL:n,libraries:o,localStorageKeys:a}),[n,o,a]);return k.jsx(A.Provider,{value:r,children:e})},ue="user",de=({Fallback:e,isLogged:n,loginPath:o="/login",redirect401Path:a="/login",...r})=>{const{libraries:s,localStorageKeys:c}=f.useContext(A),d=r?.reactRouter||s?.reactRouter,l=r?.axios||s?.axios,u=r?.localStorageKey||c?.user||ue;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,E]=f.useState(null),{useLocation:y,Navigate:j,Outlet:x}=d,C=y(),h=f.useRef(!1),v=typeof n=="function"?n():!!n,_=typeof v=="boolean"?v:v?.isLogged;return f.useEffect(()=>{h.current||(h.current=!0,l.interceptors.response.use(m=>m,async m=>(typeof m=="object"&&m&&"response"in m&&m.response&&typeof m.response=="object"&&"status"in m.response&&m.response&&typeof m.response=="object"&&"status"in m.response&&m?.response?.status===401&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(u),E(a)),Promise.reject(m))))},[l.defaults.headers.common,l.interceptors.response,u,a]),_&&!i?k.jsx(f.Suspense,{fallback:e,children:C.state?.from?.state&&C.state?.from?.pathname===o?k.jsx(j,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):k.jsx(x,{})}):k.jsx(j,{to:o+C.search,state:{from:C},replace:!0})},fe=({data:e,...n})=>{const{libraries:o}=f.useContext(A),a=n?.reactRouter||o?.reactRouter,r=n?.gtm||o?.gtm;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!r)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:s}=r,{useLocation:c,Outlet:d}=a,{pathname:l}=c(),{sendEvent:u}=s();return f.useEffect(()=>{u({event:"pageView",pathname:l,...e})},[e,l,u]),k.jsx(d,{})},D=(()=>{try{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}catch{return!1}})(),pe="user",ge=({tokenTypeKey:e="tokenType",tokenKey:n="accessToken",postContentType:o="application/json",...a})=>{const{apiURL:r=a.apiURL,libraries:s,localStorageKeys:c}=f.useContext(A),d=a?.userLocalStorageKey||c?.user||pe,l=a?.axios||s?.axios;if(!l)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l?.defaults||D)return null;if(typeof window<"u"&&window.localStorage){const u=localStorage.getItem(d),i=u?JSON.parse(u):null,E=i?.[e]?i[e]:null,y=i?.[n]?i[n]:null,j=u?`${E} ${y}`:null;j&&(l.defaults.headers.common.Authorization=j)}return l.defaults.baseURL=r,l.defaults.headers.post["Content-Type"]=o,null},me=({debug:e,resources:n,...o})=>{const{libraries:a}=f.useContext(A),r=o?.i18||a?.i18,{i18next:s,initReactI18next:c,languageDetector:d}=r||{};if(D)return null;if(!r)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return s?.isInitialized||(s.use(d).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==s.resolvedLanguage&&s.resolvedLanguage&&document.documentElement.setAttribute("lang",s.resolvedLanguage)}),s.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},ye=({dsn:e,integrations:n,tracesSampleRate:o,replaysSessionSampleRate:a,replaysOnErrorSampleRate:r,tracePropagationTargets:s,ignoreErrors:c,debug:d,environment:l,release:u,...i})=>{const{libraries:E}=f.useContext(A),y=i?.sentry||E?.sentry,j=i?.reactRouter||E?.reactRouter;if(!y)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!j)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(y.isInitialized())return null;const{createRoutesFromChildren:x,matchRoutes:C,useLocation:h,useNavigationType:v}=j;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&y.init({debug:d,dsn:e,environment:l||"production",ignoreErrors:[...c||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[y.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:x,matchRoutes:C,useEffect:f.useEffect,useLocation:h,useNavigationType:v}),...n||[]],release:u,replaysOnErrorSampleRate:r||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:s,tracesSampleRate:o||1}),null},he=({IMaskMixin:e,...n})=>{const o=f.useMemo(()=>e(({TextField:a,...r})=>k.jsx(a,{...r})),[e]);return k.jsx(o,{...n})},ve=({language:e,...n})=>{const{libraries:o}=f.useContext(A),a=n?.dayjs||o?.dayjs,r=n?.plugin||o?.dayjsPlugin;if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return f.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";r&&r.forEach(d=>{d&&a.extend(d)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),a.locale(c)})().then()},[a,r,e]),null},Ee=()=>(f.useEffect(()=>{if(D)return;const e=n=>{try{n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),we=async()=>{if("caches"in window)try{const e=await caches.keys();await Promise.all(e.map(n=>caches.delete(n)))}catch(e){console.error("Failed to clear caches:",e)}},be=({autoUpdate:e,renderDialog:n,clearCachesOnReload:o})=>{const a=f.useRef(null),[r,s]=f.useState(!1),c=f.useCallback(async()=>{a.current&&a.current.postMessage({type:"SKIP_WAITING"}),o&&await we(),window.location.reload()},[o]),d=f.useCallback(async()=>{window.confirm("A new version is available. The app will reload now.")&&await c()},[c]);return f.useEffect(()=>{if(!("serviceWorker"in navigator))return;let l,u;const i=y=>{y&&navigator.serviceWorker.controller&&(a.current=y,s(!0))},E=()=>{const y=l?.installing;y&&(u=()=>{y.state==="installed"&&i(y)},y.addEventListener("statechange",u))};return(async()=>{l=await navigator.serviceWorker.getRegistration(),l&&(i(l.waiting),l.addEventListener("updatefound",E))})().catch(console.error),()=>{l?.removeEventListener("updatefound",E),u&&l?.installing&&l.installing.removeEventListener("statechange",u)}},[]),f.useEffect(()=>{r&&e&&c().catch(console.error)},[e,r,c]),f.useEffect(()=>{r&&!e&&!n&&d().catch(console.error)},[n,d,r,e]),r&&!e&&n?n(c):null},Re=e=>e&&typeof e=="function",Se=e=>e&&typeof e=="function",Ae=({children:e,defaultQueriesOptions:n,defaultMutationsOptions:o,...a})=>{const{libraries:r}=f.useContext(A),s=a?.QueryClient||r?.reactQuery?.QueryClient,c=a?.QueryClientProvider||r?.reactQuery?.QueryClientProvider;if(!s)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Re(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Se(s))throw new Error("Provided QueryClient dependencies are not valid.");const d=new s({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(l,u,i)=>l.length+(i||0),refetchOnWindowFocus:!1,retry:3,...n}}});return k.jsx(c,{client:d,children:e})},Ce=e=>{const{libraries:n}=f.useContext(A),o=e?.i18||n?.i18,a=e?.i18?.translateFunction||n?.i18?.translateFunction,r=o?.i18next?.t||a||(u=>u),{unknownErrorTranslationKey:s="error.unknownError"}=e||{},c=r(s),d=f.useCallback(u=>{if(u&&typeof u=="object"&&"response"in u){const{response:i}=u||{};if(i&&typeof i=="object"&&"reason"in i)return String(i.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"reason"in i.data)return String(i.data.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"message"in i.data)return String(i.data.message);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"detail"in i.data){const{detail:E}=i.data;if(Array.isArray(E)&&E.length>0&&typeof E[0]=="object"&&E[0]!==null&&"msg"in E[0]){const{msg:y}=E[0];if(typeof y=="string")return String(y)}}}return u instanceof Error?u.message:c},[c]);return{getErrorCode:f.useCallback(u=>{const{response:i}=u||{};return i?.error_code?String(i?.error_code):i?.data?.error_code?String(i?.data?.error_code):i?.error_code?String(i?.error_code):i?.data?.error_code?String(i.data.error_code):"unknown_error_code"},[]),printError:d}},je=({data:e,fetchNextPage:n,isFetchingNextPage:o,isInitialLoading:a,isLoading:r,enabled:s=!0})=>{const c=f.useCallback(async l=>{o||!s||await n({pageParam:l?.pageParam||l.visibleRowsCount})},[s,n,o]),d=f.useMemo(()=>{if(e)return e.pages.reduce((l,u)=>[...l,...u],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:o||r,loadingVariant:a?"skeleton":"linear-progress",rows:d}},_e=e=>{const{libraries:n}=f.useContext(A),o=e?.axios||n?.axios,a=e?.localStorageKey||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const r=f.useCallback(({tokenType:c,accessToken:d})=>{o.defaults.headers.common.Authorization=`${c} ${d}`},[o.defaults.headers.common]),s=()=>{o.defaults.headers.common.Authorization=null};return f.useEffect(()=>{if(D)return;const c=({newValue:d,key:l})=>{if(l===a&&d)try{const{accessToken:u,tokenType:i}=JSON.parse(d);r({accessToken:u,tokenType:i})}catch(u){console.error("Failed to parse newValue from localStorage:",u)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}},[a,r]),{clearAuthenticationToken:s,setAuthenticationToken:r}},B=({library:e,date:n,format:o="ll"})=>e(n).format(o),H=(e,n)=>{const{fractionDigits:o=0,metric:a="km",spacingBetween:r=!0}=n||{},s=Number(e),c=r?" ":"";return Number.isNaN(s)?`0${c}${a}`:`${s.toFixed(o)}${c}${a}`},X=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),Pe=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Te=({path:e,size:n,apiURL:o})=>{if(!e)return"";const a=Pe(e),r=`${o}${a}`,s=r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof n=="number"&&s?`${r.replace("/files",`/thumbs/${n}`)}`:r},ke=e=>{const{apiURL:n,libraries:o}=f.useContext(A),a=e?.dayjs||o?.dayjs;return{dateAdapter:(c,d)=>{if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return B({date:c,format:d,library:a})},distanceAdapter:H,filePathAdapter:(c,d)=>{if(!n)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return typeof c=="string"&&/^https?:\/\//.test(c)?c:Te({apiURL:n,path:c,size:d})},worksiteNameAdapter:X}},W=(e,n)=>n==="short"?e.split("-")[0]:e,Ie=(e,n="full")=>{const[o,a]=f.useState(()=>{const r=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,W(r,n)});return f.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(W(e.language,n));const r=s=>{a(W(s,n))};return e?.on?.("languageChanged",r),()=>{e?.off?.("languageChanged",r)}},[e,n]),o},Oe="tracktor.filter",xe={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},Z=(e,n,o)=>`${o}_${e}=>${n}`,Ne=e=>e.reduce((n,o)=>{const a=localStorage.getItem(o);if(a)try{const r=JSON.parse(a),s=Object.keys(r)?.[0];s&&(n[s]=Object.values(r)?.[0])}catch{}return n},{}),Le=e=>{const{libraries:n,localStorageKeys:o}=f.useContext(A),a=e?.reactRouter||n?.reactRouter,{pathname:r}=a?.useLocation?.()??{pathname:"/"},[s,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],[d,l]=f.useState({}),u=o?.filter||Oe,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl;if(D)return xe;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const E=()=>Object.keys(localStorage).filter(h=>h.startsWith(u)&&h.endsWith(e?.pathname||r)),y=(h,v,_=!0)=>{const m=Z(h,e?.pathname||r,u);if(!v||Array.isArray(v)&&!v.length){i?(s.delete(h),c(s)):l(b=>{const P={...b};return delete P[h],P}),localStorage.removeItem(m);return}_&&v&&localStorage.setItem(m,JSON.stringify({...s,[h]:v})),i&&v?(s.set(h,JSON.stringify(v)),c(s)):!i&&v&&l(b=>({...b,[h]:v}))};return{getFilter:(h,v)=>{if(!i){const b=d[h];if(b!==void 0)return b}if(i){const b=s.get(h);if(b)try{return JSON.parse(b)}catch{return b}}const _=Z(h,e?.pathname||r,u),m=localStorage.getItem(_);if(m)try{const b=JSON.parse(m)[h];return!i&&b!==void 0&&l(P=>({...P,[h]:b})),b}catch{}return v},getFilters:()=>{const h=E(),v=Ne(h);if(i){const _=Object.fromEntries(s.entries());return{...v,..._}}return{...v,...d}},handleFilter:(h,v)=>(_,m)=>{if(m||Array.isArray(m)&&m.length===0){const b=v||"value",P=typeof m=="object"&&b in m?m[b]:m;y(h,P);return}y(h,void 0)},setFilter:y}},Fe=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),De=e=>{const a=e.split("/").filter(r=>r.length>0).map(r=>r.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return a.charAt(0).toLowerCase()+a.slice(1)},Ye=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),We=(e,n,o,a)=>{const r=De(n),s=Fe(o),c=`${r}${s}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},ze=(e,n)=>{const o={};return e?.forEach(a=>{o[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),n?.filter(a=>!o[a]).forEach(a=>{o[a]={query:{useQuery:!0}}}),Object.keys(o).length?o:void 0},Ue=e=>(Array.isArray(e)?e:[e]).reduce((o,a)=>{const{output:r,useInfiniteIds:s,useQueryIds:c,input:d="./openapi.json"}=a||{},l=Ye(d);return{...o,[l]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:d,output:{baseUrl:r?.baseUrl,client:"react-query",mode:"tags-split",override:{...(s?.length||c?.length)&&{operations:ze(s,c)},header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(u,i,E)=>We(u,i,E,c),query:{useQuery:!0}},schemas:r?.schemas||`src/api/${l}/model`,target:r?.target||`src/api/${l}/services/api.ts`,...r}}}},{});g.GTMSendPageView=fe,g.InitializeAxiosConfig=ge,g.InitializeDaysJSConfig=ve,g.InitializeI18nConfig=me,g.InitializeSentryConfig=ye,g.InjectDependenciesContext=A,g.InjectDependenciesProvider=le,g.MaskTextField=he,g.PreloadErrorHandler=Ee,g.QueryClientProviderWithConfig=Ae,g.RequireAuth=de,g.UpdateNotifier=be,g.axiosCustomInstance=ae,g.dateAdapter=B,g.distanceAdapter=H,g.getOrvalConfig=Ue,g.useAdapter=ke,g.useAuth=_e,g.useCurrentLanguage=Ie,g.useFilters=Le,g.useInfiniteDataGrid=je,g.useResponseError=Ce,g.worksiteNameAdapter=X,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
22
|
+
<%s key={someKey} {...props} />`,R,S,N,S),oe[S+R]=!0)}if(S=null,w!==void 0&&(o(w),S=""+w),c(p)&&(o(p.key),S=""+p.key),"key"in p){w={};for(var V in p)V!=="key"&&(w[V]=p[V])}else w=p;return S&&d(w,typeof t=="function"?t.displayName||t.name||"Unknown":t),u(t,S,T,I,r(),w,M,Q)}function E(t){typeof t=="object"&&t!==null&&t.$$typeof===j&&t._store&&(t._store.validated=1)}var y=f,j=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),m=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),Qe=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Ve=Symbol.for("react.activity"),Ge=Symbol.for("react.client.reference"),z=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,Je=Array.isArray,U=console.createTask?console.createTask:function(){return null};y={"react-stack-bottom-frame":function(t){return t()}};var ee,te={},re=y["react-stack-bottom-frame"].bind(y,s)(),ne=U(a(s)),oe={};F.Fragment=C,F.jsx=function(t,p,w,R,I){var T=1e4>z.recentlyCreatedOwnerStacks++;return i(t,p,w,!1,R,I,T?Error("react-stack-top-frame"):re,T?U(a(t)):ne)},F.jsxs=function(t,p,w,R,I){var T=1e4>z.recentlyCreatedOwnerStacks++;return i(t,p,w,!0,R,I,T?Error("react-stack-top-frame"):re,T?U(a(t)):ne)}}()),F}var K;function ce(){return K||(K=1,process.env.NODE_ENV==="production"?Y.exports=se():Y.exports=ie()),Y.exports}var k=ce();const A=f.createContext({}),le=({children:e,apiURL:n,libraries:o,localStorageKeys:a})=>{const r=f.useMemo(()=>({apiURL:n,libraries:o,localStorageKeys:a}),[n,o,a]);return k.jsx(A.Provider,{value:r,children:e})},ue="user",de=({Fallback:e,isLogged:n,loginPath:o="/login",redirect401Path:a="/login",...r})=>{const{libraries:s,localStorageKeys:c}=f.useContext(A),d=r?.reactRouter||s?.reactRouter,l=r?.axios||s?.axios,u=r?.localStorageKey||c?.user||ue;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,E]=f.useState(null),{useLocation:y,Navigate:j,Outlet:x}=d,C=y(),h=f.useRef(!1),v=typeof n=="function"?n():!!n,_=typeof v=="boolean"?v:v?.isLogged;return f.useEffect(()=>{h.current||(h.current=!0,l.interceptors.response.use(m=>m,async m=>(typeof m=="object"&&m&&"response"in m&&m.response&&typeof m.response=="object"&&"status"in m.response&&m.response&&typeof m.response=="object"&&"status"in m.response&&m?.response?.status===401&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(u),E(a)),Promise.reject(m))))},[l.defaults.headers.common,l.interceptors.response,u,a]),_&&!i?k.jsx(f.Suspense,{fallback:e,children:C.state?.from?.state&&C.state?.from?.pathname===o?k.jsx(j,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):k.jsx(x,{})}):k.jsx(j,{to:o+C.search,state:{from:C},replace:!0})},fe=({data:e,...n})=>{const{libraries:o}=f.useContext(A),a=n?.reactRouter||o?.reactRouter,r=n?.gtm||o?.gtm;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!r)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:s}=r,{useLocation:c,Outlet:d}=a,{pathname:l}=c(),{sendEvent:u}=s();return f.useEffect(()=>{u({event:"pageView",pathname:l,...e})},[e,l,u]),k.jsx(d,{})},D=(()=>{try{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}catch{return!1}})(),pe="user",ge=({tokenTypeKey:e="tokenType",tokenKey:n="accessToken",postContentType:o="application/json",...a})=>{const{apiURL:r=a.apiURL,libraries:s,localStorageKeys:c}=f.useContext(A),d=a?.userLocalStorageKey||c?.user||pe,l=a?.axios||s?.axios;if(!l)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l?.defaults||D)return null;if(typeof window<"u"&&window.localStorage){const u=localStorage.getItem(d),i=u?JSON.parse(u):null,E=i?.[e]?i[e]:null,y=i?.[n]?i[n]:null,j=u?`${E} ${y}`:null;j&&(l.defaults.headers.common.Authorization=j)}return l.defaults.baseURL=r,l.defaults.headers.post["Content-Type"]=o,null},me=({debug:e,resources:n,...o})=>{const{libraries:a}=f.useContext(A),r=o?.i18||a?.i18,{i18next:s,initReactI18next:c,languageDetector:d}=r||{};if(D)return null;if(!r)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return s?.isInitialized||(s.use(d).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==s.resolvedLanguage&&s.resolvedLanguage&&document.documentElement.setAttribute("lang",s.resolvedLanguage)}),s.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},ye=({dsn:e,integrations:n,tracesSampleRate:o,replaysSessionSampleRate:a,replaysOnErrorSampleRate:r,tracePropagationTargets:s,ignoreErrors:c,debug:d,environment:l,release:u,...i})=>{const{libraries:E}=f.useContext(A),y=i?.sentry||E?.sentry,j=i?.reactRouter||E?.reactRouter;if(!y)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!j)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(y.isInitialized())return null;const{createRoutesFromChildren:x,matchRoutes:C,useLocation:h,useNavigationType:v}=j;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&y.init({debug:d,dsn:e,environment:l||"production",ignoreErrors:[...c||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[y.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:x,matchRoutes:C,useEffect:f.useEffect,useLocation:h,useNavigationType:v}),...n||[]],release:u,replaysOnErrorSampleRate:r||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:s,tracesSampleRate:o||1}),null},he=({IMaskMixin:e,...n})=>{const o=f.useMemo(()=>e(({TextField:a,...r})=>k.jsx(a,{...r})),[e]);return k.jsx(o,{...n})},ve=({language:e,...n})=>{const{libraries:o}=f.useContext(A),a=n?.dayjs||o?.dayjs,r=n?.plugin||o?.dayjsPlugin;if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return f.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";r&&r.forEach(d=>{d&&a.extend(d)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),a.locale(c)})().then()},[a,r,e]),null},Ee=()=>(f.useEffect(()=>{if(D)return;const e=n=>{try{n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),we=async()=>{if("caches"in window)try{const e=await caches.keys();await Promise.all(e.map(n=>caches.delete(n)))}catch(e){console.error("Failed to clear caches:",e)}},be=({autoUpdate:e,renderDialog:n,clearCachesOnReload:o})=>{const a=f.useRef(null),[r,s]=f.useState(!1),c=f.useCallback(async()=>{a.current&&a.current.postMessage({type:"SKIP_WAITING"}),o&&await we(),window.location.reload()},[o]),d=f.useCallback(async()=>{window.confirm("A new version is available. The app will reload now.")&&await c()},[c]);return f.useEffect(()=>{if(!("serviceWorker"in navigator))return;let l,u;const i=y=>{y&&navigator.serviceWorker.controller&&(a.current=y,s(!0))},E=()=>{const y=l?.installing;y&&(u=()=>{y.state==="installed"&&i(y)},y.addEventListener("statechange",u))};return(async()=>{l=await navigator.serviceWorker.getRegistration(),l&&(i(l.waiting),l.addEventListener("updatefound",E))})().catch(console.error),()=>{l?.removeEventListener("updatefound",E),u&&l?.installing&&l.installing.removeEventListener("statechange",u)}},[]),f.useEffect(()=>{r&&e&&c().catch(console.error)},[e,r,c]),f.useEffect(()=>{r&&!e&&!n&&d().catch(console.error)},[n,d,r,e]),r&&!e&&n?n(c):null},Re=e=>e&&typeof e=="function",Se=e=>e&&typeof e=="function",Ae=({children:e,defaultQueriesOptions:n,defaultMutationsOptions:o,...a})=>{const{libraries:r}=f.useContext(A),s=a?.QueryClient||r?.reactQuery?.QueryClient,c=a?.QueryClientProvider||r?.reactQuery?.QueryClientProvider;if(!s)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Re(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Se(s))throw new Error("Provided QueryClient dependencies are not valid.");const d=new s({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(l,u,i)=>l.length+(i||0),refetchOnWindowFocus:!1,retry:3,...n}}});return k.jsx(c,{client:d,children:e})},Ce=e=>{const{libraries:n}=f.useContext(A),o=e?.i18||n?.i18,a=e?.i18?.translateFunction||n?.i18?.translateFunction,r=o?.i18next?.t||a||(u=>u),{unknownErrorTranslationKey:s="error.unknownError"}=e||{},c=r(s),d=f.useCallback(u=>{if(u&&typeof u=="object"&&"response"in u){const{response:i}=u||{};if(i&&typeof i=="object"&&"reason"in i)return String(i.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"reason"in i.data)return String(i.data.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"message"in i.data)return String(i.data.message);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"detail"in i.data){const{detail:E}=i.data;if(Array.isArray(E)&&E.length>0&&typeof E[0]=="object"&&E[0]!==null&&"msg"in E[0]){const{msg:y}=E[0];if(typeof y=="string")return String(y)}}}return u instanceof Error?u.message:c},[c]);return{getErrorCode:f.useCallback(u=>{const{response:i}=u||{};return i?.error_code?String(i?.error_code):i?.data?.error_code?String(i?.data?.error_code):i?.error_code?String(i?.error_code):i?.data?.error_code?String(i.data.error_code):"unknown_error_code"},[]),printError:d}},je=({data:e,fetchNextPage:n,isFetchingNextPage:o,isInitialLoading:a,isLoading:r,enabled:s=!0})=>{const c=f.useCallback(async l=>{o||!s||await n({pageParam:l?.pageParam||l.visibleRowsCount})},[s,n,o]),d=f.useMemo(()=>{if(e)return e.pages.reduce((l,u)=>[...l,...u],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:o||r,loadingVariant:a?"skeleton":"linear-progress",rows:d}},_e=e=>{const{libraries:n}=f.useContext(A),o=e?.axios||n?.axios,a=e?.localStorageKey||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const r=f.useCallback(({tokenType:c,accessToken:d})=>{o.defaults.headers.common.Authorization=`${c} ${d}`},[o.defaults.headers.common]),s=()=>{o.defaults.headers.common.Authorization=null};return f.useEffect(()=>{if(D)return;const c=({newValue:d,key:l})=>{if(l===a&&d)try{const{accessToken:u,tokenType:i}=JSON.parse(d);r({accessToken:u,tokenType:i})}catch(u){console.error("Failed to parse newValue from localStorage:",u)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}},[a,r]),{clearAuthenticationToken:s,setAuthenticationToken:r}},B=({library:e,date:n,format:o="ll"})=>e(n).format(o),H=(e,n)=>{const{fractionDigits:o=0,metric:a="km",spacingBetween:r=!0}=n||{},s=Number(e),c=r?" ":"";return Number.isNaN(s)?`0${c}${a}`:`${s.toFixed(o)}${c}${a}`},X=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),Pe=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Te=({path:e,size:n,apiURL:o})=>{if(!e)return"";const a=Pe(e),r=`${o}${a}`,s=r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof n=="number"&&s?`${r.replace("/files",`/thumbs/${n}`)}`:r},ke=e=>{const{apiURL:n,libraries:o}=f.useContext(A),a=e?.dayjs||o?.dayjs;return{dateAdapter:(c,d)=>{if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return B({date:c,format:d,library:a})},distanceAdapter:H,filePathAdapter:(c,d)=>{if(!n)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return typeof c=="string"&&/^https?:\/\//.test(c)?c:Te({apiURL:n,path:c,size:d})},worksiteNameAdapter:X}},W=(e,n)=>n==="short"?e.split("-")[0]:e,Ie=(e,n="full")=>{const[o,a]=f.useState(()=>{const r=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,W(r,n)});return f.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(W(e.language,n));const r=s=>{a(W(s,n))};return e?.on?.("languageChanged",r),()=>{e?.off?.("languageChanged",r)}},[e,n]),o},Oe="tracktor.filter",xe={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},Z=(e,n,o)=>`${o}_${e}=>${n}`,Ne=e=>e.reduce((n,o)=>{const a=localStorage.getItem(o);if(a)try{const r=JSON.parse(a),s=Object.keys(r)?.[0];s&&(n[s]=Object.values(r)?.[0])}catch{}return n},{}),Le=e=>{const{libraries:n,localStorageKeys:o}=f.useContext(A),a=e?.reactRouter||n?.reactRouter,{pathname:r}=a?.useLocation?.()??{pathname:"/"},[s,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],[d,l]=f.useState({}),u=o?.filter||Oe,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl;if(D)return xe;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const E=()=>Object.keys(localStorage).filter(h=>h.startsWith(u)&&h.endsWith(e?.pathname||r)),y=(h,v,_=!0)=>{const m=Z(h,e?.pathname||r,u);if(!v||Array.isArray(v)&&!v.length){i?(s.delete(h),c(s)):l(b=>{const P={...b};return delete P[h],P}),localStorage.removeItem(m);return}_&&v&&localStorage.setItem(m,JSON.stringify({...s,[h]:v})),i&&v?(s.set(h,JSON.stringify(v)),c(s)):!i&&v&&l(b=>({...b,[h]:v}))};return{getFilter:(h,v)=>{if(!i){const b=d[h];if(b!==void 0)return b}if(i){const b=s.get(h);if(b)try{return JSON.parse(b)}catch{return b}}const _=Z(h,e?.pathname||r,u),m=localStorage.getItem(_);if(m)try{const b=JSON.parse(m)[h];return!i&&b!==void 0&&l(P=>({...P,[h]:b})),b}catch{}return v},getFilters:()=>{const h=E(),v=Ne(h);if(i){const _=Object.fromEntries(s.entries());return{...v,..._}}return{...v,...d}},handleFilter:(h,v)=>(_,m)=>{if(m||Array.isArray(m)&&m.length===0){const b=v||"value",P=typeof m=="object"&&b in m?m[b]:m;y(h,P);return}y(h,void 0)},setFilter:y}},Fe=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),De=e=>{const a=e.split("/").filter(r=>r.length>0).map(r=>r.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return a.charAt(0).toLowerCase()+a.slice(1)},Ye=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),We=(e,n,o,a)=>{const r=De(n),s=Fe(o),c=`${r}${s}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},ze=(e,n)=>{const o={};return e?.forEach(a=>{o[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),n?.filter(a=>!o[a]).forEach(a=>{o[a]={query:{useQuery:!0}}}),Object.keys(o).length?o:void 0},Ue=e=>(Array.isArray(e)?e:[e]).reduce((o,a)=>{const{output:r,useInfiniteIds:s,useQueryIds:c,input:d="./openapi.json"}=a||{},l=Ye(d);return{...o,[l]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:d,output:{baseUrl:r?.baseUrl,client:"react-query",mode:"tags-split",override:{...(s?.length||c?.length)&&{operations:ze(s,c)},header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:a?.customAxiosInstancePath||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(u,i,E)=>We(u,i,E,c),query:{useQuery:!0}},schemas:r?.schemas||`src/api/${l}/model`,target:r?.target||`src/api/${l}/services/api.ts`,...r}}}},{});g.GTMSendPageView=fe,g.InitializeAxiosConfig=ge,g.InitializeDaysJSConfig=ve,g.InitializeI18nConfig=me,g.InitializeSentryConfig=ye,g.InjectDependenciesContext=A,g.InjectDependenciesProvider=le,g.MaskTextField=he,g.PreloadErrorHandler=Ee,g.QueryClientProviderWithConfig=Ae,g.RequireAuth=de,g.UpdateNotifier=be,g.axiosCustomInstance=ae,g.dateAdapter=B,g.distanceAdapter=H,g.getOrvalConfig=Ue,g.useAdapter=ke,g.useAuth=_e,g.useCurrentLanguage=Ie,g.useFilters=Le,g.useInfiniteDataGrid=je,g.useResponseError=Ce,g.worksiteNameAdapter=X,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|