@ukpc-lib/react 0.1.16 → 0.1.18
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 -109
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +2 -2
- package/dist/{index.es-4032ffe1.js → index.es-02587e7d.js} +5082 -5079
- package/dist/{index.es-6cb46e89.cjs → index.es-0621a3fe.cjs} +18 -18
- package/dist/share/index.cjs +1 -1
- package/dist/share/index.js +7 -3
- package/package.json +100 -100
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-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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as f, j as E, p as R } from "../index.es-
|
|
2
|
-
import { A as H, s as K, u as L } from "../index.es-
|
|
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
3
|
import P from "axios";
|
|
4
4
|
import { jsx as a, Fragment as d } from "react/jsx-runtime";
|
|
5
5
|
import { useState as j, useEffect as y } from "react";
|
|
@@ -26,7 +26,11 @@ function O({
|
|
|
26
26
|
var i, u, p, c, m, h;
|
|
27
27
|
console.error("Error 🚨:", e);
|
|
28
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
|
|
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) {
|
|
30
34
|
const l = ((m = e.response) == null ? void 0 : m.data) && ((h = e.response.data) == null ? void 0 : h.errorMessage) || "Something went wrong!";
|
|
31
35
|
return n(l), Promise.reject(e.response.data);
|
|
32
36
|
}
|
package/package.json
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@ukpc-lib/react",
|
|
3
|
-
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/",
|
|
7
|
-
"module": "./dist/",
|
|
8
|
-
"exports": {
|
|
9
|
-
"./components": {
|
|
10
|
-
"import": "./dist/components/index.js",
|
|
11
|
-
"require": "./dist/components/index.cjs",
|
|
12
|
-
"types": "./dist/components/index.d.ts"
|
|
13
|
-
},
|
|
14
|
-
"./share": {
|
|
15
|
-
"import": "./dist/share/index.js",
|
|
16
|
-
"require": "./dist/share/index.cjs",
|
|
17
|
-
"types": "./dist/share/index.d.ts"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"typesVersions": {
|
|
21
|
-
"*": {
|
|
22
|
-
"*": [
|
|
23
|
-
"./dist/*/index.d.ts"
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"files": [
|
|
28
|
-
"dist",
|
|
29
|
-
"web-components-bundle"
|
|
30
|
-
],
|
|
31
|
-
"scripts": {
|
|
32
|
-
"dev": "vite --open --port 3000",
|
|
33
|
-
"build": "npm run build-react && npm run build-wc",
|
|
34
|
-
"build-react": "tsc && vite build --config vite.config.react.ts",
|
|
35
|
-
"build-wc": "tsc && vite build --config vite.config.wc.ts --mode production",
|
|
36
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
37
|
-
"preview": "vite preview",
|
|
38
|
-
"publish": "npm publish --access public",
|
|
39
|
-
"build-publish": "npm run build && npm version patch && npm run build && npm run publish && git push"
|
|
40
|
-
},
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"@emotion/react": "^11.11.3",
|
|
43
|
-
"@emotion/styled": "^11.11.0",
|
|
44
|
-
"@mui/icons-material": "^5.15.4",
|
|
45
|
-
"@mui/material": "^5.15.4",
|
|
46
|
-
"@r2wc/react-to-web-component": "^2.0.3",
|
|
47
|
-
"@rollup/plugin-replace": "^5.0.5",
|
|
48
|
-
"axios": "^1.6.5",
|
|
49
|
-
"bootstrap-daterangepicker": "^3.1.0",
|
|
50
|
-
"cssnano": "^6.0.3",
|
|
51
|
-
"framer-motion": "^10.18.0",
|
|
52
|
-
"jquery": "^3.7.1",
|
|
53
|
-
"moment": "^2.30.1",
|
|
54
|
-
"react-bootstrap-daterangepicker": "^8.0.0",
|
|
55
|
-
"react-query": "^3.39.3",
|
|
56
|
-
"react-router-dom": "^6.21.3",
|
|
57
|
-
"react-shadow": "^20.4.0",
|
|
58
|
-
"react-svg": "^16.1.32",
|
|
59
|
-
"react-toastify": "^10.0.4",
|
|
60
|
-
"react-window": "^1.8.10",
|
|
61
|
-
"react-window-infinite-loader": "^1.0.9",
|
|
62
|
-
"simplebar-react": "^3.2.4",
|
|
63
|
-
"usehooks-ts": "^2.15.1",
|
|
64
|
-
"vite-plugin-css-injected-by-js": "^3.3.1"
|
|
65
|
-
},
|
|
66
|
-
"devDependencies": {
|
|
67
|
-
"@types/node": "^20.8.10",
|
|
68
|
-
"@types/react": "^18.2.15",
|
|
69
|
-
"@types/react-dom": "^18.2.7",
|
|
70
|
-
"@types/react-window-infinite-loader": "^1.0.9",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
72
|
-
"@typescript-eslint/parser": "^6.0.0",
|
|
73
|
-
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
74
|
-
"autoprefixer": "^10.4.16",
|
|
75
|
-
"eslint": "^8.45.0",
|
|
76
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
77
|
-
"eslint-plugin-react-refresh": "^0.4.3",
|
|
78
|
-
"postcss": "^8.4.33",
|
|
79
|
-
"prettier": "^3.0.3",
|
|
80
|
-
"react": "^18.2.0",
|
|
81
|
-
"react-dom": "^18.2.0",
|
|
82
|
-
"tailwindcss": "^3.4.1",
|
|
83
|
-
"typescript": "^5.0.2",
|
|
84
|
-
"vite": "^4.5.1",
|
|
85
|
-
"vite-plugin-css-injected-by-js": "^3.3.1",
|
|
86
|
-
"vite-plugin-dts": "^3.7.0",
|
|
87
|
-
"vite-plugin-lib-inject-css": "^1.3.0"
|
|
88
|
-
},
|
|
89
|
-
"peerDependencies": {
|
|
90
|
-
"@mui/material": "^5.15.4",
|
|
91
|
-
"react": "^18.2.0",
|
|
92
|
-
"react-dom": "^18.2.0",
|
|
93
|
-
"react-query": "^3.39.3",
|
|
94
|
-
"react-router-dom": "^6.21.3",
|
|
95
|
-
"tailwindcss": "^3.4.1"
|
|
96
|
-
},
|
|
97
|
-
"author": "Thinh Phung",
|
|
98
|
-
"description": "",
|
|
99
|
-
"license": "ISC"
|
|
100
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@ukpc-lib/react",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.1.18",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/",
|
|
7
|
+
"module": "./dist/",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./components": {
|
|
10
|
+
"import": "./dist/components/index.js",
|
|
11
|
+
"require": "./dist/components/index.cjs",
|
|
12
|
+
"types": "./dist/components/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./share": {
|
|
15
|
+
"import": "./dist/share/index.js",
|
|
16
|
+
"require": "./dist/share/index.cjs",
|
|
17
|
+
"types": "./dist/share/index.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"typesVersions": {
|
|
21
|
+
"*": {
|
|
22
|
+
"*": [
|
|
23
|
+
"./dist/*/index.d.ts"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"web-components-bundle"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"dev": "vite --open --port 3000",
|
|
33
|
+
"build": "npm run build-react && npm run build-wc",
|
|
34
|
+
"build-react": "tsc && vite build --config vite.config.react.ts",
|
|
35
|
+
"build-wc": "tsc && vite build --config vite.config.wc.ts --mode production",
|
|
36
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
37
|
+
"preview": "vite preview",
|
|
38
|
+
"publish": "npm publish --access public",
|
|
39
|
+
"build-publish": "npm run build && npm version patch && npm run build && npm run publish && git push"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@emotion/react": "^11.11.3",
|
|
43
|
+
"@emotion/styled": "^11.11.0",
|
|
44
|
+
"@mui/icons-material": "^5.15.4",
|
|
45
|
+
"@mui/material": "^5.15.4",
|
|
46
|
+
"@r2wc/react-to-web-component": "^2.0.3",
|
|
47
|
+
"@rollup/plugin-replace": "^5.0.5",
|
|
48
|
+
"axios": "^1.6.5",
|
|
49
|
+
"bootstrap-daterangepicker": "^3.1.0",
|
|
50
|
+
"cssnano": "^6.0.3",
|
|
51
|
+
"framer-motion": "^10.18.0",
|
|
52
|
+
"jquery": "^3.7.1",
|
|
53
|
+
"moment": "^2.30.1",
|
|
54
|
+
"react-bootstrap-daterangepicker": "^8.0.0",
|
|
55
|
+
"react-query": "^3.39.3",
|
|
56
|
+
"react-router-dom": "^6.21.3",
|
|
57
|
+
"react-shadow": "^20.4.0",
|
|
58
|
+
"react-svg": "^16.1.32",
|
|
59
|
+
"react-toastify": "^10.0.4",
|
|
60
|
+
"react-window": "^1.8.10",
|
|
61
|
+
"react-window-infinite-loader": "^1.0.9",
|
|
62
|
+
"simplebar-react": "^3.2.4",
|
|
63
|
+
"usehooks-ts": "^2.15.1",
|
|
64
|
+
"vite-plugin-css-injected-by-js": "^3.3.1"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@types/node": "^20.8.10",
|
|
68
|
+
"@types/react": "^18.2.15",
|
|
69
|
+
"@types/react-dom": "^18.2.7",
|
|
70
|
+
"@types/react-window-infinite-loader": "^1.0.9",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
72
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
73
|
+
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
74
|
+
"autoprefixer": "^10.4.16",
|
|
75
|
+
"eslint": "^8.45.0",
|
|
76
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
77
|
+
"eslint-plugin-react-refresh": "^0.4.3",
|
|
78
|
+
"postcss": "^8.4.33",
|
|
79
|
+
"prettier": "^3.0.3",
|
|
80
|
+
"react": "^18.2.0",
|
|
81
|
+
"react-dom": "^18.2.0",
|
|
82
|
+
"tailwindcss": "^3.4.1",
|
|
83
|
+
"typescript": "^5.0.2",
|
|
84
|
+
"vite": "^4.5.1",
|
|
85
|
+
"vite-plugin-css-injected-by-js": "^3.3.1",
|
|
86
|
+
"vite-plugin-dts": "^3.7.0",
|
|
87
|
+
"vite-plugin-lib-inject-css": "^1.3.0"
|
|
88
|
+
},
|
|
89
|
+
"peerDependencies": {
|
|
90
|
+
"@mui/material": "^5.15.4",
|
|
91
|
+
"react": "^18.2.0",
|
|
92
|
+
"react-dom": "^18.2.0",
|
|
93
|
+
"react-query": "^3.39.3",
|
|
94
|
+
"react-router-dom": "^6.21.3",
|
|
95
|
+
"tailwindcss": "^3.4.1"
|
|
96
|
+
},
|
|
97
|
+
"author": "Thinh Phung",
|
|
98
|
+
"description": "",
|
|
99
|
+
"license": "ISC"
|
|
100
|
+
}
|