react-ecosistema-unp 1.7.7 → 1.7.9-pre.0
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/assets/Tarjeta.css +1 -1
- package/dist/cards/tarjeta/Tarjeta.js +37 -34
- package/dist/lib/cards/tarjeta/Tarjeta.d.ts +1 -0
- package/dist/lib/utils/fetch-interceptor/fetchInterceptor.d.ts +7 -0
- package/dist/shared/menu-lateral/MenuLateral.js +5 -4
- package/dist/utils/eco-provider/EcoContext.js +3 -2
- package/dist/utils/fetch-interceptor/fetchInterceptor.js +56 -0
- package/package.json +1 -1
package/dist/assets/Tarjeta.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.bg-unp{border-radius:6px 6px 0 0!important;background-color:#303d50!important}.tarjeta-unp{border-radius:12px!important;box-shadow:0 6px 10px #00000019;border-bottom-left-radius:12px;margin-bottom:
|
|
1
|
+
.bg-unp{border-radius:6px 6px 0 0!important;background-color:#303d50!important}.tarjeta-unp{border-radius:12px!important;box-shadow:0 6px 10px #00000019;border-bottom-left-radius:12px;margin-bottom:1rem}.tarjeta-header-unp{border-top-left-radius:12px!important;border-top-right-radius:12px!important}.card-close-button{background:none;border:none;font-size:1.5em;cursor:pointer;color:#fff;margin-left:auto}.card-close-button:hover{color:#d36269}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as l, jsx as t, Fragment as c } from "react/jsx-runtime";
|
|
2
2
|
import a from "react";
|
|
3
3
|
import '../../assets/Bootstrap.css';import '../../assets/Tarjeta.css';/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
|
-
import { C as
|
|
6
|
-
import { C as
|
|
7
|
-
import { B as
|
|
8
|
-
const
|
|
9
|
-
marginBottom: "20px",
|
|
5
|
+
import { C as v, a as E } from "../../Card-DAsInpjB.js";
|
|
6
|
+
import { C as T } from "../../CardBody-CqyD8ylW.js";
|
|
7
|
+
import { B as x } from "../../Button-B87TJYml.js";
|
|
8
|
+
const V = {
|
|
10
9
|
width: "100px"
|
|
11
|
-
},
|
|
12
|
-
title:
|
|
10
|
+
}, k = ({
|
|
11
|
+
title: y,
|
|
13
12
|
header: s = !1,
|
|
14
|
-
children:
|
|
15
|
-
method:
|
|
16
|
-
validated:
|
|
17
|
-
onSubmit:
|
|
18
|
-
hasPaddingTop:
|
|
13
|
+
children: i,
|
|
14
|
+
method: o = "get",
|
|
15
|
+
validated: u = !1,
|
|
16
|
+
onSubmit: f,
|
|
17
|
+
hasPaddingTop: g = !0,
|
|
19
18
|
onClose: r,
|
|
20
|
-
hasBody:
|
|
21
|
-
buttonLabel:
|
|
22
|
-
isButtonDisabled:
|
|
19
|
+
hasBody: b = !0,
|
|
20
|
+
buttonLabel: j = "Enviar",
|
|
21
|
+
isButtonDisabled: h = !1,
|
|
22
|
+
extraButton: m
|
|
23
23
|
}) => {
|
|
24
|
-
const
|
|
25
|
-
(
|
|
26
|
-
),
|
|
27
|
-
isGray:
|
|
28
|
-
isLast:
|
|
29
|
-
}) :
|
|
30
|
-
return /* @__PURE__ */
|
|
24
|
+
const n = a.Children.toArray(i), C = n[0] && a.isValidElement(n[0]) && n[0].type.displayName === "Subtitulo", p = n.filter(
|
|
25
|
+
(e) => a.isValidElement(e) && e.type.displayName === "SeccionTarjeta"
|
|
26
|
+
), N = p.length > 0, S = a.Children.map(i, (e, d) => a.isValidElement(e) && e.type.displayName === "SeccionTarjeta" ? a.cloneElement(e, {
|
|
27
|
+
isGray: e.props.isGray ?? d % 2 === 1,
|
|
28
|
+
isLast: e.props.isLast ?? d === p.length - 1
|
|
29
|
+
}) : e);
|
|
30
|
+
return /* @__PURE__ */ l(
|
|
31
31
|
"form",
|
|
32
32
|
{
|
|
33
|
-
method:
|
|
33
|
+
method: o,
|
|
34
34
|
noValidate: !0,
|
|
35
|
-
onSubmit:
|
|
36
|
-
className:
|
|
35
|
+
onSubmit: f,
|
|
36
|
+
className: u ? "was-validated" : "",
|
|
37
37
|
children: [
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
|
|
38
|
+
/* @__PURE__ */ l(v, { className: "border-0 tarjeta-unp", children: [
|
|
39
|
+
/* @__PURE__ */ l(
|
|
40
|
+
E,
|
|
41
41
|
{
|
|
42
42
|
className: "bg-unp text-light tarjeta-header-unp",
|
|
43
43
|
style: {
|
|
@@ -50,18 +50,21 @@ const T = {
|
|
|
50
50
|
alignItems: "center"
|
|
51
51
|
},
|
|
52
52
|
children: [
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
r && /* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ t("span", { style: { marginLeft: s && r ? "auto" : "" }, children: y }),
|
|
54
|
+
r && /* @__PURE__ */ t("button", { className: "card-close-button", onClick: r, type: "button", children: "×" })
|
|
55
55
|
]
|
|
56
56
|
}
|
|
57
57
|
),
|
|
58
|
-
|
|
58
|
+
N ? S : b ? /* @__PURE__ */ t(T, { className: `${C || !g ? "pt-0" : ""}`, children: i }) : /* @__PURE__ */ t(c, { children: i })
|
|
59
59
|
] }),
|
|
60
|
-
|
|
60
|
+
(o === "post" || m) && /* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "end", gap: "0.5rem", marginBottom: "1rem" }, children: [
|
|
61
|
+
/* @__PURE__ */ t("div", { children: o === "post" && /* @__PURE__ */ t(x, { variant: "unp_send", style: V, type: "submit", disabled: h, children: j }) }),
|
|
62
|
+
/* @__PURE__ */ t("div", { children: m && /* @__PURE__ */ t(c, { children: m }) })
|
|
63
|
+
] })
|
|
61
64
|
]
|
|
62
65
|
}
|
|
63
66
|
);
|
|
64
67
|
};
|
|
65
68
|
export {
|
|
66
|
-
|
|
69
|
+
k as Tarjeta
|
|
67
70
|
};
|
|
@@ -4,10 +4,11 @@ import { useNavigate as H } from "react-router-dom";
|
|
|
4
4
|
import { j as u } from "../../index-CuHybtft.js";
|
|
5
5
|
import { useFinalizarSesion as C } from "../../auth/hooks/useFinalizarSesion.js";
|
|
6
6
|
import { urlBase as L, urlCertificadoLaboral as S } from "../../utils/Url.js";
|
|
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/Tarjeta.css';import '../../assets/UnpHistorico.css';import '../../assets/Bootstrap.css';import '../../assets/MenuLateral.css';/* empty css */
|
|
8
|
+
import "../../utils/fetch-interceptor/fetchInterceptor.js";
|
|
7
9
|
import "../../auth/contexts/AuthContex.js";
|
|
8
|
-
|
|
10
|
+
/* empty css */
|
|
9
11
|
/* empty css */
|
|
10
|
-
/* empty css */
|
|
11
12
|
import "../../cards/tarjeta/seccion-tarjeta/SeccionTarjeta.js";
|
|
12
13
|
/* empty css */
|
|
13
14
|
/* empty css */
|
|
@@ -68,7 +69,7 @@ function G(t) {
|
|
|
68
69
|
function W(t) {
|
|
69
70
|
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
71
|
}
|
|
71
|
-
const
|
|
72
|
+
const M1 = ({ onToggle: t, isOpen: c, showConnectionStatus: x }) => {
|
|
72
73
|
const [N, f] = o(!0), [m, p] = o(null), k = c ? "sidebar-bar-panel open" : "sidebar-bar-panel", b = H(), { FinSesion: w } = C(), { connectionStatus: v } = A(), [z, l] = o(!1), [M, n] = o(""), h = `${window.location.host}`;
|
|
73
74
|
if (d(() => {
|
|
74
75
|
const r = sessionStorage.getItem("user_token");
|
|
@@ -305,5 +306,5 @@ const z1 = ({ onToggle: t, isOpen: c, showConnectionStatus: x }) => {
|
|
|
305
306
|
] }) });
|
|
306
307
|
};
|
|
307
308
|
export {
|
|
308
|
-
|
|
309
|
+
M1 as MenuLateral
|
|
309
310
|
};
|
|
@@ -25,7 +25,8 @@ import "../../index-BrykDZgK.js";
|
|
|
25
25
|
import "../../Animacion-ThNL9iiY.js";
|
|
26
26
|
import "../../index-BUe3EJDH.js";
|
|
27
27
|
import { WebSocketProvider as i } from "../websocket-manager/WebSocketContext.js";
|
|
28
|
-
|
|
28
|
+
import "../fetch-interceptor/fetchInterceptor.js";
|
|
29
|
+
const C = ({ children: o }) => /* @__PURE__ */ r(t, { children: /* @__PURE__ */ r(i, { children: o }) });
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
+
C as EcoProvider
|
|
31
32
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
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 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 a = `${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 = a;
|
|
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: c, init: s, resolve: d, reject: f }) => {
|
|
37
|
+
const g = {
|
|
38
|
+
...s,
|
|
39
|
+
headers: { ...s.headers, Authorization: sessionStorage.getItem("user_token") }
|
|
40
|
+
};
|
|
41
|
+
window.originalFetch(c, g).then(d).catch(f);
|
|
42
|
+
});
|
|
43
|
+
}).catch((c) => {
|
|
44
|
+
i.forEach(({ reject: s }) => s(c));
|
|
45
|
+
}).finally(() => {
|
|
46
|
+
i.length = 0, l = !1, h = null;
|
|
47
|
+
}));
|
|
48
|
+
});
|
|
49
|
+
} catch (a) {
|
|
50
|
+
return Promise.reject(a);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const k = {};
|
|
54
|
+
export {
|
|
55
|
+
k as default
|
|
56
|
+
};
|