@ukpc-lib/react 0.16.5 → 0.16.6
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/FavoriteMenu/components/MenuItem.d.ts +2 -2
- package/dist/components/GlobalMenu/components/MenuItem.d.ts +1 -0
- package/dist/components/GlobalMenu/helpers/index.d.ts +3 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +2 -2
- package/dist/{index.esm2017-B5CLzdVt.cjs → index.esm2017-BWPYyOYY.cjs} +101 -101
- package/dist/{index.esm2017-DedBSRLV.js → index.esm2017-CxUJuamS.js} +3263 -3256
- package/dist/share/hooks/useSyncRouter.d.ts +1 -1
- package/dist/share/index.cjs +1 -1
- package/dist/share/index.js +64 -82
- 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-CZ1XQeht.js → index-9O8aC_qt.js} +267 -260
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-BWPYyOYY.cjs"),m=require("axios"),u=require("react"),d=require("react-router-dom"),a=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");require("react-query");require("react-dom");require("moment");const h=s=>{const[t,r]=u.useState([]);return u.useEffect(()=>{m.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(o=>r(o.data)).catch(o=>{console.error("Getting user permission error:",o)})},[s]),t},p=s=>{const t=d.useLocation();if(u.useEffect(()=>{var o,i;let r=t.pathname+t.search+t.hash;s&&!r.includes(s)&&(r=s+r),console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:",r),(i=(o=window.top)==null?void 0:o.shellNavigate)==null||i.call(o,"/app"+r,{replace:!0})},[t,s]),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 g({open:s,disabled:t}){u.useMemo(()=>{var r,o,i,n;t||(s?(o=(r=window.top)==null?void 0:r.HostBridge)==null||o.openBackdrop(!0):(n=(i=window.top)==null?void 0:i.HostBridge)==null||n.openBackdrop(!1))},[s,t])}const l=(s,t)=>(r,o)=>{const n=e.useUserPermissions({axiosInstance:t,baseUrl:s}).data;return n?o?r.every(c=>n==null?void 0:n.includes(c)):r.some(c=>n==null?void 0:n.includes(c)):!1},f=({baseUrl:s,accessWith:t,requireAll:r,children:o})=>l(s)(t,r)?a.jsx(a.Fragment,{children:o}):null,P=({accessWith:s,requireAll:t,baseUrl:r,children:o})=>l(r)(s,t)?a.jsx(a.Fragment,{children:o}):a.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.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.login=e.login;exports.logout=e.logout;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=f;exports.PermissionRoute=P;exports.getUseHasPermission=l;exports.useGetPermission=h;exports.useSyncBackdrop=g;exports.useSyncRouter=p;
|
package/dist/share/index.js
CHANGED
|
@@ -1,48 +1,30 @@
|
|
|
1
|
-
import { K as
|
|
2
|
-
import { M as
|
|
3
|
-
import
|
|
4
|
-
import { useState as
|
|
5
|
-
import {
|
|
6
|
-
import { jsx as
|
|
1
|
+
import { K as p, U as l } from "../index.esm2017-CxUJuamS.js";
|
|
2
|
+
import { M as $, O as D, R as F, a2 as I, $ as L, a as N, c as O, a0 as j, W as z, T as K, V, X, r as Y, a1 as Z, s as _, t as q, Y as J, e as Q, u as W, i as b, Z as ee } from "../index.esm2017-CxUJuamS.js";
|
|
3
|
+
import f from "axios";
|
|
4
|
+
import { useState as d, useEffect as u, useMemo as h } from "react";
|
|
5
|
+
import { useLocation as w } from "react-router-dom";
|
|
6
|
+
import { jsx as i, Fragment as c } from "react/jsx-runtime";
|
|
7
7
|
import "@r2wc/react-to-web-component";
|
|
8
8
|
import "@mui/material";
|
|
9
9
|
import "react-query";
|
|
10
10
|
import "react-dom";
|
|
11
11
|
import "moment";
|
|
12
|
-
const
|
|
13
|
-
const [r,
|
|
14
|
-
return
|
|
15
|
-
|
|
12
|
+
const C = (s) => {
|
|
13
|
+
const [r, e] = d([]);
|
|
14
|
+
return u(() => {
|
|
15
|
+
f.get(`${s}/user-management/api/v1/users/my-account/permissions`, {
|
|
16
16
|
withCredentials: !0
|
|
17
|
-
}).then((
|
|
18
|
-
console.error("Getting user permission error:",
|
|
17
|
+
}).then((o) => e(o.data)).catch((o) => {
|
|
18
|
+
console.error("Getting user permission error:", o);
|
|
19
19
|
});
|
|
20
|
-
}, [
|
|
21
|
-
},
|
|
22
|
-
const r = w()
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
window.
|
|
27
|
-
)
|
|
28
|
-
const t = (n = s) => (e || "") + n.pathname + n.search + n.hash;
|
|
29
|
-
if (a(() => {
|
|
30
|
-
const n = {
|
|
31
|
-
changeRoute: (o) => {
|
|
32
|
-
const i = t();
|
|
33
|
-
if (typeof o == "string" && i !== o) {
|
|
34
|
-
console.log(" useSyncRouter.tsx ~ location2:", i, o);
|
|
35
|
-
const m = e && o.startsWith(e) ? o.substring(e.length) : o;
|
|
36
|
-
r(m);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
window.MicrofeBridge = n;
|
|
41
|
-
}, [r, s]), a(() => {
|
|
42
|
-
var o, i;
|
|
43
|
-
const n = t();
|
|
44
|
-
console.log("fullPath1", window.location.pathname, n), (i = (o = window.parent) == null ? void 0 : o.HostBridge) == null || i.childRouteChange(n);
|
|
45
|
-
}, [s]), window.self === window.top) {
|
|
20
|
+
}, [s]), r;
|
|
21
|
+
}, E = (s) => {
|
|
22
|
+
const r = w();
|
|
23
|
+
if (u(() => {
|
|
24
|
+
var o, a;
|
|
25
|
+
let e = r.pathname + r.search + r.hash;
|
|
26
|
+
s && !e.includes(s) && (e = s + e), console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:", e), (a = (o = window.top) == null ? void 0 : o.shellNavigate) == null || a.call(o, "/app" + e, { replace: !0 });
|
|
27
|
+
}, [r, s]), window.self === window.top) {
|
|
46
28
|
console.log("useSyncRouter: Navigate to /app path"), window.location.href = window.location.href.replace(
|
|
47
29
|
window.origin,
|
|
48
30
|
`${window.origin}/app`
|
|
@@ -51,61 +33,61 @@ const H = (e) => {
|
|
|
51
33
|
}
|
|
52
34
|
};
|
|
53
35
|
function k({
|
|
54
|
-
open:
|
|
36
|
+
open: s,
|
|
55
37
|
disabled: r
|
|
56
38
|
}) {
|
|
57
39
|
h(() => {
|
|
58
|
-
var
|
|
59
|
-
r || (
|
|
60
|
-
}, [
|
|
40
|
+
var e, o, a, t;
|
|
41
|
+
r || (s ? (o = (e = window.top) == null ? void 0 : e.HostBridge) == null || o.openBackdrop(!0) : (t = (a = window.top) == null ? void 0 : a.HostBridge) == null || t.openBackdrop(!1));
|
|
42
|
+
}, [s, r]);
|
|
61
43
|
}
|
|
62
|
-
const
|
|
63
|
-
const
|
|
44
|
+
const m = (s, r) => (e, o) => {
|
|
45
|
+
const t = p({
|
|
64
46
|
axiosInstance: r,
|
|
65
|
-
baseUrl:
|
|
47
|
+
baseUrl: s
|
|
66
48
|
}).data;
|
|
67
|
-
return
|
|
68
|
-
(
|
|
69
|
-
) :
|
|
70
|
-
(
|
|
49
|
+
return t ? o ? e.every(
|
|
50
|
+
(n) => t == null ? void 0 : t.includes(n)
|
|
51
|
+
) : e.some(
|
|
52
|
+
(n) => t == null ? void 0 : t.includes(n)
|
|
71
53
|
) : !1;
|
|
72
|
-
},
|
|
73
|
-
baseUrl:
|
|
54
|
+
}, H = ({
|
|
55
|
+
baseUrl: s,
|
|
74
56
|
accessWith: r,
|
|
75
|
-
requireAll:
|
|
76
|
-
children:
|
|
77
|
-
}) =>
|
|
78
|
-
accessWith:
|
|
57
|
+
requireAll: e,
|
|
58
|
+
children: o
|
|
59
|
+
}) => m(s)(r, e) ? /* @__PURE__ */ i(c, { children: o }) : null, G = ({
|
|
60
|
+
accessWith: s,
|
|
79
61
|
requireAll: r,
|
|
80
|
-
baseUrl:
|
|
81
|
-
children:
|
|
82
|
-
}) =>
|
|
62
|
+
baseUrl: e,
|
|
63
|
+
children: o
|
|
64
|
+
}) => m(e)(s, r) ? /* @__PURE__ */ i(c, { children: o }) : /* @__PURE__ */ i(l, {});
|
|
83
65
|
export {
|
|
84
|
-
|
|
66
|
+
$ as AuthContext,
|
|
85
67
|
D as AuthProvider,
|
|
86
|
-
|
|
87
|
-
|
|
68
|
+
F as ERROR_MESSAGE,
|
|
69
|
+
H as HasPermission,
|
|
88
70
|
G as PermissionRoute,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
71
|
+
I as SaasThemeProvider,
|
|
72
|
+
L as TranslationProvider,
|
|
73
|
+
N as axiosInstance,
|
|
74
|
+
O as color,
|
|
75
|
+
j as createCustomTheme,
|
|
76
|
+
m as getUseHasPermission,
|
|
77
|
+
z as handleErrorAxios,
|
|
78
|
+
K as login,
|
|
79
|
+
V as logout,
|
|
80
|
+
X as responseInterceptor,
|
|
81
|
+
Y as search,
|
|
82
|
+
Z as setFavicon,
|
|
83
|
+
_ as setShellBackdrop,
|
|
84
|
+
q as translate,
|
|
85
|
+
J as translationConfig,
|
|
86
|
+
Q as useAuth,
|
|
87
|
+
W as useCustomTranslation,
|
|
88
|
+
C as useGetPermission,
|
|
107
89
|
k as useSyncBackdrop,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
90
|
+
E as useSyncRouter,
|
|
91
|
+
b as useTheme,
|
|
92
|
+
ee as useTranslation
|
|
111
93
|
};
|
package/package.json
CHANGED