@tracktor/shared-module 2.9.2 → 2.9.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.9.2
3
+ ## v2.9.3
4
4
  - **[fix]** - add `adaptWorksiteName` adapter improvement
package/dist/main.js CHANGED
@@ -15,11 +15,11 @@ function Et() {
15
15
  Ne = 1;
16
16
  var t = Ve, r = Symbol.for("react.element"), o = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, a = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
17
17
  function f(d, u, m) {
18
- var g, C = {}, b = null, s = null;
18
+ var g, S = {}, b = null, s = null;
19
19
  m !== void 0 && (b = "" + m), u.key !== void 0 && (b = "" + u.key), u.ref !== void 0 && (s = u.ref);
20
- for (g in u) i.call(u, g) && !l.hasOwnProperty(g) && (C[g] = u[g]);
21
- if (d && d.defaultProps) for (g in u = d.defaultProps, u) C[g] === void 0 && (C[g] = u[g]);
22
- return { $$typeof: r, type: d, key: b, ref: s, props: C, _owner: a.current };
20
+ for (g in u) i.call(u, g) && !l.hasOwnProperty(g) && (S[g] = u[g]);
21
+ if (d && d.defaultProps) for (g in u = d.defaultProps, u) S[g] === void 0 && (S[g] = u[g]);
22
+ return { $$typeof: r, type: d, key: b, ref: s, props: S, _owner: a.current };
23
23
  }
24
24
  return K.Fragment = o, K.jsx = f, K.jsxs = f, K;
25
25
  }
@@ -36,11 +36,11 @@ var q = {};
36
36
  var Ye;
37
37
  function wt() {
38
38
  return Ye || (Ye = 1, process.env.NODE_ENV !== "production" && function() {
39
- var t = Ve, r = Symbol.for("react.element"), o = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), f = Symbol.for("react.provider"), d = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), C = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), s = Symbol.for("react.offscreen"), S = Symbol.iterator, R = "@@iterator";
39
+ var t = Ve, r = Symbol.for("react.element"), o = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), f = Symbol.for("react.provider"), d = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), s = Symbol.for("react.offscreen"), C = Symbol.iterator, R = "@@iterator";
40
40
  function P(e) {
41
41
  if (e === null || typeof e != "object")
42
42
  return null;
43
- var n = S && e[S] || e[R];
43
+ var n = C && e[C] || e[R];
44
44
  return typeof n == "function" ? n : null;
45
45
  }
46
46
  var h = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
@@ -64,7 +64,7 @@ function wt() {
64
64
  var F = !1, L = !1, $ = !1, T = !1, ge = !1, ne;
65
65
  ne = Symbol.for("react.module.reference");
66
66
  function B(e) {
67
- return !!(typeof e == "string" || typeof e == "function" || e === i || e === l || ge || e === a || e === m || e === g || T || e === s || F || L || $ || typeof e == "object" && e !== null && (e.$$typeof === b || e.$$typeof === C || e.$$typeof === f || e.$$typeof === d || e.$$typeof === u || // This needs to include all possible module reference object
67
+ return !!(typeof e == "string" || typeof e == "function" || e === i || e === l || ge || e === a || e === m || e === g || T || e === s || F || L || $ || typeof e == "object" && e !== null && (e.$$typeof === b || e.$$typeof === S || e.$$typeof === f || e.$$typeof === d || e.$$typeof === u || // This needs to include all possible module reference object
68
68
  // types supported by any Flight configuration anywhere since
69
69
  // we don't know which Flight build this will end up being used
70
70
  // with.
@@ -111,7 +111,7 @@ function wt() {
111
111
  return he(c._context) + ".Provider";
112
112
  case u:
113
113
  return Me(e, e.render, "ForwardRef");
114
- case C:
114
+ case S:
115
115
  var v = e.displayName || null;
116
116
  return v !== null ? v : N(e.type) || "Memo";
117
117
  case b: {
@@ -126,9 +126,9 @@ function wt() {
126
126
  return null;
127
127
  }
128
128
  var V = Object.assign, G = 0, ye, me, Ee, we, Re, _e, pe;
129
- function Se() {
129
+ function Ce() {
130
130
  }
131
- Se.__reactDisabledLog = !0;
131
+ Ce.__reactDisabledLog = !0;
132
132
  function Ue() {
133
133
  {
134
134
  if (G === 0) {
@@ -136,7 +136,7 @@ function wt() {
136
136
  var e = {
137
137
  configurable: !0,
138
138
  enumerable: !0,
139
- value: Se,
139
+ value: Ce,
140
140
  writable: !0
141
141
  };
142
142
  Object.defineProperties(console, {
@@ -206,7 +206,7 @@ function wt() {
206
206
  var Je = typeof WeakMap == "function" ? WeakMap : Map;
207
207
  X = new Je();
208
208
  }
209
- function Ce(e, n) {
209
+ function Se(e, n) {
210
210
  if (!e || ie)
211
211
  return "";
212
212
  {
@@ -278,7 +278,7 @@ function wt() {
278
278
  return typeof e == "function" && X.set(e, $e), $e;
279
279
  }
280
280
  function Ke(e, n, c) {
281
- return Ce(e, !1);
281
+ return Se(e, !1);
282
282
  }
283
283
  function qe(e) {
284
284
  var n = e.prototype;
@@ -288,7 +288,7 @@ function wt() {
288
288
  if (e == null)
289
289
  return "";
290
290
  if (typeof e == "function")
291
- return Ce(e, qe(e));
291
+ return Se(e, qe(e));
292
292
  if (typeof e == "string")
293
293
  return Q(e);
294
294
  switch (e) {
@@ -301,7 +301,7 @@ function wt() {
301
301
  switch (e.$$typeof) {
302
302
  case u:
303
303
  return Ke(e.render);
304
- case C:
304
+ case S:
305
305
  return H(e.type, n, c);
306
306
  case b: {
307
307
  var v = e, w = v._payload, p = v._init;
@@ -545,7 +545,7 @@ Check the top-level render call using <` + c + ">.");
545
545
  c = n.propTypes;
546
546
  else if (typeof n == "object" && (n.$$typeof === u || // Note: Memo only checks outer props here.
547
547
  // Inner props are checked in the reconciler.
548
- n.$$typeof === C))
548
+ n.$$typeof === S))
549
549
  c = n.propTypes;
550
550
  else
551
551
  return;
@@ -629,16 +629,16 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
629
629
  const { libraries: l, localStorageKeys: f } = D(I), d = (a == null ? void 0 : a.reactRouter) || (l == null ? void 0 : l.reactRouter), u = (a == null ? void 0 : a.axios) || (l == null ? void 0 : l.axios), m = (a == null ? void 0 : a.localStorageKey) || (f == null ? void 0 : f.user) || Rt;
630
630
  if (!d)
631
631
  throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
632
- const [g, C] = ze(null), { useLocation: b, Navigate: s, Outlet: S } = d, R = b(), P = yt(!1), h = typeof r == "function" ? r() : !!r, _ = typeof h == "boolean" ? h : h == null ? void 0 : h.isLogged;
632
+ const [g, S] = ze(null), { useLocation: b, Navigate: s, Outlet: C } = d, R = b(), P = yt(!1), h = typeof r == "function" ? r() : !!r, _ = typeof h == "boolean" ? h : h == null ? void 0 : h.isLogged;
633
633
  return z(() => {
634
634
  P.current || (P.current = !0, u.interceptors.response.use(
635
635
  (T) => T,
636
636
  async (T) => {
637
637
  var B;
638
- return typeof T == "object" && T && "response" in T && T.response && typeof T.response == "object" && "status" in T.response && T.response && typeof T.response == "object" && "status" in T.response && ((B = T == null ? void 0 : T.response) == null ? void 0 : B.status) === 401 && (u.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(m), C(i)), Promise.reject(T);
638
+ return typeof T == "object" && T && "response" in T && T.response && typeof T.response == "object" && "status" in T.response && T.response && typeof T.response == "object" && "status" in T.response && ((B = T == null ? void 0 : T.response) == null ? void 0 : B.status) === 401 && (u.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(m), S(i)), Promise.reject(T);
639
639
  }
640
640
  ));
641
- }, [u.defaults.headers.common, u.interceptors.response, m, i]), _ && !g ? /* @__PURE__ */ W.jsx(mt, { fallback: t, children: (F = (A = R.state) == null ? void 0 : A.from) != null && F.state && (($ = (L = R.state) == null ? void 0 : L.from) == null ? void 0 : $.pathname) === o ? /* @__PURE__ */ W.jsx(s, { to: R.state.from.state.from.pathname + R.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ W.jsx(S, {}) }) : /* @__PURE__ */ W.jsx(s, { to: o + R.search, state: { from: R }, replace: !0 });
641
+ }, [u.defaults.headers.common, u.interceptors.response, m, i]), _ && !g ? /* @__PURE__ */ W.jsx(mt, { fallback: t, children: (F = (A = R.state) == null ? void 0 : A.from) != null && F.state && (($ = (L = R.state) == null ? void 0 : L.from) == null ? void 0 : $.pathname) === o ? /* @__PURE__ */ W.jsx(s, { to: R.state.from.state.from.pathname + R.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ W.jsx(C, {}) }) : /* @__PURE__ */ W.jsx(s, { to: o + R.search, state: { from: R }, replace: !0 });
642
642
  }, Nt = ({ data: t, ...r }) => {
643
643
  const { libraries: o } = D(I), i = (r == null ? void 0 : r.reactRouter) || (o == null ? void 0 : o.reactRouter), a = (r == null ? void 0 : r.gtm) || (o == null ? void 0 : o.gtm);
644
644
  if (!i)
@@ -667,7 +667,7 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
667
667
  if (!(u != null && u.defaults))
668
668
  return null;
669
669
  if (typeof window < "u" && window.localStorage) {
670
- const m = localStorage.getItem(d), g = m ? JSON.parse(m) : null, C = g != null && g[t] ? g[t] : null, b = g != null && g[r] ? g[r] : null, s = m ? `${C} ${b}` : null;
670
+ const m = localStorage.getItem(d), g = m ? JSON.parse(m) : null, S = g != null && g[t] ? g[t] : null, b = g != null && g[r] ? g[r] : null, s = m ? `${S} ${b}` : null;
671
671
  s && (u.defaults.headers.common.Authorization = s);
672
672
  }
673
673
  return u.defaults.baseURL = a, u.defaults.headers.post["Content-Type"] = o, null;
@@ -706,14 +706,14 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
706
706
  release: m,
707
707
  ...g
708
708
  }) => {
709
- const { libraries: C } = D(I), b = (g == null ? void 0 : g.sentry) || (C == null ? void 0 : C.sentry), s = (g == null ? void 0 : g.reactRouter) || (C == null ? void 0 : C.reactRouter);
709
+ const { libraries: S } = D(I), b = (g == null ? void 0 : g.sentry) || (S == null ? void 0 : S.sentry), s = (g == null ? void 0 : g.reactRouter) || (S == null ? void 0 : S.reactRouter);
710
710
  if (!b)
711
711
  throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
712
712
  if (!s)
713
713
  throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
714
714
  if (b.isInitialized())
715
715
  return null;
716
- const { createRoutesFromChildren: S, matchRoutes: R, useLocation: P, useNavigationType: h } = s;
716
+ const { createRoutesFromChildren: C, matchRoutes: R, useLocation: P, useNavigationType: h } = s;
717
717
  return (d || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && b.init({
718
718
  debug: d,
719
719
  dsn: t,
@@ -729,7 +729,7 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
729
729
  ],
730
730
  integrations: [
731
731
  b.reactRouterV6BrowserTracingIntegration({
732
- createRoutesFromChildren: S,
732
+ createRoutesFromChildren: C,
733
733
  matchRoutes: R,
734
734
  useEffect: z,
735
735
  useLocation: P,
@@ -780,7 +780,7 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
780
780
  return window.addEventListener("vite:preloadError", t), () => {
781
781
  window.removeEventListener("vite:preloadError", t);
782
782
  };
783
- }, []), null), pt = (t) => t && typeof t == "function", St = (t) => t && typeof t == "function", Jt = ({
783
+ }, []), null), pt = (t) => t && typeof t == "function", Ct = (t) => t && typeof t == "function", Jt = ({
784
784
  children: t,
785
785
  defaultQueriesOptions: r,
786
786
  defaultMutationsOptions: o,
@@ -794,7 +794,7 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
794
794
  throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
795
795
  if (!pt(f))
796
796
  throw new Error("Provided QueryClientProvider dependencies are not valid.");
797
- if (!St(l))
797
+ if (!Ct(l))
798
798
  throw new Error("Provided QueryClient dependencies are not valid.");
799
799
  const d = new l({
800
800
  defaultOptions: {
@@ -802,7 +802,7 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
802
802
  ...o
803
803
  },
804
804
  queries: {
805
- getNextPageParam: (g, C, b) => g.length + (b || 0),
805
+ getNextPageParam: (g, S, b) => g.length + (b || 0),
806
806
  refetchOnWindowFocus: !1,
807
807
  retry: 3,
808
808
  ...r
@@ -811,19 +811,19 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
811
811
  });
812
812
  return /* @__PURE__ */ W.jsx(f, { client: d, children: t });
813
813
  }, Kt = (t) => {
814
- var m, g, C;
815
- const { libraries: r } = D(I), o = (t == null ? void 0 : t.i18) || (r == null ? void 0 : r.i18), i = ((m = t == null ? void 0 : t.i18) == null ? void 0 : m.translateFunction) || ((g = r == null ? void 0 : r.i18) == null ? void 0 : g.translateFunction), a = ((C = o == null ? void 0 : o.i18next) == null ? void 0 : C.t) || i || ((b) => b), { unknownErrorTranslationKey: l = "error.unknownError" } = t || {}, f = a(l), d = re(
814
+ var m, g, S;
815
+ const { libraries: r } = D(I), o = (t == null ? void 0 : t.i18) || (r == null ? void 0 : r.i18), i = ((m = t == null ? void 0 : t.i18) == null ? void 0 : m.translateFunction) || ((g = r == null ? void 0 : r.i18) == null ? void 0 : g.translateFunction), a = ((S = o == null ? void 0 : o.i18next) == null ? void 0 : S.t) || i || ((b) => b), { unknownErrorTranslationKey: l = "error.unknownError" } = t || {}, f = a(l), d = re(
816
816
  (b) => {
817
- var S, R, P, h, _, A, F, L, $;
817
+ var C, R, P, h, _, A, F, L, $;
818
818
  const { response: s } = b || {};
819
- return s != null && s.reason ? String(s.reason) : (S = s == null ? void 0 : s.data) != null && S.reason ? String(s.data.reason) : (R = s == null ? void 0 : s.data) != null && R.message ? String(s.data.message) : (h = (P = s == null ? void 0 : s.data) == null ? void 0 : P.detail) != null && h.length && Array.isArray((_ = s == null ? void 0 : s.data) == null ? void 0 : _.detail) && ((F = (A = s == null ? void 0 : s.data) == null ? void 0 : A.detail[0]) != null && F.msg) && typeof (($ = (L = s == null ? void 0 : s.data) == null ? void 0 : L.detail[0]) == null ? void 0 : $.msg) == "string" ? String(s.data.detail[0].msg) : f;
819
+ return s != null && s.reason ? String(s.reason) : (C = s == null ? void 0 : s.data) != null && C.reason ? String(s.data.reason) : (R = s == null ? void 0 : s.data) != null && R.message ? String(s.data.message) : (h = (P = s == null ? void 0 : s.data) == null ? void 0 : P.detail) != null && h.length && Array.isArray((_ = s == null ? void 0 : s.data) == null ? void 0 : _.detail) && ((F = (A = s == null ? void 0 : s.data) == null ? void 0 : A.detail[0]) != null && F.msg) && typeof (($ = (L = s == null ? void 0 : s.data) == null ? void 0 : L.detail[0]) == null ? void 0 : $.msg) == "string" ? String(s.data.detail[0].msg) : f;
820
820
  },
821
821
  [f]
822
822
  );
823
823
  return { getErrorCode: re((b) => {
824
- var S, R, P;
824
+ var C, R, P;
825
825
  const { response: s } = b || {};
826
- return s != null && s.error_code ? String(s == null ? void 0 : s.error_code) : (S = s == null ? void 0 : s.data) != null && S.error_code ? String((R = s == null ? void 0 : s.data) == null ? void 0 : R.error_code) : s != null && s.error_code ? String(s == null ? void 0 : s.error_code) : (P = s == null ? void 0 : s.data) != null && P.error_code ? String(s.data.error_code) : "unknown_error_code";
826
+ return s != null && s.error_code ? String(s == null ? void 0 : s.error_code) : (C = s == null ? void 0 : s.data) != null && C.error_code ? String((R = s == null ? void 0 : s.data) == null ? void 0 : R.error_code) : s != null && s.error_code ? String(s == null ? void 0 : s.error_code) : (P = s == null ? void 0 : s.data) != null && P.error_code ? String(s.data.error_code) : "unknown_error_code";
827
827
  }, []), printError: d };
828
828
  }, qt = ({
829
829
  data: t,
@@ -877,10 +877,10 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
877
877
  clearAuthenticationToken: l,
878
878
  setAuthenticationToken: a
879
879
  };
880
- }, Ct = ({ library: t, date: r, format: o = "ll" }) => t(r).format(o), bt = (t, r = "km") => {
880
+ }, St = ({ library: t, date: r, format: o = "ll" }) => t(r).format(o), bt = (t, r = "km") => {
881
881
  const o = Number(t);
882
882
  return Number.isNaN(o) ? `0 ${r}` : `${o.toFixed(2)} ${r}`;
883
- }, Pt = (t) => !t || typeof t != "string" ? "" : t.replace(/_/g, " ").split(" ").map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join(" "), jt = (t) => t != null && t.startsWith("/") ? t != null && t.startsWith("/files") ? t : `/files${t}` : t != null && t.startsWith("files") ? `/${t}` : `/files/${t}`, Ot = ({ path: t, size: r, apiURL: o }) => {
883
+ }, Pt = (t) => !t || typeof t != "string" ? "" : t.replace(/_/g, " ").split(" ").map((r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase()).join(" "), jt = (t) => t != null && t.startsWith("/") ? t != null && t.startsWith("/files") ? t : `/files${t}` : t != null && t.startsWith("files") ? `/${t}` : `/files/${t}`, Ot = ({ path: t, size: r, apiURL: o }) => {
884
884
  if (!t)
885
885
  return "";
886
886
  const i = jt(t), a = `${o}${i}`, l = a.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
@@ -891,7 +891,7 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
891
891
  dateAdapter: (f, d) => {
892
892
  if (!i)
893
893
  throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
894
- return Ct({
894
+ return St({
895
895
  date: f,
896
896
  format: d,
897
897
  library: i
@@ -933,33 +933,33 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
933
933
  throw new Error(
934
934
  "React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
935
935
  );
936
- const g = (S, R, P = !0) => {
937
- const h = We(S, (t == null ? void 0 : t.pathname) || f, m);
936
+ const g = (C, R, P = !0) => {
937
+ const h = We(C, (t == null ? void 0 : t.pathname) || f, m);
938
938
  if (!R || Array.isArray(R) && !R.length) {
939
- d.delete(S), u(d), localStorage.removeItem(h);
939
+ d.delete(C), u(d), localStorage.removeItem(h);
940
940
  return;
941
941
  }
942
- P && R && localStorage.setItem(h, JSON.stringify({ ...d, [S]: R })), R && (d.set(S, JSON.stringify(R)), u(d));
942
+ P && R && localStorage.setItem(h, JSON.stringify({ ...d, [C]: R })), R && (d.set(C, JSON.stringify(R)), u(d));
943
943
  };
944
944
  return {
945
- getFilter: (S, R) => {
946
- const P = d.get(S);
945
+ getFilter: (C, R) => {
946
+ const P = d.get(C);
947
947
  if (P)
948
948
  try {
949
949
  return JSON.parse(P);
950
950
  } catch {
951
951
  return P;
952
952
  }
953
- const h = We(S, (t == null ? void 0 : t.pathname) || f, m), _ = localStorage.getItem(h);
953
+ const h = We(C, (t == null ? void 0 : t.pathname) || f, m), _ = localStorage.getItem(h);
954
954
  if (_)
955
955
  try {
956
- return JSON.parse(_)[S];
956
+ return JSON.parse(_)[C];
957
957
  } catch {
958
958
  }
959
959
  return R;
960
960
  },
961
961
  getFilters: () => {
962
- const S = Object.fromEntries(d.entries()), P = Object.keys(localStorage).filter(
962
+ const C = Object.fromEntries(d.entries()), P = Object.keys(localStorage).filter(
963
963
  (h) => h.startsWith(m) && h.endsWith((t == null ? void 0 : t.pathname) || f)
964
964
  ).reduce((h, _) => {
965
965
  var F, L;
@@ -971,17 +971,17 @@ const I = ht({}), Lt = ({ children: t, apiURL: r, libraries: o, localStorageKeys
971
971
  return h;
972
972
  }, {});
973
973
  return {
974
- ...S,
974
+ ...C,
975
975
  ...P
976
976
  };
977
977
  },
978
- handleFilter: (S, R) => (P, h) => {
978
+ handleFilter: (C, R) => (P, h) => {
979
979
  if (h || Array.isArray(h) && h.length === 0) {
980
980
  const _ = R || "value", A = typeof h == "object" && _ in h ? h[_ || "value"] : h;
981
- g(S, A);
981
+ g(C, A);
982
982
  return;
983
983
  }
984
- g(S, void 0);
984
+ g(C, void 0);
985
985
  },
986
986
  setFilter: g
987
987
  };
@@ -1049,7 +1049,7 @@ export {
1049
1049
  Gt as PreloadErrorHandler,
1050
1050
  Jt as QueryClientProviderWithConfig,
1051
1051
  $t as RequireAuth,
1052
- Ct as dateAdapter,
1052
+ St as dateAdapter,
1053
1053
  bt as distanceAdapter,
1054
1054
  Zt as getOrvalConfig,
1055
1055
  Qt as useAdapter,
package/dist/main.umd.cjs CHANGED
@@ -22,4 +22,4 @@
22
22
 
23
23
  Check the render method of \``+e+"`."}return""}}function Yt(e){return""}var Ne={};function Wt(e){{var n=Le();if(!n){var c=typeof e=="string"?e:e.displayName||e.name;c&&(n=`
24
24
 
25
- Check the top-level render call using <`+c+">.")}return n}}function Ye(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=Wt(n);if(Ne[c])return;Ne[c]=!0;var v="";e&&e._owner&&e._owner!==ue.current&&(v=" It was passed a child from "+z(e._owner.type)+"."),U(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,v),U(null)}}function We(e,n){{if(typeof e!="object")return;if(ce(e))for(var c=0;c<e.length;c++){var v=e[c];fe(v)&&Ye(v,n)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var R=T(e);if(typeof R=="function"&&R!==e.entries)for(var S=R.call(e),w;!(w=S.next()).done;)fe(w.value)&&Ye(w.value,n)}}}function zt(e){{var n=e.type;if(n==null||typeof n=="string")return;var c;if(typeof n=="function")c=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===u||n.$$typeof===P))c=n.propTypes;else return;if(c){var v=z(n);Pt(c,e.props,"prop",v,e)}else if(n.PropTypes!==void 0&&!le){le=!0;var R=z(n);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Mt(e){{for(var n=Object.keys(e.props),c=0;c<n.length;c++){var v=n[c];if(v!=="children"&&v!=="key"){U(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),U(null);break}}e.ref!==null&&(U(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}function ze(e,n,c,v,R,S){{var w=X(e);if(!w){var m="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(m+=" 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 I=Yt();I?m+=I:m+=Le();var O;e===null?O="null":ce(e)?O="array":e!==void 0&&e.$$typeof===r?(O="<"+(z(e.type)||"Unknown")+" />",m=" Did you accidentally export a JSX literal instead of a component?"):O=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",O,m)}var A=Nt(e,n,c,R,S);if(A==null)return A;if(w){var F=n.children;if(F!==void 0)if(v)if(ce(F)){for(var G=0;G<F.length;G++)We(F[G],e);Object.freeze&&Object.freeze(F)}else p("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 We(F,e)}return e===i?Mt(A):zt(A),A}}function Vt(e,n,c){return ze(e,n,c,!0)}function Ut(e,n,c){return ze(e,n,c,!1)}var Gt=Ut,Jt=Vt;B.Fragment=i,B.jsx=Gt,B.jsxs=Jt}()),B}process.env.NODE_ENV==="production"?re.exports=Ve():re.exports=Ue();var W=re.exports;const k=h.createContext({}),Ge=({children:t,apiURL:r,libraries:a,localStorageKeys:i})=>{const o=h.useMemo(()=>({apiURL:r,libraries:a,localStorageKeys:i}),[r,a,i]);return W.jsx(k.Provider,{value:o,children:t})},Je="user",Be=({Fallback:t,isLogged:r,loginPath:a="/login",redirect401Path:i="/login",...o})=>{var D,L,N,Y;const{libraries:l,localStorageKeys:f}=h.useContext(k),d=(o==null?void 0:o.reactRouter)||(l==null?void 0:l.reactRouter),u=(o==null?void 0:o.axios)||(l==null?void 0:l.axios),E=(o==null?void 0:o.localStorageKey)||(f==null?void 0:f.user)||Je;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[g,P]=h.useState(null),{useLocation:j,Navigate:s,Outlet:b}=d,C=j(),T=h.useRef(!1),y=typeof r=="function"?r():!!r,p=typeof y=="boolean"?y:y==null?void 0:y.isLogged;return h.useEffect(()=>{T.current||(T.current=!0,u.interceptors.response.use(x=>x,async x=>{var X;return typeof x=="object"&&x&&"response"in x&&x.response&&typeof x.response=="object"&&"status"in x.response&&x.response&&typeof x.response=="object"&&"status"in x.response&&((X=x==null?void 0:x.response)==null?void 0:X.status)===401&&(u.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(E),P(i)),Promise.reject(x)}))},[u.defaults.headers.common,u.interceptors.response,E,i]),p&&!g?W.jsx(h.Suspense,{fallback:t,children:(L=(D=C.state)==null?void 0:D.from)!=null&&L.state&&((Y=(N=C.state)==null?void 0:N.from)==null?void 0:Y.pathname)===a?W.jsx(s,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):W.jsx(b,{})}):W.jsx(s,{to:a+C.search,state:{from:C},replace:!0})},Ke=({data:t,...r})=>{const{libraries:a}=h.useContext(k),i=(r==null?void 0:r.reactRouter)||(a==null?void 0:a.reactRouter),o=(r==null?void 0:r.gtm)||(a==null?void 0:a.gtm);if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!o)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:l}=o,{useLocation:f,Outlet:d}=i,{pathname:u}=f(),{sendEvent:E}=l();return h.useEffect(()=>{E({event:"pageView",pathname:u,...t})},[t,u,E]),W.jsx(d,{})},Qe="user",He=({tokenTypeKey:t="tokenType",tokenKey:r="accessToken",postContentType:a="application/json",...i})=>{const{apiURL:o=i.apiURL,libraries:l,localStorageKeys:f}=h.useContext(k),d=(i==null?void 0:i.userLocalStorageKey)||(f==null?void 0:f.user)||Qe,u=(i==null?void 0:i.axios)||(l==null?void 0:l.axios);if(!u)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(u!=null&&u.defaults))return null;if(typeof window<"u"&&window.localStorage){const E=localStorage.getItem(d),g=E?JSON.parse(E):null,P=g!=null&&g[t]?g[t]:null,j=g!=null&&g[r]?g[r]:null,s=E?`${P} ${j}`:null;s&&(u.defaults.headers.common.Authorization=s)}return u.defaults.baseURL=o,u.defaults.headers.post["Content-Type"]=a,null},Xe=({debug:t,resources:r,...a})=>{const{libraries:i}=h.useContext(k),o=(a==null?void 0:a.i18)||(i==null?void 0:i.i18),{i18next:l,initReactI18next:f,languageDetector:d}=o||{};if(!o)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return l!=null&&l.isInitialized||(l.use(d).use(f).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==l.resolvedLanguage&&l.resolvedLanguage&&document.documentElement.setAttribute("lang",l.resolvedLanguage)}),l.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},Ze=({dsn:t,integrations:r,tracesSampleRate:a,replaysSessionSampleRate:i,replaysOnErrorSampleRate:o,tracePropagationTargets:l,ignoreErrors:f,debug:d,environment:u,release:E,...g})=>{const{libraries:P}=h.useContext(k),j=(g==null?void 0:g.sentry)||(P==null?void 0:P.sentry),s=(g==null?void 0:g.reactRouter)||(P==null?void 0:P.reactRouter);if(!j)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(j.isInitialized())return null;const{createRoutesFromChildren:b,matchRoutes:C,useLocation:T,useNavigationType:y}=s;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&j.init({debug:d,dsn:t,environment:u||"production",ignoreErrors:[...f||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[j.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:b,matchRoutes:C,useEffect:h.useEffect,useLocation:T,useNavigationType:y}),...r||[]],release:E,replaysOnErrorSampleRate:o||1,replaysSessionSampleRate:i||.1,tracePropagationTargets:l,tracesSampleRate:a||1}),null},$e=({IMaskMixin:t,...r})=>{const a=h.useMemo(()=>t(({TextField:i,...o})=>W.jsx(i,{...o})),[t]);return W.jsx(a,{...r})},qe=({accessToken:t,...r})=>{const{libraries:a}=h.useContext(k),i=(r==null?void 0:r.mapbox)||(a==null?void 0:a.mapbox);if(!i)throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return t&&(i.accessToken=t),null},et=({language:t,...r})=>{const{libraries:a}=h.useContext(k),i=(r==null?void 0:r.dayjs)||(a==null?void 0:a.dayjs),o=(r==null?void 0:r.plugin)||(a==null?void 0:a.dayjsPlugin);if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return h.useEffect(()=>{(async()=>{var d;const f=t||((d=navigator.language)==null?void 0:d.slice(0,2))||"en";o&&o.forEach(u=>{u&&i.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),i.locale(f)})().then()},[i,o,t]),null},tt=()=>(h.useEffect(()=>{const t=r=>{try{r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),null),rt=t=>t&&typeof t=="function",nt=t=>t&&typeof t=="function",at=({children:t,defaultQueriesOptions:r,defaultMutationsOptions:a,...i})=>{var u,E;const{libraries:o}=h.useContext(k),l=(i==null?void 0:i.QueryClient)||((u=o==null?void 0:o.reactQuery)==null?void 0:u.QueryClient),f=(i==null?void 0:i.QueryClientProvider)||((E=o==null?void 0:o.reactQuery)==null?void 0:E.QueryClientProvider);if(!l)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!f)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!rt(f))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!nt(l))throw new Error("Provided QueryClient dependencies are not valid.");const d=new l({defaultOptions:{mutations:{...a},queries:{getNextPageParam:(g,P,j)=>g.length+(j||0),refetchOnWindowFocus:!1,retry:3,...r}}});return W.jsx(f,{client:d,children:t})},ot=t=>{var E,g,P;const{libraries:r}=h.useContext(k),a=(t==null?void 0:t.i18)||(r==null?void 0:r.i18),i=((E=t==null?void 0:t.i18)==null?void 0:E.translateFunction)||((g=r==null?void 0:r.i18)==null?void 0:g.translateFunction),o=((P=a==null?void 0:a.i18next)==null?void 0:P.t)||i||(j=>j),{unknownErrorTranslationKey:l="error.unknownError"}=t||{},f=o(l),d=h.useCallback(j=>{var b,C,T,y,p,D,L,N,Y;const{response:s}=j||{};return s!=null&&s.reason?String(s.reason):(b=s==null?void 0:s.data)!=null&&b.reason?String(s.data.reason):(C=s==null?void 0:s.data)!=null&&C.message?String(s.data.message):(y=(T=s==null?void 0:s.data)==null?void 0:T.detail)!=null&&y.length&&Array.isArray((p=s==null?void 0:s.data)==null?void 0:p.detail)&&((L=(D=s==null?void 0:s.data)==null?void 0:D.detail[0])!=null&&L.msg)&&typeof((Y=(N=s==null?void 0:s.data)==null?void 0:N.detail[0])==null?void 0:Y.msg)=="string"?String(s.data.detail[0].msg):f},[f]);return{getErrorCode:h.useCallback(j=>{var b,C,T;const{response:s}=j||{};return s!=null&&s.error_code?String(s==null?void 0:s.error_code):(b=s==null?void 0:s.data)!=null&&b.error_code?String((C=s==null?void 0:s.data)==null?void 0:C.error_code):s!=null&&s.error_code?String(s==null?void 0:s.error_code):(T=s==null?void 0:s.data)!=null&&T.error_code?String(s.data.error_code):"unknown_error_code"},[]),printError:d}},it=({data:t,fetchNextPage:r,isFetchingNextPage:a,isInitialLoading:i,isLoading:o,enabled:l=!0})=>{const f=h.useCallback(async u=>{a||!l||await r({pageParam:(u==null?void 0:u.pageParam)||u.visibleRowsCount})},[l,r,a]),d=h.useMemo(()=>{if(t)return t.pages.reduce((u,E)=>[...u,...E],[])},[t]);return{fetchNextPageOnRowsScrollEnd:f,isLoading:a||o,loadingVariant:i?"skeleton":"linear",rows:d}},ct=t=>{const{libraries:r}=h.useContext(k),a=(t==null?void 0:t.axios)||(r==null?void 0:r.axios),i=(t==null?void 0:t.localStorageKey)||"user";if(!a)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const o=h.useCallback(({tokenType:f,accessToken:d})=>{a.defaults.headers.common.Authorization=`${f} ${d}`},[a.defaults.headers.common]),l=()=>{a.defaults.headers.common.Authorization=null};return h.useEffect(()=>{const f=({newValue:d,key:u})=>{if(u===i&&d)try{const{accessToken:E,tokenType:g}=JSON.parse(d);o({accessToken:E,tokenType:g})}catch(E){console.error("Failed to parse newValue from localStorage:",E)}};return window.addEventListener("storage",f),()=>{window.removeEventListener("storage",f)}},[i,o]),{clearAuthenticationToken:l,setAuthenticationToken:o}},ge=({library:t,date:r,format:a="ll"})=>t(r).format(a),he=(t,r="km")=>{const a=Number(t);return Number.isNaN(a)?`0 ${r}`:`${a.toFixed(2)} ${r}`},ye=t=>!t||typeof t!="string"?"":t.replace(/_/g," ").split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" "),st=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,ut=({path:t,size:r,apiURL:a})=>{if(!t)return"";const i=st(t),o=`${a}${i}`,l=o.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof r=="number"&&l?`${o.replace("/files",`/thumbs/${r}`)}`:o},lt=t=>{const{apiURL:r,libraries:a}=h.useContext(k),i=(t==null?void 0:t.dayjs)||(a==null?void 0:a.dayjs);return{dateAdapter:(f,d)=>{if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return ge({date:f,format:d,library:i})},distanceAdapter:he,filePathAdapter:(f,d)=>{if(!r)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return ut({apiURL:r,path:f,size:d})},worksiteNameAdapter:ye}},H=(t,r)=>r==="short"?t.split("-")[0]:t,ft=(t,r="full")=>{const[a,i]=h.useState(()=>{const o=(t==null?void 0:t.language)||navigator.language;return t&&"isInitialized"in t&&t.isInitialized,H(o,r)});return h.useEffect(()=>{var l;t&&"isInitialized"in t&&t.isInitialized&&t.language&&i(H(t.language,r));const o=f=>{i(H(f,r))};return(l=t==null?void 0:t.on)==null||l.call(t,"languageChanged",o),()=>{var f;(f=t==null?void 0:t.off)==null||f.call(t,"languageChanged",o)}},[t,r]),a},dt="tracktor.filter",me=(t,r,a)=>`${a}_${t}=>${r}`,vt=t=>{const{libraries:r,localStorageKeys:a}=h.useContext(k),i=(t==null?void 0:t.reactRouter)||(r==null?void 0:r.reactRouter),{useLocation:o,useSearchParams:l}=i,{pathname:f}=o(),[d,u]=l(),E=(a==null?void 0:a.filter)||dt;if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const g=(b,C,T=!0)=>{const y=me(b,(t==null?void 0:t.pathname)||f,E);if(!C||Array.isArray(C)&&!C.length){d.delete(b),u(d),localStorage.removeItem(y);return}T&&C&&localStorage.setItem(y,JSON.stringify({...d,[b]:C})),C&&(d.set(b,JSON.stringify(C)),u(d))};return{getFilter:(b,C)=>{const T=d.get(b);if(T)try{return JSON.parse(T)}catch{return T}const y=me(b,(t==null?void 0:t.pathname)||f,E),p=localStorage.getItem(y);if(p)try{return JSON.parse(p)[b]}catch{}return C},getFilters:()=>{const b=Object.fromEntries(d.entries()),T=Object.keys(localStorage).filter(y=>y.startsWith(E)&&y.endsWith((t==null?void 0:t.pathname)||f)).reduce((y,p)=>{var L,N;const D=localStorage.getItem(p);if(D){const Y=JSON.parse(D),x=(L=Object.keys(Y))==null?void 0:L[0];y[x]=(N=Object.values(Y))==null?void 0:N[0]}return y},{});return{...b,...T}},handleFilter:(b,C)=>(T,y)=>{if(y||Array.isArray(y)&&y.length===0){const p=C||"value",D=typeof y=="object"&&p in y?y[p||"value"]:y;g(b,D);return}g(b,void 0)},setFilter:g}},gt=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),ht=t=>{const i=t.split("/").filter(o=>o.length>0).map(o=>o.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return i.charAt(0).toLowerCase()+i.slice(1)},yt=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),mt=(t,r,a)=>{const i=ht(r),o=gt(a);return`${i}${o}`},Et=t=>{if(t)return(t==null?void 0:t.reduce((r,a)=>(r[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},r),{}))||{}},wt=t=>(Array.isArray(t)?t:[t]).reduce((a,i)=>{const{output:o,operationsToGenerateInfiniteQueryHook:l,input:f="./openapi.json"}=i||{},d=yt(f);return{...a,[d]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:f,output:{baseUrl:o==null?void 0:o.baseUrl,client:"react-query",mode:"tags-split",override:{...(l==null?void 0:l.length)&&{operations:Et(l)},header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/axiosCustomInstance.ts`},operationName:mt,query:{useQuery:!0}},schemas:(o==null?void 0:o.schemas)||`src/api/${d}/model`,target:(o==null?void 0:o.target)||`src/api/${d}/services/api.ts`,...o}}}},{});_.GTMSendPageView=Ke,_.InitializeAxiosConfig=He,_.InitializeDaysJSConfig=et,_.InitializeI18nConfig=Xe,_.InitializeMapBoxConfig=qe,_.InitializeSentryConfig=Ze,_.InjectDependenciesContext=k,_.InjectDependenciesProvider=Ge,_.MaskTextField=$e,_.PreloadErrorHandler=tt,_.QueryClientProviderWithConfig=at,_.RequireAuth=Be,_.dateAdapter=ge,_.distanceAdapter=he,_.getOrvalConfig=wt,_.useAdapter=lt,_.useAuth=ct,_.useCurrentLanguage=ft,_.useFilters=vt,_.useInfiniteDataGrid=it,_.useResponseError=ot,_.worksiteNameAdapter=ye,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
25
+ Check the top-level render call using <`+c+">.")}return n}}function Ye(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=Wt(n);if(Ne[c])return;Ne[c]=!0;var v="";e&&e._owner&&e._owner!==ue.current&&(v=" It was passed a child from "+z(e._owner.type)+"."),U(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,v),U(null)}}function We(e,n){{if(typeof e!="object")return;if(ce(e))for(var c=0;c<e.length;c++){var v=e[c];fe(v)&&Ye(v,n)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var R=T(e);if(typeof R=="function"&&R!==e.entries)for(var S=R.call(e),w;!(w=S.next()).done;)fe(w.value)&&Ye(w.value,n)}}}function zt(e){{var n=e.type;if(n==null||typeof n=="string")return;var c;if(typeof n=="function")c=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===u||n.$$typeof===P))c=n.propTypes;else return;if(c){var v=z(n);Pt(c,e.props,"prop",v,e)}else if(n.PropTypes!==void 0&&!le){le=!0;var R=z(n);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Mt(e){{for(var n=Object.keys(e.props),c=0;c<n.length;c++){var v=n[c];if(v!=="children"&&v!=="key"){U(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),U(null);break}}e.ref!==null&&(U(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}function ze(e,n,c,v,R,S){{var w=X(e);if(!w){var m="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(m+=" 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 I=Yt();I?m+=I:m+=Le();var O;e===null?O="null":ce(e)?O="array":e!==void 0&&e.$$typeof===r?(O="<"+(z(e.type)||"Unknown")+" />",m=" Did you accidentally export a JSX literal instead of a component?"):O=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",O,m)}var A=Nt(e,n,c,R,S);if(A==null)return A;if(w){var F=n.children;if(F!==void 0)if(v)if(ce(F)){for(var G=0;G<F.length;G++)We(F[G],e);Object.freeze&&Object.freeze(F)}else p("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 We(F,e)}return e===i?Mt(A):zt(A),A}}function Vt(e,n,c){return ze(e,n,c,!0)}function Ut(e,n,c){return ze(e,n,c,!1)}var Gt=Ut,Jt=Vt;B.Fragment=i,B.jsx=Gt,B.jsxs=Jt}()),B}process.env.NODE_ENV==="production"?re.exports=Ve():re.exports=Ue();var W=re.exports;const k=h.createContext({}),Ge=({children:t,apiURL:r,libraries:a,localStorageKeys:i})=>{const o=h.useMemo(()=>({apiURL:r,libraries:a,localStorageKeys:i}),[r,a,i]);return W.jsx(k.Provider,{value:o,children:t})},Je="user",Be=({Fallback:t,isLogged:r,loginPath:a="/login",redirect401Path:i="/login",...o})=>{var D,L,N,Y;const{libraries:l,localStorageKeys:f}=h.useContext(k),d=(o==null?void 0:o.reactRouter)||(l==null?void 0:l.reactRouter),u=(o==null?void 0:o.axios)||(l==null?void 0:l.axios),E=(o==null?void 0:o.localStorageKey)||(f==null?void 0:f.user)||Je;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[g,P]=h.useState(null),{useLocation:j,Navigate:s,Outlet:b}=d,C=j(),T=h.useRef(!1),y=typeof r=="function"?r():!!r,p=typeof y=="boolean"?y:y==null?void 0:y.isLogged;return h.useEffect(()=>{T.current||(T.current=!0,u.interceptors.response.use(x=>x,async x=>{var X;return typeof x=="object"&&x&&"response"in x&&x.response&&typeof x.response=="object"&&"status"in x.response&&x.response&&typeof x.response=="object"&&"status"in x.response&&((X=x==null?void 0:x.response)==null?void 0:X.status)===401&&(u.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(E),P(i)),Promise.reject(x)}))},[u.defaults.headers.common,u.interceptors.response,E,i]),p&&!g?W.jsx(h.Suspense,{fallback:t,children:(L=(D=C.state)==null?void 0:D.from)!=null&&L.state&&((Y=(N=C.state)==null?void 0:N.from)==null?void 0:Y.pathname)===a?W.jsx(s,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):W.jsx(b,{})}):W.jsx(s,{to:a+C.search,state:{from:C},replace:!0})},Ke=({data:t,...r})=>{const{libraries:a}=h.useContext(k),i=(r==null?void 0:r.reactRouter)||(a==null?void 0:a.reactRouter),o=(r==null?void 0:r.gtm)||(a==null?void 0:a.gtm);if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!o)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:l}=o,{useLocation:f,Outlet:d}=i,{pathname:u}=f(),{sendEvent:E}=l();return h.useEffect(()=>{E({event:"pageView",pathname:u,...t})},[t,u,E]),W.jsx(d,{})},Qe="user",He=({tokenTypeKey:t="tokenType",tokenKey:r="accessToken",postContentType:a="application/json",...i})=>{const{apiURL:o=i.apiURL,libraries:l,localStorageKeys:f}=h.useContext(k),d=(i==null?void 0:i.userLocalStorageKey)||(f==null?void 0:f.user)||Qe,u=(i==null?void 0:i.axios)||(l==null?void 0:l.axios);if(!u)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(u!=null&&u.defaults))return null;if(typeof window<"u"&&window.localStorage){const E=localStorage.getItem(d),g=E?JSON.parse(E):null,P=g!=null&&g[t]?g[t]:null,j=g!=null&&g[r]?g[r]:null,s=E?`${P} ${j}`:null;s&&(u.defaults.headers.common.Authorization=s)}return u.defaults.baseURL=o,u.defaults.headers.post["Content-Type"]=a,null},Xe=({debug:t,resources:r,...a})=>{const{libraries:i}=h.useContext(k),o=(a==null?void 0:a.i18)||(i==null?void 0:i.i18),{i18next:l,initReactI18next:f,languageDetector:d}=o||{};if(!o)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return l!=null&&l.isInitialized||(l.use(d).use(f).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==l.resolvedLanguage&&l.resolvedLanguage&&document.documentElement.setAttribute("lang",l.resolvedLanguage)}),l.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},Ze=({dsn:t,integrations:r,tracesSampleRate:a,replaysSessionSampleRate:i,replaysOnErrorSampleRate:o,tracePropagationTargets:l,ignoreErrors:f,debug:d,environment:u,release:E,...g})=>{const{libraries:P}=h.useContext(k),j=(g==null?void 0:g.sentry)||(P==null?void 0:P.sentry),s=(g==null?void 0:g.reactRouter)||(P==null?void 0:P.reactRouter);if(!j)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(j.isInitialized())return null;const{createRoutesFromChildren:b,matchRoutes:C,useLocation:T,useNavigationType:y}=s;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&j.init({debug:d,dsn:t,environment:u||"production",ignoreErrors:[...f||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[j.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:b,matchRoutes:C,useEffect:h.useEffect,useLocation:T,useNavigationType:y}),...r||[]],release:E,replaysOnErrorSampleRate:o||1,replaysSessionSampleRate:i||.1,tracePropagationTargets:l,tracesSampleRate:a||1}),null},$e=({IMaskMixin:t,...r})=>{const a=h.useMemo(()=>t(({TextField:i,...o})=>W.jsx(i,{...o})),[t]);return W.jsx(a,{...r})},qe=({accessToken:t,...r})=>{const{libraries:a}=h.useContext(k),i=(r==null?void 0:r.mapbox)||(a==null?void 0:a.mapbox);if(!i)throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return t&&(i.accessToken=t),null},et=({language:t,...r})=>{const{libraries:a}=h.useContext(k),i=(r==null?void 0:r.dayjs)||(a==null?void 0:a.dayjs),o=(r==null?void 0:r.plugin)||(a==null?void 0:a.dayjsPlugin);if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return h.useEffect(()=>{(async()=>{var d;const f=t||((d=navigator.language)==null?void 0:d.slice(0,2))||"en";o&&o.forEach(u=>{u&&i.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),i.locale(f)})().then()},[i,o,t]),null},tt=()=>(h.useEffect(()=>{const t=r=>{try{r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),null),rt=t=>t&&typeof t=="function",nt=t=>t&&typeof t=="function",at=({children:t,defaultQueriesOptions:r,defaultMutationsOptions:a,...i})=>{var u,E;const{libraries:o}=h.useContext(k),l=(i==null?void 0:i.QueryClient)||((u=o==null?void 0:o.reactQuery)==null?void 0:u.QueryClient),f=(i==null?void 0:i.QueryClientProvider)||((E=o==null?void 0:o.reactQuery)==null?void 0:E.QueryClientProvider);if(!l)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!f)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!rt(f))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!nt(l))throw new Error("Provided QueryClient dependencies are not valid.");const d=new l({defaultOptions:{mutations:{...a},queries:{getNextPageParam:(g,P,j)=>g.length+(j||0),refetchOnWindowFocus:!1,retry:3,...r}}});return W.jsx(f,{client:d,children:t})},ot=t=>{var E,g,P;const{libraries:r}=h.useContext(k),a=(t==null?void 0:t.i18)||(r==null?void 0:r.i18),i=((E=t==null?void 0:t.i18)==null?void 0:E.translateFunction)||((g=r==null?void 0:r.i18)==null?void 0:g.translateFunction),o=((P=a==null?void 0:a.i18next)==null?void 0:P.t)||i||(j=>j),{unknownErrorTranslationKey:l="error.unknownError"}=t||{},f=o(l),d=h.useCallback(j=>{var b,C,T,y,p,D,L,N,Y;const{response:s}=j||{};return s!=null&&s.reason?String(s.reason):(b=s==null?void 0:s.data)!=null&&b.reason?String(s.data.reason):(C=s==null?void 0:s.data)!=null&&C.message?String(s.data.message):(y=(T=s==null?void 0:s.data)==null?void 0:T.detail)!=null&&y.length&&Array.isArray((p=s==null?void 0:s.data)==null?void 0:p.detail)&&((L=(D=s==null?void 0:s.data)==null?void 0:D.detail[0])!=null&&L.msg)&&typeof((Y=(N=s==null?void 0:s.data)==null?void 0:N.detail[0])==null?void 0:Y.msg)=="string"?String(s.data.detail[0].msg):f},[f]);return{getErrorCode:h.useCallback(j=>{var b,C,T;const{response:s}=j||{};return s!=null&&s.error_code?String(s==null?void 0:s.error_code):(b=s==null?void 0:s.data)!=null&&b.error_code?String((C=s==null?void 0:s.data)==null?void 0:C.error_code):s!=null&&s.error_code?String(s==null?void 0:s.error_code):(T=s==null?void 0:s.data)!=null&&T.error_code?String(s.data.error_code):"unknown_error_code"},[]),printError:d}},it=({data:t,fetchNextPage:r,isFetchingNextPage:a,isInitialLoading:i,isLoading:o,enabled:l=!0})=>{const f=h.useCallback(async u=>{a||!l||await r({pageParam:(u==null?void 0:u.pageParam)||u.visibleRowsCount})},[l,r,a]),d=h.useMemo(()=>{if(t)return t.pages.reduce((u,E)=>[...u,...E],[])},[t]);return{fetchNextPageOnRowsScrollEnd:f,isLoading:a||o,loadingVariant:i?"skeleton":"linear",rows:d}},ct=t=>{const{libraries:r}=h.useContext(k),a=(t==null?void 0:t.axios)||(r==null?void 0:r.axios),i=(t==null?void 0:t.localStorageKey)||"user";if(!a)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const o=h.useCallback(({tokenType:f,accessToken:d})=>{a.defaults.headers.common.Authorization=`${f} ${d}`},[a.defaults.headers.common]),l=()=>{a.defaults.headers.common.Authorization=null};return h.useEffect(()=>{const f=({newValue:d,key:u})=>{if(u===i&&d)try{const{accessToken:E,tokenType:g}=JSON.parse(d);o({accessToken:E,tokenType:g})}catch(E){console.error("Failed to parse newValue from localStorage:",E)}};return window.addEventListener("storage",f),()=>{window.removeEventListener("storage",f)}},[i,o]),{clearAuthenticationToken:l,setAuthenticationToken:o}},ge=({library:t,date:r,format:a="ll"})=>t(r).format(a),he=(t,r="km")=>{const a=Number(t);return Number.isNaN(a)?`0 ${r}`:`${a.toFixed(2)} ${r}`},ye=t=>!t||typeof t!="string"?"":t.replace(/_/g," ").split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" "),st=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,ut=({path:t,size:r,apiURL:a})=>{if(!t)return"";const i=st(t),o=`${a}${i}`,l=o.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof r=="number"&&l?`${o.replace("/files",`/thumbs/${r}`)}`:o},lt=t=>{const{apiURL:r,libraries:a}=h.useContext(k),i=(t==null?void 0:t.dayjs)||(a==null?void 0:a.dayjs);return{dateAdapter:(f,d)=>{if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return ge({date:f,format:d,library:i})},distanceAdapter:he,filePathAdapter:(f,d)=>{if(!r)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return ut({apiURL:r,path:f,size:d})},worksiteNameAdapter:ye}},H=(t,r)=>r==="short"?t.split("-")[0]:t,ft=(t,r="full")=>{const[a,i]=h.useState(()=>{const o=(t==null?void 0:t.language)||navigator.language;return t&&"isInitialized"in t&&t.isInitialized,H(o,r)});return h.useEffect(()=>{var l;t&&"isInitialized"in t&&t.isInitialized&&t.language&&i(H(t.language,r));const o=f=>{i(H(f,r))};return(l=t==null?void 0:t.on)==null||l.call(t,"languageChanged",o),()=>{var f;(f=t==null?void 0:t.off)==null||f.call(t,"languageChanged",o)}},[t,r]),a},dt="tracktor.filter",me=(t,r,a)=>`${a}_${t}=>${r}`,vt=t=>{const{libraries:r,localStorageKeys:a}=h.useContext(k),i=(t==null?void 0:t.reactRouter)||(r==null?void 0:r.reactRouter),{useLocation:o,useSearchParams:l}=i,{pathname:f}=o(),[d,u]=l(),E=(a==null?void 0:a.filter)||dt;if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const g=(b,C,T=!0)=>{const y=me(b,(t==null?void 0:t.pathname)||f,E);if(!C||Array.isArray(C)&&!C.length){d.delete(b),u(d),localStorage.removeItem(y);return}T&&C&&localStorage.setItem(y,JSON.stringify({...d,[b]:C})),C&&(d.set(b,JSON.stringify(C)),u(d))};return{getFilter:(b,C)=>{const T=d.get(b);if(T)try{return JSON.parse(T)}catch{return T}const y=me(b,(t==null?void 0:t.pathname)||f,E),p=localStorage.getItem(y);if(p)try{return JSON.parse(p)[b]}catch{}return C},getFilters:()=>{const b=Object.fromEntries(d.entries()),T=Object.keys(localStorage).filter(y=>y.startsWith(E)&&y.endsWith((t==null?void 0:t.pathname)||f)).reduce((y,p)=>{var L,N;const D=localStorage.getItem(p);if(D){const Y=JSON.parse(D),x=(L=Object.keys(Y))==null?void 0:L[0];y[x]=(N=Object.values(Y))==null?void 0:N[0]}return y},{});return{...b,...T}},handleFilter:(b,C)=>(T,y)=>{if(y||Array.isArray(y)&&y.length===0){const p=C||"value",D=typeof y=="object"&&p in y?y[p||"value"]:y;g(b,D);return}g(b,void 0)},setFilter:g}},gt=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),ht=t=>{const i=t.split("/").filter(o=>o.length>0).map(o=>o.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return i.charAt(0).toLowerCase()+i.slice(1)},yt=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),mt=(t,r,a)=>{const i=ht(r),o=gt(a);return`${i}${o}`},Et=t=>{if(t)return(t==null?void 0:t.reduce((r,a)=>(r[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},r),{}))||{}},wt=t=>(Array.isArray(t)?t:[t]).reduce((a,i)=>{const{output:o,operationsToGenerateInfiniteQueryHook:l,input:f="./openapi.json"}=i||{},d=yt(f);return{...a,[d]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:f,output:{baseUrl:o==null?void 0:o.baseUrl,client:"react-query",mode:"tags-split",override:{...(l==null?void 0:l.length)&&{operations:Et(l)},header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/axiosCustomInstance.ts`},operationName:mt,query:{useQuery:!0}},schemas:(o==null?void 0:o.schemas)||`src/api/${d}/model`,target:(o==null?void 0:o.target)||`src/api/${d}/services/api.ts`,...o}}}},{});_.GTMSendPageView=Ke,_.InitializeAxiosConfig=He,_.InitializeDaysJSConfig=et,_.InitializeI18nConfig=Xe,_.InitializeMapBoxConfig=qe,_.InitializeSentryConfig=Ze,_.InjectDependenciesContext=k,_.InjectDependenciesProvider=Ge,_.MaskTextField=$e,_.PreloadErrorHandler=tt,_.QueryClientProviderWithConfig=at,_.RequireAuth=Be,_.dateAdapter=ge,_.distanceAdapter=he,_.getOrvalConfig=wt,_.useAdapter=lt,_.useAuth=ct,_.useCurrentLanguage=ft,_.useFilters=vt,_.useInfiniteDataGrid=it,_.useResponseError=ot,_.worksiteNameAdapter=ye,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tracktor/shared-module",
3
- "version": "2.9.2",
3
+ "version": "2.9.3",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "types": "./dist/main.d.ts",