react-ecosistema-unp 1.8.0-pre.0 → 1.8.0-pre.10
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/auth/contexts/AuthContex.js +12 -14
- package/dist/auth/hooks/useFinalizarSesion.js +12 -13
- package/dist/lib/auth/contexts/AuthContex.d.ts +0 -3
- package/dist/shared/app-list/AppList.js +16 -17
- package/dist/shared/menu-lateral/MenuLateral.js +50 -51
- package/dist/tables/tabla-registros/TablaRegistros.js +2 -2
- package/dist/utils/components/ProtectedRoute.js +37 -40
- package/dist/utils/components/UserRoute.js +14 -14
- package/dist/utils/eco-provider/EcoContext.js +2 -3
- package/package.json +1 -1
- package/dist/index-CuHybtft.js +0 -51
- package/dist/lib/utils/components/fetchInterceptor.d.ts +0 -7
- package/dist/lib/utils/fetch-interceptor/fetchInterceptor.d.ts +0 -7
- package/dist/utils/components/fetchInterceptor.js +0 -56
- package/dist/utils/fetch-interceptor/fetchInterceptor.js +0 -56
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const
|
|
4
|
-
const [o, r] =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// localStorage.getItem("user_token")
|
|
9
|
-
""
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as u, useState as t } from "react";
|
|
3
|
+
const c = u(void 0), i = ({ children: e }) => {
|
|
4
|
+
const [o, r] = t(
|
|
5
|
+
localStorage.getItem("access_token")
|
|
6
|
+
), [n, s] = t(
|
|
7
|
+
localStorage.getItem("auth_state")
|
|
10
8
|
);
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
|
|
9
|
+
return /* @__PURE__ */ a(
|
|
10
|
+
c.Provider,
|
|
13
11
|
{
|
|
14
12
|
value: { authToken: o, setAuthToken: r, userToken: n, setUserToken: s },
|
|
15
|
-
children:
|
|
13
|
+
children: e
|
|
16
14
|
}
|
|
17
15
|
);
|
|
18
16
|
};
|
|
19
17
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
c as AuthContext,
|
|
19
|
+
i as AuthProvider
|
|
22
20
|
};
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { FinSesionService as
|
|
1
|
+
import { FinSesionService as i } from "../services/FinSesionService.js";
|
|
2
2
|
import { y as a } from "../../index-BUe3EJDH.js";
|
|
3
3
|
import { useState as c, useEffect as l } from "react";
|
|
4
|
-
import { j as m } from "../../index-CuHybtft.js";
|
|
5
4
|
const p = () => {
|
|
6
|
-
const [
|
|
5
|
+
const [o, r] = c(null), n = `${window.location.protocol}//${window.location.host}/`;
|
|
7
6
|
return l(() => {
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
const
|
|
11
|
-
|
|
7
|
+
const e = localStorage.getItem("access_token");
|
|
8
|
+
if (e) {
|
|
9
|
+
const t = JSON.parse(e);
|
|
10
|
+
r(t);
|
|
12
11
|
}
|
|
13
12
|
}, []), { FinSesion: () => {
|
|
14
13
|
a.promise(
|
|
15
|
-
new Promise(async (
|
|
14
|
+
new Promise(async (e, t) => {
|
|
16
15
|
try {
|
|
17
|
-
await
|
|
18
|
-
} catch (
|
|
19
|
-
|
|
16
|
+
await i((o == null ? void 0 : o.user.username) || "", n), e(!0);
|
|
17
|
+
} catch (s) {
|
|
18
|
+
t(s);
|
|
20
19
|
} finally {
|
|
21
|
-
sessionStorage.removeItem("user_token"), setTimeout(() => {
|
|
22
|
-
window.location.href =
|
|
20
|
+
sessionStorage.removeItem("user_token"), localStorage.removeItem("auth_state"), localStorage.removeItem("access_token"), setTimeout(() => {
|
|
21
|
+
window.location.href = n;
|
|
23
22
|
}, 1e3);
|
|
24
23
|
}
|
|
25
24
|
}),
|
|
@@ -4,8 +4,5 @@ declare const AuthContext: React.Context<AuthContextType | undefined>;
|
|
|
4
4
|
interface AuthProviderProps {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated since version 1.7.7 — use `EcoProvider` instead.
|
|
9
|
-
*/
|
|
10
7
|
declare const AuthProvider: React.FC<AuthProviderProps>;
|
|
11
8
|
export { AuthContext, AuthProvider };
|
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
import { jsx as o, jsxs as r } from "react/jsx-runtime";
|
|
2
2
|
import { useState as d, useEffect as h } from "react";
|
|
3
|
-
import { F as
|
|
3
|
+
import { F as n, f as u, g as f, h as v, i as z } from "../../index-D3WseyJh.js";
|
|
4
4
|
import { z as N } from "../../index-DDjnZyBf.js";
|
|
5
5
|
import { G as g } from "../../iconBase-LROS5hdG.js";
|
|
6
|
-
import {
|
|
7
|
-
import { N as b } from "../../NavDropdown-ei8eIwIE.js";
|
|
6
|
+
import { N as w } from "../../NavDropdown-ei8eIwIE.js";
|
|
8
7
|
import '../../assets/AppList.css';function U(s) {
|
|
9
8
|
return g({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M1 2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zM1 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zM1 12a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1z" }, child: [] }] })(s);
|
|
10
9
|
}
|
|
11
|
-
const
|
|
12
|
-
Usuario: /* @__PURE__ */ o(
|
|
10
|
+
const b = {
|
|
11
|
+
Usuario: /* @__PURE__ */ o(n, { size: 24, className: "icon-app-2" }),
|
|
13
12
|
"Asesor(a) poblacional": /* @__PURE__ */ o(u, { size: 24, className: "icon-app-2" }),
|
|
14
13
|
Radicador: /* @__PURE__ */ o(f, { size: 24, className: "icon-app-2" }),
|
|
15
14
|
"Reparto poblacional": /* @__PURE__ */ o(v, { size: 24, className: "icon-app-2" }),
|
|
16
15
|
Digitador: /* @__PURE__ */ o(z, { size: 24, className: "icon-app-2" })
|
|
17
|
-
},
|
|
16
|
+
}, F = {
|
|
18
17
|
Usuario: "Mi perfil",
|
|
19
18
|
"Asesor(a) poblacional": "Asesoría",
|
|
20
19
|
Radicador: "Radicación",
|
|
21
20
|
"Reparto poblacional": "Reparto",
|
|
22
21
|
Digitador: "Digitación"
|
|
23
|
-
},
|
|
22
|
+
}, M = () => {
|
|
24
23
|
const [s, l] = d([]), e = location.pathname, c = e.startsWith("/") ? e : `/${e}`;
|
|
25
24
|
h(() => {
|
|
26
|
-
const a =
|
|
25
|
+
const a = localStorage.getItem("auth_state");
|
|
27
26
|
if (a)
|
|
28
27
|
try {
|
|
29
|
-
const i =
|
|
30
|
-
l(i.
|
|
28
|
+
const i = JSON.parse(a);
|
|
29
|
+
l(i.user.servicios);
|
|
31
30
|
} catch (i) {
|
|
32
31
|
console.error("Error al decodificar el token:", i);
|
|
33
32
|
}
|
|
34
33
|
}, []);
|
|
35
|
-
const
|
|
34
|
+
const t = (a) => {
|
|
36
35
|
const i = `${window.location.protocol}//${window.location.host}/${a}`;
|
|
37
36
|
window.location.href = i;
|
|
38
37
|
};
|
|
39
38
|
return /* @__PURE__ */ o(
|
|
40
|
-
|
|
39
|
+
w,
|
|
41
40
|
{
|
|
42
41
|
title: /* @__PURE__ */ o(U, { className: "icono-app" }),
|
|
43
42
|
align: "end",
|
|
@@ -46,12 +45,12 @@ const F = {
|
|
|
46
45
|
padding: "1rem"
|
|
47
46
|
}, children: /* @__PURE__ */ r("div", { className: "grid-container", children: [
|
|
48
47
|
s.filter((a) => !(a.url === "unp/ecosistema/usuario" && a.rol === "Usuario")).map(({ rol: a, url: i }) => {
|
|
49
|
-
const p =
|
|
48
|
+
const p = b[a] || /* @__PURE__ */ o(N, { size: 24, className: "icon-app-2" }), m = F[a] || a;
|
|
50
49
|
return /* @__PURE__ */ r(
|
|
51
50
|
"div",
|
|
52
51
|
{
|
|
53
52
|
className: `icon-wrapper ${c === "/" + i ? "active" : ""}`,
|
|
54
|
-
onClick: () =>
|
|
53
|
+
onClick: () => t(i),
|
|
55
54
|
children: [
|
|
56
55
|
p,
|
|
57
56
|
/* @__PURE__ */ o("span", { className: "icono-nombre-app", children: m })
|
|
@@ -64,9 +63,9 @@ const F = {
|
|
|
64
63
|
"div",
|
|
65
64
|
{
|
|
66
65
|
className: `icon-wrapper ${c === "/unp/ecosistema/usuario" ? "active" : ""}`,
|
|
67
|
-
onClick: () =>
|
|
66
|
+
onClick: () => t("unp/ecosistema/usuario"),
|
|
68
67
|
children: [
|
|
69
|
-
/* @__PURE__ */ o(
|
|
68
|
+
/* @__PURE__ */ o(n, { size: 24, className: "icon-app-2" }),
|
|
70
69
|
/* @__PURE__ */ o("span", { className: "icono-nombre-app", children: "Mi Perfil" })
|
|
71
70
|
]
|
|
72
71
|
},
|
|
@@ -77,5 +76,5 @@ const F = {
|
|
|
77
76
|
);
|
|
78
77
|
};
|
|
79
78
|
export {
|
|
80
|
-
|
|
79
|
+
M as AppList
|
|
81
80
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as a, Fragment as g, jsxs as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as o, useEffect as d } from "react";
|
|
3
|
-
import { useNavigate as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { urlBase as L, urlCertificadoLaboral as S } from "../../utils/Url.js";
|
|
3
|
+
import { useNavigate as _ } from "react-router-dom";
|
|
4
|
+
import { useFinalizarSesion as H } from "../../auth/hooks/useFinalizarSesion.js";
|
|
5
|
+
import { urlBase as C, urlCertificadoLaboral as L } from "../../utils/Url.js";
|
|
7
6
|
import "../../auth/contexts/AuthContex.js";
|
|
8
7
|
import '../../assets/EcoModalStyles.css';import '../../assets/Modal.css';import '../../assets/ContenedorVentana.css';import '../../assets/IconoTooltip.css';import '../../assets/ItemsModal.css';import '../../assets/Paginador.css';import '../../assets/ContenidoModal.css';import '../../assets/Encabezado.css';import '../../assets/SeccionTarjetaLectura.css';import '../../assets/Logo.css';import '../../assets/TarjetaLectura.css';import '../../assets/ContenedorTarjeta.css';import '../../assets/Bootstrap.css';import '../../assets/Tarjeta.css';import '../../assets/UnpHistorico.css';import '../../assets/MenuLateral.css';/* empty css */
|
|
9
8
|
/* empty css */
|
|
@@ -11,7 +10,7 @@ import '../../assets/EcoModalStyles.css';import '../../assets/Modal.css';import
|
|
|
11
10
|
import "../../cards/tarjeta/seccion-tarjeta/SeccionTarjeta.js";
|
|
12
11
|
/* empty css */
|
|
13
12
|
/* empty css */
|
|
14
|
-
import { l as
|
|
13
|
+
import { l as S } from "../../logo_escudo_blanco-DaOI8SGq.js";
|
|
15
14
|
/* empty css */
|
|
16
15
|
/* empty css */
|
|
17
16
|
/* empty css */
|
|
@@ -27,91 +26,91 @@ import "../../index-BrykDZgK.js";
|
|
|
27
26
|
/* empty css */
|
|
28
27
|
import "../../Animacion-ThNL9iiY.js";
|
|
29
28
|
import "../../index-BUe3EJDH.js";
|
|
30
|
-
import { useWebSocketConnection as
|
|
29
|
+
import { useWebSocketConnection as V } from "../../utils/websocket-manager/WebSocketContext.js";
|
|
31
30
|
import { G as i } from "../../iconBase-LROS5hdG.js";
|
|
32
|
-
function
|
|
31
|
+
function A(t) {
|
|
33
32
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M2 12h2a7.986 7.986 0 0 1 2.337-5.663 7.91 7.91 0 0 1 2.542-1.71 8.12 8.12 0 0 1 6.13-.041A2.488 2.488 0 0 0 17.5 7C18.886 7 20 5.886 20 4.5S18.886 2 17.5 2c-.689 0-1.312.276-1.763.725-2.431-.973-5.223-.958-7.635.059a9.928 9.928 0 0 0-3.18 2.139 9.92 9.92 0 0 0-2.14 3.179A10.005 10.005 0 0 0 2 12zm17.373 3.122c-.401.952-.977 1.808-1.71 2.541s-1.589 1.309-2.542 1.71a8.12 8.12 0 0 1-6.13.041A2.488 2.488 0 0 0 6.5 17C5.114 17 4 18.114 4 19.5S5.114 22 6.5 22c.689 0 1.312-.276 1.763-.725A9.965 9.965 0 0 0 12 22a9.983 9.983 0 0 0 9.217-6.102A9.992 9.992 0 0 0 22 12h-2a7.993 7.993 0 0 1-.627 3.122z" }, child: [] }, { tag: "path", attr: { d: "M12 7.462c-2.502 0-4.538 2.036-4.538 4.538S9.498 16.538 12 16.538s4.538-2.036 4.538-4.538S14.502 7.462 12 7.462zm0 7.076c-1.399 0-2.538-1.139-2.538-2.538S10.601 9.462 12 9.462s2.538 1.139 2.538 2.538-1.139 2.538-2.538 2.538z" }, child: [] }] })(t);
|
|
34
33
|
}
|
|
35
|
-
function
|
|
34
|
+
function y(t) {
|
|
36
35
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M19 2H6c-1.206 0-3 .799-3 3v14c0 2.201 1.794 3 3 3h15v-2H6.012C5.55 19.988 5 19.806 5 19s.55-.988 1.012-1H21V4c0-1.103-.897-2-2-2zm0 14H5V5c0-.806.55-.988 1-1h13v12z" }, child: [] }] })(t);
|
|
37
36
|
}
|
|
38
|
-
function
|
|
37
|
+
function E(t) {
|
|
39
38
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M20 4H4c-1.103 0-2 .897-2 2v12c0 1.103.897 2 2 2h16c1.103 0 2-.897 2-2V6c0-1.103-.897-2-2-2zm0 2v.511l-8 6.223-8-6.222V6h16zM4 18V9.044l7.386 5.745a.994.994 0 0 0 1.228 0L20 9.044 20.002 18H4z" }, child: [] }] })(t);
|
|
40
39
|
}
|
|
41
|
-
function
|
|
40
|
+
function T(t) {
|
|
42
41
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M11.953 2C6.465 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.493 2 11.953 2zM12 20c-4.411 0-8-3.589-8-8s3.567-8 7.953-8C16.391 4 20 7.589 20 12s-3.589 8-8 8z" }, child: [] }, { tag: "path", attr: { d: "M11 7h2v7h-2zm0 8h2v2h-2z" }, child: [] }] })(t);
|
|
43
42
|
}
|
|
44
|
-
function
|
|
43
|
+
function I(t) {
|
|
45
44
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M19.903 8.586a.997.997 0 0 0-.196-.293l-6-6a.997.997 0 0 0-.293-.196c-.03-.014-.062-.022-.094-.033a.991.991 0 0 0-.259-.051C13.04 2.011 13.021 2 13 2H6c-1.103 0-2 .897-2 2v16c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2V9c0-.021-.011-.04-.013-.062a.952.952 0 0 0-.051-.259c-.01-.032-.019-.063-.033-.093zM16.586 8H14V5.414L16.586 8zM6 20V4h6v5a1 1 0 0 0 1 1h5l.002 10H6z" }, child: [] }, { tag: "path", attr: { d: "M8 12h8v2H8zm0 4h8v2H8zm0-8h2v2H8z" }, child: [] }] })(t);
|
|
46
45
|
}
|
|
47
46
|
function P(t) {
|
|
48
47
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M3 13h1v7c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2v-7h1a1 1 0 0 0 .707-1.707l-9-9a.999.999 0 0 0-1.414 0l-9 9A1 1 0 0 0 3 13zm7 7v-5h4v5h-4zm2-15.586 6 6V15l.001 5H16v-5c0-1.103-.897-2-2-2h-4c-1.103 0-2 .897-2 2v5H6v-9.586l6-6z" }, child: [] }] })(t);
|
|
49
48
|
}
|
|
50
|
-
function
|
|
49
|
+
function j(t) {
|
|
51
50
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M4.222 19.778a4.983 4.983 0 0 0 3.535 1.462 4.986 4.986 0 0 0 3.536-1.462l2.828-2.829-1.414-1.414-2.828 2.829a3.007 3.007 0 0 1-4.243 0 3.005 3.005 0 0 1 0-4.243l2.829-2.828-1.414-1.414-2.829 2.828a5.006 5.006 0 0 0 0 7.071zm15.556-8.485a5.008 5.008 0 0 0 0-7.071 5.006 5.006 0 0 0-7.071 0L9.879 7.051l1.414 1.414 2.828-2.829a3.007 3.007 0 0 1 4.243 0 3.005 3.005 0 0 1 0 4.243l-2.829 2.828 1.414 1.414 2.829-2.828z" }, child: [] }, { tag: "path", attr: { d: "m8.464 16.95-1.415-1.414 8.487-8.486 1.414 1.415z" }, child: [] }] })(t);
|
|
52
51
|
}
|
|
53
|
-
function
|
|
52
|
+
function U(t) {
|
|
54
53
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M16 13v-2H7V8l-5 4 5 4v-3z" }, child: [] }, { tag: "path", attr: { d: "M20 3h-9c-1.103 0-2 .897-2 2v4h2V5h9v14h-9v-4H9v4c0 1.103.897 2 2 2h9c1.103 0 2-.897 2-2V5c0-1.103-.897-2-2-2z" }, child: [] }] })(t);
|
|
55
54
|
}
|
|
56
|
-
function
|
|
55
|
+
function F(t) {
|
|
57
56
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "m12 17 1-2V9.858c1.721-.447 3-2 3-3.858 0-2.206-1.794-4-4-4S8 3.794 8 6c0 1.858 1.279 3.411 3 3.858V15l1 2zM10 6c0-1.103.897-2 2-2s2 .897 2 2-.897 2-2 2-2-.897-2-2z" }, child: [] }, { tag: "path", attr: { d: "m16.267 10.563-.533 1.928C18.325 13.207 20 14.584 20 16c0 1.892-3.285 4-8 4s-8-2.108-8-4c0-1.416 1.675-2.793 4.267-3.51l-.533-1.928C4.197 11.54 2 13.623 2 16c0 3.364 4.393 6 10 6s10-2.636 10-6c0-2.377-2.197-4.46-5.733-5.437z" }, child: [] }] })(t);
|
|
58
57
|
}
|
|
59
|
-
function
|
|
58
|
+
function R(t) {
|
|
60
59
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M4 6h16v2H4zm4 5h12v2H8zm5 5h7v2h-7z" }, child: [] }] })(t);
|
|
61
60
|
}
|
|
62
|
-
function
|
|
61
|
+
function $(t) {
|
|
63
62
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M4 6h16v2H4zm0 5h16v2H4zm0 5h16v2H4z" }, child: [] }] })(t);
|
|
64
63
|
}
|
|
65
|
-
function
|
|
64
|
+
function D(t) {
|
|
66
65
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M15.661 15.549a1.315 1.315 0 0 0 1.185-1.386 1.363 1.363 0 0 0-1.35-1.302h-.048a1.352 1.352 0 0 0-1.303 1.397c.024.379.179.687.391.911-.827 1.609-2.07 2.794-3.954 3.788-1.266.663-2.604.912-3.905.734-1.089-.153-1.94-.64-2.463-1.421-.78-1.185-.852-2.462-.201-3.74a5.597 5.597 0 0 1 1.658-1.931 7.88 7.88 0 0 1-.331-1.218c-3.506 2.51-3.148 5.942-2.084 7.564.794 1.184 2.415 1.941 4.19 1.941.474 0 .972-.035 1.457-.154 3.077-.592 5.409-2.438 6.747-5.16l.011-.023z" }, child: [] }, { tag: "path", attr: { d: "M19.887 12.589c-1.834-2.154-4.533-3.337-7.611-3.337h-.403c-.2-.438-.661-.711-1.183-.711h-.036c-.744 0-1.325.64-1.301 1.385.023.71.627 1.302 1.35 1.302h.059a1.332 1.332 0 0 0 1.183-.828h.439c1.824 0 3.551.532 5.126 1.574 1.206.792 2.072 1.834 2.557 3.077.425 1.019.402 2.013-.035 2.843-.675 1.302-1.812 1.988-3.314 1.988-.947 0-1.871-.296-2.345-.509-.283.235-.758.626-1.102.863 1.042.473 2.096.746 3.113.746 2.309 0 4.023-1.302 4.676-2.557.709-1.422.651-3.813-1.161-5.859l-.012.023z" }, child: [] }, { tag: "path", attr: { d: "M7.647 15.975c.023.71.626 1.302 1.35 1.302h.048a1.334 1.334 0 0 0 1.302-1.397c0-.71-.616-1.301-1.338-1.301h-.048c-.048 0-.118 0-.178.022-.982-1.657-1.397-3.434-1.242-5.349.094-1.445.567-2.7 1.42-3.742.71-.888 2.048-1.326 2.96-1.35 2.556-.048 3.622 3.138 3.704 4.404l1.184.354C16.536 5.036 14.122 3 11.813 3 9.647 3 7.647 4.574 6.842 6.884c-1.102 3.077-.379 6.036.971 8.404-.118.154-.189.426-.166.687z" }, child: [] }] })(t);
|
|
67
66
|
}
|
|
68
|
-
function
|
|
67
|
+
function G(t) {
|
|
69
68
|
return i({ tag: "svg", attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z" }, child: [] }] })(t);
|
|
70
69
|
}
|
|
71
|
-
const
|
|
72
|
-
const [
|
|
70
|
+
const b1 = ({ onToggle: t, isOpen: l, showConnectionStatus: u }) => {
|
|
71
|
+
const [x, N] = o(!0), [m, p] = o(null), f = l ? "sidebar-bar-panel open" : "sidebar-bar-panel", k = _(), { FinSesion: b } = H(), { connectionStatus: v } = V(), [w, c] = o(!1), [z, n] = o(""), h = `${window.location.host}`;
|
|
73
72
|
if (d(() => {
|
|
74
|
-
const r =
|
|
73
|
+
const r = localStorage.getItem("access_token");
|
|
75
74
|
if (r) {
|
|
76
|
-
const s =
|
|
75
|
+
const s = JSON.parse(r);
|
|
77
76
|
p(s);
|
|
78
77
|
}
|
|
79
|
-
|
|
78
|
+
N(!1);
|
|
80
79
|
}, []), d(() => {
|
|
81
80
|
const r = setTimeout(() => {
|
|
82
|
-
const s =
|
|
81
|
+
const s = localStorage.getItem("auth_state");
|
|
83
82
|
if (s) {
|
|
84
|
-
const B =
|
|
83
|
+
const B = JSON.parse(s);
|
|
85
84
|
p(B);
|
|
86
85
|
}
|
|
87
86
|
}, 2e3);
|
|
88
87
|
return () => clearTimeout(r);
|
|
89
88
|
}, []), d(() => {
|
|
90
|
-
h.includes("localhost") ? (
|
|
91
|
-
}, []),
|
|
89
|
+
h.includes("localhost") ? (c(!0), n("Entorno local")) : h.includes("ecosistemadesarrollo") ? (c(!0), n("Entorno de desarrollo")) : h.includes("ecosistemapruebas") ? (c(!0), n("Entorno de pruebas")) : (c(!1), n(""));
|
|
90
|
+
}, []), x)
|
|
92
91
|
return /* @__PURE__ */ a(g, {});
|
|
93
|
-
const
|
|
94
|
-
|
|
92
|
+
const M = () => {
|
|
93
|
+
k("/unp/ecosistema/usuario");
|
|
95
94
|
};
|
|
96
|
-
return /* @__PURE__ */ a("div", { className: `container-fluid ${
|
|
95
|
+
return /* @__PURE__ */ a("div", { className: `container-fluid ${l ? "menu-open" : ""}`, children: /* @__PURE__ */ e("div", { className: f, children: [
|
|
97
96
|
/* @__PURE__ */ e("div", { className: "logo_details", children: [
|
|
98
97
|
/* @__PURE__ */ a(
|
|
99
98
|
"img",
|
|
100
99
|
{
|
|
101
|
-
src:
|
|
100
|
+
src: S,
|
|
102
101
|
alt: "Logo",
|
|
103
102
|
className: "icon logo-image"
|
|
104
103
|
}
|
|
105
104
|
),
|
|
106
105
|
/* @__PURE__ */ a("div", { className: "logo-name", children: "EI - UNP" }),
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
l ? /* @__PURE__ */ a(
|
|
107
|
+
R,
|
|
109
108
|
{
|
|
110
109
|
className: "bx bx-menu i",
|
|
111
110
|
id: "btn",
|
|
112
111
|
onClick: t
|
|
113
112
|
}
|
|
114
|
-
) : /* @__PURE__ */ a(
|
|
113
|
+
) : /* @__PURE__ */ a($, { className: "bx bx-menu i", id: "btn", onClick: t })
|
|
115
114
|
] }),
|
|
116
115
|
/* @__PURE__ */ e("ul", { className: "nav-list-panel", children: [
|
|
117
116
|
/* @__PURE__ */ e("li", { children: [
|
|
@@ -123,14 +122,14 @@ const z1 = ({ onToggle: t, isOpen: c, showConnectionStatus: x }) => {
|
|
|
123
122
|
] }),
|
|
124
123
|
/* @__PURE__ */ e("li", { children: [
|
|
125
124
|
/* @__PURE__ */ e("a", { href: "", children: [
|
|
126
|
-
/* @__PURE__ */ a(
|
|
125
|
+
/* @__PURE__ */ a(F, { className: "bx bx-map-pin i2" }),
|
|
127
126
|
/* @__PURE__ */ a("span", { className: "link_name", children: "Mapa del proceso" })
|
|
128
127
|
] }),
|
|
129
128
|
/* @__PURE__ */ a("span", { className: "tooltip", children: "Mapa del proceso" })
|
|
130
129
|
] }),
|
|
131
130
|
/* @__PURE__ */ e("li", { children: [
|
|
132
131
|
/* @__PURE__ */ e("a", { href: "", children: [
|
|
133
|
-
/* @__PURE__ */ a(
|
|
132
|
+
/* @__PURE__ */ a(y, { className: "bx bx-book-alt i2" }),
|
|
134
133
|
/* @__PURE__ */ a("span", { className: "link_name", children: "Manuales de usuario" })
|
|
135
134
|
] }),
|
|
136
135
|
/* @__PURE__ */ a("span", { className: "tooltip", children: "Manual de usuario" })
|
|
@@ -138,7 +137,7 @@ const z1 = ({ onToggle: t, isOpen: c, showConnectionStatus: x }) => {
|
|
|
138
137
|
/* @__PURE__ */ a("div", { style: { paddingLeft: "15px", paddingRight: "15px" }, children: /* @__PURE__ */ a("hr", { style: { borderTop: "1px solid white" } }) }),
|
|
139
138
|
/* @__PURE__ */ e("li", { children: [
|
|
140
139
|
/* @__PURE__ */ e("a", { href: "https://www.unp.gov.co/", target: "_blank", children: [
|
|
141
|
-
/* @__PURE__ */ a(
|
|
140
|
+
/* @__PURE__ */ a(j, { className: "bx bx-link-alt i2" }),
|
|
142
141
|
/* @__PURE__ */ a("span", { className: "link_name", children: "Portal UNP" })
|
|
143
142
|
] }),
|
|
144
143
|
/* @__PURE__ */ a("span", { className: "tooltip", children: "Portal UNP" })
|
|
@@ -150,7 +149,7 @@ const z1 = ({ onToggle: t, isOpen: c, showConnectionStatus: x }) => {
|
|
|
150
149
|
href: "https://login.microsoftonline.com/common/oauth2/authorize?client_id=00000002-0000-0ff1-ce00-000000000000",
|
|
151
150
|
target: "_blank",
|
|
152
151
|
children: [
|
|
153
|
-
/* @__PURE__ */ a(
|
|
152
|
+
/* @__PURE__ */ a(E, { className: "bx bx-envelope i2" }),
|
|
154
153
|
/* @__PURE__ */ a("span", { className: "link_name", children: "Correo institucional" })
|
|
155
154
|
]
|
|
156
155
|
}
|
|
@@ -159,14 +158,14 @@ const z1 = ({ onToggle: t, isOpen: c, showConnectionStatus: x }) => {
|
|
|
159
158
|
] }),
|
|
160
159
|
/* @__PURE__ */ e("li", { children: [
|
|
161
160
|
/* @__PURE__ */ e("a", { href: "http://intranet.unp.gov.co/", target: "_blank", children: [
|
|
162
|
-
/* @__PURE__ */ a(
|
|
161
|
+
/* @__PURE__ */ a(D, { className: "bx bxl-redux i2" }),
|
|
163
162
|
/* @__PURE__ */ a("span", { className: "link_name", children: "Acceso directo a Intranet" })
|
|
164
163
|
] }),
|
|
165
164
|
/* @__PURE__ */ a("span", { className: "tooltip", children: "Acceso directo a Intranet" })
|
|
166
165
|
] }),
|
|
167
166
|
/* @__PURE__ */ e("li", { children: [
|
|
168
167
|
/* @__PURE__ */ e("a", { href: "https://mesadeservicios.unp.gov.co/HEAT/", target: "_blank", children: [
|
|
169
|
-
/* @__PURE__ */ a(
|
|
168
|
+
/* @__PURE__ */ a(T, { className: "bx bx-error-circle i2" }),
|
|
170
169
|
/* @__PURE__ */ a("span", { className: "link_name", children: "Mesa de servicios" })
|
|
171
170
|
] }),
|
|
172
171
|
/* @__PURE__ */ a("span", { className: "tooltip", children: "Mesa de servicios" })
|
|
@@ -174,28 +173,28 @@ const z1 = ({ onToggle: t, isOpen: c, showConnectionStatus: x }) => {
|
|
|
174
173
|
/* @__PURE__ */ a("div", { style: { paddingLeft: "15px", paddingRight: "15px" }, children: /* @__PURE__ */ a("hr", { style: { borderTop: "1px solid white" } }) }),
|
|
175
174
|
/* @__PURE__ */ e("li", { children: [
|
|
176
175
|
/* @__PURE__ */ e("a", { href: "", children: [
|
|
177
|
-
/* @__PURE__ */ a(
|
|
176
|
+
/* @__PURE__ */ a(A, { className: "bx i2" }),
|
|
178
177
|
/* @__PURE__ */ a("span", { className: "link_name", children: "Acta de reunión" })
|
|
179
178
|
] }),
|
|
180
179
|
/* @__PURE__ */ a("span", { className: "tooltip", children: "Acta de reunión" })
|
|
181
180
|
] }),
|
|
182
181
|
/* @__PURE__ */ e("li", { children: [
|
|
183
182
|
/* @__PURE__ */ e("a", { href: "", children: [
|
|
184
|
-
/* @__PURE__ */ a(
|
|
183
|
+
/* @__PURE__ */ a(G, { className: "bx i2" }),
|
|
185
184
|
/* @__PURE__ */ a("span", { className: "link_name", children: "Solicitud de viáticos" })
|
|
186
185
|
] }),
|
|
187
186
|
/* @__PURE__ */ a("span", { className: "tooltip", children: "Solicitud de viáticos" })
|
|
188
187
|
] }),
|
|
189
188
|
/* @__PURE__ */ e("li", { children: [
|
|
190
|
-
/* @__PURE__ */ e("a", { href: `${
|
|
191
|
-
/* @__PURE__ */ a(
|
|
189
|
+
/* @__PURE__ */ e("a", { href: `${C}${L}`, target: "_blank", children: [
|
|
190
|
+
/* @__PURE__ */ a(I, { className: "bx i2" }),
|
|
192
191
|
/* @__PURE__ */ a("span", { className: "link_name", children: "Certificados contratistas" })
|
|
193
192
|
] }),
|
|
194
193
|
/* @__PURE__ */ a("span", { className: "tooltip", children: "Certificados contratistas" })
|
|
195
194
|
] })
|
|
196
195
|
] }),
|
|
197
196
|
/* @__PURE__ */ e("div", { className: "profile-content", children: [
|
|
198
|
-
!
|
|
197
|
+
!l && u && /* @__PURE__ */ a(g, { children: v === "connected" ? /* @__PURE__ */ e("div", { className: "gear-tooltip-container", children: [
|
|
199
198
|
/* @__PURE__ */ e(
|
|
200
199
|
"svg",
|
|
201
200
|
{
|
|
@@ -257,7 +256,7 @@ const z1 = ({ onToggle: t, isOpen: c, showConnectionStatus: x }) => {
|
|
|
257
256
|
]
|
|
258
257
|
}
|
|
259
258
|
) }),
|
|
260
|
-
!
|
|
259
|
+
!l && w && /* @__PURE__ */ e("div", { className: "gear-tooltip-container", children: [
|
|
261
260
|
/* @__PURE__ */ a(
|
|
262
261
|
"svg",
|
|
263
262
|
{
|
|
@@ -284,26 +283,26 @@ const z1 = ({ onToggle: t, isOpen: c, showConnectionStatus: x }) => {
|
|
|
284
283
|
)
|
|
285
284
|
}
|
|
286
285
|
),
|
|
287
|
-
/* @__PURE__ */ a("span", { className: "gear-tooltip-text", children:
|
|
286
|
+
/* @__PURE__ */ a("span", { className: "gear-tooltip-text", children: z })
|
|
288
287
|
] }),
|
|
289
288
|
/* @__PURE__ */ e("div", { className: "profile", children: [
|
|
290
289
|
/* @__PURE__ */ a(
|
|
291
290
|
"div",
|
|
292
291
|
{
|
|
293
292
|
className: "profile-detail",
|
|
294
|
-
onClick:
|
|
293
|
+
onClick: M,
|
|
295
294
|
style: { cursor: "pointer" },
|
|
296
295
|
children: m && /* @__PURE__ */ e("div", { className: "name-job", style: { marginTop: "3px" }, children: [
|
|
297
|
-
/* @__PURE__ */ a("div", { className: "name text-truncate", style: { width: "200px" }, children: m.
|
|
296
|
+
/* @__PURE__ */ a("div", { className: "name text-truncate", style: { width: "200px" }, children: m.user.nombres }),
|
|
298
297
|
/* @__PURE__ */ a("div", { className: "job" })
|
|
299
298
|
] })
|
|
300
299
|
}
|
|
301
300
|
),
|
|
302
|
-
/* @__PURE__ */ a(
|
|
301
|
+
/* @__PURE__ */ a(U, { className: "icon", onClick: b })
|
|
303
302
|
] })
|
|
304
303
|
] })
|
|
305
304
|
] }) });
|
|
306
305
|
};
|
|
307
306
|
export {
|
|
308
|
-
|
|
307
|
+
b1 as MenuLateral
|
|
309
308
|
};
|
|
@@ -1638,7 +1638,7 @@ const Pi = () => (/* @__PURE__ */ new Date()).getFullYear(), ht = (e) => e.norma
|
|
|
1638
1638
|
}) => {
|
|
1639
1639
|
const [H, yn] = z(""), [j, vn] = z({}), [re, Je] = z(null), [kn, ae] = z(!1), [le, ce] = z(23), [xn, de] = z(t.length > 23), [Cn, Ge] = z(!1), En = Pi(), Qe = jn();
|
|
1640
1640
|
nt(() => {
|
|
1641
|
-
Ge(t.length < 1), ce(
|
|
1641
|
+
Ge(t.length < 1), ce(20), de(t.length > 20);
|
|
1642
1642
|
}, [H, j, t.length]);
|
|
1643
1643
|
const An = (p, m) => {
|
|
1644
1644
|
vn((L) => ({ ...L, [p]: m }));
|
|
@@ -1656,7 +1656,7 @@ const Pi = () => (/* @__PURE__ */ new Date()).getFullYear(), ht = (e) => e.norma
|
|
|
1656
1656
|
), et = $n(ue);
|
|
1657
1657
|
nt(() => {
|
|
1658
1658
|
const p = et.current !== ue;
|
|
1659
|
-
$e ? (p && ce(
|
|
1659
|
+
$e ? (p && ce(20), de(!0)) : (ce((m) => Math.max(m, 20)), de(t.length > le)), Ge(t.length < 1), et.current = ue;
|
|
1660
1660
|
}, [$e, ue, t.length, le]);
|
|
1661
1661
|
const we = Le ? Bn : Pn, Tn = (p, m) => {
|
|
1662
1662
|
if (p.redirectTo) {
|
|
@@ -1,64 +1,61 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useLocation as
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
if ((await fetch(`${s}api-auth/auth/refresh_token/`, {
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S, useEffect as v } from "react";
|
|
3
|
+
import { useLocation as p, Outlet as I } from "react-router-dom";
|
|
4
|
+
const T = () => {
|
|
5
|
+
const [k, o] = S(!1), h = p(), s = `${window.location.protocol}//${window.location.host}/`, c = `${window.location.host}`, w = async () => {
|
|
6
|
+
const l = await fetch(`${s}api-auth/auth/refresh_token/`, {
|
|
8
7
|
method: "POST",
|
|
9
8
|
headers: {
|
|
10
|
-
"Content-Type": "application/json"
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
Authorization: `Bearer ${localStorage.getItem("access_token")}`
|
|
11
11
|
},
|
|
12
12
|
credentials: "include"
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
});
|
|
14
|
+
if (l.ok) {
|
|
15
|
+
const r = (await l.json()).token;
|
|
16
|
+
return localStorage.setItem("access_token", r), !0;
|
|
17
|
+
} else
|
|
18
|
+
throw new Error("Error al refrescar token de Microsoft");
|
|
16
19
|
};
|
|
17
|
-
return
|
|
18
|
-
const
|
|
20
|
+
return v(() => {
|
|
21
|
+
const l = async () => {
|
|
19
22
|
try {
|
|
20
|
-
if ((
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
credentials: "include"
|
|
26
|
-
})).ok) {
|
|
27
|
-
const i = sessionStorage.getItem("user_token");
|
|
28
|
-
if (i) {
|
|
29
|
-
const f = u(i).datos_basicos.servicios.map((e) => e.url).filter((e) => !!e), r = m.pathname, n = f.map(
|
|
23
|
+
if (localStorage.getItem("access_token")) {
|
|
24
|
+
const r = localStorage.getItem("auth_state");
|
|
25
|
+
if (r) {
|
|
26
|
+
const f = JSON.parse(r).user.servicios.map((e) => e.url).filter((e) => !!e), a = h.pathname, n = f.map(
|
|
30
27
|
(e) => e.startsWith("/") ? e : `/${e}`
|
|
31
|
-
),
|
|
28
|
+
), m = a.startsWith("/") ? a : `/${a}`;
|
|
32
29
|
n.some(
|
|
33
|
-
(e) =>
|
|
34
|
-
) ?
|
|
30
|
+
(e) => m.startsWith(e)
|
|
31
|
+
) ? o(!0) : (console.warn("No hay match con los roles del usuario"), o(!1), sessionStorage.removeItem("user_token"), localStorage.removeItem("auth_state"), localStorage.removeItem("access_token"), window.location.href = s);
|
|
35
32
|
} else
|
|
36
|
-
|
|
33
|
+
o(!1), sessionStorage.removeItem("user_token"), localStorage.removeItem("auth_state"), localStorage.removeItem("access_token"), window.location.href = s;
|
|
37
34
|
} else
|
|
38
35
|
throw new Error("Token inválido");
|
|
39
36
|
} catch {
|
|
40
37
|
try {
|
|
41
38
|
if (await w()) {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
(
|
|
46
|
-
),
|
|
47
|
-
|
|
48
|
-
(
|
|
49
|
-
) ?
|
|
39
|
+
const i = localStorage.getItem("auth_state");
|
|
40
|
+
if (i) {
|
|
41
|
+
const a = JSON.parse(i).user.servicios.map((t) => t.url).filter((t) => !!t), n = h.pathname, m = a.map(
|
|
42
|
+
(t) => t.startsWith("/") ? t : `/${t}`
|
|
43
|
+
), u = n.startsWith("/") ? n : `/${n}`;
|
|
44
|
+
m.some(
|
|
45
|
+
(t) => u.startsWith(t)
|
|
46
|
+
) ? o(!0) : (o(!1), sessionStorage.removeItem("user_token"), localStorage.removeItem("auth_state"), localStorage.removeItem("access_token"), window.location.href = s);
|
|
50
47
|
} else
|
|
51
|
-
|
|
48
|
+
o(!1), sessionStorage.removeItem("user_token"), localStorage.removeItem("auth_state"), localStorage.removeItem("access_token"), window.location.href = s;
|
|
52
49
|
} else
|
|
53
50
|
throw new Error("No se pudo refrescar el token.");
|
|
54
51
|
} catch {
|
|
55
|
-
sessionStorage.removeItem("user_token"), window.location.href = s,
|
|
52
|
+
sessionStorage.removeItem("user_token"), localStorage.removeItem("auth_state"), localStorage.removeItem("access_token"), window.location.href = s, o(!1);
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
55
|
};
|
|
59
|
-
|
|
60
|
-
}, []),
|
|
56
|
+
c.includes("ecosistemadesarrollo") || c.includes("ecosistemapruebas") || c.includes("ecosistemaprov") || c.includes("ecosistema") ? l() : (console.warn("ProtectedRoute is disabled in the local development environment."), o(!0));
|
|
57
|
+
}, []), k ? /* @__PURE__ */ g(I, {}) : null;
|
|
61
58
|
};
|
|
62
59
|
export {
|
|
63
|
-
|
|
60
|
+
T as ProtectedRoute
|
|
64
61
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { useState as d, useEffect as h } from "react";
|
|
3
|
-
import { useNavigate as u, Outlet as
|
|
3
|
+
import { useNavigate as u, Outlet as m } from "react-router-dom";
|
|
4
4
|
const k = () => {
|
|
5
|
-
const [
|
|
6
|
-
if (
|
|
5
|
+
const [a, e] = d(!1), s = u(), t = `${window.location.protocol}//${window.location.host}/`, o = `${window.location.host}`;
|
|
6
|
+
if (o.includes("localhost"))
|
|
7
7
|
return console.warn("ProtectedRoute is disabled in the local development environment."), null;
|
|
8
|
-
const
|
|
9
|
-
if ((await fetch(`${
|
|
8
|
+
const n = async () => {
|
|
9
|
+
if ((await fetch(`${t}api-auth/auth/refresh_token/`, {
|
|
10
10
|
method: "POST",
|
|
11
11
|
headers: {
|
|
12
12
|
"Content-Type": "application/json"
|
|
@@ -17,9 +17,9 @@ const k = () => {
|
|
|
17
17
|
throw new Error("Error al refrescar token de Microsoft");
|
|
18
18
|
};
|
|
19
19
|
return h(() => {
|
|
20
|
-
const
|
|
20
|
+
const r = async () => {
|
|
21
21
|
try {
|
|
22
|
-
if ((await fetch(`${
|
|
22
|
+
if ((await fetch(`${t}api-auth/auth/validate_jwt/`, {
|
|
23
23
|
method: "POST",
|
|
24
24
|
headers: {
|
|
25
25
|
"Content-Type": "application/json"
|
|
@@ -29,9 +29,9 @@ const k = () => {
|
|
|
29
29
|
e(!0);
|
|
30
30
|
else
|
|
31
31
|
try {
|
|
32
|
-
if (await
|
|
32
|
+
if (await n())
|
|
33
33
|
(await fetch(
|
|
34
|
-
`${
|
|
34
|
+
`${t}api-auth/auth/validate_jwt/`,
|
|
35
35
|
{
|
|
36
36
|
method: "POST",
|
|
37
37
|
headers: {
|
|
@@ -39,18 +39,18 @@ const k = () => {
|
|
|
39
39
|
},
|
|
40
40
|
credentials: "include"
|
|
41
41
|
}
|
|
42
|
-
)).ok ? e(!0) : (sessionStorage.removeItem("user_token"), window.location.href =
|
|
42
|
+
)).ok ? e(!0) : (sessionStorage.removeItem("user_token"), localStorage.removeItem("auth_state"), localStorage.removeItem("access_token"), window.location.href = t, e(!1));
|
|
43
43
|
else
|
|
44
44
|
throw new Error("No se pudo refrescar el token.");
|
|
45
45
|
} catch {
|
|
46
|
-
sessionStorage.removeItem("user_token"), window.location.href =
|
|
46
|
+
sessionStorage.removeItem("user_token"), localStorage.removeItem("auth_state"), localStorage.removeItem("access_token"), window.location.href = t, e(!1);
|
|
47
47
|
}
|
|
48
48
|
} catch {
|
|
49
|
-
sessionStorage.removeItem("user_token"), window.location.href =
|
|
49
|
+
sessionStorage.removeItem("user_token"), localStorage.removeItem("auth_state"), localStorage.removeItem("access_token"), window.location.href = t, e(!1);
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
}, [s]),
|
|
52
|
+
o.includes("localhost") ? (console.warn("ProtectedRoute is disabled in the local development environment."), e(!0)) : r();
|
|
53
|
+
}, [s]), a ? /* @__PURE__ */ c(m, {}) : null;
|
|
54
54
|
};
|
|
55
55
|
export {
|
|
56
56
|
k as UserRoute
|
|
@@ -2,7 +2,6 @@ import { jsx as r } from "react/jsx-runtime";
|
|
|
2
2
|
import { AuthProvider as t } from "../../auth/contexts/AuthContex.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "react-router-dom";
|
|
5
|
-
import "../../index-CuHybtft.js";
|
|
6
5
|
import '../../assets/EcoModalStyles.css';import '../../assets/Modal.css';import '../../assets/ContenedorVentana.css';import '../../assets/IconoTooltip.css';import '../../assets/ItemsModal.css';import '../../assets/Paginador.css';import '../../assets/ContenidoModal.css';import '../../assets/Encabezado.css';import '../../assets/SeccionTarjetaLectura.css';import '../../assets/Logo.css';import '../../assets/TarjetaLectura.css';import '../../assets/ContenedorTarjeta.css';import '../../assets/Bootstrap.css';import '../../assets/Tarjeta.css';import '../../assets/UnpHistorico.css';/* empty css */
|
|
7
6
|
/* empty css */
|
|
8
7
|
/* empty css */
|
|
@@ -25,7 +24,7 @@ import "../../index-BrykDZgK.js";
|
|
|
25
24
|
import "../../Animacion-ThNL9iiY.js";
|
|
26
25
|
import "../../index-BUe3EJDH.js";
|
|
27
26
|
import { WebSocketProvider as i } from "../websocket-manager/WebSocketContext.js";
|
|
28
|
-
const
|
|
27
|
+
const z = ({ children: o }) => /* @__PURE__ */ r(t, { children: /* @__PURE__ */ r(i, { children: o }) });
|
|
29
28
|
export {
|
|
30
|
-
|
|
29
|
+
z as EcoProvider
|
|
31
30
|
};
|
package/package.json
CHANGED
package/dist/index-CuHybtft.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
class o extends Error {
|
|
2
|
-
}
|
|
3
|
-
o.prototype.name = "InvalidTokenError";
|
|
4
|
-
function i(t) {
|
|
5
|
-
return decodeURIComponent(atob(t).replace(/(.)/g, (e, r) => {
|
|
6
|
-
let n = r.charCodeAt(0).toString(16).toUpperCase();
|
|
7
|
-
return n.length < 2 && (n = "0" + n), "%" + n;
|
|
8
|
-
}));
|
|
9
|
-
}
|
|
10
|
-
function s(t) {
|
|
11
|
-
let e = t.replace(/-/g, "+").replace(/_/g, "/");
|
|
12
|
-
switch (e.length % 4) {
|
|
13
|
-
case 0:
|
|
14
|
-
break;
|
|
15
|
-
case 2:
|
|
16
|
-
e += "==";
|
|
17
|
-
break;
|
|
18
|
-
case 3:
|
|
19
|
-
e += "=";
|
|
20
|
-
break;
|
|
21
|
-
default:
|
|
22
|
-
throw new Error("base64 string is not of the correct length");
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
return i(e);
|
|
26
|
-
} catch {
|
|
27
|
-
return atob(e);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function d(t, e) {
|
|
31
|
-
if (typeof t != "string")
|
|
32
|
-
throw new o("Invalid token specified: must be a string");
|
|
33
|
-
e || (e = {});
|
|
34
|
-
const r = e.header === !0 ? 0 : 1, n = t.split(".")[r];
|
|
35
|
-
if (typeof n != "string")
|
|
36
|
-
throw new o(`Invalid token specified: missing part #${r + 1}`);
|
|
37
|
-
let c;
|
|
38
|
-
try {
|
|
39
|
-
c = s(n);
|
|
40
|
-
} catch (a) {
|
|
41
|
-
throw new o(`Invalid token specified: invalid base64 for part #${r + 1} (${a.message})`);
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
return JSON.parse(c);
|
|
45
|
-
} catch (a) {
|
|
46
|
-
throw new o(`Invalid token specified: invalid json for part #${r + 1} (${a.message})`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export {
|
|
50
|
-
d as j
|
|
51
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
window.originalFetch = window.fetch.bind(window);
|
|
2
|
-
let l = !1, h = null;
|
|
3
|
-
const i = [];
|
|
4
|
-
async function p() {
|
|
5
|
-
const e = `${`${window.location.protocol}//${window.location.host}/`}api-auth/auth/refresh_token/`, t = await window.originalFetch(e, {
|
|
6
|
-
method: "POST",
|
|
7
|
-
credentials: "include"
|
|
8
|
-
});
|
|
9
|
-
if (!t.ok)
|
|
10
|
-
throw new Error("Error al refrescar token, status " + t.status);
|
|
11
|
-
return "Token refreshed";
|
|
12
|
-
}
|
|
13
|
-
window.fetch = async function(o, e) {
|
|
14
|
-
const t = typeof o == "string" ? o : o.toString();
|
|
15
|
-
if (console.log("URL petición:", t), t.includes("/api-auth/"))
|
|
16
|
-
return window.originalFetch(o, e);
|
|
17
|
-
e = e || {};
|
|
18
|
-
const u = sessionStorage.getItem("user_token");
|
|
19
|
-
e.headers = {
|
|
20
|
-
...e.headers,
|
|
21
|
-
...u ? { Authorization: u } : {}
|
|
22
|
-
};
|
|
23
|
-
try {
|
|
24
|
-
const c = `${window.location.protocol}//${window.location.host}/`, r = await window.originalFetch(o, e);
|
|
25
|
-
if (r.status !== 401) {
|
|
26
|
-
const n = await r.clone().text();
|
|
27
|
-
if (!n.includes("Signature has expired"))
|
|
28
|
-
return r;
|
|
29
|
-
if (n.includes("Invalid or expired token"))
|
|
30
|
-
return sessionStorage.removeItem("user_token"), setTimeout(() => {
|
|
31
|
-
window.location.href = c;
|
|
32
|
-
}, 1e3), r;
|
|
33
|
-
}
|
|
34
|
-
return new Promise((w, n) => {
|
|
35
|
-
i.push({ input: o, init: e, resolve: w, reject: n }), l || (l = !0, h = p(), h.then(() => {
|
|
36
|
-
i.forEach(({ input: a, init: s, resolve: d, reject: f }) => {
|
|
37
|
-
const g = {
|
|
38
|
-
...s,
|
|
39
|
-
headers: { ...s.headers, Authorization: sessionStorage.getItem("user_token") }
|
|
40
|
-
};
|
|
41
|
-
window.originalFetch(a, g).then(d).catch(f);
|
|
42
|
-
});
|
|
43
|
-
}).catch((a) => {
|
|
44
|
-
i.forEach(({ reject: s }) => s(a));
|
|
45
|
-
}).finally(() => {
|
|
46
|
-
i.length = 0, l = !1, h = null;
|
|
47
|
-
}));
|
|
48
|
-
});
|
|
49
|
-
} catch (c) {
|
|
50
|
-
return Promise.reject(c);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const k = {};
|
|
54
|
-
export {
|
|
55
|
-
k as default
|
|
56
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
window.originalFetch = window.fetch.bind(window);
|
|
2
|
-
let l = !1, h = null;
|
|
3
|
-
const c = [];
|
|
4
|
-
async function k() {
|
|
5
|
-
const e = `${`${window.location.protocol}//${window.location.host}/`}api-auth/auth/refresh_token/`, t = await window.originalFetch(e, {
|
|
6
|
-
method: "POST",
|
|
7
|
-
credentials: "include"
|
|
8
|
-
});
|
|
9
|
-
if (!t.ok)
|
|
10
|
-
throw new Error("Error al refrescar token, status " + t.status);
|
|
11
|
-
return console.warn("Token refrescado"), "Token refreshed";
|
|
12
|
-
}
|
|
13
|
-
window.fetch = async function(o, e) {
|
|
14
|
-
const t = typeof o == "string" ? o : o.toString();
|
|
15
|
-
if (console.log("Petición fetchInterceptor Librería:", t), t.includes("/api-auth/"))
|
|
16
|
-
return window.originalFetch(o, e);
|
|
17
|
-
e = e || {};
|
|
18
|
-
const u = sessionStorage.getItem("user_token");
|
|
19
|
-
e.headers = {
|
|
20
|
-
...e.headers,
|
|
21
|
-
...u ? { Authorization: u } : {}
|
|
22
|
-
};
|
|
23
|
-
try {
|
|
24
|
-
const i = `${window.location.protocol}//${window.location.host}/`, r = await window.originalFetch(o, e);
|
|
25
|
-
if (r.status !== 401) {
|
|
26
|
-
const n = await r.clone().text();
|
|
27
|
-
if (!n.includes("Signature has expired"))
|
|
28
|
-
return r;
|
|
29
|
-
if (n.includes("Invalid or expired token"))
|
|
30
|
-
return console.warn("El token expiró"), sessionStorage.removeItem("user_token"), setTimeout(() => {
|
|
31
|
-
window.location.href = i;
|
|
32
|
-
}, 1e3), r;
|
|
33
|
-
}
|
|
34
|
-
return new Promise((w, n) => {
|
|
35
|
-
c.push({ input: o, init: e, resolve: w, reject: n }), l || (l = !0, h = k(), h.then(() => {
|
|
36
|
-
c.forEach(({ input: a, init: s, resolve: d, reject: f }) => {
|
|
37
|
-
const g = {
|
|
38
|
-
...s,
|
|
39
|
-
headers: { ...s.headers, Authorization: sessionStorage.getItem("user_token") }
|
|
40
|
-
};
|
|
41
|
-
window.originalFetch(a, g).then(d).catch(f);
|
|
42
|
-
});
|
|
43
|
-
}).catch((a) => {
|
|
44
|
-
c.forEach(({ reject: s }) => s(a));
|
|
45
|
-
}).finally(() => {
|
|
46
|
-
c.length = 0, l = !1, h = null;
|
|
47
|
-
}));
|
|
48
|
-
});
|
|
49
|
-
} catch (i) {
|
|
50
|
-
return Promise.reject(i);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const p = {};
|
|
54
|
-
export {
|
|
55
|
-
p as default
|
|
56
|
-
};
|