@tracktor/shared-module 2.16.0 → 2.17.1
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 +3 -3
- package/dist/hooks/useFilters.d.ts +5 -0
- package/dist/main.js +323 -303
- package/dist/main.umd.cjs +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,11 @@ interface useFiltersOptions {
|
|
|
13
13
|
* React Router library
|
|
14
14
|
*/
|
|
15
15
|
reactRouter?: NonNullable<InjectDependenciesContextProps["libraries"]>["reactRouter"];
|
|
16
|
+
/**
|
|
17
|
+
* Enable URL synchronization for filters
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
syncWithUrl?: boolean;
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* Hook to handle filter
|
package/dist/main.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import de, { createContext as fe, useMemo as
|
|
3
|
-
const $e = (e,
|
|
4
|
-
const
|
|
1
|
+
import ee from "axios";
|
|
2
|
+
import de, { createContext as fe, useMemo as M, useContext as A, useState as J, useRef as pe, useEffect as O, Suspense as ge, useCallback as Y } from "react";
|
|
3
|
+
const $e = (e, n) => {
|
|
4
|
+
const o = ee.CancelToken.source(), a = ee({
|
|
5
5
|
...e,
|
|
6
|
-
...
|
|
7
|
-
cancelToken:
|
|
6
|
+
...n,
|
|
7
|
+
cancelToken: o.token
|
|
8
8
|
}).then(({ data: r }) => r);
|
|
9
9
|
return a.cancel = () => {
|
|
10
|
-
|
|
10
|
+
o.cancel("Query was cancelled");
|
|
11
11
|
}, a;
|
|
12
12
|
};
|
|
13
|
-
var
|
|
13
|
+
var $ = { exports: {} }, N = {};
|
|
14
14
|
/**
|
|
15
15
|
* @license React
|
|
16
16
|
* react-jsx-runtime.production.js
|
|
@@ -20,12 +20,12 @@ var L = { exports: {} }, x = {};
|
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
22
|
*/
|
|
23
|
-
var
|
|
23
|
+
var te;
|
|
24
24
|
function me() {
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
var e = Symbol.for("react.transitional.element"),
|
|
28
|
-
function
|
|
25
|
+
if (te) return N;
|
|
26
|
+
te = 1;
|
|
27
|
+
var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
28
|
+
function o(a, r, s) {
|
|
29
29
|
var c = null;
|
|
30
30
|
if (s !== void 0 && (c = "" + s), r.key !== void 0 && (c = "" + r.key), "key" in r) {
|
|
31
31
|
s = {};
|
|
@@ -40,9 +40,9 @@ function me() {
|
|
|
40
40
|
props: s
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return N.Fragment = n, N.jsx = o, N.jsxs = o, N;
|
|
44
44
|
}
|
|
45
|
-
var
|
|
45
|
+
var L = {};
|
|
46
46
|
/**
|
|
47
47
|
* @license React
|
|
48
48
|
* react-jsx-runtime.development.js
|
|
@@ -52,22 +52,22 @@ var I = {};
|
|
|
52
52
|
* This source code is licensed under the MIT license found in the
|
|
53
53
|
* LICENSE file in the root directory of this source tree.
|
|
54
54
|
*/
|
|
55
|
-
var
|
|
55
|
+
var re;
|
|
56
56
|
function ye() {
|
|
57
|
-
return
|
|
57
|
+
return re || (re = 1, process.env.NODE_ENV !== "production" && function() {
|
|
58
58
|
function e(t) {
|
|
59
59
|
if (t == null) return null;
|
|
60
60
|
if (typeof t == "function")
|
|
61
61
|
return t.$$typeof === ce ? null : t.displayName || t.name || null;
|
|
62
62
|
if (typeof t == "string") return t;
|
|
63
63
|
switch (t) {
|
|
64
|
-
case
|
|
64
|
+
case b:
|
|
65
65
|
return "Fragment";
|
|
66
|
-
case
|
|
66
|
+
case m:
|
|
67
67
|
return "Profiler";
|
|
68
|
-
case
|
|
68
|
+
case g:
|
|
69
69
|
return "StrictMode";
|
|
70
|
-
case
|
|
70
|
+
case P:
|
|
71
71
|
return "Suspense";
|
|
72
72
|
case ae:
|
|
73
73
|
return "SuspenseList";
|
|
@@ -78,13 +78,13 @@ 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 x:
|
|
82
82
|
return "Portal";
|
|
83
|
-
case
|
|
83
|
+
case p:
|
|
84
84
|
return (t.displayName || "Context") + ".Provider";
|
|
85
|
-
case
|
|
85
|
+
case _:
|
|
86
86
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
87
|
-
case
|
|
87
|
+
case h:
|
|
88
88
|
var f = t.render;
|
|
89
89
|
return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
90
90
|
case se:
|
|
@@ -98,28 +98,28 @@ function ye() {
|
|
|
98
98
|
}
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function n(t) {
|
|
102
102
|
return "" + t;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function o(t) {
|
|
105
105
|
try {
|
|
106
|
-
|
|
106
|
+
n(t);
|
|
107
107
|
var f = !1;
|
|
108
108
|
} catch {
|
|
109
109
|
f = !0;
|
|
110
110
|
}
|
|
111
111
|
if (f) {
|
|
112
112
|
f = console;
|
|
113
|
-
var y = f.error,
|
|
113
|
+
var y = f.error, w = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
114
114
|
return y.call(
|
|
115
115
|
f,
|
|
116
116
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
117
|
-
|
|
118
|
-
),
|
|
117
|
+
w
|
|
118
|
+
), n(t);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
function a(t) {
|
|
122
|
-
if (t ===
|
|
122
|
+
if (t === b) return "<>";
|
|
123
123
|
if (typeof t == "object" && t !== null && t.$$typeof === G)
|
|
124
124
|
return "<...>";
|
|
125
125
|
try {
|
|
@@ -130,14 +130,14 @@ function ye() {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
function r() {
|
|
133
|
-
var t =
|
|
133
|
+
var t = z.A;
|
|
134
134
|
return t === null ? null : t.getOwner();
|
|
135
135
|
}
|
|
136
136
|
function s() {
|
|
137
137
|
return Error("react-stack-top-frame");
|
|
138
138
|
}
|
|
139
139
|
function c(t) {
|
|
140
|
-
if (
|
|
140
|
+
if (K.call(t, "key")) {
|
|
141
141
|
var f = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
142
142
|
if (f && f.isReactWarning) return !1;
|
|
143
143
|
}
|
|
@@ -145,7 +145,7 @@ function ye() {
|
|
|
145
145
|
}
|
|
146
146
|
function u(t, f) {
|
|
147
147
|
function y() {
|
|
148
|
-
|
|
148
|
+
q || (q = !0, console.error(
|
|
149
149
|
"%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://react.dev/link/special-props)",
|
|
150
150
|
f
|
|
151
151
|
));
|
|
@@ -155,22 +155,22 @@ function ye() {
|
|
|
155
155
|
configurable: !0
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function d() {
|
|
159
159
|
var t = e(this.type);
|
|
160
|
-
return
|
|
160
|
+
return B[t] || (B[t] = !0, console.error(
|
|
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
|
|
165
|
-
return y =
|
|
166
|
-
$$typeof:
|
|
164
|
+
function l(t, f, y, w, k, T, W, Q) {
|
|
165
|
+
return y = T.ref, t = {
|
|
166
|
+
$$typeof: S,
|
|
167
167
|
type: t,
|
|
168
168
|
key: f,
|
|
169
|
-
props:
|
|
170
|
-
_owner:
|
|
169
|
+
props: T,
|
|
170
|
+
_owner: k
|
|
171
171
|
}, (y !== void 0 ? y : null) !== null ? Object.defineProperty(t, "ref", {
|
|
172
172
|
enumerable: !1,
|
|
173
|
-
get:
|
|
173
|
+
get: d
|
|
174
174
|
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
175
175
|
configurable: !1,
|
|
176
176
|
enumerable: !1,
|
|
@@ -185,149 +185,149 @@ function ye() {
|
|
|
185
185
|
configurable: !1,
|
|
186
186
|
enumerable: !1,
|
|
187
187
|
writable: !0,
|
|
188
|
-
value:
|
|
188
|
+
value: W
|
|
189
189
|
}), Object.defineProperty(t, "_debugTask", {
|
|
190
190
|
configurable: !1,
|
|
191
191
|
enumerable: !1,
|
|
192
192
|
writable: !0,
|
|
193
|
-
value:
|
|
193
|
+
value: Q
|
|
194
194
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
195
195
|
}
|
|
196
|
-
function i(t, f, y,
|
|
197
|
-
var
|
|
198
|
-
if (
|
|
199
|
-
if (
|
|
200
|
-
if (ue(
|
|
201
|
-
for (
|
|
202
|
-
|
|
203
|
-
Object.freeze && Object.freeze(
|
|
196
|
+
function i(t, f, y, w, k, T, W, Q) {
|
|
197
|
+
var R = f.children;
|
|
198
|
+
if (R !== void 0)
|
|
199
|
+
if (w)
|
|
200
|
+
if (ue(R)) {
|
|
201
|
+
for (w = 0; w < R.length; w++)
|
|
202
|
+
v(R[w]);
|
|
203
|
+
Object.freeze && Object.freeze(R);
|
|
204
204
|
} else
|
|
205
205
|
console.error(
|
|
206
206
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
207
207
|
);
|
|
208
|
-
else
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
var
|
|
208
|
+
else v(R);
|
|
209
|
+
if (K.call(f, "key")) {
|
|
210
|
+
R = e(t);
|
|
211
|
+
var I = Object.keys(f).filter(function(le) {
|
|
212
212
|
return le !== "key";
|
|
213
213
|
});
|
|
214
|
-
|
|
214
|
+
w = 0 < I.length ? "{key: someKey, " + I.join(": ..., ") + ": ...}" : "{key: someKey}", Z[R + w] || (I = 0 < I.length ? "{" + I.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} />
|
|
218
218
|
React keys must be passed directly to JSX without using spread:
|
|
219
219
|
let props = %s;
|
|
220
220
|
<%s key={someKey} {...props} />`,
|
|
221
|
-
E,
|
|
222
221
|
w,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
R,
|
|
223
|
+
I,
|
|
224
|
+
R
|
|
225
|
+
), Z[R + w] = !0);
|
|
226
226
|
}
|
|
227
|
-
if (
|
|
227
|
+
if (R = null, y !== void 0 && (o(y), R = "" + y), c(f) && (o(f.key), R = "" + f.key), "key" in f) {
|
|
228
228
|
y = {};
|
|
229
|
-
for (var
|
|
230
|
-
|
|
229
|
+
for (var V in f)
|
|
230
|
+
V !== "key" && (y[V] = f[V]);
|
|
231
231
|
} else y = f;
|
|
232
|
-
return
|
|
232
|
+
return R && u(
|
|
233
233
|
y,
|
|
234
234
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
235
|
-
),
|
|
235
|
+
), l(
|
|
236
236
|
t,
|
|
237
|
-
|
|
238
|
-
_,
|
|
237
|
+
R,
|
|
239
238
|
T,
|
|
239
|
+
k,
|
|
240
240
|
r(),
|
|
241
241
|
y,
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
W,
|
|
243
|
+
Q
|
|
244
244
|
);
|
|
245
245
|
}
|
|
246
|
-
function
|
|
247
|
-
typeof t == "object" && t !== null && t.$$typeof ===
|
|
246
|
+
function v(t) {
|
|
247
|
+
typeof t == "object" && t !== null && t.$$typeof === S && t._store && (t._store.validated = 1);
|
|
248
248
|
}
|
|
249
|
-
var
|
|
249
|
+
var E = de, S = Symbol.for("react.transitional.element"), x = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), p = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), ae = Symbol.for("react.suspense_list"), se = Symbol.for("react.memo"), G = Symbol.for("react.lazy"), ie = Symbol.for("react.activity"), ce = Symbol.for("react.client.reference"), z = E.__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
|
+
E = {
|
|
253
253
|
"react-stack-bottom-frame": function(t) {
|
|
254
254
|
return t();
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
var
|
|
258
|
-
|
|
257
|
+
var q, B = {}, X = E["react-stack-bottom-frame"].bind(
|
|
258
|
+
E,
|
|
259
259
|
s
|
|
260
|
-
)(),
|
|
261
|
-
|
|
262
|
-
var
|
|
260
|
+
)(), H = U(a(s)), Z = {};
|
|
261
|
+
L.Fragment = b, L.jsx = function(t, f, y, w, k) {
|
|
262
|
+
var T = 1e4 > z.recentlyCreatedOwnerStacks++;
|
|
263
263
|
return i(
|
|
264
264
|
t,
|
|
265
265
|
f,
|
|
266
266
|
y,
|
|
267
267
|
!1,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
w,
|
|
269
|
+
k,
|
|
270
|
+
T ? Error("react-stack-top-frame") : X,
|
|
271
|
+
T ? U(a(t)) : H
|
|
272
272
|
);
|
|
273
|
-
},
|
|
274
|
-
var
|
|
273
|
+
}, L.jsxs = function(t, f, y, w, k) {
|
|
274
|
+
var T = 1e4 > z.recentlyCreatedOwnerStacks++;
|
|
275
275
|
return i(
|
|
276
276
|
t,
|
|
277
277
|
f,
|
|
278
278
|
y,
|
|
279
279
|
!0,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
w,
|
|
281
|
+
k,
|
|
282
|
+
T ? Error("react-stack-top-frame") : X,
|
|
283
|
+
T ? U(a(t)) : H
|
|
284
284
|
);
|
|
285
285
|
};
|
|
286
|
-
}()),
|
|
286
|
+
}()), L;
|
|
287
287
|
}
|
|
288
|
-
var
|
|
288
|
+
var ne;
|
|
289
289
|
function he() {
|
|
290
|
-
return
|
|
290
|
+
return ne || (ne = 1, process.env.NODE_ENV === "production" ? $.exports = me() : $.exports = ye()), $.exports;
|
|
291
291
|
}
|
|
292
|
-
var
|
|
293
|
-
const
|
|
294
|
-
const r =
|
|
292
|
+
var C = he();
|
|
293
|
+
const j = fe({}), De = ({ children: e, apiURL: n, libraries: o, localStorageKeys: a }) => {
|
|
294
|
+
const r = M(
|
|
295
295
|
() => ({
|
|
296
|
-
apiURL:
|
|
297
|
-
libraries:
|
|
296
|
+
apiURL: n,
|
|
297
|
+
libraries: o,
|
|
298
298
|
localStorageKeys: a
|
|
299
299
|
}),
|
|
300
|
-
[
|
|
300
|
+
[n, o, a]
|
|
301
301
|
);
|
|
302
|
-
return /* @__PURE__ */
|
|
303
|
-
}, ve = "user",
|
|
304
|
-
const { libraries: s, localStorageKeys: c } = j
|
|
302
|
+
return /* @__PURE__ */ C.jsx(j.Provider, { value: r, children: e });
|
|
303
|
+
}, ve = "user", Ye = ({ Fallback: e, isLogged: n, loginPath: o = "/login", redirect401Path: a = "/login", ...r }) => {
|
|
304
|
+
const { libraries: s, localStorageKeys: c } = A(j), u = r?.reactRouter || s?.reactRouter, d = r?.axios || s?.axios, l = r?.localStorageKey || c?.user || ve;
|
|
305
305
|
if (!u)
|
|
306
306
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
307
|
-
const [i,
|
|
308
|
-
return
|
|
309
|
-
|
|
310
|
-
(
|
|
311
|
-
async (
|
|
307
|
+
const [i, v] = J(null), { useLocation: E, Navigate: S, Outlet: x } = u, b = E(), g = pe(!1), m = typeof n == "function" ? n() : !!n, _ = typeof m == "boolean" ? m : m?.isLogged;
|
|
308
|
+
return O(() => {
|
|
309
|
+
g.current || (g.current = !0, d.interceptors.response.use(
|
|
310
|
+
(p) => p,
|
|
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 && (d.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(l), v(a)), Promise.reject(p))
|
|
312
312
|
));
|
|
313
|
-
}, [
|
|
314
|
-
},
|
|
315
|
-
const { libraries:
|
|
313
|
+
}, [d.defaults.headers.common, d.interceptors.response, l, a]), _ && !i ? /* @__PURE__ */ C.jsx(ge, { fallback: e, children: b.state?.from?.state && b.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(S, { to: b.state.from.state.from.pathname + b.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ C.jsx(x, {}) }) : /* @__PURE__ */ C.jsx(S, { to: o + b.search, state: { from: b }, replace: !0 });
|
|
314
|
+
}, ze = ({ data: e, ...n }) => {
|
|
315
|
+
const { libraries: o } = A(j), 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."
|
|
319
319
|
);
|
|
320
320
|
if (!r)
|
|
321
321
|
throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
|
|
322
|
-
const { useGoogleTagManager: s } = r, { useLocation: c, Outlet: u } = a, { pathname:
|
|
323
|
-
return
|
|
324
|
-
|
|
322
|
+
const { useGoogleTagManager: s } = r, { useLocation: c, Outlet: u } = a, { pathname: d } = c(), { sendEvent: l } = s();
|
|
323
|
+
return O(() => {
|
|
324
|
+
l({
|
|
325
325
|
event: "pageView",
|
|
326
|
-
pathname:
|
|
326
|
+
pathname: d,
|
|
327
327
|
...e
|
|
328
328
|
});
|
|
329
|
-
}, [e,
|
|
330
|
-
},
|
|
329
|
+
}, [e, d, l]), /* @__PURE__ */ C.jsx(u, {});
|
|
330
|
+
}, F = (() => {
|
|
331
331
|
try {
|
|
332
332
|
return typeof global == "object" && global !== null && ("HermesInternal" in global || // Hermes JS engine
|
|
333
333
|
"__fbBatchedBridge" in global || // RN Bridge
|
|
@@ -335,25 +335,25 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
335
335
|
} catch {
|
|
336
336
|
return !1;
|
|
337
337
|
}
|
|
338
|
-
})(), Ee = "user",
|
|
338
|
+
})(), Ee = "user", Ue = ({
|
|
339
339
|
tokenTypeKey: e = "tokenType",
|
|
340
|
-
tokenKey:
|
|
341
|
-
postContentType:
|
|
340
|
+
tokenKey: n = "accessToken",
|
|
341
|
+
postContentType: o = "application/json",
|
|
342
342
|
...a
|
|
343
343
|
}) => {
|
|
344
|
-
const { apiURL: r = a.apiURL, libraries: s, localStorageKeys: c } = j
|
|
345
|
-
if (!
|
|
344
|
+
const { apiURL: r = a.apiURL, libraries: s, localStorageKeys: c } = A(j), u = a?.userLocalStorageKey || c?.user || Ee, d = a?.axios || s?.axios;
|
|
345
|
+
if (!d)
|
|
346
346
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
347
|
-
if (!
|
|
347
|
+
if (!d?.defaults || F)
|
|
348
348
|
return null;
|
|
349
349
|
if (typeof window < "u" && window.localStorage) {
|
|
350
|
-
const
|
|
351
|
-
|
|
350
|
+
const l = localStorage.getItem(u), i = l ? JSON.parse(l) : null, v = i?.[e] ? i[e] : null, E = i?.[n] ? i[n] : null, S = l ? `${v} ${E}` : null;
|
|
351
|
+
S && (d.defaults.headers.common.Authorization = S);
|
|
352
352
|
}
|
|
353
|
-
return
|
|
354
|
-
},
|
|
355
|
-
const { libraries: a } = j
|
|
356
|
-
if (
|
|
353
|
+
return d.defaults.baseURL = r, d.defaults.headers.post["Content-Type"] = o, null;
|
|
354
|
+
}, We = ({ debug: e, resources: n, ...o }) => {
|
|
355
|
+
const { libraries: a } = A(j), r = o?.i18 || a?.i18, { i18next: s, initReactI18next: c, languageDetector: u } = r || {};
|
|
356
|
+
if (F)
|
|
357
357
|
return null;
|
|
358
358
|
if (!r)
|
|
359
359
|
throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
@@ -368,38 +368,38 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
368
368
|
bindI18n: "languageChanged loaded",
|
|
369
369
|
useSuspense: !0
|
|
370
370
|
},
|
|
371
|
-
resources:
|
|
371
|
+
resources: n,
|
|
372
372
|
returnNull: !1
|
|
373
373
|
}).then(() => {
|
|
374
374
|
document.documentElement.lang !== s.resolvedLanguage && s.resolvedLanguage && document.documentElement.setAttribute("lang", s.resolvedLanguage);
|
|
375
|
-
}), s.on("languageChanged", (
|
|
376
|
-
document.documentElement.setAttribute("lang",
|
|
375
|
+
}), s.on("languageChanged", (d) => {
|
|
376
|
+
document.documentElement.setAttribute("lang", d);
|
|
377
377
|
})), null;
|
|
378
378
|
}, Qe = ({
|
|
379
379
|
dsn: e,
|
|
380
|
-
integrations:
|
|
381
|
-
tracesSampleRate:
|
|
380
|
+
integrations: n,
|
|
381
|
+
tracesSampleRate: o,
|
|
382
382
|
replaysSessionSampleRate: a,
|
|
383
383
|
replaysOnErrorSampleRate: r,
|
|
384
384
|
tracePropagationTargets: s,
|
|
385
385
|
ignoreErrors: c,
|
|
386
386
|
debug: u,
|
|
387
|
-
environment:
|
|
388
|
-
release:
|
|
387
|
+
environment: d,
|
|
388
|
+
release: l,
|
|
389
389
|
...i
|
|
390
390
|
}) => {
|
|
391
|
-
const { libraries:
|
|
392
|
-
if (!
|
|
391
|
+
const { libraries: v } = A(j), E = i?.sentry || v?.sentry, S = i?.reactRouter || v?.reactRouter;
|
|
392
|
+
if (!E)
|
|
393
393
|
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
394
|
-
if (!
|
|
394
|
+
if (!S)
|
|
395
395
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
396
|
-
if (
|
|
396
|
+
if (E.isInitialized())
|
|
397
397
|
return null;
|
|
398
|
-
const { createRoutesFromChildren:
|
|
399
|
-
return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") &&
|
|
398
|
+
const { createRoutesFromChildren: x, matchRoutes: b, useLocation: g, useNavigationType: m } = S;
|
|
399
|
+
return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && E.init({
|
|
400
400
|
debug: u,
|
|
401
401
|
dsn: e,
|
|
402
|
-
environment:
|
|
402
|
+
environment: d || "production",
|
|
403
403
|
ignoreErrors: [
|
|
404
404
|
...c || [],
|
|
405
405
|
/dynamically imported module/,
|
|
@@ -410,35 +410,35 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
410
410
|
/vite:preloadError/
|
|
411
411
|
],
|
|
412
412
|
integrations: [
|
|
413
|
-
|
|
414
|
-
createRoutesFromChildren:
|
|
415
|
-
matchRoutes:
|
|
416
|
-
useEffect:
|
|
417
|
-
useLocation:
|
|
418
|
-
useNavigationType:
|
|
413
|
+
E.reactRouterV6BrowserTracingIntegration({
|
|
414
|
+
createRoutesFromChildren: x,
|
|
415
|
+
matchRoutes: b,
|
|
416
|
+
useEffect: O,
|
|
417
|
+
useLocation: g,
|
|
418
|
+
useNavigationType: m
|
|
419
419
|
}),
|
|
420
|
-
...
|
|
420
|
+
...n || []
|
|
421
421
|
],
|
|
422
|
-
release:
|
|
422
|
+
release: l,
|
|
423
423
|
replaysOnErrorSampleRate: r || 1,
|
|
424
424
|
replaysSessionSampleRate: a || 0.1,
|
|
425
425
|
tracePropagationTargets: s,
|
|
426
|
-
tracesSampleRate:
|
|
426
|
+
tracesSampleRate: o || 1
|
|
427
427
|
}), null;
|
|
428
|
-
},
|
|
429
|
-
const
|
|
428
|
+
}, Ve = ({ IMaskMixin: e, ...n }) => {
|
|
429
|
+
const o = M(
|
|
430
430
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
431
|
-
() => e(({ TextField: a, ...r }) => /* @__PURE__ */
|
|
431
|
+
() => e(({ TextField: a, ...r }) => /* @__PURE__ */ C.jsx(a, { ...r })),
|
|
432
432
|
[e]
|
|
433
433
|
);
|
|
434
|
-
return /* @__PURE__ */
|
|
435
|
-
},
|
|
436
|
-
const { libraries:
|
|
434
|
+
return /* @__PURE__ */ C.jsx(o, { ...n });
|
|
435
|
+
}, Me = ({ language: e, ...n }) => {
|
|
436
|
+
const { libraries: o } = A(j), 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."
|
|
440
440
|
);
|
|
441
|
-
return
|
|
441
|
+
return O(() => {
|
|
442
442
|
(async () => {
|
|
443
443
|
const c = e || navigator.language?.slice(0, 2) || "en";
|
|
444
444
|
r && r.forEach((u) => {
|
|
@@ -446,52 +446,52 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
446
446
|
}), await import("dayjs/locale/en"), await import("dayjs/locale/fr"), a.locale(c);
|
|
447
447
|
})().then();
|
|
448
448
|
}, [a, r, e]), null;
|
|
449
|
-
},
|
|
450
|
-
if (
|
|
449
|
+
}, Je = () => (O(() => {
|
|
450
|
+
if (F)
|
|
451
451
|
return;
|
|
452
|
-
const e = (
|
|
452
|
+
const e = (n) => {
|
|
453
453
|
try {
|
|
454
|
-
|
|
454
|
+
n.preventDefault(), n.stopPropagation(), n.stopImmediatePropagation(), window.location.reload();
|
|
455
455
|
} catch {
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
return window.addEventListener("vite:preloadError", e), () => {
|
|
459
459
|
window.removeEventListener("vite:preloadError", e);
|
|
460
460
|
};
|
|
461
|
-
}, []), null), we = (e) => e && typeof e == "function",
|
|
461
|
+
}, []), null), we = (e) => e && typeof e == "function", Re = (e) => e && typeof e == "function", Ge = ({
|
|
462
462
|
children: e,
|
|
463
|
-
defaultQueriesOptions:
|
|
464
|
-
defaultMutationsOptions:
|
|
463
|
+
defaultQueriesOptions: n,
|
|
464
|
+
defaultMutationsOptions: o,
|
|
465
465
|
...a
|
|
466
466
|
}) => {
|
|
467
|
-
const { libraries: r } = j
|
|
467
|
+
const { libraries: r } = A(j), s = a?.QueryClient || r?.reactQuery?.QueryClient, c = a?.QueryClientProvider || r?.reactQuery?.QueryClientProvider;
|
|
468
468
|
if (!s)
|
|
469
469
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
470
470
|
if (!c)
|
|
471
471
|
throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
472
472
|
if (!we(c))
|
|
473
473
|
throw new Error("Provided QueryClientProvider dependencies are not valid.");
|
|
474
|
-
if (!
|
|
474
|
+
if (!Re(s))
|
|
475
475
|
throw new Error("Provided QueryClient dependencies are not valid.");
|
|
476
476
|
const u = new s({
|
|
477
477
|
defaultOptions: {
|
|
478
478
|
mutations: {
|
|
479
|
-
...
|
|
479
|
+
...o
|
|
480
480
|
},
|
|
481
481
|
queries: {
|
|
482
|
-
getNextPageParam: (
|
|
482
|
+
getNextPageParam: (d, l, i) => d.length + (i || 0),
|
|
483
483
|
refetchOnWindowFocus: !1,
|
|
484
484
|
retry: 3,
|
|
485
|
-
...
|
|
485
|
+
...n
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
});
|
|
489
|
-
return /* @__PURE__ */
|
|
490
|
-
},
|
|
491
|
-
const { libraries:
|
|
492
|
-
(
|
|
493
|
-
if (
|
|
494
|
-
const { response: i } =
|
|
489
|
+
return /* @__PURE__ */ C.jsx(c, { client: u, children: e });
|
|
490
|
+
}, Ke = (e) => {
|
|
491
|
+
const { libraries: n } = A(j), o = e?.i18 || n?.i18, a = e?.i18?.translateFunction || n?.i18?.translateFunction, r = o?.i18next?.t || a || ((l) => l), { unknownErrorTranslationKey: s = "error.unknownError" } = e || {}, c = r(s), u = Y(
|
|
492
|
+
(l) => {
|
|
493
|
+
if (l && typeof l == "object" && "response" in l) {
|
|
494
|
+
const { response: i } = l || {};
|
|
495
495
|
if (i && typeof i == "object" && "reason" in i)
|
|
496
496
|
return String(i.reason);
|
|
497
497
|
if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "reason" in i.data)
|
|
@@ -499,67 +499,67 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
499
499
|
if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "message" in i.data)
|
|
500
500
|
return String(i.data.message);
|
|
501
501
|
if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "detail" in i.data) {
|
|
502
|
-
const { detail:
|
|
503
|
-
if (Array.isArray(
|
|
504
|
-
const { msg:
|
|
505
|
-
if (typeof
|
|
506
|
-
return String(
|
|
502
|
+
const { detail: v } = i.data;
|
|
503
|
+
if (Array.isArray(v) && v.length > 0 && typeof v[0] == "object" && v[0] !== null && "msg" in v[0]) {
|
|
504
|
+
const { msg: E } = v[0];
|
|
505
|
+
if (typeof E == "string")
|
|
506
|
+
return String(E);
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
return
|
|
510
|
+
return l instanceof Error ? l.message : c;
|
|
511
511
|
},
|
|
512
512
|
[c]
|
|
513
513
|
);
|
|
514
|
-
return { getErrorCode:
|
|
515
|
-
const { response: i } =
|
|
514
|
+
return { getErrorCode: Y((l) => {
|
|
515
|
+
const { response: i } = l || {};
|
|
516
516
|
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";
|
|
517
517
|
}, []), printError: u };
|
|
518
|
-
},
|
|
518
|
+
}, qe = ({
|
|
519
519
|
data: e,
|
|
520
|
-
fetchNextPage:
|
|
521
|
-
isFetchingNextPage:
|
|
520
|
+
fetchNextPage: n,
|
|
521
|
+
isFetchingNextPage: o,
|
|
522
522
|
isInitialLoading: a,
|
|
523
523
|
isLoading: r,
|
|
524
524
|
enabled: s = !0
|
|
525
525
|
}) => {
|
|
526
|
-
const c =
|
|
527
|
-
async (
|
|
528
|
-
|
|
526
|
+
const c = Y(
|
|
527
|
+
async (d) => {
|
|
528
|
+
o || !s || await n({ pageParam: d?.pageParam || d.visibleRowsCount });
|
|
529
529
|
},
|
|
530
|
-
[s,
|
|
531
|
-
), u =
|
|
530
|
+
[s, n, o]
|
|
531
|
+
), u = M(() => {
|
|
532
532
|
if (e)
|
|
533
|
-
return e.pages.reduce((
|
|
533
|
+
return e.pages.reduce((d, l) => [...d, ...l], []);
|
|
534
534
|
}, [e]);
|
|
535
535
|
return {
|
|
536
536
|
fetchNextPageOnRowsScrollEnd: c,
|
|
537
|
-
isLoading:
|
|
537
|
+
isLoading: o || r,
|
|
538
538
|
loadingVariant: a ? "skeleton" : "linear-progress",
|
|
539
539
|
rows: u
|
|
540
540
|
};
|
|
541
|
-
},
|
|
542
|
-
const { libraries:
|
|
543
|
-
if (!
|
|
541
|
+
}, Be = (e) => {
|
|
542
|
+
const { libraries: n } = A(j), o = e?.axios || n?.axios, a = e?.localStorageKey || "user";
|
|
543
|
+
if (!o)
|
|
544
544
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
545
|
-
const r =
|
|
545
|
+
const r = Y(
|
|
546
546
|
({ tokenType: c, accessToken: u }) => {
|
|
547
|
-
|
|
547
|
+
o.defaults.headers.common.Authorization = `${c} ${u}`;
|
|
548
548
|
},
|
|
549
|
-
[
|
|
549
|
+
[o.defaults.headers.common]
|
|
550
550
|
), s = () => {
|
|
551
|
-
|
|
551
|
+
o.defaults.headers.common.Authorization = null;
|
|
552
552
|
};
|
|
553
|
-
return
|
|
554
|
-
if (
|
|
553
|
+
return O(() => {
|
|
554
|
+
if (F)
|
|
555
555
|
return;
|
|
556
|
-
const c = ({ newValue: u, key:
|
|
557
|
-
if (
|
|
556
|
+
const c = ({ newValue: u, key: d }) => {
|
|
557
|
+
if (d === a && u)
|
|
558
558
|
try {
|
|
559
|
-
const { accessToken:
|
|
560
|
-
r({ accessToken:
|
|
561
|
-
} catch (
|
|
562
|
-
console.error("Failed to parse newValue from localStorage:",
|
|
559
|
+
const { accessToken: l, tokenType: i } = JSON.parse(u);
|
|
560
|
+
r({ accessToken: l, tokenType: i });
|
|
561
|
+
} catch (l) {
|
|
562
|
+
console.error("Failed to parse newValue from localStorage:", l);
|
|
563
563
|
}
|
|
564
564
|
};
|
|
565
565
|
return window.addEventListener("storage", c), () => {
|
|
@@ -569,21 +569,21 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
569
569
|
clearAuthenticationToken: s,
|
|
570
570
|
setAuthenticationToken: r
|
|
571
571
|
};
|
|
572
|
-
},
|
|
573
|
-
const { fractionDigits:
|
|
574
|
-
return Number.isNaN(s) ? `0${c}${a}` : `${s.toFixed(
|
|
575
|
-
},
|
|
572
|
+
}, be = ({ library: e, date: n, format: o = "ll" }) => e(n).format(o), Se = (e, n) => {
|
|
573
|
+
const { fractionDigits: o = 0, metric: a = "km", spacingBetween: r = !0 } = n || {}, s = Number(e), c = r ? " " : "";
|
|
574
|
+
return Number.isNaN(s) ? `0${c}${a}` : `${s.toFixed(o)}${c}${a}`;
|
|
575
|
+
}, 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(" "), Ae = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, _e = ({ path: e, size: n, apiURL: o }) => {
|
|
576
576
|
if (!e)
|
|
577
577
|
return "";
|
|
578
|
-
const a =
|
|
579
|
-
return typeof
|
|
580
|
-
},
|
|
581
|
-
const { apiURL:
|
|
578
|
+
const a = Ae(e), r = `${o}${a}`, s = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
579
|
+
return typeof n == "number" && s ? `${r.replace("/files", `/thumbs/${n}`)}` : r;
|
|
580
|
+
}, Xe = (e) => {
|
|
581
|
+
const { apiURL: n, libraries: o } = A(j), a = e?.dayjs || o?.dayjs;
|
|
582
582
|
return {
|
|
583
583
|
dateAdapter: (c, u) => {
|
|
584
584
|
if (!a)
|
|
585
585
|
throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
586
|
-
return
|
|
586
|
+
return be({
|
|
587
587
|
date: c,
|
|
588
588
|
format: u,
|
|
589
589
|
library: a
|
|
@@ -591,32 +591,32 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
591
591
|
},
|
|
592
592
|
distanceAdapter: Se,
|
|
593
593
|
filePathAdapter: (c, u) => {
|
|
594
|
-
if (!
|
|
594
|
+
if (!n)
|
|
595
595
|
throw new Error(
|
|
596
596
|
"API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
|
|
597
597
|
);
|
|
598
598
|
return typeof c == "string" && /^https?:\/\//.test(c) ? c : _e({
|
|
599
|
-
apiURL:
|
|
599
|
+
apiURL: n,
|
|
600
600
|
path: c,
|
|
601
601
|
size: u
|
|
602
602
|
});
|
|
603
603
|
},
|
|
604
|
-
worksiteNameAdapter:
|
|
604
|
+
worksiteNameAdapter: je
|
|
605
605
|
};
|
|
606
|
-
},
|
|
607
|
-
const [
|
|
606
|
+
}, D = (e, n) => n === "short" ? e.split("-")[0] : e, He = (e, n = "full") => {
|
|
607
|
+
const [o, a] = J(() => {
|
|
608
608
|
const r = e?.language || navigator.language;
|
|
609
|
-
return e && "isInitialized" in e && e.isInitialized,
|
|
609
|
+
return e && "isInitialized" in e && e.isInitialized, D(r, n);
|
|
610
610
|
});
|
|
611
|
-
return
|
|
612
|
-
e && "isInitialized" in e && e.isInitialized && e.language && a(
|
|
611
|
+
return O(() => {
|
|
612
|
+
e && "isInitialized" in e && e.isInitialized && e.language && a(D(e.language, n));
|
|
613
613
|
const r = (s) => {
|
|
614
|
-
a(
|
|
614
|
+
a(D(s, n));
|
|
615
615
|
};
|
|
616
616
|
return e?.on?.("languageChanged", r), () => {
|
|
617
617
|
e?.off?.("languageChanged", r);
|
|
618
618
|
};
|
|
619
|
-
}, [e,
|
|
619
|
+
}, [e, n]), o;
|
|
620
620
|
}, Pe = "tracktor.filter", Te = {
|
|
621
621
|
getFilter: () => {
|
|
622
622
|
},
|
|
@@ -625,94 +625,114 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
625
625
|
},
|
|
626
626
|
setFilter: () => {
|
|
627
627
|
}
|
|
628
|
-
},
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
|
|
628
|
+
}, oe = (e, n, o) => `${o}_${e}=>${n}`, Ce = (e) => e.reduce((n, o) => {
|
|
629
|
+
const a = localStorage.getItem(o);
|
|
630
|
+
if (a)
|
|
631
|
+
try {
|
|
632
|
+
const r = JSON.parse(a), s = Object.keys(r)?.[0];
|
|
633
|
+
s && (n[s] = Object.values(r)?.[0]);
|
|
634
|
+
} catch {
|
|
635
|
+
}
|
|
636
|
+
return n;
|
|
637
|
+
}, {}), Ze = (e) => {
|
|
638
|
+
const { libraries: n, localStorageKeys: o } = A(j), a = e?.reactRouter || n?.reactRouter, { pathname: r } = a?.useLocation?.() ?? { pathname: "/" }, [s, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
|
|
639
|
+
}], [u, d] = J({}), l = o?.filter || Pe, i = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl;
|
|
640
|
+
if (F)
|
|
632
641
|
return Te;
|
|
633
642
|
if (!a)
|
|
634
643
|
throw new Error(
|
|
635
|
-
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of
|
|
644
|
+
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter."
|
|
636
645
|
);
|
|
637
|
-
const
|
|
638
|
-
|
|
646
|
+
const v = () => Object.keys(localStorage).filter(
|
|
647
|
+
(g) => g.startsWith(l) && g.endsWith(e?.pathname || r)
|
|
648
|
+
), E = (g, m, _ = !0) => {
|
|
649
|
+
const p = oe(g, e?.pathname || r, l);
|
|
639
650
|
if (!m || Array.isArray(m) && !m.length) {
|
|
640
|
-
s.delete(g), c(s)
|
|
651
|
+
i ? (s.delete(g), c(s)) : d((h) => {
|
|
652
|
+
const P = { ...h };
|
|
653
|
+
return delete P[g], P;
|
|
654
|
+
}), localStorage.removeItem(p);
|
|
641
655
|
return;
|
|
642
656
|
}
|
|
643
|
-
|
|
657
|
+
_ && m && localStorage.setItem(p, JSON.stringify({ ...s, [g]: m })), i && m ? (s.set(g, JSON.stringify(m)), c(s)) : !i && m && d((h) => ({ ...h, [g]: m }));
|
|
644
658
|
};
|
|
645
659
|
return {
|
|
646
660
|
getFilter: (g, m) => {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
return
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
661
|
+
if (!i) {
|
|
662
|
+
const h = u[g];
|
|
663
|
+
if (h !== void 0)
|
|
664
|
+
return h;
|
|
665
|
+
}
|
|
666
|
+
if (i) {
|
|
667
|
+
const h = s.get(g);
|
|
668
|
+
if (h)
|
|
669
|
+
try {
|
|
670
|
+
return JSON.parse(h);
|
|
671
|
+
} catch {
|
|
672
|
+
return h;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
const _ = oe(g, e?.pathname || r, l), p = localStorage.getItem(_);
|
|
676
|
+
if (p)
|
|
656
677
|
try {
|
|
657
|
-
|
|
678
|
+
const h = JSON.parse(p)[g];
|
|
679
|
+
return !i && h !== void 0 && d((P) => ({ ...P, [g]: h })), h;
|
|
658
680
|
} catch {
|
|
659
681
|
}
|
|
660
682
|
return m;
|
|
661
683
|
},
|
|
662
684
|
getFilters: () => {
|
|
663
|
-
const g =
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
return p;
|
|
672
|
-
}, {});
|
|
685
|
+
const g = v(), m = Ce(g);
|
|
686
|
+
if (i) {
|
|
687
|
+
const _ = Object.fromEntries(s.entries());
|
|
688
|
+
return {
|
|
689
|
+
...m,
|
|
690
|
+
..._
|
|
691
|
+
};
|
|
692
|
+
}
|
|
673
693
|
return {
|
|
674
|
-
...
|
|
675
|
-
...
|
|
694
|
+
...m,
|
|
695
|
+
...u
|
|
676
696
|
};
|
|
677
697
|
},
|
|
678
|
-
handleFilter: (g, m) => (
|
|
698
|
+
handleFilter: (g, m) => (_, p) => {
|
|
679
699
|
if (p || Array.isArray(p) && p.length === 0) {
|
|
680
|
-
const
|
|
681
|
-
|
|
700
|
+
const h = m || "value", P = typeof p == "object" && h in p ? p[h] : p;
|
|
701
|
+
E(g, P);
|
|
682
702
|
return;
|
|
683
703
|
}
|
|
684
|
-
|
|
704
|
+
E(g, void 0);
|
|
685
705
|
},
|
|
686
|
-
setFilter:
|
|
706
|
+
setFilter: E
|
|
687
707
|
};
|
|
688
|
-
},
|
|
689
|
-
const a = e.split("/").filter((r) => r.length > 0).map((r) => r.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((
|
|
708
|
+
}, ke = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), Oe = (e) => {
|
|
709
|
+
const a = e.split("/").filter((r) => r.length > 0).map((r) => r.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join("")).join("");
|
|
690
710
|
return a.charAt(0).toLowerCase() + a.slice(1);
|
|
691
|
-
},
|
|
692
|
-
const r =
|
|
711
|
+
}, xe = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), Ie = (e, n, o, a) => {
|
|
712
|
+
const r = Oe(n), s = ke(o), c = `${r}${s}`;
|
|
693
713
|
return e && typeof e == "object" && "operationId" in e && a?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
|
|
694
|
-
},
|
|
695
|
-
const
|
|
714
|
+
}, Ne = (e, n) => {
|
|
715
|
+
const o = {};
|
|
696
716
|
return e?.forEach((a) => {
|
|
697
|
-
|
|
717
|
+
o[a] = {
|
|
698
718
|
query: {
|
|
699
719
|
useInfinite: !0,
|
|
700
720
|
useInfiniteQueryParam: "offset",
|
|
701
721
|
useQuery: !0
|
|
702
722
|
}
|
|
703
723
|
};
|
|
704
|
-
}),
|
|
705
|
-
|
|
724
|
+
}), n?.filter((a) => !o[a]).forEach((a) => {
|
|
725
|
+
o[a] = {
|
|
706
726
|
query: {
|
|
707
727
|
useQuery: !0
|
|
708
728
|
}
|
|
709
729
|
};
|
|
710
|
-
}), Object.keys(
|
|
711
|
-
},
|
|
712
|
-
const { output: r, useInfiniteIds: s, useQueryIds: c, input: u = "./openapi.json" } = a || {},
|
|
730
|
+
}), Object.keys(o).length ? o : void 0;
|
|
731
|
+
}, et = (e) => (Array.isArray(e) ? e : [e]).reduce((o, a) => {
|
|
732
|
+
const { output: r, useInfiniteIds: s, useQueryIds: c, input: u = "./openapi.json" } = a || {}, d = xe(u);
|
|
713
733
|
return {
|
|
714
|
-
...
|
|
715
|
-
[
|
|
734
|
+
...o,
|
|
735
|
+
[d]: {
|
|
716
736
|
hooks: {
|
|
717
737
|
afterAllFilesWrite: "prettier src/api/ --write"
|
|
718
738
|
},
|
|
@@ -723,50 +743,50 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
723
743
|
mode: "tags-split",
|
|
724
744
|
override: {
|
|
725
745
|
...(s?.length || c?.length) && {
|
|
726
|
-
operations:
|
|
746
|
+
operations: Ne(s, c)
|
|
727
747
|
},
|
|
728
|
-
header: (
|
|
748
|
+
header: (l) => [
|
|
729
749
|
"Generated by orval 🍺",
|
|
730
|
-
...
|
|
731
|
-
...
|
|
750
|
+
...l.title ? [l.title] : [],
|
|
751
|
+
...l.description ? [l.description] : []
|
|
732
752
|
],
|
|
733
753
|
mutator: {
|
|
734
754
|
name: "axiosCustomInstance",
|
|
735
755
|
path: "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"
|
|
736
756
|
},
|
|
737
|
-
operationName: (
|
|
757
|
+
operationName: (l, i, v) => Ie(l, i, v, c),
|
|
738
758
|
query: {
|
|
739
759
|
useQuery: !0
|
|
740
760
|
}
|
|
741
761
|
},
|
|
742
|
-
schemas: r?.schemas || `src/api/${
|
|
743
|
-
target: r?.target || `src/api/${
|
|
762
|
+
schemas: r?.schemas || `src/api/${d}/model`,
|
|
763
|
+
target: r?.target || `src/api/${d}/services/api.ts`,
|
|
744
764
|
...r
|
|
745
765
|
}
|
|
746
766
|
}
|
|
747
767
|
};
|
|
748
768
|
}, {});
|
|
749
769
|
export {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
770
|
+
ze as GTMSendPageView,
|
|
771
|
+
Ue as InitializeAxiosConfig,
|
|
772
|
+
Me as InitializeDaysJSConfig,
|
|
773
|
+
We as InitializeI18nConfig,
|
|
754
774
|
Qe as InitializeSentryConfig,
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
775
|
+
j as InjectDependenciesContext,
|
|
776
|
+
De as InjectDependenciesProvider,
|
|
777
|
+
Ve as MaskTextField,
|
|
778
|
+
Je as PreloadErrorHandler,
|
|
759
779
|
Ge as QueryClientProviderWithConfig,
|
|
760
|
-
|
|
780
|
+
Ye as RequireAuth,
|
|
761
781
|
$e as axiosCustomInstance,
|
|
762
|
-
|
|
782
|
+
be as dateAdapter,
|
|
763
783
|
Se as distanceAdapter,
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
784
|
+
et as getOrvalConfig,
|
|
785
|
+
Xe as useAdapter,
|
|
786
|
+
Be as useAuth,
|
|
787
|
+
He as useCurrentLanguage,
|
|
788
|
+
Ze as useFilters,
|
|
789
|
+
qe as useInfiniteDataGrid,
|
|
790
|
+
Ke as useResponseError,
|
|
791
|
+
je as worksiteNameAdapter
|
|
772
792
|
};
|
package/dist/main.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(g,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],O):(g=typeof globalThis<"u"?globalThis:g||self,O(g["@tracktor/shared-module"]={},g.axios,g.React))})(this,function(g,O,p){"use strict";const ae=(e,n)=>{const o=O.CancelToken.source(),a=O({...e,...n,cancelToken:o.token}).then(({data:r})=>r);return a.cancel=()=>{o.cancel("Query was cancelled")},a};var Y={exports:{}},L={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.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
|
|
9
|
+
*/var G;function se(){if(G)return L;G=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function o(a,r,s){var c=null;if(s!==void 0&&(c=""+s),r.key!==void 0&&(c=""+r.key),"key"in r){s={};for(var l in r)l!=="key"&&(s[l]=r[l])}else s=r;return r=s.ref,{$$typeof:e,type:a,key:c,ref:r!==void 0?r:null,props:s}}return L.Fragment=n,L.jsx=o,L.jsxs=o,L}var F={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
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
|
|
17
|
+
*/var J;function ie(){return J||(J=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Qe?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case h:return"Profiler";case y:return"StrictMode";case P:return"Suspense";case Ue:return"SuspenseList";case Me:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case x:return"Portal";case m:return(t.displayName||"Context")+".Provider";case _:return(t._context.displayName||"Context")+".Consumer";case E:var f=t.render;return t=t.displayName,t||(t=f.displayName||f.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case We:return f=t.displayName||null,f!==null?f:e(t.type)||"Memo";case q:f=t._payload,t=t._init;try{return e(t(f))}catch{}}return null}function n(t){return""+t}function o(t){try{n(t);var f=!1}catch{f=!0}if(f){f=console;var v=f.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return v.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),n(t)}}function a(t){if(t===C)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===q)return"<...>";try{var f=e(t);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function r(){var t=U.A;return t===null?null:t.getOwner()}function s(){return Error("react-stack-top-frame")}function c(t){if($.call(t,"key")){var f=Object.getOwnPropertyDescriptor(t,"key").get;if(f&&f.isReactWarning)return!1}return t.key!==void 0}function l(t,f){function v(){ee||(ee=!0,console.error("%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://react.dev/link/special-props)",f))}v.isReactWarning=!0,Object.defineProperty(t,"key",{get:v,configurable:!0})}function d(){var t=e(this.type);return te[t]||(te[t]=!0,console.error("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.")),t=this.props.ref,t!==void 0?t:null}function u(t,f,v,R,I,T,M,Q){return v=T.ref,t={$$typeof:j,type:t,key:f,props:T,_owner:I},(v!==void 0?v:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:d}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function i(t,f,v,R,I,T,M,Q){var S=f.children;if(S!==void 0)if(R)if(Ve(S)){for(R=0;R<S.length;R++)w(S[R]);Object.freeze&&Object.freeze(S)}else console.error("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 w(S);if($.call(f,"key")){S=e(t);var N=Object.keys(f).filter(function(Ge){return Ge!=="key"});R=0<N.length?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}",oe[S+R]||(N=0<N.length?"{"+N.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
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} />`,b,R,O,R),oe[R+b]=!0)}if(R=null,v!==void 0&&(n(v),R=""+v),c(f)&&(n(f.key),R=""+f.key),"key"in f){v={};for(var Q in f)Q!=="key"&&(v[Q]=f[Q])}else v=f;return R&&u(v,typeof t=="function"?t.displayName||t.name||"Unknown":t),d(t,R,_,T,r(),v,U,M)}function E(t){typeof t=="object"&&t!==null&&t.$$typeof===h&&t._store&&(t._store.validated=1)}var m=p,h=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),w=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),ze=Symbol.for("react.suspense_list"),Ue=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Me=Symbol.for("react.activity"),Qe=Symbol.for("react.client.reference"),Y=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,We=Array.isArray,z=console.createTask?console.createTask:function(){return null};m={"react-stack-bottom-frame":function(t){return t()}};var ee,te={},re=m["react-stack-bottom-frame"].bind(m,s)(),ne=z(a(s)),oe={};N.Fragment=g,N.jsx=function(t,f,v,b,T){var _=1e4>Y.recentlyCreatedOwnerStacks++;return i(t,f,v,!1,b,T,_?Error("react-stack-top-frame"):re,_?z(a(t)):ne)},N.jsxs=function(t,f,v,b,T){var _=1e4>Y.recentlyCreatedOwnerStacks++;return i(t,f,v,!0,b,T,_?Error("react-stack-top-frame"):re,_?z(a(t)):ne)}}()),N}var G;function ce(){return G||(G=1,process.env.NODE_ENV==="production"?F.exports=se():F.exports=ie()),F.exports}var P=ce();const j=p.createContext({}),ue=({children:e,apiURL:o,libraries:n,localStorageKeys:a})=>{const r=p.useMemo(()=>({apiURL:o,libraries:n,localStorageKeys:a}),[o,n,a]);return P.jsx(j.Provider,{value:r,children:e})},le="user",de=({Fallback:e,isLogged:o,loginPath:n="/login",redirect401Path:a="/login",...r})=>{const{libraries:s,localStorageKeys:c}=p.useContext(j),u=r?.reactRouter||s?.reactRouter,l=r?.axios||s?.axios,d=r?.localStorageKey||c?.user||le;if(!u)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,E]=p.useState(null),{useLocation:m,Navigate:h,Outlet:S}=u,g=m(),A=p.useRef(!1),C=typeof o=="function"?o():!!o,I=typeof C=="boolean"?C:C?.isLogged;return p.useEffect(()=>{A.current||(A.current=!0,l.interceptors.response.use(w=>w,async w=>(typeof w=="object"&&w&&"response"in w&&w.response&&typeof w.response=="object"&&"status"in w.response&&w.response&&typeof w.response=="object"&&"status"in w.response&&w?.response?.status===401&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(d),E(a)),Promise.reject(w))))},[l.defaults.headers.common,l.interceptors.response,d,a]),I&&!i?P.jsx(p.Suspense,{fallback:e,children:g.state?.from?.state&&g.state?.from?.pathname===n?P.jsx(h,{to:g.state.from.state.from.pathname+g.state.from.state.from.search,replace:!0}):P.jsx(S,{})}):P.jsx(h,{to:n+g.search,state:{from:g},replace:!0})},fe=({data:e,...o})=>{const{libraries:n}=p.useContext(j),a=o?.reactRouter||n?.reactRouter,r=o?.gtm||n?.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:u}=a,{pathname:l}=c(),{sendEvent:d}=s();return p.useEffect(()=>{d({event:"pageView",pathname:l,...e})},[e,l,d]),P.jsx(u,{})},L=(()=>{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:o="accessToken",postContentType:n="application/json",...a})=>{const{apiURL:r=a.apiURL,libraries:s,localStorageKeys:c}=p.useContext(j),u=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||L)return null;if(typeof window<"u"&&window.localStorage){const d=localStorage.getItem(u),i=d?JSON.parse(d):null,E=i?.[e]?i[e]:null,m=i?.[o]?i[o]:null,h=d?`${E} ${m}`:null;h&&(l.defaults.headers.common.Authorization=h)}return l.defaults.baseURL=r,l.defaults.headers.post["Content-Type"]=n,null},me=({debug:e,resources:o,...n})=>{const{libraries:a}=p.useContext(j),r=n?.i18||a?.i18,{i18next:s,initReactI18next:c,languageDetector:u}=r||{};if(L)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(u).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:o,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:o,tracesSampleRate:n,replaysSessionSampleRate:a,replaysOnErrorSampleRate:r,tracePropagationTargets:s,ignoreErrors:c,debug:u,environment:l,release:d,...i})=>{const{libraries:E}=p.useContext(j),m=i?.sentry||E?.sentry,h=i?.reactRouter||E?.reactRouter;if(!m)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!h)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(m.isInitialized())return null;const{createRoutesFromChildren:S,matchRoutes:g,useLocation:A,useNavigationType:C}=h;return(u||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&m.init({debug:u,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:[m.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:S,matchRoutes:g,useEffect:p.useEffect,useLocation:A,useNavigationType:C}),...o||[]],release:d,replaysOnErrorSampleRate:r||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:s,tracesSampleRate:n||1}),null},he=({IMaskMixin:e,...o})=>{const n=p.useMemo(()=>e(({TextField:a,...r})=>P.jsx(a,{...r})),[e]);return P.jsx(n,{...o})},ve=({language:e,...o})=>{const{libraries:n}=p.useContext(j),a=o?.dayjs||n?.dayjs,r=o?.plugin||n?.dayjsPlugin;if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return p.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";r&&r.forEach(u=>{u&&a.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),a.locale(c)})().then()},[a,r,e]),null},Ee=()=>(p.useEffect(()=>{if(L)return;const e=o=>{try{o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),we=e=>e&&typeof e=="function",be=e=>e&&typeof e=="function",Re=({children:e,defaultQueriesOptions:o,defaultMutationsOptions:n,...a})=>{const{libraries:r}=p.useContext(j),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(!we(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!be(s))throw new Error("Provided QueryClient dependencies are not valid.");const u=new s({defaultOptions:{mutations:{...n},queries:{getNextPageParam:(l,d,i)=>l.length+(i||0),refetchOnWindowFocus:!1,retry:3,...o}}});return P.jsx(c,{client:u,children:e})},Se=e=>{const{libraries:o}=p.useContext(j),n=e?.i18||o?.i18,a=e?.i18?.translateFunction||o?.i18?.translateFunction,r=n?.i18next?.t||a||(d=>d),{unknownErrorTranslationKey:s="error.unknownError"}=e||{},c=r(s),u=p.useCallback(d=>{if(d&&typeof d=="object"&&"response"in d){const{response:i}=d||{};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:m}=E[0];if(typeof m=="string")return String(m)}}}return d instanceof Error?d.message:c},[c]);return{getErrorCode:p.useCallback(d=>{const{response:i}=d||{};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:u}},Ae=({data:e,fetchNextPage:o,isFetchingNextPage:n,isInitialLoading:a,isLoading:r,enabled:s=!0})=>{const c=p.useCallback(async l=>{n||!s||await o({pageParam:l?.pageParam||l.visibleRowsCount})},[s,o,n]),u=p.useMemo(()=>{if(e)return e.pages.reduce((l,d)=>[...l,...d],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:n||r,loadingVariant:a?"skeleton":"linear-progress",rows:u}},Ce=e=>{const{libraries:o}=p.useContext(j),n=e?.axios||o?.axios,a=e?.localStorageKey||"user";if(!n)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const r=p.useCallback(({tokenType:c,accessToken:u})=>{n.defaults.headers.common.Authorization=`${c} ${u}`},[n.defaults.headers.common]),s=()=>{n.defaults.headers.common.Authorization=null};return p.useEffect(()=>{if(L)return;const c=({newValue:u,key:l})=>{if(l===a&&u)try{const{accessToken:d,tokenType:i}=JSON.parse(u);r({accessToken:d,tokenType:i})}catch(d){console.error("Failed to parse newValue from localStorage:",d)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}},[a,r]),{clearAuthenticationToken:s,setAuthenticationToken:r}},J=({library:e,date:o,format:n="ll"})=>e(o).format(n),K=(e,o)=>{const{fractionDigits:n=0,metric:a="km",spacingBetween:r=!0}=o||{},s=Number(e),c=r?" ":"";return Number.isNaN(s)?`0${c}${a}`:`${s.toFixed(n)}${c}${a}`},B=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(n=>n.length>0?n.charAt(0).toUpperCase()+n.slice(1):n).join(" "),je=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,_e=({path:e,size:o,apiURL:n})=>{if(!e)return"";const a=je(e),r=`${n}${a}`,s=r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof o=="number"&&s?`${r.replace("/files",`/thumbs/${o}`)}`:r},Pe=e=>{const{apiURL:o,libraries:n}=p.useContext(j),a=e?.dayjs||n?.dayjs;return{dateAdapter:(c,u)=>{if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return J({date:c,format:u,library:a})},distanceAdapter:K,filePathAdapter:(c,u)=>{if(!o)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:_e({apiURL:o,path:c,size:u})},worksiteNameAdapter:B}},D=(e,o)=>o==="short"?e.split("-")[0]:e,Te=(e,o="full")=>{const[n,a]=p.useState(()=>{const r=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,D(r,o)});return p.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(D(e.language,o));const r=s=>{a(D(s,o))};return e?.on?.("languageChanged",r),()=>{e?.off?.("languageChanged",r)}},[e,o]),n},ke="tracktor.filter",Ie={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},X=(e,o,n)=>`${n}_${e}=>${o}`,Oe=e=>{const{libraries:o,localStorageKeys:n}=p.useContext(j),a=e?.reactRouter||o?.reactRouter,{pathname:r}=a?.useLocation?.()??{pathname:"/"},[s,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],u=n?.filter||ke;if(L)return Ie;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const l=(m,h,S=!0)=>{const g=X(m,e?.pathname||r,u);if(!h||Array.isArray(h)&&!h.length){s.delete(m),c(s),localStorage.removeItem(g);return}S&&h&&localStorage.setItem(g,JSON.stringify({...s,[m]:h})),h&&(s.set(m,JSON.stringify(h)),c(s))};return{getFilter:(m,h)=>{const S=s.get(m);if(S)try{return JSON.parse(S)}catch{return S}const g=X(m,e?.pathname||r,u),A=localStorage.getItem(g);if(A)try{return JSON.parse(A)[m]}catch{}return h},getFilters:()=>{const m=Object.fromEntries(s.entries()),S=Object.keys(localStorage).filter(g=>g.startsWith(u)&&g.endsWith(e?.pathname||r)).reduce((g,A)=>{const C=localStorage.getItem(A);if(C){const I=JSON.parse(C),w=Object.keys(I)?.[0];g[w]=Object.values(I)?.[0]}return g},{});return{...m,...S}},handleFilter:(m,h)=>(S,g)=>{if(g||Array.isArray(g)&&g.length===0){const A=h||"value",C=typeof g=="object"&&A in g?g[A]:g;l(m,C);return}l(m,void 0)},setFilter:l}},xe=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Ne=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)},Le=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Fe=(e,o,n,a)=>{const r=Ne(o),s=xe(n),c=`${r}${s}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},De=(e,o)=>{const n={};return e?.forEach(a=>{n[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),o?.filter(a=>!n[a]).forEach(a=>{n[a]={query:{useQuery:!0}}}),Object.keys(n).length?n:void 0},Ye=e=>(Array.isArray(e)?e:[e]).reduce((n,a)=>{const{output:r,useInfiniteIds:s,useQueryIds:c,input:u="./openapi.json"}=a||{},l=Le(u);return{...n,[l]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:u,output:{baseUrl:r?.baseUrl,client:"react-query",mode:"tags-split",override:{...(s?.length||c?.length)&&{operations:De(s,c)},header:d=>["Generated by orval 🍺",...d.title?[d.title]:[],...d.description?[d.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(d,i,E)=>Fe(d,i,E,c),query:{useQuery:!0}},schemas:r?.schemas||`src/api/${l}/model`,target:r?.target||`src/api/${l}/services/api.ts`,...r}}}},{});y.GTMSendPageView=fe,y.InitializeAxiosConfig=ge,y.InitializeDaysJSConfig=ve,y.InitializeI18nConfig=me,y.InitializeSentryConfig=ye,y.InjectDependenciesContext=j,y.InjectDependenciesProvider=ue,y.MaskTextField=he,y.PreloadErrorHandler=Ee,y.QueryClientProviderWithConfig=Re,y.RequireAuth=de,y.axiosCustomInstance=ae,y.dateAdapter=J,y.distanceAdapter=K,y.getOrvalConfig=Ye,y.useAdapter=Pe,y.useAuth=Ce,y.useCurrentLanguage=Te,y.useFilters=Oe,y.useInfiniteDataGrid=Ae,y.useResponseError=Se,y.worksiteNameAdapter=B,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
22
|
+
<%s key={someKey} {...props} />`,R,S,N,S),oe[S+R]=!0)}if(S=null,v!==void 0&&(o(v),S=""+v),c(f)&&(o(f.key),S=""+f.key),"key"in f){v={};for(var V in f)V!=="key"&&(v[V]=f[V])}else v=f;return S&&l(v,typeof t=="function"?t.displayName||t.name||"Unknown":t),u(t,S,T,I,r(),v,M,Q)}function w(t){typeof t=="object"&&t!==null&&t.$$typeof===j&&t._store&&(t._store.validated=1)}var b=p,j=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),m=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),Ue=Symbol.for("react.suspense_list"),We=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Me=Symbol.for("react.activity"),Qe=Symbol.for("react.client.reference"),U=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,Ve=Array.isArray,W=console.createTask?console.createTask:function(){return null};b={"react-stack-bottom-frame":function(t){return t()}};var ee,te={},re=b["react-stack-bottom-frame"].bind(b,s)(),ne=W(a(s)),oe={};F.Fragment=C,F.jsx=function(t,f,v,R,I){var T=1e4>U.recentlyCreatedOwnerStacks++;return i(t,f,v,!1,R,I,T?Error("react-stack-top-frame"):re,T?W(a(t)):ne)},F.jsxs=function(t,f,v,R,I){var T=1e4>U.recentlyCreatedOwnerStacks++;return i(t,f,v,!0,R,I,T?Error("react-stack-top-frame"):re,T?W(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=p.createContext({}),le=({children:e,apiURL:n,libraries:o,localStorageKeys:a})=>{const r=p.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}=p.useContext(A),l=r?.reactRouter||s?.reactRouter,d=r?.axios||s?.axios,u=r?.localStorageKey||c?.user||ue;if(!l)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,w]=p.useState(null),{useLocation:b,Navigate:j,Outlet:x}=l,C=b(),y=p.useRef(!1),h=typeof n=="function"?n():!!n,_=typeof h=="boolean"?h:h?.isLogged;return p.useEffect(()=>{y.current||(y.current=!0,d.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&&(d.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(u),w(a)),Promise.reject(m))))},[d.defaults.headers.common,d.interceptors.response,u,a]),_&&!i?k.jsx(p.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}=p.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:l}=a,{pathname:d}=c(),{sendEvent:u}=s();return p.useEffect(()=>{u({event:"pageView",pathname:d,...e})},[e,d,u]),k.jsx(l,{})},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}=p.useContext(A),l=a?.userLocalStorageKey||c?.user||pe,d=a?.axios||s?.axios;if(!d)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!d?.defaults||D)return null;if(typeof window<"u"&&window.localStorage){const u=localStorage.getItem(l),i=u?JSON.parse(u):null,w=i?.[e]?i[e]:null,b=i?.[n]?i[n]:null,j=u?`${w} ${b}`:null;j&&(d.defaults.headers.common.Authorization=j)}return d.defaults.baseURL=r,d.defaults.headers.post["Content-Type"]=o,null},me=({debug:e,resources:n,...o})=>{const{libraries:a}=p.useContext(A),r=o?.i18||a?.i18,{i18next:s,initReactI18next:c,languageDetector:l}=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(l).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",d=>{document.documentElement.setAttribute("lang",d)})),null},ye=({dsn:e,integrations:n,tracesSampleRate:o,replaysSessionSampleRate:a,replaysOnErrorSampleRate:r,tracePropagationTargets:s,ignoreErrors:c,debug:l,environment:d,release:u,...i})=>{const{libraries:w}=p.useContext(A),b=i?.sentry||w?.sentry,j=i?.reactRouter||w?.reactRouter;if(!b)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(b.isInitialized())return null;const{createRoutesFromChildren:x,matchRoutes:C,useLocation:y,useNavigationType:h}=j;return(l||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&b.init({debug:l,dsn:e,environment:d||"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:[b.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:x,matchRoutes:C,useEffect:p.useEffect,useLocation:y,useNavigationType:h}),...n||[]],release:u,replaysOnErrorSampleRate:r||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:s,tracesSampleRate:o||1}),null},he=({IMaskMixin:e,...n})=>{const o=p.useMemo(()=>e(({TextField:a,...r})=>k.jsx(a,{...r})),[e]);return k.jsx(o,{...n})},ve=({language:e,...n})=>{const{libraries:o}=p.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 p.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";r&&r.forEach(l=>{l&&a.extend(l)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),a.locale(c)})().then()},[a,r,e]),null},Ee=()=>(p.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=e=>e&&typeof e=="function",be=e=>e&&typeof e=="function",Re=({children:e,defaultQueriesOptions:n,defaultMutationsOptions:o,...a})=>{const{libraries:r}=p.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(!we(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!be(s))throw new Error("Provided QueryClient dependencies are not valid.");const l=new s({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(d,u,i)=>d.length+(i||0),refetchOnWindowFocus:!1,retry:3,...n}}});return k.jsx(c,{client:l,children:e})},Se=e=>{const{libraries:n}=p.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),l=p.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:w}=i.data;if(Array.isArray(w)&&w.length>0&&typeof w[0]=="object"&&w[0]!==null&&"msg"in w[0]){const{msg:b}=w[0];if(typeof b=="string")return String(b)}}}return u instanceof Error?u.message:c},[c]);return{getErrorCode:p.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:l}},Ae=({data:e,fetchNextPage:n,isFetchingNextPage:o,isInitialLoading:a,isLoading:r,enabled:s=!0})=>{const c=p.useCallback(async d=>{o||!s||await n({pageParam:d?.pageParam||d.visibleRowsCount})},[s,n,o]),l=p.useMemo(()=>{if(e)return e.pages.reduce((d,u)=>[...d,...u],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:o||r,loadingVariant:a?"skeleton":"linear-progress",rows:l}},Ce=e=>{const{libraries:n}=p.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=p.useCallback(({tokenType:c,accessToken:l})=>{o.defaults.headers.common.Authorization=`${c} ${l}`},[o.defaults.headers.common]),s=()=>{o.defaults.headers.common.Authorization=null};return p.useEffect(()=>{if(D)return;const c=({newValue:l,key:d})=>{if(d===a&&l)try{const{accessToken:u,tokenType:i}=JSON.parse(l);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),X=(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}`},H=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),je=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,_e=({path:e,size:n,apiURL:o})=>{if(!e)return"";const a=je(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},Pe=e=>{const{apiURL:n,libraries:o}=p.useContext(A),a=e?.dayjs||o?.dayjs;return{dateAdapter:(c,l)=>{if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return B({date:c,format:l,library:a})},distanceAdapter:X,filePathAdapter:(c,l)=>{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:_e({apiURL:n,path:c,size:l})},worksiteNameAdapter:H}},z=(e,n)=>n==="short"?e.split("-")[0]:e,Te=(e,n="full")=>{const[o,a]=p.useState(()=>{const r=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,z(r,n)});return p.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(z(e.language,n));const r=s=>{a(z(s,n))};return e?.on?.("languageChanged",r),()=>{e?.off?.("languageChanged",r)}},[e,n]),o},ke="tracktor.filter",Ie={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},Z=(e,n,o)=>`${o}_${e}=>${n}`,Oe=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},{}),xe=e=>{const{libraries:n,localStorageKeys:o}=p.useContext(A),a=e?.reactRouter||n?.reactRouter,{pathname:r}=a?.useLocation?.()??{pathname:"/"},[s,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],[l,d]=p.useState({}),u=o?.filter||ke,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl;if(D)return Ie;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const w=()=>Object.keys(localStorage).filter(y=>y.startsWith(u)&&y.endsWith(e?.pathname||r)),b=(y,h,_=!0)=>{const m=Z(y,e?.pathname||r,u);if(!h||Array.isArray(h)&&!h.length){i?(s.delete(y),c(s)):d(E=>{const P={...E};return delete P[y],P}),localStorage.removeItem(m);return}_&&h&&localStorage.setItem(m,JSON.stringify({...s,[y]:h})),i&&h?(s.set(y,JSON.stringify(h)),c(s)):!i&&h&&d(E=>({...E,[y]:h}))};return{getFilter:(y,h)=>{if(!i){const E=l[y];if(E!==void 0)return E}if(i){const E=s.get(y);if(E)try{return JSON.parse(E)}catch{return E}}const _=Z(y,e?.pathname||r,u),m=localStorage.getItem(_);if(m)try{const E=JSON.parse(m)[y];return!i&&E!==void 0&&d(P=>({...P,[y]:E})),E}catch{}return h},getFilters:()=>{const y=w(),h=Oe(y);if(i){const _=Object.fromEntries(s.entries());return{...h,..._}}return{...h,...l}},handleFilter:(y,h)=>(_,m)=>{if(m||Array.isArray(m)&&m.length===0){const E=h||"value",P=typeof m=="object"&&E in m?m[E]:m;b(y,P);return}b(y,void 0)},setFilter:b}},Ne=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Le=e=>{const a=e.split("/").filter(r=>r.length>0).map(r=>r.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(d=>d.charAt(0).toUpperCase()+d.slice(1)).join("")).join("");return a.charAt(0).toLowerCase()+a.slice(1)},Fe=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),De=(e,n,o,a)=>{const r=Le(n),s=Ne(o),c=`${r}${s}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},Ye=(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},ze=e=>(Array.isArray(e)?e:[e]).reduce((o,a)=>{const{output:r,useInfiniteIds:s,useQueryIds:c,input:l="./openapi.json"}=a||{},d=Fe(l);return{...o,[d]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:l,output:{baseUrl:r?.baseUrl,client:"react-query",mode:"tags-split",override:{...(s?.length||c?.length)&&{operations:Ye(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,w)=>De(u,i,w,c),query:{useQuery:!0}},schemas:r?.schemas||`src/api/${d}/model`,target:r?.target||`src/api/${d}/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=Re,g.RequireAuth=de,g.axiosCustomInstance=ae,g.dateAdapter=B,g.distanceAdapter=X,g.getOrvalConfig=ze,g.useAdapter=Pe,g.useAuth=Ce,g.useCurrentLanguage=Te,g.useFilters=xe,g.useInfiniteDataGrid=Ae,g.useResponseError=Se,g.worksiteNameAdapter=H,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|