react-ecosistema-unp 0.9.14 → 0.9.16-pre-release

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.
@@ -1,20 +1,22 @@
1
- import { jsx as t, Fragment as p } from "react/jsx-runtime";
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { useLocation as d, Navigate as r, Outlet as p } from "react-router-dom";
2
3
  import { useAuthId as f } from "../../auth/hooks/AuthHook.js";
3
- import { j as g } from "../../index-CuHybtft.js";
4
- import { u as h, N as r } from "../../chunk-IR6S3I6Y-DDsyyqUQ.js";
5
- const _ = ({ children: s }) => {
6
- const { authToken: n, userToken: i } = f(), m = h(), a = i || localStorage.getItem("user_token");
7
- if (!(n || localStorage.getItem("access_token")) || !a)
8
- return /* @__PURE__ */ t(r, { to: "/", replace: !0 });
4
+ import { j as h } from "../../index-CuHybtft.js";
5
+ const T = () => {
6
+ const { authToken: s, userToken: n } = f(), i = d(), a = n || localStorage.getItem("user_token");
7
+ if (!(s || localStorage.getItem("access_token")) || !a)
8
+ return /* @__PURE__ */ e(r, { to: "/", replace: !0 });
9
+ let c;
9
10
  try {
10
- const u = g(a).access_url, e = m.pathname, d = u.map((o) => o.startsWith("/") ? o : `/${o}`), l = e.startsWith("/") ? e : `/${e}`;
11
- if (!d.includes(l))
12
- return /* @__PURE__ */ t(r, { to: "/sistema/pagina-no-permitida", replace: !0 });
13
- } catch (c) {
14
- return console.error("Error decoding token:", c), /* @__PURE__ */ t(r, { to: "/", replace: !0 });
11
+ c = h(a);
12
+ } catch (t) {
13
+ return console.error("Error decoding token:", t), /* @__PURE__ */ e(r, { to: "/", replace: !0 });
15
14
  }
16
- return /* @__PURE__ */ t(p, { children: s });
15
+ const u = c.access_url, o = i.pathname, l = u.map(
16
+ (t) => t.startsWith("/") ? t : `/${t}`
17
+ ), m = o.startsWith("/") ? o : `/${o}`;
18
+ return l.includes(m) ? /* @__PURE__ */ e(p, {}) : /* @__PURE__ */ e(r, { to: "/sistema/pagina-no-permitida", replace: !0 });
17
19
  };
18
20
  export {
19
- _ as ProtectedRoute
21
+ T as ProtectedRoute
20
22
  };
@@ -1,9 +1,9 @@
1
- import { jsx as t, Fragment as n } from "react/jsx-runtime";
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Navigate as a, Outlet as n } from "react-router-dom";
2
3
  import { useAuthId as s } from "../../auth/hooks/AuthHook.js";
3
- import { N as m } from "../../chunk-IR6S3I6Y-DDsyyqUQ.js";
4
- const p = ({ children: e }) => {
5
- const { authToken: o, userToken: r } = s(), a = r || localStorage.getItem("user_token");
6
- return !(o || localStorage.getItem("access_token")) || !a ? /* @__PURE__ */ t(m, { to: "/sistema/pagina-no-permitida", replace: !0 }) : /* @__PURE__ */ t(n, { children: e });
4
+ const p = () => {
5
+ const { authToken: e, userToken: o } = s(), r = o || localStorage.getItem("user_token");
6
+ return !(e || localStorage.getItem("access_token")) || !r ? /* @__PURE__ */ t(a, { to: "/sistema/pagina-no-permitida", replace: !0 }) : /* @__PURE__ */ t(n, {});
7
7
  };
8
8
  export {
9
9
  p as UserRoute
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": "0.9.14",
5
+ "version": "0.9.16-pre-release",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
@@ -57,7 +57,8 @@
57
57
  },
58
58
  "peerDependencies": {
59
59
  "react": ">=18.0.0 <=20.0.0",
60
- "react-dom": ">=18.0.0 <=20.0.0"
60
+ "react-dom": ">=18.0.0 <=20.0.0",
61
+ "react-router-dom": ">=6.0.0 <=8.0.0"
61
62
  },
62
63
  "dependencies": {
63
64
  "bootstrap": "^5.3.3",
@@ -65,7 +66,6 @@
65
66
  "lottie-react": "^2.4.1",
66
67
  "react-bootstrap": "^2.10.9",
67
68
  "react-icons": "^5.4.0",
68
- "react-router-dom": "^7.1.5",
69
69
  "react-toastify": "^11.0.3",
70
70
  "sweetalert2": "^11.16.1"
71
71
  },