@tracktor/shared-module 2.19.1 → 2.19.4

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.
@@ -26,27 +26,11 @@ export interface UpdateNotifierProps {
26
26
  * and will receive an `onReload` callback to trigger the reload flow.
27
27
  * - If no `renderDialog` is provided, a default `window.confirm` prompt is shown,
28
28
  * and the app reloads automatically after user confirmation.
29
- * - If `clearCachesOnReload` is true, all entries in CacheStorage will be cleared before reloading
30
- * (use with caution, as this removes *all* caches for the current origin).
31
- * - If `autoUpdate` is true, the app will reload automatically when an update is detected,
32
- * bypassing both `window.confirm` and any custom UI.
29
+ * - If `clearCachesOnReload` is true, all entries in CacheStorage will be cleared,
30
+ * but *safely on next load*, not before reload (avoids crashes or race conditions).
33
31
  *
34
32
  * Usage:
35
33
  * Place <UpdateNotifier /> once at the root of your app (e.g., in App.tsx).
36
- *
37
- * Example with a custom banner:
38
- * ```tsx
39
- * <UpdateNotifier
40
- * renderDialog={(handleReloadApp) => (
41
- * <div style={{ position: "fixed", bottom: 0, width: "100%", background: "orange", padding: "1rem" }}>
42
- * <span>A new version is available.</span>
43
- * <button onClick={onReload} style={{ marginLeft: "1rem" }}>
44
- * Reload now
45
- * </button>
46
- * </div>
47
- * )}
48
- * />
49
- * ```
50
34
  */
51
35
  declare const UpdateNotifier: ({ autoUpdate, renderDialog, clearCachesOnReload }: UpdateNotifierProps) => ReactNode;
52
36
  export default UpdateNotifier;
package/dist/main.js CHANGED
@@ -1,7 +1,7 @@
1
- import ee from "axios";
2
- import fe, { useMemo as G, createContext as pe, useContext as j, useEffect as k, useState as W, useRef as ae, Suspense as ge, useCallback as N } from "react";
3
- const Ye = (e, r) => {
4
- const o = ee.CancelToken.source(), a = ee({
1
+ import X from "axios";
2
+ import de, { useMemo as M, createContext as fe, useContext as j, useEffect as A, useState as Y, useRef as ne, Suspense as pe, useCallback as x } from "react";
3
+ const De = (e, r) => {
4
+ const o = X.CancelToken.source(), a = X({
5
5
  ...e,
6
6
  ...r,
7
7
  cancelToken: o.token
@@ -10,20 +10,11 @@ const Ye = (e, r) => {
10
10
  o.cancel("Query was cancelled");
11
11
  }, a;
12
12
  };
13
- var D = { exports: {} }, L = {};
14
- /**
15
- * @license React
16
- * react-jsx-runtime.production.js
17
- *
18
- * Copyright (c) Meta Platforms, Inc. and affiliates.
19
- *
20
- * This source code is licensed under the MIT license found in the
21
- * LICENSE file in the root directory of this source tree.
22
- */
23
- var te;
24
- function me() {
25
- if (te) return L;
26
- te = 1;
13
+ var $ = { exports: {} }, O = {};
14
+ var Z;
15
+ function ge() {
16
+ if (Z) return O;
17
+ Z = 1;
27
18
  var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
28
19
  function o(a, n, i) {
29
20
  var c = null;
@@ -40,56 +31,47 @@ function me() {
40
31
  props: i
41
32
  };
42
33
  }
43
- return L.Fragment = r, L.jsx = o, L.jsxs = o, L;
34
+ return O.Fragment = r, O.jsx = o, O.jsxs = o, O;
44
35
  }
45
- var F = {};
46
- /**
47
- * @license React
48
- * react-jsx-runtime.development.js
49
- *
50
- * Copyright (c) Meta Platforms, Inc. and affiliates.
51
- *
52
- * This source code is licensed under the MIT license found in the
53
- * LICENSE file in the root directory of this source tree.
54
- */
55
- var re;
56
- function he() {
57
- return re || (re = 1, process.env.NODE_ENV !== "production" && function() {
36
+ var N = {};
37
+ var ee;
38
+ function me() {
39
+ return ee || (ee = 1, process.env.NODE_ENV !== "production" && (function() {
58
40
  function e(t) {
59
41
  if (t == null) return null;
60
42
  if (typeof t == "function")
61
- return t.$$typeof === le ? null : t.displayName || t.name || null;
43
+ return t.$$typeof === ce ? null : t.displayName || t.name || null;
62
44
  if (typeof t == "string") return t;
63
45
  switch (t) {
64
- case A:
46
+ case g:
65
47
  return "Fragment";
66
- case y:
48
+ case P:
67
49
  return "Profiler";
68
- case m:
50
+ case h:
69
51
  return "StrictMode";
70
- case P:
52
+ case oe:
71
53
  return "Suspense";
72
- case se:
54
+ case ae:
73
55
  return "SuspenseList";
74
- case ce:
56
+ case ie:
75
57
  return "Activity";
76
58
  }
77
59
  if (typeof t == "object")
78
60
  switch (typeof t.tag == "number" && console.error(
79
61
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
80
62
  ), t.$$typeof) {
81
- case x:
63
+ case S:
82
64
  return "Portal";
83
- case g:
84
- return (t.displayName || "Context") + ".Provider";
85
- case _:
65
+ case E:
66
+ return t.displayName || "Context";
67
+ case m:
86
68
  return (t._context.displayName || "Context") + ".Consumer";
87
- case w:
69
+ case T:
88
70
  var f = t.render;
89
71
  return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
90
- case ie:
72
+ case se:
91
73
  return f = t.displayName || null, f !== null ? f : e(t.type) || "Memo";
92
- case J:
74
+ case W:
93
75
  f = t._payload, t = t._init;
94
76
  try {
95
77
  return e(t(f));
@@ -110,17 +92,17 @@ function he() {
110
92
  }
111
93
  if (f) {
112
94
  f = console;
113
- var v = f.error, E = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
95
+ var v = f.error, w = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
114
96
  return v.call(
115
97
  f,
116
98
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
117
- E
99
+ w
118
100
  ), r(t);
119
101
  }
120
102
  }
121
103
  function a(t) {
122
- if (t === A) return "<>";
123
- if (typeof t == "object" && t !== null && t.$$typeof === J)
104
+ if (t === g) return "<>";
105
+ if (typeof t == "object" && t !== null && t.$$typeof === W)
124
106
  return "<...>";
125
107
  try {
126
108
  var f = e(t);
@@ -137,7 +119,7 @@ function he() {
137
119
  return Error("react-stack-top-frame");
138
120
  }
139
121
  function c(t) {
140
- if (K.call(t, "key")) {
122
+ if (G.call(t, "key")) {
141
123
  var f = Object.getOwnPropertyDescriptor(t, "key").get;
142
124
  if (f && f.isReactWarning) return !1;
143
125
  }
@@ -145,7 +127,7 @@ function he() {
145
127
  }
146
128
  function u(t, f) {
147
129
  function v() {
148
- q || (q = !0, console.error(
130
+ J || (J = !0, console.error(
149
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)",
150
132
  f
151
133
  ));
@@ -157,18 +139,19 @@ function he() {
157
139
  }
158
140
  function l() {
159
141
  var t = e(this.type);
160
- return B[t] || (B[t] = !0, console.error(
142
+ return K[t] || (K[t] = !0, console.error(
161
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."
162
144
  )), t = this.props.ref, t !== void 0 ? t : null;
163
145
  }
164
- function d(t, f, v, E, I, T, Q, V) {
165
- return v = T.ref, t = {
166
- $$typeof: b,
146
+ function d(t, f, v, w, F, Q) {
147
+ var R = v.ref;
148
+ return t = {
149
+ $$typeof: k,
167
150
  type: t,
168
151
  key: f,
169
- props: T,
170
- _owner: I
171
- }, (v !== void 0 ? v : null) !== null ? Object.defineProperty(t, "ref", {
152
+ props: v,
153
+ _owner: w
154
+ }, (R !== void 0 ? R : null) !== null ? Object.defineProperty(t, "ref", {
172
155
  enumerable: !1,
173
156
  get: l
174
157
  }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
@@ -185,49 +168,49 @@ function he() {
185
168
  configurable: !1,
186
169
  enumerable: !1,
187
170
  writable: !0,
188
- value: Q
171
+ value: F
189
172
  }), Object.defineProperty(t, "_debugTask", {
190
173
  configurable: !1,
191
174
  enumerable: !1,
192
175
  writable: !0,
193
- value: V
176
+ value: Q
194
177
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
195
178
  }
196
- function s(t, f, v, E, I, T, Q, V) {
179
+ function s(t, f, v, w, F, Q) {
197
180
  var R = f.children;
198
181
  if (R !== void 0)
199
- if (E)
200
- if (ue(R)) {
201
- for (E = 0; E < R.length; E++)
202
- h(R[E]);
182
+ if (w)
183
+ if (le(R)) {
184
+ for (w = 0; w < R.length; w++)
185
+ y(R[w]);
203
186
  Object.freeze && Object.freeze(R);
204
187
  } else
205
188
  console.error(
206
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."
207
190
  );
208
- else h(R);
209
- if (K.call(f, "key")) {
191
+ else y(R);
192
+ if (G.call(f, "key")) {
210
193
  R = e(t);
211
- var O = Object.keys(f).filter(function(de) {
212
- return de !== "key";
194
+ var I = Object.keys(f).filter(function(ue) {
195
+ return ue !== "key";
213
196
  });
214
- E = 0 < O.length ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}", Z[R + E] || (O = 0 < O.length ? "{" + O.join(": ..., ") + ": ...}" : "{}", console.error(
197
+ w = 0 < I.length ? "{key: someKey, " + I.join(": ..., ") + ": ...}" : "{key: someKey}", H[R + w] || (I = 0 < I.length ? "{" + I.join(": ..., ") + ": ...}" : "{}", console.error(
215
198
  `A props object containing a "key" prop is being spread into JSX:
216
199
  let props = %s;
217
200
  <%s {...props} />
218
201
  React keys must be passed directly to JSX without using spread:
219
202
  let props = %s;
220
203
  <%s key={someKey} {...props} />`,
221
- E,
204
+ w,
222
205
  R,
223
- O,
206
+ I,
224
207
  R
225
- ), Z[R + E] = !0);
208
+ ), H[R + w] = !0);
226
209
  }
227
210
  if (R = null, v !== void 0 && (o(v), R = "" + v), c(f) && (o(f.key), R = "" + f.key), "key" in f) {
228
211
  v = {};
229
- for (var M in f)
230
- M !== "key" && (v[M] = f[M]);
212
+ for (var V in f)
213
+ V !== "key" && (v[V] = f[V]);
231
214
  } else v = f;
232
215
  return R && u(
233
216
  v,
@@ -235,70 +218,67 @@ React keys must be passed directly to JSX without using spread:
235
218
  ), d(
236
219
  t,
237
220
  R,
238
- T,
239
- I,
240
- n(),
241
221
  v,
242
- Q,
243
- V
222
+ n(),
223
+ F,
224
+ Q
244
225
  );
245
226
  }
246
- function h(t) {
247
- typeof t == "object" && t !== null && t.$$typeof === b && t._store && (t._store.validated = 1);
227
+ function y(t) {
228
+ p(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === W && (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
+ }
230
+ function p(t) {
231
+ return typeof t == "object" && t !== null && t.$$typeof === k;
248
232
  }
249
- var p = fe, b = Symbol.for("react.transitional.element"), x = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), m = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), g = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), se = Symbol.for("react.suspense_list"), ie = Symbol.for("react.memo"), J = Symbol.for("react.lazy"), ce = Symbol.for("react.activity"), le = Symbol.for("react.client.reference"), z = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, ue = Array.isArray, U = console.createTask ? console.createTask : function() {
233
+ var b = de, k = Symbol.for("react.transitional.element"), S = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), h = Symbol.for("react.strict_mode"), P = Symbol.for("react.profiler"), m = Symbol.for("react.consumer"), E = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), oe = Symbol.for("react.suspense"), ae = Symbol.for("react.suspense_list"), se = Symbol.for("react.memo"), W = Symbol.for("react.lazy"), ie = Symbol.for("react.activity"), ce = Symbol.for("react.client.reference"), z = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, le = Array.isArray, U = console.createTask ? console.createTask : function() {
250
234
  return null;
251
235
  };
252
- p = {
253
- "react-stack-bottom-frame": function(t) {
236
+ b = {
237
+ react_stack_bottom_frame: function(t) {
254
238
  return t();
255
239
  }
256
240
  };
257
- var q, B = {}, H = p["react-stack-bottom-frame"].bind(
258
- p,
241
+ var J, K = {}, q = b.react_stack_bottom_frame.bind(
242
+ b,
259
243
  i
260
- )(), X = U(a(i)), Z = {};
261
- F.Fragment = A, F.jsx = function(t, f, v, E, I) {
262
- var T = 1e4 > z.recentlyCreatedOwnerStacks++;
244
+ )(), B = U(a(i)), H = {};
245
+ N.Fragment = g, N.jsx = function(t, f, v) {
246
+ var w = 1e4 > z.recentlyCreatedOwnerStacks++;
263
247
  return s(
264
248
  t,
265
249
  f,
266
250
  v,
267
251
  !1,
268
- E,
269
- I,
270
- T ? Error("react-stack-top-frame") : H,
271
- T ? U(a(t)) : X
252
+ w ? Error("react-stack-top-frame") : q,
253
+ w ? U(a(t)) : B
272
254
  );
273
- }, F.jsxs = function(t, f, v, E, I) {
274
- var T = 1e4 > z.recentlyCreatedOwnerStacks++;
255
+ }, N.jsxs = function(t, f, v) {
256
+ var w = 1e4 > z.recentlyCreatedOwnerStacks++;
275
257
  return s(
276
258
  t,
277
259
  f,
278
260
  v,
279
261
  !0,
280
- E,
281
- I,
282
- T ? Error("react-stack-top-frame") : H,
283
- T ? U(a(t)) : X
262
+ w ? Error("react-stack-top-frame") : q,
263
+ w ? U(a(t)) : B
284
264
  );
285
265
  };
286
- }()), F;
266
+ })()), N;
287
267
  }
288
- var ne;
268
+ var te;
289
269
  function ye() {
290
- return ne || (ne = 1, process.env.NODE_ENV === "production" ? D.exports = me() : D.exports = he()), D.exports;
270
+ return te || (te = 1, process.env.NODE_ENV === "production" ? $.exports = ge() : $.exports = me()), $.exports;
291
271
  }
292
272
  var C = ye();
293
- const We = ({ IMaskMixin: e, ...r }) => {
294
- const o = G(
273
+ const Ye = ({ IMaskMixin: e, ...r }) => {
274
+ const o = M(
295
275
  // eslint-disable-next-line react/jsx-props-no-spreading
296
276
  () => e(({ TextField: a, ...n }) => /* @__PURE__ */ C.jsx(a, { ...n })),
297
277
  [e]
298
278
  );
299
279
  return /* @__PURE__ */ C.jsx(o, { ...r });
300
- }, S = pe({}), ze = ({ children: e, apiURL: r, libraries: o, localStorageKeys: a }) => {
301
- const n = G(
280
+ }, _ = fe({}), We = ({ children: e, apiURL: r, libraries: o, localStorageKeys: a }) => {
281
+ const n = M(
302
282
  () => ({
303
283
  apiURL: r,
304
284
  libraries: o,
@@ -306,9 +286,9 @@ const We = ({ IMaskMixin: e, ...r }) => {
306
286
  }),
307
287
  [r, o, a]
308
288
  );
309
- return /* @__PURE__ */ C.jsx(S.Provider, { value: n, children: e });
310
- }, Ue = ({ data: e, ...r }) => {
311
- const { libraries: o } = j(S), a = r?.reactRouter || o?.reactRouter, n = r?.gtm || o?.gtm;
289
+ return /* @__PURE__ */ C.jsx(_.Provider, { value: n, children: e });
290
+ }, ze = ({ data: e, ...r }) => {
291
+ const { libraries: o } = j(_), a = r?.reactRouter || o?.reactRouter, n = r?.gtm || o?.gtm;
312
292
  if (!a)
313
293
  throw new Error(
314
294
  "React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
@@ -316,14 +296,14 @@ const We = ({ IMaskMixin: e, ...r }) => {
316
296
  if (!n)
317
297
  throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
318
298
  const { useGoogleTagManager: i } = n, { useLocation: c, Outlet: u } = a, { pathname: l } = c(), { sendEvent: d } = i();
319
- return k(() => {
299
+ return A(() => {
320
300
  d({
321
301
  event: "pageView",
322
302
  pathname: l,
323
303
  ...e
324
304
  });
325
305
  }, [e, l, d]), /* @__PURE__ */ C.jsx(u, {});
326
- }, $ = (() => {
306
+ }, L = (() => {
327
307
  try {
328
308
  return typeof global == "object" && global !== null && ("HermesInternal" in global || // Hermes JS engine
329
309
  "__fbBatchedBridge" in global || // RN Bridge
@@ -331,29 +311,29 @@ const We = ({ IMaskMixin: e, ...r }) => {
331
311
  } catch {
332
312
  return !1;
333
313
  }
334
- })(), ve = "user", Qe = ({
314
+ })(), he = "user", Ue = ({
335
315
  tokenTypeKey: e = "tokenType",
336
316
  tokenKey: r = "accessToken",
337
317
  postContentType: o = "application/json",
338
318
  ...a
339
319
  }) => {
340
- const { apiURL: n = a.apiURL, libraries: i, localStorageKeys: c } = j(S), u = a?.userLocalStorageKey || c?.user || ve, l = a?.axios || i?.axios;
320
+ const { apiURL: n = a.apiURL, libraries: i, localStorageKeys: c } = j(_), u = a?.userLocalStorageKey || c?.user || he, l = a?.axios || i?.axios;
341
321
  if (!l)
342
322
  throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
343
- if (!l?.defaults || $)
323
+ if (!l?.defaults || L)
344
324
  return null;
345
325
  if (typeof window < "u" && window.localStorage) {
346
- const d = localStorage.getItem(u), s = d ? JSON.parse(d) : null, h = s?.[e] ? s[e] : null, p = s?.[r] ? s[r] : null, b = d ? `${h} ${p}` : null;
326
+ const d = localStorage.getItem(u), s = d ? JSON.parse(d) : null, y = s?.[e] ? s[e] : null, p = s?.[r] ? s[r] : null, b = d ? `${y} ${p}` : null;
347
327
  b && (l.defaults.headers.common.Authorization = b);
348
328
  }
349
329
  return l.defaults.baseURL = n, l.defaults.headers.post["Content-Type"] = o, null;
350
- }, Ve = ({ language: e, ...r }) => {
351
- const { libraries: o } = j(S), a = r?.dayjs || o?.dayjs, n = r?.plugin || o?.dayjsPlugin;
330
+ }, Qe = ({ language: e, ...r }) => {
331
+ const { libraries: o } = j(_), a = r?.dayjs || o?.dayjs, n = r?.plugin || o?.dayjsPlugin;
352
332
  if (!a)
353
333
  throw new Error(
354
334
  "Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
355
335
  );
356
- return k(() => {
336
+ return A(() => {
357
337
  (async () => {
358
338
  const c = e || navigator.language?.slice(0, 2) || "en";
359
339
  n && n.forEach((u) => {
@@ -361,9 +341,9 @@ const We = ({ IMaskMixin: e, ...r }) => {
361
341
  }), await import("dayjs/locale/en"), await import("dayjs/locale/fr"), a.locale(c);
362
342
  })().then();
363
343
  }, [a, n, e]), null;
364
- }, Me = ({ debug: e, resources: r, ...o }) => {
365
- const { libraries: a } = j(S), n = o?.i18 || a?.i18, { i18next: i, initReactI18next: c, languageDetector: u } = n || {};
366
- if ($)
344
+ }, Ve = ({ debug: e, resources: r, ...o }) => {
345
+ const { libraries: a } = j(_), n = o?.i18 || a?.i18, { i18next: i, initReactI18next: c, languageDetector: u } = n || {};
346
+ if (L)
367
347
  return null;
368
348
  if (!n)
369
349
  throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
@@ -385,7 +365,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
385
365
  }), i.on("languageChanged", (l) => {
386
366
  document.documentElement.setAttribute("lang", l);
387
367
  })), null;
388
- }, Ge = ({
368
+ }, Me = ({
389
369
  dsn: e,
390
370
  integrations: r,
391
371
  tracesSampleRate: o,
@@ -398,14 +378,14 @@ const We = ({ IMaskMixin: e, ...r }) => {
398
378
  release: d,
399
379
  ...s
400
380
  }) => {
401
- const { libraries: h } = j(S), p = s?.sentry || h?.sentry, b = s?.reactRouter || h?.reactRouter;
381
+ const { libraries: y } = j(_), p = s?.sentry || y?.sentry, b = s?.reactRouter || y?.reactRouter;
402
382
  if (!p)
403
383
  throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
404
384
  if (!b)
405
385
  throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
406
386
  if (p.isInitialized())
407
387
  return null;
408
- const { createRoutesFromChildren: x, matchRoutes: A, useLocation: m, useNavigationType: y } = b;
388
+ const { createRoutesFromChildren: k, matchRoutes: S, useLocation: g, useNavigationType: h } = b;
409
389
  return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && p.init({
410
390
  debug: u,
411
391
  dsn: e,
@@ -421,11 +401,11 @@ const We = ({ IMaskMixin: e, ...r }) => {
421
401
  ],
422
402
  integrations: [
423
403
  p.reactRouterV6BrowserTracingIntegration({
424
- createRoutesFromChildren: x,
425
- matchRoutes: A,
426
- useEffect: k,
427
- useLocation: m,
428
- useNavigationType: y
404
+ createRoutesFromChildren: k,
405
+ matchRoutes: S,
406
+ useEffect: A,
407
+ useLocation: g,
408
+ useNavigationType: h
429
409
  }),
430
410
  ...r || []
431
411
  ],
@@ -435,8 +415,8 @@ const We = ({ IMaskMixin: e, ...r }) => {
435
415
  tracePropagationTargets: i,
436
416
  tracesSampleRate: o || 1
437
417
  }), null;
438
- }, Je = () => (k(() => {
439
- if ($)
418
+ }, Ge = () => (A(() => {
419
+ if (L)
440
420
  return;
441
421
  const e = (r) => {
442
422
  try {
@@ -447,17 +427,17 @@ const We = ({ IMaskMixin: e, ...r }) => {
447
427
  return window.addEventListener("vite:preloadError", e), () => {
448
428
  window.removeEventListener("vite:preloadError", e);
449
429
  };
450
- }, []), null), we = "user", Ke = ({ Fallback: e, isLogged: r, loginPath: o = "/login", redirect401Path: a = "/login", ...n }) => {
451
- const { libraries: i, localStorageKeys: c } = j(S), u = n?.reactRouter || i?.reactRouter, l = n?.axios || i?.axios, d = n?.localStorageKey || c?.user || we;
430
+ }, []), null), ve = "user", Je = ({ Fallback: e, isLogged: r, loginPath: o = "/login", redirect401Path: a = "/login", ...n }) => {
431
+ const { libraries: i, localStorageKeys: c } = j(_), u = n?.reactRouter || i?.reactRouter, l = n?.axios || i?.axios, d = n?.localStorageKey || c?.user || ve;
452
432
  if (!u)
453
433
  throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
454
- const [s, h] = W(null), { useLocation: p, Navigate: b, Outlet: x } = u, A = p(), m = ae(!1), y = typeof r == "function" ? r() : !!r, _ = typeof y == "boolean" ? y : y?.isLogged;
455
- return k(() => {
456
- m.current || (m.current = !0, l.interceptors.response.use(
457
- (g) => g,
458
- async (g) => (typeof g == "object" && g && "response" in g && g.response && typeof g.response == "object" && "status" in g.response && g.response && typeof g.response == "object" && "status" in g.response && g?.response?.status === 401 && (l.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(d), h(a)), Promise.reject(g))
434
+ const [s, y] = Y(null), { useLocation: p, Navigate: b, Outlet: k } = u, S = p(), g = ne(!1), h = typeof r == "function" ? r() : !!r, P = typeof h == "boolean" ? h : h?.isLogged;
435
+ return A(() => {
436
+ g.current || (g.current = !0, l.interceptors.response.use(
437
+ (m) => m,
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))
459
439
  ));
460
- }, [l.defaults.headers.common, l.interceptors.response, d, a]), _ && !s ? /* @__PURE__ */ C.jsx(ge, { fallback: e, children: A.state?.from?.state && A.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(b, { to: A.state.from.state.from.pathname + A.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ C.jsx(x, {}) }) : /* @__PURE__ */ C.jsx(b, { to: o + A.search, state: { from: A }, replace: !0 });
440
+ }, [l.defaults.headers.common, l.interceptors.response, d, a]), P && !s ? /* @__PURE__ */ C.jsx(pe, { fallback: e, children: S.state?.from?.state && S.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(b, { to: S.state.from.state.from.pathname + S.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ C.jsx(k, {}) }) : /* @__PURE__ */ C.jsx(b, { to: o + S.search, state: { from: S }, replace: !0 });
461
441
  }, Ee = async () => {
462
442
  if ("caches" in window)
463
443
  try {
@@ -466,43 +446,48 @@ const We = ({ IMaskMixin: e, ...r }) => {
466
446
  } catch (e) {
467
447
  console.error("Failed to clear caches:", e);
468
448
  }
469
- }, qe = ({ autoUpdate: e, renderDialog: r, clearCachesOnReload: o }) => {
470
- const a = ae(null), [n, i] = W(!1), c = N(async () => {
471
- a.current && a.current.postMessage({ type: "SKIP_WAITING" }), o && await Ee(), window.location.reload();
472
- }, [o]), u = N(async () => {
473
- window.confirm("A new version is available. The app will reload now.") && await c();
449
+ }, Ke = ({ autoUpdate: e, renderDialog: r, clearCachesOnReload: o }) => {
450
+ const a = ne(null), [n, i] = Y(!1), c = x(() => {
451
+ a.current && a.current.postMessage({ type: "SKIP_WAITING" }), o && localStorage.setItem("tracktor_clear_caches", "1"), window.location.reload();
452
+ }, [o]);
453
+ A(() => {
454
+ localStorage.getItem("tracktor_clear_caches") === "1" && (localStorage.removeItem("tracktor_clear_caches"), Ee().catch(console.error));
455
+ }, []);
456
+ const u = x(() => {
457
+ window.confirm("A new version is available. The app will reload now.") && c();
474
458
  }, [c]);
475
- return k(() => {
476
- if (!("serviceWorker" in navigator)) return;
459
+ return A(() => {
460
+ if (!("serviceWorker" in navigator))
461
+ return;
477
462
  let l, d;
478
463
  const s = (p) => {
479
464
  p && navigator.serviceWorker.controller && (a.current = p, i(!0));
480
- }, h = () => {
465
+ }, y = () => {
481
466
  const p = l?.installing;
482
467
  p && (d = () => {
483
468
  p.state === "installed" && s(p);
484
469
  }, p.addEventListener("statechange", d));
485
470
  };
486
471
  return (async () => {
487
- l = await navigator.serviceWorker.getRegistration(), l && (s(l.waiting), l.addEventListener("updatefound", h));
472
+ l = await navigator.serviceWorker.getRegistration(), l && (s(l.waiting), l.addEventListener("updatefound", y));
488
473
  })().catch(console.error), () => {
489
- l?.removeEventListener("updatefound", h), d && l?.installing && l.installing.removeEventListener("statechange", d);
474
+ l?.removeEventListener("updatefound", y), d && l?.installing && l.installing.removeEventListener("statechange", d);
490
475
  };
491
- }, []), k(() => {
492
- n && e && c().catch(console.error);
493
- }, [e, n, c]), k(() => {
494
- n && !e && !r && u().catch(console.error);
476
+ }, []), A(() => {
477
+ n && e && c();
478
+ }, [e, n, c]), A(() => {
479
+ n && !e && !r && u();
495
480
  }, [r, u, n, e]), n && !e && r ? r(c) : null;
496
- }, Re = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), be = (e) => {
481
+ }, we = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), Re = (e) => {
497
482
  const r = e.split(/[/\\]/).pop() || "";
498
483
  return r.substring(0, r.lastIndexOf("."));
499
- }, Ae = (e) => {
484
+ }, be = (e) => {
500
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("");
501
486
  return a.charAt(0).toLowerCase() + a.slice(1);
502
- }, Se = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), je = (e, r, o, a) => {
503
- const n = Ae(r), i = Re(o), c = `${n}${i}`;
487
+ }, _e = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), Se = (e, r, o, a) => {
488
+ const n = be(r), i = we(o), c = `${n}${i}`;
504
489
  return e && typeof e == "object" && "operationId" in e && a?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
505
- }, _e = (e, r) => {
490
+ }, Ae = (e, r) => {
506
491
  const o = {};
507
492
  return e?.forEach((a) => {
508
493
  o[a] = {
@@ -519,8 +504,8 @@ const We = ({ IMaskMixin: e, ...r }) => {
519
504
  }
520
505
  };
521
506
  }), Object.keys(o).length ? o : void 0;
522
- }, Be = (e) => (Array.isArray(e) ? e : [e]).reduce((o, a) => {
523
- const { output: n, useInfiniteIds: i, useQueryIds: c, input: u = "./openapi.json", customAxiosInstancePath: l, overrideApiName: d } = a || {}, s = d || Se(u), h = l || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";
507
+ }, qe = (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 || _e(u), y = l || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";
524
509
  return {
525
510
  ...o,
526
511
  [s]: {
@@ -531,7 +516,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
531
516
  mode: "tags-split",
532
517
  override: {
533
518
  ...(i?.length || c?.length) && {
534
- operations: _e(i, c)
519
+ operations: Ae(i, c)
535
520
  },
536
521
  header: (p) => [
537
522
  "Generated by orval 🍺",
@@ -539,10 +524,10 @@ const We = ({ IMaskMixin: e, ...r }) => {
539
524
  ...p.description ? [p.description] : []
540
525
  ],
541
526
  mutator: {
542
- name: be(h),
543
- path: h
527
+ name: Re(y),
528
+ path: y
544
529
  },
545
- operationName: (p, b, x) => je(p, b, x, c),
530
+ operationName: (p, b, k) => Se(p, b, k, c),
546
531
  query: {
547
532
  useQuery: !0
548
533
  }
@@ -553,20 +538,20 @@ const We = ({ IMaskMixin: e, ...r }) => {
553
538
  }
554
539
  }
555
540
  };
556
- }, {}), Pe = (e) => e && typeof e == "function", Te = (e) => e && typeof e == "function", He = ({
541
+ }, {}), je = (e) => e && typeof e == "function", Pe = (e) => e && typeof e == "function", Be = ({
557
542
  children: e,
558
543
  defaultQueriesOptions: r,
559
544
  defaultMutationsOptions: o,
560
545
  ...a
561
546
  }) => {
562
- const { libraries: n } = j(S), i = a?.QueryClient || n?.reactQuery?.QueryClient, c = a?.QueryClientProvider || n?.reactQuery?.QueryClientProvider;
547
+ const { libraries: n } = j(_), i = a?.QueryClient || n?.reactQuery?.QueryClient, c = a?.QueryClientProvider || n?.reactQuery?.QueryClientProvider;
563
548
  if (!i)
564
549
  throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
565
550
  if (!c)
566
551
  throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
567
- if (!Pe(c))
552
+ if (!je(c))
568
553
  throw new Error("Provided QueryClientProvider dependencies are not valid.");
569
- if (!Te(i))
554
+ if (!Pe(i))
570
555
  throw new Error("Provided QueryClient dependencies are not valid.");
571
556
  const u = new i({
572
557
  defaultOptions: {
@@ -582,45 +567,45 @@ const We = ({ IMaskMixin: e, ...r }) => {
582
567
  }
583
568
  });
584
569
  return /* @__PURE__ */ C.jsx(c, { client: u, children: e });
585
- }, ke = ({ library: e, date: r, format: o = "ll" }) => e(r).format(o), Ce = (e, r) => {
570
+ }, Te = ({ library: e, date: r, format: o = "ll" }) => e(r).format(o), ke = (e, r) => {
586
571
  const { fractionDigits: o = 0, metric: a = "km", spacingBetween: n = !0 } = r || {}, i = Number(e), c = n ? " " : "";
587
572
  return Number.isNaN(i) ? `0${c}${a}` : `${i.toFixed(o)}${c}${a}`;
588
- }, xe = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((o) => o.length > 0 ? o.charAt(0).toUpperCase() + o.slice(1) : o).join(" "), Ie = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, Oe = ({ path: e, size: r, apiURL: o }) => {
573
+ }, Ce = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((o) => o.length > 0 ? o.charAt(0).toUpperCase() + o.slice(1) : o).join(" "), Ie = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, xe = ({ path: e, size: r, apiURL: o }) => {
589
574
  if (!e)
590
575
  return "";
591
576
  const a = Ie(e), n = `${o}${a}`, i = n.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
592
577
  return typeof r == "number" && i ? `${n.replace("/files", `/thumbs/${r}`)}` : n;
593
- }, Xe = (e) => {
594
- const { apiURL: r, libraries: o } = j(S), a = e?.dayjs || o?.dayjs;
578
+ }, He = (e) => {
579
+ const { apiURL: r, libraries: o } = j(_), a = e?.dayjs || o?.dayjs;
595
580
  return {
596
581
  dateAdapter: (c, u) => {
597
582
  if (!a)
598
583
  throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
599
- return ke({
584
+ return Te({
600
585
  date: c,
601
586
  format: u,
602
587
  library: a
603
588
  });
604
589
  },
605
- distanceAdapter: Ce,
590
+ distanceAdapter: ke,
606
591
  filePathAdapter: (c, u) => {
607
592
  if (!r)
608
593
  throw new Error(
609
594
  "API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
610
595
  );
611
- return typeof c == "string" && /^https?:\/\//.test(c) ? c : Oe({
596
+ return typeof c == "string" && /^https?:\/\//.test(c) ? c : xe({
612
597
  apiURL: r,
613
598
  path: c,
614
599
  size: u
615
600
  });
616
601
  },
617
- worksiteNameAdapter: xe
602
+ worksiteNameAdapter: Ce
618
603
  };
619
- }, Ze = (e) => {
620
- const { libraries: r } = j(S), o = e?.axios || r?.axios, a = e?.localStorageKey || "user";
604
+ }, Xe = (e) => {
605
+ const { libraries: r } = j(_), o = e?.axios || r?.axios, a = e?.localStorageKey || "user";
621
606
  if (!o)
622
607
  throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
623
- const n = N(
608
+ const n = x(
624
609
  ({ tokenType: c, accessToken: u }) => {
625
610
  o.defaults.headers.common.Authorization = `${c} ${u}`;
626
611
  },
@@ -628,8 +613,8 @@ const We = ({ IMaskMixin: e, ...r }) => {
628
613
  ), i = () => {
629
614
  o.defaults.headers.common.Authorization = null;
630
615
  };
631
- return k(() => {
632
- if ($)
616
+ return A(() => {
617
+ if (L)
633
618
  return;
634
619
  const c = ({ newValue: u, key: l }) => {
635
620
  if (l === a && u)
@@ -647,21 +632,21 @@ const We = ({ IMaskMixin: e, ...r }) => {
647
632
  clearAuthenticationToken: i,
648
633
  setAuthenticationToken: n
649
634
  };
650
- }, Y = (e, r) => r === "short" ? e.split("-")[0] : e, et = (e, r = "full") => {
651
- const [o, a] = W(() => {
635
+ }, D = (e, r) => r === "short" ? e.split("-")[0] : e, Ze = (e, r = "full") => {
636
+ const [o, a] = Y(() => {
652
637
  const n = e?.language || navigator.language;
653
- return e && "isInitialized" in e && e.isInitialized, Y(n, r);
638
+ return e && "isInitialized" in e && e.isInitialized, D(n, r);
654
639
  });
655
- return k(() => {
656
- e && "isInitialized" in e && e.isInitialized && e.language && a(Y(e.language, r));
640
+ return A(() => {
641
+ e && "isInitialized" in e && e.isInitialized && e.language && a(D(e.language, r));
657
642
  const n = (i) => {
658
- a(Y(i, r));
643
+ a(D(i, r));
659
644
  };
660
645
  return e?.on?.("languageChanged", n), () => {
661
646
  e?.off?.("languageChanged", n);
662
647
  };
663
648
  }, [e, r]), o;
664
- }, Ne = "tracktor.filter", Le = {
649
+ }, Oe = "tracktor.filter", Ne = {
665
650
  getFilter: () => {
666
651
  },
667
652
  getFilters: () => ({}),
@@ -669,7 +654,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
669
654
  },
670
655
  setFilter: () => {
671
656
  }
672
- }, oe = (e, r, o) => `${o}_${e}=>${r}`, Fe = (e) => e.reduce((r, o) => {
657
+ }, re = (e, r, o) => `${o}_${e}=>${r}`, Le = (e) => e.reduce((r, o) => {
673
658
  const a = localStorage.getItem(o);
674
659
  if (a)
675
660
  try {
@@ -678,78 +663,78 @@ const We = ({ IMaskMixin: e, ...r }) => {
678
663
  } catch {
679
664
  }
680
665
  return r;
681
- }, {}), tt = (e) => {
682
- const { libraries: r, localStorageKeys: o } = j(S), a = e?.reactRouter || r?.reactRouter, { pathname: n } = a?.useLocation?.() ?? { pathname: "/" }, [i, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
683
- }], [u, l] = W({}), d = o?.filter || Ne, s = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl;
684
- if ($)
685
- return Le;
666
+ }, {}), et = (e) => {
667
+ const { libraries: r, localStorageKeys: o } = j(_), a = e?.reactRouter || r?.reactRouter, { pathname: n } = a?.useLocation?.() ?? { pathname: "/" }, [i, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
668
+ }], [u, l] = Y({}), d = o?.filter || Oe, s = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl;
669
+ if (L)
670
+ return Ne;
686
671
  if (!a)
687
672
  throw new Error(
688
673
  "React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter."
689
674
  );
690
- const h = () => Object.keys(localStorage).filter(
691
- (m) => m.startsWith(d) && m.endsWith(e?.pathname || n)
692
- ), p = (m, y, _ = !0) => {
693
- const g = oe(m, e?.pathname || n, d);
694
- if (!y || Array.isArray(y) && !y.length) {
695
- s ? (i.delete(m), c(i)) : l((w) => {
696
- const P = { ...w };
697
- return delete P[m], P;
698
- }), localStorage.removeItem(g);
675
+ const y = () => Object.keys(localStorage).filter(
676
+ (g) => g.startsWith(d) && g.endsWith(e?.pathname || n)
677
+ ), p = (g, h, P = !0) => {
678
+ const m = re(g, e?.pathname || n, d);
679
+ if (!h || Array.isArray(h) && !h.length) {
680
+ s ? (i.delete(g), c(i)) : l((E) => {
681
+ const T = { ...E };
682
+ return delete T[g], T;
683
+ }), localStorage.removeItem(m);
699
684
  return;
700
685
  }
701
- _ && y && localStorage.setItem(g, JSON.stringify({ ...i, [m]: y })), s && y ? (i.set(m, JSON.stringify(y)), c(i)) : !s && y && l((w) => ({ ...w, [m]: y }));
686
+ P && h && localStorage.setItem(m, JSON.stringify({ ...i, [g]: h })), s && h ? (i.set(g, JSON.stringify(h)), c(i)) : !s && h && l((E) => ({ ...E, [g]: h }));
702
687
  };
703
688
  return {
704
- getFilter: (m, y) => {
689
+ getFilter: (g, h) => {
705
690
  if (!s) {
706
- const w = u[m];
707
- if (w !== void 0)
708
- return w;
691
+ const E = u[g];
692
+ if (E !== void 0)
693
+ return E;
709
694
  }
710
695
  if (s) {
711
- const w = i.get(m);
712
- if (w)
696
+ const E = i.get(g);
697
+ if (E)
713
698
  try {
714
- return JSON.parse(w);
699
+ return JSON.parse(E);
715
700
  } catch {
716
- return w;
701
+ return E;
717
702
  }
718
703
  }
719
- const _ = oe(m, e?.pathname || n, d), g = localStorage.getItem(_);
720
- if (g)
704
+ const P = re(g, e?.pathname || n, d), m = localStorage.getItem(P);
705
+ if (m)
721
706
  try {
722
- const w = JSON.parse(g)[m];
723
- return !s && w !== void 0 && l((P) => ({ ...P, [m]: w })), w;
707
+ const E = JSON.parse(m)[g];
708
+ return !s && E !== void 0 && l((T) => ({ ...T, [g]: E })), E;
724
709
  } catch {
725
710
  }
726
- return y;
711
+ return h;
727
712
  },
728
713
  getFilters: () => {
729
- const m = h(), y = Fe(m);
714
+ const g = y(), h = Le(g);
730
715
  if (s) {
731
- const _ = Object.fromEntries(i.entries());
716
+ const P = Object.fromEntries(i.entries());
732
717
  return {
733
- ...y,
734
- ..._
718
+ ...h,
719
+ ...P
735
720
  };
736
721
  }
737
722
  return {
738
- ...y,
723
+ ...h,
739
724
  ...u
740
725
  };
741
726
  },
742
- handleFilter: (m, y) => (_, g) => {
743
- if (g || Array.isArray(g) && g.length === 0) {
744
- const w = y || "value", P = typeof g == "object" && w in g ? g[w] : g;
745
- p(m, P);
727
+ handleFilter: (g, h) => (P, m) => {
728
+ if (m || Array.isArray(m) && m.length === 0) {
729
+ const E = h || "value", T = typeof m == "object" && E in m ? m[E] : m;
730
+ p(g, T);
746
731
  return;
747
732
  }
748
- p(m, void 0);
733
+ p(g, void 0);
749
734
  },
750
735
  setFilter: p
751
736
  };
752
- }, rt = ({
737
+ }, tt = ({
753
738
  data: e,
754
739
  fetchNextPage: r,
755
740
  isFetchingNextPage: o,
@@ -757,12 +742,12 @@ const We = ({ IMaskMixin: e, ...r }) => {
757
742
  isLoading: n,
758
743
  enabled: i = !0
759
744
  }) => {
760
- const c = N(
745
+ const c = x(
761
746
  async (l) => {
762
747
  o || !i || await r({ pageParam: l?.pageParam || l.visibleRowsCount });
763
748
  },
764
749
  [i, r, o]
765
- ), u = G(() => {
750
+ ), u = M(() => {
766
751
  if (e)
767
752
  return e.pages.reduce((l, d) => [...l, ...d], []);
768
753
  }, [e]);
@@ -772,8 +757,8 @@ const We = ({ IMaskMixin: e, ...r }) => {
772
757
  loadingVariant: a ? "skeleton" : "linear-progress",
773
758
  rows: u
774
759
  };
775
- }, nt = (e) => {
776
- const { libraries: r } = j(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 = N(
760
+ }, rt = (e) => {
761
+ const { libraries: r } = j(_), 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 = x(
777
762
  (d) => {
778
763
  if (d && typeof d == "object" && "response" in d) {
779
764
  const { response: s } = d || {};
@@ -784,9 +769,9 @@ const We = ({ IMaskMixin: e, ...r }) => {
784
769
  if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "message" in s.data && s.data.message)
785
770
  return String(s.data.message);
786
771
  if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "detail" in s.data) {
787
- const { detail: h } = s.data;
788
- if (Array.isArray(h) && h.length > 0 && typeof h[0] == "object" && h[0] !== null && "msg" in h[0]) {
789
- const { msg: p } = h[0];
772
+ const { detail: y } = s.data;
773
+ if (Array.isArray(y) && y.length > 0 && typeof y[0] == "object" && y[0] !== null && "msg" in y[0]) {
774
+ const { msg: p } = y[0];
790
775
  if (typeof p == "string")
791
776
  return String(p);
792
777
  }
@@ -796,33 +781,33 @@ const We = ({ IMaskMixin: e, ...r }) => {
796
781
  },
797
782
  [c]
798
783
  );
799
- return { getErrorCode: N((d) => {
784
+ return { getErrorCode: x((d) => {
800
785
  const { response: s } = d || {};
801
786
  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";
802
787
  }, []), printError: u };
803
788
  };
804
789
  export {
805
- Ue as GTMSendPageView,
806
- Qe as InitializeAxiosConfig,
807
- Ve as InitializeDaysJSConfig,
808
- Me as InitializeI18nConfig,
809
- Ge as InitializeSentryConfig,
810
- S as InjectDependenciesContext,
811
- ze as InjectDependenciesProvider,
812
- We as MaskTextField,
813
- Je as PreloadErrorHandler,
814
- He as QueryClientProviderWithConfig,
815
- Ke as RequireAuth,
816
- qe as UpdateNotifier,
817
- Ye as axiosCustomInstance,
818
- ke as dateAdapter,
819
- Ce as distanceAdapter,
820
- Be as getOrvalConfig,
821
- Xe as useAdapter,
822
- Ze as useAuth,
823
- et as useCurrentLanguage,
824
- tt as useFilters,
825
- rt as useInfiniteDataGrid,
826
- nt as useResponseError,
827
- xe as worksiteNameAdapter
790
+ ze as GTMSendPageView,
791
+ Ue as InitializeAxiosConfig,
792
+ Qe as InitializeDaysJSConfig,
793
+ Ve as InitializeI18nConfig,
794
+ Me as InitializeSentryConfig,
795
+ _ as InjectDependenciesContext,
796
+ We as InjectDependenciesProvider,
797
+ Ye as MaskTextField,
798
+ Ge as PreloadErrorHandler,
799
+ Be as QueryClientProviderWithConfig,
800
+ Je as RequireAuth,
801
+ Ke as UpdateNotifier,
802
+ De as axiosCustomInstance,
803
+ Te as dateAdapter,
804
+ ke as distanceAdapter,
805
+ qe as getOrvalConfig,
806
+ He as useAdapter,
807
+ Xe as useAuth,
808
+ Ze as useCurrentLanguage,
809
+ et as useFilters,
810
+ tt as useInfiniteDataGrid,
811
+ rt as useResponseError,
812
+ Ce as worksiteNameAdapter
828
813
  };
package/dist/main.umd.cjs CHANGED
@@ -1,22 +1,6 @@
1
- (function(m,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],x):(m=typeof globalThis<"u"?globalThis:m||self,x(m["@tracktor/shared-module"]={},m.axios,m.React))})(this,function(m,x,f){"use strict";const ae=(e,r)=>{const o=x.CancelToken.source(),a=x({...e,...r,cancelToken:o.token}).then(({data:n})=>n);return a.cancel=()=>{o.cancel("Query was cancelled")},a};var Y={exports:{}},L={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var G;function se(){if(G)return L;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 L.Fragment=r,L.jsx=o,L.jsxs=o,L}var F={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var J;function ie(){return J||(J=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Je?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case E:return"Profiler";case y:return"StrictMode";case _: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 I:return"Portal";case h:return(t.displayName||"Context")+".Provider";case P:return(t._context.displayName||"Context")+".Consumer";case b: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 q: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 w=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return w.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),r(t)}}function a(t){if(t===j)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===q)return"<...>";try{var p=e(t);return p?"<"+p+">":"<...>"}catch{return"<...>"}}function n(){var t=z.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 w(){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))}w.isReactWarning=!0,Object.defineProperty(t,"key",{get:w,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,w,R,O,T,M,Q){return w=T.ref,t={$$typeof:A,type:t,key:p,props:T,_owner:O},(w!==void 0?w: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:M}),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,w,R,O,T,M,Q){var S=p.children;if(S!==void 0)if(R)if(Ke(S)){for(R=0;R<S.length;R++)v(S[R]);Object.freeze&&Object.freeze(S)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(S);if($.call(p,"key")){S=e(t);var N=Object.keys(p).filter(function(Be){return Be!=="key"});R=0<N.length?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}",oe[S+R]||(N=0<N.length?"{"+N.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(m,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],I):(m=typeof globalThis<"u"?globalThis:m||self,I(m["@tracktor/shared-module"]={},m.axios,m.React))})(this,(function(m,I,f){"use strict";const ne=(e,r)=>{const o=I.CancelToken.source(),a=I({...e,...r,cancelToken:o.token}).then(({data:n})=>n);return a.cancel=()=>{o.cancel("Query was cancelled")},a};var F={exports:{}},x={};var V;function oe(){if(V)return x;V=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 x.Fragment=r,x.jsx=o,x.jsxs=o,x}var N={};var G;function ae(){return G||(G=1,process.env.NODE_ENV!=="production"&&(function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Ge?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case y:return"Fragment";case j:return"Profiler";case E:return"StrictMode";case Ue:return"Suspense";case Me:return"SuspenseList";case Ve: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 C:return"Portal";case b:return t.displayName||"Context";case h:return(t._context.displayName||"Context")+".Consumer";case P:var p=t.render;return t=t.displayName,t||(t=p.displayName||p.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Qe:return p=t.displayName||null,p!==null?p:e(t.type)||"Memo";case W: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 w=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return w.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),r(t)}}function a(t){if(t===y)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===W)return"<...>";try{var p=e(t);return p?"<"+p+">":"<...>"}catch{return"<...>"}}function n(){var t=z.A;return t===null?null:t.getOwner()}function i(){return Error("react-stack-top-frame")}function c(t){if(Z.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 w(){q||(q=!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))}w.isReactWarning=!0,Object.defineProperty(t,"key",{get:w,configurable:!0})}function l(){var t=e(this.type);return $[t]||($[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,w,R,Y,M){var _=w.ref;return t={$$typeof:k,type:t,key:p,props:w,_owner:R},(_!==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:Y}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function s(t,p,w,R,Y,M){var _=p.children;if(_!==void 0)if(R)if(Je(_)){for(R=0;R<_.length;R++)v(_[R]);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(Z.call(p,"key")){_=e(t);var O=Object.keys(p).filter(function(Ke){return Ke!=="key"});R=0<O.length?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}",re[_+R]||(O=0<O.length?"{"+O.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
2
  let props = %s;
19
3
  <%s {...props} />
20
4
  React keys must be passed directly to JSX without using spread:
21
5
  let props = %s;
22
- <%s key={someKey} {...props} />`,R,S,N,S),oe[S+R]=!0)}if(S=null,w!==void 0&&(o(w),S=""+w),c(p)&&(o(p.key),S=""+p.key),"key"in p){w={};for(var V in p)V!=="key"&&(w[V]=p[V])}else w=p;return S&&u(w,typeof t=="function"?t.displayName||t.name||"Unknown":t),d(t,S,T,O,n(),w,M,Q)}function v(t){typeof t=="object"&&t!==null&&t.$$typeof===A&&t._store&&(t._store.validated=1)}var g=f,A=Symbol.for("react.transitional.element"),I=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),h=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),Qe=Symbol.for("react.suspense_list"),Ve=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Ge=Symbol.for("react.activity"),Je=Symbol.for("react.client.reference"),z=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,Ke=Array.isArray,U=console.createTask?console.createTask:function(){return null};g={"react-stack-bottom-frame":function(t){return t()}};var ee,te={},re=g["react-stack-bottom-frame"].bind(g,i)(),ne=U(a(i)),oe={};F.Fragment=j,F.jsx=function(t,p,w,R,O){var T=1e4>z.recentlyCreatedOwnerStacks++;return s(t,p,w,!1,R,O,T?Error("react-stack-top-frame"):re,T?U(a(t)):ne)},F.jsxs=function(t,p,w,R,O){var T=1e4>z.recentlyCreatedOwnerStacks++;return s(t,p,w,!0,R,O,T?Error("react-stack-top-frame"):re,T?U(a(t)):ne)}}()),F}var K;function ce(){return K||(K=1,process.env.NODE_ENV==="production"?Y.exports=se():Y.exports=ie()),Y.exports}var k=ce();const le=({IMaskMixin:e,...r})=>{const o=f.useMemo(()=>e(({TextField:a,...n})=>k.jsx(a,{...n})),[e]);return k.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 k.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]),k.jsx(u,{})},D=(()=>{try{return typeof global=="object"&&global!==null&&("HermesInternal"in global||"__fbBatchedBridge"in global||"__metro"in global)||typeof window>"u"&&typeof global<"u"?!0:typeof navigator<"u"&&navigator.userAgent?/react.native|ReactNative/i.test(navigator.userAgent):!1}catch{return!1}})(),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||D)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,A=d?`${v} ${g}`:null;A&&(l.defaults.headers.common.Authorization=A)}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(D)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},he=({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,A=s?.reactRouter||v?.reactRouter;if(!g)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!A)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:I,matchRoutes:j,useLocation:y,useNavigationType:E}=A;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:I,matchRoutes:j,useEffect:f.useEffect,useLocation:y,useNavigationType:E}),...r||[]],release:d,replaysOnErrorSampleRate:n||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:i,tracesSampleRate:o||1}),null},ye=()=>(f.useEffect(()=>{if(D)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:A,Outlet:I}=u,j=g(),y=f.useRef(!1),E=typeof r=="function"?r():!!r,P=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]),P&&!s?k.jsx(f.Suspense,{fallback:e,children:j.state?.from?.state&&j.state?.from?.pathname===o?k.jsx(A,{to:j.state.from.state.from.pathname+j.state.from.state.from.search,replace:!0}):k.jsx(I,{})}):k.jsx(A,{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)}},be=({autoUpdate:e,renderDialog:r,clearCachesOnReload:o})=>{const a=f.useRef(null),[n,i]=f.useState(!1),c=f.useCallback(async()=>{a.current&&a.current.postMessage({type:"SKIP_WAITING"}),o&&await we(),window.location.reload()},[o]),u=f.useCallback(async()=>{window.confirm("A new version is available. The app will reload now.")&&await 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().catch(console.error)},[e,n,c]),f.useEffect(()=>{n&&!e&&!r&&u().catch(console.error)},[r,u,n,e]),n&&!e&&r?r(c):null},Re=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Se=e=>{const r=e.split(/[/\\]/).pop()||"";return r.substring(0,r.lastIndexOf("."))},Ae=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)},Ce=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),je=(e,r,o,a)=>{const n=Ae(r),i=Re(o),c=`${n}${i}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},Pe=(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},_e=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||Ce(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:Pe(i,c)},header:g=>["Generated by orval 🍺",...g.title?[g.title]:[],...g.description?[g.description]:[]],mutator:{name:Se(v),path:v},operationName:(g,A,I)=>je(g,A,I,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 k.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(D)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}},W=(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,W(n,r)});return f.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(W(e.language,r));const n=i=>{a(W(i,r))};return e?.on?.("languageChanged",n),()=>{e?.off?.("languageChanged",n)}},[e,r]),o},De="tracktor.filter",Ye={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},Z=(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;if(D)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 v=()=>Object.keys(localStorage).filter(y=>y.startsWith(d)&&y.endsWith(e?.pathname||n)),g=(y,E,P=!0)=>{const h=Z(y,e?.pathname||n,d);if(!E||Array.isArray(E)&&!E.length){s?(i.delete(y),c(i)):l(b=>{const _={...b};return delete _[y],_}),localStorage.removeItem(h);return}P&&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)try{return JSON.parse(b)}catch{return b}}const P=Z(y,e?.pathname||n,d),h=localStorage.getItem(P);if(h)try{const b=JSON.parse(h)[y];return!s&&b!==void 0&&l(_=>({..._,[y]:b})),b}catch{}return E},getFilters:()=>{const y=v(),E=We(y);if(s){const P=Object.fromEntries(i.entries());return{...E,...P}}return{...E,...u}},handleFilter:(y,E)=>(P,h)=>{if(h||Array.isArray(h)&&h.length===0){const b=E||"value",_=typeof h=="object"&&b in h?h[b]:h;g(y,_);return}g(y,void 0)},setFilter:g}},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=he,m.InjectDependenciesContext=C,m.InjectDependenciesProvider=ue,m.MaskTextField=le,m.PreloadErrorHandler=ye,m.QueryClientProviderWithConfig=Ie,m.RequireAuth=Ee,m.UpdateNotifier=be,m.axiosCustomInstance=ae,m.dateAdapter=B,m.distanceAdapter=H,m.getOrvalConfig=_e,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"})});
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===k}var S=f,k=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"),P=Symbol.for("react.forward_ref"),Ue=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),Qe=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),Ve=Symbol.for("react.activity"),Ge=Symbol.for("react.client.reference"),z=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,Je=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 T=se();const ie=({IMaskMixin:e,...r})=>{const o=f.useMemo(()=>e(({TextField:a,...n})=>T.jsx(a,{...n})),[e]);return T.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 T.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]),T.jsx(u,{})},L=(()=>{try{return typeof global=="object"&&global!==null&&("HermesInternal"in global||"__fbBatchedBridge"in global||"__metro"in global)||typeof window>"u"&&typeof global<"u"?!0:typeof navigator<"u"&&navigator.userAgent?/react.native|ReactNative/i.test(navigator.userAgent):!1}catch{return!1}})(),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:k,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:k,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:k}=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?T.jsx(f.Suspense,{fallback:e,children:C.state?.from?.state&&C.state?.from?.pathname===o?T.jsx(S,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):T.jsx(k,{})}):T.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,k)=>Se(g,S,k,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 T.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:()=>{}},X=(e,r,o)=>`${o}_${e}=>${r}`,De=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},{}),Ye=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 P={...b};return delete P[y],P}),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)try{return JSON.parse(b)}catch{return 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(P=>({...P,[y]:b})),b}catch{}return E},getFilters:()=>{const y=v(),E=De(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",P=typeof h=="object"&&b in h?h[b]:h;g(y,P);return}g(y,void 0)},setFilter:g}},We=({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}},ze=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=Ye,m.useInfiniteDataGrid=We,m.useResponseError=ze,m.worksiteNameAdapter=H,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "@tracktor/shared-module",
3
- "version": "2.19.1",
3
+ "version": "2.19.4",
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",
@@ -26,13 +24,13 @@
26
24
  "url": "https://github.com/Tracktor/shared-module/issues"
27
25
  },
28
26
  "scripts": {
29
- "dev": "vite",
30
- "build": "vite build",
31
- "lint": "biome check --diagnostic-level=error . && tsc --noEmit --incremental",
32
- "lint:fix": "biome check . --write",
33
- "preview": "vite preview",
34
- "test": "yarn lint && vitest",
35
- "prepare": "yarn run build && husky install"
27
+ "dev": "bunx vite",
28
+ "build": "bunx vite build",
29
+ "lint": "bunx biome check --diagnostic-level=error . && bunx tsc --noEmit --incremental",
30
+ "lint:fix": "bunx biome check . --write",
31
+ "preview": "bunx vite preview",
32
+ "test": "bun run lint && bunx vitest",
33
+ "prepare": "bun run build && bunx husky install"
36
34
  },
37
35
  "dependencies": {
38
36
  "axios": "^1.0.0"
package/CHANGELOG.md DELETED
@@ -1,6 +0,0 @@
1
- # Changelog
2
-
3
- ## [2.19.1] - 2025-11-04
4
-
5
- ### Fix
6
- - Response error with null msg