react-ecosistema-unp 1.7.0 → 1.7.1-8.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.
Files changed (53) hide show
  1. package/dist/TabPane-BiwPZSbT.js +752 -0
  2. package/dist/assets/ContenedorVentana.css +1 -1
  3. package/dist/assets/EcoModalStyles.css +1 -0
  4. package/dist/assets/Modal.css +1 -1
  5. package/dist/assets/TabVentana.css +1 -1
  6. package/dist/assets/Tabla.css +1 -1
  7. package/dist/assets/Tarjeta.css +1 -1
  8. package/dist/cards/tarjeta/Tarjeta.js +37 -34
  9. package/dist/cards/tarjeta/nuevo-elemento/NuevoElemento.js +1 -1
  10. package/dist/cards/tarjeta-info/TarjetaInfo.js +1 -1
  11. package/dist/data/tarjeta-datos/TarjetaDatos.js +1 -1
  12. package/dist/index-BrykDZgK.js +390 -0
  13. package/dist/{index-CgSyrJ_X.js → index-D3WseyJh.js} +18 -14
  14. package/dist/{index-Cpp73e44.js → index-DDjnZyBf.js} +31 -19
  15. package/dist/lib/auth/contexts/AuthContex.d.ts +3 -0
  16. package/dist/lib/cards/tarjeta/Tarjeta.d.ts +1 -0
  17. package/dist/lib/tables/tabla-registros/TablaRegistros.d.ts +8 -0
  18. package/dist/lib/tables/tabla-registros/modal/Modal.d.ts +2 -3
  19. package/dist/lib/tables/tabla-registros/modal-v2/EcoModal.d.ts +22 -0
  20. package/dist/lib/tables/tabla-registros/tabla/Tabla.d.ts +7 -1
  21. package/dist/lib/ui/items-modal/ItemsModal.d.ts +1 -0
  22. package/dist/lib/ui/paginador/Paginador.d.ts +3 -0
  23. package/dist/lib/ui.d.ts +1 -1
  24. package/dist/lib/utils/eco-provider/EcoContext.d.ts +4 -0
  25. package/dist/lib/utils/fetch-interceptor/fetchInterceptor.d.ts +7 -0
  26. package/dist/lib/utils/websocket-manager/WebSocketContext.d.ts +3 -0
  27. package/dist/lib/utils.d.ts +1 -0
  28. package/dist/shared/app-list/AppList.js +2 -2
  29. package/dist/shared/iconos-sistema/logout-button/LogoutButton.js +1 -1
  30. package/dist/shared/menu-lateral/MenuLateral.js +6 -4
  31. package/dist/shared/notificacion-usuario/NotificacionUsuario.js +3 -3
  32. package/dist/shared/tab-ventana/TabVentana.js +1 -1
  33. package/dist/shared/ventana-tabs/VentanaTabs.js +1 -1
  34. package/dist/tables/tabla-registros/TablaRegistros.js +499 -492
  35. package/dist/tables/tabla-registros/buscador/Buscador.js +1 -1
  36. package/dist/tables/tabla-registros/encabezado-tabla/EncabezadoTabla.js +12 -9
  37. package/dist/tables/tabla-registros/modal/Modal.js +23 -23
  38. package/dist/tables/tabla-registros/modal-v2/EcoModal.js +118 -0
  39. package/dist/tables/tabla-registros/tabla/Tabla.js +187 -127
  40. package/dist/ui/contenido-modal/ContenidoModal.js +1 -1
  41. package/dist/ui/contenido-modal/ContenidoModalv0.1.js +1 -1
  42. package/dist/ui/icono-tooltip/IconoTooltip.js +1 -1
  43. package/dist/ui/items-modal/ItemsModal.js +16 -13
  44. package/dist/ui/paginador/Paginador.js +27 -16
  45. package/dist/ui.js +9 -8
  46. package/dist/utils/components/ProtectedRoute.js +57 -30
  47. package/dist/utils/components/UserRoute.js +45 -22
  48. package/dist/utils/eco-provider/EcoContext.js +31 -0
  49. package/dist/utils/fetch-interceptor/fetchInterceptor.js +56 -0
  50. package/dist/utils/unp-historico/UnpHistorico.js +6 -4
  51. package/dist/utils.js +17 -15
  52. package/package.json +4 -2
  53. package/dist/TabPane-DtFCEmIj.js +0 -1136
@@ -1,25 +1,28 @@
1
- import { jsx as t, jsxs as o } from "react/jsx-runtime";
2
- import { useNavigate as d } from "react-router-dom";
3
- import { r as i, s as n } from "../../index-Cpp73e44.js";
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
+ import { useNavigate as s } from "react-router-dom";
3
+ import { t as i, u as n } from "../../index-DDjnZyBf.js";
4
4
  import { G as c } from "../../iconBase-LROS5hdG.js";
5
5
  import '../../assets/ItemsModal.css';/* empty css */
6
- function m(l) {
7
- return c({ tag: "svg", attr: { viewBox: "0 0 32 32" }, child: [{ tag: "path", attr: { d: "M 15 4 L 15 20.5625 L 9.71875 15.28125 L 8.28125 16.71875 L 15.28125 23.71875 L 16 24.40625 L 16.71875 23.71875 L 23.71875 16.71875 L 22.28125 15.28125 L 17 20.5625 L 17 4 Z M 7 26 L 7 28 L 25 28 L 25 26 Z" }, child: [] }] })(l);
6
+ function m(o) {
7
+ return c({ tag: "svg", attr: { viewBox: "0 0 32 32" }, child: [{ tag: "path", attr: { d: "M 15 4 L 15 20.5625 L 9.71875 15.28125 L 8.28125 16.71875 L 15.28125 23.71875 L 16 24.40625 L 16.71875 23.71875 L 23.71875 16.71875 L 22.28125 15.28125 L 17 20.5625 L 17 4 Z M 7 26 L 7 28 L 25 28 L 25 26 Z" }, child: [] }] })(o);
8
8
  }
9
- const N = ({ sections: l }) => {
10
- const e = d();
11
- return /* @__PURE__ */ t("div", { className: "listado-tarjetas", children: l.map((a, r) => /* @__PURE__ */ o("div", { className: "tarjeta-listado-row", children: [
12
- /* @__PURE__ */ o(
9
+ const N = ({ sections: o }) => {
10
+ const e = s();
11
+ return /* @__PURE__ */ t("div", { className: "listado-tarjetas", children: o.map((a, r) => /* @__PURE__ */ l("div", { className: "tarjeta-listado-row", children: [
12
+ /* @__PURE__ */ l(
13
13
  "div",
14
14
  {
15
15
  className: "tarjeta-listado-container",
16
16
  onClick: () => e(a.route, { state: a.state }),
17
17
  children: [
18
- /* @__PURE__ */ o("div", { className: "tarjeta-listado-label-container", children: [
18
+ /* @__PURE__ */ l("div", { className: "tarjeta-listado-label-container", children: [
19
19
  /* @__PURE__ */ t(a.icon, { className: "tarjeta-listado-process-menu" }),
20
20
  /* @__PURE__ */ t("span", { children: a.label })
21
21
  ] }),
22
- "closed" in a && /* @__PURE__ */ t("div", { className: "tarjeta-listado-state-container", children: a.closed ? /* @__PURE__ */ t(i, { style: { color: "#3AB34A" } }) : /* @__PURE__ */ t(n, { style: { color: "#E2E2E2" } }) })
22
+ "closed" in a && /* @__PURE__ */ l("div", { className: "tarjeta-listado-state-container", children: [
23
+ a.extraItem && a.extraItem,
24
+ a.closed ? /* @__PURE__ */ t(i, { style: { color: "#3AB34A" } }) : /* @__PURE__ */ t(n, { style: { color: "#E2E2E2" } })
25
+ ] })
23
26
  ]
24
27
  }
25
28
  ),
@@ -27,8 +30,8 @@ const N = ({ sections: l }) => {
27
30
  "div",
28
31
  {
29
32
  className: "tarjeta-listado-download-container",
30
- onClick: (s) => {
31
- s.stopPropagation(), a.handleDownload && a.handleDownload();
33
+ onClick: (d) => {
34
+ d.stopPropagation(), a.handleDownload && a.handleDownload();
32
35
  },
33
36
  children: /* @__PURE__ */ t(m, { className: "tarjeta-listado-download-icon" })
34
37
  }
@@ -1,29 +1,36 @@
1
- import { jsxs as s, Fragment as h, jsx as i } from "react/jsx-runtime";
2
- import { useState as p, useRef as g, useEffect as y } from "react";
1
+ import { jsxs as s, Fragment as g, jsx as i } from "react/jsx-runtime";
2
+ import { useState as v, useRef as b, useEffect as N } from "react";
3
3
  import '../../assets/Bootstrap.css';import '../../assets/Paginador.css';/* empty css */
4
4
  /* empty css */
5
- import { C as v } from "../../Card-DAsInpjB.js";
5
+ import { C as k } from "../../Card-DAsInpjB.js";
6
6
  import { B as f } from "../../Button-B87TJYml.js";
7
- const w = ({ stepContent: a, onSubmit: d, canJump: c = !0 }) => {
8
- const [e, t] = p(0), o = g(null);
9
- return y(() => {
7
+ const E = ({
8
+ stepContent: a,
9
+ onSubmit: d,
10
+ canJump: c = !0,
11
+ sendButtonLabel: p = "Enviar",
12
+ isSendButtonDisabled: y = !1,
13
+ extraButton: u
14
+ }) => {
15
+ const [e, t] = v(0), o = b(null);
16
+ return N(() => {
10
17
  o.current && e > 0 && o.current.scrollIntoView({
11
18
  behavior: "smooth"
12
19
  });
13
- }, [e]), /* @__PURE__ */ s(h, { children: [
14
- /* @__PURE__ */ i(v, { ref: o, className: "border-0 paginador-card", children: /* @__PURE__ */ i("ul", { id: "progressbar", children: a.map((l, r) => /* @__PURE__ */ s(
20
+ }, [e]), /* @__PURE__ */ s(g, { children: [
21
+ /* @__PURE__ */ i(k, { ref: o, className: "border-0 paginador-card", children: /* @__PURE__ */ i("ul", { id: "progressbar", children: a.map((l, r) => /* @__PURE__ */ s(
15
22
  "li",
16
23
  {
17
24
  className: r <= e ? "active" : "",
18
25
  onClick: async () => {
19
26
  if (a[e].handleNextClick && !c) {
20
27
  const n = a[e].handleNextClick;
21
- let u = !0;
28
+ let m = !0;
22
29
  if (n) {
23
- const m = await n();
24
- typeof m == "boolean" && (u = m);
30
+ const h = await n();
31
+ typeof h == "boolean" && (m = h);
25
32
  }
26
- u && t(e + 1);
33
+ m && (r >= e + 1 ? t(e + 1) : r < e && t(r));
27
34
  } else c ? c && t(r) : (r === e + 1 || r < e) && t(r);
28
35
  },
29
36
  children: [
@@ -38,6 +45,7 @@ const w = ({ stepContent: a, onSubmit: d, canJump: c = !0 }) => {
38
45
  e > 0 && /* @__PURE__ */ i(
39
46
  f,
40
47
  {
48
+ type: "button",
41
49
  variant: "unp_secondary",
42
50
  onClick: () => t(e - 1),
43
51
  children: "Anterior"
@@ -46,6 +54,7 @@ const w = ({ stepContent: a, onSubmit: d, canJump: c = !0 }) => {
46
54
  e < a.length - 1 && /* @__PURE__ */ i(
47
55
  f,
48
56
  {
57
+ type: "button",
49
58
  variant: "unp_primary",
50
59
  style: { justifySelf: "end", marginLeft: "1rem" },
51
60
  onClick: async () => {
@@ -63,16 +72,18 @@ const w = ({ stepContent: a, onSubmit: d, canJump: c = !0 }) => {
63
72
  e === a.length - 1 && d && /* @__PURE__ */ i(
64
73
  f,
65
74
  {
66
- type: "submit",
75
+ type: "button",
67
76
  variant: "unp_send",
68
77
  onClick: d,
69
78
  style: { marginLeft: "1rem" },
70
- children: "Enviar"
79
+ disabled: y,
80
+ children: p
71
81
  }
72
- )
82
+ ),
83
+ u && /* @__PURE__ */ i("div", { children: u })
73
84
  ] })
74
85
  ] });
75
86
  };
76
87
  export {
77
- w as Paginador
88
+ E as Paginador
78
89
  };
package/dist/ui.js CHANGED
@@ -1,23 +1,24 @@
1
1
  import { Encabezado as t } from "./ui/encabezado/Encabezado.js";
2
2
  import { Subtitulo as m } from "./ui/subtitulo/Subtitulo.js";
3
- import { ContenidoModal as n } from "./ui/contenido-modal/ContenidoModal.js";
4
- import { Paginador as f } from "./ui/paginador/Paginador.js";
3
+ import { ContenidoModal as a } from "./ui/contenido-modal/ContenidoModal.js";
4
+ import { Paginador as n } from "./ui/paginador/Paginador.js";
5
5
  import { Logo as d } from "./ui/logo/Logo.js";
6
6
  import { ItemsModal as l } from "./ui/items-modal/ItemsModal.js";
7
7
  import { IconoTooltip as M } from "./ui/icono-tooltip/IconoTooltip.js";
8
8
  import { ContenedorVentana as C } from "./ui/contenedor-ventana/ContenedorVentana.js";
9
- import { CustomModal as g, EcoModal as s } from "./tables/tabla-registros/modal/Modal.js";
10
- import { Animacion as I } from "./ui/animacion/Animacion.js";
9
+ import { CustomModal as g } from "./tables/tabla-registros/modal/Modal.js";
10
+ import { EcoModal as E } from "./tables/tabla-registros/modal-v2/EcoModal.js";
11
+ import { Animacion as z } from "./ui/animacion/Animacion.js";
11
12
  export {
12
- I as Animacion,
13
+ z as Animacion,
13
14
  C as ContenedorVentana,
14
- n as ContenidoModal,
15
+ a as ContenidoModal,
15
16
  g as CustomModal,
16
- s as EcoModal,
17
+ E as EcoModal,
17
18
  t as Encabezado,
18
19
  M as IconoTooltip,
19
20
  l as ItemsModal,
20
21
  d as Logo,
21
- f as Paginador,
22
+ n as Paginador,
22
23
  m as Subtitulo
23
24
  };
@@ -1,39 +1,66 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { useState as h, useEffect as u } from "react";
3
- import { useNavigate as p, useLocation as w, Outlet as k } from "react-router-dom";
4
- import { j as v } from "../../index-CuHybtft.js";
1
+ import { jsx as _ } from "react/jsx-runtime";
2
+ import { useState as T, useEffect as v } from "react";
3
+ import { useNavigate as b, useLocation as y, Outlet as g } from "react-router-dom";
4
+ import { j as f } from "../../index-CuHybtft.js";
5
5
  const $ = () => {
6
- const [r, t] = h(!1), i = p(), c = w(), e = `${window.location.protocol}//${window.location.host}/`;
7
- return u(() => {
6
+ const [w, c] = T(!1), p = b(), d = y(), s = `${window.location.protocol}//${window.location.host}/`, m = async () => {
7
+ if (!(await fetch(`${s}api-auth/auth/refresh_token/`, {
8
+ method: "POST",
9
+ headers: { "Content-Type": "application/json" },
10
+ credentials: "include"
11
+ })).ok)
12
+ throw new Error("Error al refrescar token de Microsoft");
13
+ return !0;
14
+ }, u = async (r) => {
15
+ const a = await fetch(`${s}api-auth/users/role_by_user`, {
16
+ method: "POST",
17
+ headers: { "Content-Type": "application/json" },
18
+ body: JSON.stringify({ id_usuario: r })
19
+ });
20
+ if (!a.ok)
21
+ throw new Error("Error al obtener roles del usuario");
22
+ return (await a.json()).roles.map((t) => t.id_rol);
23
+ }, h = (r, a, o) => {
24
+ const n = r.datos_basicos.servicios.map((e) => e.url).filter((e) => !!e).map(
25
+ (e) => e.startsWith("/") ? e : `/${e}`
26
+ ), i = o.startsWith("/") ? o : `/${o}`, l = n.some(
27
+ (e) => i.startsWith(e)
28
+ ), k = r.datos_basicos.servicios.some(
29
+ (e) => a.includes(e.id_rol)
30
+ );
31
+ return l && k;
32
+ };
33
+ return v(() => {
8
34
  (async () => {
9
35
  try {
10
- if ((await fetch(
11
- `${e}api-auth/auth/validate_jwt/`,
12
- {
13
- method: "POST",
14
- headers: {
15
- "Content-Type": "application/json"
16
- },
17
- credentials: "include"
18
- }
19
- )).ok) {
20
- const a = sessionStorage.getItem("user_token");
21
- if (a) {
22
- const l = v(a).datos_basicos.servicios.map((o) => o.url).filter((o) => !!o), s = c.pathname, m = l.map(
23
- (o) => o.startsWith("/") ? o : `/${o}`
24
- ), d = s.startsWith("/") ? s : `/${s}`;
25
- m.some(
26
- (o) => d.startsWith(o)
27
- ) ? t(!0) : (t(!1), sessionStorage.removeItem("user_token"), window.location.href = e);
36
+ if (!(await fetch(`${s}api-auth/auth/validate_jwt/`, {
37
+ method: "POST",
38
+ headers: { "Content-Type": "application/json" },
39
+ credentials: "include"
40
+ })).ok) throw new Error("Token inválido");
41
+ const o = sessionStorage.getItem("user_token");
42
+ if (!o) throw new Error("Token no encontrado");
43
+ const t = f(o), n = t.datos_basicos.id_busuario, i = await u(n);
44
+ h(t, i, d.pathname) ? c(!0) : (sessionStorage.removeItem("user_token"), window.location.href = s, c(!1));
45
+ } catch {
46
+ try {
47
+ if (await m()) {
48
+ const t = sessionStorage.getItem("user_token");
49
+ if (!t) throw new Error("Token no encontrado tras refresco");
50
+ const n = f(t), i = n.datos_basicos.id_busuario, l = await u(i);
51
+ if (h(n, l, d.pathname)) {
52
+ c(!0);
53
+ return;
54
+ } else
55
+ sessionStorage.removeItem("user_token"), window.location.href = s, c(!1);
28
56
  } else
29
- t(!1), sessionStorage.removeItem("user_token"), window.location.href = e;
30
- } else
31
- sessionStorage.removeItem("user_token"), window.location.href = e;
32
- } catch (n) {
33
- console.error("Validation error:", n), sessionStorage.removeItem("user_token"), window.location.href = e;
57
+ throw new Error("No se pudo refrescar el token.");
58
+ } catch {
59
+ sessionStorage.removeItem("user_token"), window.location.href = s;
60
+ }
34
61
  }
35
62
  })();
36
- }, [i]), r ? /* @__PURE__ */ f(k, {}) : null;
63
+ }, [p, d.pathname]), w ? /* @__PURE__ */ _(g, {}) : null;
37
64
  };
38
65
  export {
39
66
  $ as ProtectedRoute
@@ -1,30 +1,53 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { useState as a, useEffect as i } from "react";
3
- import { useNavigate as l, Outlet as c } from "react-router-dom";
4
- const f = () => {
5
- const [t, r] = a(!1), n = l(), e = `${window.location.protocol}//${window.location.host}/`;
6
- return i(() => {
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
- `${e}api-auth/auth/validate_jwt/`,
11
- {
12
- method: "POST",
13
- headers: {
14
- "Content-Type": "application/json"
15
- },
16
- credentials: "include"
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
- return sessionStorage.removeItem("user_token"), window.location.href = e;
22
- } catch (o) {
23
- return console.error("Validation error:", o), sessionStorage.removeItem("user_token"), window.location.href = e;
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
- }, [n]), t ? /* @__PURE__ */ s(c, {}) : null;
49
+ }, [r]), o ? /* @__PURE__ */ c(u, {}) : null;
27
50
  };
28
51
  export {
29
- f as UserRoute
52
+ k as UserRoute
30
53
  };
@@ -0,0 +1,31 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { AuthProvider as t } from "../../auth/contexts/AuthContex.js";
3
+ import "react";
4
+ import "react-router-dom";
5
+ import "../../index-CuHybtft.js";
6
+ 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
+ /* empty css */
8
+ /* empty css */
9
+ import "../../cards/tarjeta/seccion-tarjeta/SeccionTarjeta.js";
10
+ /* empty css */
11
+ /* empty css */
12
+ /* empty css */
13
+ /* empty css */
14
+ /* empty css */
15
+ /* empty css */
16
+ import "../../ui/subtitulo/Subtitulo.js";
17
+ /* empty css */
18
+ /* empty css */
19
+ /* empty css */
20
+ /* empty css */
21
+ /* empty css */
22
+ /* empty css */
23
+ import "../../index-BrykDZgK.js";
24
+ /* empty css */
25
+ import "../../Animacion-ThNL9iiY.js";
26
+ import "../../index-BUe3EJDH.js";
27
+ import { WebSocketProvider as i } from "../websocket-manager/WebSocketContext.js";
28
+ const B = ({ children: o }) => /* @__PURE__ */ r(t, { children: /* @__PURE__ */ r(i, { children: o }) });
29
+ export {
30
+ B as EcoProvider
31
+ };
@@ -0,0 +1,56 @@
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
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsx as t, Fragment as s, jsxs as a } from "react/jsx-runtime";
2
2
  import { useState as l, useEffect as N } from "react";
3
- 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 */
3
+ 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 */
4
4
  /* empty css */
5
5
  /* empty css */
6
6
  import "../../cards/tarjeta/seccion-tarjeta/SeccionTarjeta.js";
@@ -9,7 +9,7 @@ import "../../cards/tarjeta/seccion-tarjeta/SeccionTarjeta.js";
9
9
  /* empty css */
10
10
  /* empty css */
11
11
  import { TarjetaInfo as b } from "../../cards/tarjeta-info/TarjetaInfo.js";
12
- import { F as u } from "../../index-CgSyrJ_X.js";
12
+ import { F as u } from "../../index-D3WseyJh.js";
13
13
  import { fetchHistorico as f } from "./FetchHistorico.js";
14
14
  /* empty css */
15
15
  import "../../ui/subtitulo/Subtitulo.js";
@@ -20,9 +20,11 @@ import "react-router-dom";
20
20
  /* empty css */
21
21
  /* empty css */
22
22
  /* empty css */
23
+ import "../../index-BrykDZgK.js";
24
+ /* empty css */
23
25
  import { Animacion as v } from "../../ui/animacion/Animacion.js";
24
26
  import { T as g } from "../../Table-C5ydZooy.js";
25
- const G = ({ endpoint: h, nuip: r }) => {
27
+ const K = ({ endpoint: h, nuip: r }) => {
26
28
  const [c, m] = l({
27
29
  sintesisHechos1: !1,
28
30
  sintesisHehcos2: !1
@@ -156,5 +158,5 @@ const G = ({ endpoint: h, nuip: r }) => {
156
158
  ] }) });
157
159
  };
158
160
  export {
159
- G as UnpHistorico
161
+ K as UnpHistorico
160
162
  };
package/dist/utils.js CHANGED
@@ -1,22 +1,24 @@
1
- import { AuthProvider as r } from "./auth/contexts/AuthContex.js";
2
- import { ProtectedRoute as m } from "./utils/components/ProtectedRoute.js";
3
- import { UserRoute as s } from "./utils/components/UserRoute.js";
4
- import { UnpHistorico as f } from "./utils/unp-historico/UnpHistorico.js";
5
- import { IsInvalidStyles as x, useFormValidation as a } from "./utils/validations/useFormValidation.js";
6
- import { CaptchaEcosistema as n } from "./utils/captcha/CaptchaEcosistema.js";
1
+ import { EcoProvider as r } from "./utils/eco-provider/EcoContext.js";
2
+ import { AuthProvider as m } from "./auth/contexts/AuthContex.js";
3
+ import { ProtectedRoute as c } from "./utils/components/ProtectedRoute.js";
4
+ import { UserRoute as i } from "./utils/components/UserRoute.js";
5
+ import { UnpHistorico as x } from "./utils/unp-historico/UnpHistorico.js";
6
+ import { IsInvalidStyles as u, useFormValidation as d } from "./utils/validations/useFormValidation.js";
7
+ import { CaptchaEcosistema as v } from "./utils/captcha/CaptchaEcosistema.js";
7
8
  import { useFetchData as S } from "./utils/fetch-data/useFetchData.js";
8
9
  import { WebSocketProvider as h, useWebSocketConnection as k } from "./utils/websocket-manager/WebSocketContext.js";
9
- import { useWebSocket as v } from "./utils/websocket-manager/useWebSocket.js";
10
+ import { useWebSocket as W } from "./utils/websocket-manager/useWebSocket.js";
10
11
  export {
11
- r as AuthProvider,
12
- n as CaptchaEcosistema,
13
- x as IsInvalidStyles,
14
- m as ProtectedRoute,
15
- f as UnpHistorico,
16
- s as UserRoute,
12
+ m as AuthProvider,
13
+ v as CaptchaEcosistema,
14
+ r as EcoProvider,
15
+ u as IsInvalidStyles,
16
+ c as ProtectedRoute,
17
+ x as UnpHistorico,
18
+ i as UserRoute,
17
19
  h as WebSocketProvider,
18
20
  S as useFetchData,
19
- a as useFormValidation,
20
- v as useWebSocket,
21
+ d as useFormValidation,
22
+ W as useWebSocket,
21
23
  k as useWebSocketConnection
22
24
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "react-ecosistema-unp",
3
3
  "author": "Ecosistema de Información - Unidad Nacional de Protección",
4
4
  "private": false,
5
- "version": "1.7.0",
5
+ "version": "1.7.18.pre-1",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
@@ -36,7 +36,9 @@
36
36
  "./data": {
37
37
  "types": "./dist/lib/data.d.ts",
38
38
  "default": "./dist/data.js"
39
- }
39
+ },
40
+ "./styles/EcoStyles.css": "./dist/assets/Bootstrap.css",
41
+ "./utils/fetchInterceptor.js": "./dist/utils/fetch-interceptor/fetchInterceptor.js"
40
42
  },
41
43
  "files": [
42
44
  "dist"