@variamosple/variamos-components 0.0.23 → 0.1.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/Components/AuthWrapper/index.js +18 -38
- package/dist/Components/ConfirmationModal/index.d.ts +1 -1
- package/dist/Components/ConfirmationModal/index.js +19 -280
- package/dist/Components/Footer/index.js +6 -6
- package/dist/Components/Header/BugFormModal.d.ts +14 -0
- package/dist/Components/Header/BugFormModal.js +100 -0
- package/dist/Components/Header/HeaderOptions.js +85 -31
- package/dist/Components/Header/MenuItem.js +19 -20
- package/dist/Components/Header/SubHeader.js +35 -9
- package/dist/Components/Header/index.js +24 -25
- package/dist/Components/NotAuthorized/index.js +10 -11
- package/dist/Components/Paginator/index.js +56 -128
- package/dist/Components/ProtectedRoute/index.js +10 -10
- package/dist/Context/AnalyticsContext.js +7 -7
- package/dist/Context/MenuContext.js +16 -16
- package/dist/Context/SessionContext.js +35 -35
- package/dist/HOC/WithPageVisit.d.ts +1 -1
- package/dist/HOC/WithPageVisit.js +6 -6
- package/dist/assets/index.css +1 -1
- package/package.json +10 -7
- package/dist/AbstractModalHeader-UzCRSxIO.js +0 -1690
- package/dist/Anchor-DJG5WYYF.js +0 -40
- package/dist/Button-DWo2Fl71.js +0 -78
- package/dist/Button-GQJKgb76.js +0 -33
- package/dist/Container-BLjzOisH.js +0 -22
- package/dist/Nav-CdxSljzW.js +0 -144
- package/dist/NavDropdown-AuV3RgfC.js +0 -1764
- package/dist/NavLink-ebvp1HCw.js +0 -173
- package/dist/SubHeader-gTVD9DIX.js +0 -481
- package/dist/ThemeProvider-Q3gZ4GF2.js +0 -72
- package/dist/jsx-runtime-Drh4NO5G.js +0 -633
- package/dist/useEventCallback-Bfo0-hwZ.js +0 -16
- package/dist/useMergedRefs-BpAaCckn.js +0 -16
- package/dist/useWindow-rGE2GXIv.js +0 -118
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useMemo as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as h } from "react";
|
|
3
|
+
import { Nav as v, NavDropdown as d } from "react-bootstrap";
|
|
3
4
|
import "../../Context/AnalyticsContext.js";
|
|
4
5
|
import "../../Context/MenuContext.js";
|
|
5
|
-
import { useRouter as
|
|
6
|
-
import { useSession as
|
|
6
|
+
import { useRouter as C } from "../../Context/RouterContext.js";
|
|
7
|
+
import { useSession as N } from "../../Context/SessionContext.js";
|
|
7
8
|
import { mapToWebTarget as m } from "../../Model/Router.js";
|
|
8
|
-
import { N as h } from "../../Nav-CdxSljzW.js";
|
|
9
|
-
import { N as d } from "../../NavDropdown-AuV3RgfC.js";
|
|
10
9
|
const y = ({
|
|
11
10
|
title: e,
|
|
12
11
|
type: w,
|
|
13
12
|
location: g,
|
|
14
|
-
target:
|
|
15
|
-
children:
|
|
13
|
+
target: k,
|
|
14
|
+
children: t
|
|
16
15
|
}) => {
|
|
17
|
-
const { user: r } =
|
|
18
|
-
const i = (r == null ? void 0 : r.permissions) || [],
|
|
19
|
-
return
|
|
16
|
+
const { user: r } = N(), { navigate: p } = C(), a = h(() => {
|
|
17
|
+
const i = (r == null ? void 0 : r.permissions) || [], R = (r == null ? void 0 : r.roles) || [];
|
|
18
|
+
return t ? t.filter((o) => {
|
|
20
19
|
var c, f;
|
|
21
20
|
if (!((c = o == null ? void 0 : o.allowedPermissions) != null && c.length) && !((f = o == null ? void 0 : o.allowedRoles) != null && f.length))
|
|
22
21
|
return !0;
|
|
23
|
-
let
|
|
24
|
-
return o.allowedRoles && (
|
|
25
|
-
(
|
|
26
|
-
)),
|
|
22
|
+
let l = !0;
|
|
23
|
+
return o.allowedRoles && (l = l && o.allowedRoles.some((n) => R.includes(n))), o.allowedPermissions && (l = l && o.allowedPermissions.some(
|
|
24
|
+
(n) => i.includes(n)
|
|
25
|
+
)), l;
|
|
27
26
|
}) : [];
|
|
28
|
-
}, [
|
|
29
|
-
return w === "location" ? /* @__PURE__ */
|
|
30
|
-
|
|
27
|
+
}, [t, r]);
|
|
28
|
+
return w === "location" ? /* @__PURE__ */ s(
|
|
29
|
+
v.Link,
|
|
31
30
|
{
|
|
32
31
|
as: "button",
|
|
33
32
|
className: "btn btn-link",
|
|
34
|
-
onClick: () => p(g, { target: m(
|
|
33
|
+
onClick: () => p(g, { target: m(k) }),
|
|
35
34
|
children: e
|
|
36
35
|
}
|
|
37
|
-
) : /* @__PURE__ */
|
|
36
|
+
) : /* @__PURE__ */ s(d, { title: e, children: a == null ? void 0 : a.map((i) => /* @__PURE__ */ s(
|
|
38
37
|
d.Item,
|
|
39
38
|
{
|
|
40
39
|
as: "button",
|
|
@@ -1,12 +1,38 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "react";
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as w } from "react";
|
|
3
|
+
import { Navbar as h, Container as g, Nav as d } from "react-bootstrap";
|
|
3
4
|
import "../../Context/AnalyticsContext.js";
|
|
4
|
-
import "../../Context/MenuContext.js";
|
|
5
|
-
import "../../Context/RouterContext.js";
|
|
6
|
-
import "../../Context/SessionContext.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { useMenu as N } from "../../Context/MenuContext.js";
|
|
6
|
+
import { useRouter as v } from "../../Context/RouterContext.js";
|
|
7
|
+
import { useSession as R } from "../../Context/SessionContext.js";
|
|
8
|
+
const H = () => {
|
|
9
|
+
const { navigate: f } = v(), { subMenu: n } = N(), { user: r } = R(), t = w(() => {
|
|
10
|
+
const l = (r == null ? void 0 : r.roles) || [], m = (r == null ? void 0 : r.permissions) || [];
|
|
11
|
+
return n ? n.filter((o) => {
|
|
12
|
+
var a, c;
|
|
13
|
+
if (!((a = o == null ? void 0 : o.allowedRoles) != null && a.length) && !((c = o == null ? void 0 : o.allowedPermissions) != null && c.length))
|
|
14
|
+
return !0;
|
|
15
|
+
let i = !0;
|
|
16
|
+
return o.allowedRoles && (i = i && o.allowedRoles.some(
|
|
17
|
+
(e) => l.includes(e)
|
|
18
|
+
)), o.allowedPermissions && (i = i && o.allowedPermissions.some(
|
|
19
|
+
(e) => m.includes(e)
|
|
20
|
+
)), i;
|
|
21
|
+
}) : [];
|
|
22
|
+
}, [n, r]), p = (l) => () => {
|
|
23
|
+
f(l);
|
|
24
|
+
};
|
|
25
|
+
return t.length ? /* @__PURE__ */ s(h, { className: "py-1 shadow-sm bg-white", children: /* @__PURE__ */ s(g, { children: /* @__PURE__ */ s(d, { className: "d-flex justify-content-center w-100 gap-3", children: t.map((l) => /* @__PURE__ */ s(
|
|
26
|
+
d.Link,
|
|
27
|
+
{
|
|
28
|
+
as: "button",
|
|
29
|
+
className: "btn btn-link p-0",
|
|
30
|
+
onClick: p(l.location),
|
|
31
|
+
children: l.title
|
|
32
|
+
},
|
|
33
|
+
l.location
|
|
34
|
+
)) }) }) }) : null;
|
|
35
|
+
};
|
|
10
36
|
export {
|
|
11
|
-
|
|
37
|
+
H as SubHeader
|
|
12
38
|
};
|
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Navbar as t, Container as u, Nav as i } from "react-bootstrap";
|
|
2
3
|
import "../../Context/AnalyticsContext.js";
|
|
3
|
-
import { useMenu as
|
|
4
|
-
import { useRouter as
|
|
5
|
-
import { useSession as
|
|
6
|
-
import { HeaderOptions as
|
|
7
|
-
import { MenuItemComponent as
|
|
8
|
-
import {
|
|
9
|
-
import { C as h } from "../../Container-BLjzOisH.js";
|
|
10
|
-
import { N as t } from "../../Nav-CdxSljzW.js";
|
|
4
|
+
import { useMenu as h } from "../../Context/MenuContext.js";
|
|
5
|
+
import { useRouter as f } from "../../Context/RouterContext.js";
|
|
6
|
+
import { useSession as g } from "../../Context/SessionContext.js";
|
|
7
|
+
import { HeaderOptions as N } from "./HeaderOptions.js";
|
|
8
|
+
import { MenuItemComponent as n } from "./MenuItem.js";
|
|
9
|
+
import { SubHeader as k } from "./SubHeader.js";
|
|
11
10
|
const I = ({
|
|
12
|
-
logoUrl:
|
|
13
|
-
logoAlt:
|
|
14
|
-
signInUrl:
|
|
11
|
+
logoUrl: a,
|
|
12
|
+
logoAlt: m = "App logo",
|
|
13
|
+
signInUrl: s
|
|
15
14
|
}) => {
|
|
16
|
-
const { items:
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
15
|
+
const { items: c } = h(), { navigate: l } = f(), { isAuthenticated: p, isLoading: d } = g();
|
|
16
|
+
return /* @__PURE__ */ o("header", { className: "sticky-top", children: [
|
|
17
|
+
/* @__PURE__ */ e(t, { bg: "dark", variant: "dark", children: /* @__PURE__ */ o(u, { fluid: !0, children: [
|
|
18
|
+
/* @__PURE__ */ e(t.Brand, { onClick: () => l("/"), children: /* @__PURE__ */ e(
|
|
20
19
|
"img",
|
|
21
20
|
{
|
|
22
|
-
src:
|
|
21
|
+
src: a,
|
|
23
22
|
height: "30",
|
|
24
23
|
className: "d-inline-block align-top",
|
|
25
|
-
alt:
|
|
24
|
+
alt: m
|
|
26
25
|
}
|
|
27
26
|
) }),
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
!
|
|
32
|
-
|
|
27
|
+
/* @__PURE__ */ e(i, { className: "me-auto", children: c.map((r) => /* @__PURE__ */ e(n, { ...r }, r.title)) }),
|
|
28
|
+
/* @__PURE__ */ o(i, { className: "me-5 pe-5", children: [
|
|
29
|
+
/* @__PURE__ */ e(N, {}),
|
|
30
|
+
!d && !p && /* @__PURE__ */ e(
|
|
31
|
+
n,
|
|
33
32
|
{
|
|
34
33
|
title: "Sign In",
|
|
35
34
|
type: "location",
|
|
36
|
-
location:
|
|
35
|
+
location: s
|
|
37
36
|
}
|
|
38
37
|
)
|
|
39
38
|
] })
|
|
40
39
|
] }) }),
|
|
41
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ e(k, {})
|
|
42
41
|
] });
|
|
43
42
|
};
|
|
44
43
|
export {
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Container as i, Button as n } from "react-bootstrap";
|
|
2
3
|
import "../../Context/AnalyticsContext.js";
|
|
3
4
|
import "../../Context/MenuContext.js";
|
|
4
|
-
import { useRouter as
|
|
5
|
+
import { useRouter as a } from "../../Context/RouterContext.js";
|
|
5
6
|
import "../../Context/SessionContext.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/* @__PURE__ */ t
|
|
12
|
-
/* @__PURE__ */ t.jsx("p", { className: "fs-4 text-muted", children: "You are not authorized to access this page." }),
|
|
13
|
-
/* @__PURE__ */ t.jsx(i, { variant: "primary", onClick: () => r(e), children: "Go Home" })
|
|
7
|
+
const u = ({ homePath: e }) => {
|
|
8
|
+
const { navigate: r } = a();
|
|
9
|
+
return /* @__PURE__ */ o(i, { className: "d-flex flex-column justify-content-center align-items-center vh-100 text-center", children: [
|
|
10
|
+
/* @__PURE__ */ t("h1", { className: "display-1 fw-bold text-danger", children: "403" }),
|
|
11
|
+
/* @__PURE__ */ t("p", { className: "fs-4 text-muted", children: "You are not authorized to access this page." }),
|
|
12
|
+
/* @__PURE__ */ t(n, { variant: "primary", onClick: () => r(e), children: "Go Home" })
|
|
14
13
|
] });
|
|
15
14
|
};
|
|
16
15
|
export {
|
|
17
|
-
|
|
16
|
+
u as NotAuthorized
|
|
18
17
|
};
|
|
@@ -1,156 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
linkStyle: d,
|
|
14
|
-
linkClassName: N,
|
|
15
|
-
as: u = v,
|
|
16
|
-
...a
|
|
17
|
-
}, M) => {
|
|
18
|
-
const k = i || s ? "span" : u;
|
|
19
|
-
return /* @__PURE__ */ l.jsx("li", {
|
|
20
|
-
ref: M,
|
|
21
|
-
style: e,
|
|
22
|
-
className: x(r, "page-item", {
|
|
23
|
-
active: i,
|
|
24
|
-
disabled: s
|
|
25
|
-
}),
|
|
26
|
-
children: /* @__PURE__ */ l.jsxs(k, {
|
|
27
|
-
className: x("page-link", N),
|
|
28
|
-
style: d,
|
|
29
|
-
...a,
|
|
30
|
-
children: [o, i && n && /* @__PURE__ */ l.jsx("span", {
|
|
31
|
-
className: "visually-hidden",
|
|
32
|
-
children: n
|
|
33
|
-
})]
|
|
34
|
-
})
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
j.displayName = "PageItem";
|
|
38
|
-
function t(i, s, r = i) {
|
|
39
|
-
const e = /* @__PURE__ */ p.forwardRef(({
|
|
40
|
-
children: n,
|
|
41
|
-
...o
|
|
42
|
-
}, d) => /* @__PURE__ */ l.jsxs(j, {
|
|
43
|
-
...o,
|
|
44
|
-
ref: d,
|
|
45
|
-
children: [/* @__PURE__ */ l.jsx("span", {
|
|
46
|
-
"aria-hidden": "true",
|
|
47
|
-
children: n || s
|
|
48
|
-
}), /* @__PURE__ */ l.jsx("span", {
|
|
49
|
-
className: "visually-hidden",
|
|
50
|
-
children: r
|
|
51
|
-
})]
|
|
52
|
-
}));
|
|
53
|
-
return e.displayName = i, e;
|
|
54
|
-
}
|
|
55
|
-
const E = t("First", "«"), R = t("Prev", "‹", "Previous"), B = t("Ellipsis", "…", "More"), b = t("Next", "›"), w = t("Last", "»"), h = /* @__PURE__ */ p.forwardRef(({
|
|
56
|
-
bsPrefix: i,
|
|
57
|
-
className: s,
|
|
58
|
-
size: r,
|
|
59
|
-
...e
|
|
60
|
-
}, n) => {
|
|
61
|
-
const o = I(i, "pagination");
|
|
62
|
-
return /* @__PURE__ */ l.jsx("ul", {
|
|
63
|
-
ref: n,
|
|
64
|
-
...e,
|
|
65
|
-
className: x(s, o, r && `${o}-${r}`)
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
h.displayName = "Pagination";
|
|
69
|
-
const c = Object.assign(h, {
|
|
70
|
-
First: E,
|
|
71
|
-
Prev: R,
|
|
72
|
-
Ellipsis: B,
|
|
73
|
-
Item: j,
|
|
74
|
-
Next: b,
|
|
75
|
-
Last: w
|
|
76
|
-
}), f = (i, s) => {
|
|
77
|
-
const r = [];
|
|
78
|
-
for (let e = i; e <= s; e++)
|
|
79
|
-
r.push(e);
|
|
80
|
-
return r;
|
|
81
|
-
}, m = 5, L = ({
|
|
82
|
-
currentPage: i,
|
|
83
|
-
totalPages: s,
|
|
84
|
-
onPageChange: r
|
|
1
|
+
import { jsxs as k, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as p } from "react";
|
|
3
|
+
import { Pagination as f } from "react-bootstrap";
|
|
4
|
+
const n = (m, i) => {
|
|
5
|
+
const l = [];
|
|
6
|
+
for (let c = m; c <= i; c++)
|
|
7
|
+
l.push(c);
|
|
8
|
+
return l;
|
|
9
|
+
}, M = 5, v = ({
|
|
10
|
+
currentPage: m,
|
|
11
|
+
totalPages: i,
|
|
12
|
+
onPageChange: l
|
|
85
13
|
}) => {
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
14
|
+
const c = p(() => {
|
|
15
|
+
if (m === 1 && i === 1)
|
|
88
16
|
return [];
|
|
89
|
-
if (
|
|
90
|
-
return
|
|
91
|
-
if (
|
|
92
|
-
return
|
|
93
|
-
let
|
|
94
|
-
return
|
|
95
|
-
}, [
|
|
96
|
-
return /* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
|
|
17
|
+
if (m === 1)
|
|
18
|
+
return n(2, Math.min(i - 1, M + 1));
|
|
19
|
+
if (i - M <= 0)
|
|
20
|
+
return n(2, i - 1);
|
|
21
|
+
let d, h;
|
|
22
|
+
return m <= Math.ceil(M / 2) ? (d = 2, h = Math.min(M + 1, i - 1)) : m + Math.floor(M / 2) >= i ? (d = Math.max(i - M, 2), h = i - 1) : (d = m - Math.floor(M / 2), h = m + Math.floor(M / 2)), h = Math.min(h, i - 1), d = Math.max(d, 2), n(d, h);
|
|
23
|
+
}, [m, i]);
|
|
24
|
+
return /* @__PURE__ */ k(f, { className: "d-flex justify-content-end", children: [
|
|
25
|
+
/* @__PURE__ */ s(
|
|
26
|
+
f.First,
|
|
99
27
|
{
|
|
100
|
-
onClick: () =>
|
|
101
|
-
disabled:
|
|
28
|
+
onClick: () => l(1),
|
|
29
|
+
disabled: m === 1
|
|
102
30
|
}
|
|
103
31
|
),
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
|
|
32
|
+
/* @__PURE__ */ s(
|
|
33
|
+
f.Prev,
|
|
106
34
|
{
|
|
107
|
-
onClick: () =>
|
|
108
|
-
disabled:
|
|
35
|
+
onClick: () => l(m - 1),
|
|
36
|
+
disabled: m === 1
|
|
109
37
|
}
|
|
110
38
|
),
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
|
|
39
|
+
/* @__PURE__ */ s(
|
|
40
|
+
f.Item,
|
|
113
41
|
{
|
|
114
|
-
active:
|
|
115
|
-
onClick: () =>
|
|
42
|
+
active: m === 1,
|
|
43
|
+
onClick: () => l(1),
|
|
116
44
|
children: "1"
|
|
117
45
|
}
|
|
118
46
|
),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
47
|
+
i > 2 && !c.includes(2) && /* @__PURE__ */ s(f.Ellipsis, {}),
|
|
48
|
+
c.map((d) => /* @__PURE__ */ s(
|
|
49
|
+
f.Item,
|
|
122
50
|
{
|
|
123
|
-
active:
|
|
124
|
-
onClick: () =>
|
|
125
|
-
children:
|
|
51
|
+
active: m === d,
|
|
52
|
+
onClick: () => l(d),
|
|
53
|
+
children: d
|
|
126
54
|
},
|
|
127
|
-
|
|
55
|
+
d
|
|
128
56
|
)),
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
57
|
+
i > M && !c.includes(i - 1) && /* @__PURE__ */ s(f.Ellipsis, {}),
|
|
58
|
+
i > 1 && /* @__PURE__ */ s(
|
|
59
|
+
f.Item,
|
|
132
60
|
{
|
|
133
|
-
active:
|
|
134
|
-
onClick: () =>
|
|
135
|
-
children:
|
|
61
|
+
active: m === i,
|
|
62
|
+
onClick: () => l(i),
|
|
63
|
+
children: i
|
|
136
64
|
}
|
|
137
65
|
),
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
|
|
66
|
+
/* @__PURE__ */ s(
|
|
67
|
+
f.Next,
|
|
140
68
|
{
|
|
141
|
-
onClick: () =>
|
|
142
|
-
disabled:
|
|
69
|
+
onClick: () => l(m + 1),
|
|
70
|
+
disabled: m === i
|
|
143
71
|
}
|
|
144
72
|
),
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
|
|
73
|
+
/* @__PURE__ */ s(
|
|
74
|
+
f.Last,
|
|
147
75
|
{
|
|
148
|
-
onClick: () =>
|
|
149
|
-
disabled:
|
|
76
|
+
onClick: () => l(i),
|
|
77
|
+
disabled: m === i
|
|
150
78
|
}
|
|
151
79
|
)
|
|
152
80
|
] });
|
|
153
81
|
};
|
|
154
82
|
export {
|
|
155
|
-
|
|
83
|
+
v as Paginator
|
|
156
84
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useEffect as
|
|
1
|
+
import { jsx as f, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as g } from "react";
|
|
3
3
|
import "../../Context/AnalyticsContext.js";
|
|
4
4
|
import "../../Context/MenuContext.js";
|
|
5
|
-
import { useRouter as
|
|
6
|
-
import { useSession as
|
|
7
|
-
const
|
|
5
|
+
import { useRouter as h } from "../../Context/RouterContext.js";
|
|
6
|
+
import { useSession as d } from "../../Context/SessionContext.js";
|
|
7
|
+
const F = ({
|
|
8
8
|
notAuthorizedPath: e,
|
|
9
9
|
allowedPermissions: i = [],
|
|
10
10
|
children: c
|
|
11
11
|
}) => {
|
|
12
12
|
var m;
|
|
13
|
-
const { isAuthenticated: n, isLoading: r, user: t } =
|
|
14
|
-
return
|
|
13
|
+
const { isAuthenticated: n, isLoading: r, user: t } = d(), { navigate: s } = h();
|
|
14
|
+
return g(() => {
|
|
15
15
|
if (!r && n) {
|
|
16
16
|
const o = (t == null ? void 0 : t.permissions) || [];
|
|
17
|
-
!i.length || o.some((
|
|
17
|
+
!i.length || o.some((p) => i.includes(p)) || s(e);
|
|
18
18
|
}
|
|
19
19
|
}, [
|
|
20
20
|
r,
|
|
@@ -25,8 +25,8 @@ const v = ({
|
|
|
25
25
|
i
|
|
26
26
|
]), i.length > 0 && !((m = t == null ? void 0 : t.permissions) != null && m.some(
|
|
27
27
|
(o) => i.includes(o)
|
|
28
|
-
)) ? null : /* @__PURE__ */
|
|
28
|
+
)) ? null : /* @__PURE__ */ f(u, { children: c });
|
|
29
29
|
};
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
F as ProtectedRoute
|
|
32
32
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { Events as
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as c, useEffect as r } from "react";
|
|
3
|
+
import { Events as a } from "../Common/Events.js";
|
|
4
4
|
import { useDebouncedValue as m } from "../Hooks/useDebouncedValue.js";
|
|
5
|
-
const u =
|
|
5
|
+
const u = c({}), d = "page-visit", E = ({
|
|
6
6
|
onVisit: t,
|
|
7
7
|
children: s
|
|
8
8
|
}) => {
|
|
9
9
|
const [e, o] = m(null, 1e4);
|
|
10
10
|
return r(() => {
|
|
11
|
-
|
|
11
|
+
a.subscribe(d, (i) => {
|
|
12
12
|
o(i.detail.id);
|
|
13
13
|
});
|
|
14
14
|
}, [o]), r(() => {
|
|
15
15
|
e && t(e).then(() => {
|
|
16
16
|
});
|
|
17
|
-
}, [e, t]), /* @__PURE__ */ n
|
|
17
|
+
}, [e, t]), /* @__PURE__ */ n(u.Provider, { value: {}, children: s });
|
|
18
18
|
};
|
|
19
19
|
export {
|
|
20
20
|
u as AnalyticsContext,
|
|
21
21
|
E as AnalyticsProvider,
|
|
22
|
-
|
|
22
|
+
d as PAGE_VISIT_EVENT
|
|
23
23
|
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useQuery as
|
|
4
|
-
import { useRouter as
|
|
5
|
-
import { useSession as
|
|
6
|
-
const P =
|
|
1
|
+
import { jsx as R } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as L, useMemo as d, useEffect as S, useContext as y } from "react";
|
|
3
|
+
import { useQuery as E } from "../Hooks/useQuery.js";
|
|
4
|
+
import { useRouter as j } from "./RouterContext.js";
|
|
5
|
+
import { useSession as q } from "./SessionContext.js";
|
|
6
|
+
const P = L({
|
|
7
7
|
items: [],
|
|
8
8
|
isLoading: !0
|
|
9
9
|
}), A = ({
|
|
10
10
|
requestMenu: e,
|
|
11
11
|
children: h
|
|
12
12
|
}) => {
|
|
13
|
-
const { user: r } =
|
|
13
|
+
const { user: r } = q(), { basePath: l } = j(), {
|
|
14
14
|
data: o,
|
|
15
15
|
loadData: f,
|
|
16
16
|
isLoading: n,
|
|
17
17
|
isLoaded: p
|
|
18
|
-
} =
|
|
18
|
+
} = E({
|
|
19
19
|
queryFunction: e
|
|
20
20
|
}), g = d(() => {
|
|
21
21
|
var w;
|
|
22
22
|
const i = (r == null ? void 0 : r.permissions) || [], c = (r == null ? void 0 : r.roles) || [];
|
|
23
23
|
return (w = o == null ? void 0 : o.items) != null && w.length ? o.items.filter((s) => {
|
|
24
|
-
var
|
|
25
|
-
if (!((
|
|
24
|
+
var v, x;
|
|
25
|
+
if (!((v = s == null ? void 0 : s.allowedPermissions) != null && v.length) && !((x = s == null ? void 0 : s.allowedRoles) != null && x.length))
|
|
26
26
|
return !0;
|
|
27
27
|
let t = !0;
|
|
28
28
|
return s.allowedRoles && (t = t && s.allowedRoles.some((a) => c.includes(a))), s.allowedPermissions && (t = t && s.allowedPermissions.some(
|
|
29
29
|
(a) => i.includes(a)
|
|
30
30
|
)), t;
|
|
31
31
|
}) : [];
|
|
32
|
-
}, [o == null ? void 0 : o.items, r]),
|
|
32
|
+
}, [o == null ? void 0 : o.items, r]), C = d(() => {
|
|
33
33
|
if (!(o != null && o.subMenu))
|
|
34
34
|
return;
|
|
35
35
|
const i = o == null ? void 0 : o.subMenu.find(
|
|
36
36
|
(c) => l === c.accessibleFrom
|
|
37
37
|
);
|
|
38
38
|
return (i == null ? void 0 : i.items) || void 0;
|
|
39
|
-
}, [o == null ? void 0 : o.subMenu, l]),
|
|
39
|
+
}, [o == null ? void 0 : o.subMenu, l]), F = d(() => o != null && o.options ? o == null ? void 0 : o.options.filter(
|
|
40
40
|
(i) => !i.accessibleFrom || l === i.accessibleFrom
|
|
41
41
|
) : [], [o == null ? void 0 : o.options, l]);
|
|
42
|
-
return
|
|
42
|
+
return S(() => {
|
|
43
43
|
!n && !p && f({});
|
|
44
|
-
}, [n, p, f]), /* @__PURE__ */
|
|
44
|
+
}, [n, p, f]), /* @__PURE__ */ R(
|
|
45
45
|
P.Provider,
|
|
46
46
|
{
|
|
47
|
-
value: { items: g, subMenu:
|
|
47
|
+
value: { items: g, subMenu: C, options: F, isLoading: n },
|
|
48
48
|
children: h
|
|
49
49
|
}
|
|
50
50
|
);
|
|
51
51
|
}, B = () => {
|
|
52
|
-
const e =
|
|
52
|
+
const e = y(P);
|
|
53
53
|
if (e === void 0)
|
|
54
54
|
throw new Error("useSession must be used within a SessionProvider");
|
|
55
55
|
return e;
|