@ukpc-lib/react 0.13.1-dev.2 → 0.13.1-dev.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/dist/components/index.cjs +1 -1
- package/dist/components/index.js +2 -2
- package/dist/{index.esm2017-gn4YavpL.js → index.esm2017-VcIv3oNf.js} +7246 -7243
- package/dist/{index.esm2017-D_jfQoO6.cjs → index.esm2017-_6AWldhb.cjs} +79 -79
- package/dist/share/index.cjs +1 -1
- package/dist/share/index.js +24 -24
- package/package.json +1 -1
package/dist/share/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.esm2017-_6AWldhb.cjs"),h=require("axios"),a=require("react"),u=require("react-router-dom"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");const l=s=>{const[r,t]=a.useState([]);return a.useEffect(()=>{h.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(e=>t(e.data)).catch(e=>{console.error("Getting user permission error:",e)})},[s]),r},m=()=>{const s=u.useNavigate(),r=u.useLocation();if(a.useEffect(()=>{const t={changeRoute:e=>{typeof e=="string"&&window.location.pathname+r.search+r.hash!==e&&s(e)}};window.MicrofeBridge=t},[s,r]),a.useEffect(()=>{var e,n;const t=window.location.pathname+r.search+r.hash;(n=(e=window.parent)==null?void 0:e.HostBridge)==null||n.childRouteChange(t)},[r]),window.self===window.top){console.log("useSyncRouter: Navigate to /app path"),window.location.href=window.location.href.replace(window.origin,`${window.origin}/app`);return}},c=s=>(r,t)=>{const e=l(s);return t?r.every(n=>e==null?void 0:e.includes(n)):r.some(n=>e==null?void 0:e.includes(n))},d=({baseUrl:s,accessWith:r,requireAll:t,children:e})=>c(s)(r,t)?i.jsx(i.Fragment,{children:e}):null,g=({accessWith:s,requireAll:r,baseUrl:t,unAuthorizedPath:e,children:n})=>c(t)(s,r)?i.jsx(i.Fragment,{children:n}):i.jsx(u.Navigate,{to:e,replace:!0});exports.AuthContext=o.AuthContext;exports.AuthProvider=o.AuthProvider;exports.ERROR_MESSAGE=o.ERROR_MESSAGE;exports.SaasThemeProvider=o.SaasThemeProvider;exports.TranslationProvider=o.TranslationProvider;exports.axiosInstance=o.axiosInstance;exports.color=o.color;exports.createCustomTheme=o.createCustomTheme;exports.handleErrorAxios=o.handleErrorAxios;exports.login=o.login;exports.logout=o.logout;exports.responseInterceptor=o.responseInterceptor;exports.search=o.search;exports.setFavicon=o.setFavicon;exports.translate=o.translate;exports.translationConfig=o.translationConfig;exports.useAuth=o.useAuth;exports.useCustomTranslation=o.useCustomTranslation;exports.useTheme=o.useTheme;exports.useTranslation=o.useTranslation$1;exports.HasPermission=d;exports.PermissionRoute=g;exports.getUseHasPermission=c;exports.useGetPermission=l;exports.useSyncRouter=m;
|
package/dist/share/index.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { M as E, N as M, O as N, a0 as B, Y as G, a as H, c as $, Z as F, U as I, R as O, T as j, V as L, v as U, $ as V, t as X, W as Y, b as Z, u as _, g as b, X as k } from "../index.esm2017-
|
|
2
|
-
import
|
|
1
|
+
import { M as E, N as M, O as N, a0 as B, Y as G, a as H, c as $, Z as F, U as I, R as O, T as j, V as L, v as U, $ as V, t as X, W as Y, b as Z, u as _, g as b, X as k } from "../index.esm2017-VcIv3oNf.js";
|
|
2
|
+
import u from "axios";
|
|
3
3
|
import { useState as m, useEffect as n } from "react";
|
|
4
|
-
import { useNavigate as h, useLocation as l, Navigate as
|
|
4
|
+
import { useNavigate as h, useLocation as l, Navigate as d } from "react-router-dom";
|
|
5
5
|
import { jsx as a, Fragment as i } from "react/jsx-runtime";
|
|
6
6
|
import "@r2wc/react-to-web-component";
|
|
7
7
|
import "@mui/material";
|
|
8
|
-
const
|
|
9
|
-
const [
|
|
8
|
+
const g = (s) => {
|
|
9
|
+
const [o, t] = m([]);
|
|
10
10
|
return n(() => {
|
|
11
|
-
|
|
11
|
+
u.get(`${s}/user-management/api/v1/users/my-account/permissions`, {
|
|
12
12
|
withCredentials: !0
|
|
13
13
|
}).then((e) => t(e.data)).catch((e) => {
|
|
14
14
|
console.error("Getting user permission error:", e);
|
|
15
15
|
});
|
|
16
|
-
}, [
|
|
16
|
+
}, [s]), o;
|
|
17
17
|
}, T = () => {
|
|
18
|
-
const
|
|
18
|
+
const s = h(), o = l();
|
|
19
19
|
if (n(() => {
|
|
20
20
|
const t = {
|
|
21
21
|
changeRoute: (e) => {
|
|
22
|
-
typeof e == "string" &&
|
|
22
|
+
typeof e == "string" && window.location.pathname + o.search + o.hash !== e && s(e);
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
window.MicrofeBridge = t;
|
|
26
|
-
}, [
|
|
26
|
+
}, [s, o]), n(() => {
|
|
27
27
|
var e, r;
|
|
28
|
-
const t =
|
|
28
|
+
const t = window.location.pathname + o.search + o.hash;
|
|
29
29
|
(r = (e = window.parent) == null ? void 0 : e.HostBridge) == null || r.childRouteChange(t);
|
|
30
|
-
}, [
|
|
30
|
+
}, [o]), window.self === window.top) {
|
|
31
31
|
console.log("useSyncRouter: Navigate to /app path"), window.location.href = window.location.href.replace(
|
|
32
32
|
window.origin,
|
|
33
33
|
`${window.origin}/app`
|
|
34
34
|
);
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
},
|
|
38
|
-
const e =
|
|
39
|
-
return t ?
|
|
37
|
+
}, c = (s) => (o, t) => {
|
|
38
|
+
const e = g(s);
|
|
39
|
+
return t ? o.every(
|
|
40
40
|
(r) => e == null ? void 0 : e.includes(r)
|
|
41
|
-
) :
|
|
41
|
+
) : o.some(
|
|
42
42
|
(r) => e == null ? void 0 : e.includes(r)
|
|
43
43
|
);
|
|
44
44
|
}, C = ({
|
|
45
|
-
baseUrl:
|
|
46
|
-
accessWith:
|
|
45
|
+
baseUrl: s,
|
|
46
|
+
accessWith: o,
|
|
47
47
|
requireAll: t,
|
|
48
48
|
children: e
|
|
49
|
-
}) =>
|
|
50
|
-
accessWith:
|
|
51
|
-
requireAll:
|
|
49
|
+
}) => c(s)(o, t) ? /* @__PURE__ */ a(i, { children: e }) : null, S = ({
|
|
50
|
+
accessWith: s,
|
|
51
|
+
requireAll: o,
|
|
52
52
|
baseUrl: t,
|
|
53
53
|
unAuthorizedPath: e,
|
|
54
54
|
children: r
|
|
55
|
-
}) =>
|
|
55
|
+
}) => c(t)(s, o) ? /* @__PURE__ */ a(i, { children: r }) : /* @__PURE__ */ a(d, { to: e, replace: !0 });
|
|
56
56
|
export {
|
|
57
57
|
E as AuthContext,
|
|
58
58
|
M as AuthProvider,
|
|
@@ -64,7 +64,7 @@ export {
|
|
|
64
64
|
H as axiosInstance,
|
|
65
65
|
$ as color,
|
|
66
66
|
F as createCustomTheme,
|
|
67
|
-
|
|
67
|
+
c as getUseHasPermission,
|
|
68
68
|
I as handleErrorAxios,
|
|
69
69
|
O as login,
|
|
70
70
|
j as logout,
|
|
@@ -75,7 +75,7 @@ export {
|
|
|
75
75
|
Y as translationConfig,
|
|
76
76
|
Z as useAuth,
|
|
77
77
|
_ as useCustomTranslation,
|
|
78
|
-
|
|
78
|
+
g as useGetPermission,
|
|
79
79
|
T as useSyncRouter,
|
|
80
80
|
b as useTheme,
|
|
81
81
|
k as useTranslation
|