@ukpc-lib/react 0.1.27 → 0.1.29
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 +2 -2
- package/dist/components/index.js +32 -31
- package/dist/{index.module-ebc563e0.js → index.module-34bab88b.js} +5086 -5089
- package/dist/{index.module-35d2f1ab.cjs → index.module-9c4fe97a.cjs} +75 -75
- package/dist/share/index.cjs +1 -1
- package/dist/share/index.js +12 -11
- package/package.json +1 -1
- package/web-components-bundle/global-menu/index.cjs +11 -1056
- package/web-components-bundle/global-menu/index.js +7337 -25045
- package/web-components-bundle/global-topbar/index.cjs +3 -3
- package/web-components-bundle/global-topbar/index.js +21 -16
- package/web-components-bundle/{index-455ab881.js → react-to-web-component-3a9dbdde.js} +868 -891
- package/web-components-bundle/{index-a6f8a2d0.cjs → react-to-web-component-e10d811d.cjs} +17 -17
package/dist/share/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.module-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.module-9c4fe97a.cjs"),l=require("axios"),i=require("react/jsx-runtime"),g=require("react");require("@r2wc/react-to-web-component");const R=require("react-router-dom");require("react-dom");require("@mui/material");require("moment");function q({config:t,pushError:n=o.pushError}){const r=l.create(t);r.interceptors.request.use(async e=>(e.headers={Accept:"application/json","Content-Type":"application/json"},e),e=>Promise.reject(e)),r.interceptors.response.use(e=>e,async e=>s(e));async function s(e){var h,p,P;console.error("Error 🚨:",e);const u=e.config,a=(p=(h=e.response)==null?void 0:h.data)==null?void 0:p.errorMessage,m=a===o.ERROR_MESSAGE.TOKEN_EXPIRED;return((P=e.response)==null?void 0:P.status)===401?m&&!u._retry?(u._retry=!0,r.post("/authentication/api/v1/auth/refresh-token").then(()=>r(u)).catch(()=>o.login(t.baseURL))):((!a||!m)&&o.login(t.baseURL),Promise.reject("Unauthorized! Please login again.")):(n(a||"Something went wrong!"),Promise.reject(e.response.data))}return r}const d=t=>{const[n,r]=g.useState([]);return g.useEffect(()=>{l.get(`${t}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>r(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[t]),n},c=t=>(n,r)=>{const s=d(t);return r?n.every(e=>s==null?void 0:s.includes(e)):n.some(e=>s==null?void 0:s.includes(e))},E=({baseUrl:t,accessWith:n,requireAll:r,children:s})=>c(t)(n,r)?i.jsx(i.Fragment,{children:s}):null,f=({accessWith:t,requireAll:n,baseUrl:r,unAuthorizedPath:s,children:e})=>c(r)(t,n)?i.jsx(i.Fragment,{children:e}):i.jsx(R.Navigate,{to:s,replace:!0});exports.AuthProvider=o.AuthProvider;exports.search=o.search;exports.useAuth=o.useAuth;exports.HasPermission=E;exports.PermissionRoute=f;exports.getAxiosInstance=q;exports.getUseHasPermission=c;exports.useGetPermission=d;
|
package/dist/share/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { t as h, p as E, E as g } from "../index.module-
|
|
2
|
-
import { A as
|
|
1
|
+
import { t as h, p as E, E as g } from "../index.module-34bab88b.js";
|
|
2
|
+
import { A as H, i as L, u as N } from "../index.module-34bab88b.js";
|
|
3
3
|
import f from "axios";
|
|
4
4
|
import { jsx as a, Fragment as P } from "react/jsx-runtime";
|
|
5
5
|
import { useState as d, useEffect as R } from "react";
|
|
6
|
+
import "@r2wc/react-to-web-component";
|
|
6
7
|
import { Navigate as y } from "react-router-dom";
|
|
7
8
|
import "react-dom";
|
|
8
9
|
import "@mui/material";
|
|
9
10
|
import "moment";
|
|
10
|
-
function
|
|
11
|
+
function T({
|
|
11
12
|
config: t,
|
|
12
13
|
pushError: n = E
|
|
13
14
|
}) {
|
|
@@ -46,12 +47,12 @@ const x = (t) => {
|
|
|
46
47
|
) : n.some(
|
|
47
48
|
(e) => r == null ? void 0 : r.includes(e)
|
|
48
49
|
);
|
|
49
|
-
},
|
|
50
|
+
}, U = ({
|
|
50
51
|
baseUrl: t,
|
|
51
52
|
accessWith: n,
|
|
52
53
|
requireAll: s,
|
|
53
54
|
children: r
|
|
54
|
-
}) => l(t)(n, s) ? /* @__PURE__ */ a(P, { children: r }) : null,
|
|
55
|
+
}) => l(t)(n, s) ? /* @__PURE__ */ a(P, { children: r }) : null, k = ({
|
|
55
56
|
accessWith: t,
|
|
56
57
|
requireAll: n,
|
|
57
58
|
baseUrl: s,
|
|
@@ -59,12 +60,12 @@ const x = (t) => {
|
|
|
59
60
|
children: e
|
|
60
61
|
}) => l(s)(t, n) ? /* @__PURE__ */ a(P, { children: e }) : /* @__PURE__ */ a(y, { to: r, replace: !0 });
|
|
61
62
|
export {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
H as AuthProvider,
|
|
64
|
+
U as HasPermission,
|
|
65
|
+
k as PermissionRoute,
|
|
66
|
+
T as getAxiosInstance,
|
|
66
67
|
l as getUseHasPermission,
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
L as search,
|
|
69
|
+
N as useAuth,
|
|
69
70
|
x as useGetPermission
|
|
70
71
|
};
|