@ukpc-lib/react 0.1.14 → 0.1.15
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 +22 -26
- package/dist/components/index.js +2292 -7480
- package/dist/index.es-088789c7.cjs +177 -0
- package/dist/index.es-bb5fb95c.js +24653 -0
- package/dist/share/index.cjs +1 -1
- package/dist/share/index.js +18 -19
- package/package.json +1 -1
- package/web-components-bundle/global-menu/index.cjs +22 -22
- package/web-components-bundle/global-menu/index.js +1670 -1769
- package/dist/index.es-4032ffe1.js +0 -19562
- package/dist/index.es-6cb46e89.cjs +0 -173
- /package/dist/{src/components → components}/GlobalMenu/components/Dropdown.d.ts +0 -0
- /package/dist/{src/components → components}/GlobalMenu/components/MenuItem.d.ts +0 -0
- /package/dist/{src/components → components}/GlobalMenu/helpers/index.d.ts +0 -0
- /package/dist/{src/components → components}/GlobalMenu/icons/IconCollapsed.d.ts +0 -0
- /package/dist/{src/components → components}/GlobalMenu/icons/IconDown.d.ts +0 -0
- /package/dist/{src/components → components}/GlobalMenu/icons/IconExpand.d.ts +0 -0
- /package/dist/{src/components → components}/GlobalMenu/icons/IconLogout.d.ts +0 -0
- /package/dist/{src/components → components}/GlobalMenu/index.d.ts +0 -0
- /package/dist/{src/components → components}/GlobalMenu/models/MenuItemDto.d.ts +0 -0
- /package/dist/{src/components → components}/GlobalMenu/models/index.d.ts +0 -0
- /package/dist/{src/components → components}/LanguageSwitcher/index.d.ts +0 -0
- /package/dist/{src/components → components}/LogoutConfirmModal/index.d.ts +0 -0
- /package/dist/{src/components → components}/NoData/index.d.ts +0 -0
- /package/dist/{src/components → components}/NotFoundPage/index.d.ts +0 -0
- /package/dist/{src/components → components}/PopUp/index.d.ts +0 -0
- /package/dist/{src/components → components}/PopUp/types.d.ts +0 -0
- /package/dist/{src/components → components}/ShadownDom/index.d.ts +0 -0
- /package/dist/{src/components → components}/StyledAutocomplete/AutocompleteOption.d.ts +0 -0
- /package/dist/{src/components → components}/StyledAutocomplete/StyledAutocomplete.d.ts +0 -0
- /package/dist/{src/components → components}/StyledAutocomplete/helpers.d.ts +0 -0
- /package/dist/{src/components → components}/StyledAutocomplete/index.d.ts +0 -0
- /package/dist/{src/components → components}/StyledAutocomplete/types.d.ts +0 -0
- /package/dist/{src/components → components}/StyledAutocomplete/useStyledAutocomplete.d.ts +0 -0
- /package/dist/{src/components → components}/StyledDateRangePicker/BlockIcon.d.ts +0 -0
- /package/dist/{src/components → components}/StyledDateRangePicker/index.d.ts +0 -0
- /package/dist/{src/components → components}/Toast/ToastConfig.d.ts +0 -0
- /package/dist/{src/components → components}/Toast/icons/ErrorIcon.d.ts +0 -0
- /package/dist/{src/components → components}/Toast/icons/SuccessIcon.d.ts +0 -0
- /package/dist/{src/components → components}/Toast/icons/WarningIcon.d.ts +0 -0
- /package/dist/{src/components → components}/Toast/index.d.ts +0 -0
- /package/dist/{src/components → components}/Topbar/icons/MessageIcon.d.ts +0 -0
- /package/dist/{src/components → components}/Topbar/icons/NotificationIcon.d.ts +0 -0
- /package/dist/{src/components → components}/Topbar/index.d.ts +0 -0
- /package/dist/{src/components → components}/UnauthorizedPage/index.d.ts +0 -0
- /package/dist/{src/components → components}/index.d.ts +0 -0
- /package/dist/{src/share → share}/AuthProvider/index.d.ts +0 -0
- /package/dist/{src/share → share}/helpers/index.d.ts +0 -0
- /package/dist/{src/share → share}/hooks/index.d.ts +0 -0
- /package/dist/{src/share → share}/hooks/useGetPermission.d.ts +0 -0
- /package/dist/{src/share → share}/index.d.ts +0 -0
- /package/dist/{src/share → share}/interceptor/index.d.ts +0 -0
- /package/dist/{src/share → share}/interceptor/interceptor.const.d.ts +0 -0
- /package/dist/{src/share → share}/permissions/HasPermission.d.ts +0 -0
- /package/dist/{src/share → share}/permissions/PermissionRoute.d.ts +0 -0
- /package/dist/{src/share → share}/permissions/index.d.ts +0 -0
package/dist/share/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.es-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.es-088789c7.cjs"),R=require("axios"),i=require("react/jsx-runtime"),d=require("react");require("@mui/material");const f=require("react-router-dom");require("moment");function j({config:n,pushError:r=o.pushError}){const t=R.create(n);t.interceptors.request.use(async e=>(e.headers={Accept:"application/json","Content-Type":"application/json"},e),e=>Promise.reject(e)),t.interceptors.response.use(e=>e,async e=>s(e));function s(e){var c,p,m,h,P,g;console.error("Error 🚨:",e);const a=e==null?void 0:e.config;if(((c=e.response)==null?void 0:c.status)===401&&e.response.data.errorMessage===o.ERROR_MESSAGE.TOKEN_EXPIRED&&!a._retry&&(a._retry=!0,t.post("/authentication/api/v1/auth/refresh-token").then(()=>t(a)).catch(()=>o.login(n.baseURL))),((p=e.response)==null?void 0:p.status)===401&&(((m=e.response)==null?void 0:m.data.errorMessage)!==o.ERROR_MESSAGE.TOKEN_EXPIRED||!((h=e.response)!=null&&h.data.errorMessage))&&o.login(n.baseURL),e.response.status!==401){const l=((P=e.response)==null?void 0:P.data)&&((g=e.response.data)==null?void 0:g.errorMessage)||"Something went wrong!";return r(l),Promise.reject(e.response.data)}return Promise.reject(e)}return t}const E=n=>{const[r,t]=d.useState([]);return d.useEffect(()=>{R.get(`${n}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>t(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[n]),r},u=n=>(r,t)=>{const s=E(n);return t?r.every(e=>s==null?void 0:s.includes(e)):r.some(e=>s==null?void 0:s.includes(e))},A=({baseUrl:n,accessWith:r,requireAll:t,children:s})=>u(n)(r,t)?i.jsx(i.Fragment,{children:s}):null,q=({accessWith:n,requireAll:r,baseUrl:t,unAuthorizedPath:s,children:e})=>u(t)(n,r)?i.jsx(i.Fragment,{children:e}):i.jsx(f.Navigate,{to:s,replace:!0});exports.AuthProvider=o.AuthProvider;exports.search=o.search;exports.useAuth=o.useAuth;exports.HasPermission=A;exports.PermissionRoute=q;exports.getAxiosInstance=j;exports.getUseHasPermission=u;exports.useGetPermission=E;
|
package/dist/share/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { E as f,
|
|
2
|
-
import { A as
|
|
1
|
+
import { E as f, h as E, p as R } from "../index.es-bb5fb95c.js";
|
|
2
|
+
import { A as D, s as H, u as K } from "../index.es-bb5fb95c.js";
|
|
3
3
|
import P from "axios";
|
|
4
4
|
import { jsx as a, Fragment as d } from "react/jsx-runtime";
|
|
5
|
-
import { useState as
|
|
6
|
-
import { Navigate as A } from "react-router-dom";
|
|
7
|
-
import "react-dom";
|
|
5
|
+
import { useState as y, useEffect as A } from "react";
|
|
8
6
|
import "@mui/material";
|
|
7
|
+
import { Navigate as j } from "react-router-dom";
|
|
9
8
|
import "moment";
|
|
10
|
-
function
|
|
9
|
+
function N({
|
|
11
10
|
config: r,
|
|
12
11
|
pushError: n = R
|
|
13
12
|
}) {
|
|
@@ -23,10 +22,10 @@ function O({
|
|
|
23
22
|
async (e) => s(e)
|
|
24
23
|
);
|
|
25
24
|
function s(e) {
|
|
26
|
-
var i, u,
|
|
25
|
+
var i, u, c, p, m, h;
|
|
27
26
|
console.error("Error 🚨:", e);
|
|
28
27
|
const o = e == null ? void 0 : e.config;
|
|
29
|
-
if (((i = e.response) == null ? void 0 : i.status) === 401 && e.response.data.errorMessage === f.TOKEN_EXPIRED && !o._retry && (o._retry = !0, t.post("/authentication/api/v1/auth/refresh-token").then(() => t(o)).catch(() => E(r.baseURL))), ((u = e.response) == null ? void 0 : u.status) === 401 && (((
|
|
28
|
+
if (((i = e.response) == null ? void 0 : i.status) === 401 && e.response.data.errorMessage === f.TOKEN_EXPIRED && !o._retry && (o._retry = !0, t.post("/authentication/api/v1/auth/refresh-token").then(() => t(o)).catch(() => E(r.baseURL))), ((u = e.response) == null ? void 0 : u.status) === 401 && (((c = e.response) == null ? void 0 : c.data.errorMessage) !== f.TOKEN_EXPIRED || !((p = e.response) != null && p.data.errorMessage)) && E(r.baseURL), e.response.status !== 401) {
|
|
30
29
|
const l = ((m = e.response) == null ? void 0 : m.data) && ((h = e.response.data) == null ? void 0 : h.errorMessage) || "Something went wrong!";
|
|
31
30
|
return n(l), Promise.reject(e.response.data);
|
|
32
31
|
}
|
|
@@ -35,8 +34,8 @@ function O({
|
|
|
35
34
|
return t;
|
|
36
35
|
}
|
|
37
36
|
const v = (r) => {
|
|
38
|
-
const [n, t] =
|
|
39
|
-
return
|
|
37
|
+
const [n, t] = y([]);
|
|
38
|
+
return A(() => {
|
|
40
39
|
P.get(`${r}/user-management/api/v1/users/my-account/permissions`, {
|
|
41
40
|
withCredentials: !0
|
|
42
41
|
}).then((s) => t(s.data)).catch((s) => {
|
|
@@ -50,25 +49,25 @@ const v = (r) => {
|
|
|
50
49
|
) : n.some(
|
|
51
50
|
(e) => s == null ? void 0 : s.includes(e)
|
|
52
51
|
);
|
|
53
|
-
},
|
|
52
|
+
}, O = ({
|
|
54
53
|
baseUrl: r,
|
|
55
54
|
accessWith: n,
|
|
56
55
|
requireAll: t,
|
|
57
56
|
children: s
|
|
58
|
-
}) => g(r)(n, t) ? /* @__PURE__ */ a(d, { children: s }) : null,
|
|
57
|
+
}) => g(r)(n, t) ? /* @__PURE__ */ a(d, { children: s }) : null, T = ({
|
|
59
58
|
accessWith: r,
|
|
60
59
|
requireAll: n,
|
|
61
60
|
baseUrl: t,
|
|
62
61
|
unAuthorizedPath: s,
|
|
63
62
|
children: e
|
|
64
|
-
}) => g(t)(r, n) ? /* @__PURE__ */ a(d, { children: e }) : /* @__PURE__ */ a(
|
|
63
|
+
}) => g(t)(r, n) ? /* @__PURE__ */ a(d, { children: e }) : /* @__PURE__ */ a(j, { to: s, replace: !0 });
|
|
65
64
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
D as AuthProvider,
|
|
66
|
+
O as HasPermission,
|
|
67
|
+
T as PermissionRoute,
|
|
68
|
+
N as getAxiosInstance,
|
|
70
69
|
g as getUseHasPermission,
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
H as search,
|
|
71
|
+
K as useAuth,
|
|
73
72
|
v as useGetPermission
|
|
74
73
|
};
|