@tracktor/shared-module 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,4 @@
1
1
  # [Versions](https://github.com/Tracktor/shared-module/releases)
2
2
 
3
- ## v0.21.0
4
- - **[feat]** : add `getErrorCode` function from `useResponseError` hook
5
- - **[feat]** : remove `printErrorCode` function from `useResponseError` hook
3
+ ## v0.22.0
4
+ - **[feat]** : adding `environment` param to `SentryConfig` to allow to set the environment for sentry
@@ -43,6 +43,10 @@ interface SentryConfigProps<T> {
43
43
  * By default, all errors will be sent.
44
44
  */
45
45
  ignoreErrors?: Array<string | RegExp>;
46
+ /**
47
+ * The current environment of your application (e.g. "production").
48
+ */
49
+ environment?: string;
46
50
  }) => void;
47
51
  BrowserTracing: any;
48
52
  /**
@@ -110,6 +114,10 @@ interface SentryConfigProps<T> {
110
114
  * By default, all errors will be sent.
111
115
  */
112
116
  ignoreErrors?: Array<string | RegExp>;
117
+ /**
118
+ * The current environment of your application (e.g. "production").
119
+ */
120
+ environment?: string;
113
121
  }
114
122
  /**
115
123
  * This component is used to initialize Sentry
@@ -123,7 +131,8 @@ interface SentryConfigProps<T> {
123
131
  * @param tracePropagationTargets
124
132
  * @param ignoreErrors
125
133
  * @param debug
134
+ * @param environment
126
135
  * @constructor
127
136
  */
128
- declare const SentryConfig: <T extends unknown>({ dsn, sentry, integrations, tracesSampleRate, routingInstrumentationDependencies, replaysSessionSampleRate, replaysOnErrorSampleRate, tracePropagationTargets, ignoreErrors, debug, }: SentryConfigProps<T>) => null;
137
+ declare const SentryConfig: <T extends unknown>({ dsn, sentry, integrations, tracesSampleRate, routingInstrumentationDependencies, replaysSessionSampleRate, replaysOnErrorSampleRate, tracePropagationTargets, ignoreErrors, debug, environment, }: SentryConfigProps<T>) => null;
129
138
  export default SentryConfig;
package/dist/main.js CHANGED
@@ -12,7 +12,7 @@ var ue = { exports: {} }, M = {};
12
12
  var De;
13
13
  function Rr() {
14
14
  return De || (De = 1, process.env.NODE_ENV !== "production" && function() {
15
- var t = Ne, o = Symbol.for("react.element"), i = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), n = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), C = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), T = Symbol.for("react.offscreen"), k = Symbol.iterator, $ = "@@iterator";
15
+ var t = Ne, o = Symbol.for("react.element"), i = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), E = Symbol.for("react.provider"), n = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), h = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), C = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), T = Symbol.for("react.offscreen"), k = Symbol.iterator, $ = "@@iterator";
16
16
  function F(e) {
17
17
  if (e === null || typeof e != "object")
18
18
  return null;
@@ -40,7 +40,7 @@ function Rr() {
40
40
  var ce = !1, le = !1, U = !1, We = !1, Me = !1, fe;
41
41
  fe = Symbol.for("react.module.reference");
42
42
  function Ve(e) {
43
- return !!(typeof e == "string" || typeof e == "function" || e === s || e === v || Me || e === c || e === m || e === E || We || e === T || ce || le || U || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === C || e.$$typeof === h || e.$$typeof === n || e.$$typeof === l || // This needs to include all possible module reference object
43
+ return !!(typeof e == "string" || typeof e == "function" || e === s || e === v || Me || e === c || e === h || e === m || We || e === T || ce || le || U || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === C || e.$$typeof === E || e.$$typeof === n || 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.
@@ -72,9 +72,9 @@ function Rr() {
72
72
  return "Profiler";
73
73
  case c:
74
74
  return "StrictMode";
75
- case m:
75
+ case h:
76
76
  return "Suspense";
77
- case E:
77
+ case m:
78
78
  return "SuspenseList";
79
79
  }
80
80
  if (typeof e == "object")
@@ -82,7 +82,7 @@ function Rr() {
82
82
  case n:
83
83
  var r = e;
84
84
  return de(r) + ".Consumer";
85
- case h:
85
+ case E:
86
86
  var a = e;
87
87
  return de(a._context) + ".Provider";
88
88
  case l:
@@ -268,9 +268,9 @@ function Rr() {
268
268
  if (typeof e == "string")
269
269
  return z(e);
270
270
  switch (e) {
271
- case m:
271
+ case h:
272
272
  return z("Suspense");
273
- case E:
273
+ case m:
274
274
  return z("SuspenseList");
275
275
  }
276
276
  if (typeof e == "object")
@@ -612,17 +612,17 @@ function br() {
612
612
  return V;
613
613
  Le = 1;
614
614
  var t = Ne, o = Symbol.for("react.element"), i = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, c = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, v = { key: !0, ref: !0, __self: !0, __source: !0 };
615
- function h(n, l, m) {
616
- var E, C = {}, O = null, T = null;
617
- m !== void 0 && (O = "" + m), l.key !== void 0 && (O = "" + l.key), l.ref !== void 0 && (T = l.ref);
618
- for (E in l)
619
- s.call(l, E) && !v.hasOwnProperty(E) && (C[E] = l[E]);
615
+ function E(n, l, h) {
616
+ var m, C = {}, O = null, T = null;
617
+ h !== void 0 && (O = "" + h), l.key !== void 0 && (O = "" + l.key), l.ref !== void 0 && (T = l.ref);
618
+ for (m in l)
619
+ s.call(l, m) && !v.hasOwnProperty(m) && (C[m] = l[m]);
620
620
  if (n && n.defaultProps)
621
- for (E in l = n.defaultProps, l)
622
- C[E] === void 0 && (C[E] = l[E]);
621
+ for (m in l = n.defaultProps, l)
622
+ C[m] === void 0 && (C[m] = l[m]);
623
623
  return { $$typeof: o, type: n, key: O, ref: T, props: C, _owner: c.current };
624
624
  }
625
- return V.Fragment = i, V.jsx = h, V.jsxs = h, V;
625
+ return V.Fragment = i, V.jsx = E, V.jsxs = E, V;
626
626
  }
627
627
  process.env.NODE_ENV === "production" ? ue.exports = br() : ue.exports = Rr();
628
628
  var x = ue.exports;
@@ -642,11 +642,11 @@ const q = pr({
642
642
  useAuth: s,
643
643
  Outlet: c,
644
644
  Navigate: v,
645
- useLocation: h,
645
+ useLocation: E,
646
646
  useGoogleTagManager: n,
647
647
  apiURL: l
648
648
  }) => {
649
- const m = se(
649
+ const h = se(
650
650
  () => ({
651
651
  apiURL: l,
652
652
  axios: t,
@@ -655,11 +655,11 @@ const q = pr({
655
655
  translate: i,
656
656
  useAuth: s,
657
657
  useGoogleTagManager: n,
658
- useLocation: h
658
+ useLocation: E
659
659
  }),
660
- [v, c, l, t, i, s, n, h]
660
+ [v, c, l, t, i, s, n, E]
661
661
  );
662
- return /* @__PURE__ */ x.jsx(q.Provider, { value: m, children: o });
662
+ return /* @__PURE__ */ x.jsx(q.Provider, { value: h, children: o });
663
663
  }, H = (t) => `RequireAuth require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`, Pr = ({
664
664
  Fallback: t,
665
665
  loginPath: o = "/login",
@@ -670,20 +670,20 @@ const q = pr({
670
670
  var $, F, j, b;
671
671
  const {
672
672
  axios: v = c.axios,
673
- useLocation: h = c.useLocation,
673
+ useLocation: E = c.useLocation,
674
674
  useAuth: n = c.useAuth,
675
675
  Outlet: l = c.Outlet,
676
- Navigate: m = c.Navigate
676
+ Navigate: h = c.Navigate
677
677
  } = K(q);
678
678
  if (n === void 0)
679
679
  throw new Error(H("useAuth"));
680
- if (h === void 0)
680
+ if (E === void 0)
681
681
  throw new Error(H("useLocation"));
682
682
  if (l === void 0)
683
683
  throw new Error(H("Outlet"));
684
- if (m === void 0)
684
+ if (h === void 0)
685
685
  throw new Error(H("Navigate"));
686
- const [E, C] = gr(null), { isLogged: O } = n(), T = h(), k = mr(!1);
686
+ const [m, C] = gr(null), { isLogged: O } = n(), T = E(), k = mr(!1);
687
687
  return hr(() => {
688
688
  k.current || (k.current = !0, v == null || v.interceptors.response.use(
689
689
  (_) => _,
@@ -692,7 +692,7 @@ const q = pr({
692
692
  return typeof _ == "object" && _ && "response" in _ && _.response && typeof _.response == "object" && "status" in _.response && _.response && typeof _.response == "object" && "status" in _.response && ((U = _ == null ? void 0 : _.response) == null ? void 0 : U.status) === 401 && (v.defaults.headers.common.Authorization = null, localStorage.removeItem(i), C(s)), Promise.reject(_);
693
693
  }
694
694
  ));
695
- }, [v == null ? void 0 : v.defaults.headers.common, v == null ? void 0 : v.interceptors.response, i, s]), O && !E ? /* @__PURE__ */ x.jsx(Er, { fallback: t, children: (F = ($ = T.state) == null ? void 0 : $.from) != null && F.state && ((b = (j = T.state) == null ? void 0 : j.from) == null ? void 0 : b.pathname) === o ? /* @__PURE__ */ x.jsx(m, { to: T.state.from.state.from.pathname + T.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ x.jsx(l, {}) }) : /* @__PURE__ */ x.jsx(m, { to: o, state: { from: T }, replace: !0 });
695
+ }, [v == null ? void 0 : v.defaults.headers.common, v == null ? void 0 : v.interceptors.response, i, s]), O && !m ? /* @__PURE__ */ x.jsx(Er, { fallback: t, children: (F = ($ = T.state) == null ? void 0 : $.from) != null && F.state && ((b = (j = T.state) == null ? void 0 : j.from) == null ? void 0 : b.pathname) === o ? /* @__PURE__ */ x.jsx(h, { to: T.state.from.state.from.pathname + T.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ x.jsx(l, {}) }) : /* @__PURE__ */ x.jsx(h, { to: o, state: { from: T }, replace: !0 });
696
696
  }, ie = (t) => `GTMSendPageView require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`, Ar = ({ ...t }) => {
697
697
  const {
698
698
  useLocation: o = t.useLocation,
@@ -719,8 +719,8 @@ const q = pr({
719
719
  }) => {
720
720
  if (!t.defaults)
721
721
  return null;
722
- const h = localStorage.getItem(s), n = h ? JSON.parse(h) : null, l = n != null && n[i] ? n[i] : null, m = n != null && n[c] ? n[c] : null, E = h ? `${l} ${m}` : null;
723
- return t.defaults.baseURL = o, t.defaults.headers.post["Content-Type"] = v, E && (t.defaults.headers.common.Authorization = E), null;
722
+ const E = localStorage.getItem(s), n = E ? JSON.parse(E) : null, l = n != null && n[i] ? n[i] : null, h = n != null && n[c] ? n[c] : null, m = E ? `${l} ${h}` : null;
723
+ return t.defaults.baseURL = o, t.defaults.headers.post["Content-Type"] = v, m && (t.defaults.headers.common.Authorization = m), null;
724
724
  }, kr = ({
725
725
  i18n: t,
726
726
  debug: o,
@@ -751,13 +751,15 @@ const q = pr({
751
751
  tracesSampleRate: s,
752
752
  routingInstrumentationDependencies: c,
753
753
  replaysSessionSampleRate: v,
754
- replaysOnErrorSampleRate: h,
754
+ replaysOnErrorSampleRate: E,
755
755
  tracePropagationTargets: n,
756
756
  ignoreErrors: l,
757
- debug: m
758
- }) => (o.isInitialized() || (m || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && o.init({
759
- debug: m,
757
+ debug: h,
758
+ environment: m
759
+ }) => (o.isInitialized() || (h || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && o.init({
760
+ debug: h,
760
761
  dsn: t,
762
+ environment: m || "production",
761
763
  ignoreErrors: l || [/Failed to fetch dynamically imported module/],
762
764
  integrations: [
763
765
  new o.BrowserTracing({
@@ -772,7 +774,7 @@ const q = pr({
772
774
  o.replayIntegration(),
773
775
  ...i || []
774
776
  ],
775
- replaysOnErrorSampleRate: h || 1,
777
+ replaysOnErrorSampleRate: E || 1,
776
778
  replaysSessionSampleRate: v || 0.1,
777
779
  tracePropagationTargets: n,
778
780
  tracesSampleRate: s || 1
@@ -801,17 +803,17 @@ const q = pr({
801
803
  return /* @__PURE__ */ x.jsx(s, { client: c, children: t });
802
804
  }, Ir = (t) => {
803
805
  const { unknownErrorTranslationKey: o = "error.unknownError" } = t || {}, { translate: i = t == null ? void 0 : t.translate } = K(q), s = i ? i(o) : "Unknown error", c = Y(
804
- (h) => {
805
- var l, m, E, C, O, T, k, $, F;
806
- const { response: n } = h || {};
807
- return n != null && n.reason ? String(n.reason) : (l = n == null ? void 0 : n.data) != null && l.reason ? String(n.data.reason) : (m = n == null ? void 0 : n.data) != null && m.message ? String(n.data.message) : (C = (E = n == null ? void 0 : n.data) == null ? void 0 : E.detail) != null && C.length && Array.isArray((O = n == null ? void 0 : n.data) == null ? void 0 : O.detail) && ((k = (T = n == null ? void 0 : n.data) == null ? void 0 : T.detail[0]) != null && k.msg) && typeof ((F = ($ = n == null ? void 0 : n.data) == null ? void 0 : $.detail[0]) == null ? void 0 : F.msg) == "string" ? String(n.data.detail[0].msg) : s;
806
+ (E) => {
807
+ var l, h, m, C, O, T, k, $, F;
808
+ const { response: n } = E || {};
809
+ return n != null && n.reason ? String(n.reason) : (l = n == null ? void 0 : n.data) != null && l.reason ? String(n.data.reason) : (h = n == null ? void 0 : n.data) != null && h.message ? String(n.data.message) : (C = (m = n == null ? void 0 : n.data) == null ? void 0 : m.detail) != null && C.length && Array.isArray((O = n == null ? void 0 : n.data) == null ? void 0 : O.detail) && ((k = (T = n == null ? void 0 : n.data) == null ? void 0 : T.detail[0]) != null && k.msg) && typeof ((F = ($ = n == null ? void 0 : n.data) == null ? void 0 : $.detail[0]) == null ? void 0 : F.msg) == "string" ? String(n.data.detail[0].msg) : s;
808
810
  },
809
811
  [s]
810
812
  );
811
- return { getErrorCode: Y((h) => {
812
- var l, m, E;
813
- const { response: n } = h || {};
814
- return n != null && n.error_code ? String(n == null ? void 0 : n.error_code) : (l = n == null ? void 0 : n.data) != null && l.error_code ? String((m = n == null ? void 0 : n.data) == null ? void 0 : m.error_code) : n != null && n.error_code ? String(n == null ? void 0 : n.error_code) : (E = n == null ? void 0 : n.data) != null && E.error_code ? String(n.data.error_code) : "unknown_error_code";
813
+ return { getErrorCode: Y((E) => {
814
+ var l, h, m;
815
+ const { response: n } = E || {};
816
+ return n != null && n.error_code ? String(n == null ? void 0 : n.error_code) : (l = n == null ? void 0 : n.data) != null && l.error_code ? String((h = n == null ? void 0 : n.data) == null ? void 0 : h.error_code) : n != null && n.error_code ? String(n == null ? void 0 : n.error_code) : (m = n == null ? void 0 : n.data) != null && m.error_code ? String(n.data.error_code) : "unknown_error_code";
815
817
  }, []), printError: c };
816
818
  }, Nr = ({
817
819
  data: t,
@@ -821,17 +823,17 @@ const q = pr({
821
823
  isLoading: c,
822
824
  enabled: v = !0
823
825
  }) => {
824
- const h = Y(
826
+ const E = Y(
825
827
  async (l) => {
826
828
  i || !v || await o({ pageParam: (l == null ? void 0 : l.pageParam) || l.visibleRowsCount });
827
829
  },
828
830
  [v, o, i]
829
831
  ), n = se(() => {
830
832
  if (t)
831
- return t.pages.reduce((l, m) => [...l, ...m], []);
833
+ return t.pages.reduce((l, h) => [...l, ...h], []);
832
834
  }, [t]);
833
835
  return {
834
- fetchNextPageOnRowsScrollEnd: h,
836
+ fetchNextPageOnRowsScrollEnd: E,
835
837
  isLoading: i || c,
836
838
  loadingVariant: s ? "skeleton" : "linear",
837
839
  rows: n
package/dist/main.umd.cjs CHANGED
@@ -1,4 +1,4 @@
1
- (function(b,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],h):(b=typeof globalThis<"u"?globalThis:b||self,h(b["@tracktor/shared-module"]={},b.React))})(this,function(b,h){"use strict";var q={exports:{}},Y={};/**
1
+ (function(b,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],E):(b=typeof globalThis<"u"?globalThis:b||self,E(b["@tracktor/shared-module"]={},b.React))})(this,function(b,E){"use strict";var q={exports:{}},Y={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.development.js
4
4
  *
@@ -6,11 +6,11 @@
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 ce;function Me(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&function(){var t=h,o=Symbol.for("react.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),n=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),F=Symbol.iterator,I="@@iterator";function L(e){if(e===null||typeof e!="object")return null;var r=F&&e[F]||e[I];return typeof r=="function"?r:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(e){{for(var r=arguments.length,a=new Array(r>1?r-1:0),u=1;u<r;u++)a[u-1]=arguments[u];w("error",e,a)}}function w(e,r,a){{var u=k.ReactDebugCurrentFrame,p=u.getStackAddendum();p!==""&&(r+="%s",a=a.concat([p]));var g=a.map(function(d){return String(d)});g.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,g)}}var de=!1,ve=!1,J=!1,ar=!1,or=!1,pe;pe=Symbol.for("react.module.reference");function ir(e){return!!(typeof e=="string"||typeof e=="function"||e===s||e===v||or||e===c||e===m||e===y||ar||e===O||de||ve||J||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===S||e.$$typeof===E||e.$$typeof===n||e.$$typeof===l||e.$$typeof===pe||e.getModuleId!==void 0))}function ur(e,r,a){var u=e.displayName;if(u)return u;var p=r.displayName||r.name||"";return p!==""?a+"("+p+")":a}function ge(e){return e.displayName||"Context"}function x(e){if(e==null)return null;if(typeof e.tag=="number"&&C("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 s:return"Fragment";case i:return"Portal";case v:return"Profiler";case c:return"StrictMode";case m:return"Suspense";case y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case n:var r=e;return ge(r)+".Consumer";case E:var a=e;return ge(a._context)+".Provider";case l:return ur(e,e.render,"ForwardRef");case S:var u=e.displayName||null;return u!==null?u:x(e.type)||"Memo";case j:{var p=e,g=p._payload,d=p._init;try{return x(d(g))}catch{return null}}}return null}var N=Object.assign,z=0,me,he,Ee,ye,be,Re,_e;function Ce(){}Ce.__reactDisabledLog=!0;function sr(){{if(z===0){me=console.log,he=console.info,Ee=console.warn,ye=console.error,be=console.group,Re=console.groupCollapsed,_e=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function cr(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:N({},e,{value:me}),info:N({},e,{value:he}),warn:N({},e,{value:Ee}),error:N({},e,{value:ye}),group:N({},e,{value:be}),groupCollapsed:N({},e,{value:Re}),groupEnd:N({},e,{value:_e})})}z<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var re=k.ReactCurrentDispatcher,te;function $(e,r,a){{if(te===void 0)try{throw Error()}catch(p){var u=p.stack.trim().match(/\n( *(at )?)/);te=u&&u[1]||""}return`
9
+ */var ce;function Me(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&function(){var t=E,o=Symbol.for("react.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),n=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),F=Symbol.iterator,I="@@iterator";function L(e){if(e===null||typeof e!="object")return null;var r=F&&e[F]||e[I];return typeof r=="function"?r:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(e){{for(var r=arguments.length,a=new Array(r>1?r-1:0),u=1;u<r;u++)a[u-1]=arguments[u];w("error",e,a)}}function w(e,r,a){{var u=k.ReactDebugCurrentFrame,p=u.getStackAddendum();p!==""&&(r+="%s",a=a.concat([p]));var g=a.map(function(d){return String(d)});g.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,g)}}var de=!1,ve=!1,J=!1,ar=!1,or=!1,pe;pe=Symbol.for("react.module.reference");function ir(e){return!!(typeof e=="string"||typeof e=="function"||e===s||e===v||or||e===c||e===h||e===m||ar||e===O||de||ve||J||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===S||e.$$typeof===y||e.$$typeof===n||e.$$typeof===l||e.$$typeof===pe||e.getModuleId!==void 0))}function ur(e,r,a){var u=e.displayName;if(u)return u;var p=r.displayName||r.name||"";return p!==""?a+"("+p+")":a}function ge(e){return e.displayName||"Context"}function x(e){if(e==null)return null;if(typeof e.tag=="number"&&C("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 s:return"Fragment";case i:return"Portal";case v:return"Profiler";case c:return"StrictMode";case h:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case n:var r=e;return ge(r)+".Consumer";case y:var a=e;return ge(a._context)+".Provider";case l:return ur(e,e.render,"ForwardRef");case S:var u=e.displayName||null;return u!==null?u:x(e.type)||"Memo";case j:{var p=e,g=p._payload,d=p._init;try{return x(d(g))}catch{return null}}}return null}var N=Object.assign,z=0,me,he,Ee,ye,be,Re,_e;function Ce(){}Ce.__reactDisabledLog=!0;function sr(){{if(z===0){me=console.log,he=console.info,Ee=console.warn,ye=console.error,be=console.group,Re=console.groupCollapsed,_e=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function cr(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:N({},e,{value:me}),info:N({},e,{value:he}),warn:N({},e,{value:Ee}),error:N({},e,{value:ye}),group:N({},e,{value:be}),groupCollapsed:N({},e,{value:Re}),groupEnd:N({},e,{value:_e})})}z<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var re=k.ReactCurrentDispatcher,te;function $(e,r,a){{if(te===void 0)try{throw Error()}catch(p){var u=p.stack.trim().match(/\n( *(at )?)/);te=u&&u[1]||""}return`
10
10
  `+te+e}}var ne=!1,X;{var lr=typeof WeakMap=="function"?WeakMap:Map;X=new lr}function we(e,r){if(!e||ne)return"";{var a=X.get(e);if(a!==void 0)return a}var u;ne=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var g;g=re.current,re.current=null,sr();try{if(r){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(D){u=D}Reflect.construct(e,[],d)}else{try{d.call()}catch(D){u=D}e.call(d.prototype)}}else{try{throw Error()}catch(D){u=D}e()}}catch(D){if(D&&u&&typeof D.stack=="string"){for(var f=D.stack.split(`
11
11
  `),T=u.stack.split(`
12
12
  `),R=f.length-1,_=T.length-1;R>=1&&_>=0&&f[R]!==T[_];)_--;for(;R>=1&&_>=0;R--,_--)if(f[R]!==T[_]){if(R!==1||_!==1)do if(R--,_--,_<0||f[R]!==T[_]){var P=`
13
- `+f[R].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),typeof e=="function"&&X.set(e,P),P}while(R>=1&&_>=0);break}}}finally{ne=!1,re.current=g,cr(),Error.prepareStackTrace=p}var V=e?e.displayName||e.name:"",Ne=V?$(V):"";return typeof e=="function"&&X.set(e,Ne),Ne}function fr(e,r,a){return we(e,!1)}function dr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function H(e,r,a){if(e==null)return"";if(typeof e=="function")return we(e,dr(e));if(typeof e=="string")return $(e);switch(e){case m:return $("Suspense");case y:return $("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case l:return fr(e.render);case S:return H(e.type,r,a);case j:{var u=e,p=u._payload,g=u._init;try{return H(g(p),r,a)}catch{}}}return""}var K=Object.prototype.hasOwnProperty,Te={},Se=k.ReactDebugCurrentFrame;function Z(e){if(e){var r=e._owner,a=H(e.type,e._source,r?r.type:null);Se.setExtraStackFrame(a)}else Se.setExtraStackFrame(null)}function vr(e,r,a,u,p){{var g=Function.call.bind(K);for(var d in e)if(g(e,d)){var f=void 0;try{if(typeof e[d]!="function"){var T=Error((u||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw T.name="Invariant Violation",T}f=e[d](r,d,u,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(R){f=R}f&&!(f instanceof Error)&&(Z(p),C("%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).",u||"React class",a,d,typeof f),Z(null)),f instanceof Error&&!(f.message in Te)&&(Te[f.message]=!0,Z(p),C("Failed %s type: %s",a,f.message),Z(null))}}}var pr=Array.isArray;function ae(e){return pr(e)}function gr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,a=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function mr(e){try{return Oe(e),!1}catch{return!0}}function Oe(e){return""+e}function je(e){if(mr(e))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",gr(e)),Oe(e)}var B=k.ReactCurrentOwner,hr={key:!0,ref:!0,__self:!0,__source:!0},Pe,Ae,oe;oe={};function Er(e){if(K.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function yr(e){if(K.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function br(e,r){if(typeof e.ref=="string"&&B.current&&r&&B.current.stateNode!==r){var a=x(B.current.type);oe[a]||(C('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',x(B.current.type),e.ref),oe[a]=!0)}}function Rr(e,r){{var a=function(){Pe||(Pe=!0,C("%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://reactjs.org/link/special-props)",r))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function _r(e,r){{var a=function(){Ae||(Ae=!0,C("%s: `ref` 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://reactjs.org/link/special-props)",r))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var Cr=function(e,r,a,u,p,g,d){var f={$$typeof:o,type:e,key:r,ref:a,props:d,_owner:g};return f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(f,"_self",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.defineProperty(f,"_source",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f};function wr(e,r,a,u,p){{var g,d={},f=null,T=null;a!==void 0&&(je(a),f=""+a),yr(r)&&(je(r.key),f=""+r.key),Er(r)&&(T=r.ref,br(r,p));for(g in r)K.call(r,g)&&!hr.hasOwnProperty(g)&&(d[g]=r[g]);if(e&&e.defaultProps){var R=e.defaultProps;for(g in R)d[g]===void 0&&(d[g]=R[g])}if(f||T){var _=typeof e=="function"?e.displayName||e.name||"Unknown":e;f&&Rr(d,_),T&&_r(d,_)}return Cr(e,f,T,p,u,B.current,d)}}var ie=k.ReactCurrentOwner,ke=k.ReactDebugCurrentFrame;function W(e){if(e){var r=e._owner,a=H(e.type,e._source,r?r.type:null);ke.setExtraStackFrame(a)}else ke.setExtraStackFrame(null)}var ue;ue=!1;function se(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function xe(){{if(ie.current){var e=x(ie.current.type);if(e)return`
13
+ `+f[R].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),typeof e=="function"&&X.set(e,P),P}while(R>=1&&_>=0);break}}}finally{ne=!1,re.current=g,cr(),Error.prepareStackTrace=p}var V=e?e.displayName||e.name:"",Ne=V?$(V):"";return typeof e=="function"&&X.set(e,Ne),Ne}function fr(e,r,a){return we(e,!1)}function dr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function H(e,r,a){if(e==null)return"";if(typeof e=="function")return we(e,dr(e));if(typeof e=="string")return $(e);switch(e){case h:return $("Suspense");case m:return $("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case l:return fr(e.render);case S:return H(e.type,r,a);case j:{var u=e,p=u._payload,g=u._init;try{return H(g(p),r,a)}catch{}}}return""}var K=Object.prototype.hasOwnProperty,Te={},Se=k.ReactDebugCurrentFrame;function Z(e){if(e){var r=e._owner,a=H(e.type,e._source,r?r.type:null);Se.setExtraStackFrame(a)}else Se.setExtraStackFrame(null)}function vr(e,r,a,u,p){{var g=Function.call.bind(K);for(var d in e)if(g(e,d)){var f=void 0;try{if(typeof e[d]!="function"){var T=Error((u||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw T.name="Invariant Violation",T}f=e[d](r,d,u,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(R){f=R}f&&!(f instanceof Error)&&(Z(p),C("%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).",u||"React class",a,d,typeof f),Z(null)),f instanceof Error&&!(f.message in Te)&&(Te[f.message]=!0,Z(p),C("Failed %s type: %s",a,f.message),Z(null))}}}var pr=Array.isArray;function ae(e){return pr(e)}function gr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,a=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function mr(e){try{return Oe(e),!1}catch{return!0}}function Oe(e){return""+e}function je(e){if(mr(e))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",gr(e)),Oe(e)}var B=k.ReactCurrentOwner,hr={key:!0,ref:!0,__self:!0,__source:!0},Pe,Ae,oe;oe={};function Er(e){if(K.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function yr(e){if(K.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function br(e,r){if(typeof e.ref=="string"&&B.current&&r&&B.current.stateNode!==r){var a=x(B.current.type);oe[a]||(C('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',x(B.current.type),e.ref),oe[a]=!0)}}function Rr(e,r){{var a=function(){Pe||(Pe=!0,C("%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://reactjs.org/link/special-props)",r))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function _r(e,r){{var a=function(){Ae||(Ae=!0,C("%s: `ref` 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://reactjs.org/link/special-props)",r))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var Cr=function(e,r,a,u,p,g,d){var f={$$typeof:o,type:e,key:r,ref:a,props:d,_owner:g};return f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(f,"_self",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.defineProperty(f,"_source",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f};function wr(e,r,a,u,p){{var g,d={},f=null,T=null;a!==void 0&&(je(a),f=""+a),yr(r)&&(je(r.key),f=""+r.key),Er(r)&&(T=r.ref,br(r,p));for(g in r)K.call(r,g)&&!hr.hasOwnProperty(g)&&(d[g]=r[g]);if(e&&e.defaultProps){var R=e.defaultProps;for(g in R)d[g]===void 0&&(d[g]=R[g])}if(f||T){var _=typeof e=="function"?e.displayName||e.name||"Unknown":e;f&&Rr(d,_),T&&_r(d,_)}return Cr(e,f,T,p,u,B.current,d)}}var ie=k.ReactCurrentOwner,ke=k.ReactDebugCurrentFrame;function W(e){if(e){var r=e._owner,a=H(e.type,e._source,r?r.type:null);ke.setExtraStackFrame(a)}else ke.setExtraStackFrame(null)}var ue;ue=!1;function se(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function xe(){{if(ie.current){var e=x(ie.current.type);if(e)return`
14
14
 
15
15
  Check the render method of \``+e+"`."}return""}}function Tr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),a=e.lineNumber;return`
16
16
 
@@ -24,4 +24,4 @@ Check the top-level render call using <`+a+">.")}return r}}function Fe(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 We(){if(le)return U;le=1;var t=h,o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,c=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,v={key:!0,ref:!0,__self:!0,__source:!0};function E(n,l,m){var y,S={},j=null,O=null;m!==void 0&&(j=""+m),l.key!==void 0&&(j=""+l.key),l.ref!==void 0&&(O=l.ref);for(y in l)s.call(l,y)&&!v.hasOwnProperty(y)&&(S[y]=l[y]);if(n&&n.defaultProps)for(y in l=n.defaultProps,l)S[y]===void 0&&(S[y]=l[y]);return{$$typeof:o,type:n,key:j,ref:O,props:S,_owner:c.current}}return U.Fragment=i,U.jsx=E,U.jsxs=E,U}process.env.NODE_ENV==="production"?q.exports=We():q.exports=Me();var A=q.exports;const M=h.createContext({apiURL:void 0,axios:void 0,children:void 0,Navigate:void 0,Outlet:void 0,translate:void 0,useAuth:void 0,useLocation:void 0}),Ve=({axios:t,children:o,translate:i,useAuth:s,Outlet:c,Navigate:v,useLocation:E,useGoogleTagManager:n,apiURL:l})=>{const m=h.useMemo(()=>({apiURL:l,axios:t,Navigate:v,Outlet:c,translate:i,useAuth:s,useGoogleTagManager:n,useLocation:E}),[v,c,l,t,i,s,n,E]);return A.jsx(M.Provider,{value:m,children:o})},G=t=>`RequireAuth require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ye=({Fallback:t,loginPath:o="/login",localStorageKey:i="user",redirect401Path:s="/login",...c})=>{var I,L,k,C;const{axios:v=c.axios,useLocation:E=c.useLocation,useAuth:n=c.useAuth,Outlet:l=c.Outlet,Navigate:m=c.Navigate}=h.useContext(M);if(n===void 0)throw new Error(G("useAuth"));if(E===void 0)throw new Error(G("useLocation"));if(l===void 0)throw new Error(G("Outlet"));if(m===void 0)throw new Error(G("Navigate"));const[y,S]=h.useState(null),{isLogged:j}=n(),O=E(),F=h.useRef(!1);return h.useLayoutEffect(()=>{F.current||(F.current=!0,v==null||v.interceptors.response.use(w=>w,async w=>{var J;return 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&&((J=w==null?void 0:w.response)==null?void 0:J.status)===401&&(v.defaults.headers.common.Authorization=null,localStorage.removeItem(i),S(s)),Promise.reject(w)}))},[v==null?void 0:v.defaults.headers.common,v==null?void 0:v.interceptors.response,i,s]),j&&!y?A.jsx(h.Suspense,{fallback:t,children:(L=(I=O.state)==null?void 0:I.from)!=null&&L.state&&((C=(k=O.state)==null?void 0:k.from)==null?void 0:C.pathname)===o?A.jsx(m,{to:O.state.from.state.from.pathname+O.state.from.state.from.search,replace:!0}):A.jsx(l,{})}):A.jsx(m,{to:o,state:{from:O},replace:!0})},Q=t=>`GTMSendPageView require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ue=({...t})=>{const{useLocation:o=t.useLocation,Outlet:i=t.Outlet,useGoogleTagManager:s=t.useGoogleTagManager}=h.useContext(M);if(o===void 0)throw new Error(Q("useLocation"));if(i===void 0)throw new Error(Q("Outlet"));if(s===void 0)throw new Error(Q("useGoogleTagManager"));const{pathname:c}=o(),{sendEvent:v}=s();return h.useEffect(()=>{v({event:"pageView",pathname:c})},[c,v]),A.jsx(i,{})},ze=({axios:t,baseURL:o,tokenTypeKey:i="tokenType",userLocalStorageKey:s="user",tokenKey:c="accessToken",postContentType:v="application/json"})=>{if(!t.defaults)return null;const E=localStorage.getItem(s),n=E?JSON.parse(E):null,l=n!=null&&n[i]?n[i]:null,m=n!=null&&n[c]?n[c]:null,y=E?`${l} ${m}`:null;return t.defaults.baseURL=o,t.defaults.headers.post["Content-Type"]=v,y&&(t.defaults.headers.common.Authorization=y),null},Be=({i18n:t,debug:o,initReactI18next:i,resources:s,LanguageDetector:c})=>(t!=null&&t.isInitialized||(t.use(c).use(i).init({debug:o,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:!1,useSuspense:!0},resources:s,returnNull:!1}).then(()=>{document.documentElement.lang!==t.resolvedLanguage&&t.resolvedLanguage&&document.documentElement.setAttribute("lang",t.resolvedLanguage)}),t.on("languageChanged",v=>{document.documentElement.setAttribute("lang",v)})),null),Ge=({dsn:t,sentry:o,integrations:i,tracesSampleRate:s,routingInstrumentationDependencies:c,replaysSessionSampleRate:v,replaysOnErrorSampleRate:E,tracePropagationTargets:n,ignoreErrors:l,debug:m})=>(o.isInitialized()||(m||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&o.init({debug:m,dsn:t,ignoreErrors:l||[/Failed to fetch dynamically imported module/],integrations:[new o.BrowserTracing({routingInstrumentation:o.reactRouterV6Instrumentation(c.useEffect,c.useLocation,c.useNavigationType,c.createRoutesFromChildren,c.matchRoutes)}),o.replayIntegration(),...i||[]],replaysOnErrorSampleRate:E||1,replaysSessionSampleRate:v||.1,tracePropagationTargets:n,tracesSampleRate:s||1}),null),Je=({IMaskMixin:t,...o})=>{const i=h.useMemo(()=>t(({TextField:s,...c})=>A.jsx(s,{...c})),[t]);return A.jsx(i,{...o})},$e=({mapbox:t,accessToken:o})=>(t&&o&&(t.accessToken=o),null),Xe=({children:t,defaultOptions:o,QueryClient:i,QueryClientProvider:s})=>{const c=new i({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:3,...o}}});return A.jsx(s,{client:c,children:t})},He=t=>{const{unknownErrorTranslationKey:o="error.unknownError"}=t||{},{translate:i=t==null?void 0:t.translate}=h.useContext(M),s=i?i(o):"Unknown error",c=h.useCallback(E=>{var l,m,y,S,j,O,F,I,L;const{response:n}=E||{};return n!=null&&n.reason?String(n.reason):(l=n==null?void 0:n.data)!=null&&l.reason?String(n.data.reason):(m=n==null?void 0:n.data)!=null&&m.message?String(n.data.message):(S=(y=n==null?void 0:n.data)==null?void 0:y.detail)!=null&&S.length&&Array.isArray((j=n==null?void 0:n.data)==null?void 0:j.detail)&&((F=(O=n==null?void 0:n.data)==null?void 0:O.detail[0])!=null&&F.msg)&&typeof((L=(I=n==null?void 0:n.data)==null?void 0:I.detail[0])==null?void 0:L.msg)=="string"?String(n.data.detail[0].msg):s},[s]);return{getErrorCode:h.useCallback(E=>{var l,m,y;const{response:n}=E||{};return n!=null&&n.error_code?String(n==null?void 0:n.error_code):(l=n==null?void 0:n.data)!=null&&l.error_code?String((m=n==null?void 0:n.data)==null?void 0:m.error_code):n!=null&&n.error_code?String(n==null?void 0:n.error_code):(y=n==null?void 0:n.data)!=null&&y.error_code?String(n.data.error_code):"unknown_error_code"},[]),printError:c}},Ke=({data:t,fetchNextPage:o,isFetchingNextPage:i,isInitialLoading:s,isLoading:c,enabled:v=!0})=>{const E=h.useCallback(async l=>{i||!v||await o({pageParam:(l==null?void 0:l.pageParam)||l.visibleRowsCount})},[v,o,i]),n=h.useMemo(()=>{if(t)return t.pages.reduce((l,m)=>[...l,...m],[])},[t]);return{fetchNextPageOnRowsScrollEnd:E,isLoading:i||c,loadingVariant:s?"skeleton":"linear",rows:n}},Ze=t=>{const o=h.useCallback(({tokenType:s,accessToken:c})=>{t.defaults.headers.common.Authorization=`${s} ${c}`},[t.defaults.headers.common]);return{clearAuthenticationToken:h.useCallback(()=>{t.defaults.headers.common.Authorization=null},[t.defaults.headers.common]),setAuthenticationToken:o}},fe=(t,o="km")=>{const i=Number(t);return Number.isNaN(i)?`0 ${o}`:`${i.toFixed(2)} ${o}`},ee=(t,o)=>{if(!t)return"";const i=typeof t=="object"&&"pathname"in t?`${t.origin}${t.pathname}`:t;return typeof o=="number"?`${i.replace("/files",`/thumbs/${o}`)}`:i},qe=()=>{const{apiURL:t}=h.useContext(M);return{distanceAdapter:fe,filePathAdapter:(i,s)=>ee(t&&typeof i=="string"?{origin:t,pathname:i}:i,s)}},Qe=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),er=t=>{const s=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("");return s.charAt(0).toLowerCase()+s.slice(1)},rr=(t,o,i)=>{const s=er(o),c=Qe(i);return`${s}${c}`},tr=t=>{if(t)return(t==null?void 0:t.reduce((o,i)=>(o[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset"}},o),{}))||{}},nr=t=>{const{input:o="./openapi.json",operationsToGenerateInfiniteQueryHook:i=void 0}=t||{};return{api:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:o,output:{client:"react-query",mode:"tags-split",override:{header:s=>["Generated by orval 🍺",...s.title?[s.title]:[],...s.description?[s.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/config/orval/mutator/axiosCustomInstance.ts`},operationName:rr,...(i==null?void 0:i.length)&&{operations:tr(i)},query:{useQuery:!0}},schemas:"src/api/model",target:"src/api/services/api.ts"}}}};b.AxiosConfig=ze,b.GTMSendPageView=Ue,b.I18nConfig=Be,b.InjectDependenciesContext=M,b.InjectDependenciesProvider=Ve,b.MapBoxConfig=$e,b.MaskTextField=Je,b.QueryClientConfigProvider=Xe,b.RequireAuth=Ye,b.SentryConfig=Ge,b.distanceAdapter=fe,b.filePathAdapter=ee,b.getOrvalConfig=nr,b.useAdapter=qe,b.useAuth=Ze,b.useInfiniteDataGrid=Ke,b.useResponseError=He,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
27
+ */var le;function We(){if(le)return U;le=1;var t=E,o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,c=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,v={key:!0,ref:!0,__self:!0,__source:!0};function y(n,l,h){var m,S={},j=null,O=null;h!==void 0&&(j=""+h),l.key!==void 0&&(j=""+l.key),l.ref!==void 0&&(O=l.ref);for(m in l)s.call(l,m)&&!v.hasOwnProperty(m)&&(S[m]=l[m]);if(n&&n.defaultProps)for(m in l=n.defaultProps,l)S[m]===void 0&&(S[m]=l[m]);return{$$typeof:o,type:n,key:j,ref:O,props:S,_owner:c.current}}return U.Fragment=i,U.jsx=y,U.jsxs=y,U}process.env.NODE_ENV==="production"?q.exports=We():q.exports=Me();var A=q.exports;const M=E.createContext({apiURL:void 0,axios:void 0,children:void 0,Navigate:void 0,Outlet:void 0,translate:void 0,useAuth:void 0,useLocation:void 0}),Ve=({axios:t,children:o,translate:i,useAuth:s,Outlet:c,Navigate:v,useLocation:y,useGoogleTagManager:n,apiURL:l})=>{const h=E.useMemo(()=>({apiURL:l,axios:t,Navigate:v,Outlet:c,translate:i,useAuth:s,useGoogleTagManager:n,useLocation:y}),[v,c,l,t,i,s,n,y]);return A.jsx(M.Provider,{value:h,children:o})},G=t=>`RequireAuth require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ye=({Fallback:t,loginPath:o="/login",localStorageKey:i="user",redirect401Path:s="/login",...c})=>{var I,L,k,C;const{axios:v=c.axios,useLocation:y=c.useLocation,useAuth:n=c.useAuth,Outlet:l=c.Outlet,Navigate:h=c.Navigate}=E.useContext(M);if(n===void 0)throw new Error(G("useAuth"));if(y===void 0)throw new Error(G("useLocation"));if(l===void 0)throw new Error(G("Outlet"));if(h===void 0)throw new Error(G("Navigate"));const[m,S]=E.useState(null),{isLogged:j}=n(),O=y(),F=E.useRef(!1);return E.useLayoutEffect(()=>{F.current||(F.current=!0,v==null||v.interceptors.response.use(w=>w,async w=>{var J;return 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&&((J=w==null?void 0:w.response)==null?void 0:J.status)===401&&(v.defaults.headers.common.Authorization=null,localStorage.removeItem(i),S(s)),Promise.reject(w)}))},[v==null?void 0:v.defaults.headers.common,v==null?void 0:v.interceptors.response,i,s]),j&&!m?A.jsx(E.Suspense,{fallback:t,children:(L=(I=O.state)==null?void 0:I.from)!=null&&L.state&&((C=(k=O.state)==null?void 0:k.from)==null?void 0:C.pathname)===o?A.jsx(h,{to:O.state.from.state.from.pathname+O.state.from.state.from.search,replace:!0}):A.jsx(l,{})}):A.jsx(h,{to:o,state:{from:O},replace:!0})},Q=t=>`GTMSendPageView require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ue=({...t})=>{const{useLocation:o=t.useLocation,Outlet:i=t.Outlet,useGoogleTagManager:s=t.useGoogleTagManager}=E.useContext(M);if(o===void 0)throw new Error(Q("useLocation"));if(i===void 0)throw new Error(Q("Outlet"));if(s===void 0)throw new Error(Q("useGoogleTagManager"));const{pathname:c}=o(),{sendEvent:v}=s();return E.useEffect(()=>{v({event:"pageView",pathname:c})},[c,v]),A.jsx(i,{})},ze=({axios:t,baseURL:o,tokenTypeKey:i="tokenType",userLocalStorageKey:s="user",tokenKey:c="accessToken",postContentType:v="application/json"})=>{if(!t.defaults)return null;const y=localStorage.getItem(s),n=y?JSON.parse(y):null,l=n!=null&&n[i]?n[i]:null,h=n!=null&&n[c]?n[c]:null,m=y?`${l} ${h}`:null;return t.defaults.baseURL=o,t.defaults.headers.post["Content-Type"]=v,m&&(t.defaults.headers.common.Authorization=m),null},Be=({i18n:t,debug:o,initReactI18next:i,resources:s,LanguageDetector:c})=>(t!=null&&t.isInitialized||(t.use(c).use(i).init({debug:o,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:!1,useSuspense:!0},resources:s,returnNull:!1}).then(()=>{document.documentElement.lang!==t.resolvedLanguage&&t.resolvedLanguage&&document.documentElement.setAttribute("lang",t.resolvedLanguage)}),t.on("languageChanged",v=>{document.documentElement.setAttribute("lang",v)})),null),Ge=({dsn:t,sentry:o,integrations:i,tracesSampleRate:s,routingInstrumentationDependencies:c,replaysSessionSampleRate:v,replaysOnErrorSampleRate:y,tracePropagationTargets:n,ignoreErrors:l,debug:h,environment:m})=>(o.isInitialized()||(h||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&o.init({debug:h,dsn:t,environment:m||"production",ignoreErrors:l||[/Failed to fetch dynamically imported module/],integrations:[new o.BrowserTracing({routingInstrumentation:o.reactRouterV6Instrumentation(c.useEffect,c.useLocation,c.useNavigationType,c.createRoutesFromChildren,c.matchRoutes)}),o.replayIntegration(),...i||[]],replaysOnErrorSampleRate:y||1,replaysSessionSampleRate:v||.1,tracePropagationTargets:n,tracesSampleRate:s||1}),null),Je=({IMaskMixin:t,...o})=>{const i=E.useMemo(()=>t(({TextField:s,...c})=>A.jsx(s,{...c})),[t]);return A.jsx(i,{...o})},$e=({mapbox:t,accessToken:o})=>(t&&o&&(t.accessToken=o),null),Xe=({children:t,defaultOptions:o,QueryClient:i,QueryClientProvider:s})=>{const c=new i({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:3,...o}}});return A.jsx(s,{client:c,children:t})},He=t=>{const{unknownErrorTranslationKey:o="error.unknownError"}=t||{},{translate:i=t==null?void 0:t.translate}=E.useContext(M),s=i?i(o):"Unknown error",c=E.useCallback(y=>{var l,h,m,S,j,O,F,I,L;const{response:n}=y||{};return n!=null&&n.reason?String(n.reason):(l=n==null?void 0:n.data)!=null&&l.reason?String(n.data.reason):(h=n==null?void 0:n.data)!=null&&h.message?String(n.data.message):(S=(m=n==null?void 0:n.data)==null?void 0:m.detail)!=null&&S.length&&Array.isArray((j=n==null?void 0:n.data)==null?void 0:j.detail)&&((F=(O=n==null?void 0:n.data)==null?void 0:O.detail[0])!=null&&F.msg)&&typeof((L=(I=n==null?void 0:n.data)==null?void 0:I.detail[0])==null?void 0:L.msg)=="string"?String(n.data.detail[0].msg):s},[s]);return{getErrorCode:E.useCallback(y=>{var l,h,m;const{response:n}=y||{};return n!=null&&n.error_code?String(n==null?void 0:n.error_code):(l=n==null?void 0:n.data)!=null&&l.error_code?String((h=n==null?void 0:n.data)==null?void 0:h.error_code):n!=null&&n.error_code?String(n==null?void 0:n.error_code):(m=n==null?void 0:n.data)!=null&&m.error_code?String(n.data.error_code):"unknown_error_code"},[]),printError:c}},Ke=({data:t,fetchNextPage:o,isFetchingNextPage:i,isInitialLoading:s,isLoading:c,enabled:v=!0})=>{const y=E.useCallback(async l=>{i||!v||await o({pageParam:(l==null?void 0:l.pageParam)||l.visibleRowsCount})},[v,o,i]),n=E.useMemo(()=>{if(t)return t.pages.reduce((l,h)=>[...l,...h],[])},[t]);return{fetchNextPageOnRowsScrollEnd:y,isLoading:i||c,loadingVariant:s?"skeleton":"linear",rows:n}},Ze=t=>{const o=E.useCallback(({tokenType:s,accessToken:c})=>{t.defaults.headers.common.Authorization=`${s} ${c}`},[t.defaults.headers.common]);return{clearAuthenticationToken:E.useCallback(()=>{t.defaults.headers.common.Authorization=null},[t.defaults.headers.common]),setAuthenticationToken:o}},fe=(t,o="km")=>{const i=Number(t);return Number.isNaN(i)?`0 ${o}`:`${i.toFixed(2)} ${o}`},ee=(t,o)=>{if(!t)return"";const i=typeof t=="object"&&"pathname"in t?`${t.origin}${t.pathname}`:t;return typeof o=="number"?`${i.replace("/files",`/thumbs/${o}`)}`:i},qe=()=>{const{apiURL:t}=E.useContext(M);return{distanceAdapter:fe,filePathAdapter:(i,s)=>ee(t&&typeof i=="string"?{origin:t,pathname:i}:i,s)}},Qe=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),er=t=>{const s=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("");return s.charAt(0).toLowerCase()+s.slice(1)},rr=(t,o,i)=>{const s=er(o),c=Qe(i);return`${s}${c}`},tr=t=>{if(t)return(t==null?void 0:t.reduce((o,i)=>(o[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset"}},o),{}))||{}},nr=t=>{const{input:o="./openapi.json",operationsToGenerateInfiniteQueryHook:i=void 0}=t||{};return{api:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:o,output:{client:"react-query",mode:"tags-split",override:{header:s=>["Generated by orval 🍺",...s.title?[s.title]:[],...s.description?[s.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/config/orval/mutator/axiosCustomInstance.ts`},operationName:rr,...(i==null?void 0:i.length)&&{operations:tr(i)},query:{useQuery:!0}},schemas:"src/api/model",target:"src/api/services/api.ts"}}}};b.AxiosConfig=ze,b.GTMSendPageView=Ue,b.I18nConfig=Be,b.InjectDependenciesContext=M,b.InjectDependenciesProvider=Ve,b.MapBoxConfig=$e,b.MaskTextField=Je,b.QueryClientConfigProvider=Xe,b.RequireAuth=Ye,b.SentryConfig=Ge,b.distanceAdapter=fe,b.filePathAdapter=ee,b.getOrvalConfig=nr,b.useAdapter=qe,b.useAuth=Ze,b.useInfiniteDataGrid=Ke,b.useResponseError=He,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "@tracktor/shared-module",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "types": "./dist/main.d.ts",
7
7
  "main": "./dist/main.umd.cjs",
8
8
  "module": "./dist/main.js",
9
- "engines": {
10
- "node": ">=20 <22"
11
- },
12
9
  "files": [
13
10
  "dist"
14
11
  ],