@ukpc-lib/react 0.1.18 → 0.1.20
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/README.md +114 -114
- package/package.json +100 -100
- package/dist/components/GlobalMenu/components/Dropdown.d.ts +0 -8
- package/dist/components/GlobalMenu/components/MenuItem.d.ts +0 -15
- package/dist/components/GlobalMenu/helpers/index.d.ts +0 -0
- package/dist/components/GlobalMenu/icons/IconCollapsed.d.ts +0 -2
- package/dist/components/GlobalMenu/icons/IconDown.d.ts +0 -3
- package/dist/components/GlobalMenu/icons/IconExpand.d.ts +0 -2
- package/dist/components/GlobalMenu/icons/IconLogout.d.ts +0 -2
- package/dist/components/GlobalMenu/index.d.ts +0 -7
- package/dist/components/GlobalMenu/models/MenuItemDto.d.ts +0 -8
- package/dist/components/GlobalMenu/models/index.d.ts +0 -1
- package/dist/components/LanguageSwitcher/index.d.ts +0 -1
- package/dist/components/LogoutConfirmModal/index.d.ts +0 -7
- package/dist/components/NoData/index.d.ts +0 -2
- package/dist/components/NotFoundPage/index.d.ts +0 -4
- package/dist/components/PopUp/index.d.ts +0 -8
- package/dist/components/PopUp/types.d.ts +0 -26
- package/dist/components/ShadownDom/index.d.ts +0 -8
- package/dist/components/StyledAutocomplete/AutocompleteOption.d.ts +0 -11
- package/dist/components/StyledAutocomplete/StyledAutocomplete.d.ts +0 -29
- package/dist/components/StyledAutocomplete/helpers.d.ts +0 -1
- package/dist/components/StyledAutocomplete/index.d.ts +0 -3
- package/dist/components/StyledAutocomplete/types.d.ts +0 -46
- package/dist/components/StyledAutocomplete/useStyledAutocomplete.d.ts +0 -28
- package/dist/components/StyledDateRangePicker/BlockIcon.d.ts +0 -4
- package/dist/components/StyledDateRangePicker/index.d.ts +0 -13
- package/dist/components/Toast/ToastConfig.d.ts +0 -2
- package/dist/components/Toast/icons/ErrorIcon.d.ts +0 -1
- package/dist/components/Toast/icons/SuccessIcon.d.ts +0 -1
- package/dist/components/Toast/icons/WarningIcon.d.ts +0 -1
- package/dist/components/Toast/index.d.ts +0 -5
- package/dist/components/Topbar/icons/MessageIcon.d.ts +0 -4
- package/dist/components/Topbar/icons/NotificationIcon.d.ts +0 -3
- package/dist/components/Topbar/index.d.ts +0 -29
- package/dist/components/UnauthorizedPage/index.d.ts +0 -1
- package/dist/components/index.cjs +0 -65
- package/dist/components/index.d.ts +0 -9
- package/dist/components/index.js +0 -10045
- package/dist/index.css +0 -1
- package/dist/index.es-02587e7d.js +0 -19565
- package/dist/index.es-0621a3fe.cjs +0 -173
- package/dist/share/AuthProvider/index.d.ts +0 -20
- package/dist/share/helpers/index.d.ts +0 -1
- package/dist/share/hooks/index.d.ts +0 -1
- package/dist/share/hooks/useGetPermission.d.ts +0 -1
- package/dist/share/index.cjs +0 -1
- package/dist/share/index.d.ts +0 -5
- package/dist/share/index.js +0 -78
- package/dist/share/interceptor/index.d.ts +0 -7
- package/dist/share/interceptor/interceptor.const.d.ts +0 -6
- package/dist/share/permissions/HasPermission.d.ts +0 -9
- package/dist/share/permissions/PermissionRoute.d.ts +0 -9
- package/dist/share/permissions/index.d.ts +0 -2
- package/web-components-bundle/global-menu/index.cjs +0 -91
- package/web-components-bundle/global-menu/index.js +0 -18099
- package/web-components-bundle/global-topbar/index.cjs +0 -3
- package/web-components-bundle/global-topbar/index.js +0 -228
- package/web-components-bundle/index-3a3447c8.cjs +0 -69
- package/web-components-bundle/index-688657b9.js +0 -9352
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import { UseQueryResult } from 'react-query';
|
|
3
|
-
type User = {
|
|
4
|
-
firstName: string;
|
|
5
|
-
lastName: string;
|
|
6
|
-
countryCode?: string;
|
|
7
|
-
status?: string;
|
|
8
|
-
email?: string;
|
|
9
|
-
avatarUrl?: string;
|
|
10
|
-
};
|
|
11
|
-
export declare const AuthProvider: FC<PropsWithChildren & {
|
|
12
|
-
baseUrl: string;
|
|
13
|
-
userData: UseQueryResult;
|
|
14
|
-
}>;
|
|
15
|
-
export declare const useAuth: () => {
|
|
16
|
-
login: () => void;
|
|
17
|
-
logout: () => void;
|
|
18
|
-
user: User;
|
|
19
|
-
};
|
|
20
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function search<T>(option: T, searchText: string, fields: Array<keyof T>): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useGetPermission';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useGetPermission: (baseUrl: string) => string[];
|
package/dist/share/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.es-0621a3fe.cjs"),R=require("axios"),i=require("react/jsx-runtime"),d=require("react"),f=require("react-router-dom");require("react-dom");require("@mui/material");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)return a._retry=!0,t.post("/authentication/api/v1/auth/refresh-token").then(()=>t(a)).catch(()=>o.login(n.baseURL));if(((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)))return o.login(n.baseURL);if(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))},q=({baseUrl:n,accessWith:r,requireAll:t,children:s})=>u(n)(r,t)?i.jsx(i.Fragment,{children:s}):null,A=({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=q;exports.PermissionRoute=A;exports.getAxiosInstance=j;exports.getUseHasPermission=u;exports.useGetPermission=E;
|
package/dist/share/index.d.ts
DELETED
package/dist/share/index.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { E as f, j as E, p as R } from "../index.es-02587e7d.js";
|
|
2
|
-
import { A as H, s as K, u as L } from "../index.es-02587e7d.js";
|
|
3
|
-
import P from "axios";
|
|
4
|
-
import { jsx as a, Fragment as d } from "react/jsx-runtime";
|
|
5
|
-
import { useState as j, useEffect as y } from "react";
|
|
6
|
-
import { Navigate as A } from "react-router-dom";
|
|
7
|
-
import "react-dom";
|
|
8
|
-
import "@mui/material";
|
|
9
|
-
import "moment";
|
|
10
|
-
function O({
|
|
11
|
-
config: r,
|
|
12
|
-
pushError: n = R
|
|
13
|
-
}) {
|
|
14
|
-
const t = P.create(r);
|
|
15
|
-
t.interceptors.request.use(
|
|
16
|
-
async (e) => (e.headers = {
|
|
17
|
-
Accept: "application/json",
|
|
18
|
-
"Content-Type": "application/json"
|
|
19
|
-
}, e),
|
|
20
|
-
(e) => Promise.reject(e)
|
|
21
|
-
), t.interceptors.response.use(
|
|
22
|
-
(e) => e,
|
|
23
|
-
async (e) => s(e)
|
|
24
|
-
);
|
|
25
|
-
function s(e) {
|
|
26
|
-
var i, u, p, c, m, h;
|
|
27
|
-
console.error("Error 🚨:", e);
|
|
28
|
-
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)
|
|
30
|
-
return o._retry = !0, t.post("/authentication/api/v1/auth/refresh-token").then(() => t(o)).catch(() => E(r.baseURL));
|
|
31
|
-
if (((u = e.response) == null ? void 0 : u.status) === 401 && (((p = e.response) == null ? void 0 : p.data.errorMessage) !== f.TOKEN_EXPIRED || !((c = e.response) != null && c.data.errorMessage)))
|
|
32
|
-
return E(r.baseURL);
|
|
33
|
-
if (e.response.status !== 401) {
|
|
34
|
-
const l = ((m = e.response) == null ? void 0 : m.data) && ((h = e.response.data) == null ? void 0 : h.errorMessage) || "Something went wrong!";
|
|
35
|
-
return n(l), Promise.reject(e.response.data);
|
|
36
|
-
}
|
|
37
|
-
return Promise.reject(e);
|
|
38
|
-
}
|
|
39
|
-
return t;
|
|
40
|
-
}
|
|
41
|
-
const v = (r) => {
|
|
42
|
-
const [n, t] = j([]);
|
|
43
|
-
return y(() => {
|
|
44
|
-
P.get(`${r}/user-management/api/v1/users/my-account/permissions`, {
|
|
45
|
-
withCredentials: !0
|
|
46
|
-
}).then((s) => t(s.data)).catch((s) => {
|
|
47
|
-
console.error("Getting user permission error:", s);
|
|
48
|
-
});
|
|
49
|
-
}, [r]), n;
|
|
50
|
-
}, g = (r) => (n, t) => {
|
|
51
|
-
const s = v(r);
|
|
52
|
-
return t ? n.every(
|
|
53
|
-
(e) => s == null ? void 0 : s.includes(e)
|
|
54
|
-
) : n.some(
|
|
55
|
-
(e) => s == null ? void 0 : s.includes(e)
|
|
56
|
-
);
|
|
57
|
-
}, T = ({
|
|
58
|
-
baseUrl: r,
|
|
59
|
-
accessWith: n,
|
|
60
|
-
requireAll: t,
|
|
61
|
-
children: s
|
|
62
|
-
}) => g(r)(n, t) ? /* @__PURE__ */ a(d, { children: s }) : null, q = ({
|
|
63
|
-
accessWith: r,
|
|
64
|
-
requireAll: n,
|
|
65
|
-
baseUrl: t,
|
|
66
|
-
unAuthorizedPath: s,
|
|
67
|
-
children: e
|
|
68
|
-
}) => g(t)(r, n) ? /* @__PURE__ */ a(d, { children: e }) : /* @__PURE__ */ a(A, { to: s, replace: !0 });
|
|
69
|
-
export {
|
|
70
|
-
H as AuthProvider,
|
|
71
|
-
T as HasPermission,
|
|
72
|
-
q as PermissionRoute,
|
|
73
|
-
O as getAxiosInstance,
|
|
74
|
-
g as getUseHasPermission,
|
|
75
|
-
K as search,
|
|
76
|
-
L as useAuth,
|
|
77
|
-
v as useGetPermission
|
|
78
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
type TgetAxiosInstanceParams = {
|
|
3
|
-
config: AxiosRequestConfig;
|
|
4
|
-
pushError?: (message: string) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare function getAxiosInstance({ config, pushError, }: TgetAxiosInstanceParams): import("axios").AxiosInstance;
|
|
7
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
export declare const getUseHasPermission: (baseUrl: string) => (accessWith: string[], requireAll?: boolean) => boolean;
|
|
3
|
-
type HasPermissionProps = {
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
accessWith: string[];
|
|
6
|
-
requireAll?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare const HasPermission: ({ baseUrl, accessWith, requireAll, children, }: PropsWithChildren<HasPermissionProps>) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
type PermissionRouteProps = {
|
|
3
|
-
accessWith: string[];
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
requireAll?: boolean;
|
|
6
|
-
unAuthorizedPath: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const PermissionRoute: ({ accessWith, requireAll, baseUrl, unAuthorizedPath, children, }: PropsWithChildren<PermissionRouteProps>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|