react-ecosistema-unp 1.7.15 → 1.7.16-pre.1
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 +61 -61
- package/dist/lib/assets/animations/noData.json.d.ts +5866 -5866
- package/dist/lib/assets/animations/noInfo.json.d.ts +2981 -2981
- package/dist/shared/menu-lateral/MenuLateral.js +9 -9
- package/dist/ui/logo/Logo.js +6 -6
- package/dist/utils/components/ProtectedRoute.js +52 -29
- package/dist/utils/components/UserRoute.js +45 -22
- package/package.json +113 -113
|
@@ -1,40 +1,63 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useNavigate as
|
|
4
|
-
import { j as
|
|
5
|
-
const
|
|
6
|
-
const [
|
|
7
|
-
|
|
1
|
+
import { jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useEffect as _ } from "react";
|
|
3
|
+
import { useNavigate as S, useLocation as T, Outlet as U } from "react-router-dom";
|
|
4
|
+
import { j as m } from "../../index-CuHybtft.js";
|
|
5
|
+
const E = () => {
|
|
6
|
+
const [d, s] = g(!1), u = S(), l = T(), o = `${window.location.protocol}//${window.location.host}/`, p = async () => {
|
|
7
|
+
if ((await fetch(`${o}api-auth/auth/refresh_token/`, {
|
|
8
|
+
method: "POST",
|
|
9
|
+
headers: {
|
|
10
|
+
"Content-Type": "application/json"
|
|
11
|
+
},
|
|
12
|
+
credentials: "include"
|
|
13
|
+
})).ok)
|
|
14
|
+
return !0;
|
|
15
|
+
throw new Error("Error al refrescar token de Microsoft");
|
|
16
|
+
};
|
|
17
|
+
return _(() => {
|
|
8
18
|
(async () => {
|
|
9
19
|
try {
|
|
10
|
-
if ((await fetch(
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
credentials: "include"
|
|
18
|
-
}
|
|
19
|
-
)).ok) {
|
|
20
|
+
if ((await fetch(`${o}api-auth/auth/validate_jwt/`, {
|
|
21
|
+
method: "POST",
|
|
22
|
+
headers: {
|
|
23
|
+
"Content-Type": "application/json"
|
|
24
|
+
},
|
|
25
|
+
credentials: "include"
|
|
26
|
+
})).ok) {
|
|
20
27
|
const a = sessionStorage.getItem("user_token");
|
|
21
28
|
if (a) {
|
|
22
|
-
const
|
|
23
|
-
(
|
|
24
|
-
),
|
|
25
|
-
|
|
26
|
-
(
|
|
27
|
-
) ?
|
|
29
|
+
const f = m(a).datos_basicos.servicios.map((e) => e.url).filter((e) => !!e), r = l.pathname, n = f.map(
|
|
30
|
+
(e) => e.startsWith("/") ? e : `/${e}`
|
|
31
|
+
), c = r.startsWith("/") ? r : `/${r}`;
|
|
32
|
+
n.some(
|
|
33
|
+
(e) => c.startsWith(e)
|
|
34
|
+
) ? s(!0) : (s(!1), sessionStorage.removeItem("user_token"), window.location.href = o);
|
|
28
35
|
} else
|
|
29
|
-
|
|
36
|
+
s(!1), sessionStorage.removeItem("user_token"), window.location.href = o;
|
|
30
37
|
} else
|
|
31
|
-
|
|
32
|
-
} catch
|
|
33
|
-
|
|
38
|
+
throw new Error("Token inválido");
|
|
39
|
+
} catch {
|
|
40
|
+
try {
|
|
41
|
+
if (await p()) {
|
|
42
|
+
const i = sessionStorage.getItem("user_token");
|
|
43
|
+
if (i) {
|
|
44
|
+
const r = m(i).datos_basicos.servicios.map((t) => t.url).filter((t) => !!t), n = l.pathname, c = r.map(
|
|
45
|
+
(t) => t.startsWith("/") ? t : `/${t}`
|
|
46
|
+
), h = n.startsWith("/") ? n : `/${n}`;
|
|
47
|
+
c.some(
|
|
48
|
+
(t) => h.startsWith(t)
|
|
49
|
+
) ? s(!0) : (s(!1), sessionStorage.removeItem("user_token"), window.location.href = o);
|
|
50
|
+
} else
|
|
51
|
+
s(!1), sessionStorage.removeItem("user_token"), window.location.href = o;
|
|
52
|
+
} else
|
|
53
|
+
throw new Error("No se pudo refrescar el token.");
|
|
54
|
+
} catch {
|
|
55
|
+
sessionStorage.removeItem("user_token"), window.location.href = o;
|
|
56
|
+
}
|
|
34
57
|
}
|
|
35
58
|
})();
|
|
36
|
-
}, [
|
|
59
|
+
}, [u]), d ? /* @__PURE__ */ v(U, {}) : null;
|
|
37
60
|
};
|
|
38
61
|
export {
|
|
39
|
-
|
|
62
|
+
E as ProtectedRoute
|
|
40
63
|
};
|
|
@@ -1,30 +1,53 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useNavigate as
|
|
4
|
-
const
|
|
5
|
-
const [
|
|
6
|
-
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useEffect as d } from "react";
|
|
3
|
+
import { useNavigate as h, Outlet as u } from "react-router-dom";
|
|
4
|
+
const k = () => {
|
|
5
|
+
const [o, t] = l(!1), r = h(), e = `${window.location.protocol}//${window.location.host}/`, s = async () => {
|
|
6
|
+
if ((await fetch(`${e}api-auth/auth/refresh_token/`, {
|
|
7
|
+
method: "POST",
|
|
8
|
+
headers: {
|
|
9
|
+
"Content-Type": "application/json"
|
|
10
|
+
},
|
|
11
|
+
credentials: "include"
|
|
12
|
+
})).ok)
|
|
13
|
+
return !0;
|
|
14
|
+
throw new Error("Error al refrescar token de Microsoft");
|
|
15
|
+
};
|
|
16
|
+
return d(() => {
|
|
7
17
|
(async () => {
|
|
8
18
|
try {
|
|
9
|
-
if ((await fetch(
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
)).ok)
|
|
19
|
-
r(!0);
|
|
19
|
+
if ((await fetch(`${e}api-auth/auth/validate_jwt/`, {
|
|
20
|
+
method: "POST",
|
|
21
|
+
headers: {
|
|
22
|
+
"Content-Type": "application/json"
|
|
23
|
+
},
|
|
24
|
+
credentials: "include"
|
|
25
|
+
})).ok)
|
|
26
|
+
t(!0);
|
|
20
27
|
else
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
try {
|
|
29
|
+
if (await s())
|
|
30
|
+
(await fetch(
|
|
31
|
+
`${e}api-auth/auth/validate_jwt/`,
|
|
32
|
+
{
|
|
33
|
+
method: "POST",
|
|
34
|
+
headers: {
|
|
35
|
+
"Content-Type": "application/json"
|
|
36
|
+
},
|
|
37
|
+
credentials: "include"
|
|
38
|
+
}
|
|
39
|
+
)).ok ? t(!0) : (sessionStorage.removeItem("user_token"), window.location.href = e);
|
|
40
|
+
else
|
|
41
|
+
throw new Error("No se pudo refrescar el token.");
|
|
42
|
+
} catch {
|
|
43
|
+
sessionStorage.removeItem("user_token"), window.location.href = e;
|
|
44
|
+
}
|
|
45
|
+
} catch {
|
|
46
|
+
sessionStorage.removeItem("user_token"), window.location.href = e;
|
|
24
47
|
}
|
|
25
48
|
})();
|
|
26
|
-
}, [
|
|
49
|
+
}, [r]), o ? /* @__PURE__ */ c(u, {}) : null;
|
|
27
50
|
};
|
|
28
51
|
export {
|
|
29
|
-
|
|
52
|
+
k as UserRoute
|
|
30
53
|
};
|
package/package.json
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-ecosistema-unp",
|
|
3
|
-
"author": "Ecosistema de Información - Unidad Nacional de Protección",
|
|
4
|
-
"private": false,
|
|
5
|
-
"version": "1.7.
|
|
6
|
-
"type": "module",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"types": "./dist/lib/main.d.ts",
|
|
10
|
-
"default": "./dist/main.js"
|
|
11
|
-
},
|
|
12
|
-
"./shared": {
|
|
13
|
-
"types": "./dist/lib/shared.d.ts",
|
|
14
|
-
"default": "./dist/shared.js"
|
|
15
|
-
},
|
|
16
|
-
"./ui": {
|
|
17
|
-
"types": "./dist/lib/ui.d.ts",
|
|
18
|
-
"default": "./dist/ui.js"
|
|
19
|
-
},
|
|
20
|
-
"./cards": {
|
|
21
|
-
"types": "./dist/lib/cards.d.ts",
|
|
22
|
-
"default": "./dist/cards.js"
|
|
23
|
-
},
|
|
24
|
-
"./tables": {
|
|
25
|
-
"types": "./dist/lib/tables.d.ts",
|
|
26
|
-
"default": "./dist/tables.js"
|
|
27
|
-
},
|
|
28
|
-
"./utils": {
|
|
29
|
-
"types": "./dist/lib/utils.d.ts",
|
|
30
|
-
"default": "./dist/utils.js"
|
|
31
|
-
},
|
|
32
|
-
"./accessibility": {
|
|
33
|
-
"types": "./dist/lib/accessibility.d.ts",
|
|
34
|
-
"default": "./dist/accessibility.js"
|
|
35
|
-
},
|
|
36
|
-
"./data": {
|
|
37
|
-
"types": "./dist/lib/data.d.ts",
|
|
38
|
-
"default": "./dist/data.js"
|
|
39
|
-
},
|
|
40
|
-
"./styles/EcoStyles.css": "./dist/assets/Bootstrap.css",
|
|
41
|
-
"./utils/fetchInterceptor.js": "./dist/utils/fetch-interceptor/fetchInterceptor.js"
|
|
42
|
-
},
|
|
43
|
-
"files": [
|
|
44
|
-
"dist"
|
|
45
|
-
],
|
|
46
|
-
"repository": {
|
|
47
|
-
"type": "git",
|
|
48
|
-
"url": "https://github.com/EcosistemaUNP/react-ecosistema-unp"
|
|
49
|
-
},
|
|
50
|
-
"sideEffects": [
|
|
51
|
-
"**/*.css"
|
|
52
|
-
],
|
|
53
|
-
"scripts": {
|
|
54
|
-
"dev": "vite",
|
|
55
|
-
"build": "tsc -b ./tsconfig.lib.json && vite build",
|
|
56
|
-
"prepublishOnly": "npm run build",
|
|
57
|
-
"lint": "eslint .",
|
|
58
|
-
"preview": "vite preview",
|
|
59
|
-
"storybook": "storybook dev -p 6006",
|
|
60
|
-
"build-storybook": "storybook build --output-dir .storybook/.storybook-build",
|
|
61
|
-
"predeploy": "npm run build-storybook",
|
|
62
|
-
"deploy:storybook": "gh-pages -d .storybook-build -b gh-pages -t"
|
|
63
|
-
},
|
|
64
|
-
"peerDependencies": {
|
|
65
|
-
"react": ">=18.0.0 <=20.0.0",
|
|
66
|
-
"react-dom": ">=18.0.0 <=20.0.0",
|
|
67
|
-
"react-router-dom": ">=6.0.0 <=8.0.0"
|
|
68
|
-
},
|
|
69
|
-
"dependencies": {
|
|
70
|
-
"@marsidev/react-turnstile": "^1.1.0",
|
|
71
|
-
"bootstrap": "^5.3.3",
|
|
72
|
-
"jwt-decode": "^4.0.0",
|
|
73
|
-
"lottie-react": "^2.4.1",
|
|
74
|
-
"react-bootstrap": "^2.10.9",
|
|
75
|
-
"react-icons": "^5.4.0",
|
|
76
|
-
"react-select": "^5.10.1",
|
|
77
|
-
"react-toastify": "^11.0.3",
|
|
78
|
-
"sweetalert2": "^11.16.1"
|
|
79
|
-
},
|
|
80
|
-
"devDependencies": {
|
|
81
|
-
"@chromatic-com/storybook": "^3.2.4",
|
|
82
|
-
"@eslint/js": "^9.17.0",
|
|
83
|
-
"@storybook/addon-essentials": "^8.5.5",
|
|
84
|
-
"@storybook/addon-interactions": "^8.5.5",
|
|
85
|
-
"@storybook/addon-onboarding": "^8.5.5",
|
|
86
|
-
"@storybook/blocks": "^8.5.5",
|
|
87
|
-
"@storybook/react": "^8.5.5",
|
|
88
|
-
"@storybook/react-vite": "^8.5.5",
|
|
89
|
-
"@storybook/test": "^8.5.5",
|
|
90
|
-
"@types/node": "^22.10.10",
|
|
91
|
-
"@types/react": "^18.3.18",
|
|
92
|
-
"@types/react-dom": "^18.3.5",
|
|
93
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
94
|
-
"eslint": "^9.17.0",
|
|
95
|
-
"eslint-plugin-react-hooks": "^5.0.0",
|
|
96
|
-
"eslint-plugin-react-refresh": "^0.4.16",
|
|
97
|
-
"eslint-plugin-storybook": "^0.11.2",
|
|
98
|
-
"gh-pages": "^6.3.0",
|
|
99
|
-
"glob": "^11.0.1",
|
|
100
|
-
"globals": "^15.14.0",
|
|
101
|
-
"storybook": "^8.5.5",
|
|
102
|
-
"typescript": "~5.6.2",
|
|
103
|
-
"typescript-eslint": "^8.18.2",
|
|
104
|
-
"vite": "^6.1.0",
|
|
105
|
-
"vite-plugin-dts": "^4.5.0",
|
|
106
|
-
"vite-plugin-lib-inject-css": "^2.2.1"
|
|
107
|
-
},
|
|
108
|
-
"eslintConfig": {
|
|
109
|
-
"extends": [
|
|
110
|
-
"plugin:storybook/recommended"
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-ecosistema-unp",
|
|
3
|
+
"author": "Ecosistema de Información - Unidad Nacional de Protección",
|
|
4
|
+
"private": false,
|
|
5
|
+
"version": "1.7.16-pre.1",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/lib/main.d.ts",
|
|
10
|
+
"default": "./dist/main.js"
|
|
11
|
+
},
|
|
12
|
+
"./shared": {
|
|
13
|
+
"types": "./dist/lib/shared.d.ts",
|
|
14
|
+
"default": "./dist/shared.js"
|
|
15
|
+
},
|
|
16
|
+
"./ui": {
|
|
17
|
+
"types": "./dist/lib/ui.d.ts",
|
|
18
|
+
"default": "./dist/ui.js"
|
|
19
|
+
},
|
|
20
|
+
"./cards": {
|
|
21
|
+
"types": "./dist/lib/cards.d.ts",
|
|
22
|
+
"default": "./dist/cards.js"
|
|
23
|
+
},
|
|
24
|
+
"./tables": {
|
|
25
|
+
"types": "./dist/lib/tables.d.ts",
|
|
26
|
+
"default": "./dist/tables.js"
|
|
27
|
+
},
|
|
28
|
+
"./utils": {
|
|
29
|
+
"types": "./dist/lib/utils.d.ts",
|
|
30
|
+
"default": "./dist/utils.js"
|
|
31
|
+
},
|
|
32
|
+
"./accessibility": {
|
|
33
|
+
"types": "./dist/lib/accessibility.d.ts",
|
|
34
|
+
"default": "./dist/accessibility.js"
|
|
35
|
+
},
|
|
36
|
+
"./data": {
|
|
37
|
+
"types": "./dist/lib/data.d.ts",
|
|
38
|
+
"default": "./dist/data.js"
|
|
39
|
+
},
|
|
40
|
+
"./styles/EcoStyles.css": "./dist/assets/Bootstrap.css",
|
|
41
|
+
"./utils/fetchInterceptor.js": "./dist/utils/fetch-interceptor/fetchInterceptor.js"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist"
|
|
45
|
+
],
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/EcosistemaUNP/react-ecosistema-unp"
|
|
49
|
+
},
|
|
50
|
+
"sideEffects": [
|
|
51
|
+
"**/*.css"
|
|
52
|
+
],
|
|
53
|
+
"scripts": {
|
|
54
|
+
"dev": "vite",
|
|
55
|
+
"build": "tsc -b ./tsconfig.lib.json && vite build",
|
|
56
|
+
"prepublishOnly": "npm run build",
|
|
57
|
+
"lint": "eslint .",
|
|
58
|
+
"preview": "vite preview",
|
|
59
|
+
"storybook": "storybook dev -p 6006",
|
|
60
|
+
"build-storybook": "storybook build --output-dir .storybook/.storybook-build",
|
|
61
|
+
"predeploy": "npm run build-storybook",
|
|
62
|
+
"deploy:storybook": "gh-pages -d .storybook-build -b gh-pages -t"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"react": ">=18.0.0 <=20.0.0",
|
|
66
|
+
"react-dom": ">=18.0.0 <=20.0.0",
|
|
67
|
+
"react-router-dom": ">=6.0.0 <=8.0.0"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"@marsidev/react-turnstile": "^1.1.0",
|
|
71
|
+
"bootstrap": "^5.3.3",
|
|
72
|
+
"jwt-decode": "^4.0.0",
|
|
73
|
+
"lottie-react": "^2.4.1",
|
|
74
|
+
"react-bootstrap": "^2.10.9",
|
|
75
|
+
"react-icons": "^5.4.0",
|
|
76
|
+
"react-select": "^5.10.1",
|
|
77
|
+
"react-toastify": "^11.0.3",
|
|
78
|
+
"sweetalert2": "^11.16.1"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@chromatic-com/storybook": "^3.2.4",
|
|
82
|
+
"@eslint/js": "^9.17.0",
|
|
83
|
+
"@storybook/addon-essentials": "^8.5.5",
|
|
84
|
+
"@storybook/addon-interactions": "^8.5.5",
|
|
85
|
+
"@storybook/addon-onboarding": "^8.5.5",
|
|
86
|
+
"@storybook/blocks": "^8.5.5",
|
|
87
|
+
"@storybook/react": "^8.5.5",
|
|
88
|
+
"@storybook/react-vite": "^8.5.5",
|
|
89
|
+
"@storybook/test": "^8.5.5",
|
|
90
|
+
"@types/node": "^22.10.10",
|
|
91
|
+
"@types/react": "^18.3.18",
|
|
92
|
+
"@types/react-dom": "^18.3.5",
|
|
93
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
94
|
+
"eslint": "^9.17.0",
|
|
95
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
96
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
97
|
+
"eslint-plugin-storybook": "^0.11.2",
|
|
98
|
+
"gh-pages": "^6.3.0",
|
|
99
|
+
"glob": "^11.0.1",
|
|
100
|
+
"globals": "^15.14.0",
|
|
101
|
+
"storybook": "^8.5.5",
|
|
102
|
+
"typescript": "~5.6.2",
|
|
103
|
+
"typescript-eslint": "^8.18.2",
|
|
104
|
+
"vite": "^6.1.0",
|
|
105
|
+
"vite-plugin-dts": "^4.5.0",
|
|
106
|
+
"vite-plugin-lib-inject-css": "^2.2.1"
|
|
107
|
+
},
|
|
108
|
+
"eslintConfig": {
|
|
109
|
+
"extends": [
|
|
110
|
+
"plugin:storybook/recommended"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}
|