@tracktor/shared-module 2.16.0 → 2.17.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 +3 -3
- package/dist/hooks/useFilters.d.ts +5 -0
- package/dist/main.js +191 -191
- 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,5 +1,5 @@
|
|
|
1
1
|
import Z from "axios";
|
|
2
|
-
import de, { createContext as fe, useMemo as
|
|
2
|
+
import de, { createContext as fe, useMemo as V, useContext as j, useState as oe, useRef as pe, useEffect as k, Suspense as ge, useCallback as D } from "react";
|
|
3
3
|
const $e = (e, o) => {
|
|
4
4
|
const n = Z.CancelToken.source(), a = Z({
|
|
5
5
|
...e,
|
|
@@ -10,7 +10,7 @@ const $e = (e, o) => {
|
|
|
10
10
|
n.cancel("Query was cancelled");
|
|
11
11
|
}, a;
|
|
12
12
|
};
|
|
13
|
-
var
|
|
13
|
+
var $ = { exports: {} }, x = {};
|
|
14
14
|
/**
|
|
15
15
|
* @license React
|
|
16
16
|
* react-jsx-runtime.production.js
|
|
@@ -61,11 +61,11 @@ function ye() {
|
|
|
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 y:
|
|
65
65
|
return "Fragment";
|
|
66
66
|
case S:
|
|
67
67
|
return "Profiler";
|
|
68
|
-
case
|
|
68
|
+
case g:
|
|
69
69
|
return "StrictMode";
|
|
70
70
|
case M:
|
|
71
71
|
return "Suspense";
|
|
@@ -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 b:
|
|
82
|
-
return "Portal";
|
|
83
81
|
case v:
|
|
82
|
+
return "Portal";
|
|
83
|
+
case E:
|
|
84
84
|
return (t.displayName || "Context") + ".Provider";
|
|
85
|
-
case
|
|
85
|
+
case _:
|
|
86
86
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
87
|
-
case
|
|
87
|
+
case L:
|
|
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:
|
|
@@ -110,16 +110,16 @@ function ye() {
|
|
|
110
110
|
}
|
|
111
111
|
if (f) {
|
|
112
112
|
f = console;
|
|
113
|
-
var
|
|
114
|
-
return
|
|
113
|
+
var m = f.error, b = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
114
|
+
return m.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
|
-
|
|
117
|
+
b
|
|
118
118
|
), o(t);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
function a(t) {
|
|
122
|
-
if (t ===
|
|
122
|
+
if (t === y) return "<>";
|
|
123
123
|
if (typeof t == "object" && t !== null && t.$$typeof === G)
|
|
124
124
|
return "<...>";
|
|
125
125
|
try {
|
|
@@ -130,7 +130,7 @@ function ye() {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
function r() {
|
|
133
|
-
var t =
|
|
133
|
+
var t = Y.A;
|
|
134
134
|
return t === null ? null : t.getOwner();
|
|
135
135
|
}
|
|
136
136
|
function s() {
|
|
@@ -144,33 +144,33 @@ function ye() {
|
|
|
144
144
|
return t.key !== void 0;
|
|
145
145
|
}
|
|
146
146
|
function u(t, f) {
|
|
147
|
-
function
|
|
147
|
+
function m() {
|
|
148
148
|
K || (K = !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
|
));
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
get:
|
|
153
|
+
m.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
154
|
+
get: m,
|
|
155
155
|
configurable: !0
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function d() {
|
|
159
159
|
var t = e(this.type);
|
|
160
160
|
return q[t] || (q[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
|
|
166
|
-
$$typeof:
|
|
164
|
+
function l(t, f, m, b, C, P, U, W) {
|
|
165
|
+
return m = P.ref, t = {
|
|
166
|
+
$$typeof: p,
|
|
167
167
|
type: t,
|
|
168
168
|
key: f,
|
|
169
|
-
props:
|
|
170
|
-
_owner:
|
|
171
|
-
}, (
|
|
169
|
+
props: P,
|
|
170
|
+
_owner: C
|
|
171
|
+
}, (m !== void 0 ? m : 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,113 +185,113 @@ function ye() {
|
|
|
185
185
|
configurable: !1,
|
|
186
186
|
enumerable: !1,
|
|
187
187
|
writable: !0,
|
|
188
|
-
value:
|
|
188
|
+
value: U
|
|
189
189
|
}), Object.defineProperty(t, "_debugTask", {
|
|
190
190
|
configurable: !1,
|
|
191
191
|
enumerable: !1,
|
|
192
192
|
writable: !0,
|
|
193
|
-
value:
|
|
193
|
+
value: W
|
|
194
194
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
195
195
|
}
|
|
196
|
-
function i(t, f,
|
|
197
|
-
var
|
|
198
|
-
if (
|
|
199
|
-
if (
|
|
200
|
-
if (ue(
|
|
201
|
-
for (
|
|
202
|
-
h(
|
|
203
|
-
Object.freeze && Object.freeze(
|
|
196
|
+
function i(t, f, m, b, C, P, U, W) {
|
|
197
|
+
var R = f.children;
|
|
198
|
+
if (R !== void 0)
|
|
199
|
+
if (b)
|
|
200
|
+
if (ue(R)) {
|
|
201
|
+
for (b = 0; b < R.length; b++)
|
|
202
|
+
h(R[b]);
|
|
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 h(
|
|
208
|
+
else h(R);
|
|
209
209
|
if (J.call(f, "key")) {
|
|
210
|
-
|
|
210
|
+
R = e(t);
|
|
211
211
|
var O = Object.keys(f).filter(function(le) {
|
|
212
212
|
return le !== "key";
|
|
213
213
|
});
|
|
214
|
-
|
|
214
|
+
b = 0 < O.length ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}", H[R + b] || (O = 0 < O.length ? "{" + O.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
215
215
|
`A props object containing a "key" prop is being spread into JSX:
|
|
216
216
|
let props = %s;
|
|
217
217
|
<%s {...props} />
|
|
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
|
-
|
|
222
|
-
|
|
221
|
+
b,
|
|
222
|
+
R,
|
|
223
223
|
O,
|
|
224
|
-
|
|
225
|
-
), H[
|
|
224
|
+
R
|
|
225
|
+
), H[R + b] = !0);
|
|
226
226
|
}
|
|
227
|
-
if (
|
|
228
|
-
|
|
227
|
+
if (R = null, m !== void 0 && (n(m), R = "" + m), c(f) && (n(f.key), R = "" + f.key), "key" in f) {
|
|
228
|
+
m = {};
|
|
229
229
|
for (var Q in f)
|
|
230
|
-
Q !== "key" && (
|
|
231
|
-
} else
|
|
232
|
-
return
|
|
233
|
-
|
|
230
|
+
Q !== "key" && (m[Q] = f[Q]);
|
|
231
|
+
} else m = f;
|
|
232
|
+
return R && u(
|
|
233
|
+
m,
|
|
234
234
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
235
|
-
),
|
|
235
|
+
), l(
|
|
236
236
|
t,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
R,
|
|
238
|
+
P,
|
|
239
|
+
C,
|
|
240
240
|
r(),
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
m,
|
|
242
|
+
U,
|
|
243
|
+
W
|
|
244
244
|
);
|
|
245
245
|
}
|
|
246
246
|
function h(t) {
|
|
247
|
-
typeof t == "object" && t !== null && t.$$typeof ===
|
|
247
|
+
typeof t == "object" && t !== null && t.$$typeof === p && t._store && (t._store.validated = 1);
|
|
248
248
|
}
|
|
249
|
-
var
|
|
249
|
+
var w = de, p = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), S = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), E = Symbol.for("react.context"), L = Symbol.for("react.forward_ref"), M = 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"), Y = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, ue = Array.isArray, z = console.createTask ? console.createTask : function() {
|
|
250
250
|
return null;
|
|
251
251
|
};
|
|
252
|
-
|
|
252
|
+
w = {
|
|
253
253
|
"react-stack-bottom-frame": function(t) {
|
|
254
254
|
return t();
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
var K, q = {}, B =
|
|
258
|
-
|
|
257
|
+
var K, q = {}, B = w["react-stack-bottom-frame"].bind(
|
|
258
|
+
w,
|
|
259
259
|
s
|
|
260
|
-
)(), X =
|
|
261
|
-
I.Fragment =
|
|
262
|
-
var
|
|
260
|
+
)(), X = z(a(s)), H = {};
|
|
261
|
+
I.Fragment = y, I.jsx = function(t, f, m, b, C) {
|
|
262
|
+
var P = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
263
263
|
return i(
|
|
264
264
|
t,
|
|
265
265
|
f,
|
|
266
|
-
|
|
266
|
+
m,
|
|
267
267
|
!1,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
b,
|
|
269
|
+
C,
|
|
270
|
+
P ? Error("react-stack-top-frame") : B,
|
|
271
|
+
P ? z(a(t)) : X
|
|
272
272
|
);
|
|
273
|
-
}, I.jsxs = function(t, f,
|
|
274
|
-
var
|
|
273
|
+
}, I.jsxs = function(t, f, m, b, C) {
|
|
274
|
+
var P = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
275
275
|
return i(
|
|
276
276
|
t,
|
|
277
277
|
f,
|
|
278
|
-
|
|
278
|
+
m,
|
|
279
279
|
!0,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
b,
|
|
281
|
+
C,
|
|
282
|
+
P ? Error("react-stack-top-frame") : B,
|
|
283
|
+
P ? z(a(t)) : X
|
|
284
284
|
);
|
|
285
285
|
};
|
|
286
286
|
}()), I;
|
|
287
287
|
}
|
|
288
288
|
var re;
|
|
289
289
|
function he() {
|
|
290
|
-
return re || (re = 1, process.env.NODE_ENV === "production" ?
|
|
290
|
+
return re || (re = 1, process.env.NODE_ENV === "production" ? $.exports = me() : $.exports = ye()), $.exports;
|
|
291
291
|
}
|
|
292
|
-
var
|
|
292
|
+
var T = he();
|
|
293
293
|
const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys: a }) => {
|
|
294
|
-
const r =
|
|
294
|
+
const r = V(
|
|
295
295
|
() => ({
|
|
296
296
|
apiURL: o,
|
|
297
297
|
libraries: n,
|
|
@@ -299,18 +299,18 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
299
299
|
}),
|
|
300
300
|
[o, n, a]
|
|
301
301
|
);
|
|
302
|
-
return /* @__PURE__ */
|
|
302
|
+
return /* @__PURE__ */ T.jsx(A.Provider, { value: r, children: e });
|
|
303
303
|
}, ve = "user", De = ({ Fallback: e, isLogged: o, loginPath: n = "/login", redirect401Path: a = "/login", ...r }) => {
|
|
304
|
-
const { libraries: s, localStorageKeys: c } = j(A), u = r?.reactRouter || s?.reactRouter,
|
|
304
|
+
const { libraries: s, localStorageKeys: c } = j(A), 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, h] = oe(null), { useLocation:
|
|
308
|
-
return
|
|
309
|
-
|
|
310
|
-
(
|
|
311
|
-
async (
|
|
307
|
+
const [i, h] = oe(null), { useLocation: w, Navigate: p, Outlet: v } = u, y = w(), g = pe(!1), S = typeof o == "function" ? o() : !!o, _ = typeof S == "boolean" ? S : S?.isLogged;
|
|
308
|
+
return k(() => {
|
|
309
|
+
g.current || (g.current = !0, d.interceptors.response.use(
|
|
310
|
+
(E) => E,
|
|
311
|
+
async (E) => (typeof E == "object" && E && "response" in E && E.response && typeof E.response == "object" && "status" in E.response && E.response && typeof E.response == "object" && "status" in E.response && E?.response?.status === 401 && (d.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(l), h(a)), Promise.reject(E))
|
|
312
312
|
));
|
|
313
|
-
}, [
|
|
313
|
+
}, [d.defaults.headers.common, d.interceptors.response, l, a]), _ && !i ? /* @__PURE__ */ T.jsx(ge, { fallback: e, children: y.state?.from?.state && y.state?.from?.pathname === n ? /* @__PURE__ */ T.jsx(p, { to: y.state.from.state.from.pathname + y.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ T.jsx(v, {}) }) : /* @__PURE__ */ T.jsx(p, { to: n + y.search, state: { from: y }, replace: !0 });
|
|
314
314
|
}, Ye = ({ data: e, ...o }) => {
|
|
315
315
|
const { libraries: n } = j(A), a = o?.reactRouter || n?.reactRouter, r = o?.gtm || n?.gtm;
|
|
316
316
|
if (!a)
|
|
@@ -319,14 +319,14 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
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 k(() => {
|
|
324
|
+
l({
|
|
325
325
|
event: "pageView",
|
|
326
|
-
pathname:
|
|
326
|
+
pathname: d,
|
|
327
327
|
...e
|
|
328
328
|
});
|
|
329
|
-
}, [e,
|
|
329
|
+
}, [e, d, l]), /* @__PURE__ */ T.jsx(u, {});
|
|
330
330
|
}, N = (() => {
|
|
331
331
|
try {
|
|
332
332
|
return typeof global == "object" && global !== null && ("HermesInternal" in global || // Hermes JS engine
|
|
@@ -341,16 +341,16 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
341
341
|
postContentType: n = "application/json",
|
|
342
342
|
...a
|
|
343
343
|
}) => {
|
|
344
|
-
const { apiURL: r = a.apiURL, libraries: s, localStorageKeys: c } = j(A), u = a?.userLocalStorageKey || c?.user || Ee,
|
|
345
|
-
if (!
|
|
344
|
+
const { apiURL: r = a.apiURL, libraries: s, localStorageKeys: c } = j(A), 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 || N)
|
|
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, h = i?.[e] ? i[e] : null, w = i?.[o] ? i[o] : null, p = l ? `${h} ${w}` : null;
|
|
351
|
+
p && (d.defaults.headers.common.Authorization = p);
|
|
352
352
|
}
|
|
353
|
-
return
|
|
353
|
+
return d.defaults.baseURL = r, d.defaults.headers.post["Content-Type"] = n, null;
|
|
354
354
|
}, Ue = ({ debug: e, resources: o, ...n }) => {
|
|
355
355
|
const { libraries: a } = j(A), r = n?.i18 || a?.i18, { i18next: s, initReactI18next: c, languageDetector: u } = r || {};
|
|
356
356
|
if (N)
|
|
@@ -372,10 +372,10 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
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
|
+
}, We = ({
|
|
379
379
|
dsn: e,
|
|
380
380
|
integrations: o,
|
|
381
381
|
tracesSampleRate: n,
|
|
@@ -384,22 +384,22 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
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: h } = j(A),
|
|
392
|
-
if (!
|
|
391
|
+
const { libraries: h } = j(A), w = i?.sentry || h?.sentry, p = i?.reactRouter || h?.reactRouter;
|
|
392
|
+
if (!w)
|
|
393
393
|
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
394
|
-
if (!
|
|
394
|
+
if (!p)
|
|
395
395
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
396
|
-
if (
|
|
396
|
+
if (w.isInitialized())
|
|
397
397
|
return null;
|
|
398
|
-
const { createRoutesFromChildren:
|
|
399
|
-
return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") &&
|
|
398
|
+
const { createRoutesFromChildren: v, matchRoutes: y, useLocation: g, useNavigationType: S } = p;
|
|
399
|
+
return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && w.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:
|
|
413
|
+
w.reactRouterV6BrowserTracingIntegration({
|
|
414
|
+
createRoutesFromChildren: v,
|
|
415
|
+
matchRoutes: y,
|
|
416
|
+
useEffect: k,
|
|
417
|
+
useLocation: g,
|
|
418
418
|
useNavigationType: S
|
|
419
419
|
}),
|
|
420
420
|
...o || []
|
|
421
421
|
],
|
|
422
|
-
release:
|
|
422
|
+
release: l,
|
|
423
423
|
replaysOnErrorSampleRate: r || 1,
|
|
424
424
|
replaysSessionSampleRate: a || 0.1,
|
|
425
425
|
tracePropagationTargets: s,
|
|
426
426
|
tracesSampleRate: n || 1
|
|
427
427
|
}), null;
|
|
428
|
-
},
|
|
429
|
-
const n =
|
|
428
|
+
}, Qe = ({ IMaskMixin: e, ...o }) => {
|
|
429
|
+
const n = V(
|
|
430
430
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
431
|
-
() => e(({ TextField: a, ...r }) => /* @__PURE__ */
|
|
431
|
+
() => e(({ TextField: a, ...r }) => /* @__PURE__ */ T.jsx(a, { ...r })),
|
|
432
432
|
[e]
|
|
433
433
|
);
|
|
434
|
-
return /* @__PURE__ */
|
|
434
|
+
return /* @__PURE__ */ T.jsx(n, { ...o });
|
|
435
435
|
}, Ve = ({ language: e, ...o }) => {
|
|
436
436
|
const { libraries: n } = j(A), a = o?.dayjs || n?.dayjs, r = o?.plugin || n?.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 k(() => {
|
|
442
442
|
(async () => {
|
|
443
443
|
const c = e || navigator.language?.slice(0, 2) || "en";
|
|
444
444
|
r && r.forEach((u) => {
|
|
@@ -446,7 +446,7 @@ 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
|
-
}, Me = () => (
|
|
449
|
+
}, Me = () => (k(() => {
|
|
450
450
|
if (N)
|
|
451
451
|
return;
|
|
452
452
|
const e = (o) => {
|
|
@@ -479,19 +479,19 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
479
479
|
...n
|
|
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
|
...o
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
});
|
|
489
|
-
return /* @__PURE__ */
|
|
489
|
+
return /* @__PURE__ */ T.jsx(c, { client: u, children: e });
|
|
490
490
|
}, Je = (e) => {
|
|
491
|
-
const { libraries: o } = j(A), n = e?.i18 || o?.i18, a = e?.i18?.translateFunction || o?.i18?.translateFunction, r = n?.i18next?.t || a || ((
|
|
492
|
-
(
|
|
493
|
-
if (
|
|
494
|
-
const { response: i } =
|
|
491
|
+
const { libraries: o } = j(A), n = e?.i18 || o?.i18, a = e?.i18?.translateFunction || o?.i18?.translateFunction, r = n?.i18next?.t || a || ((l) => l), { unknownErrorTranslationKey: s = "error.unknownError" } = e || {}, c = r(s), u = D(
|
|
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)
|
|
@@ -501,18 +501,18 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
501
501
|
if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "detail" in i.data) {
|
|
502
502
|
const { detail: h } = i.data;
|
|
503
503
|
if (Array.isArray(h) && h.length > 0 && typeof h[0] == "object" && h[0] !== null && "msg" in h[0]) {
|
|
504
|
-
const { msg:
|
|
505
|
-
if (typeof
|
|
506
|
-
return String(
|
|
504
|
+
const { msg: w } = h[0];
|
|
505
|
+
if (typeof w == "string")
|
|
506
|
+
return String(w);
|
|
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: D((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
|
}, Ke = ({
|
|
@@ -523,14 +523,14 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
523
523
|
isLoading: r,
|
|
524
524
|
enabled: s = !0
|
|
525
525
|
}) => {
|
|
526
|
-
const c =
|
|
527
|
-
async (
|
|
528
|
-
n || !s || await o({ pageParam:
|
|
526
|
+
const c = D(
|
|
527
|
+
async (d) => {
|
|
528
|
+
n || !s || await o({ pageParam: d?.pageParam || d.visibleRowsCount });
|
|
529
529
|
},
|
|
530
530
|
[s, o, n]
|
|
531
|
-
), u =
|
|
531
|
+
), u = V(() => {
|
|
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,
|
|
@@ -542,7 +542,7 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
542
542
|
const { libraries: o } = j(A), n = e?.axios || o?.axios, a = e?.localStorageKey || "user";
|
|
543
543
|
if (!n)
|
|
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 = D(
|
|
546
546
|
({ tokenType: c, accessToken: u }) => {
|
|
547
547
|
n.defaults.headers.common.Authorization = `${c} ${u}`;
|
|
548
548
|
},
|
|
@@ -550,16 +550,16 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
550
550
|
), s = () => {
|
|
551
551
|
n.defaults.headers.common.Authorization = null;
|
|
552
552
|
};
|
|
553
|
-
return
|
|
553
|
+
return k(() => {
|
|
554
554
|
if (N)
|
|
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), () => {
|
|
@@ -603,15 +603,15 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
603
603
|
},
|
|
604
604
|
worksiteNameAdapter: Ae
|
|
605
605
|
};
|
|
606
|
-
},
|
|
606
|
+
}, F = (e, o) => o === "short" ? e.split("-")[0] : e, Xe = (e, o = "full") => {
|
|
607
607
|
const [n, a] = oe(() => {
|
|
608
608
|
const r = e?.language || navigator.language;
|
|
609
|
-
return e && "isInitialized" in e && e.isInitialized,
|
|
609
|
+
return e && "isInitialized" in e && e.isInitialized, F(r, o);
|
|
610
610
|
});
|
|
611
|
-
return
|
|
612
|
-
e && "isInitialized" in e && e.isInitialized && e.language && a(
|
|
611
|
+
return k(() => {
|
|
612
|
+
e && "isInitialized" in e && e.isInitialized && e.language && a(F(e.language, o));
|
|
613
613
|
const r = (s) => {
|
|
614
|
-
a(
|
|
614
|
+
a(F(s, o));
|
|
615
615
|
};
|
|
616
616
|
return e?.on?.("languageChanged", r), () => {
|
|
617
617
|
e?.off?.("languageChanged", r);
|
|
@@ -627,66 +627,66 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
627
627
|
}
|
|
628
628
|
}, ne = (e, o, n) => `${n}_${e}=>${o}`, He = (e) => {
|
|
629
629
|
const { libraries: o, localStorageKeys: n } = j(A), a = e?.reactRouter || o?.reactRouter, { pathname: r } = a?.useLocation?.() ?? { pathname: "/" }, [s, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
|
|
630
|
-
}], u = n?.filter || Pe;
|
|
630
|
+
}], u = n?.filter || Pe, d = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl;
|
|
631
631
|
if (N)
|
|
632
632
|
return Te;
|
|
633
633
|
if (!a)
|
|
634
634
|
throw new Error(
|
|
635
635
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
636
636
|
);
|
|
637
|
-
const l = (
|
|
638
|
-
const
|
|
639
|
-
if (!
|
|
640
|
-
s.delete(
|
|
637
|
+
const l = (p, v, y = !0) => {
|
|
638
|
+
const g = ne(p, e?.pathname || r, u);
|
|
639
|
+
if (!v || Array.isArray(v) && !v.length) {
|
|
640
|
+
d && (s.delete(p), c(s)), localStorage.removeItem(g);
|
|
641
641
|
return;
|
|
642
642
|
}
|
|
643
|
-
|
|
643
|
+
y && v && localStorage.setItem(g, JSON.stringify({ ...s, [p]: v })), v && d && (s.set(p, JSON.stringify(v)), c(s));
|
|
644
644
|
};
|
|
645
645
|
return {
|
|
646
|
-
getFilter: (
|
|
647
|
-
const
|
|
648
|
-
if (
|
|
646
|
+
getFilter: (p, v) => {
|
|
647
|
+
const y = s.get(p);
|
|
648
|
+
if (y)
|
|
649
649
|
try {
|
|
650
|
-
return JSON.parse(
|
|
650
|
+
return JSON.parse(y);
|
|
651
651
|
} catch {
|
|
652
|
-
return
|
|
652
|
+
return y;
|
|
653
653
|
}
|
|
654
|
-
const
|
|
655
|
-
if (
|
|
654
|
+
const g = ne(p, e?.pathname || r, u), S = localStorage.getItem(g);
|
|
655
|
+
if (S)
|
|
656
656
|
try {
|
|
657
|
-
return JSON.parse(
|
|
657
|
+
return JSON.parse(S)[p];
|
|
658
658
|
} catch {
|
|
659
659
|
}
|
|
660
|
-
return
|
|
660
|
+
return v;
|
|
661
661
|
},
|
|
662
662
|
getFilters: () => {
|
|
663
|
-
const
|
|
664
|
-
(
|
|
665
|
-
).reduce((
|
|
666
|
-
const
|
|
667
|
-
if (
|
|
668
|
-
const
|
|
669
|
-
|
|
663
|
+
const p = d ? Object.fromEntries(s.entries()) : {}, y = Object.keys(localStorage).filter(
|
|
664
|
+
(g) => g.startsWith(u) && g.endsWith(e?.pathname || r)
|
|
665
|
+
).reduce((g, S) => {
|
|
666
|
+
const _ = localStorage.getItem(S);
|
|
667
|
+
if (_) {
|
|
668
|
+
const E = JSON.parse(_), L = Object.keys(E)?.[0];
|
|
669
|
+
g[L] = Object.values(E)?.[0];
|
|
670
670
|
}
|
|
671
|
-
return
|
|
671
|
+
return g;
|
|
672
672
|
}, {});
|
|
673
673
|
return {
|
|
674
|
-
...
|
|
675
|
-
...
|
|
674
|
+
...p,
|
|
675
|
+
...y
|
|
676
676
|
};
|
|
677
677
|
},
|
|
678
|
-
handleFilter: (
|
|
679
|
-
if (
|
|
680
|
-
const
|
|
681
|
-
l(
|
|
678
|
+
handleFilter: (p, v) => (y, g) => {
|
|
679
|
+
if (g || Array.isArray(g) && g.length === 0) {
|
|
680
|
+
const S = v || "value", _ = typeof g == "object" && S in g ? g[S] : g;
|
|
681
|
+
l(p, _);
|
|
682
682
|
return;
|
|
683
683
|
}
|
|
684
|
-
l(
|
|
684
|
+
l(p, void 0);
|
|
685
685
|
},
|
|
686
686
|
setFilter: l
|
|
687
687
|
};
|
|
688
688
|
}, Ce = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), ke = (e) => {
|
|
689
|
-
const a = e.split("/").filter((r) => r.length > 0).map((r) => r.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((
|
|
689
|
+
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
690
|
return a.charAt(0).toLowerCase() + a.slice(1);
|
|
691
691
|
}, Oe = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), xe = (e, o, n, a) => {
|
|
692
692
|
const r = ke(o), s = Ce(n), c = `${r}${s}`;
|
|
@@ -709,10 +709,10 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
709
709
|
};
|
|
710
710
|
}), Object.keys(n).length ? n : void 0;
|
|
711
711
|
}, Ze = (e) => (Array.isArray(e) ? e : [e]).reduce((n, a) => {
|
|
712
|
-
const { output: r, useInfiniteIds: s, useQueryIds: c, input: u = "./openapi.json" } = a || {},
|
|
712
|
+
const { output: r, useInfiniteIds: s, useQueryIds: c, input: u = "./openapi.json" } = a || {}, d = Oe(u);
|
|
713
713
|
return {
|
|
714
714
|
...n,
|
|
715
|
-
[
|
|
715
|
+
[d]: {
|
|
716
716
|
hooks: {
|
|
717
717
|
afterAllFilesWrite: "prettier src/api/ --write"
|
|
718
718
|
},
|
|
@@ -725,22 +725,22 @@ const A = fe({}), Fe = ({ children: e, apiURL: o, libraries: n, localStorageKeys
|
|
|
725
725
|
...(s?.length || c?.length) && {
|
|
726
726
|
operations: Ie(s, c)
|
|
727
727
|
},
|
|
728
|
-
header: (
|
|
728
|
+
header: (l) => [
|
|
729
729
|
"Generated by orval 🍺",
|
|
730
|
-
...
|
|
731
|
-
...
|
|
730
|
+
...l.title ? [l.title] : [],
|
|
731
|
+
...l.description ? [l.description] : []
|
|
732
732
|
],
|
|
733
733
|
mutator: {
|
|
734
734
|
name: "axiosCustomInstance",
|
|
735
735
|
path: "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"
|
|
736
736
|
},
|
|
737
|
-
operationName: (
|
|
737
|
+
operationName: (l, i, h) => xe(l, i, h, c),
|
|
738
738
|
query: {
|
|
739
739
|
useQuery: !0
|
|
740
740
|
}
|
|
741
741
|
},
|
|
742
|
-
schemas: r?.schemas || `src/api/${
|
|
743
|
-
target: r?.target || `src/api/${
|
|
742
|
+
schemas: r?.schemas || `src/api/${d}/model`,
|
|
743
|
+
target: r?.target || `src/api/${d}/services/api.ts`,
|
|
744
744
|
...r
|
|
745
745
|
}
|
|
746
746
|
}
|
|
@@ -751,10 +751,10 @@ export {
|
|
|
751
751
|
ze as InitializeAxiosConfig,
|
|
752
752
|
Ve as InitializeDaysJSConfig,
|
|
753
753
|
Ue as InitializeI18nConfig,
|
|
754
|
-
|
|
754
|
+
We as InitializeSentryConfig,
|
|
755
755
|
A as InjectDependenciesContext,
|
|
756
756
|
Fe as InjectDependenciesProvider,
|
|
757
|
-
|
|
757
|
+
Qe as MaskTextField,
|
|
758
758
|
Me as PreloadErrorHandler,
|
|
759
759
|
Ge as QueryClientProviderWithConfig,
|
|
760
760
|
De as RequireAuth,
|
package/dist/main.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(g,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],I):(g=typeof globalThis<"u"?globalThis:g||self,I(g["@tracktor/shared-module"]={},g.axios,g.React))})(this,function(g,I,p){"use strict";const ae=(e,o)=>{const n=I.CancelToken.source(),a=I({...e,...o,cancelToken:n.token}).then(({data:r})=>r);return a.cancel=()=>{n.cancel("Query was cancelled")},a};var F={exports:{}},x={};/**
|
|
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 V;function se(){if(V)return x;V=1;var e=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function n(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 u in r)u!=="key"&&(s[u]=r[u])}else s=r;return r=s.ref,{$$typeof:e,type:a,key:c,ref:r!==void 0?r:null,props:s}}return x.Fragment=o,x.jsx=n,x.jsxs=n,x}var N={};/**
|
|
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 G;function ie(){return G||(G=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Me?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case v:return"Fragment";case C:return"Profiler";case y:return"StrictMode";case Z:return"Suspense";case ze:return"SuspenseList";case We: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 w:return"Portal";case b:return(t.displayName||"Context")+".Provider";case _:return(t._context.displayName||"Context")+".Consumer";case Y:var f=t.render;return t=t.displayName,t||(t=f.displayName||f.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ue: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 o(t){return""+t}function n(t){try{o(t);var f=!1}catch{f=!0}if(f){f=console;var h=f.error,S=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return h.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",S),o(t)}}function a(t){if(t===v)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=z.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 u(t,f){function h(){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))}h.isReactWarning=!0,Object.defineProperty(t,"key",{get:h,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 l(t,f,h,S,k,P,W,M){return h=P.ref,t={$$typeof:m,type:t,key:f,props:P,_owner:k},(h!==void 0?h: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:W}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function i(t,f,h,S,k,P,W,M){var A=f.children;if(A!==void 0)if(S)if(Qe(A)){for(S=0;S<A.length;S++)E(A[S]);Object.freeze&&Object.freeze(A)}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 E(A);if($.call(f,"key")){A=e(t);var O=Object.keys(f).filter(function(Ve){return Ve!=="key"});S=0<O.length?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}",oe[A+S]||(O=0<O.length?"{"+O.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} />`,S,A,O,A),oe[A+S]=!0)}if(A=null,h!==void 0&&(n(h),A=""+h),c(f)&&(n(f.key),A=""+f.key),"key"in f){h={};for(var Q in f)Q!=="key"&&(h[Q]=f[Q])}else h=f;return A&&u(h,typeof t=="function"?t.displayName||t.name||"Unknown":t),l(t,A,P,k,r(),h,W,M)}function E(t){typeof t=="object"&&t!==null&&t.$$typeof===m&&t._store&&(t._store.validated=1)}var R=p,m=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),b=Symbol.for("react.context"),Y=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"),We=Symbol.for("react.activity"),Me=Symbol.for("react.client.reference"),z=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,Qe=Array.isArray,U=console.createTask?console.createTask:function(){return null};R={"react-stack-bottom-frame":function(t){return t()}};var ee,te={},re=R["react-stack-bottom-frame"].bind(R,s)(),ne=U(a(s)),oe={};N.Fragment=v,N.jsx=function(t,f,h,S,k){var P=1e4>z.recentlyCreatedOwnerStacks++;return i(t,f,h,!1,S,k,P?Error("react-stack-top-frame"):re,P?U(a(t)):ne)},N.jsxs=function(t,f,h,S,k){var P=1e4>z.recentlyCreatedOwnerStacks++;return i(t,f,h,!0,S,k,P?Error("react-stack-top-frame"):re,P?U(a(t)):ne)}}()),N}var J;function ce(){return J||(J=1,process.env.NODE_ENV==="production"?F.exports=se():F.exports=ie()),F.exports}var T=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 T.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,d=r?.axios||s?.axios,l=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:R,Navigate:m,Outlet:w}=u,v=R(),y=p.useRef(!1),C=typeof o=="function"?o():!!o,_=typeof C=="boolean"?C:C?.isLogged;return p.useEffect(()=>{y.current||(y.current=!0,d.interceptors.response.use(b=>b,async b=>(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&&b?.response?.status===401&&(d.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(l),E(a)),Promise.reject(b))))},[d.defaults.headers.common,d.interceptors.response,l,a]),_&&!i?T.jsx(p.Suspense,{fallback:e,children:v.state?.from?.state&&v.state?.from?.pathname===n?T.jsx(m,{to:v.state.from.state.from.pathname+v.state.from.state.from.search,replace:!0}):T.jsx(w,{})}):T.jsx(m,{to:n+v.search,state:{from:v},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:d}=c(),{sendEvent:l}=s();return p.useEffect(()=>{l({event:"pageView",pathname:d,...e})},[e,d,l]),T.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,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||L)return null;if(typeof window<"u"&&window.localStorage){const l=localStorage.getItem(u),i=l?JSON.parse(l):null,E=i?.[e]?i[e]:null,R=i?.[o]?i[o]:null,m=l?`${E} ${R}`:null;m&&(d.defaults.headers.common.Authorization=m)}return d.defaults.baseURL=r,d.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",d=>{document.documentElement.setAttribute("lang",d)})),null},ye=({dsn:e,integrations:o,tracesSampleRate:n,replaysSessionSampleRate:a,replaysOnErrorSampleRate:r,tracePropagationTargets:s,ignoreErrors:c,debug:u,environment:d,release:l,...i})=>{const{libraries:E}=p.useContext(j),R=i?.sentry||E?.sentry,m=i?.reactRouter||E?.reactRouter;if(!R)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!m)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(R.isInitialized())return null;const{createRoutesFromChildren:w,matchRoutes:v,useLocation:y,useNavigationType:C}=m;return(u||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&R.init({debug:u,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:[R.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:w,matchRoutes:v,useEffect:p.useEffect,useLocation:y,useNavigationType:C}),...o||[]],release:l,replaysOnErrorSampleRate:r||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:s,tracesSampleRate:n||1}),null},he=({IMaskMixin:e,...o})=>{const n=p.useMemo(()=>e(({TextField:a,...r})=>T.jsx(a,{...r})),[e]);return T.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:(d,l,i)=>d.length+(i||0),refetchOnWindowFocus:!1,retry:3,...o}}});return T.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||(l=>l),{unknownErrorTranslationKey:s="error.unknownError"}=e||{},c=r(s),u=p.useCallback(l=>{if(l&&typeof l=="object"&&"response"in l){const{response:i}=l||{};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:R}=E[0];if(typeof R=="string")return String(R)}}}return l instanceof Error?l.message:c},[c]);return{getErrorCode:p.useCallback(l=>{const{response:i}=l||{};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 d=>{n||!s||await o({pageParam:d?.pageParam||d.visibleRowsCount})},[s,o,n]),u=p.useMemo(()=>{if(e)return e.pages.reduce((d,l)=>[...d,...l],[])},[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:d})=>{if(d===a&&u)try{const{accessToken:l,tokenType:i}=JSON.parse(u);r({accessToken:l,tokenType:i})}catch(l){console.error("Failed to parse newValue from localStorage:",l)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}},[a,r]),{clearAuthenticationToken:s,setAuthenticationToken:r}},K=({library:e,date:o,format:n="ll"})=>e(o).format(n),B=(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}`},X=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 K({date:c,format:u,library:a})},distanceAdapter:B,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:X}},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:()=>{}},H=(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,d=e?.syncWithUrl===void 0?!0:e?.syncWithUrl;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,w,v=!0)=>{const y=H(m,e?.pathname||r,u);if(!w||Array.isArray(w)&&!w.length){d&&(s.delete(m),c(s)),localStorage.removeItem(y);return}v&&w&&localStorage.setItem(y,JSON.stringify({...s,[m]:w})),w&&d&&(s.set(m,JSON.stringify(w)),c(s))};return{getFilter:(m,w)=>{const v=s.get(m);if(v)try{return JSON.parse(v)}catch{return v}const y=H(m,e?.pathname||r,u),C=localStorage.getItem(y);if(C)try{return JSON.parse(C)[m]}catch{}return w},getFilters:()=>{const m=d?Object.fromEntries(s.entries()):{},v=Object.keys(localStorage).filter(y=>y.startsWith(u)&&y.endsWith(e?.pathname||r)).reduce((y,C)=>{const _=localStorage.getItem(C);if(_){const b=JSON.parse(_),Y=Object.keys(b)?.[0];y[Y]=Object.values(b)?.[0]}return y},{});return{...m,...v}},handleFilter:(m,w)=>(v,y)=>{if(y||Array.isArray(y)&&y.length===0){const C=w||"value",_=typeof y=="object"&&C in y?y[C]:y;l(m,_);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(d=>d.charAt(0).toUpperCase()+d.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||{},d=Le(u);return{...n,[d]:{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:l=>["Generated by orval 🍺",...l.title?[l.title]:[],...l.description?[l.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(l,i,E)=>Fe(l,i,E,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=j,g.InjectDependenciesProvider=ue,g.MaskTextField=he,g.PreloadErrorHandler=Ee,g.QueryClientProviderWithConfig=Re,g.RequireAuth=de,g.axiosCustomInstance=ae,g.dateAdapter=K,g.distanceAdapter=B,g.getOrvalConfig=Ye,g.useAdapter=Pe,g.useAuth=Ce,g.useCurrentLanguage=Te,g.useFilters=Oe,g.useInfiniteDataGrid=Ae,g.useResponseError=Se,g.worksiteNameAdapter=X,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|