@tracktor/shared-module 0.19.0 → 0.19.2
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 +3 -5
- package/dist/main.js +71 -71
- package/dist/main.umd.cjs +4 -4
- package/dist/utils/adapter/filePathAdapter.d.ts +2 -2
- package/dist/utils/adapter/index.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# [Versions](https://github.com/Tracktor/shared-module/releases)
|
|
2
2
|
|
|
3
|
-
## v0.19.
|
|
4
|
-
- **[
|
|
5
|
-
|
|
6
|
-
- **[feat]** : add `filePathAdapter` from `useAdapter` hook
|
|
7
|
-
- **[feat]** : add `distanceAdapter` from `useAdapter` hook
|
|
3
|
+
## v0.19.2
|
|
4
|
+
- **[fix]** : filePathAdapter
|
|
5
|
+
__
|
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, u = Symbol.for("react.element"),
|
|
15
|
+
var t = Ne, u = Symbol.for("react.element"), o = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), f = 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";
|
|
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 ===
|
|
43
|
+
return !!(typeof e == "string" || typeof e == "function" || e === i || e === f || Me || e === s || 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
|
|
44
44
|
// types supported by any Flight configuration anywhere since
|
|
45
45
|
// we don't know which Flight build this will end up being used
|
|
46
46
|
// with.
|
|
@@ -64,9 +64,9 @@ function Rr() {
|
|
|
64
64
|
if (typeof e == "string")
|
|
65
65
|
return e;
|
|
66
66
|
switch (e) {
|
|
67
|
-
case o:
|
|
68
|
-
return "Fragment";
|
|
69
67
|
case i:
|
|
68
|
+
return "Fragment";
|
|
69
|
+
case o:
|
|
70
70
|
return "Portal";
|
|
71
71
|
case f:
|
|
72
72
|
return "Profiler";
|
|
@@ -583,7 +583,7 @@ Check the top-level render call using <` + a + ">.");
|
|
|
583
583
|
else
|
|
584
584
|
ke(S, e);
|
|
585
585
|
}
|
|
586
|
-
return e ===
|
|
586
|
+
return e === i ? cr(R) : sr(R), R;
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
589
|
function lr(e, r, a) {
|
|
@@ -593,7 +593,7 @@ Check the top-level render call using <` + a + ">.");
|
|
|
593
593
|
return $e(e, r, a, !1);
|
|
594
594
|
}
|
|
595
595
|
var dr = fr, vr = lr;
|
|
596
|
-
M.Fragment =
|
|
596
|
+
M.Fragment = i, M.jsx = dr, M.jsxs = vr;
|
|
597
597
|
}()), M;
|
|
598
598
|
}
|
|
599
599
|
var V = {};
|
|
@@ -611,18 +611,18 @@ function br() {
|
|
|
611
611
|
if (Le)
|
|
612
612
|
return V;
|
|
613
613
|
Le = 1;
|
|
614
|
-
var t = Ne, u = Symbol.for("react.element"),
|
|
614
|
+
var t = Ne, u = Symbol.for("react.element"), o = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, s = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
615
615
|
function h(n, l, m) {
|
|
616
616
|
var E, C = {}, O = null, T = null;
|
|
617
617
|
m !== void 0 && (O = "" + m), l.key !== void 0 && (O = "" + l.key), l.ref !== void 0 && (T = l.ref);
|
|
618
618
|
for (E in l)
|
|
619
|
-
|
|
619
|
+
i.call(l, E) && !f.hasOwnProperty(E) && (C[E] = l[E]);
|
|
620
620
|
if (n && n.defaultProps)
|
|
621
621
|
for (E in l = n.defaultProps, l)
|
|
622
622
|
C[E] === void 0 && (C[E] = l[E]);
|
|
623
623
|
return { $$typeof: u, type: n, key: O, ref: T, props: C, _owner: s.current };
|
|
624
624
|
}
|
|
625
|
-
return V.Fragment =
|
|
625
|
+
return V.Fragment = o, V.jsx = h, V.jsxs = h, V;
|
|
626
626
|
}
|
|
627
627
|
process.env.NODE_ENV === "production" ? ue.exports = br() : ue.exports = Rr();
|
|
628
628
|
var x = ue.exports;
|
|
@@ -638,8 +638,8 @@ const q = pr({
|
|
|
638
638
|
}), Sr = ({
|
|
639
639
|
axios: t,
|
|
640
640
|
children: u,
|
|
641
|
-
translate:
|
|
642
|
-
useAuth:
|
|
641
|
+
translate: o,
|
|
642
|
+
useAuth: i,
|
|
643
643
|
Outlet: s,
|
|
644
644
|
Navigate: f,
|
|
645
645
|
useLocation: h,
|
|
@@ -652,19 +652,19 @@ const q = pr({
|
|
|
652
652
|
axios: t,
|
|
653
653
|
Navigate: f,
|
|
654
654
|
Outlet: s,
|
|
655
|
-
translate:
|
|
656
|
-
useAuth:
|
|
655
|
+
translate: o,
|
|
656
|
+
useAuth: i,
|
|
657
657
|
useGoogleTagManager: n,
|
|
658
658
|
useLocation: h
|
|
659
659
|
}),
|
|
660
|
-
[f, s, l, t,
|
|
660
|
+
[f, s, l, t, o, i, n, h]
|
|
661
661
|
);
|
|
662
662
|
return /* @__PURE__ */ x.jsx(q.Provider, { value: m, children: u });
|
|
663
663
|
}, H = (t) => `RequireAuth require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`, jr = ({
|
|
664
664
|
Fallback: t,
|
|
665
665
|
loginPath: u = "/login",
|
|
666
|
-
localStorageKey:
|
|
667
|
-
redirect401Path:
|
|
666
|
+
localStorageKey: o = "user",
|
|
667
|
+
redirect401Path: i = "/login",
|
|
668
668
|
...s
|
|
669
669
|
}) => {
|
|
670
670
|
var $, F, j, b;
|
|
@@ -689,45 +689,45 @@ const q = pr({
|
|
|
689
689
|
(_) => _,
|
|
690
690
|
async (_) => {
|
|
691
691
|
var U;
|
|
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 && (f.defaults.headers.common.Authorization = null, localStorage.removeItem(
|
|
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 && (f.defaults.headers.common.Authorization = null, localStorage.removeItem(o), C(i)), Promise.reject(_);
|
|
693
693
|
}
|
|
694
694
|
));
|
|
695
|
-
}, [f == null ? void 0 : f.defaults.headers.common, f == null ? void 0 : f.interceptors.response,
|
|
695
|
+
}, [f == null ? void 0 : f.defaults.headers.common, f == null ? void 0 : f.interceptors.response, o, i]), 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) === u ? /* @__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: u, state: { from: T }, replace: !0 });
|
|
696
696
|
}, ie = (t) => `GTMSendPageView require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`, Pr = ({ ...t }) => {
|
|
697
697
|
const {
|
|
698
698
|
useLocation: u = t.useLocation,
|
|
699
|
-
Outlet:
|
|
700
|
-
useGoogleTagManager:
|
|
699
|
+
Outlet: o = t.Outlet,
|
|
700
|
+
useGoogleTagManager: i = t.useGoogleTagManager
|
|
701
701
|
} = K(q);
|
|
702
702
|
if (u === void 0)
|
|
703
703
|
throw new Error(ie("useLocation"));
|
|
704
|
-
if (i === void 0)
|
|
705
|
-
throw new Error(ie("Outlet"));
|
|
706
704
|
if (o === void 0)
|
|
705
|
+
throw new Error(ie("Outlet"));
|
|
706
|
+
if (i === void 0)
|
|
707
707
|
throw new Error(ie("useGoogleTagManager"));
|
|
708
|
-
const { pathname: s } = u(), { sendEvent: f } =
|
|
708
|
+
const { pathname: s } = u(), { sendEvent: f } = i();
|
|
709
709
|
return yr(() => {
|
|
710
710
|
f({ event: "pageView", pathname: s });
|
|
711
|
-
}, [s, f]), /* @__PURE__ */ x.jsx(
|
|
711
|
+
}, [s, f]), /* @__PURE__ */ x.jsx(o, {});
|
|
712
712
|
}, Ar = ({
|
|
713
713
|
axios: t,
|
|
714
714
|
baseURL: u,
|
|
715
|
-
tokenTypeKey:
|
|
716
|
-
userLocalStorageKey:
|
|
715
|
+
tokenTypeKey: o = "tokenType",
|
|
716
|
+
userLocalStorageKey: i = "user",
|
|
717
717
|
tokenKey: s = "accessToken",
|
|
718
718
|
postContentType: f = "application/json"
|
|
719
719
|
}) => {
|
|
720
720
|
if (!t.defaults)
|
|
721
721
|
return null;
|
|
722
|
-
const h = localStorage.getItem(
|
|
722
|
+
const h = localStorage.getItem(i), n = h ? JSON.parse(h) : null, l = n != null && n[o] ? n[o] : null, m = n != null && n[s] ? n[s] : null, E = h ? `${l} ${m}` : null;
|
|
723
723
|
return t.defaults.baseURL = u, t.defaults.headers.post["Content-Type"] = f, E && (t.defaults.headers.common.Authorization = E), null;
|
|
724
724
|
}, xr = ({
|
|
725
725
|
i18n: t,
|
|
726
726
|
debug: u,
|
|
727
|
-
initReactI18next:
|
|
728
|
-
resources:
|
|
727
|
+
initReactI18next: o,
|
|
728
|
+
resources: i,
|
|
729
729
|
LanguageDetector: s
|
|
730
|
-
}) => (t != null && t.isInitialized || (t.use(s).use(
|
|
730
|
+
}) => (t != null && t.isInitialized || (t.use(s).use(o).init({
|
|
731
731
|
debug: u,
|
|
732
732
|
fallbackLng: "en",
|
|
733
733
|
interpolation: {
|
|
@@ -738,7 +738,7 @@ const q = pr({
|
|
|
738
738
|
bindI18n: !1,
|
|
739
739
|
useSuspense: !0
|
|
740
740
|
},
|
|
741
|
-
resources:
|
|
741
|
+
resources: i,
|
|
742
742
|
returnNull: !1
|
|
743
743
|
}).then(() => {
|
|
744
744
|
document.documentElement.lang !== t.resolvedLanguage && t.resolvedLanguage && document.documentElement.setAttribute("lang", t.resolvedLanguage);
|
|
@@ -747,8 +747,8 @@ const q = pr({
|
|
|
747
747
|
})), null), kr = ({
|
|
748
748
|
dsn: t,
|
|
749
749
|
sentry: u,
|
|
750
|
-
integrations:
|
|
751
|
-
tracesSampleRate:
|
|
750
|
+
integrations: o,
|
|
751
|
+
tracesSampleRate: i,
|
|
752
752
|
routingInstrumentationDependencies: s,
|
|
753
753
|
replaysSessionSampleRate: f,
|
|
754
754
|
replaysOnErrorSampleRate: h,
|
|
@@ -770,26 +770,26 @@ const q = pr({
|
|
|
770
770
|
)
|
|
771
771
|
}),
|
|
772
772
|
u.replayIntegration(),
|
|
773
|
-
...
|
|
773
|
+
...o || []
|
|
774
774
|
],
|
|
775
775
|
replaysOnErrorSampleRate: h || 1,
|
|
776
776
|
replaysSessionSampleRate: f || 0.1,
|
|
777
777
|
tracePropagationTargets: n,
|
|
778
|
-
tracesSampleRate:
|
|
778
|
+
tracesSampleRate: i || 1
|
|
779
779
|
}), null), $r = ({ IMaskMixin: t, ...u }) => {
|
|
780
|
-
const
|
|
780
|
+
const o = se(
|
|
781
781
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
782
|
-
() => t(({ TextField:
|
|
782
|
+
() => t(({ TextField: i, ...s }) => /* @__PURE__ */ x.jsx(i, { ...s })),
|
|
783
783
|
[t]
|
|
784
784
|
);
|
|
785
|
-
return /* @__PURE__ */ x.jsx(
|
|
785
|
+
return /* @__PURE__ */ x.jsx(o, { ...u });
|
|
786
786
|
}, Fr = ({ mapbox: t, accessToken: u }) => (t && u && (t.accessToken = u), null), Dr = ({
|
|
787
787
|
children: t,
|
|
788
788
|
defaultOptions: u,
|
|
789
|
-
QueryClient:
|
|
790
|
-
QueryClientProvider:
|
|
789
|
+
QueryClient: o,
|
|
790
|
+
QueryClientProvider: i
|
|
791
791
|
}) => {
|
|
792
|
-
const s = new
|
|
792
|
+
const s = new o({
|
|
793
793
|
defaultOptions: {
|
|
794
794
|
queries: {
|
|
795
795
|
refetchOnWindowFocus: !1,
|
|
@@ -798,51 +798,51 @@ const q = pr({
|
|
|
798
798
|
}
|
|
799
799
|
}
|
|
800
800
|
});
|
|
801
|
-
return /* @__PURE__ */ x.jsx(
|
|
801
|
+
return /* @__PURE__ */ x.jsx(i, { client: s, children: t });
|
|
802
802
|
}, Lr = (t) => {
|
|
803
|
-
const { unknownErrorTranslationKey: u = "error.unknownError" } = t || {}, { translate:
|
|
803
|
+
const { unknownErrorTranslationKey: u = "error.unknownError" } = t || {}, { translate: o = t == null ? void 0 : t.translate } = K(q), i = o ? o(u) : "Unknown error", s = Y(
|
|
804
804
|
(h) => {
|
|
805
805
|
var l, m, E, C, O, T, k, $, F;
|
|
806
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) :
|
|
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) : i;
|
|
808
808
|
},
|
|
809
|
-
[
|
|
809
|
+
[i]
|
|
810
810
|
), f = Y(
|
|
811
811
|
(h) => {
|
|
812
812
|
var l, m, E;
|
|
813
813
|
const { response: n } = h || {};
|
|
814
|
-
return
|
|
814
|
+
return o && (n != null && n.error_code) ? o(n == null ? void 0 : n.error_code) : o && ((l = n == null ? void 0 : n.data) != null && l.error_code) ? o((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) : i;
|
|
815
815
|
},
|
|
816
|
-
[
|
|
816
|
+
[i, o]
|
|
817
817
|
);
|
|
818
818
|
return { printError: s, printErrorCode: f };
|
|
819
819
|
}, Ir = ({
|
|
820
820
|
data: t,
|
|
821
821
|
fetchNextPage: u,
|
|
822
|
-
isFetchingNextPage:
|
|
823
|
-
isInitialLoading:
|
|
822
|
+
isFetchingNextPage: o,
|
|
823
|
+
isInitialLoading: i,
|
|
824
824
|
isLoading: s,
|
|
825
825
|
enabled: f = !0
|
|
826
826
|
}) => {
|
|
827
827
|
const h = Y(
|
|
828
828
|
async (l) => {
|
|
829
|
-
|
|
829
|
+
o || !f || await u({ pageParam: (l == null ? void 0 : l.pageParam) || l.visibleRowsCount });
|
|
830
830
|
},
|
|
831
|
-
[f, u,
|
|
831
|
+
[f, u, o]
|
|
832
832
|
), n = se(() => {
|
|
833
833
|
if (t)
|
|
834
834
|
return t.pages.reduce((l, m) => [...l, ...m], []);
|
|
835
835
|
}, [t]);
|
|
836
836
|
return {
|
|
837
837
|
fetchNextPageOnRowsScrollEnd: h,
|
|
838
|
-
isLoading:
|
|
839
|
-
loadingVariant:
|
|
838
|
+
isLoading: o || s,
|
|
839
|
+
loadingVariant: i ? "skeleton" : "linear",
|
|
840
840
|
rows: n
|
|
841
841
|
};
|
|
842
842
|
}, Nr = (t) => {
|
|
843
843
|
const u = Y(
|
|
844
|
-
({ tokenType:
|
|
845
|
-
t.defaults.headers.common.Authorization = `${
|
|
844
|
+
({ tokenType: i, accessToken: s }) => {
|
|
845
|
+
t.defaults.headers.common.Authorization = `${i} ${s}`;
|
|
846
846
|
},
|
|
847
847
|
[t.defaults.headers.common]
|
|
848
848
|
);
|
|
@@ -855,30 +855,30 @@ const q = pr({
|
|
|
855
855
|
}, Ie = (t, u) => {
|
|
856
856
|
if (!t)
|
|
857
857
|
return "";
|
|
858
|
-
const
|
|
859
|
-
return typeof u == "number" ? `${
|
|
858
|
+
const o = typeof t == "object" && "pathname" in t ? `${t.origin}${t.pathname}` : t;
|
|
859
|
+
return typeof u == "number" ? `${o.replace("/files", `/thumbs/${u}`)}` : o;
|
|
860
860
|
}, Wr = () => {
|
|
861
861
|
const { apiURL: t } = K(q);
|
|
862
|
-
return { distanceAdapter: (
|
|
863
|
-
const f = Number(
|
|
862
|
+
return { distanceAdapter: (i, s = "km") => {
|
|
863
|
+
const f = Number(i);
|
|
864
864
|
return Number.isNaN(f) ? `0 ${s}` : `${f.toFixed(2)} ${s}`;
|
|
865
|
-
}, filePathAdapter: (
|
|
865
|
+
}, filePathAdapter: (i, s) => Ie(t && typeof i == "string" ? { origin: t, pathname: i } : i, s) };
|
|
866
866
|
}, _r = (t) => t.charAt(0).toUpperCase() + t.slice(1).toLowerCase(), wr = (t) => {
|
|
867
|
-
const
|
|
868
|
-
return
|
|
869
|
-
}, Cr = (t, u,
|
|
870
|
-
const
|
|
871
|
-
return `${
|
|
867
|
+
const i = t.split("/").filter((s) => s.length > 0).map((s) => s.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join("")).join("");
|
|
868
|
+
return i.charAt(0).toLowerCase() + i.slice(1);
|
|
869
|
+
}, Cr = (t, u, o) => {
|
|
870
|
+
const i = wr(u), s = _r(o);
|
|
871
|
+
return `${i}${s}`;
|
|
872
872
|
}, Tr = (t) => {
|
|
873
873
|
if (t)
|
|
874
|
-
return (t == null ? void 0 : t.reduce((u,
|
|
874
|
+
return (t == null ? void 0 : t.reduce((u, o) => (u[o] = {
|
|
875
875
|
query: {
|
|
876
876
|
useInfinite: !0,
|
|
877
877
|
useInfiniteQueryParam: "offset"
|
|
878
878
|
}
|
|
879
879
|
}, u), {})) || {};
|
|
880
880
|
}, Mr = (t) => {
|
|
881
|
-
const { input: u = "./openapi.json", operationsToGenerateInfiniteQueryHook:
|
|
881
|
+
const { input: u = "./openapi.json", operationsToGenerateInfiniteQueryHook: o = void 0 } = t || {};
|
|
882
882
|
return {
|
|
883
883
|
api: {
|
|
884
884
|
hooks: {
|
|
@@ -889,17 +889,17 @@ const q = pr({
|
|
|
889
889
|
client: "react-query",
|
|
890
890
|
mode: "tags-split",
|
|
891
891
|
override: {
|
|
892
|
-
header: (
|
|
892
|
+
header: (i) => [
|
|
893
893
|
"Generated by orval 🍺",
|
|
894
|
-
...
|
|
895
|
-
...
|
|
894
|
+
...i.title ? [i.title] : [],
|
|
895
|
+
...i.description ? [i.description] : []
|
|
896
896
|
],
|
|
897
897
|
mutator: {
|
|
898
898
|
name: "axiosCustomInstance",
|
|
899
899
|
path: `${__dirname}/config/orval/mutator/axiosCustomInstance.ts`
|
|
900
900
|
},
|
|
901
901
|
operationName: Cr,
|
|
902
|
-
...(
|
|
902
|
+
...(o == null ? void 0 : o.length) && { operations: Tr(o) },
|
|
903
903
|
query: {
|
|
904
904
|
useQuery: !0
|
|
905
905
|
}
|
package/dist/main.umd.cjs
CHANGED
|
@@ -6,17 +6,17 @@
|
|
|
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 Ne(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&function(){var t=h,u=Symbol.for("react.element"),
|
|
9
|
+
*/var ce;function Ne(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&function(){var t=h,u=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),f=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"),O=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),S=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),c=1;c<r;c++)a[c-1]=arguments[c];w("error",e,a)}}function w(e,r,a){{var c=k.ReactDebugCurrentFrame,p=c.getStackAddendum();p!==""&&(r+="%s",a=a.concat([p]));var g=a.map(function(v){return String(v)});g.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,g)}}var fe=!1,de=!1,J=!1,nr=!1,ar=!1,ve;ve=Symbol.for("react.module.reference");function or(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===f||ar||e===s||e===m||e===y||nr||e===S||fe||de||J||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===O||e.$$typeof===E||e.$$typeof===n||e.$$typeof===l||e.$$typeof===ve||e.getModuleId!==void 0))}function ir(e,r,a){var c=e.displayName;if(c)return c;var p=r.displayName||r.name||"";return p!==""?a+"("+p+")":a}function pe(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 i:return"Fragment";case o:return"Portal";case f:return"Profiler";case s:return"StrictMode";case m:return"Suspense";case y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case n:var r=e;return pe(r)+".Consumer";case E:var a=e;return pe(a._context)+".Provider";case l:return ir(e,e.render,"ForwardRef");case O:var c=e.displayName||null;return c!==null?c:x(e.type)||"Memo";case j:{var p=e,g=p._payload,v=p._init;try{return x(v(g))}catch{return null}}}return null}var N=Object.assign,z=0,ge,me,he,Ee,ye,be,Re;function _e(){}_e.__reactDisabledLog=!0;function ur(){{if(z===0){ge=console.log,me=console.info,he=console.warn,Ee=console.error,ye=console.group,be=console.groupCollapsed,Re=console.groupEnd;var e={configurable:!0,enumerable:!0,value:_e,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function sr(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:N({},e,{value:ge}),info:N({},e,{value:me}),warn:N({},e,{value:he}),error:N({},e,{value:Ee}),group:N({},e,{value:ye}),groupCollapsed:N({},e,{value:be}),groupEnd:N({},e,{value:Re})})}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 c=p.stack.trim().match(/\n( *(at )?)/);te=c&&c[1]||""}return`
|
|
10
10
|
`+te+e}}var ne=!1,X;{var cr=typeof WeakMap=="function"?WeakMap:Map;X=new cr}function Ce(e,r){if(!e||ne)return"";{var a=X.get(e);if(a!==void 0)return a}var c;ne=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var g;g=re.current,re.current=null,ur();try{if(r){var v=function(){throw Error()};if(Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[])}catch(D){c=D}Reflect.construct(e,[],v)}else{try{v.call()}catch(D){c=D}e.call(v.prototype)}}else{try{throw Error()}catch(D){c=D}e()}}catch(D){if(D&&c&&typeof D.stack=="string"){for(var d=D.stack.split(`
|
|
11
11
|
`),T=c.stack.split(`
|
|
12
12
|
`),R=d.length-1,_=T.length-1;R>=1&&_>=0&&d[R]!==T[_];)_--;for(;R>=1&&_>=0;R--,_--)if(d[R]!==T[_]){if(R!==1||_!==1)do if(R--,_--,_<0||d[R]!==T[_]){var P=`
|
|
13
|
-
`+d[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,sr(),Error.prepareStackTrace=p}var V=e?e.displayName||e.name:"",Le=V
|
|
13
|
+
`+d[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,sr(),Error.prepareStackTrace=p}var V=e?e.displayName||e.name:"",Le=V?$(V):"";return typeof e=="function"&&X.set(e,Le),Le}function lr(e,r,a){return Ce(e,!1)}function fr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function H(e,r,a){if(e==null)return"";if(typeof e=="function")return Ce(e,fr(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 lr(e.render);case O:return H(e.type,r,a);case j:{var c=e,p=c._payload,g=c._init;try{return H(g(p),r,a)}catch{}}}return""}var K=Object.prototype.hasOwnProperty,we={},Te=k.ReactDebugCurrentFrame;function Z(e){if(e){var r=e._owner,a=H(e.type,e._source,r?r.type:null);Te.setExtraStackFrame(a)}else Te.setExtraStackFrame(null)}function dr(e,r,a,c,p){{var g=Function.call.bind(K);for(var v in e)if(g(e,v)){var d=void 0;try{if(typeof e[v]!="function"){var T=Error((c||"React class")+": "+a+" type `"+v+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[v]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw T.name="Invariant Violation",T}d=e[v](r,v,c,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(R){d=R}d&&!(d 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).",c||"React class",a,v,typeof d),Z(null)),d instanceof Error&&!(d.message in we)&&(we[d.message]=!0,Z(p),C("Failed %s type: %s",a,d.message),Z(null))}}}var vr=Array.isArray;function ae(e){return vr(e)}function pr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,a=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function gr(e){try{return Oe(e),!1}catch{return!0}}function Oe(e){return""+e}function Se(e){if(gr(e))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",pr(e)),Oe(e)}var B=k.ReactCurrentOwner,mr={key:!0,ref:!0,__self:!0,__source:!0},je,Pe,oe;oe={};function hr(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 Er(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 yr(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 br(e,r){{var a=function(){je||(je=!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 Rr(e,r){{var a=function(){Pe||(Pe=!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 _r=function(e,r,a,c,p,g,v){var d={$$typeof:u,type:e,key:r,ref:a,props:v,_owner:g};return d._store={},Object.defineProperty(d._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(d,"_self",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.defineProperty(d,"_source",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d};function Cr(e,r,a,c,p){{var g,v={},d=null,T=null;a!==void 0&&(Se(a),d=""+a),Er(r)&&(Se(r.key),d=""+r.key),hr(r)&&(T=r.ref,yr(r,p));for(g in r)K.call(r,g)&&!mr.hasOwnProperty(g)&&(v[g]=r[g]);if(e&&e.defaultProps){var R=e.defaultProps;for(g in R)v[g]===void 0&&(v[g]=R[g])}if(d||T){var _=typeof e=="function"?e.displayName||e.name||"Unknown":e;d&&br(v,_),T&&Rr(v,_)}return _r(e,d,T,p,c,B.current,v)}}var ie=k.ReactCurrentOwner,Ae=k.ReactDebugCurrentFrame;function W(e){if(e){var r=e._owner,a=H(e.type,e._source,r?r.type:null);Ae.setExtraStackFrame(a)}else Ae.setExtraStackFrame(null)}var ue;ue=!1;function se(e){return typeof e=="object"&&e!==null&&e.$$typeof===u}function ke(){{if(ie.current){var e=x(ie.current.type);if(e)return`
|
|
14
14
|
|
|
15
15
|
Check the render method of \``+e+"`."}return""}}function wr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),a=e.lineNumber;return`
|
|
16
16
|
|
|
17
17
|
Check your code at `+r+":"+a+"."}return""}}var xe={};function Tr(e){{var r=ke();if(!r){var a=typeof e=="string"?e:e.displayName||e.name;a&&(r=`
|
|
18
18
|
|
|
19
|
-
Check the top-level render call using <`+a+">.")}return r}}function De(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=Tr(r);if(xe[a])return;xe[a]=!0;var c="";e&&e._owner&&e._owner!==ie.current&&(c=" It was passed a child from "+x(e._owner.type)+"."),W(e),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,c),W(null)}}function Fe(e,r){{if(typeof e!="object")return;if(ae(e))for(var a=0;a<e.length;a++){var c=e[a];se(c)&&De(c,r)}else if(se(e))e._store&&(e._store.validated=!0);else if(e){var p=L(e);if(typeof p=="function"&&p!==e.entries)for(var g=p.call(e),v;!(v=g.next()).done;)se(v.value)&&De(v.value,r)}}}function Or(e){{var r=e.type;if(r==null||typeof r=="string")return;var a;if(typeof r=="function")a=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===l||r.$$typeof===O))a=r.propTypes;else return;if(a){var c=x(r);dr(a,e.props,"prop",c,e)}else if(r.PropTypes!==void 0&&!ue){ue=!0;var p=x(r);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",p||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Sr(e){{for(var r=Object.keys(e.props),a=0;a<r.length;a++){var c=r[a];if(c!=="children"&&c!=="key"){W(e),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),W(null);break}}e.ref!==null&&(W(e),C("Invalid attribute `ref` supplied to `React.Fragment`."),W(null))}}function Ie(e,r,a,c,p,g){{var v=or(e);if(!v){var d="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(d+=" 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 T=wr(p);T?d+=T:d+=ke();var R;e===null?R="null":ae(e)?R="array":e!==void 0&&e.$$typeof===u?(R="<"+(x(e.type)||"Unknown")+" />",d=" Did you accidentally export a JSX literal instead of a component?"):R=typeof e,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,d)}var _=Cr(e,r,a,p,g);if(_==null)return _;if(v){var P=r.children;if(P!==void 0)if(c)if(ae(P)){for(var V=0;V<P.length;V++)Fe(P[V],e);Object.freeze&&Object.freeze(P)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Fe(P,e)}return e===
|
|
19
|
+
Check the top-level render call using <`+a+">.")}return r}}function De(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=Tr(r);if(xe[a])return;xe[a]=!0;var c="";e&&e._owner&&e._owner!==ie.current&&(c=" It was passed a child from "+x(e._owner.type)+"."),W(e),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,c),W(null)}}function Fe(e,r){{if(typeof e!="object")return;if(ae(e))for(var a=0;a<e.length;a++){var c=e[a];se(c)&&De(c,r)}else if(se(e))e._store&&(e._store.validated=!0);else if(e){var p=L(e);if(typeof p=="function"&&p!==e.entries)for(var g=p.call(e),v;!(v=g.next()).done;)se(v.value)&&De(v.value,r)}}}function Or(e){{var r=e.type;if(r==null||typeof r=="string")return;var a;if(typeof r=="function")a=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===l||r.$$typeof===O))a=r.propTypes;else return;if(a){var c=x(r);dr(a,e.props,"prop",c,e)}else if(r.PropTypes!==void 0&&!ue){ue=!0;var p=x(r);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",p||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Sr(e){{for(var r=Object.keys(e.props),a=0;a<r.length;a++){var c=r[a];if(c!=="children"&&c!=="key"){W(e),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),W(null);break}}e.ref!==null&&(W(e),C("Invalid attribute `ref` supplied to `React.Fragment`."),W(null))}}function Ie(e,r,a,c,p,g){{var v=or(e);if(!v){var d="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(d+=" 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 T=wr(p);T?d+=T:d+=ke();var R;e===null?R="null":ae(e)?R="array":e!==void 0&&e.$$typeof===u?(R="<"+(x(e.type)||"Unknown")+" />",d=" Did you accidentally export a JSX literal instead of a component?"):R=typeof e,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,d)}var _=Cr(e,r,a,p,g);if(_==null)return _;if(v){var P=r.children;if(P!==void 0)if(c)if(ae(P)){for(var V=0;V<P.length;V++)Fe(P[V],e);Object.freeze&&Object.freeze(P)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Fe(P,e)}return e===i?Sr(_):Or(_),_}}function jr(e,r,a){return Ie(e,r,a,!0)}function Pr(e,r,a){return Ie(e,r,a,!1)}var Ar=Pr,kr=jr;Y.Fragment=i,Y.jsx=Ar,Y.jsxs=kr}()),Y}var U={};/**
|
|
20
20
|
* @license React
|
|
21
21
|
* react-jsx-runtime.production.min.js
|
|
22
22
|
*
|
|
@@ -24,4 +24,4 @@ Check the top-level render call using <`+a+">.")}return r}}function De(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 Me(){if(le)return U;le=1;var t=h,u=Symbol.for("react.element"),
|
|
27
|
+
*/var le;function Me(){if(le)return U;le=1;var t=h,u=Symbol.for("react.element"),o=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function E(n,l,m){var y,O={},j=null,S=null;m!==void 0&&(j=""+m),l.key!==void 0&&(j=""+l.key),l.ref!==void 0&&(S=l.ref);for(y in l)i.call(l,y)&&!f.hasOwnProperty(y)&&(O[y]=l[y]);if(n&&n.defaultProps)for(y in l=n.defaultProps,l)O[y]===void 0&&(O[y]=l[y]);return{$$typeof:u,type:n,key:j,ref:S,props:O,_owner:s.current}}return U.Fragment=o,U.jsx=E,U.jsxs=E,U}process.env.NODE_ENV==="production"?q.exports=Me():q.exports=Ne();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}),We=({axios:t,children:u,translate:o,useAuth:i,Outlet:s,Navigate:f,useLocation:E,useGoogleTagManager:n,apiURL:l})=>{const m=h.useMemo(()=>({apiURL:l,axios:t,Navigate:f,Outlet:s,translate:o,useAuth:i,useGoogleTagManager:n,useLocation:E}),[f,s,l,t,o,i,n,E]);return A.jsx(M.Provider,{value:m,children:u})},G=t=>`RequireAuth require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ve=({Fallback:t,loginPath:u="/login",localStorageKey:o="user",redirect401Path:i="/login",...s})=>{var I,L,k,C;const{axios:f=s.axios,useLocation:E=s.useLocation,useAuth:n=s.useAuth,Outlet:l=s.Outlet,Navigate:m=s.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,O]=h.useState(null),{isLogged:j}=n(),S=E(),F=h.useRef(!1);return h.useLayoutEffect(()=>{F.current||(F.current=!0,f==null||f.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&&(f.defaults.headers.common.Authorization=null,localStorage.removeItem(o),O(i)),Promise.reject(w)}))},[f==null?void 0:f.defaults.headers.common,f==null?void 0:f.interceptors.response,o,i]),j&&!y?A.jsx(h.Suspense,{fallback:t,children:(L=(I=S.state)==null?void 0:I.from)!=null&&L.state&&((C=(k=S.state)==null?void 0:k.from)==null?void 0:C.pathname)===u?A.jsx(m,{to:S.state.from.state.from.pathname+S.state.from.state.from.search,replace:!0}):A.jsx(l,{})}):A.jsx(m,{to:u,state:{from:S},replace:!0})},Q=t=>`GTMSendPageView require « ${t} » dependency. You can provide with InjectDependenciesProvider or directly in props.`,Ye=({...t})=>{const{useLocation:u=t.useLocation,Outlet:o=t.Outlet,useGoogleTagManager:i=t.useGoogleTagManager}=h.useContext(M);if(u===void 0)throw new Error(Q("useLocation"));if(o===void 0)throw new Error(Q("Outlet"));if(i===void 0)throw new Error(Q("useGoogleTagManager"));const{pathname:s}=u(),{sendEvent:f}=i();return h.useEffect(()=>{f({event:"pageView",pathname:s})},[s,f]),A.jsx(o,{})},Ue=({axios:t,baseURL:u,tokenTypeKey:o="tokenType",userLocalStorageKey:i="user",tokenKey:s="accessToken",postContentType:f="application/json"})=>{if(!t.defaults)return null;const E=localStorage.getItem(i),n=E?JSON.parse(E):null,l=n!=null&&n[o]?n[o]:null,m=n!=null&&n[s]?n[s]:null,y=E?`${l} ${m}`:null;return t.defaults.baseURL=u,t.defaults.headers.post["Content-Type"]=f,y&&(t.defaults.headers.common.Authorization=y),null},ze=({i18n:t,debug:u,initReactI18next:o,resources:i,LanguageDetector:s})=>(t!=null&&t.isInitialized||(t.use(s).use(o).init({debug:u,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:!1,useSuspense:!0},resources:i,returnNull:!1}).then(()=>{document.documentElement.lang!==t.resolvedLanguage&&t.resolvedLanguage&&document.documentElement.setAttribute("lang",t.resolvedLanguage)}),t.on("languageChanged",f=>{document.documentElement.setAttribute("lang",f)})),null),Be=({dsn:t,sentry:u,integrations:o,tracesSampleRate:i,routingInstrumentationDependencies:s,replaysSessionSampleRate:f,replaysOnErrorSampleRate:E,tracePropagationTargets:n,ignoreErrors:l,debug:m})=>(u.isInitialized()||(m||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&u.init({debug:m,dsn:t,ignoreErrors:l||[/Failed to fetch dynamically imported module/],integrations:[new u.BrowserTracing({routingInstrumentation:u.reactRouterV6Instrumentation(s.useEffect,s.useLocation,s.useNavigationType,s.createRoutesFromChildren,s.matchRoutes)}),u.replayIntegration(),...o||[]],replaysOnErrorSampleRate:E||1,replaysSessionSampleRate:f||.1,tracePropagationTargets:n,tracesSampleRate:i||1}),null),Ge=({IMaskMixin:t,...u})=>{const o=h.useMemo(()=>t(({TextField:i,...s})=>A.jsx(i,{...s})),[t]);return A.jsx(o,{...u})},Je=({mapbox:t,accessToken:u})=>(t&&u&&(t.accessToken=u),null),$e=({children:t,defaultOptions:u,QueryClient:o,QueryClientProvider:i})=>{const s=new o({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:3,...u}}});return A.jsx(i,{client:s,children:t})},Xe=t=>{const{unknownErrorTranslationKey:u="error.unknownError"}=t||{},{translate:o=t==null?void 0:t.translate}=h.useContext(M),i=o?o(u):"Unknown error",s=h.useCallback(E=>{var l,m,y,O,j,S,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):(O=(y=n==null?void 0:n.data)==null?void 0:y.detail)!=null&&O.length&&Array.isArray((j=n==null?void 0:n.data)==null?void 0:j.detail)&&((F=(S=n==null?void 0:n.data)==null?void 0:S.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):i},[i]),f=h.useCallback(E=>{var l,m,y;const{response:n}=E||{};return o&&(n!=null&&n.error_code)?o(n==null?void 0:n.error_code):o&&((l=n==null?void 0:n.data)!=null&&l.error_code)?o((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):i},[i,o]);return{printError:s,printErrorCode:f}},He=({data:t,fetchNextPage:u,isFetchingNextPage:o,isInitialLoading:i,isLoading:s,enabled:f=!0})=>{const E=h.useCallback(async l=>{o||!f||await u({pageParam:(l==null?void 0:l.pageParam)||l.visibleRowsCount})},[f,u,o]),n=h.useMemo(()=>{if(t)return t.pages.reduce((l,m)=>[...l,...m],[])},[t]);return{fetchNextPageOnRowsScrollEnd:E,isLoading:o||s,loadingVariant:i?"skeleton":"linear",rows:n}},Ke=t=>{const u=h.useCallback(({tokenType:i,accessToken:s})=>{t.defaults.headers.common.Authorization=`${i} ${s}`},[t.defaults.headers.common]);return{clearAuthenticationToken:h.useCallback(()=>{t.defaults.headers.common.Authorization=null},[t.defaults.headers.common]),setAuthenticationToken:u}},ee=(t,u)=>{if(!t)return"";const o=typeof t=="object"&&"pathname"in t?`${t.origin}${t.pathname}`:t;return typeof u=="number"?`${o.replace("/files",`/thumbs/${u}`)}`:o},Ze=()=>{const{apiURL:t}=h.useContext(M);return{distanceAdapter:(i,s="km")=>{const f=Number(i);return Number.isNaN(f)?`0 ${s}`:`${f.toFixed(2)} ${s}`},filePathAdapter:(i,s)=>ee(t&&typeof i=="string"?{origin:t,pathname:i}:i,s)}},qe=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Qe=t=>{const i=t.split("/").filter(s=>s.length>0).map(s=>s.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return i.charAt(0).toLowerCase()+i.slice(1)},er=(t,u,o)=>{const i=Qe(u),s=qe(o);return`${i}${s}`},rr=t=>{if(t)return(t==null?void 0:t.reduce((u,o)=>(u[o]={query:{useInfinite:!0,useInfiniteQueryParam:"offset"}},u),{}))||{}},tr=t=>{const{input:u="./openapi.json",operationsToGenerateInfiniteQueryHook:o=void 0}=t||{};return{api:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:u,output:{client:"react-query",mode:"tags-split",override:{header:i=>["Generated by orval 🍺",...i.title?[i.title]:[],...i.description?[i.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/config/orval/mutator/axiosCustomInstance.ts`},operationName:er,...(o==null?void 0:o.length)&&{operations:rr(o)},query:{useQuery:!0}},schemas:"src/api/model",target:"src/api/services/api.ts"}}}};b.AxiosConfig=Ue,b.GTMSendPageView=Ye,b.I18nConfig=ze,b.InjectDependenciesContext=M,b.InjectDependenciesProvider=We,b.MapBoxConfig=Je,b.MaskTextField=Ge,b.QueryClientConfigProvider=$e,b.RequireAuth=Ve,b.SentryConfig=Be,b.filePathAdapter=ee,b.getOrvalConfig=tr,b.useAdapter=Ze,b.useAuth=Ke,b.useInfiniteDataGrid=He,b.useResponseError=Xe,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Adapt file path from server to display file on client
|
|
3
|
-
* @param
|
|
3
|
+
* @param location
|
|
4
4
|
* @param size - full or number for thumbs
|
|
5
5
|
*/
|
|
6
|
-
declare const filePathAdapter: (
|
|
6
|
+
declare const filePathAdapter: (location?: string | null | {
|
|
7
7
|
pathname: string;
|
|
8
8
|
origin: string;
|
|
9
9
|
}, size?: number | "full") => string;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tracktor/shared-module",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
|
-
"types": "./dist/
|
|
6
|
+
"types": "./dist/main.d.ts",
|
|
7
7
|
"main": "./dist/main.umd.cjs",
|
|
8
8
|
"module": "./dist/main.js",
|
|
9
9
|
"engines": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"import": "./dist/main.js",
|
|
18
18
|
"require": "./dist/main.umd.cjs",
|
|
19
|
-
"types": "./dist/
|
|
19
|
+
"types": "./dist/main.d.ts"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|