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