@ukpc-lib/react 0.16.5-sandbox.poms-1875.patch-1 → 0.16.5-sandbox.poms-1875.patch-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/dist/components/index.cjs +1 -1
- package/dist/components/index.js +2 -2
- package/dist/{index.esm2017-Dwmyl50e.js → index.esm2017-CeJW_DxL.js} +2246 -2237
- package/dist/{index.esm2017-DEvwglYk.cjs → index.esm2017-CnDCNrk-.cjs} +76 -76
- package/dist/share/index.cjs +1 -1
- package/dist/share/index.js +39 -37
- package/dist/share/interceptor/index.d.ts +2 -0
- package/package.json +1 -1
- package/web-components-bundle/favorite-menu/index.js +1 -1
- package/web-components-bundle/global-menu/index.js +1 -1
- package/web-components-bundle/global-topbar/index.js +1 -1
- package/web-components-bundle/has-permission/index.js +1 -1
- package/web-components-bundle/{index-DaCSdxEj.js → index-PHgeC3tp.js} +6 -3
package/dist/share/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-CnDCNrk-.cjs"),g=require("axios"),c=require("react"),d=require("react-router-dom"),u=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");require("react-query");require("react-dom");require("moment");const h=r=>{const[i,t]=c.useState([]);return c.useEffect(()=>{g.get(`${r}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>t(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[r]),i},f=r=>{const i=d.useNavigate(),t=d.useLocation();console.log(" useSyncRouter.tsx ~ location1:",t,window.location.pathname);const s=(n=t)=>(r||"")+n.pathname+n.search+n.hash;if(c.useEffect(()=>{const n={changeRoute:o=>{const a=s();if(typeof o=="string"&&a!==o){console.log(" useSyncRouter.tsx ~ location2:",a,o);const m=r&&o.startsWith(r)?o.substring(r.length):o;i(m)}}};window.MicrofeBridge=n},[i,t]),c.useEffect(()=>{var o,a;const n=s();console.log("fullPath1",window.location.pathname,n),(a=(o=window.parent)==null?void 0:o.HostBridge)==null||a.childRouteChange(n)},[t]),window.self===window.top){console.log("useSyncRouter: Navigate to /app path"),window.location.href=window.location.href.replace(window.origin,`${window.origin}/app`);return}};function P({open:r,disabled:i}){c.useMemo(()=>{var t,s,n,o;i||(r?(s=(t=window.top)==null?void 0:t.HostBridge)==null||s.openBackdrop(!0):(o=(n=window.top)==null?void 0:n.HostBridge)==null||o.openBackdrop(!1))},[r,i])}const l=(r,i)=>(t,s)=>{const o=e.useUserPermissions({axiosInstance:i,baseUrl:r}).data;return o?s?t.every(a=>o==null?void 0:o.includes(a)):t.some(a=>o==null?void 0:o.includes(a)):!1},w=({baseUrl:r,accessWith:i,requireAll:t,children:s})=>l(r)(i,t)?u.jsx(u.Fragment,{children:s}):null,p=({accessWith:r,requireAll:i,baseUrl:t,children:s})=>l(t)(r,i)?u.jsx(u.Fragment,{children:s}):u.jsx(e.UnauthorizedPage,{});exports.AuthContext=e.AuthContext;exports.AuthProvider=e.AuthProvider;exports.ERROR_MESSAGE=e.ERROR_MESSAGE;exports.SaasThemeProvider=e.SaasThemeProvider;exports.TranslationProvider=e.TranslationProvider;exports.X_AUTO_CANCEL=e.X_AUTO_CANCEL;exports.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.isCanceledError=e.isCanceledError;exports.login=e.login;exports.logout=e.logout;exports.requestInterceptor=e.requestInterceptor;exports.responseInterceptor=e.responseInterceptor;exports.search=e.search;exports.setFavicon=e.setFavicon;exports.setShellBackdrop=e.setShellBackdrop;exports.translate=e.translate;exports.translationConfig=e.translationConfig;exports.useAuth=e.useAuth;exports.useCustomTranslation=e.useCustomTranslation;exports.useTheme=e.useTheme;exports.useTranslation=e.useTranslation;exports.HasPermission=w;exports.PermissionRoute=p;exports.getUseHasPermission=l;exports.useGetPermission=h;exports.useSyncBackdrop=P;exports.useSyncRouter=f;
|
package/dist/share/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { K as d, U as p } from "../index.esm2017-
|
|
2
|
-
import { M as
|
|
1
|
+
import { K as d, U as p } from "../index.esm2017-CeJW_DxL.js";
|
|
2
|
+
import { M as N, O, R as _, a5 as $, a2 as z, X as D, a as L, c as X, a3 as j, W as q, Y as K, T as V, V as W, $ as Y, Z, r as J, a4 as Q, s as b, t as oo, a0 as eo, e as so, u as to, i as ro, a1 as no } from "../index.esm2017-CeJW_DxL.js";
|
|
3
3
|
import g from "axios";
|
|
4
|
-
import { useState as f, useEffect as
|
|
4
|
+
import { useState as f, useEffect as i, useMemo as h } from "react";
|
|
5
5
|
import { useNavigate as w, useLocation as P } from "react-router-dom";
|
|
6
|
-
import { jsx as
|
|
6
|
+
import { jsx as c, Fragment as u } from "react/jsx-runtime";
|
|
7
7
|
import "@r2wc/react-to-web-component";
|
|
8
8
|
import "@mui/material";
|
|
9
9
|
import "react-query";
|
|
@@ -11,7 +11,7 @@ import "react-dom";
|
|
|
11
11
|
import "moment";
|
|
12
12
|
const H = (e) => {
|
|
13
13
|
const [n, s] = f([]);
|
|
14
|
-
return
|
|
14
|
+
return i(() => {
|
|
15
15
|
g.get(`${e}/user-management/api/v1/users/my-account/permissions`, {
|
|
16
16
|
withCredentials: !0
|
|
17
17
|
}).then((t) => s(t.data)).catch((t) => {
|
|
@@ -26,22 +26,22 @@ const H = (e) => {
|
|
|
26
26
|
window.location.pathname
|
|
27
27
|
);
|
|
28
28
|
const t = (r = s) => (e || "") + r.pathname + r.search + r.hash;
|
|
29
|
-
if (
|
|
29
|
+
if (i(() => {
|
|
30
30
|
const r = {
|
|
31
31
|
changeRoute: (o) => {
|
|
32
|
-
const
|
|
33
|
-
if (typeof o == "string" &&
|
|
34
|
-
console.log(" useSyncRouter.tsx ~ location2:",
|
|
32
|
+
const a = t();
|
|
33
|
+
if (typeof o == "string" && a !== o) {
|
|
34
|
+
console.log(" useSyncRouter.tsx ~ location2:", a, o);
|
|
35
35
|
const m = e && o.startsWith(e) ? o.substring(e.length) : o;
|
|
36
36
|
n(m);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
window.MicrofeBridge = r;
|
|
41
|
-
}, [n, s]),
|
|
42
|
-
var o,
|
|
41
|
+
}, [n, s]), i(() => {
|
|
42
|
+
var o, a;
|
|
43
43
|
const r = t();
|
|
44
|
-
console.log("fullPath1", window.location.pathname, r), (
|
|
44
|
+
console.log("fullPath1", window.location.pathname, r), (a = (o = window.parent) == null ? void 0 : o.HostBridge) == null || a.childRouteChange(r);
|
|
45
45
|
}, [s]), window.self === window.top) {
|
|
46
46
|
console.log("useSyncRouter: Navigate to /app path"), window.location.href = window.location.href.replace(
|
|
47
47
|
window.origin,
|
|
@@ -65,48 +65,50 @@ const l = (e, n) => (s, t) => {
|
|
|
65
65
|
baseUrl: e
|
|
66
66
|
}).data;
|
|
67
67
|
return o ? t ? s.every(
|
|
68
|
-
(
|
|
68
|
+
(a) => o == null ? void 0 : o.includes(a)
|
|
69
69
|
) : s.some(
|
|
70
|
-
(
|
|
70
|
+
(a) => o == null ? void 0 : o.includes(a)
|
|
71
71
|
) : !1;
|
|
72
72
|
}, F = ({
|
|
73
73
|
baseUrl: e,
|
|
74
74
|
accessWith: n,
|
|
75
75
|
requireAll: s,
|
|
76
76
|
children: t
|
|
77
|
-
}) => l(e)(n, s) ? /* @__PURE__ */ u
|
|
77
|
+
}) => l(e)(n, s) ? /* @__PURE__ */ c(u, { children: t }) : null, U = ({
|
|
78
78
|
accessWith: e,
|
|
79
79
|
requireAll: n,
|
|
80
80
|
baseUrl: s,
|
|
81
81
|
children: t
|
|
82
|
-
}) => l(s)(e, n) ? /* @__PURE__ */ u
|
|
82
|
+
}) => l(s)(e, n) ? /* @__PURE__ */ c(u, { children: t }) : /* @__PURE__ */ c(p, {});
|
|
83
83
|
export {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
N as AuthContext,
|
|
85
|
+
O as AuthProvider,
|
|
86
|
+
_ as ERROR_MESSAGE,
|
|
87
87
|
F as HasPermission,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
U as PermissionRoute,
|
|
89
|
+
$ as SaasThemeProvider,
|
|
90
|
+
z as TranslationProvider,
|
|
91
|
+
D as X_AUTO_CANCEL,
|
|
92
|
+
L as axiosInstance,
|
|
93
|
+
X as color,
|
|
94
|
+
j as createCustomTheme,
|
|
94
95
|
l as getUseHasPermission,
|
|
95
|
-
|
|
96
|
+
q as handleErrorAxios,
|
|
97
|
+
K as isCanceledError,
|
|
96
98
|
V as login,
|
|
97
99
|
W as logout,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
Y as requestInterceptor,
|
|
101
|
+
Z as responseInterceptor,
|
|
102
|
+
J as search,
|
|
103
|
+
Q as setFavicon,
|
|
104
|
+
b as setShellBackdrop,
|
|
105
|
+
oo as translate,
|
|
106
|
+
eo as translationConfig,
|
|
107
|
+
so as useAuth,
|
|
108
|
+
to as useCustomTranslation,
|
|
107
109
|
H as useGetPermission,
|
|
108
110
|
k as useSyncBackdrop,
|
|
109
111
|
M as useSyncRouter,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
ro as useTheme,
|
|
113
|
+
no as useTranslation
|
|
112
114
|
};
|
|
@@ -2,6 +2,7 @@ export declare const ERROR_MESSAGE: {
|
|
|
2
2
|
TOKEN_MALFORMED: string;
|
|
3
3
|
TOKEN_EXPIRED: string;
|
|
4
4
|
};
|
|
5
|
+
export declare const X_AUTO_CANCEL = "true";
|
|
5
6
|
export declare const login: (baseURL: string) => void;
|
|
6
7
|
export declare const logout: (baseURL: string) => void;
|
|
7
8
|
declare const axiosInstance: import('axios').AxiosInstance;
|
|
@@ -13,4 +14,5 @@ export type HandleErrorOptions = {
|
|
|
13
14
|
export declare function handleErrorAxios(error: any, options?: HandleErrorOptions): void | Promise<import('axios').AxiosResponse<any, any>>;
|
|
14
15
|
declare const requestInterceptor: number;
|
|
15
16
|
declare const responseInterceptor: number;
|
|
17
|
+
export declare function isCanceledError(error: any): boolean;
|
|
16
18
|
export { axiosInstance, responseInterceptor, requestInterceptor };
|
package/package.json
CHANGED
|
@@ -33892,10 +33892,13 @@ function Fie(e, t) {
|
|
|
33892
33892
|
}
|
|
33893
33893
|
Rn.interceptors.request.use(
|
|
33894
33894
|
(e) => {
|
|
33895
|
+
var r;
|
|
33896
|
+
if (((r = e.headers) == null ? void 0 : r.X_AUTO_CANCEL) !== "true")
|
|
33897
|
+
return e;
|
|
33895
33898
|
const t = k0(e);
|
|
33896
33899
|
if (Xl.has(t)) {
|
|
33897
|
-
const
|
|
33898
|
-
|
|
33900
|
+
const i = Xl.get(t);
|
|
33901
|
+
i == null || i.abort(), Xl.delete(t);
|
|
33899
33902
|
}
|
|
33900
33903
|
const n = new AbortController();
|
|
33901
33904
|
return e.signal = n.signal, Xl.set(t, n), e;
|
|
@@ -33909,7 +33912,7 @@ Rn.interceptors.response.use(
|
|
|
33909
33912
|
},
|
|
33910
33913
|
async (e) => {
|
|
33911
33914
|
if (tn.isCancel(e))
|
|
33912
|
-
return Promise.reject({ ...e,
|
|
33915
|
+
return Promise.reject({ ...e, isCanceled: !0 });
|
|
33913
33916
|
if (e.config) {
|
|
33914
33917
|
const t = k0(e.config);
|
|
33915
33918
|
Xl.delete(t);
|