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