@tracktor/shared-module 2.1.1 → 2.1.3

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,4 +1,4 @@
1
1
  # [Versions](https://github.com/Tracktor/shared-module/releases)
2
2
 
3
- ## v2.1.1
4
- - **[feat]** - orval config improvements
3
+ ## v2.1.3
4
+ - **[fix]** - orval config base url with several api
@@ -1,5 +1,6 @@
1
1
  import { AxiosError, AxiosRequestConfig } from "axios";
2
- export declare const axiosCustomInstance: <T>(config: AxiosRequestConfig) => Promise<T>;
2
+ export declare const AXIOS_INSTANCE: import("axios").AxiosInstance;
3
+ export declare const axiosCustomInstance: <T>(config: AxiosRequestConfig, options?: AxiosRequestConfig) => Promise<T>;
3
4
  export default axiosCustomInstance;
4
- export interface ErrorType<Error> extends AxiosError<Error> {
5
- }
5
+ export type ErrorType<Error> = AxiosError<Error>;
6
+ export type BodyType<BodyData> = BodyData;
@@ -1,15 +1,19 @@
1
1
  import axios, { AxiosError, AxiosRequestConfig } from "axios";
2
2
 
3
- axios.create();
3
+ export const AXIOS_INSTANCE = axios.create();
4
4
 
5
- export const axiosCustomInstance = <T>(config: AxiosRequestConfig): Promise<T> => {
5
+ export const axiosCustomInstance = <T>(config: AxiosRequestConfig, options?: AxiosRequestConfig): Promise<T> => {
6
6
  const source = axios.CancelToken.source();
7
- // @ts-ignore
8
- const promise = axios({ ...config, cancelToken: source.token }).then(({ data }) => data);
7
+
8
+ const promise = AXIOS_INSTANCE({
9
+ ...config,
10
+ ...options,
11
+ cancelToken: source.token,
12
+ }).then(({ data }) => data);
9
13
 
10
14
  // @ts-ignore
11
15
  promise.cancel = () => {
12
- source.cancel("Query was cancelled.");
16
+ source.cancel("Query was cancelled");
13
17
  };
14
18
 
15
19
  return promise;
@@ -17,4 +21,5 @@ export const axiosCustomInstance = <T>(config: AxiosRequestConfig): Promise<T> =
17
21
 
18
22
  export default axiosCustomInstance;
19
23
 
20
- export interface ErrorType<Error> extends AxiosError<Error> {}
24
+ export type ErrorType<Error> = AxiosError<Error>;
25
+ export type BodyType<BodyData> = BodyData;
@@ -18,12 +18,19 @@ interface CustomOrvalConfig {
18
18
  * @default "src/api/services/api.ts"
19
19
  */
20
20
  target?: string;
21
+ /**
22
+ * Give you the possibility to set base url to your mock handlers.
23
+ */
24
+ baseUrl?: string;
21
25
  };
22
26
  /**
23
27
  * List of operations to use infinite query
24
28
  */
25
29
  operationsToGenerateInfiniteQueryHook?: string[];
26
30
  }
31
+ interface OrvalConfig {
32
+ [key: string]: CustomOrvalConfig;
33
+ }
27
34
  /**
28
35
  * Convert a string to capitalize
29
36
  * @param method
@@ -49,5 +56,5 @@ export declare const getOrvalOperationName: (_: any, route: string, method: stri
49
56
  /**
50
57
  * Get the orval config required for the generation
51
58
  */
52
- export declare const getOrvalConfig: (config?: CustomOrvalConfig | CustomOrvalConfig[]) => CustomOrvalConfig | undefined;
59
+ export declare const getOrvalConfig: (config?: CustomOrvalConfig | CustomOrvalConfig[]) => OrvalConfig;
53
60
  export default getOrvalConfig;
package/dist/main.js CHANGED
@@ -12,7 +12,7 @@ var se = { exports: {} }, B = {};
12
12
  var Fe;
13
13
  function yt() {
14
14
  return Fe || (Fe = 1, process.env.NODE_ENV !== "production" && function() {
15
- var t = Ne, n = Symbol.for("react.element"), i = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), v = Symbol.for("react.provider"), s = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), a = Symbol.for("react.offscreen"), j = Symbol.iterator, x = "@@iterator";
15
+ var t = Ne, n = Symbol.for("react.element"), i = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), v = Symbol.for("react.provider"), s = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), u = Symbol.for("react.offscreen"), j = Symbol.iterator, x = "@@iterator";
16
16
  function T(e) {
17
17
  if (e === null || typeof e != "object")
18
18
  return null;
@@ -37,10 +37,10 @@ function yt() {
37
37
  p.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, p);
38
38
  }
39
39
  }
40
- var N = !1, W = !1, b = !1, fe = !1, de = !1, M;
40
+ var N = !1, W = !1, C = !1, fe = !1, de = !1, M;
41
41
  M = Symbol.for("react.module.reference");
42
42
  function We(e) {
43
- return !!(typeof e == "string" || typeof e == "function" || e === u || e === f || de || e === c || e === y || e === E || fe || e === a || N || W || b || typeof e == "object" && e !== null && (e.$$typeof === R || e.$$typeof === w || e.$$typeof === v || e.$$typeof === s || e.$$typeof === l || // This needs to include all possible module reference object
43
+ return !!(typeof e == "string" || typeof e == "function" || e === c || e === f || de || e === a || e === y || e === E || fe || e === u || N || W || C || typeof e == "object" && e !== null && (e.$$typeof === R || e.$$typeof === w || e.$$typeof === v || e.$$typeof === s || e.$$typeof === l || // This needs to include all possible module reference object
44
44
  // types supported by any Flight configuration anywhere since
45
45
  // we don't know which Flight build this will end up being used
46
46
  // with.
@@ -64,13 +64,13 @@ function yt() {
64
64
  if (typeof e == "string")
65
65
  return e;
66
66
  switch (e) {
67
- case u:
67
+ case c:
68
68
  return "Fragment";
69
69
  case i:
70
70
  return "Portal";
71
71
  case f:
72
72
  return "Profiler";
73
- case c:
73
+ case a:
74
74
  return "StrictMode";
75
75
  case y:
76
76
  return "Suspense";
@@ -232,18 +232,18 @@ function yt() {
232
232
  if ($ && d && typeof $.stack == "string") {
233
233
  for (var g = $.stack.split(`
234
234
  `), S = d.stack.split(`
235
- `), C = g.length - 1, P = S.length - 1; C >= 1 && P >= 0 && g[C] !== S[P]; )
235
+ `), b = g.length - 1, P = S.length - 1; b >= 1 && P >= 0 && g[b] !== S[P]; )
236
236
  P--;
237
- for (; C >= 1 && P >= 0; C--, P--)
238
- if (g[C] !== S[P]) {
239
- if (C !== 1 || P !== 1)
237
+ for (; b >= 1 && P >= 0; b--, P--)
238
+ if (g[b] !== S[P]) {
239
+ if (b !== 1 || P !== 1)
240
240
  do
241
- if (C--, P--, P < 0 || g[C] !== S[P]) {
241
+ if (b--, P--, P < 0 || g[b] !== S[P]) {
242
242
  var O = `
243
- ` + g[C].replace(" at new ", " at ");
243
+ ` + g[b].replace(" at new ", " at ");
244
244
  return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && J.set(e, O), O;
245
245
  }
246
- while (C >= 1 && P >= 0);
246
+ while (b >= 1 && P >= 0);
247
247
  break;
248
248
  }
249
249
  }
@@ -289,13 +289,13 @@ function yt() {
289
289
  }
290
290
  return "";
291
291
  }
292
- var H = Object.prototype.hasOwnProperty, Ce = {}, be = D.ReactDebugCurrentFrame;
292
+ var H = Object.prototype.hasOwnProperty, be = {}, Ce = D.ReactDebugCurrentFrame;
293
293
  function K(e) {
294
294
  if (e) {
295
295
  var r = e._owner, o = X(e.type, e._source, r ? r.type : null);
296
- be.setExtraStackFrame(o);
296
+ Ce.setExtraStackFrame(o);
297
297
  } else
298
- be.setExtraStackFrame(null);
298
+ Ce.setExtraStackFrame(null);
299
299
  }
300
300
  function Be(e, r, o, d, h) {
301
301
  {
@@ -309,10 +309,10 @@ function yt() {
309
309
  throw S.name = "Invariant Violation", S;
310
310
  }
311
311
  g = e[m](r, m, d, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
312
- } catch (C) {
313
- g = C;
312
+ } catch (b) {
313
+ g = b;
314
314
  }
315
- g && !(g instanceof Error) && (K(h), _("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", d || "React class", o, m, typeof g), K(null)), g instanceof Error && !(g.message in Ce) && (Ce[g.message] = !0, K(h), _("Failed %s type: %s", o, g.message), K(null));
315
+ g && !(g instanceof Error) && (K(h), _("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", d || "React class", o, m, typeof g), K(null)), g instanceof Error && !(g.message in be) && (be[g.message] = !0, K(h), _("Failed %s type: %s", o, g.message), K(null));
316
316
  }
317
317
  }
318
318
  }
@@ -427,9 +427,9 @@ function yt() {
427
427
  for (p in r)
428
428
  H.call(r, p) && !Xe.hasOwnProperty(p) && (m[p] = r[p]);
429
429
  if (e && e.defaultProps) {
430
- var C = e.defaultProps;
431
- for (p in C)
432
- m[p] === void 0 && (m[p] = C[p]);
430
+ var b = e.defaultProps;
431
+ for (p in b)
432
+ m[p] === void 0 && (m[p] = b[p]);
433
433
  }
434
434
  if (g || S) {
435
435
  var P = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
@@ -564,8 +564,8 @@ Check the top-level render call using <` + o + ">.");
564
564
  (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (g += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
565
565
  var S = ot(h);
566
566
  S ? g += S : g += Oe();
567
- var C;
568
- e === null ? C = "null" : ne(e) ? C = "array" : e !== void 0 && e.$$typeof === n ? (C = "<" + (I(e.type) || "Unknown") + " />", g = " Did you accidentally export a JSX literal instead of a component?") : C = typeof e, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", C, g);
567
+ var b;
568
+ e === null ? b = "null" : ne(e) ? b = "array" : e !== void 0 && e.$$typeof === n ? (b = "<" + (I(e.type) || "Unknown") + " />", g = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, g);
569
569
  }
570
570
  var P = nt(e, r, o, h, p);
571
571
  if (P == null)
@@ -583,7 +583,7 @@ Check the top-level render call using <` + o + ">.");
583
583
  else
584
584
  ke(O, e);
585
585
  }
586
- return e === u ? ut(P) : at(P), P;
586
+ return e === c ? ut(P) : at(P), P;
587
587
  }
588
588
  }
589
589
  function ct(e, r, o) {
@@ -593,7 +593,7 @@ Check the top-level render call using <` + o + ">.");
593
593
  return Ie(e, r, o, !1);
594
594
  }
595
595
  var lt = st, ft = ct;
596
- B.Fragment = u, B.jsx = lt, B.jsxs = ft;
596
+ B.Fragment = c, B.jsx = lt, B.jsxs = ft;
597
597
  }()), B;
598
598
  }
599
599
  var G = {};
@@ -611,36 +611,36 @@ function ht() {
611
611
  if (Ye)
612
612
  return G;
613
613
  Ye = 1;
614
- var t = Ne, n = Symbol.for("react.element"), i = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, c = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
614
+ var t = Ne, n = Symbol.for("react.element"), i = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, a = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
615
615
  function v(s, l, y) {
616
- var E, w = {}, R = null, a = null;
617
- y !== void 0 && (R = "" + y), l.key !== void 0 && (R = "" + l.key), l.ref !== void 0 && (a = l.ref);
616
+ var E, w = {}, R = null, u = null;
617
+ y !== void 0 && (R = "" + y), l.key !== void 0 && (R = "" + l.key), l.ref !== void 0 && (u = l.ref);
618
618
  for (E in l)
619
- u.call(l, E) && !f.hasOwnProperty(E) && (w[E] = l[E]);
619
+ c.call(l, E) && !f.hasOwnProperty(E) && (w[E] = l[E]);
620
620
  if (s && s.defaultProps)
621
621
  for (E in l = s.defaultProps, l)
622
622
  w[E] === void 0 && (w[E] = l[E]);
623
- return { $$typeof: n, type: s, key: R, ref: a, props: w, _owner: c.current };
623
+ return { $$typeof: n, type: s, key: R, ref: u, props: w, _owner: a.current };
624
624
  }
625
625
  return G.Fragment = i, G.jsx = v, G.jsxs = v, G;
626
626
  }
627
627
  process.env.NODE_ENV === "production" ? se.exports = ht() : se.exports = yt();
628
628
  var F = se.exports;
629
629
  const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
630
- const u = le(
630
+ const c = le(
631
631
  () => ({
632
632
  apiURL: n,
633
633
  libraries: i
634
634
  }),
635
635
  [n, i]
636
636
  );
637
- return /* @__PURE__ */ F.jsx(A.Provider, { value: u, children: t });
637
+ return /* @__PURE__ */ F.jsx(A.Provider, { value: c, children: t });
638
638
  }, At = ({
639
639
  Fallback: t,
640
640
  isLogged: n,
641
641
  loginPath: i = "/login",
642
- localStorageKey: u = "user",
643
- redirect401Path: c = "/login",
642
+ localStorageKey: c = "user",
643
+ redirect401Path: a = "/login",
644
644
  ...f
645
645
  }) => {
646
646
  var _, Y, N, W;
@@ -649,25 +649,25 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
649
649
  throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
650
650
  if (!s)
651
651
  throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
652
- const [y, E] = vt(null), { useLocation: w, Navigate: R, Outlet: a } = l, j = w(), x = gt(!1), T = typeof n == "function" ? n() : !!n, D = typeof T == "boolean" ? T : T == null ? void 0 : T.isLogged;
652
+ const [y, E] = vt(null), { useLocation: w, Navigate: R, Outlet: u } = l, j = w(), x = gt(!1), T = typeof n == "function" ? n() : !!n, D = typeof T == "boolean" ? T : T == null ? void 0 : T.isLogged;
653
653
  return Z(() => {
654
654
  x.current || (x.current = !0, s == null || s.interceptors.response.use(
655
- (b) => b,
656
- async (b) => {
655
+ (C) => C,
656
+ async (C) => {
657
657
  var M;
658
- return typeof b == "object" && b && "response" in b && b.response && typeof b.response == "object" && "status" in b.response && b.response && typeof b.response == "object" && "status" in b.response && ((M = b == null ? void 0 : b.response) == null ? void 0 : M.status) === 401 && (s.defaults.headers.common.Authorization = null, localStorage.removeItem(u), E(c)), Promise.reject(b);
658
+ return typeof C == "object" && C && "response" in C && C.response && typeof C.response == "object" && "status" in C.response && C.response && typeof C.response == "object" && "status" in C.response && ((M = C == null ? void 0 : C.response) == null ? void 0 : M.status) === 401 && (s.defaults.headers.common.Authorization = null, localStorage.removeItem(c), E(a)), Promise.reject(C);
659
659
  }
660
660
  ));
661
- }, [s == null ? void 0 : s.defaults.headers.common, s == null ? void 0 : s.interceptors.response, u, c]), D && !y ? /* @__PURE__ */ F.jsx(mt, { fallback: t, children: (Y = (_ = j.state) == null ? void 0 : _.from) != null && Y.state && ((W = (N = j.state) == null ? void 0 : N.from) == null ? void 0 : W.pathname) === i ? /* @__PURE__ */ F.jsx(R, { to: j.state.from.state.from.pathname + j.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ F.jsx(a, {}) }) : /* @__PURE__ */ F.jsx(R, { to: i, state: { from: j }, replace: !0 });
661
+ }, [s == null ? void 0 : s.defaults.headers.common, s == null ? void 0 : s.interceptors.response, c, a]), D && !y ? /* @__PURE__ */ F.jsx(mt, { fallback: t, children: (Y = (_ = j.state) == null ? void 0 : _.from) != null && Y.state && ((W = (N = j.state) == null ? void 0 : N.from) == null ? void 0 : W.pathname) === i ? /* @__PURE__ */ F.jsx(R, { to: j.state.from.state.from.pathname + j.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ F.jsx(u, {}) }) : /* @__PURE__ */ F.jsx(R, { to: i, state: { from: j }, replace: !0 });
662
662
  }, Dt = ({ ...t }) => {
663
- const { libraries: n } = k(A), i = (t == null ? void 0 : t.reactRouter) || (n == null ? void 0 : n.reactRouter), u = (t == null ? void 0 : t.gtm) || (n == null ? void 0 : n.gtm);
663
+ const { libraries: n } = k(A), i = (t == null ? void 0 : t.reactRouter) || (n == null ? void 0 : n.reactRouter), c = (t == null ? void 0 : t.gtm) || (n == null ? void 0 : n.gtm);
664
664
  if (!i)
665
665
  throw new Error(
666
666
  "React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
667
667
  );
668
- if (!u)
668
+ if (!c)
669
669
  throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
670
- const { useGoogleTagManager: c } = u, { useLocation: f, Outlet: v } = i, { pathname: s } = f(), { sendEvent: l } = c();
670
+ const { useGoogleTagManager: a } = c, { useLocation: f, Outlet: v } = i, { pathname: s } = f(), { sendEvent: l } = a();
671
671
  return Z(() => {
672
672
  l({ event: "pageView", pathname: s });
673
673
  }, [s, l]), /* @__PURE__ */ F.jsx(v, {});
@@ -675,19 +675,19 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
675
675
  tokenTypeKey: t = "tokenType",
676
676
  userLocalStorageKey: n = "user",
677
677
  tokenKey: i = "accessToken",
678
- postContentType: u = "application/json",
679
- ...c
678
+ postContentType: c = "application/json",
679
+ ...a
680
680
  }) => {
681
- const { apiURL: f = c.apiURL, libraries: v } = k(A), s = (c == null ? void 0 : c.axios) || (v == null ? void 0 : v.axios);
681
+ const { apiURL: f = a.apiURL, libraries: v } = k(A), s = (a == null ? void 0 : a.axios) || (v == null ? void 0 : v.axios);
682
682
  if (!s)
683
683
  throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
684
684
  if (!(s != null && s.defaults))
685
685
  return null;
686
686
  const l = localStorage.getItem(n), y = l ? JSON.parse(l) : null, E = y != null && y[t] ? y[t] : null, w = y != null && y[i] ? y[i] : null, R = l ? `${E} ${w}` : null;
687
- return s.defaults.baseURL = f, s.defaults.headers.post["Content-Type"] = u, R && (s.defaults.headers.common.Authorization = R), null;
687
+ return s.defaults.baseURL = f, s.defaults.headers.post["Content-Type"] = c, R && (s.defaults.headers.common.Authorization = R), null;
688
688
  }, It = ({ debug: t, resources: n, ...i }) => {
689
- const { libraries: u } = k(A), c = (i == null ? void 0 : i.i18) || (u == null ? void 0 : u.i18), { i18next: f, initReactI18next: v, languageDetector: s } = c || {};
690
- if (!c)
689
+ const { libraries: c } = k(A), a = (i == null ? void 0 : i.i18) || (c == null ? void 0 : c.i18), { i18next: f, initReactI18next: v, languageDetector: s } = a || {};
690
+ if (!a)
691
691
  throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
692
692
  return f != null && f.isInitialized || (f.use(s).use(v).init({
693
693
  debug: t,
@@ -711,8 +711,8 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
711
711
  dsn: t,
712
712
  integrations: n,
713
713
  tracesSampleRate: i,
714
- replaysSessionSampleRate: u,
715
- replaysOnErrorSampleRate: c,
714
+ replaysSessionSampleRate: c,
715
+ replaysOnErrorSampleRate: a,
716
716
  tracePropagationTargets: f,
717
717
  ignoreErrors: v,
718
718
  debug: s,
@@ -726,7 +726,7 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
726
726
  throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
727
727
  if (w.isInitialized())
728
728
  return null;
729
- const { createRoutesFromChildren: a, matchRoutes: j, useLocation: x, useNavigationType: T } = R;
729
+ const { createRoutesFromChildren: u, matchRoutes: j, useLocation: x, useNavigationType: T } = R;
730
730
  return (s || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && w.init({
731
731
  debug: s,
732
732
  dsn: t,
@@ -734,7 +734,7 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
734
734
  ignoreErrors: [...v || [], /dynamically imported module/],
735
735
  integrations: [
736
736
  w.reactRouterV6BrowserTracingIntegration({
737
- createRoutesFromChildren: a,
737
+ createRoutesFromChildren: u,
738
738
  matchRoutes: j,
739
739
  useEffect: Z,
740
740
  useLocation: x,
@@ -742,26 +742,26 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
742
742
  }),
743
743
  ...n || []
744
744
  ],
745
- replaysOnErrorSampleRate: c || 1,
746
- replaysSessionSampleRate: u || 0.1,
745
+ replaysOnErrorSampleRate: a || 1,
746
+ replaysSessionSampleRate: c || 0.1,
747
747
  tracePropagationTargets: f,
748
748
  tracesSampleRate: i || 1
749
749
  }), null;
750
750
  }, Ft = ({ IMaskMixin: t, ...n }) => {
751
751
  const i = le(
752
752
  // eslint-disable-next-line react/jsx-props-no-spreading
753
- () => t(({ TextField: u, ...c }) => /* @__PURE__ */ F.jsx(u, { ...c })),
753
+ () => t(({ TextField: c, ...a }) => /* @__PURE__ */ F.jsx(c, { ...a })),
754
754
  [t]
755
755
  );
756
756
  return /* @__PURE__ */ F.jsx(i, { ...n });
757
757
  }, Yt = ({ accessToken: t, ...n }) => {
758
- const { libraries: i } = k(A), u = (n == null ? void 0 : n.mapbox) || (i == null ? void 0 : i.mapbox);
759
- if (!u)
758
+ const { libraries: i } = k(A), c = (n == null ? void 0 : n.mapbox) || (i == null ? void 0 : i.mapbox);
759
+ if (!c)
760
760
  throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
761
- return t && (u.accessToken = t), null;
761
+ return t && (c.accessToken = t), null;
762
762
  }, Nt = ({ language: t, ...n }) => {
763
- const { libraries: i } = k(A), u = (n == null ? void 0 : n.dayjs) || (i == null ? void 0 : i.dayjs), c = (n == null ? void 0 : n.plugin) || (i == null ? void 0 : i.dayjsPlugin);
764
- if (!u)
763
+ const { libraries: i } = k(A), c = (n == null ? void 0 : n.dayjs) || (i == null ? void 0 : i.dayjs), a = (n == null ? void 0 : n.plugin) || (i == null ? void 0 : i.dayjsPlugin);
764
+ if (!c)
765
765
  throw new Error(
766
766
  "Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
767
767
  );
@@ -769,22 +769,22 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
769
769
  (async () => {
770
770
  var s;
771
771
  const v = t || ((s = navigator.language) == null ? void 0 : s.slice(0, 2)) || "en";
772
- if (c && c.forEach((l) => {
773
- l && u.extend(l);
772
+ if (a && a.forEach((l) => {
773
+ l && c.extend(l);
774
774
  }), v === "fr") {
775
775
  const l = await import("dayjs/locale/fr");
776
- u.locale(l.default);
776
+ c.locale(l.default);
777
777
  }
778
778
  })().then();
779
- }, [u, c, t]), null;
779
+ }, [c, a, t]), null;
780
780
  }, Et = (t) => t && typeof t == "function", pt = (t) => t && typeof t == "function", Wt = ({
781
781
  children: t,
782
782
  defaultQueriesOptions: n,
783
783
  defaultMutationsOptions: i,
784
- ...u
784
+ ...c
785
785
  }) => {
786
786
  var l, y;
787
- const { libraries: c } = k(A), f = (u == null ? void 0 : u.QueryClient) || ((l = c == null ? void 0 : c.reactQuery) == null ? void 0 : l.QueryClient), v = (u == null ? void 0 : u.QueryClientProvider) || ((y = c == null ? void 0 : c.reactQuery) == null ? void 0 : y.QueryClientProvider);
787
+ const { libraries: a } = k(A), f = (c == null ? void 0 : c.QueryClient) || ((l = a == null ? void 0 : a.reactQuery) == null ? void 0 : l.QueryClient), v = (c == null ? void 0 : c.QueryClientProvider) || ((y = a == null ? void 0 : a.reactQuery) == null ? void 0 : y.QueryClientProvider);
788
788
  if (!f)
789
789
  throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
790
790
  if (!v)
@@ -809,25 +809,25 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
809
809
  return /* @__PURE__ */ F.jsx(v, { client: s, children: t });
810
810
  }, Lt = (t) => {
811
811
  var y, E, w;
812
- const { libraries: n } = k(A), i = (t == null ? void 0 : t.i18) || (n == null ? void 0 : n.i18), u = ((y = t == null ? void 0 : t.i18) == null ? void 0 : y.translateFunction) || ((E = n == null ? void 0 : n.i18) == null ? void 0 : E.translateFunction), c = ((w = i == null ? void 0 : i.i18next) == null ? void 0 : w.t) || u || ((R) => R), { unknownErrorTranslationKey: f = "error.unknownError" } = t || {}, v = c(f), s = ce(
812
+ const { libraries: n } = k(A), i = (t == null ? void 0 : t.i18) || (n == null ? void 0 : n.i18), c = ((y = t == null ? void 0 : t.i18) == null ? void 0 : y.translateFunction) || ((E = n == null ? void 0 : n.i18) == null ? void 0 : E.translateFunction), a = ((w = i == null ? void 0 : i.i18next) == null ? void 0 : w.t) || c || ((R) => R), { unknownErrorTranslationKey: f = "error.unknownError" } = t || {}, v = a(f), s = ce(
813
813
  (R) => {
814
- var j, x, T, D, _, Y, N, W, b;
815
- const { response: a } = R || {};
816
- return a != null && a.reason ? String(a.reason) : (j = a == null ? void 0 : a.data) != null && j.reason ? String(a.data.reason) : (x = a == null ? void 0 : a.data) != null && x.message ? String(a.data.message) : (D = (T = a == null ? void 0 : a.data) == null ? void 0 : T.detail) != null && D.length && Array.isArray((_ = a == null ? void 0 : a.data) == null ? void 0 : _.detail) && ((N = (Y = a == null ? void 0 : a.data) == null ? void 0 : Y.detail[0]) != null && N.msg) && typeof ((b = (W = a == null ? void 0 : a.data) == null ? void 0 : W.detail[0]) == null ? void 0 : b.msg) == "string" ? String(a.data.detail[0].msg) : v;
814
+ var j, x, T, D, _, Y, N, W, C;
815
+ const { response: u } = R || {};
816
+ return u != null && u.reason ? String(u.reason) : (j = u == null ? void 0 : u.data) != null && j.reason ? String(u.data.reason) : (x = u == null ? void 0 : u.data) != null && x.message ? String(u.data.message) : (D = (T = u == null ? void 0 : u.data) == null ? void 0 : T.detail) != null && D.length && Array.isArray((_ = u == null ? void 0 : u.data) == null ? void 0 : _.detail) && ((N = (Y = u == null ? void 0 : u.data) == null ? void 0 : Y.detail[0]) != null && N.msg) && typeof ((C = (W = u == null ? void 0 : u.data) == null ? void 0 : W.detail[0]) == null ? void 0 : C.msg) == "string" ? String(u.data.detail[0].msg) : v;
817
817
  },
818
818
  [v]
819
819
  );
820
820
  return { getErrorCode: ce((R) => {
821
821
  var j, x, T;
822
- const { response: a } = R || {};
823
- return a != null && a.error_code ? String(a == null ? void 0 : a.error_code) : (j = a == null ? void 0 : a.data) != null && j.error_code ? String((x = a == null ? void 0 : a.data) == null ? void 0 : x.error_code) : a != null && a.error_code ? String(a == null ? void 0 : a.error_code) : (T = a == null ? void 0 : a.data) != null && T.error_code ? String(a.data.error_code) : "unknown_error_code";
822
+ const { response: u } = R || {};
823
+ return u != null && u.error_code ? String(u == null ? void 0 : u.error_code) : (j = u == null ? void 0 : u.data) != null && j.error_code ? String((x = u == null ? void 0 : u.data) == null ? void 0 : x.error_code) : u != null && u.error_code ? String(u == null ? void 0 : u.error_code) : (T = u == null ? void 0 : u.data) != null && T.error_code ? String(u.data.error_code) : "unknown_error_code";
824
824
  }, []), printError: s };
825
825
  }, Vt = ({
826
826
  data: t,
827
827
  fetchNextPage: n,
828
828
  isFetchingNextPage: i,
829
- isInitialLoading: u,
830
- isLoading: c,
829
+ isInitialLoading: c,
830
+ isLoading: a,
831
831
  enabled: f = !0
832
832
  }) => {
833
833
  const v = ce(
@@ -841,8 +841,8 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
841
841
  }, [t]);
842
842
  return {
843
843
  fetchNextPageOnRowsScrollEnd: v,
844
- isLoading: i || c,
845
- loadingVariant: u ? "skeleton" : "linear",
844
+ isLoading: i || a,
845
+ loadingVariant: c ? "skeleton" : "linear",
846
846
  rows: s
847
847
  };
848
848
  }, zt = (t) => {
@@ -860,21 +860,21 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
860
860
  }, Rt = ({ library: t, date: n, format: i = "ll" }) => t(n).format(i), wt = (t, n = "km") => {
861
861
  const i = Number(t);
862
862
  return Number.isNaN(i) ? `0 ${n}` : `${i.toFixed(2)} ${n}`;
863
- }, _t = (t) => t != null && t.startsWith("/") ? t != null && t.startsWith("/files") ? t : `/files${t}` : t != null && t.startsWith("files") ? `/${t}` : t != null && t.startsWith("files") ? `/${t}` : `/files/${t}`, Ct = ({ path: t, size: n, apiURL: i }) => {
863
+ }, _t = (t) => t != null && t.startsWith("/") ? t != null && t.startsWith("/files") ? t : `/files${t}` : t != null && t.startsWith("files") ? `/${t}` : t != null && t.startsWith("files") ? `/${t}` : `/files/${t}`, bt = ({ path: t, size: n, apiURL: i }) => {
864
864
  if (!t)
865
865
  return "";
866
- const u = _t(t), c = `${i}${u}`, f = c.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
867
- return typeof n == "number" && f ? `${c.replace("/files", `/thumbs/${n}`)}` : c;
866
+ const c = _t(t), a = `${i}${c}`, f = a.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
867
+ return typeof n == "number" && f ? `${a.replace("/files", `/thumbs/${n}`)}` : a;
868
868
  }, Mt = (t) => {
869
- const { apiURL: n, libraries: i } = k(A), u = (t == null ? void 0 : t.dayjs) || (i == null ? void 0 : i.dayjs);
869
+ const { apiURL: n, libraries: i } = k(A), c = (t == null ? void 0 : t.dayjs) || (i == null ? void 0 : i.dayjs);
870
870
  return {
871
871
  dateAdapter: (v, s) => {
872
- if (!u)
872
+ if (!c)
873
873
  throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
874
874
  return Rt({
875
875
  date: v,
876
876
  format: s,
877
- library: u
877
+ library: c
878
878
  });
879
879
  },
880
880
  distanceAdapter: wt,
@@ -883,19 +883,19 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
883
883
  throw new Error(
884
884
  "API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
885
885
  );
886
- return Ct({
886
+ return bt({
887
887
  apiURL: n,
888
888
  path: v,
889
889
  size: s
890
890
  });
891
891
  }
892
892
  };
893
- }, bt = (t) => t.charAt(0).toUpperCase() + t.slice(1).toLowerCase(), Pt = (t) => {
894
- const u = t.split("/").filter((c) => c.length > 0).map((c) => c.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join("")).join("");
895
- return u.charAt(0).toLowerCase() + u.slice(1);
893
+ }, Ct = (t) => t.charAt(0).toUpperCase() + t.slice(1).toLowerCase(), Pt = (t) => {
894
+ const c = t.split("/").filter((a) => a.length > 0).map((a) => a.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join("")).join("");
895
+ return c.charAt(0).toLowerCase() + c.slice(1);
896
896
  }, jt = (t) => (t.split("/").pop() || t).replace(/\.json$/, "").replace(/^openapi\./, ""), Tt = (t, n, i) => {
897
- const u = Pt(n), c = bt(i);
898
- return `${u}${c}`;
897
+ const c = Pt(n), a = Ct(i);
898
+ return `${c}${a}`;
899
899
  }, St = (t) => {
900
900
  if (t)
901
901
  return (t == null ? void 0 : t.reduce((n, i) => (n[i] = {
@@ -905,8 +905,8 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
905
905
  useQuery: !0
906
906
  }
907
907
  }, n), {})) || {};
908
- }, Ut = (t) => (Array.isArray(t) ? t : [t]).reduce((i, u) => {
909
- const { output: c, operationsToGenerateInfiniteQueryHook: f, input: v = "./openapi.json" } = u || {}, s = jt(v);
908
+ }, Ut = (t) => (Array.isArray(t) ? t : [t]).reduce((i, c) => {
909
+ const { output: a, operationsToGenerateInfiniteQueryHook: f, input: v = "./openapi.json" } = c || {}, s = jt(v);
910
910
  return {
911
911
  ...i,
912
912
  [s]: {
@@ -915,6 +915,7 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
915
915
  },
916
916
  input: v,
917
917
  output: {
918
+ baseUrl: a == null ? void 0 : a.baseUrl,
918
919
  client: "react-query",
919
920
  mode: "tags-split",
920
921
  override: {
@@ -933,9 +934,9 @@ const A = dt({}), Ot = ({ children: t, apiURL: n, libraries: i }) => {
933
934
  useQuery: !0
934
935
  }
935
936
  },
936
- schemas: (c == null ? void 0 : c.schemas) || `src/api/${s}/model`,
937
- target: (c == null ? void 0 : c.target) || `src/api/${s}/services/api.ts`,
938
- ...c
937
+ schemas: (a == null ? void 0 : a.schemas) || `src/api/${s}/model`,
938
+ target: (a == null ? void 0 : a.target) || `src/api/${s}/services/api.ts`,
939
+ ...a
939
940
  }
940
941
  }
941
942
  };
package/dist/main.umd.cjs CHANGED
@@ -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 se;function We(){return se||(se=1,process.env.NODE_ENV!=="production"&&function(){var t=h,n=Symbol.for("react.element"),i=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),v=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),a=Symbol.for("react.offscreen"),S=Symbol.iterator,I="@@iterator";function x(e){if(e===null||typeof e!="object")return null;var r=S&&e[S]||e[I];return typeof r=="function"?r:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(e){{for(var r=arguments.length,o=new Array(r>1?r-1:0),d=1;d<r;d++)o[d-1]=arguments[d];W("error",e,o)}}function W(e,r,o){{var d=k.ReactDebugCurrentFrame,E=d.getStackAddendum();E!==""&&(r+="%s",o=o.concat([E]));var p=o.map(function(y){return String(y)});p.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,p)}}var L=!1,M=!1,j=!1,ve=!1,ge=!1,Q;Q=Symbol.for("react.module.reference");function lt(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===f||ge||e===u||e===m||e===R||ve||e===a||L||M||j||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===_||e.$$typeof===v||e.$$typeof===s||e.$$typeof===l||e.$$typeof===Q||e.getModuleId!==void 0))}function ft(e,r,o){var d=e.displayName;if(d)return d;var E=r.displayName||r.name||"";return E!==""?o+"("+E+")":o}function ye(e){return e.displayName||"Context"}function Y(e){if(e==null)return null;if(typeof e.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case c:return"Fragment";case i:return"Portal";case f:return"Profiler";case u:return"StrictMode";case m:return"Suspense";case R:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case s:var r=e;return ye(r)+".Consumer";case v:var o=e;return ye(o._context)+".Provider";case l:return ft(e,e.render,"ForwardRef");case _:var d=e.displayName||null;return d!==null?d:Y(e.type)||"Memo";case C:{var E=e,p=E._payload,y=E._init;try{return Y(y(p))}catch{return null}}}return null}var z=Object.assign,J=0,me,he,Ee,Re,pe,we,Ce;function _e(){}_e.__reactDisabledLog=!0;function dt(){{if(J===0){me=console.log,he=console.info,Ee=console.warn,Re=console.error,pe=console.group,we=console.groupCollapsed,Ce=console.groupEnd;var e={configurable:!0,enumerable:!0,value:_e,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}J++}}function vt(){{if(J--,J===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:me}),info:z({},e,{value:he}),warn:z({},e,{value:Ee}),error:z({},e,{value:Re}),group:z({},e,{value:pe}),groupCollapsed:z({},e,{value:we}),groupEnd:z({},e,{value:Ce})})}J<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=k.ReactCurrentDispatcher,re;function H(e,r,o){{if(re===void 0)try{throw Error()}catch(E){var d=E.stack.trim().match(/\n( *(at )?)/);re=d&&d[1]||""}return`
9
+ */var se;function We(){return se||(se=1,process.env.NODE_ENV!=="production"&&function(){var t=h,n=Symbol.for("react.element"),i=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),v=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),c=Symbol.for("react.offscreen"),S=Symbol.iterator,I="@@iterator";function x(e){if(e===null||typeof e!="object")return null;var r=S&&e[S]||e[I];return typeof r=="function"?r:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(e){{for(var r=arguments.length,o=new Array(r>1?r-1:0),d=1;d<r;d++)o[d-1]=arguments[d];W("error",e,o)}}function W(e,r,o){{var d=k.ReactDebugCurrentFrame,E=d.getStackAddendum();E!==""&&(r+="%s",o=o.concat([E]));var p=o.map(function(y){return String(y)});p.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,p)}}var L=!1,M=!1,j=!1,ve=!1,ge=!1,Q;Q=Symbol.for("react.module.reference");function lt(e){return!!(typeof e=="string"||typeof e=="function"||e===u||e===f||ge||e===a||e===m||e===R||ve||e===c||L||M||j||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===_||e.$$typeof===v||e.$$typeof===s||e.$$typeof===l||e.$$typeof===Q||e.getModuleId!==void 0))}function ft(e,r,o){var d=e.displayName;if(d)return d;var E=r.displayName||r.name||"";return E!==""?o+"("+E+")":o}function ye(e){return e.displayName||"Context"}function Y(e){if(e==null)return null;if(typeof e.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case u:return"Fragment";case i:return"Portal";case f:return"Profiler";case a:return"StrictMode";case m:return"Suspense";case R:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case s:var r=e;return ye(r)+".Consumer";case v:var o=e;return ye(o._context)+".Provider";case l:return ft(e,e.render,"ForwardRef");case _:var d=e.displayName||null;return d!==null?d:Y(e.type)||"Memo";case C:{var E=e,p=E._payload,y=E._init;try{return Y(y(p))}catch{return null}}}return null}var z=Object.assign,J=0,me,he,Ee,Re,pe,we,Ce;function _e(){}_e.__reactDisabledLog=!0;function dt(){{if(J===0){me=console.log,he=console.info,Ee=console.warn,Re=console.error,pe=console.group,we=console.groupCollapsed,Ce=console.groupEnd;var e={configurable:!0,enumerable:!0,value:_e,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}J++}}function vt(){{if(J--,J===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:me}),info:z({},e,{value:he}),warn:z({},e,{value:Ee}),error:z({},e,{value:Re}),group:z({},e,{value:pe}),groupCollapsed:z({},e,{value:we}),groupEnd:z({},e,{value:Ce})})}J<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=k.ReactCurrentDispatcher,re;function H(e,r,o){{if(re===void 0)try{throw Error()}catch(E){var d=E.stack.trim().match(/\n( *(at )?)/);re=d&&d[1]||""}return`
10
10
  `+re+e}}var ne=!1,K;{var gt=typeof WeakMap=="function"?WeakMap:Map;K=new gt}function be(e,r){if(!e||ne)return"";{var o=K.get(e);if(o!==void 0)return o}var d;ne=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var p;p=te.current,te.current=null,dt();try{if(r){var y=function(){throw Error()};if(Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(N){d=N}Reflect.construct(e,[],y)}else{try{y.call()}catch(N){d=N}e.call(y.prototype)}}else{try{throw Error()}catch(N){d=N}e()}}catch(N){if(N&&d&&typeof N.stack=="string"){for(var g=N.stack.split(`
11
11
  `),O=d.stack.split(`
12
12
  `),P=g.length-1,T=O.length-1;P>=1&&T>=0&&g[P]!==O[T];)T--;for(;P>=1&&T>=0;P--,T--)if(g[P]!==O[T]){if(P!==1||T!==1)do if(P--,T--,T<0||g[P]!==O[T]){var D=`
@@ -16,7 +16,7 @@ Check the render method of \``+e+"`."}return""}}function xt(e){{if(e!==void 0){v
16
16
 
17
17
  Check your code at `+r+":"+o+"."}return""}}var De={};function Ot(e){{var r=Ie();if(!r){var o=typeof e=="string"?e:e.displayName||e.name;o&&(r=`
18
18
 
19
- Check the top-level render call using <`+o+">.")}return r}}function ke(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var o=Ot(r);if(De[o])return;De[o]=!0;var d="";e&&e._owner&&e._owner!==ae.current&&(d=" It was passed a child from "+Y(e._owner.type)+"."),V(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',o,d),V(null)}}function Fe(e,r){{if(typeof e!="object")return;if(oe(e))for(var o=0;o<e.length;o++){var d=e[o];ue(d)&&ke(d,r)}else if(ue(e))e._store&&(e._store.validated=!0);else if(e){var E=x(e);if(typeof E=="function"&&E!==e.entries)for(var p=E.call(e),y;!(y=p.next()).done;)ue(y.value)&&ke(y.value,r)}}}function At(e){{var r=e.type;if(r==null||typeof r=="string")return;var o;if(typeof r=="function")o=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===l||r.$$typeof===_))o=r.propTypes;else return;if(o){var d=Y(r);ht(o,e.props,"prop",d,e)}else if(r.PropTypes!==void 0&&!ce){ce=!0;var E=Y(r);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function It(e){{for(var r=Object.keys(e.props),o=0;o<r.length;o++){var d=r[o];if(d!=="children"&&d!=="key"){V(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),V(null);break}}e.ref!==null&&(V(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}function Ye(e,r,o,d,E,p){{var y=lt(e);if(!y){var g="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(g+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=xt(E);O?g+=O:g+=Ie();var P;e===null?P="null":oe(e)?P="array":e!==void 0&&e.$$typeof===n?(P="<"+(Y(e.type)||"Unknown")+" />",g=" Did you accidentally export a JSX literal instead of a component?"):P=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,g)}var T=St(e,r,o,E,p);if(T==null)return T;if(y){var D=r.children;if(D!==void 0)if(d)if(oe(D)){for(var U=0;U<D.length;U++)Fe(D[U],e);Object.freeze&&Object.freeze(D)}else b("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 Fe(D,e)}return e===c?It(T):At(T),T}}function Dt(e,r,o){return Ye(e,r,o,!0)}function kt(e,r,o){return Ye(e,r,o,!1)}var Ft=kt,Yt=Dt;B.Fragment=c,B.jsx=Ft,B.jsxs=Yt}()),B}var G={};/**
19
+ Check the top-level render call using <`+o+">.")}return r}}function ke(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var o=Ot(r);if(De[o])return;De[o]=!0;var d="";e&&e._owner&&e._owner!==ae.current&&(d=" It was passed a child from "+Y(e._owner.type)+"."),V(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',o,d),V(null)}}function Fe(e,r){{if(typeof e!="object")return;if(oe(e))for(var o=0;o<e.length;o++){var d=e[o];ue(d)&&ke(d,r)}else if(ue(e))e._store&&(e._store.validated=!0);else if(e){var E=x(e);if(typeof E=="function"&&E!==e.entries)for(var p=E.call(e),y;!(y=p.next()).done;)ue(y.value)&&ke(y.value,r)}}}function At(e){{var r=e.type;if(r==null||typeof r=="string")return;var o;if(typeof r=="function")o=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===l||r.$$typeof===_))o=r.propTypes;else return;if(o){var d=Y(r);ht(o,e.props,"prop",d,e)}else if(r.PropTypes!==void 0&&!ce){ce=!0;var E=Y(r);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function It(e){{for(var r=Object.keys(e.props),o=0;o<r.length;o++){var d=r[o];if(d!=="children"&&d!=="key"){V(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),V(null);break}}e.ref!==null&&(V(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}function Ye(e,r,o,d,E,p){{var y=lt(e);if(!y){var g="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(g+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=xt(E);O?g+=O:g+=Ie();var P;e===null?P="null":oe(e)?P="array":e!==void 0&&e.$$typeof===n?(P="<"+(Y(e.type)||"Unknown")+" />",g=" Did you accidentally export a JSX literal instead of a component?"):P=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,g)}var T=St(e,r,o,E,p);if(T==null)return T;if(y){var D=r.children;if(D!==void 0)if(d)if(oe(D)){for(var U=0;U<D.length;U++)Fe(D[U],e);Object.freeze&&Object.freeze(D)}else b("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 Fe(D,e)}return e===u?It(T):At(T),T}}function Dt(e,r,o){return Ye(e,r,o,!0)}function kt(e,r,o){return Ye(e,r,o,!1)}var Ft=kt,Yt=Dt;B.Fragment=u,B.jsx=Ft,B.jsxs=Yt}()),B}var G={};/**
20
20
  * @license React
21
21
  * react-jsx-runtime.production.min.js
22
22
  *
@@ -24,4 +24,4 @@ Check the top-level render call using <`+o+">.")}return r}}function ke(e,r){{if(
24
24
  *
25
25
  * This source code is licensed under the MIT license found in the
26
26
  * LICENSE file in the root directory of this source tree.
27
- */var le;function Le(){if(le)return G;le=1;var t=h,n=Symbol.for("react.element"),i=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,u=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function v(s,l,m){var R,_={},C=null,a=null;m!==void 0&&(C=""+m),l.key!==void 0&&(C=""+l.key),l.ref!==void 0&&(a=l.ref);for(R in l)c.call(l,R)&&!f.hasOwnProperty(R)&&(_[R]=l[R]);if(s&&s.defaultProps)for(R in l=s.defaultProps,l)_[R]===void 0&&(_[R]=l[R]);return{$$typeof:n,type:s,key:C,ref:a,props:_,_owner:u.current}}return G.Fragment=i,G.jsx=v,G.jsxs=v,G}process.env.NODE_ENV==="production"?ee.exports=Le():ee.exports=We();var F=ee.exports;const A=h.createContext({}),Me=({children:t,apiURL:n,libraries:i})=>{const c=h.useMemo(()=>({apiURL:n,libraries:i}),[n,i]);return F.jsx(A.Provider,{value:c,children:t})},ze=({Fallback:t,isLogged:n,loginPath:i="/login",localStorageKey:c="user",redirect401Path:u="/login",...f})=>{var b,W,L,M;const{libraries:v}=h.useContext(A),s=(f==null?void 0:f.axios)||(v==null?void 0:v.axios),l=(f==null?void 0:f.reactRouter)||(v==null?void 0:v.reactRouter);if(!l)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!s)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[m,R]=h.useState(null),{useLocation:_,Navigate:C,Outlet:a}=l,S=_(),I=h.useRef(!1),x=typeof n=="function"?n():!!n,k=typeof x=="boolean"?x:x==null?void 0:x.isLogged;return h.useEffect(()=>{I.current||(I.current=!0,s==null||s.interceptors.response.use(j=>j,async j=>{var Q;return typeof j=="object"&&j&&"response"in j&&j.response&&typeof j.response=="object"&&"status"in j.response&&j.response&&typeof j.response=="object"&&"status"in j.response&&((Q=j==null?void 0:j.response)==null?void 0:Q.status)===401&&(s.defaults.headers.common.Authorization=null,localStorage.removeItem(c),R(u)),Promise.reject(j)}))},[s==null?void 0:s.defaults.headers.common,s==null?void 0:s.interceptors.response,c,u]),k&&!m?F.jsx(h.Suspense,{fallback:t,children:(W=(b=S.state)==null?void 0:b.from)!=null&&W.state&&((M=(L=S.state)==null?void 0:L.from)==null?void 0:M.pathname)===i?F.jsx(C,{to:S.state.from.state.from.pathname+S.state.from.state.from.search,replace:!0}):F.jsx(a,{})}):F.jsx(C,{to:i,state:{from:S},replace:!0})},Ve=({...t})=>{const{libraries:n}=h.useContext(A),i=(t==null?void 0:t.reactRouter)||(n==null?void 0:n.reactRouter),c=(t==null?void 0:t.gtm)||(n==null?void 0:n.gtm);if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!c)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:u}=c,{useLocation:f,Outlet:v}=i,{pathname:s}=f(),{sendEvent:l}=u();return h.useEffect(()=>{l({event:"pageView",pathname:s})},[s,l]),F.jsx(v,{})},Ue=({tokenTypeKey:t="tokenType",userLocalStorageKey:n="user",tokenKey:i="accessToken",postContentType:c="application/json",...u})=>{const{apiURL:f=u.apiURL,libraries:v}=h.useContext(A),s=(u==null?void 0:u.axios)||(v==null?void 0:v.axios);if(!s)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(s!=null&&s.defaults))return null;const l=localStorage.getItem(n),m=l?JSON.parse(l):null,R=m!=null&&m[t]?m[t]:null,_=m!=null&&m[i]?m[i]:null,C=l?`${R} ${_}`:null;return s.defaults.baseURL=f,s.defaults.headers.post["Content-Type"]=c,C&&(s.defaults.headers.common.Authorization=C),null},Be=({debug:t,resources:n,...i})=>{const{libraries:c}=h.useContext(A),u=(i==null?void 0:i.i18)||(c==null?void 0:c.i18),{i18next:f,initReactI18next:v,languageDetector:s}=u||{};if(!u)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return f!=null&&f.isInitialized||(f.use(s).use(v).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==f.resolvedLanguage&&f.resolvedLanguage&&document.documentElement.setAttribute("lang",f.resolvedLanguage)}),f.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},Ge=({dsn:t,integrations:n,tracesSampleRate:i,replaysSessionSampleRate:c,replaysOnErrorSampleRate:u,tracePropagationTargets:f,ignoreErrors:v,debug:s,environment:l,...m})=>{const{libraries:R}=h.useContext(A),_=(m==null?void 0:m.sentry)||(R==null?void 0:R.sentry),C=(m==null?void 0:m.reactRouter)||(R==null?void 0:R.reactRouter);if(!_)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!C)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(_.isInitialized())return null;const{createRoutesFromChildren:a,matchRoutes:S,useLocation:I,useNavigationType:x}=C;return(s||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&_.init({debug:s,dsn:t,environment:l||"production",ignoreErrors:[...v||[],/dynamically imported module/],integrations:[_.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:a,matchRoutes:S,useEffect:h.useEffect,useLocation:I,useNavigationType:x}),...n||[]],replaysOnErrorSampleRate:u||1,replaysSessionSampleRate:c||.1,tracePropagationTargets:f,tracesSampleRate:i||1}),null},Qe=({IMaskMixin:t,...n})=>{const i=h.useMemo(()=>t(({TextField:c,...u})=>F.jsx(c,{...u})),[t]);return F.jsx(i,{...n})},Je=({accessToken:t,...n})=>{const{libraries:i}=h.useContext(A),c=(n==null?void 0:n.mapbox)||(i==null?void 0:i.mapbox);if(!c)throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return t&&(c.accessToken=t),null},Xe=({language:t,...n})=>{const{libraries:i}=h.useContext(A),c=(n==null?void 0:n.dayjs)||(i==null?void 0:i.dayjs),u=(n==null?void 0:n.plugin)||(i==null?void 0:i.dayjsPlugin);if(!c)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return h.useEffect(()=>{(async()=>{var s;const v=t||((s=navigator.language)==null?void 0:s.slice(0,2))||"en";if(u&&u.forEach(l=>{l&&c.extend(l)}),v==="fr"){const l=await import("dayjs/locale/fr");c.locale(l.default)}})().then()},[c,u,t]),null},He=t=>t&&typeof t=="function",Ke=t=>t&&typeof t=="function",Ze=({children:t,defaultQueriesOptions:n,defaultMutationsOptions:i,...c})=>{var l,m;const{libraries:u}=h.useContext(A),f=(c==null?void 0:c.QueryClient)||((l=u==null?void 0:u.reactQuery)==null?void 0:l.QueryClient),v=(c==null?void 0:c.QueryClientProvider)||((m=u==null?void 0:u.reactQuery)==null?void 0:m.QueryClientProvider);if(!f)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!v)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!He(v))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Ke(f))throw new Error("Provided QueryClient dependencies are not valid.");const s=new f({defaultOptions:{mutations:{...i},queries:{getNextPageParam:(R,_,C)=>R.length+(C||0),refetchOnWindowFocus:!1,retry:3,...n}}});return F.jsx(v,{client:s,children:t})},$e=t=>{var m,R,_;const{libraries:n}=h.useContext(A),i=(t==null?void 0:t.i18)||(n==null?void 0:n.i18),c=((m=t==null?void 0:t.i18)==null?void 0:m.translateFunction)||((R=n==null?void 0:n.i18)==null?void 0:R.translateFunction),u=((_=i==null?void 0:i.i18next)==null?void 0:_.t)||c||(C=>C),{unknownErrorTranslationKey:f="error.unknownError"}=t||{},v=u(f),s=h.useCallback(C=>{var S,I,x,k,b,W,L,M,j;const{response:a}=C||{};return a!=null&&a.reason?String(a.reason):(S=a==null?void 0:a.data)!=null&&S.reason?String(a.data.reason):(I=a==null?void 0:a.data)!=null&&I.message?String(a.data.message):(k=(x=a==null?void 0:a.data)==null?void 0:x.detail)!=null&&k.length&&Array.isArray((b=a==null?void 0:a.data)==null?void 0:b.detail)&&((L=(W=a==null?void 0:a.data)==null?void 0:W.detail[0])!=null&&L.msg)&&typeof((j=(M=a==null?void 0:a.data)==null?void 0:M.detail[0])==null?void 0:j.msg)=="string"?String(a.data.detail[0].msg):v},[v]);return{getErrorCode:h.useCallback(C=>{var S,I,x;const{response:a}=C||{};return a!=null&&a.error_code?String(a==null?void 0:a.error_code):(S=a==null?void 0:a.data)!=null&&S.error_code?String((I=a==null?void 0:a.data)==null?void 0:I.error_code):a!=null&&a.error_code?String(a==null?void 0:a.error_code):(x=a==null?void 0:a.data)!=null&&x.error_code?String(a.data.error_code):"unknown_error_code"},[]),printError:s}},qe=({data:t,fetchNextPage:n,isFetchingNextPage:i,isInitialLoading:c,isLoading:u,enabled:f=!0})=>{const v=h.useCallback(async l=>{i||!f||await n({pageParam:(l==null?void 0:l.pageParam)||l.visibleRowsCount})},[f,n,i]),s=h.useMemo(()=>{if(t)return t.pages.reduce((l,m)=>[...l,...m],[])},[t]);return{fetchNextPageOnRowsScrollEnd:v,isLoading:i||u,loadingVariant:c?"skeleton":"linear",rows:s}},et=t=>{const{libraries:n}=h.useContext(A),i=(t==null?void 0:t.axios)||(n==null?void 0:n.axios);if(!i)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");return{clearAuthenticationToken:()=>{i.defaults.headers.common.Authorization=null},setAuthenticationToken:({tokenType:f,accessToken:v})=>{i.defaults.headers.common.Authorization=`${f} ${v}`}}},fe=({library:t,date:n,format:i="ll"})=>t(n).format(i),de=(t,n="km")=>{const i=Number(t);return Number.isNaN(i)?`0 ${n}`:`${i.toFixed(2)} ${n}`},tt=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,rt=({path:t,size:n,apiURL:i})=>{if(!t)return"";const c=tt(t),u=`${i}${c}`,f=u.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof n=="number"&&f?`${u.replace("/files",`/thumbs/${n}`)}`:u},nt=t=>{const{apiURL:n,libraries:i}=h.useContext(A),c=(t==null?void 0:t.dayjs)||(i==null?void 0:i.dayjs);return{dateAdapter:(v,s)=>{if(!c)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return fe({date:v,format:s,library:c})},distanceAdapter:de,filePathAdapter:(v,s)=>{if(!n)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return rt({apiURL:n,path:v,size:s})}}},ot=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),it=t=>{const c=t.split("/").filter(u=>u.length>0).map(u=>u.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return c.charAt(0).toLowerCase()+c.slice(1)},at=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),ct=(t,n,i)=>{const c=it(n),u=ot(i);return`${c}${u}`},ut=t=>{if(t)return(t==null?void 0:t.reduce((n,i)=>(n[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},n),{}))||{}},st=t=>(Array.isArray(t)?t:[t]).reduce((i,c)=>{const{output:u,operationsToGenerateInfiniteQueryHook:f,input:v="./openapi.json"}=c||{},s=at(v);return{...i,[s]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:v,output:{client:"react-query",mode:"tags-split",override:{...(f==null?void 0:f.length)&&{operations:ut(f)},header:l=>["Generated by orval 🍺",...l.title?[l.title]:[],...l.description?[l.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/config/orval/mutator/axiosCustomInstance.ts`},operationName:ct,query:{useQuery:!0}},schemas:(u==null?void 0:u.schemas)||`src/api/${s}/model`,target:(u==null?void 0:u.target)||`src/api/${s}/services/api.ts`,...u}}}},{});w.GTMSendPageView=Ve,w.InitializeAxiosConfig=Ue,w.InitializeDaysJSConfig=Xe,w.InitializeI18nConfig=Be,w.InitializeMapBoxConfig=Je,w.InitializeSentryConfig=Ge,w.InjectDependenciesContext=A,w.InjectDependenciesProvider=Me,w.MaskTextField=Qe,w.QueryClientProviderWithConfig=Ze,w.RequireAuth=ze,w.dateAdapter=fe,w.distanceAdapter=de,w.getOrvalConfig=st,w.useAdapter=nt,w.useAuth=et,w.useInfiniteDataGrid=qe,w.useResponseError=$e,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
27
+ */var le;function Le(){if(le)return G;le=1;var t=h,n=Symbol.for("react.element"),i=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function v(s,l,m){var R,_={},C=null,c=null;m!==void 0&&(C=""+m),l.key!==void 0&&(C=""+l.key),l.ref!==void 0&&(c=l.ref);for(R in l)u.call(l,R)&&!f.hasOwnProperty(R)&&(_[R]=l[R]);if(s&&s.defaultProps)for(R in l=s.defaultProps,l)_[R]===void 0&&(_[R]=l[R]);return{$$typeof:n,type:s,key:C,ref:c,props:_,_owner:a.current}}return G.Fragment=i,G.jsx=v,G.jsxs=v,G}process.env.NODE_ENV==="production"?ee.exports=Le():ee.exports=We();var F=ee.exports;const A=h.createContext({}),Me=({children:t,apiURL:n,libraries:i})=>{const u=h.useMemo(()=>({apiURL:n,libraries:i}),[n,i]);return F.jsx(A.Provider,{value:u,children:t})},ze=({Fallback:t,isLogged:n,loginPath:i="/login",localStorageKey:u="user",redirect401Path:a="/login",...f})=>{var b,W,L,M;const{libraries:v}=h.useContext(A),s=(f==null?void 0:f.axios)||(v==null?void 0:v.axios),l=(f==null?void 0:f.reactRouter)||(v==null?void 0:v.reactRouter);if(!l)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!s)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[m,R]=h.useState(null),{useLocation:_,Navigate:C,Outlet:c}=l,S=_(),I=h.useRef(!1),x=typeof n=="function"?n():!!n,k=typeof x=="boolean"?x:x==null?void 0:x.isLogged;return h.useEffect(()=>{I.current||(I.current=!0,s==null||s.interceptors.response.use(j=>j,async j=>{var Q;return typeof j=="object"&&j&&"response"in j&&j.response&&typeof j.response=="object"&&"status"in j.response&&j.response&&typeof j.response=="object"&&"status"in j.response&&((Q=j==null?void 0:j.response)==null?void 0:Q.status)===401&&(s.defaults.headers.common.Authorization=null,localStorage.removeItem(u),R(a)),Promise.reject(j)}))},[s==null?void 0:s.defaults.headers.common,s==null?void 0:s.interceptors.response,u,a]),k&&!m?F.jsx(h.Suspense,{fallback:t,children:(W=(b=S.state)==null?void 0:b.from)!=null&&W.state&&((M=(L=S.state)==null?void 0:L.from)==null?void 0:M.pathname)===i?F.jsx(C,{to:S.state.from.state.from.pathname+S.state.from.state.from.search,replace:!0}):F.jsx(c,{})}):F.jsx(C,{to:i,state:{from:S},replace:!0})},Ve=({...t})=>{const{libraries:n}=h.useContext(A),i=(t==null?void 0:t.reactRouter)||(n==null?void 0:n.reactRouter),u=(t==null?void 0:t.gtm)||(n==null?void 0:n.gtm);if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!u)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:a}=u,{useLocation:f,Outlet:v}=i,{pathname:s}=f(),{sendEvent:l}=a();return h.useEffect(()=>{l({event:"pageView",pathname:s})},[s,l]),F.jsx(v,{})},Ue=({tokenTypeKey:t="tokenType",userLocalStorageKey:n="user",tokenKey:i="accessToken",postContentType:u="application/json",...a})=>{const{apiURL:f=a.apiURL,libraries:v}=h.useContext(A),s=(a==null?void 0:a.axios)||(v==null?void 0:v.axios);if(!s)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(s!=null&&s.defaults))return null;const l=localStorage.getItem(n),m=l?JSON.parse(l):null,R=m!=null&&m[t]?m[t]:null,_=m!=null&&m[i]?m[i]:null,C=l?`${R} ${_}`:null;return s.defaults.baseURL=f,s.defaults.headers.post["Content-Type"]=u,C&&(s.defaults.headers.common.Authorization=C),null},Be=({debug:t,resources:n,...i})=>{const{libraries:u}=h.useContext(A),a=(i==null?void 0:i.i18)||(u==null?void 0:u.i18),{i18next:f,initReactI18next:v,languageDetector:s}=a||{};if(!a)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return f!=null&&f.isInitialized||(f.use(s).use(v).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==f.resolvedLanguage&&f.resolvedLanguage&&document.documentElement.setAttribute("lang",f.resolvedLanguage)}),f.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},Ge=({dsn:t,integrations:n,tracesSampleRate:i,replaysSessionSampleRate:u,replaysOnErrorSampleRate:a,tracePropagationTargets:f,ignoreErrors:v,debug:s,environment:l,...m})=>{const{libraries:R}=h.useContext(A),_=(m==null?void 0:m.sentry)||(R==null?void 0:R.sentry),C=(m==null?void 0:m.reactRouter)||(R==null?void 0:R.reactRouter);if(!_)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!C)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(_.isInitialized())return null;const{createRoutesFromChildren:c,matchRoutes:S,useLocation:I,useNavigationType:x}=C;return(s||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&_.init({debug:s,dsn:t,environment:l||"production",ignoreErrors:[...v||[],/dynamically imported module/],integrations:[_.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:c,matchRoutes:S,useEffect:h.useEffect,useLocation:I,useNavigationType:x}),...n||[]],replaysOnErrorSampleRate:a||1,replaysSessionSampleRate:u||.1,tracePropagationTargets:f,tracesSampleRate:i||1}),null},Qe=({IMaskMixin:t,...n})=>{const i=h.useMemo(()=>t(({TextField:u,...a})=>F.jsx(u,{...a})),[t]);return F.jsx(i,{...n})},Je=({accessToken:t,...n})=>{const{libraries:i}=h.useContext(A),u=(n==null?void 0:n.mapbox)||(i==null?void 0:i.mapbox);if(!u)throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return t&&(u.accessToken=t),null},Xe=({language:t,...n})=>{const{libraries:i}=h.useContext(A),u=(n==null?void 0:n.dayjs)||(i==null?void 0:i.dayjs),a=(n==null?void 0:n.plugin)||(i==null?void 0:i.dayjsPlugin);if(!u)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return h.useEffect(()=>{(async()=>{var s;const v=t||((s=navigator.language)==null?void 0:s.slice(0,2))||"en";if(a&&a.forEach(l=>{l&&u.extend(l)}),v==="fr"){const l=await import("dayjs/locale/fr");u.locale(l.default)}})().then()},[u,a,t]),null},He=t=>t&&typeof t=="function",Ke=t=>t&&typeof t=="function",Ze=({children:t,defaultQueriesOptions:n,defaultMutationsOptions:i,...u})=>{var l,m;const{libraries:a}=h.useContext(A),f=(u==null?void 0:u.QueryClient)||((l=a==null?void 0:a.reactQuery)==null?void 0:l.QueryClient),v=(u==null?void 0:u.QueryClientProvider)||((m=a==null?void 0:a.reactQuery)==null?void 0:m.QueryClientProvider);if(!f)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!v)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!He(v))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Ke(f))throw new Error("Provided QueryClient dependencies are not valid.");const s=new f({defaultOptions:{mutations:{...i},queries:{getNextPageParam:(R,_,C)=>R.length+(C||0),refetchOnWindowFocus:!1,retry:3,...n}}});return F.jsx(v,{client:s,children:t})},$e=t=>{var m,R,_;const{libraries:n}=h.useContext(A),i=(t==null?void 0:t.i18)||(n==null?void 0:n.i18),u=((m=t==null?void 0:t.i18)==null?void 0:m.translateFunction)||((R=n==null?void 0:n.i18)==null?void 0:R.translateFunction),a=((_=i==null?void 0:i.i18next)==null?void 0:_.t)||u||(C=>C),{unknownErrorTranslationKey:f="error.unknownError"}=t||{},v=a(f),s=h.useCallback(C=>{var S,I,x,k,b,W,L,M,j;const{response:c}=C||{};return c!=null&&c.reason?String(c.reason):(S=c==null?void 0:c.data)!=null&&S.reason?String(c.data.reason):(I=c==null?void 0:c.data)!=null&&I.message?String(c.data.message):(k=(x=c==null?void 0:c.data)==null?void 0:x.detail)!=null&&k.length&&Array.isArray((b=c==null?void 0:c.data)==null?void 0:b.detail)&&((L=(W=c==null?void 0:c.data)==null?void 0:W.detail[0])!=null&&L.msg)&&typeof((j=(M=c==null?void 0:c.data)==null?void 0:M.detail[0])==null?void 0:j.msg)=="string"?String(c.data.detail[0].msg):v},[v]);return{getErrorCode:h.useCallback(C=>{var S,I,x;const{response:c}=C||{};return c!=null&&c.error_code?String(c==null?void 0:c.error_code):(S=c==null?void 0:c.data)!=null&&S.error_code?String((I=c==null?void 0:c.data)==null?void 0:I.error_code):c!=null&&c.error_code?String(c==null?void 0:c.error_code):(x=c==null?void 0:c.data)!=null&&x.error_code?String(c.data.error_code):"unknown_error_code"},[]),printError:s}},qe=({data:t,fetchNextPage:n,isFetchingNextPage:i,isInitialLoading:u,isLoading:a,enabled:f=!0})=>{const v=h.useCallback(async l=>{i||!f||await n({pageParam:(l==null?void 0:l.pageParam)||l.visibleRowsCount})},[f,n,i]),s=h.useMemo(()=>{if(t)return t.pages.reduce((l,m)=>[...l,...m],[])},[t]);return{fetchNextPageOnRowsScrollEnd:v,isLoading:i||a,loadingVariant:u?"skeleton":"linear",rows:s}},et=t=>{const{libraries:n}=h.useContext(A),i=(t==null?void 0:t.axios)||(n==null?void 0:n.axios);if(!i)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");return{clearAuthenticationToken:()=>{i.defaults.headers.common.Authorization=null},setAuthenticationToken:({tokenType:f,accessToken:v})=>{i.defaults.headers.common.Authorization=`${f} ${v}`}}},fe=({library:t,date:n,format:i="ll"})=>t(n).format(i),de=(t,n="km")=>{const i=Number(t);return Number.isNaN(i)?`0 ${n}`:`${i.toFixed(2)} ${n}`},tt=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,rt=({path:t,size:n,apiURL:i})=>{if(!t)return"";const u=tt(t),a=`${i}${u}`,f=a.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof n=="number"&&f?`${a.replace("/files",`/thumbs/${n}`)}`:a},nt=t=>{const{apiURL:n,libraries:i}=h.useContext(A),u=(t==null?void 0:t.dayjs)||(i==null?void 0:i.dayjs);return{dateAdapter:(v,s)=>{if(!u)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return fe({date:v,format:s,library:u})},distanceAdapter:de,filePathAdapter:(v,s)=>{if(!n)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return rt({apiURL:n,path:v,size:s})}}},ot=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),it=t=>{const u=t.split("/").filter(a=>a.length>0).map(a=>a.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return u.charAt(0).toLowerCase()+u.slice(1)},at=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),ct=(t,n,i)=>{const u=it(n),a=ot(i);return`${u}${a}`},ut=t=>{if(t)return(t==null?void 0:t.reduce((n,i)=>(n[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},n),{}))||{}},st=t=>(Array.isArray(t)?t:[t]).reduce((i,u)=>{const{output:a,operationsToGenerateInfiniteQueryHook:f,input:v="./openapi.json"}=u||{},s=at(v);return{...i,[s]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:v,output:{baseUrl:a==null?void 0:a.baseUrl,client:"react-query",mode:"tags-split",override:{...(f==null?void 0:f.length)&&{operations:ut(f)},header:l=>["Generated by orval 🍺",...l.title?[l.title]:[],...l.description?[l.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/config/orval/mutator/axiosCustomInstance.ts`},operationName:ct,query:{useQuery:!0}},schemas:(a==null?void 0:a.schemas)||`src/api/${s}/model`,target:(a==null?void 0:a.target)||`src/api/${s}/services/api.ts`,...a}}}},{});w.GTMSendPageView=Ve,w.InitializeAxiosConfig=Ue,w.InitializeDaysJSConfig=Xe,w.InitializeI18nConfig=Be,w.InitializeMapBoxConfig=Je,w.InitializeSentryConfig=Ge,w.InjectDependenciesContext=A,w.InjectDependenciesProvider=Me,w.MaskTextField=Qe,w.QueryClientProviderWithConfig=Ze,w.RequireAuth=ze,w.dateAdapter=fe,w.distanceAdapter=de,w.getOrvalConfig=st,w.useAdapter=nt,w.useAuth=et,w.useInfiniteDataGrid=qe,w.useResponseError=$e,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tracktor/shared-module",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "types": "./dist/main.d.ts",