@variamosple/variamos-components 0.0.23 → 0.0.24
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/HeaderOptions.js +16 -16
- 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,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;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createContext as K, useState as
|
|
3
|
-
import { Events as
|
|
4
|
-
import { usePageVisibility as
|
|
5
|
-
const y = K(void 0),
|
|
6
|
-
d &&
|
|
1
|
+
import { jsx as G } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as K, useState as T, useEffect as k, useContext as N } from "react";
|
|
3
|
+
import { Events as V } from "../Common/Events.js";
|
|
4
|
+
import { usePageVisibility as z } from "../Hooks/usePageVisibility.js";
|
|
5
|
+
const y = K(void 0), x = "guestId", f = (d) => {
|
|
6
|
+
d && V.publish("variamosNavigate", d);
|
|
7
7
|
}, m = (d) => {
|
|
8
8
|
d && localStorage.setItem("authToken", d);
|
|
9
|
-
},
|
|
9
|
+
}, J = ({
|
|
10
10
|
loginUrl: d,
|
|
11
|
-
getSessionInfo:
|
|
11
|
+
getSessionInfo: e,
|
|
12
12
|
requestSignUp: v,
|
|
13
13
|
requestSignIn: w,
|
|
14
14
|
requestSignInAsGuest: C,
|
|
15
15
|
requestLogout: P,
|
|
16
16
|
children: b
|
|
17
17
|
}) => {
|
|
18
|
-
const [E, t] =
|
|
19
|
-
|
|
20
|
-
c(!0),
|
|
18
|
+
const [E, t] = T(null), [A, c] = T(!0), g = !!E, I = z();
|
|
19
|
+
k(() => {
|
|
20
|
+
c(!0), e().then((o) => {
|
|
21
21
|
var a, n, i;
|
|
22
22
|
o != null && o.errorCode ? t(null) : (m((a = o == null ? void 0 : o.data) == null ? void 0 : a.authToken), t(((n = o == null ? void 0 : o.data) == null ? void 0 : n.user) ?? null), f((i = o == null ? void 0 : o.data) == null ? void 0 : i.redirect));
|
|
23
23
|
}).catch(() => {
|
|
24
24
|
t(null);
|
|
25
25
|
}).finally(() => c(!1));
|
|
26
|
-
}, [
|
|
27
|
-
if (g &&
|
|
26
|
+
}, [e]), k(() => {
|
|
27
|
+
if (g && I) {
|
|
28
28
|
const o = () => {
|
|
29
|
-
|
|
30
|
-
var i, r,
|
|
31
|
-
n != null && n.errorCode ? t(null) : (m((i = n == null ? void 0 : n.data) == null ? void 0 : i.authToken), t(((r = n == null ? void 0 : n.data) == null ? void 0 : r.user) ?? null), f((
|
|
29
|
+
e().then((n) => {
|
|
30
|
+
var i, r, h;
|
|
31
|
+
n != null && n.errorCode ? t(null) : (m((i = n == null ? void 0 : n.data) == null ? void 0 : i.authToken), t(((r = n == null ? void 0 : n.data) == null ? void 0 : r.user) ?? null), f((h = n == null ? void 0 : n.data) == null ? void 0 : h.redirect));
|
|
32
32
|
}).catch(() => {
|
|
33
33
|
t(null);
|
|
34
34
|
});
|
|
@@ -39,28 +39,28 @@ const y = K(void 0), k = "guestId", f = (d) => {
|
|
|
39
39
|
}, 6e4);
|
|
40
40
|
return () => clearInterval(a);
|
|
41
41
|
}
|
|
42
|
-
}, [g,
|
|
43
|
-
const
|
|
42
|
+
}, [g, I, e]);
|
|
43
|
+
const L = (o) => {
|
|
44
44
|
if (!v)
|
|
45
45
|
throw new Error("requestSignUp is not defined.");
|
|
46
46
|
return c(!0), v(o).finally(() => c(!1));
|
|
47
|
-
},
|
|
47
|
+
}, U = (o) => {
|
|
48
48
|
if (!w)
|
|
49
49
|
throw new Error("requestSignIn is not defined.");
|
|
50
|
-
return c(!0), w(o).then((a) => a != null && a.errorCode ? a :
|
|
51
|
-
var i, r,
|
|
52
|
-
return n != null && n.errorCode ? (t(null), a.withError(n.errorCode, n.message)) : (m((i = n == null ? void 0 : n.data) == null ? void 0 : i.authToken), t(((r = n == null ? void 0 : n.data) == null ? void 0 : r.user) ?? null), f((
|
|
50
|
+
return c(!0), w(o).then((a) => a != null && a.errorCode ? a : e().then((n) => {
|
|
51
|
+
var i, r, h;
|
|
52
|
+
return n != null && n.errorCode ? (t(null), a.withError(n.errorCode, n.message)) : (m((i = n == null ? void 0 : n.data) == null ? void 0 : i.authToken), t(((r = n == null ? void 0 : n.data) == null ? void 0 : r.user) ?? null), f((h = n == null ? void 0 : n.data) == null ? void 0 : h.redirect)), a;
|
|
53
53
|
}).catch(() => (t(null), a.withError(500, "Sign in error.")))).finally(() => c(!1));
|
|
54
|
-
},
|
|
54
|
+
}, j = () => {
|
|
55
55
|
if (!C)
|
|
56
56
|
throw new Error("requestSignInAsGuest is not defined.");
|
|
57
57
|
c(!0);
|
|
58
|
-
const o = localStorage.getItem(
|
|
58
|
+
const o = localStorage.getItem(x);
|
|
59
59
|
return C(o).then((a) => {
|
|
60
60
|
var n;
|
|
61
|
-
return a != null && a.errorCode ? a : (localStorage.setItem(
|
|
62
|
-
var r,
|
|
63
|
-
return i != null && i.errorCode ? (t(null), a.withError(i.errorCode, i.message)) : (m((r = i == null ? void 0 : i.data) == null ? void 0 : r.authToken), t(((
|
|
61
|
+
return a != null && a.errorCode ? a : (localStorage.setItem(x, ((n = a == null ? void 0 : a.data) == null ? void 0 : n.id) || ""), e().then((i) => {
|
|
62
|
+
var r, h, S;
|
|
63
|
+
return i != null && i.errorCode ? (t(null), a.withError(i.errorCode, i.message)) : (m((r = i == null ? void 0 : i.data) == null ? void 0 : r.authToken), t(((h = i == null ? void 0 : i.data) == null ? void 0 : h.user) ?? null), f((S = i == null ? void 0 : i.data) == null ? void 0 : S.redirect)), a;
|
|
64
64
|
}).catch(() => (t(null), a.withError(500, "Sign in error."))));
|
|
65
65
|
}).finally(() => c(!1));
|
|
66
66
|
}, q = () => {
|
|
@@ -70,28 +70,28 @@ const y = K(void 0), k = "guestId", f = (d) => {
|
|
|
70
70
|
}, 200);
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
|
-
return /* @__PURE__ */ G
|
|
73
|
+
return /* @__PURE__ */ G(
|
|
74
74
|
y.Provider,
|
|
75
75
|
{
|
|
76
76
|
value: {
|
|
77
77
|
user: E,
|
|
78
78
|
isAuthenticated: g,
|
|
79
79
|
logout: q,
|
|
80
|
-
signUp:
|
|
81
|
-
signIn:
|
|
82
|
-
signInAsGuest:
|
|
83
|
-
isLoading:
|
|
80
|
+
signUp: L,
|
|
81
|
+
signIn: U,
|
|
82
|
+
signInAsGuest: j,
|
|
83
|
+
isLoading: A
|
|
84
84
|
},
|
|
85
85
|
children: b
|
|
86
86
|
}
|
|
87
87
|
);
|
|
88
|
-
},
|
|
88
|
+
}, M = () => {
|
|
89
89
|
const d = N(y);
|
|
90
90
|
if (d === void 0)
|
|
91
91
|
throw new Error("useSession must be used within a SessionProvider");
|
|
92
92
|
return d;
|
|
93
93
|
};
|
|
94
94
|
export {
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
J as SessionProvider,
|
|
96
|
+
M as useSession
|
|
97
97
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
export declare function withPageVisit<T extends object>(WrappedComponent: React.ComponentType<T>, id: string): (props: T) =>
|
|
2
|
+
export declare function withPageVisit<T extends object>(WrappedComponent: React.ComponentType<T>, id: string): (props: T) => React.JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import e from "react";
|
|
3
3
|
import { Events as m } from "../Common/Events.js";
|
|
4
4
|
import { PAGE_VISIT_EVENT as f } from "../Context/AnalyticsContext.js";
|
|
5
|
-
function E(
|
|
6
|
-
return (o) => (
|
|
7
|
-
m.publish(f, { id:
|
|
8
|
-
}, []), /* @__PURE__ */
|
|
5
|
+
function E(r, t) {
|
|
6
|
+
return (o) => (e.useEffect(() => {
|
|
7
|
+
m.publish(f, { id: t });
|
|
8
|
+
}, []), /* @__PURE__ */ i(r, { ...o }));
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
11
|
E as withPageVisit
|
package/dist/assets/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._footer_cvhpi_1{height:50px;min-height:50px;background-color:var(--dark-color-font);color:#fff;text-align:center;margin-top:auto;display:flex;justify-content:center;align-items:center}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@variamosple/variamos-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.24",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"types": "dist/main.d.ts",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"prepack": "npm run build"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"react": "^18.3.1",
|
|
22
|
+
"react": "^18.3.1 || ^19.0.0",
|
|
23
23
|
"react-bootstrap": "^2.10.9",
|
|
24
24
|
"react-bootstrap-icons": "^1.11.5",
|
|
25
|
-
"react-dom": "^18.3.1"
|
|
25
|
+
"react-dom": "^18.3.1 || ^19.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@variamosple/variamos-components": "file:"
|
|
@@ -30,21 +30,24 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@eslint/js": "^9.19.0",
|
|
32
32
|
"@types/node": "^22.13.4",
|
|
33
|
-
"@types/react": "^
|
|
33
|
+
"@types/react": "^19.2.18",
|
|
34
34
|
"@types/react-bootstrap": "^0.32.37",
|
|
35
|
-
"@types/react-dom": "^
|
|
35
|
+
"@types/react-dom": "^19.2.4",
|
|
36
36
|
"@vitejs/plugin-react": "^4.3.4",
|
|
37
37
|
"eslint": "^9.19.0",
|
|
38
38
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
39
39
|
"eslint-plugin-react-refresh": "^0.4.18",
|
|
40
40
|
"glob": "^11.0.1",
|
|
41
41
|
"globals": "^15.14.0",
|
|
42
|
-
"react": "^
|
|
43
|
-
"react-dom": "^
|
|
42
|
+
"react": "^19.2.8",
|
|
43
|
+
"react-dom": "^19.2.8",
|
|
44
44
|
"typescript": "~5.7.2",
|
|
45
45
|
"typescript-eslint": "^8.22.0",
|
|
46
46
|
"vite": "^6.1.0",
|
|
47
47
|
"vite-plugin-dts": "^4.5.0",
|
|
48
48
|
"vite-plugin-lib-inject-css": "^2.2.1"
|
|
49
|
+
},
|
|
50
|
+
"allowScripts": {
|
|
51
|
+
"esbuild@0.25.12": true
|
|
49
52
|
}
|
|
50
53
|
}
|