@tracktor/shared-module 2.15.8 → 2.15.9

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