@tracktor/shared-module 2.3.3 → 2.4.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/CHANGELOG.md +2 -2
- package/dist/components/Utils/GTMSendPageView.d.ts +6 -1
- package/dist/main.js +75 -68
- package/dist/main.umd.cjs +7 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,11 +8,16 @@ export interface GTMSendPageViewProps {
|
|
|
8
8
|
* React Router library
|
|
9
9
|
*/
|
|
10
10
|
reactRouter?: NonNullable<InjectDependenciesContextProps["libraries"]>["reactRouter"];
|
|
11
|
+
/**
|
|
12
|
+
* Data to send to GTM
|
|
13
|
+
*/
|
|
14
|
+
data?: object;
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
13
17
|
* This component send page view to Google Tag Manager
|
|
18
|
+
* @param data
|
|
14
19
|
* @param props
|
|
15
20
|
* @constructor
|
|
16
21
|
*/
|
|
17
|
-
declare const GTMSendPageView: ({ ...props }: GTMSendPageViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare const GTMSendPageView: ({ data, ...props }: GTMSendPageViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
23
|
export default GTMSendPageView;
|
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Ye, { createContext as gt, useMemo as le, useContext as D, useState as We, useRef as mt, useEffect as
|
|
1
|
+
import Ye, { createContext as gt, useMemo as le, useContext as D, useState as We, useRef as mt, useEffect as z, Suspense as ht, useCallback as ee } from "react";
|
|
2
2
|
var ce = { exports: {} }, G = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -14,9 +14,9 @@ function yt() {
|
|
|
14
14
|
if (Fe) return G;
|
|
15
15
|
Fe = 1;
|
|
16
16
|
var t = Ye, n = Symbol.for("react.element"), o = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
-
function l(d, c,
|
|
17
|
+
function l(d, c, g) {
|
|
18
18
|
var y, w = {}, R = null, u = null;
|
|
19
|
-
|
|
19
|
+
g !== void 0 && (R = "" + g), c.key !== void 0 && (R = "" + c.key), c.ref !== void 0 && (u = c.ref);
|
|
20
20
|
for (y in c) s.call(c, y) && !f.hasOwnProperty(y) && (w[y] = c[y]);
|
|
21
21
|
if (d && d.defaultProps) for (y in c = d.defaultProps, c) w[y] === void 0 && (w[y] = c[y]);
|
|
22
22
|
return { $$typeof: n, type: d, key: R, ref: u, props: w, _owner: i.current };
|
|
@@ -36,7 +36,7 @@ var Q = {};
|
|
|
36
36
|
var Le;
|
|
37
37
|
function Et() {
|
|
38
38
|
return Le || (Le = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
-
var t = Ye, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), d = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"),
|
|
39
|
+
var t = Ye, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), d = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), u = Symbol.for("react.offscreen"), j = Symbol.iterator, T = "@@iterator";
|
|
40
40
|
function x(e) {
|
|
41
41
|
if (e === null || typeof e != "object")
|
|
42
42
|
return null;
|
|
@@ -64,13 +64,13 @@ function Et() {
|
|
|
64
64
|
var N = !1, Y = !1, b = !1, fe = !1, de = !1, U;
|
|
65
65
|
U = Symbol.for("react.module.reference");
|
|
66
66
|
function Me(e) {
|
|
67
|
-
return !!(typeof e == "string" || typeof e == "function" || e === s || e === f || de || e === i || e ===
|
|
67
|
+
return !!(typeof e == "string" || typeof e == "function" || e === s || e === f || de || e === i || e === g || e === y || fe || e === u || N || Y || b || typeof e == "object" && e !== null && (e.$$typeof === R || e.$$typeof === w || e.$$typeof === l || e.$$typeof === d || e.$$typeof === c || // This needs to include all possible module reference object
|
|
68
68
|
// types supported by any Flight configuration anywhere since
|
|
69
69
|
// we don't know which Flight build this will end up being used
|
|
70
70
|
// with.
|
|
71
71
|
e.$$typeof === U || e.getModuleId !== void 0));
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function Ve(e, r, a) {
|
|
74
74
|
var v = e.displayName;
|
|
75
75
|
if (v)
|
|
76
76
|
return v;
|
|
@@ -96,7 +96,7 @@ function Et() {
|
|
|
96
96
|
return "Profiler";
|
|
97
97
|
case i:
|
|
98
98
|
return "StrictMode";
|
|
99
|
-
case
|
|
99
|
+
case g:
|
|
100
100
|
return "Suspense";
|
|
101
101
|
case y:
|
|
102
102
|
return "SuspenseList";
|
|
@@ -110,7 +110,7 @@ function Et() {
|
|
|
110
110
|
var a = e;
|
|
111
111
|
return ve(a._context) + ".Provider";
|
|
112
112
|
case c:
|
|
113
|
-
return
|
|
113
|
+
return Ve(e, e.render, "ForwardRef");
|
|
114
114
|
case w:
|
|
115
115
|
var v = e.displayName || null;
|
|
116
116
|
return v !== null ? v : I(e.type) || "Memo";
|
|
@@ -129,7 +129,7 @@ function Et() {
|
|
|
129
129
|
function we() {
|
|
130
130
|
}
|
|
131
131
|
we.__reactDisabledLog = !0;
|
|
132
|
-
function
|
|
132
|
+
function ze() {
|
|
133
133
|
{
|
|
134
134
|
if (q === 0) {
|
|
135
135
|
ge = console.log, me = console.info, he = console.warn, ye = console.error, Ee = console.group, pe = console.groupCollapsed, Re = console.groupEnd;
|
|
@@ -219,7 +219,7 @@ function Et() {
|
|
|
219
219
|
var E = Error.prepareStackTrace;
|
|
220
220
|
Error.prepareStackTrace = void 0;
|
|
221
221
|
var p;
|
|
222
|
-
p = te.current, te.current = null,
|
|
222
|
+
p = te.current, te.current = null, ze();
|
|
223
223
|
try {
|
|
224
224
|
if (r) {
|
|
225
225
|
var h = function() {
|
|
@@ -254,17 +254,17 @@ function Et() {
|
|
|
254
254
|
}
|
|
255
255
|
} catch ($) {
|
|
256
256
|
if ($ && v && typeof $.stack == "string") {
|
|
257
|
-
for (var
|
|
257
|
+
for (var m = $.stack.split(`
|
|
258
258
|
`), S = v.stack.split(`
|
|
259
|
-
`), C =
|
|
259
|
+
`), C = m.length - 1, P = S.length - 1; C >= 1 && P >= 0 && m[C] !== S[P]; )
|
|
260
260
|
P--;
|
|
261
261
|
for (; C >= 1 && P >= 0; C--, P--)
|
|
262
|
-
if (
|
|
262
|
+
if (m[C] !== S[P]) {
|
|
263
263
|
if (C !== 1 || P !== 1)
|
|
264
264
|
do
|
|
265
|
-
if (C--, P--, P < 0 ||
|
|
265
|
+
if (C--, P--, P < 0 || m[C] !== S[P]) {
|
|
266
266
|
var O = `
|
|
267
|
-
` +
|
|
267
|
+
` + m[C].replace(" at new ", " at ");
|
|
268
268
|
return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && K.set(e, O), O;
|
|
269
269
|
}
|
|
270
270
|
while (C >= 1 && P >= 0);
|
|
@@ -274,7 +274,7 @@ function Et() {
|
|
|
274
274
|
} finally {
|
|
275
275
|
ne = !1, te.current = p, Ue(), Error.prepareStackTrace = E;
|
|
276
276
|
}
|
|
277
|
-
var
|
|
277
|
+
var V = e ? e.displayName || e.name : "", $e = V ? J(V) : "";
|
|
278
278
|
return typeof e == "function" && K.set(e, $e), $e;
|
|
279
279
|
}
|
|
280
280
|
function Be(e, r, a) {
|
|
@@ -292,7 +292,7 @@ function Et() {
|
|
|
292
292
|
if (typeof e == "string")
|
|
293
293
|
return J(e);
|
|
294
294
|
switch (e) {
|
|
295
|
-
case
|
|
295
|
+
case g:
|
|
296
296
|
return J("Suspense");
|
|
297
297
|
case y:
|
|
298
298
|
return J("SuspenseList");
|
|
@@ -326,17 +326,17 @@ function Et() {
|
|
|
326
326
|
var p = Function.call.bind(H);
|
|
327
327
|
for (var h in e)
|
|
328
328
|
if (p(e, h)) {
|
|
329
|
-
var
|
|
329
|
+
var m = void 0;
|
|
330
330
|
try {
|
|
331
331
|
if (typeof e[h] != "function") {
|
|
332
332
|
var S = Error((v || "React class") + ": " + a + " type `" + h + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[h] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
333
333
|
throw S.name = "Invariant Violation", S;
|
|
334
334
|
}
|
|
335
|
-
|
|
335
|
+
m = e[h](r, h, v, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
336
336
|
} catch (C) {
|
|
337
|
-
|
|
337
|
+
m = C;
|
|
338
338
|
}
|
|
339
|
-
|
|
339
|
+
m && !(m instanceof Error) && (Z(E), _("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", v || "React class", a, h, typeof m), Z(null)), m instanceof Error && !(m.message in Ce) && (Ce[m.message] = !0, Z(E), _("Failed %s type: %s", a, m.message), Z(null));
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
}
|
|
@@ -416,7 +416,7 @@ function Et() {
|
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
var ot = function(e, r, a, v, E, p, h) {
|
|
419
|
-
var
|
|
419
|
+
var m = {
|
|
420
420
|
// This tag allows us to uniquely identify this as a React Element
|
|
421
421
|
$$typeof: n,
|
|
422
422
|
// Built-in properties that belong on the element
|
|
@@ -427,27 +427,27 @@ function Et() {
|
|
|
427
427
|
// Record the component responsible for creating this element.
|
|
428
428
|
_owner: p
|
|
429
429
|
};
|
|
430
|
-
return
|
|
430
|
+
return m._store = {}, Object.defineProperty(m._store, "validated", {
|
|
431
431
|
configurable: !1,
|
|
432
432
|
enumerable: !1,
|
|
433
433
|
writable: !0,
|
|
434
434
|
value: !1
|
|
435
|
-
}), Object.defineProperty(
|
|
435
|
+
}), Object.defineProperty(m, "_self", {
|
|
436
436
|
configurable: !1,
|
|
437
437
|
enumerable: !1,
|
|
438
438
|
writable: !1,
|
|
439
439
|
value: v
|
|
440
|
-
}), Object.defineProperty(
|
|
440
|
+
}), Object.defineProperty(m, "_source", {
|
|
441
441
|
configurable: !1,
|
|
442
442
|
enumerable: !1,
|
|
443
443
|
writable: !1,
|
|
444
444
|
value: E
|
|
445
|
-
}), Object.freeze && (Object.freeze(
|
|
445
|
+
}), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m;
|
|
446
446
|
};
|
|
447
447
|
function at(e, r, a, v, E) {
|
|
448
448
|
{
|
|
449
|
-
var p, h = {},
|
|
450
|
-
a !== void 0 && (je(a),
|
|
449
|
+
var p, h = {}, m = null, S = null;
|
|
450
|
+
a !== void 0 && (je(a), m = "" + a), et(r) && (je(r.key), m = "" + r.key), Ze(r) && (S = r.ref, tt(r, E));
|
|
451
451
|
for (p in r)
|
|
452
452
|
H.call(r, p) && !He.hasOwnProperty(p) && (h[p] = r[p]);
|
|
453
453
|
if (e && e.defaultProps) {
|
|
@@ -455,11 +455,11 @@ function Et() {
|
|
|
455
455
|
for (p in C)
|
|
456
456
|
h[p] === void 0 && (h[p] = C[p]);
|
|
457
457
|
}
|
|
458
|
-
if (
|
|
458
|
+
if (m || S) {
|
|
459
459
|
var P = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
460
|
-
|
|
460
|
+
m && rt(h, P), S && nt(h, P);
|
|
461
461
|
}
|
|
462
|
-
return ot(e,
|
|
462
|
+
return ot(e, m, S, E, v, B.current, h);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
var ie = k.ReactCurrentOwner, Te = k.ReactDebugCurrentFrame;
|
|
@@ -576,12 +576,12 @@ Check the top-level render call using <` + a + ">.");
|
|
|
576
576
|
{
|
|
577
577
|
var h = Me(e);
|
|
578
578
|
if (!h) {
|
|
579
|
-
var
|
|
580
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
579
|
+
var m = "";
|
|
580
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (m += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
581
581
|
var S = it();
|
|
582
|
-
S ?
|
|
582
|
+
S ? m += S : m += Oe();
|
|
583
583
|
var C;
|
|
584
|
-
e === null ? C = "null" : oe(e) ? C = "array" : e !== void 0 && e.$$typeof === n ? (C = "<" + (I(e.type) || "Unknown") + " />",
|
|
584
|
+
e === null ? C = "null" : oe(e) ? C = "array" : e !== void 0 && e.$$typeof === n ? (C = "<" + (I(e.type) || "Unknown") + " />", m = " Did you accidentally export a JSX literal instead of a component?") : C = typeof e, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", C, m);
|
|
585
585
|
}
|
|
586
586
|
var P = at(e, r, a, E, p);
|
|
587
587
|
if (P == null)
|
|
@@ -591,8 +591,8 @@ Check the top-level render call using <` + a + ">.");
|
|
|
591
591
|
if (O !== void 0)
|
|
592
592
|
if (v)
|
|
593
593
|
if (oe(O)) {
|
|
594
|
-
for (var
|
|
595
|
-
De(O[
|
|
594
|
+
for (var V = 0; V < O.length; V++)
|
|
595
|
+
De(O[V], e);
|
|
596
596
|
Object.freeze && Object.freeze(O);
|
|
597
597
|
} else
|
|
598
598
|
_("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
@@ -635,8 +635,8 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
635
635
|
const { libraries: l } = D(A), d = (f == null ? void 0 : f.reactRouter) || (l == null ? void 0 : l.reactRouter), c = (f == null ? void 0 : f.axios) || (l == null ? void 0 : l.axios);
|
|
636
636
|
if (!d)
|
|
637
637
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
638
|
-
const [
|
|
639
|
-
return
|
|
638
|
+
const [g, y] = We(null), { useLocation: w, Navigate: R, Outlet: u } = d, j = w(), T = mt(!1), x = typeof n == "function" ? n() : !!n, k = typeof x == "boolean" ? x : x == null ? void 0 : x.isLogged;
|
|
639
|
+
return z(() => {
|
|
640
640
|
T.current || (T.current = !0, c.interceptors.response.use(
|
|
641
641
|
(b) => b,
|
|
642
642
|
async (b) => {
|
|
@@ -644,19 +644,23 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
644
644
|
return typeof b == "object" && b && "response" in b && b.response && typeof b.response == "object" && "status" in b.response && b.response && typeof b.response == "object" && "status" in b.response && ((U = b == null ? void 0 : b.response) == null ? void 0 : U.status) === 401 && (c.defaults.headers.common.Authorization = null, localStorage.removeItem(s), y(i)), Promise.reject(b);
|
|
645
645
|
}
|
|
646
646
|
));
|
|
647
|
-
}, [c.defaults.headers.common, c.interceptors.response, s, i]), k && !
|
|
648
|
-
}, Dt = ({
|
|
649
|
-
const { libraries:
|
|
650
|
-
if (!
|
|
647
|
+
}, [c.defaults.headers.common, c.interceptors.response, s, i]), k && !g ? /* @__PURE__ */ F.jsx(ht, { fallback: t, children: (L = (_ = j.state) == null ? void 0 : _.from) != null && L.state && ((Y = (N = j.state) == null ? void 0 : N.from) == null ? void 0 : Y.pathname) === o ? /* @__PURE__ */ F.jsx(R, { to: j.state.from.state.from.pathname + j.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ F.jsx(u, {}) }) : /* @__PURE__ */ F.jsx(R, { to: o + j.search, state: { from: j }, replace: !0 });
|
|
648
|
+
}, Dt = ({ data: t, ...n }) => {
|
|
649
|
+
const { libraries: o } = D(A), s = (n == null ? void 0 : n.reactRouter) || (o == null ? void 0 : o.reactRouter), i = (n == null ? void 0 : n.gtm) || (o == null ? void 0 : o.gtm);
|
|
650
|
+
if (!s)
|
|
651
651
|
throw new Error(
|
|
652
652
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
653
653
|
);
|
|
654
|
-
if (!
|
|
654
|
+
if (!i)
|
|
655
655
|
throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
|
|
656
|
-
const { useGoogleTagManager:
|
|
657
|
-
return
|
|
658
|
-
|
|
659
|
-
|
|
656
|
+
const { useGoogleTagManager: f } = i, { useLocation: l, Outlet: d } = s, { pathname: c } = l(), { sendEvent: g } = f();
|
|
657
|
+
return z(() => {
|
|
658
|
+
g({
|
|
659
|
+
event: "pageView",
|
|
660
|
+
pathname: c,
|
|
661
|
+
...t
|
|
662
|
+
});
|
|
663
|
+
}, [t, c, g]), /* @__PURE__ */ F.jsx(d, {});
|
|
660
664
|
}, It = ({
|
|
661
665
|
tokenTypeKey: t = "tokenType",
|
|
662
666
|
userLocalStorageKey: n = "user",
|
|
@@ -669,7 +673,7 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
669
673
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
670
674
|
if (!(d != null && d.defaults))
|
|
671
675
|
return null;
|
|
672
|
-
const c = localStorage.getItem(n),
|
|
676
|
+
const c = localStorage.getItem(n), g = c ? JSON.parse(c) : null, y = g != null && g[t] ? g[t] : null, w = g != null && g[o] ? g[o] : null, R = c ? `${y} ${w}` : null;
|
|
673
677
|
return d.defaults.baseURL = f, d.defaults.headers.post["Content-Type"] = s, R && (d.defaults.headers.common.Authorization = R), null;
|
|
674
678
|
}, $t = ({ debug: t, resources: n, ...o }) => {
|
|
675
679
|
const { libraries: s } = D(A), i = (o == null ? void 0 : o.i18) || (s == null ? void 0 : s.i18), { i18next: f, initReactI18next: l, languageDetector: d } = i || {};
|
|
@@ -703,9 +707,9 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
703
707
|
ignoreErrors: l,
|
|
704
708
|
debug: d,
|
|
705
709
|
environment: c,
|
|
706
|
-
...
|
|
710
|
+
...g
|
|
707
711
|
}) => {
|
|
708
|
-
const { libraries: y } = D(A), w = (
|
|
712
|
+
const { libraries: y } = D(A), w = (g == null ? void 0 : g.sentry) || (y == null ? void 0 : y.sentry), R = (g == null ? void 0 : g.reactRouter) || (y == null ? void 0 : y.reactRouter);
|
|
709
713
|
if (!w)
|
|
710
714
|
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
711
715
|
if (!R)
|
|
@@ -722,7 +726,7 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
722
726
|
w.reactRouterV6BrowserTracingIntegration({
|
|
723
727
|
createRoutesFromChildren: u,
|
|
724
728
|
matchRoutes: j,
|
|
725
|
-
useEffect:
|
|
729
|
+
useEffect: z,
|
|
726
730
|
useLocation: T,
|
|
727
731
|
useNavigationType: x
|
|
728
732
|
}),
|
|
@@ -751,7 +755,7 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
751
755
|
throw new Error(
|
|
752
756
|
"Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
|
|
753
757
|
);
|
|
754
|
-
return
|
|
758
|
+
return z(() => {
|
|
755
759
|
(async () => {
|
|
756
760
|
var d;
|
|
757
761
|
const l = t || ((d = navigator.language) == null ? void 0 : d.slice(0, 2)) || "en";
|
|
@@ -766,8 +770,8 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
766
770
|
defaultMutationsOptions: o,
|
|
767
771
|
...s
|
|
768
772
|
}) => {
|
|
769
|
-
var c,
|
|
770
|
-
const { libraries: i } = D(A), f = (s == null ? void 0 : s.QueryClient) || ((c = i == null ? void 0 : i.reactQuery) == null ? void 0 : c.QueryClient), l = (s == null ? void 0 : s.QueryClientProvider) || ((
|
|
773
|
+
var c, g;
|
|
774
|
+
const { libraries: i } = D(A), f = (s == null ? void 0 : s.QueryClient) || ((c = i == null ? void 0 : i.reactQuery) == null ? void 0 : c.QueryClient), l = (s == null ? void 0 : s.QueryClientProvider) || ((g = i == null ? void 0 : i.reactQuery) == null ? void 0 : g.QueryClientProvider);
|
|
771
775
|
if (!f)
|
|
772
776
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
773
777
|
if (!l)
|
|
@@ -791,8 +795,8 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
791
795
|
});
|
|
792
796
|
return /* @__PURE__ */ F.jsx(l, { client: d, children: t });
|
|
793
797
|
}, Mt = (t) => {
|
|
794
|
-
var
|
|
795
|
-
const { libraries: n } = D(A), o = (t == null ? void 0 : t.i18) || (n == null ? void 0 : n.i18), s = ((
|
|
798
|
+
var g, y, w;
|
|
799
|
+
const { libraries: n } = D(A), o = (t == null ? void 0 : t.i18) || (n == null ? void 0 : n.i18), s = ((g = t == null ? void 0 : t.i18) == null ? void 0 : g.translateFunction) || ((y = n == null ? void 0 : n.i18) == null ? void 0 : y.translateFunction), i = ((w = o == null ? void 0 : o.i18next) == null ? void 0 : w.t) || s || ((R) => R), { unknownErrorTranslationKey: f = "error.unknownError" } = t || {}, l = i(f), d = ee(
|
|
796
800
|
(R) => {
|
|
797
801
|
var j, T, x, k, _, L, N, Y, b;
|
|
798
802
|
const { response: u } = R || {};
|
|
@@ -805,7 +809,7 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
805
809
|
const { response: u } = R || {};
|
|
806
810
|
return u != null && u.error_code ? String(u == null ? void 0 : u.error_code) : (j = u == null ? void 0 : u.data) != null && j.error_code ? String((T = u == null ? void 0 : u.data) == null ? void 0 : T.error_code) : u != null && u.error_code ? String(u == null ? void 0 : u.error_code) : (x = u == null ? void 0 : u.data) != null && x.error_code ? String(u.data.error_code) : "unknown_error_code";
|
|
807
811
|
}, []), printError: d };
|
|
808
|
-
},
|
|
812
|
+
}, Vt = ({
|
|
809
813
|
data: t,
|
|
810
814
|
fetchNextPage: n,
|
|
811
815
|
isFetchingNextPage: o,
|
|
@@ -820,7 +824,7 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
820
824
|
[f, n, o]
|
|
821
825
|
), d = le(() => {
|
|
822
826
|
if (t)
|
|
823
|
-
return t.pages.reduce((c,
|
|
827
|
+
return t.pages.reduce((c, g) => [...c, ...g], []);
|
|
824
828
|
}, [t]);
|
|
825
829
|
return {
|
|
826
830
|
fetchNextPageOnRowsScrollEnd: l,
|
|
@@ -828,7 +832,7 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
828
832
|
loadingVariant: s ? "skeleton" : "linear",
|
|
829
833
|
rows: d
|
|
830
834
|
};
|
|
831
|
-
},
|
|
835
|
+
}, zt = (t) => {
|
|
832
836
|
const { libraries: n } = D(A), o = (t == null ? void 0 : t.axios) || (n == null ? void 0 : n.axios), s = (t == null ? void 0 : t.localStorageKey) || "user";
|
|
833
837
|
if (!o)
|
|
834
838
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
@@ -840,12 +844,15 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
840
844
|
), f = () => {
|
|
841
845
|
o.defaults.headers.common.Authorization = null;
|
|
842
846
|
};
|
|
843
|
-
return
|
|
847
|
+
return z(() => {
|
|
844
848
|
const l = ({ newValue: d, key: c }) => {
|
|
845
|
-
if (c === s)
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
+
if (c === s && d)
|
|
850
|
+
try {
|
|
851
|
+
const { accessToken: g, tokenType: y } = JSON.parse(d);
|
|
852
|
+
i({ accessToken: g, tokenType: y });
|
|
853
|
+
} catch (g) {
|
|
854
|
+
console.error("Failed to parse newValue from localStorage:", g);
|
|
855
|
+
}
|
|
849
856
|
};
|
|
850
857
|
return window.addEventListener("storage", l), () => {
|
|
851
858
|
window.removeEventListener("storage", l);
|
|
@@ -889,7 +896,7 @@ const A = gt({}), At = ({ children: t, apiURL: n, libraries: o }) => {
|
|
|
889
896
|
};
|
|
890
897
|
}, Ne = (t, n) => n === "short" ? t.split("-")[0] : t, qt = (t, n = "full") => {
|
|
891
898
|
const [o, s] = We(() => Ne((t == null ? void 0 : t.language) || navigator.language, n));
|
|
892
|
-
return
|
|
899
|
+
return z(() => {
|
|
893
900
|
var f;
|
|
894
901
|
const i = (l) => {
|
|
895
902
|
s(Ne(l, n));
|
|
@@ -970,8 +977,8 @@ export {
|
|
|
970
977
|
Bt as getOrvalConfig,
|
|
971
978
|
Gt as handleImportModuleError,
|
|
972
979
|
Ut as useAdapter,
|
|
973
|
-
|
|
980
|
+
zt as useAuth,
|
|
974
981
|
qt as useCurrentLanguage,
|
|
975
|
-
|
|
982
|
+
Vt as useInfiniteDataGrid,
|
|
976
983
|
Mt as useResponseError
|
|
977
984
|
};
|
package/dist/main.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(p,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],h):(p=typeof globalThis<"u"?globalThis:p||self,h(p["@tracktor/shared-module"]={},p.React))})(this,function(p,h){"use strict";var ee={exports:{}},B={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ue;function Ye(){if(ue)return B;ue=1;var t=
|
|
9
|
+
*/var ue;function Ye(){if(ue)return B;ue=1;var t=h,n=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function l(d,u,g){var E,_={},C=null,c=null;g!==void 0&&(C=""+g),u.key!==void 0&&(C=""+u.key),u.ref!==void 0&&(c=u.ref);for(E in u)s.call(u,E)&&!f.hasOwnProperty(E)&&(_[E]=u[E]);if(d&&d.defaultProps)for(E in u=d.defaultProps,u)_[E]===void 0&&(_[E]=u[E]);return{$$typeof:n,type:d,key:C,ref:c,props:_,_owner:i.current}}return B.Fragment=o,B.jsx=l,B.jsxs=l,B}var G={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var le;function Me(){return le||(le=1,process.env.NODE_ENV!=="production"&&function(){var t=
|
|
18
|
-
`+re+e}}var ne=!1,H;{var yt=typeof WeakMap=="function"?WeakMap:Map;H=new yt}function Pe(e,r){if(!e||ne)return"";{var a=H.get(e);if(a!==void 0)return a}var v;ne=!0;var R=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var w;w=te.current,te.current=null,mt();try{if(r){var y=function(){throw Error()};if(Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(N){v=N}Reflect.construct(e,[],y)}else{try{y.call()}catch(N){v=N}e.call(y.prototype)}}else{try{throw Error()}catch(N){v=N}e()}}catch(N){if(N&&v&&typeof N.stack=="string"){for(var
|
|
17
|
+
*/var le;function Me(){return le||(le=1,process.env.NODE_ENV!=="production"&&function(){var t=h,n=Symbol.for("react.element"),o=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),d=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),c=Symbol.for("react.offscreen"),T=Symbol.iterator,k="@@iterator";function x(e){if(e===null||typeof e!="object")return null;var r=T&&e[T]||e[k];return typeof r=="function"?r:null}var D=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(e){{for(var r=arguments.length,a=new Array(r>1?r-1:0),v=1;v<r;v++)a[v-1]=arguments[v];W("error",e,a)}}function W(e,r,a){{var v=D.ReactDebugCurrentFrame,R=v.getStackAddendum();R!==""&&(r+="%s",a=a.concat([R]));var w=a.map(function(y){return String(y)});w.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,w)}}var Y=!1,M=!1,j=!1,ge=!1,me=!1,Q;Q=Symbol.for("react.module.reference");function vt(e){return!!(typeof e=="string"||typeof e=="function"||e===s||e===f||me||e===i||e===g||e===E||ge||e===c||Y||M||j||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===_||e.$$typeof===l||e.$$typeof===d||e.$$typeof===u||e.$$typeof===Q||e.getModuleId!==void 0))}function gt(e,r,a){var v=e.displayName;if(v)return v;var R=r.displayName||r.name||"";return R!==""?a+"("+R+")":a}function he(e){return e.displayName||"Context"}function L(e){if(e==null)return null;if(typeof e.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case s:return"Fragment";case o:return"Portal";case f:return"Profiler";case i:return"StrictMode";case g:return"Suspense";case E:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case d:var r=e;return he(r)+".Consumer";case l:var a=e;return he(a._context)+".Provider";case u:return gt(e,e.render,"ForwardRef");case _:var v=e.displayName||null;return v!==null?v:L(e.type)||"Memo";case C:{var R=e,w=R._payload,y=R._init;try{return L(y(w))}catch{return null}}}return null}var z=Object.assign,J=0,ye,Ee,Re,we,pe,Ce,_e;function be(){}be.__reactDisabledLog=!0;function mt(){{if(J===0){ye=console.log,Ee=console.info,Re=console.warn,we=console.error,pe=console.group,Ce=console.groupCollapsed,_e=console.groupEnd;var e={configurable:!0,enumerable:!0,value:be,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}J++}}function ht(){{if(J--,J===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:ye}),info:z({},e,{value:Ee}),warn:z({},e,{value:Re}),error:z({},e,{value:we}),group:z({},e,{value:pe}),groupCollapsed:z({},e,{value:Ce}),groupEnd:z({},e,{value:_e})})}J<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=D.ReactCurrentDispatcher,re;function X(e,r,a){{if(re===void 0)try{throw Error()}catch(R){var v=R.stack.trim().match(/\n( *(at )?)/);re=v&&v[1]||""}return`
|
|
18
|
+
`+re+e}}var ne=!1,H;{var yt=typeof WeakMap=="function"?WeakMap:Map;H=new yt}function Pe(e,r){if(!e||ne)return"";{var a=H.get(e);if(a!==void 0)return a}var v;ne=!0;var R=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var w;w=te.current,te.current=null,mt();try{if(r){var y=function(){throw Error()};if(Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(N){v=N}Reflect.construct(e,[],y)}else{try{y.call()}catch(N){v=N}e.call(y.prototype)}}else{try{throw Error()}catch(N){v=N}e()}}catch(N){if(N&&v&&typeof N.stack=="string"){for(var m=N.stack.split(`
|
|
19
19
|
`),O=v.stack.split(`
|
|
20
|
-
`),P=
|
|
21
|
-
`+
|
|
20
|
+
`),P=m.length-1,S=O.length-1;P>=1&&S>=0&&m[P]!==O[S];)S--;for(;P>=1&&S>=0;P--,S--)if(m[P]!==O[S]){if(P!==1||S!==1)do if(P--,S--,S<0||m[P]!==O[S]){var I=`
|
|
21
|
+
`+m[P].replace(" at new "," at ");return e.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",e.displayName)),typeof e=="function"&&H.set(e,I),I}while(P>=1&&S>=0);break}}}finally{ne=!1,te.current=w,ht(),Error.prepareStackTrace=R}var U=e?e.displayName||e.name:"",We=U?X(U):"";return typeof e=="function"&&H.set(e,We),We}function Et(e,r,a){return Pe(e,!1)}function Rt(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function Z(e,r,a){if(e==null)return"";if(typeof e=="function")return Pe(e,Rt(e));if(typeof e=="string")return X(e);switch(e){case g:return X("Suspense");case E:return X("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Et(e.render);case _:return Z(e.type,r,a);case C:{var v=e,R=v._payload,w=v._init;try{return Z(w(R),r,a)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,je={},Se=D.ReactDebugCurrentFrame;function q(e){if(e){var r=e._owner,a=Z(e.type,e._source,r?r.type:null);Se.setExtraStackFrame(a)}else Se.setExtraStackFrame(null)}function wt(e,r,a,v,R){{var w=Function.call.bind($);for(var y in e)if(w(e,y)){var m=void 0;try{if(typeof e[y]!="function"){var O=Error((v||"React class")+": "+a+" type `"+y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw O.name="Invariant Violation",O}m=e[y](r,y,v,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(P){m=P}m&&!(m instanceof Error)&&(q(R),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",v||"React class",a,y,typeof m),q(null)),m instanceof Error&&!(m.message in je)&&(je[m.message]=!0,q(R),b("Failed %s type: %s",a,m.message),q(null))}}}var pt=Array.isArray;function oe(e){return pt(e)}function Ct(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,a=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function _t(e){try{return Te(e),!1}catch{return!0}}function Te(e){return""+e}function xe(e){if(_t(e))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ct(e)),Te(e)}var K=D.ReactCurrentOwner,bt={key:!0,ref:!0,__self:!0,__source:!0},Oe,Ae,ae;ae={};function Pt(e){if($.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function jt(e){if($.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function St(e,r){if(typeof e.ref=="string"&&K.current&&r&&K.current.stateNode!==r){var a=L(K.current.type);ae[a]||(b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',L(K.current.type),e.ref),ae[a]=!0)}}function Tt(e,r){{var a=function(){Oe||(Oe=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function xt(e,r){{var a=function(){Ae||(Ae=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var Ot=function(e,r,a,v,R,w,y){var m={$$typeof:n,type:e,key:r,ref:a,props:y,_owner:w};return m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(m,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(m,"_source",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m};function At(e,r,a,v,R){{var w,y={},m=null,O=null;a!==void 0&&(xe(a),m=""+a),jt(r)&&(xe(r.key),m=""+r.key),Pt(r)&&(O=r.ref,St(r,R));for(w in r)$.call(r,w)&&!bt.hasOwnProperty(w)&&(y[w]=r[w]);if(e&&e.defaultProps){var P=e.defaultProps;for(w in P)y[w]===void 0&&(y[w]=P[w])}if(m||O){var S=typeof e=="function"?e.displayName||e.name||"Unknown":e;m&&Tt(y,S),O&&xt(y,S)}return Ot(e,m,O,R,v,K.current,y)}}var ie=D.ReactCurrentOwner,ke=D.ReactDebugCurrentFrame;function V(e){if(e){var r=e._owner,a=Z(e.type,e._source,r?r.type:null);ke.setExtraStackFrame(a)}else ke.setExtraStackFrame(null)}var se;se=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function Ie(){{if(ie.current){var e=L(ie.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function kt(e){return""}var De={};function It(e){{var r=Ie();if(!r){var a=typeof e=="string"?e:e.displayName||e.name;a&&(r=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+a+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=It(r);if(De[a])return;De[a]=!0;var v="";e&&e._owner&&e._owner!==ie.current&&(v=" It was passed a child from "+L(e._owner.type)+"."),V(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,v),V(null)}}function Le(e,r){{if(typeof e!="object")return;if(oe(e))for(var a=0;a<e.length;a++){var v=e[a];ce(v)&&Fe(v,r)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var R=x(e);if(typeof R=="function"&&R!==e.entries)for(var w=R.call(e),y;!(y=w.next()).done;)ce(y.value)&&Fe(y.value,r)}}}function Dt(e){{var r=e.type;if(r==null||typeof r=="string")return;var a;if(typeof r=="function")a=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===u||r.$$typeof===_))a=r.propTypes;else return;if(a){var v=L(r);wt(a,e.props,"prop",v,e)}else if(r.PropTypes!==void 0&&!se){se=!0;var R=L(r);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ft(e){{for(var r=Object.keys(e.props),a=0;a<r.length;a++){var v=r[a];if(v!=="children"&&v!=="key"){V(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),V(null);break}}e.ref!==null&&(V(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}function Ne(e,r,a,v,R,w){{var y=vt(e);if(!y){var g="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(g+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=kt();O?g+=O:g+=Ie();var P;e===null?P="null":oe(e)?P="array":e!==void 0&&e.$$typeof===n?(P="<"+(L(e.type)||"Unknown")+" />",g=" Did you accidentally export a JSX literal instead of a component?"):P=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,g)}var S=At(e,r,a,R,w);if(S==null)return S;if(y){var I=r.children;if(I!==void 0)if(v)if(oe(I)){for(var U=0;U<I.length;U++)Le(I[U],e);Object.freeze&&Object.freeze(I)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Le(I,e)}return e===s?Ft(S):Dt(S),S}}function Lt(e,r,a){return Ne(e,r,a,!0)}function Nt(e,r,a){return Ne(e,r,a,!1)}var Wt=Nt,Yt=Lt;G.Fragment=s,G.jsx=Wt,G.jsxs=Yt}()),G}process.env.NODE_ENV==="production"?ee.exports=Ye():ee.exports=Me();var F=ee.exports;const A=m.createContext({}),ze=({children:t,apiURL:n,libraries:o})=>{const s=m.useMemo(()=>({apiURL:n,libraries:o}),[n,o]);return F.jsx(A.Provider,{value:s,children:t})},Ve=({Fallback:t,isLogged:n,loginPath:o="/login",localStorageKey:s="user",redirect401Path:i="/login",...f})=>{var b,W,Y,M;const{libraries:l}=m.useContext(A),d=(f==null?void 0:f.reactRouter)||(l==null?void 0:l.reactRouter),u=(f==null?void 0:f.axios)||(l==null?void 0:l.axios);if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[h,E]=m.useState(null),{useLocation:_,Navigate:p,Outlet:c}=d,T=_(),k=m.useRef(!1),x=typeof n=="function"?n():!!n,D=typeof x=="boolean"?x:x==null?void 0:x.isLogged;return m.useEffect(()=>{k.current||(k.current=!0,u.interceptors.response.use(j=>j,async j=>{var Q;return typeof j=="object"&&j&&"response"in j&&j.response&&typeof j.response=="object"&&"status"in j.response&&j.response&&typeof j.response=="object"&&"status"in j.response&&((Q=j==null?void 0:j.response)==null?void 0:Q.status)===401&&(u.defaults.headers.common.Authorization=null,localStorage.removeItem(s),E(i)),Promise.reject(j)}))},[u.defaults.headers.common,u.interceptors.response,s,i]),D&&!h?F.jsx(m.Suspense,{fallback:t,children:(W=(b=T.state)==null?void 0:b.from)!=null&&W.state&&((M=(Y=T.state)==null?void 0:Y.from)==null?void 0:M.pathname)===o?F.jsx(p,{to:T.state.from.state.from.pathname+T.state.from.state.from.search,replace:!0}):F.jsx(c,{})}):F.jsx(p,{to:o+T.search,state:{from:T},replace:!0})},Ue=({...t})=>{const{libraries:n}=m.useContext(A),o=(t==null?void 0:t.reactRouter)||(n==null?void 0:n.reactRouter),s=(t==null?void 0:t.gtm)||(n==null?void 0:n.gtm);if(!o)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!s)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:i}=s,{useLocation:f,Outlet:l}=o,{pathname:d}=f(),{sendEvent:u}=i();return m.useEffect(()=>{u({event:"pageView",pathname:d})},[d,u]),F.jsx(l,{})},Be=({tokenTypeKey:t="tokenType",userLocalStorageKey:n="user",tokenKey:o="accessToken",postContentType:s="application/json",...i})=>{const{apiURL:f=i.apiURL,libraries:l}=m.useContext(A),d=(i==null?void 0:i.axios)||(l==null?void 0:l.axios);if(!d)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(d!=null&&d.defaults))return null;const u=localStorage.getItem(n),h=u?JSON.parse(u):null,E=h!=null&&h[t]?h[t]:null,_=h!=null&&h[o]?h[o]:null,p=u?`${E} ${_}`:null;return d.defaults.baseURL=f,d.defaults.headers.post["Content-Type"]=s,p&&(d.defaults.headers.common.Authorization=p),null},Ge=({debug:t,resources:n,...o})=>{const{libraries:s}=m.useContext(A),i=(o==null?void 0:o.i18)||(s==null?void 0:s.i18),{i18next:f,initReactI18next:l,languageDetector:d}=i||{};if(!i)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return f!=null&&f.isInitialized||(f.use(d).use(l).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==f.resolvedLanguage&&f.resolvedLanguage&&document.documentElement.setAttribute("lang",f.resolvedLanguage)}),f.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},Qe=({dsn:t,integrations:n,tracesSampleRate:o,replaysSessionSampleRate:s,replaysOnErrorSampleRate:i,tracePropagationTargets:f,ignoreErrors:l,debug:d,environment:u,...h})=>{const{libraries:E}=m.useContext(A),_=(h==null?void 0:h.sentry)||(E==null?void 0:E.sentry),p=(h==null?void 0:h.reactRouter)||(E==null?void 0:E.reactRouter);if(!_)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!p)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(_.isInitialized())return null;const{createRoutesFromChildren:c,matchRoutes:T,useLocation:k,useNavigationType:x}=p;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&_.init({debug:d,dsn:t,environment:u||"production",ignoreErrors:[...l||[],/dynamically imported module/],integrations:[_.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:c,matchRoutes:T,useEffect:m.useEffect,useLocation:k,useNavigationType:x}),...n||[]],replaysOnErrorSampleRate:i||1,replaysSessionSampleRate:s||.1,tracePropagationTargets:f,tracesSampleRate:o||1}),null},Je=({IMaskMixin:t,...n})=>{const o=m.useMemo(()=>t(({TextField:s,...i})=>F.jsx(s,{...i})),[t]);return F.jsx(o,{...n})},Ke=({accessToken:t,...n})=>{const{libraries:o}=m.useContext(A),s=(n==null?void 0:n.mapbox)||(o==null?void 0:o.mapbox);if(!s)throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return t&&(s.accessToken=t),null},Xe=({language:t,...n})=>{const{libraries:o}=m.useContext(A),s=(n==null?void 0:n.dayjs)||(o==null?void 0:o.dayjs),i=(n==null?void 0:n.plugin)||(o==null?void 0:o.dayjsPlugin);if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return m.useEffect(()=>{(async()=>{var d;const l=t||((d=navigator.language)==null?void 0:d.slice(0,2))||"en";i&&i.forEach(u=>{u&&s.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),s.locale(l)})().then()},[s,i,t]),null},He=t=>t&&typeof t=="function",Ze=t=>t&&typeof t=="function",$e=({children:t,defaultQueriesOptions:n,defaultMutationsOptions:o,...s})=>{var u,h;const{libraries:i}=m.useContext(A),f=(s==null?void 0:s.QueryClient)||((u=i==null?void 0:i.reactQuery)==null?void 0:u.QueryClient),l=(s==null?void 0:s.QueryClientProvider)||((h=i==null?void 0:i.reactQuery)==null?void 0:h.QueryClientProvider);if(!f)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!He(l))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Ze(f))throw new Error("Provided QueryClient dependencies are not valid.");const d=new f({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(E,_,p)=>E.length+(p||0),refetchOnWindowFocus:!1,retry:3,...n}}});return F.jsx(l,{client:d,children:t})},qe=t=>{var h,E,_;const{libraries:n}=m.useContext(A),o=(t==null?void 0:t.i18)||(n==null?void 0:n.i18),s=((h=t==null?void 0:t.i18)==null?void 0:h.translateFunction)||((E=n==null?void 0:n.i18)==null?void 0:E.translateFunction),i=((_=o==null?void 0:o.i18next)==null?void 0:_.t)||s||(p=>p),{unknownErrorTranslationKey:f="error.unknownError"}=t||{},l=i(f),d=m.useCallback(p=>{var T,k,x,D,b,W,Y,M,j;const{response:c}=p||{};return c!=null&&c.reason?String(c.reason):(T=c==null?void 0:c.data)!=null&&T.reason?String(c.data.reason):(k=c==null?void 0:c.data)!=null&&k.message?String(c.data.message):(D=(x=c==null?void 0:c.data)==null?void 0:x.detail)!=null&&D.length&&Array.isArray((b=c==null?void 0:c.data)==null?void 0:b.detail)&&((Y=(W=c==null?void 0:c.data)==null?void 0:W.detail[0])!=null&&Y.msg)&&typeof((j=(M=c==null?void 0:c.data)==null?void 0:M.detail[0])==null?void 0:j.msg)=="string"?String(c.data.detail[0].msg):l},[l]);return{getErrorCode:m.useCallback(p=>{var T,k,x;const{response:c}=p||{};return c!=null&&c.error_code?String(c==null?void 0:c.error_code):(T=c==null?void 0:c.data)!=null&&T.error_code?String((k=c==null?void 0:c.data)==null?void 0:k.error_code):c!=null&&c.error_code?String(c==null?void 0:c.error_code):(x=c==null?void 0:c.data)!=null&&x.error_code?String(c.data.error_code):"unknown_error_code"},[]),printError:d}},et=({data:t,fetchNextPage:n,isFetchingNextPage:o,isInitialLoading:s,isLoading:i,enabled:f=!0})=>{const l=m.useCallback(async u=>{o||!f||await n({pageParam:(u==null?void 0:u.pageParam)||u.visibleRowsCount})},[f,n,o]),d=m.useMemo(()=>{if(t)return t.pages.reduce((u,h)=>[...u,...h],[])},[t]);return{fetchNextPageOnRowsScrollEnd:l,isLoading:o||i,loadingVariant:s?"skeleton":"linear",rows:d}},tt=t=>{const{libraries:n}=m.useContext(A),o=(t==null?void 0:t.axios)||(n==null?void 0:n.axios),s=(t==null?void 0:t.localStorageKey)||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const i=m.useCallback(({tokenType:l,accessToken:d})=>{o.defaults.headers.common.Authorization=`${l} ${d}`},[o.defaults.headers.common]),f=()=>{o.defaults.headers.common.Authorization=null};return m.useEffect(()=>{const l=({newValue:d,key:u})=>{if(u===s){const{accessToken:h,tokenType:E}=d&&JSON.parse(d);i({accessToken:h,tokenType:E})}};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}},[s,i]),{clearAuthenticationToken:f,setAuthenticationToken:i}},fe=({library:t,date:n,format:o="ll"})=>t(n).format(o),de=(t,n="km")=>{const o=Number(t);return Number.isNaN(o)?`0 ${n}`:`${o.toFixed(2)} ${n}`},rt=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,nt=({path:t,size:n,apiURL:o})=>{if(!t)return"";const s=rt(t),i=`${o}${s}`,f=i.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof n=="number"&&f?`${i.replace("/files",`/thumbs/${n}`)}`:i},ot=t=>{const{apiURL:n,libraries:o}=m.useContext(A),s=(t==null?void 0:t.dayjs)||(o==null?void 0:o.dayjs);return{dateAdapter:(l,d)=>{if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return fe({date:l,format:d,library:s})},distanceAdapter:de,filePathAdapter:(l,d)=>{if(!n)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return nt({apiURL:n,path:l,size:d})}}},ve=(t,n)=>n==="short"?t.split("-")[0]:t,at=(t,n="full")=>{const[o,s]=m.useState(()=>ve((t==null?void 0:t.language)||navigator.language,n));return m.useEffect(()=>{var f;const i=l=>{s(ve(l,n))};return(f=t==null?void 0:t.on)==null||f.call(t,"languageChanged",i),()=>{var l;(l=t==null?void 0:t.off)==null||l.call(t,"languageChanged",i)}},[t,n]),o},it=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),st=t=>{const s=t.split("/").filter(i=>i.length>0).map(i=>i.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return s.charAt(0).toLowerCase()+s.slice(1)},ct=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),ut=(t,n,o)=>{const s=st(n),i=it(o);return`${s}${i}`},lt=t=>{if(t)return(t==null?void 0:t.reduce((n,o)=>(n[o]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},n),{}))||{}},ft=t=>(Array.isArray(t)?t:[t]).reduce((o,s)=>{const{output:i,operationsToGenerateInfiniteQueryHook:f,input:l="./openapi.json"}=s||{},d=ct(l);return{...o,[d]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:l,output:{baseUrl:i==null?void 0:i.baseUrl,client:"react-query",mode:"tags-split",override:{...(f==null?void 0:f.length)&&{operations:lt(f)},header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/axiosCustomInstance.ts`},operationName:ut,query:{useQuery:!0}},schemas:(i==null?void 0:i.schemas)||`src/api/${d}/model`,target:(i==null?void 0:i.target)||`src/api/${d}/services/api.ts`,...i}}}},{}),dt=t=>{const n="moduleFetchError";throw t.message.includes("Failed to fetch dynamically imported module")&&(document.cookie.split(";").some(s=>s.trim().startsWith(`${n}=`))||(document.cookie=`${n}=true; max-age=60; path=/`,window.location.reload())),t};C.GTMSendPageView=Ue,C.InitializeAxiosConfig=Be,C.InitializeDaysJSConfig=Xe,C.InitializeI18nConfig=Ge,C.InitializeMapBoxConfig=Ke,C.InitializeSentryConfig=Qe,C.InjectDependenciesContext=A,C.InjectDependenciesProvider=ze,C.MaskTextField=Je,C.QueryClientProviderWithConfig=$e,C.RequireAuth=Ve,C.dateAdapter=fe,C.distanceAdapter=de,C.getOrvalConfig=ft,C.handleImportModuleError=dt,C.useAdapter=ot,C.useAuth=tt,C.useCurrentLanguage=at,C.useInfiniteDataGrid=et,C.useResponseError=qe,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
|
25
|
+
Check the top-level render call using <`+a+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=It(r);if(De[a])return;De[a]=!0;var v="";e&&e._owner&&e._owner!==ie.current&&(v=" It was passed a child from "+L(e._owner.type)+"."),V(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,v),V(null)}}function Le(e,r){{if(typeof e!="object")return;if(oe(e))for(var a=0;a<e.length;a++){var v=e[a];ce(v)&&Fe(v,r)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var R=x(e);if(typeof R=="function"&&R!==e.entries)for(var w=R.call(e),y;!(y=w.next()).done;)ce(y.value)&&Fe(y.value,r)}}}function Dt(e){{var r=e.type;if(r==null||typeof r=="string")return;var a;if(typeof r=="function")a=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===u||r.$$typeof===_))a=r.propTypes;else return;if(a){var v=L(r);wt(a,e.props,"prop",v,e)}else if(r.PropTypes!==void 0&&!se){se=!0;var R=L(r);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ft(e){{for(var r=Object.keys(e.props),a=0;a<r.length;a++){var v=r[a];if(v!=="children"&&v!=="key"){V(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),V(null);break}}e.ref!==null&&(V(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}function Ne(e,r,a,v,R,w){{var y=vt(e);if(!y){var m="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(m+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=kt();O?m+=O:m+=Ie();var P;e===null?P="null":oe(e)?P="array":e!==void 0&&e.$$typeof===n?(P="<"+(L(e.type)||"Unknown")+" />",m=" Did you accidentally export a JSX literal instead of a component?"):P=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,m)}var S=At(e,r,a,R,w);if(S==null)return S;if(y){var I=r.children;if(I!==void 0)if(v)if(oe(I)){for(var U=0;U<I.length;U++)Le(I[U],e);Object.freeze&&Object.freeze(I)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Le(I,e)}return e===s?Ft(S):Dt(S),S}}function Lt(e,r,a){return Ne(e,r,a,!0)}function Nt(e,r,a){return Ne(e,r,a,!1)}var Wt=Nt,Yt=Lt;G.Fragment=s,G.jsx=Wt,G.jsxs=Yt}()),G}process.env.NODE_ENV==="production"?ee.exports=Ye():ee.exports=Me();var F=ee.exports;const A=h.createContext({}),ze=({children:t,apiURL:n,libraries:o})=>{const s=h.useMemo(()=>({apiURL:n,libraries:o}),[n,o]);return F.jsx(A.Provider,{value:s,children:t})},Ve=({Fallback:t,isLogged:n,loginPath:o="/login",localStorageKey:s="user",redirect401Path:i="/login",...f})=>{var b,W,Y,M;const{libraries:l}=h.useContext(A),d=(f==null?void 0:f.reactRouter)||(l==null?void 0:l.reactRouter),u=(f==null?void 0:f.axios)||(l==null?void 0:l.axios);if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[g,E]=h.useState(null),{useLocation:_,Navigate:C,Outlet:c}=d,T=_(),k=h.useRef(!1),x=typeof n=="function"?n():!!n,D=typeof x=="boolean"?x:x==null?void 0:x.isLogged;return h.useEffect(()=>{k.current||(k.current=!0,u.interceptors.response.use(j=>j,async j=>{var Q;return typeof j=="object"&&j&&"response"in j&&j.response&&typeof j.response=="object"&&"status"in j.response&&j.response&&typeof j.response=="object"&&"status"in j.response&&((Q=j==null?void 0:j.response)==null?void 0:Q.status)===401&&(u.defaults.headers.common.Authorization=null,localStorage.removeItem(s),E(i)),Promise.reject(j)}))},[u.defaults.headers.common,u.interceptors.response,s,i]),D&&!g?F.jsx(h.Suspense,{fallback:t,children:(W=(b=T.state)==null?void 0:b.from)!=null&&W.state&&((M=(Y=T.state)==null?void 0:Y.from)==null?void 0:M.pathname)===o?F.jsx(C,{to:T.state.from.state.from.pathname+T.state.from.state.from.search,replace:!0}):F.jsx(c,{})}):F.jsx(C,{to:o+T.search,state:{from:T},replace:!0})},Ue=({data:t,...n})=>{const{libraries:o}=h.useContext(A),s=(n==null?void 0:n.reactRouter)||(o==null?void 0:o.reactRouter),i=(n==null?void 0:n.gtm)||(o==null?void 0:o.gtm);if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!i)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:f}=i,{useLocation:l,Outlet:d}=s,{pathname:u}=l(),{sendEvent:g}=f();return h.useEffect(()=>{g({event:"pageView",pathname:u,...t})},[t,u,g]),F.jsx(d,{})},Be=({tokenTypeKey:t="tokenType",userLocalStorageKey:n="user",tokenKey:o="accessToken",postContentType:s="application/json",...i})=>{const{apiURL:f=i.apiURL,libraries:l}=h.useContext(A),d=(i==null?void 0:i.axios)||(l==null?void 0:l.axios);if(!d)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(d!=null&&d.defaults))return null;const u=localStorage.getItem(n),g=u?JSON.parse(u):null,E=g!=null&&g[t]?g[t]:null,_=g!=null&&g[o]?g[o]:null,C=u?`${E} ${_}`:null;return d.defaults.baseURL=f,d.defaults.headers.post["Content-Type"]=s,C&&(d.defaults.headers.common.Authorization=C),null},Ge=({debug:t,resources:n,...o})=>{const{libraries:s}=h.useContext(A),i=(o==null?void 0:o.i18)||(s==null?void 0:s.i18),{i18next:f,initReactI18next:l,languageDetector:d}=i||{};if(!i)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return f!=null&&f.isInitialized||(f.use(d).use(l).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==f.resolvedLanguage&&f.resolvedLanguage&&document.documentElement.setAttribute("lang",f.resolvedLanguage)}),f.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},Qe=({dsn:t,integrations:n,tracesSampleRate:o,replaysSessionSampleRate:s,replaysOnErrorSampleRate:i,tracePropagationTargets:f,ignoreErrors:l,debug:d,environment:u,...g})=>{const{libraries:E}=h.useContext(A),_=(g==null?void 0:g.sentry)||(E==null?void 0:E.sentry),C=(g==null?void 0:g.reactRouter)||(E==null?void 0:E.reactRouter);if(!_)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!C)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(_.isInitialized())return null;const{createRoutesFromChildren:c,matchRoutes:T,useLocation:k,useNavigationType:x}=C;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&_.init({debug:d,dsn:t,environment:u||"production",ignoreErrors:[...l||[],/dynamically imported module/],integrations:[_.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:c,matchRoutes:T,useEffect:h.useEffect,useLocation:k,useNavigationType:x}),...n||[]],replaysOnErrorSampleRate:i||1,replaysSessionSampleRate:s||.1,tracePropagationTargets:f,tracesSampleRate:o||1}),null},Je=({IMaskMixin:t,...n})=>{const o=h.useMemo(()=>t(({TextField:s,...i})=>F.jsx(s,{...i})),[t]);return F.jsx(o,{...n})},Ke=({accessToken:t,...n})=>{const{libraries:o}=h.useContext(A),s=(n==null?void 0:n.mapbox)||(o==null?void 0:o.mapbox);if(!s)throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return t&&(s.accessToken=t),null},Xe=({language:t,...n})=>{const{libraries:o}=h.useContext(A),s=(n==null?void 0:n.dayjs)||(o==null?void 0:o.dayjs),i=(n==null?void 0:n.plugin)||(o==null?void 0:o.dayjsPlugin);if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return h.useEffect(()=>{(async()=>{var d;const l=t||((d=navigator.language)==null?void 0:d.slice(0,2))||"en";i&&i.forEach(u=>{u&&s.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),s.locale(l)})().then()},[s,i,t]),null},He=t=>t&&typeof t=="function",Ze=t=>t&&typeof t=="function",$e=({children:t,defaultQueriesOptions:n,defaultMutationsOptions:o,...s})=>{var u,g;const{libraries:i}=h.useContext(A),f=(s==null?void 0:s.QueryClient)||((u=i==null?void 0:i.reactQuery)==null?void 0:u.QueryClient),l=(s==null?void 0:s.QueryClientProvider)||((g=i==null?void 0:i.reactQuery)==null?void 0:g.QueryClientProvider);if(!f)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!He(l))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Ze(f))throw new Error("Provided QueryClient dependencies are not valid.");const d=new f({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(E,_,C)=>E.length+(C||0),refetchOnWindowFocus:!1,retry:3,...n}}});return F.jsx(l,{client:d,children:t})},qe=t=>{var g,E,_;const{libraries:n}=h.useContext(A),o=(t==null?void 0:t.i18)||(n==null?void 0:n.i18),s=((g=t==null?void 0:t.i18)==null?void 0:g.translateFunction)||((E=n==null?void 0:n.i18)==null?void 0:E.translateFunction),i=((_=o==null?void 0:o.i18next)==null?void 0:_.t)||s||(C=>C),{unknownErrorTranslationKey:f="error.unknownError"}=t||{},l=i(f),d=h.useCallback(C=>{var T,k,x,D,b,W,Y,M,j;const{response:c}=C||{};return c!=null&&c.reason?String(c.reason):(T=c==null?void 0:c.data)!=null&&T.reason?String(c.data.reason):(k=c==null?void 0:c.data)!=null&&k.message?String(c.data.message):(D=(x=c==null?void 0:c.data)==null?void 0:x.detail)!=null&&D.length&&Array.isArray((b=c==null?void 0:c.data)==null?void 0:b.detail)&&((Y=(W=c==null?void 0:c.data)==null?void 0:W.detail[0])!=null&&Y.msg)&&typeof((j=(M=c==null?void 0:c.data)==null?void 0:M.detail[0])==null?void 0:j.msg)=="string"?String(c.data.detail[0].msg):l},[l]);return{getErrorCode:h.useCallback(C=>{var T,k,x;const{response:c}=C||{};return c!=null&&c.error_code?String(c==null?void 0:c.error_code):(T=c==null?void 0:c.data)!=null&&T.error_code?String((k=c==null?void 0:c.data)==null?void 0:k.error_code):c!=null&&c.error_code?String(c==null?void 0:c.error_code):(x=c==null?void 0:c.data)!=null&&x.error_code?String(c.data.error_code):"unknown_error_code"},[]),printError:d}},et=({data:t,fetchNextPage:n,isFetchingNextPage:o,isInitialLoading:s,isLoading:i,enabled:f=!0})=>{const l=h.useCallback(async u=>{o||!f||await n({pageParam:(u==null?void 0:u.pageParam)||u.visibleRowsCount})},[f,n,o]),d=h.useMemo(()=>{if(t)return t.pages.reduce((u,g)=>[...u,...g],[])},[t]);return{fetchNextPageOnRowsScrollEnd:l,isLoading:o||i,loadingVariant:s?"skeleton":"linear",rows:d}},tt=t=>{const{libraries:n}=h.useContext(A),o=(t==null?void 0:t.axios)||(n==null?void 0:n.axios),s=(t==null?void 0:t.localStorageKey)||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const i=h.useCallback(({tokenType:l,accessToken:d})=>{o.defaults.headers.common.Authorization=`${l} ${d}`},[o.defaults.headers.common]),f=()=>{o.defaults.headers.common.Authorization=null};return h.useEffect(()=>{const l=({newValue:d,key:u})=>{if(u===s&&d)try{const{accessToken:g,tokenType:E}=JSON.parse(d);i({accessToken:g,tokenType:E})}catch(g){console.error("Failed to parse newValue from localStorage:",g)}};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}},[s,i]),{clearAuthenticationToken:f,setAuthenticationToken:i}},fe=({library:t,date:n,format:o="ll"})=>t(n).format(o),de=(t,n="km")=>{const o=Number(t);return Number.isNaN(o)?`0 ${n}`:`${o.toFixed(2)} ${n}`},rt=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,nt=({path:t,size:n,apiURL:o})=>{if(!t)return"";const s=rt(t),i=`${o}${s}`,f=i.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof n=="number"&&f?`${i.replace("/files",`/thumbs/${n}`)}`:i},ot=t=>{const{apiURL:n,libraries:o}=h.useContext(A),s=(t==null?void 0:t.dayjs)||(o==null?void 0:o.dayjs);return{dateAdapter:(l,d)=>{if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return fe({date:l,format:d,library:s})},distanceAdapter:de,filePathAdapter:(l,d)=>{if(!n)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return nt({apiURL:n,path:l,size:d})}}},ve=(t,n)=>n==="short"?t.split("-")[0]:t,at=(t,n="full")=>{const[o,s]=h.useState(()=>ve((t==null?void 0:t.language)||navigator.language,n));return h.useEffect(()=>{var f;const i=l=>{s(ve(l,n))};return(f=t==null?void 0:t.on)==null||f.call(t,"languageChanged",i),()=>{var l;(l=t==null?void 0:t.off)==null||l.call(t,"languageChanged",i)}},[t,n]),o},it=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),st=t=>{const s=t.split("/").filter(i=>i.length>0).map(i=>i.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return s.charAt(0).toLowerCase()+s.slice(1)},ct=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),ut=(t,n,o)=>{const s=st(n),i=it(o);return`${s}${i}`},lt=t=>{if(t)return(t==null?void 0:t.reduce((n,o)=>(n[o]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},n),{}))||{}},ft=t=>(Array.isArray(t)?t:[t]).reduce((o,s)=>{const{output:i,operationsToGenerateInfiniteQueryHook:f,input:l="./openapi.json"}=s||{},d=ct(l);return{...o,[d]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:l,output:{baseUrl:i==null?void 0:i.baseUrl,client:"react-query",mode:"tags-split",override:{...(f==null?void 0:f.length)&&{operations:lt(f)},header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/axiosCustomInstance.ts`},operationName:ut,query:{useQuery:!0}},schemas:(i==null?void 0:i.schemas)||`src/api/${d}/model`,target:(i==null?void 0:i.target)||`src/api/${d}/services/api.ts`,...i}}}},{}),dt=t=>{const n="moduleFetchError";throw t.message.includes("Failed to fetch dynamically imported module")&&(document.cookie.split(";").some(s=>s.trim().startsWith(`${n}=`))||(document.cookie=`${n}=true; max-age=60; path=/`,window.location.reload())),t};p.GTMSendPageView=Ue,p.InitializeAxiosConfig=Be,p.InitializeDaysJSConfig=Xe,p.InitializeI18nConfig=Ge,p.InitializeMapBoxConfig=Ke,p.InitializeSentryConfig=Qe,p.InjectDependenciesContext=A,p.InjectDependenciesProvider=ze,p.MaskTextField=Je,p.QueryClientProviderWithConfig=$e,p.RequireAuth=Ve,p.dateAdapter=fe,p.distanceAdapter=de,p.getOrvalConfig=ft,p.handleImportModuleError=dt,p.useAdapter=ot,p.useAuth=tt,p.useCurrentLanguage=at,p.useInfiniteDataGrid=et,p.useResponseError=qe,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|