@ciscode/ui-authentication-kit 1.0.4 → 1.0.5
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/index.mjs +353 -325
- package/dist/index.umd.js +11 -11
- package/dist/pages/auth/SignUpPage.d.ts.map +1 -1
- package/dist/pages/auth/SignUpPage.js +18 -7
- package/dist/pages/auth/SignUpPage.js.map +1 -1
- package/dist/providers/AuthProvider.js +1 -1
- package/dist/providers/AuthProvider.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import * as U from "react";
|
|
2
|
-
import e, { createContext as
|
|
3
|
-
import
|
|
4
|
-
import { jwtDecode as
|
|
5
|
-
import
|
|
6
|
-
import { useT as
|
|
7
|
-
import { useNavigate as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
const t = e.useContext(
|
|
2
|
+
import e, { createContext as ve, useContext as Me, useEffect as V, forwardRef as ie, createElement as ae, useState as m, useMemo as X } from "react";
|
|
3
|
+
import le from "axios";
|
|
4
|
+
import { jwtDecode as ke } from "jwt-decode";
|
|
5
|
+
import Ie from "react-dom";
|
|
6
|
+
import { useT as q } from "@ciscode/ui-translate-core";
|
|
7
|
+
import { useNavigate as se, useLocation as oe, Routes as Le, Route as Y, Navigate as J } from "react-router";
|
|
8
|
+
const me = e.createContext(null);
|
|
9
|
+
function de() {
|
|
10
|
+
const t = e.useContext(me);
|
|
11
11
|
if (!t)
|
|
12
12
|
throw new Error("useAuthConfig must be used within an AuthConfigProvider");
|
|
13
13
|
return t;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const ue = ve(null);
|
|
16
16
|
function z() {
|
|
17
|
-
const t =
|
|
17
|
+
const t = Me(ue);
|
|
18
18
|
if (!t)
|
|
19
19
|
throw new Error("useAuthState must be inside <AuthProvider>");
|
|
20
20
|
return t;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const a =
|
|
22
|
+
function te(t) {
|
|
23
|
+
const a = ke(t);
|
|
24
24
|
return {
|
|
25
25
|
id: a.sub,
|
|
26
26
|
email: a.email ?? "",
|
|
@@ -30,54 +30,54 @@ function J(t) {
|
|
|
30
30
|
tenantId: a.tenantId ?? ""
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
let
|
|
34
|
-
function
|
|
35
|
-
|
|
33
|
+
let re = !1;
|
|
34
|
+
function Ce() {
|
|
35
|
+
re = !1;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function je(t, a) {
|
|
38
38
|
t.defaults.withCredentials = !0;
|
|
39
|
-
const
|
|
39
|
+
const r = `${a.baseUrl}${a.refreshEndpoint ?? "/auth/refresh-token"}`;
|
|
40
40
|
t.interceptors.request.use((n) => {
|
|
41
41
|
const o = a.getAccessToken();
|
|
42
42
|
return o && (n.headers.Authorization = `Bearer ${o}`), n;
|
|
43
43
|
});
|
|
44
|
-
let
|
|
44
|
+
let l = !1, s = [];
|
|
45
45
|
return t.interceptors.response.use(
|
|
46
46
|
(n) => n,
|
|
47
47
|
async (n) => {
|
|
48
|
-
var
|
|
48
|
+
var i;
|
|
49
49
|
const o = n.config;
|
|
50
|
-
if (((
|
|
50
|
+
if (((i = n.response) == null ? void 0 : i.status) !== 401 || !o || o._retry)
|
|
51
51
|
return Promise.reject(n);
|
|
52
|
-
if (o._retry = !0, !
|
|
53
|
-
|
|
52
|
+
if (o._retry = !0, !l) {
|
|
53
|
+
l = !0;
|
|
54
54
|
try {
|
|
55
|
-
const { data:
|
|
56
|
-
return a.setAccessToken(
|
|
57
|
-
} catch (
|
|
58
|
-
return !!a.getAccessToken() && !
|
|
55
|
+
const { data: c } = await le.post(r, {}, { withCredentials: !0 });
|
|
56
|
+
return a.setAccessToken(c.accessToken), s.forEach((d) => d(c.accessToken)), s = [], t.request(o);
|
|
57
|
+
} catch (c) {
|
|
58
|
+
return !!a.getAccessToken() && !re && (re = !0, a.logout()), s.forEach((p) => p(null)), s = [], Promise.reject(c);
|
|
59
59
|
} finally {
|
|
60
|
-
|
|
60
|
+
l = !1;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
return new Promise((
|
|
63
|
+
return new Promise((c, d) => {
|
|
64
64
|
s.push((p) => {
|
|
65
65
|
if (!p)
|
|
66
|
-
return
|
|
67
|
-
(o.headers ?? (o.headers = {})).Authorization = `Bearer ${p}`,
|
|
66
|
+
return d(n);
|
|
67
|
+
(o.headers ?? (o.headers = {})).Authorization = `Bearer ${p}`, c(t.request(o));
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
), t;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
const a =
|
|
75
|
-
return
|
|
76
|
-
const { body:
|
|
77
|
-
return
|
|
78
|
-
|
|
73
|
+
const Se = ({ onConfirm: t }) => {
|
|
74
|
+
const a = q("authLib");
|
|
75
|
+
return V(() => {
|
|
76
|
+
const { body: r } = document, l = r.style.overflow, s = r.style.pointerEvents;
|
|
77
|
+
return r.style.overflow = "hidden", r.style.pointerEvents = "none", () => {
|
|
78
|
+
r.style.overflow = l, r.style.pointerEvents = s;
|
|
79
79
|
};
|
|
80
|
-
}, []),
|
|
80
|
+
}, []), Ie.createPortal(
|
|
81
81
|
/* @__PURE__ */ e.createElement("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center bg-black/40 backdrop-blur-sm" }, /* @__PURE__ */ e.createElement("div", { className: "pointer-events-auto w-full max-w-sm rounded-xl bg-white p-6 shadow-xl" }, /* @__PURE__ */ e.createElement("h2", { className: "mb-4 text-xl font-semibold text-gray-800 ltr:text-left rtl:text-center" }, a("sessionExpired.title")), /* @__PURE__ */ e.createElement("p", { className: "mb-8 text-sm text-gray-600 ltr:text-left rtl:text-center" }, a("sessionExpired.message")), /* @__PURE__ */ e.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ e.createElement(
|
|
82
82
|
"button",
|
|
83
83
|
{
|
|
@@ -92,11 +92,11 @@ const Me = ({ onConfirm: t }) => {
|
|
|
92
92
|
)))),
|
|
93
93
|
document.body
|
|
94
94
|
);
|
|
95
|
-
},
|
|
95
|
+
}, P = ({
|
|
96
96
|
label: t,
|
|
97
97
|
type: a = "text",
|
|
98
|
-
placeholder:
|
|
99
|
-
color:
|
|
98
|
+
placeholder: r,
|
|
99
|
+
color: l = "",
|
|
100
100
|
value: s,
|
|
101
101
|
onChange: n
|
|
102
102
|
}) => {
|
|
@@ -113,17 +113,17 @@ const Me = ({ onConfirm: t }) => {
|
|
|
113
113
|
{
|
|
114
114
|
id: o,
|
|
115
115
|
type: a,
|
|
116
|
-
placeholder:
|
|
116
|
+
placeholder: r || void 0,
|
|
117
117
|
value: s,
|
|
118
|
-
onChange: (
|
|
118
|
+
onChange: (i) => n == null ? void 0 : n(i.target.value),
|
|
119
119
|
className: `
|
|
120
120
|
px-4 py-4 mt-3.5 text-sm font-light rounded-lg border border-solid w-full
|
|
121
121
|
ltr:text-left rtl:text-right
|
|
122
|
-
${
|
|
122
|
+
${l}
|
|
123
123
|
`
|
|
124
124
|
}
|
|
125
125
|
));
|
|
126
|
-
},
|
|
126
|
+
}, ge = ({ icon: t, label: a }) => /* @__PURE__ */ U.createElement("div", { className: "flex gap-5 px-8 py-3 items-center bg-indigo-50 rounded-lg max-md:px-5" }, /* @__PURE__ */ U.createElement(
|
|
127
127
|
"img",
|
|
128
128
|
{
|
|
129
129
|
loading: "lazy",
|
|
@@ -131,18 +131,18 @@ const Me = ({ onConfirm: t }) => {
|
|
|
131
131
|
alt: a || "",
|
|
132
132
|
className: "object-contain shrink-0 aspect-square w-[26px]"
|
|
133
133
|
}
|
|
134
|
-
), a && /* @__PURE__ */ U.createElement("div", { className: "basis-auto text-sm hidden md:block ltr:text-left rtl:text-right" }, a)),
|
|
135
|
-
function
|
|
136
|
-
return t ? t.startsWith(`${a}-`) ? t : t.startsWith("#") ? `${t}` :
|
|
134
|
+
), a && /* @__PURE__ */ U.createElement("div", { className: "basis-auto text-sm hidden md:block ltr:text-left rtl:text-right" }, a)), fe = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iLTMgMCAyNjIgMjYyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48cGF0aCBkPSJNMjU1Ljg3OCAxMzMuNDUxYzAtMTAuNzM0LS44NzEtMTguNTY3LTIuNzU2LTI2LjY5SDEzMC41NXY0OC40NDhoNzEuOTQ3Yy0xLjQ1IDEyLjA0LTkuMjgzIDMwLjE3Mi0yNi42OSA0Mi4zNTZsLS4yNDQgMS42MjIgMzguNzU1IDMwLjAyMyAyLjY4NS4yNjhjMjQuNjU5LTIyLjc3NCAzOC44NzUtNTYuMjgyIDM4Ljg3NS05Ni4wMjciIGZpbGw9IiM0Mjg1RjQiLz48cGF0aCBkPSJNMTMwLjU1IDI2MS4xYzM1LjI0OCAwIDY0LjgzOS0xMS42MDUgODYuNDUzLTMxLjYyMmwtNDEuMTk2LTMxLjkxM2MtMTEuMDI0IDcuNjg4LTI1LjgyIDEzLjA1NS00NS4yNTcgMTMuMDU1LTM0LjUyMyAwLTYzLjgyNC0yMi43NzMtNzQuMjY5LTU0LjI1bC0xLjUzMS4xMy00MC4yOTggMzEuMTg3LS41MjcgMS40NjVDMzUuMzkzIDIzMS43OTggNzkuNDkgMjYxLjEgMTMwLjU1IDI2MS4xIiBmaWxsPSIjMzRBODUzIi8+PHBhdGggZD0iTTU2LjI4MSAxNTYuMzdjLTIuNzU2LTguMTIzLTQuMzUxLTE2LjgyNy00LjM1MS0yNS44MiAwLTguOTk0IDEuNTk1LTE3LjY5NyA0LjIwNi0yNS44MmwtLjA3My0xLjczTDE1LjI2IDcxLjMxMmwtMS4zMzUuNjM1QzUuMDc3IDg5LjY0NCAwIDEwOS41MTcgMCAxMzAuNTVzNS4wNzcgNDAuOTA1IDEzLjkyNSA1OC42MDJsNDIuMzU2LTMyLjc4MiIgZmlsbD0iI0ZCQkMwNSIvPjxwYXRoIGQ9Ik0xMzAuNTUgNTAuNDc5YzI0LjUxNCAwIDQxLjA1IDEwLjU4OSA1MC40NzkgMTkuNDM4bDM2Ljg0NC0zNS45NzRDMTk1LjI0NSAxMi45MSAxNjUuNzk4IDAgMTMwLjU1IDAgNzkuNDkgMCAzNS4zOTMgMjkuMzAxIDEzLjkyNSA3MS45NDdsNDIuMjExIDMyLjc4M2MxMC41OS0zMS40NzcgMzkuODkxLTU0LjI1MSA3NC40MTQtNTQuMjUxIiBmaWxsPSIjRUI0MzM1Ii8+PC9zdmc+", he = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE2IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPjxwYXRoIGZpbGw9IiNGMzUzMjUiIGQ9Ik0xIDFoNi41djYuNUgxVjF6Ii8+PHBhdGggZmlsbD0iIzgxQkMwNiIgZD0iTTguNSAxSDE1djYuNUg4LjVWMXoiLz48cGF0aCBmaWxsPSIjMDVBNkYwIiBkPSJNMSA4LjVoNi41VjE1SDFWOC41eiIvPjxwYXRoIGZpbGw9IiNGRkJBMDgiIGQ9Ik04LjUgOC41SDE1VjE1SDguNVY4LjV6Ii8+PC9zdmc+";
|
|
135
|
+
function O(t, a, r) {
|
|
136
|
+
return t ? t.startsWith(`${a}-`) ? t : t.startsWith("#") ? `${t}` : r : r;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const
|
|
138
|
+
function xe(t, a) {
|
|
139
|
+
const r = (a == null ? void 0 : a.bg) || "bg-sky-500", l = (a == null ? void 0 : a.text) || "text-gray-800", s = (a == null ? void 0 : a.border) || "border-gray-300", n = (a == null ? void 0 : a.fill) || "fill-current", o = (a == null ? void 0 : a.stroke) || "stroke-current";
|
|
140
140
|
return {
|
|
141
|
-
bgClass:
|
|
142
|
-
textClass:
|
|
143
|
-
borderClass:
|
|
144
|
-
fillClass:
|
|
145
|
-
strokeClass:
|
|
141
|
+
bgClass: O(t.bg ?? "", "bg", r),
|
|
142
|
+
textClass: O(t.text ?? "", "text", l),
|
|
143
|
+
borderClass: O(t.border ?? "", "border", s),
|
|
144
|
+
fillClass: O(t.fill ?? "", "fill", n),
|
|
145
|
+
strokeClass: O(t.stroke ?? "", "stroke", o)
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
@@ -151,14 +151,14 @@ function de(t, a) {
|
|
|
151
151
|
* This source code is licensed under the ISC license.
|
|
152
152
|
* See the LICENSE file in the root directory of this source tree.
|
|
153
153
|
*/
|
|
154
|
-
const
|
|
154
|
+
const Te = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), pe = (...t) => t.filter((a, r, l) => !!a && a.trim() !== "" && l.indexOf(a) === r).join(" ").trim();
|
|
155
155
|
/**
|
|
156
156
|
* @license lucide-react v0.481.0 - ISC
|
|
157
157
|
*
|
|
158
158
|
* This source code is licensed under the ISC license.
|
|
159
159
|
* See the LICENSE file in the root directory of this source tree.
|
|
160
160
|
*/
|
|
161
|
-
var
|
|
161
|
+
var Pe = {
|
|
162
162
|
xmlns: "http://www.w3.org/2000/svg",
|
|
163
163
|
width: 24,
|
|
164
164
|
height: 24,
|
|
@@ -175,30 +175,30 @@ var ke = {
|
|
|
175
175
|
* This source code is licensed under the ISC license.
|
|
176
176
|
* See the LICENSE file in the root directory of this source tree.
|
|
177
177
|
*/
|
|
178
|
-
const
|
|
178
|
+
const Ue = ie(
|
|
179
179
|
({
|
|
180
180
|
color: t = "currentColor",
|
|
181
181
|
size: a = 24,
|
|
182
|
-
strokeWidth:
|
|
183
|
-
absoluteStrokeWidth:
|
|
182
|
+
strokeWidth: r = 2,
|
|
183
|
+
absoluteStrokeWidth: l,
|
|
184
184
|
className: s = "",
|
|
185
185
|
children: n,
|
|
186
186
|
iconNode: o,
|
|
187
|
-
...
|
|
188
|
-
},
|
|
187
|
+
...i
|
|
188
|
+
}, c) => ae(
|
|
189
189
|
"svg",
|
|
190
190
|
{
|
|
191
|
-
ref:
|
|
192
|
-
...
|
|
191
|
+
ref: c,
|
|
192
|
+
...Pe,
|
|
193
193
|
width: a,
|
|
194
194
|
height: a,
|
|
195
195
|
stroke: t,
|
|
196
|
-
strokeWidth:
|
|
197
|
-
className:
|
|
198
|
-
...
|
|
196
|
+
strokeWidth: l ? Number(r) * 24 / Number(a) : r,
|
|
197
|
+
className: pe("lucide", s),
|
|
198
|
+
...i
|
|
199
199
|
},
|
|
200
200
|
[
|
|
201
|
-
...o.map(([
|
|
201
|
+
...o.map(([d, p]) => ae(d, p)),
|
|
202
202
|
...Array.isArray(n) ? n : [n]
|
|
203
203
|
]
|
|
204
204
|
)
|
|
@@ -209,16 +209,16 @@ const Le = le(
|
|
|
209
209
|
* This source code is licensed under the ISC license.
|
|
210
210
|
* See the LICENSE file in the root directory of this source tree.
|
|
211
211
|
*/
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
({ className:
|
|
212
|
+
const be = (t, a) => {
|
|
213
|
+
const r = ie(
|
|
214
|
+
({ className: l, ...s }, n) => ae(Ue, {
|
|
215
215
|
ref: n,
|
|
216
216
|
iconNode: a,
|
|
217
|
-
className:
|
|
217
|
+
className: pe(`lucide-${Te(t)}`, l),
|
|
218
218
|
...s
|
|
219
219
|
})
|
|
220
220
|
);
|
|
221
|
-
return
|
|
221
|
+
return r.displayName = `${t}`, r;
|
|
222
222
|
};
|
|
223
223
|
/**
|
|
224
224
|
* @license lucide-react v0.481.0 - ISC
|
|
@@ -226,7 +226,7 @@ const ge = (t, a) => {
|
|
|
226
226
|
* This source code is licensed under the ISC license.
|
|
227
227
|
* See the LICENSE file in the root directory of this source tree.
|
|
228
228
|
*/
|
|
229
|
-
const
|
|
229
|
+
const ze = [
|
|
230
230
|
[
|
|
231
231
|
"path",
|
|
232
232
|
{
|
|
@@ -236,27 +236,27 @@ const Ce = [
|
|
|
236
236
|
],
|
|
237
237
|
["path", { d: "M12 9v4", key: "juzpu7" }],
|
|
238
238
|
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
239
|
-
],
|
|
239
|
+
], De = be("TriangleAlert", ze);
|
|
240
240
|
/**
|
|
241
241
|
* @license lucide-react v0.481.0 - ISC
|
|
242
242
|
*
|
|
243
243
|
* This source code is licensed under the ISC license.
|
|
244
244
|
* See the LICENSE file in the root directory of this source tree.
|
|
245
245
|
*/
|
|
246
|
-
const
|
|
246
|
+
const Ae = [
|
|
247
247
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
248
248
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
249
|
-
],
|
|
249
|
+
], Be = be("X", Ae), we = ({
|
|
250
250
|
message: t,
|
|
251
251
|
dismissAfterMs: a = 4e3
|
|
252
252
|
}) => {
|
|
253
|
-
const
|
|
254
|
-
return
|
|
253
|
+
const r = q("authLib"), [l, s] = m(!1);
|
|
254
|
+
return V(() => {
|
|
255
255
|
if (s(!!t), t && a > 0) {
|
|
256
256
|
const n = window.setTimeout(() => s(!1), a);
|
|
257
257
|
return () => window.clearTimeout(n);
|
|
258
258
|
}
|
|
259
|
-
}, [t, a]), !
|
|
259
|
+
}, [t, a]), !l || !t ? null : /* @__PURE__ */ e.createElement(
|
|
260
260
|
"div",
|
|
261
261
|
{
|
|
262
262
|
role: "alert",
|
|
@@ -266,81 +266,81 @@ const Se = [
|
|
|
266
266
|
rounded-lg border border-red-300 bg-red-50/80 p-4 pr-6 text-sm text-red-800
|
|
267
267
|
shadow-lg backdrop-blur
|
|
268
268
|
transition-all duration-300 ease-out
|
|
269
|
-
${
|
|
269
|
+
${l ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0"}
|
|
270
270
|
`
|
|
271
271
|
},
|
|
272
272
|
/* @__PURE__ */ e.createElement("span", { className: "absolute ltr:left-0 rtl:right-0 top-0 h-full w-1 bg-gradient-to-b from-red-500 to-red-400" }),
|
|
273
|
-
/* @__PURE__ */ e.createElement(
|
|
273
|
+
/* @__PURE__ */ e.createElement(De, { className: "mt-0.5 h-5 w-5 flex-none" }),
|
|
274
274
|
/* @__PURE__ */ e.createElement("span", { className: "grow leading-5 ltr:text-left rtl:text-right" }, t),
|
|
275
275
|
/* @__PURE__ */ e.createElement(
|
|
276
276
|
"button",
|
|
277
277
|
{
|
|
278
278
|
onClick: () => s(!1),
|
|
279
|
-
"aria-label":
|
|
279
|
+
"aria-label": r("inlineError.dismiss"),
|
|
280
280
|
className: `
|
|
281
281
|
absolute ltr:right-2 rtl:left-2 top-2 rounded p-1 text-red-600/70
|
|
282
282
|
hover:bg-red-100 hover:text-red-700 focus:outline-none
|
|
283
283
|
focus-visible:ring focus-visible:ring-red-500/50
|
|
284
284
|
`
|
|
285
285
|
},
|
|
286
|
-
/* @__PURE__ */ e.createElement(
|
|
286
|
+
/* @__PURE__ */ e.createElement(Be, { className: "h-4 w-4" })
|
|
287
287
|
)
|
|
288
288
|
);
|
|
289
|
-
},
|
|
290
|
-
const t =
|
|
291
|
-
brandName:
|
|
289
|
+
}, $e = () => {
|
|
290
|
+
const t = q("authLib"), a = se(), r = oe(), {
|
|
291
|
+
brandName: l = t("brandName", { defaultValue: "MyBrand" }),
|
|
292
292
|
colors: s = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
|
|
293
293
|
logoUrl: n,
|
|
294
294
|
oauthProviders: o = [],
|
|
295
|
-
illustrationUrl:
|
|
295
|
+
illustrationUrl: i = t("community.illustrationUrl", {
|
|
296
296
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets/TEMP/35ba84b8335fda2819c3a14ea3d00321a0fd0e79e571caa31108468010868ca5?placeholderIfAbsent=true&apiKey=a460e9a46e514356ac1106eada03046c"
|
|
297
297
|
}),
|
|
298
|
-
communityContent:
|
|
298
|
+
communityContent: c = {
|
|
299
299
|
title: t("community.title"),
|
|
300
300
|
description: t("community.description")
|
|
301
301
|
},
|
|
302
|
-
baseUrl:
|
|
302
|
+
baseUrl: d
|
|
303
303
|
// IMPORTANT: used for Google OAuth redirect
|
|
304
|
-
} =
|
|
305
|
-
google: { icon:
|
|
306
|
-
microsoft: { icon:
|
|
307
|
-
},
|
|
308
|
-
id:
|
|
309
|
-
icon:
|
|
310
|
-
label:
|
|
311
|
-
})), { bgClass:
|
|
312
|
-
async function
|
|
313
|
-
var
|
|
314
|
-
if (
|
|
315
|
-
|
|
304
|
+
} = de(), { login: p } = z(), [w, E] = m(""), [C, v] = m(""), [f, h] = m(!1), [M, g] = m(null), k = {
|
|
305
|
+
google: { icon: fe, label: t("social.google") },
|
|
306
|
+
microsoft: { icon: he, label: t("social.microsoft") }
|
|
307
|
+
}, b = o.filter((u) => u in k).map((u) => ({
|
|
308
|
+
id: u,
|
|
309
|
+
icon: k[u].icon,
|
|
310
|
+
label: k[u].label
|
|
311
|
+
})), { bgClass: j, textClass: N, borderClass: D } = xe(s), H = `${j} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
|
|
312
|
+
async function A(u) {
|
|
313
|
+
var S;
|
|
314
|
+
if (u.preventDefault(), !f) {
|
|
315
|
+
g(null), h(!0);
|
|
316
316
|
try {
|
|
317
|
-
await p({ email:
|
|
318
|
-
} catch (
|
|
319
|
-
((
|
|
317
|
+
await p({ email: w, password: C });
|
|
318
|
+
} catch (y) {
|
|
319
|
+
((S = y == null ? void 0 : y.response) == null ? void 0 : S.status) === 401 ? g(t("errors.invalidCredentials")) : g(t("errors.generic"));
|
|
320
320
|
} finally {
|
|
321
|
-
|
|
321
|
+
h(!1);
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
var
|
|
327
|
-
if (!
|
|
325
|
+
function _(u) {
|
|
326
|
+
var y, B, I;
|
|
327
|
+
if (!d) {
|
|
328
328
|
console.error("Auth baseUrl is not configured.");
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
|
-
const
|
|
332
|
-
if (sessionStorage.setItem("postLoginRedirect",
|
|
333
|
-
const
|
|
334
|
-
|
|
331
|
+
const S = ((B = (y = r.state) == null ? void 0 : y.from) == null ? void 0 : B.pathname) || ((I = r.state) == null ? void 0 : I.from) || "/";
|
|
332
|
+
if (sessionStorage.setItem("postLoginRedirect", S), u === "google") {
|
|
333
|
+
const R = "/oauth/google/callback", F = `${window.location.origin}${R}`, T = new URL(`${d}/auth/google`);
|
|
334
|
+
T.searchParams.set("redirect", F), window.location.href = T.toString();
|
|
335
335
|
return;
|
|
336
336
|
}
|
|
337
|
-
if (
|
|
338
|
-
const
|
|
339
|
-
|
|
337
|
+
if (u === "microsoft") {
|
|
338
|
+
const R = "/oauth/microsoft/callback", F = `${window.location.origin}${R}`, T = new URL(`${d}/auth/microsoft`);
|
|
339
|
+
T.searchParams.set("redirect", F), window.location.href = T.toString();
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
const
|
|
343
|
+
const K = /* @__PURE__ */ e.createElement(
|
|
344
344
|
"svg",
|
|
345
345
|
{
|
|
346
346
|
className: "h-4 w-4 animate-spin stroke-current",
|
|
@@ -358,7 +358,7 @@ const Se = [
|
|
|
358
358
|
}
|
|
359
359
|
)
|
|
360
360
|
);
|
|
361
|
-
return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${
|
|
361
|
+
return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${H}` }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ e.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${j}` }, /* @__PURE__ */ e.createElement("div", null, n ? /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement(
|
|
362
362
|
"img",
|
|
363
363
|
{
|
|
364
364
|
loading: "lazy",
|
|
@@ -366,11 +366,11 @@ const Se = [
|
|
|
366
366
|
alt: "Brand Logo",
|
|
367
367
|
className: "bg-white h-8 md:h-22 rounded-lg"
|
|
368
368
|
}
|
|
369
|
-
), /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" },
|
|
369
|
+
), /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, l)) : /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, c.title), /* @__PURE__ */ e.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, c.description), /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement(
|
|
370
370
|
"img",
|
|
371
371
|
{
|
|
372
372
|
loading: "lazy",
|
|
373
|
-
src:
|
|
373
|
+
src: i,
|
|
374
374
|
alt: "Sign in illustration",
|
|
375
375
|
className: "max-w-sm w-full mx-auto rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-300 p-6"
|
|
376
376
|
}
|
|
@@ -382,90 +382,91 @@ const Se = [
|
|
|
382
382
|
alt: "Brand Logo",
|
|
383
383
|
className: `h-22 rounded-full border ${D}`
|
|
384
384
|
}
|
|
385
|
-
) : /* @__PURE__ */ e.createElement("h2", { className: "text-2xl font-bold" },
|
|
385
|
+
) : /* @__PURE__ */ e.createElement("h2", { className: "text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "w-full md:w-auto mb-4 md:mb-0 text-center md:text-left ltr:text-center rtl:text-center md:ltr:text-left md:rtl:text-right" }, /* @__PURE__ */ e.createElement("p", { className: "text-sm md:text-lg" }, t("SignInPage.welcome"), " ", /* @__PURE__ */ e.createElement("span", { className: `font-semibold ${N} uppercase` }, l)), /* @__PURE__ */ e.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, t("SignInPage.signIn"))), /* @__PURE__ */ e.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, t("SignInPage.noAccount"), /* @__PURE__ */ e.createElement("br", null), /* @__PURE__ */ e.createElement(
|
|
386
386
|
"button",
|
|
387
387
|
{
|
|
388
388
|
type: "button",
|
|
389
389
|
onClick: () => a("/signup"),
|
|
390
|
-
className:
|
|
390
|
+
className: N
|
|
391
391
|
},
|
|
392
392
|
t("SignInPage.signUp")
|
|
393
|
-
))),
|
|
394
|
-
|
|
393
|
+
))), M && /* @__PURE__ */ e.createElement(we, { message: M }), /* @__PURE__ */ e.createElement("form", { className: "space-y-6", onSubmit: A }, /* @__PURE__ */ e.createElement(
|
|
394
|
+
P,
|
|
395
395
|
{
|
|
396
396
|
label: t("form.emailLabel"),
|
|
397
397
|
type: "email",
|
|
398
398
|
placeholder: t("form.emailPlaceholder"),
|
|
399
399
|
color: D,
|
|
400
|
-
value:
|
|
400
|
+
value: w,
|
|
401
401
|
onChange: E
|
|
402
402
|
}
|
|
403
403
|
), /* @__PURE__ */ e.createElement(
|
|
404
|
-
|
|
404
|
+
P,
|
|
405
405
|
{
|
|
406
406
|
label: t("form.passwordLabel"),
|
|
407
407
|
type: "password",
|
|
408
408
|
placeholder: t("form.passwordPlaceholder"),
|
|
409
409
|
color: D,
|
|
410
410
|
value: C,
|
|
411
|
-
onChange:
|
|
411
|
+
onChange: v
|
|
412
412
|
}
|
|
413
|
-
), /* @__PURE__ */ e.createElement("div", { className: "ltr:text-right rtl:text-left" }, /* @__PURE__ */ e.createElement("button", { className: `text-sm ${
|
|
413
|
+
), /* @__PURE__ */ e.createElement("div", { className: "ltr:text-right rtl:text-left" }, /* @__PURE__ */ e.createElement("button", { className: `text-sm ${N}` }, t("SignInPage.forgotPassword"))), /* @__PURE__ */ e.createElement(
|
|
414
414
|
"button",
|
|
415
415
|
{
|
|
416
416
|
type: "submit",
|
|
417
|
-
disabled:
|
|
418
|
-
className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${
|
|
417
|
+
disabled: f,
|
|
418
|
+
className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${f ? "opacity-60 cursor-not-allowed" : ""} ${j} text-white`
|
|
419
419
|
},
|
|
420
|
-
|
|
421
|
-
t(
|
|
422
|
-
),
|
|
420
|
+
f && K,
|
|
421
|
+
t(f ? "SignInPage.signInSubmitting" : "SignInPage.signIn")
|
|
422
|
+
), b.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${j}` }), /* @__PURE__ */ e.createElement("span", { className: `${N} mx-3 text-sm` }, t("SignInPage.orLoginWith")), /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${j}` })), /* @__PURE__ */ e.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, b.map((u) => /* @__PURE__ */ e.createElement(
|
|
423
423
|
"button",
|
|
424
424
|
{
|
|
425
|
-
key:
|
|
425
|
+
key: u.id,
|
|
426
426
|
type: "button",
|
|
427
|
-
onClick: () =>
|
|
427
|
+
onClick: () => _(u.id),
|
|
428
428
|
className: "flex-1"
|
|
429
429
|
},
|
|
430
|
-
/* @__PURE__ */ e.createElement(
|
|
430
|
+
/* @__PURE__ */ e.createElement(ge, { icon: u.icon, label: u.label })
|
|
431
431
|
))))))));
|
|
432
|
-
},
|
|
433
|
-
const t =
|
|
434
|
-
brandName:
|
|
432
|
+
}, Ve = () => {
|
|
433
|
+
const t = q("authLib"), a = se(), r = oe(), {
|
|
434
|
+
brandName: l = t("brandName", { defaultValue: "MyBrand" }),
|
|
435
435
|
colors: s = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
|
|
436
436
|
logoUrl: n,
|
|
437
437
|
oauthProviders: o = [],
|
|
438
|
-
illustrationUrl:
|
|
438
|
+
illustrationUrl: i = t("community.illustrationUrl", {
|
|
439
439
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets/TEMP/35ba84b8335fda2819c3a14ea3d00321a0fd0e79e571caa31108468010868ca5?placeholderIfAbsent=true&apiKey=a460e9a46e514356ac1106eada03046c"
|
|
440
440
|
}),
|
|
441
|
-
communityContent:
|
|
441
|
+
communityContent: c = {
|
|
442
442
|
title: t("community.title"),
|
|
443
443
|
description: t("community.description")
|
|
444
444
|
},
|
|
445
|
-
baseUrl:
|
|
445
|
+
baseUrl: d
|
|
446
446
|
// IMPORTANT: used for OAuth redirect (same as SignIn)
|
|
447
|
-
} =
|
|
448
|
-
google: { icon:
|
|
449
|
-
microsoft: { icon:
|
|
450
|
-
},
|
|
451
|
-
id:
|
|
452
|
-
icon:
|
|
453
|
-
label:
|
|
454
|
-
})), { bgClass:
|
|
455
|
-
async function x
|
|
456
|
-
var
|
|
457
|
-
if (
|
|
458
|
-
|
|
447
|
+
} = de(), { login: p, api: w } = z(), [E, C] = m(""), [v, f] = m(""), [h, M] = m(""), [g, k] = m(""), [b, j] = m(""), [N, D] = m(!1), [H, A] = m(null), [_, K] = m(!1), u = {
|
|
448
|
+
google: { icon: fe, label: t("social.google") },
|
|
449
|
+
microsoft: { icon: he, label: t("social.microsoft") }
|
|
450
|
+
}, S = o.filter((x) => x in u).map((x) => ({
|
|
451
|
+
id: x,
|
|
452
|
+
icon: u[x].icon,
|
|
453
|
+
label: u[x].label
|
|
454
|
+
})), { bgClass: y, textClass: B, borderClass: I } = xe(s), R = `${y} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
|
|
455
|
+
async function F(x) {
|
|
456
|
+
var Q, W, Z;
|
|
457
|
+
if (x.preventDefault(), !N) {
|
|
458
|
+
A(null), D(!0);
|
|
459
459
|
try {
|
|
460
|
-
await
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
460
|
+
await w.post("/api/auth/register", {
|
|
461
|
+
fullname: { fname: E, lname: v },
|
|
462
|
+
username: h,
|
|
463
|
+
email: g,
|
|
464
|
+
password: b
|
|
465
|
+
}), await p({ email: g, password: b });
|
|
466
|
+
} catch (L) {
|
|
467
|
+
const $ = (Q = L == null ? void 0 : L.response) == null ? void 0 : Q.status;
|
|
468
|
+
A(
|
|
469
|
+
$ === 400 ? ((Z = (W = L == null ? void 0 : L.response) == null ? void 0 : W.data) == null ? void 0 : Z.message) || t("errors.invalidData", {
|
|
469
470
|
defaultValue: "Please check the fields and try again."
|
|
470
471
|
}) : $ === 409 ? t("errors.emailInUse", {
|
|
471
472
|
defaultValue: "This email is already in use."
|
|
@@ -474,29 +475,29 @@ const Se = [
|
|
|
474
475
|
})
|
|
475
476
|
);
|
|
476
477
|
} finally {
|
|
477
|
-
|
|
478
|
+
D(!1);
|
|
478
479
|
}
|
|
479
480
|
}
|
|
480
481
|
}
|
|
481
|
-
function
|
|
482
|
-
var
|
|
483
|
-
if (!
|
|
482
|
+
function T(x) {
|
|
483
|
+
var W, Z, L;
|
|
484
|
+
if (!d) {
|
|
484
485
|
console.error("Auth baseUrl is not configured.");
|
|
485
486
|
return;
|
|
486
487
|
}
|
|
487
|
-
const
|
|
488
|
-
if (sessionStorage.setItem("postLoginRedirect",
|
|
489
|
-
const $ = "/oauth/google/callback",
|
|
490
|
-
|
|
488
|
+
const Q = ((Z = (W = r.state) == null ? void 0 : W.from) == null ? void 0 : Z.pathname) || ((L = r.state) == null ? void 0 : L.from) || "/";
|
|
489
|
+
if (sessionStorage.setItem("postLoginRedirect", Q), x === "google") {
|
|
490
|
+
const $ = "/oauth/google/callback", ee = `${window.location.origin}${$}`, G = new URL(`${d}/auth/google`);
|
|
491
|
+
G.searchParams.set("redirect", ee), window.location.href = G.toString();
|
|
491
492
|
return;
|
|
492
493
|
}
|
|
493
|
-
if (
|
|
494
|
-
const $ = "/oauth/microsoft/callback",
|
|
495
|
-
|
|
494
|
+
if (x === "microsoft") {
|
|
495
|
+
const $ = "/oauth/microsoft/callback", ee = `${window.location.origin}${$}`, G = new URL(`${d}/auth/microsoft`);
|
|
496
|
+
G.searchParams.set("redirect", ee), window.location.href = G.toString();
|
|
496
497
|
return;
|
|
497
498
|
}
|
|
498
499
|
}
|
|
499
|
-
const
|
|
500
|
+
const Ne = /* @__PURE__ */ e.createElement(
|
|
500
501
|
"svg",
|
|
501
502
|
{
|
|
502
503
|
className: "h-4 w-4 animate-spin stroke-current",
|
|
@@ -514,7 +515,7 @@ const Se = [
|
|
|
514
515
|
}
|
|
515
516
|
)
|
|
516
517
|
);
|
|
517
|
-
return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${
|
|
518
|
+
return /* @__PURE__ */ e.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${R}` }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ e.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${y}` }, /* @__PURE__ */ e.createElement("div", null, n ? /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement(
|
|
518
519
|
"img",
|
|
519
520
|
{
|
|
520
521
|
loading: "lazy",
|
|
@@ -522,11 +523,11 @@ const Se = [
|
|
|
522
523
|
alt: "Brand Logo",
|
|
523
524
|
className: "bg-white h-8 md:h-22 rounded-lg"
|
|
524
525
|
}
|
|
525
|
-
), /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" },
|
|
526
|
+
), /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, l)) : /* @__PURE__ */ e.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, c.title), /* @__PURE__ */ e.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, c.description), /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ e.createElement(
|
|
526
527
|
"img",
|
|
527
528
|
{
|
|
528
529
|
loading: "lazy",
|
|
529
|
-
src:
|
|
530
|
+
src: i,
|
|
530
531
|
alt: "Sign up illustration",
|
|
531
532
|
className: "max-w-sm w-full mx-auto rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-300 p-6"
|
|
532
533
|
}
|
|
@@ -536,242 +537,269 @@ const Se = [
|
|
|
536
537
|
loading: "lazy",
|
|
537
538
|
src: n,
|
|
538
539
|
alt: "Brand Logo",
|
|
539
|
-
className: `h-22 rounded-full border ${
|
|
540
|
+
className: `h-22 rounded-full border ${I}`
|
|
540
541
|
}
|
|
541
|
-
) : /* @__PURE__ */ e.createElement("h2", { className: "text-2xl font-bold" },
|
|
542
|
+
) : /* @__PURE__ */ e.createElement("h2", { className: "text-2xl font-bold" }, l)), /* @__PURE__ */ e.createElement("div", { className: "w-full md:w-auto mb-4 md:mb-0 text-center md:text-left ltr:text-center rtl:text-center md:ltr:text-left md:rtl:text-right" }, /* @__PURE__ */ e.createElement("p", { className: "text-sm md:text-lg" }, t("SignUpPage.welcome", { defaultValue: "Join" }), " ", /* @__PURE__ */ e.createElement("span", { className: `font-semibold ${B} uppercase` }, l)), /* @__PURE__ */ e.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, t("SignUpPage.signUp", { defaultValue: "Sign up" }))), /* @__PURE__ */ e.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, t("SignUpPage.alreadyHaveAccount", {
|
|
542
543
|
defaultValue: "Already have an account?"
|
|
543
544
|
}), /* @__PURE__ */ e.createElement("br", null), /* @__PURE__ */ e.createElement(
|
|
544
545
|
"button",
|
|
545
546
|
{
|
|
546
547
|
type: "button",
|
|
547
548
|
onClick: () => a("/login"),
|
|
548
|
-
className:
|
|
549
|
+
className: B
|
|
549
550
|
},
|
|
550
551
|
t("SignUpPage.signIn", { defaultValue: "Sign in" })
|
|
551
|
-
))),
|
|
552
|
-
|
|
552
|
+
))), H && /* @__PURE__ */ e.createElement(we, { message: H }), /* @__PURE__ */ e.createElement("form", { className: "space-y-6", onSubmit: F }, /* @__PURE__ */ e.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ e.createElement(
|
|
553
|
+
P,
|
|
553
554
|
{
|
|
554
|
-
label: t("form.
|
|
555
|
+
label: t("form.fnameLabel", { defaultValue: "First Name" }),
|
|
555
556
|
type: "text",
|
|
556
|
-
placeholder: t("form.
|
|
557
|
-
|
|
558
|
-
}),
|
|
559
|
-
color: A,
|
|
557
|
+
placeholder: t("form.fnamePlaceholder", { defaultValue: "Enter your first name" }),
|
|
558
|
+
color: I,
|
|
560
559
|
value: E,
|
|
561
560
|
onChange: C
|
|
562
561
|
}
|
|
563
562
|
), /* @__PURE__ */ e.createElement(
|
|
564
|
-
|
|
563
|
+
P,
|
|
564
|
+
{
|
|
565
|
+
label: t("form.lnameLabel", { defaultValue: "Last Name" }),
|
|
566
|
+
type: "text",
|
|
567
|
+
placeholder: t("form.lnamePlaceholder", { defaultValue: "Enter your last name" }),
|
|
568
|
+
color: I,
|
|
569
|
+
value: v,
|
|
570
|
+
onChange: f
|
|
571
|
+
}
|
|
572
|
+
)), /* @__PURE__ */ e.createElement(
|
|
573
|
+
P,
|
|
574
|
+
{
|
|
575
|
+
label: t("form.usernameLabel", { defaultValue: "Username" }),
|
|
576
|
+
type: "text",
|
|
577
|
+
placeholder: t("form.usernamePlaceholder", { defaultValue: "Choose a username" }),
|
|
578
|
+
color: I,
|
|
579
|
+
value: h,
|
|
580
|
+
onChange: M
|
|
581
|
+
}
|
|
582
|
+
), /* @__PURE__ */ e.createElement(
|
|
583
|
+
P,
|
|
565
584
|
{
|
|
566
585
|
label: t("form.emailLabel"),
|
|
567
586
|
type: "email",
|
|
568
587
|
placeholder: t("form.emailPlaceholder"),
|
|
569
|
-
color:
|
|
570
|
-
value:
|
|
571
|
-
onChange:
|
|
588
|
+
color: I,
|
|
589
|
+
value: g,
|
|
590
|
+
onChange: k
|
|
572
591
|
}
|
|
573
592
|
), /* @__PURE__ */ e.createElement(
|
|
574
|
-
|
|
593
|
+
P,
|
|
575
594
|
{
|
|
576
595
|
label: t("form.passwordLabel"),
|
|
577
596
|
type: "password",
|
|
578
597
|
placeholder: t("form.passwordPlaceholder"),
|
|
579
|
-
color:
|
|
580
|
-
value:
|
|
581
|
-
onChange:
|
|
598
|
+
color: I,
|
|
599
|
+
value: b,
|
|
600
|
+
onChange: j
|
|
582
601
|
}
|
|
583
|
-
), /* @__PURE__ */ e.createElement(
|
|
602
|
+
), /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ e.createElement(
|
|
603
|
+
"input",
|
|
604
|
+
{
|
|
605
|
+
id: "agree",
|
|
606
|
+
type: "checkbox",
|
|
607
|
+
checked: _,
|
|
608
|
+
onChange: (x) => K(x.target.checked),
|
|
609
|
+
className: "form-checkbox"
|
|
610
|
+
}
|
|
611
|
+
), /* @__PURE__ */ e.createElement("label", { htmlFor: "agree", className: "text-sm" }, "I agree to the ", /* @__PURE__ */ e.createElement("span", { className: "underline cursor-pointer" }, "terms and conditions"), " (placeholder)")), /* @__PURE__ */ e.createElement(
|
|
584
612
|
"button",
|
|
585
613
|
{
|
|
586
614
|
type: "submit",
|
|
587
|
-
disabled:
|
|
588
|
-
className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${
|
|
615
|
+
disabled: N,
|
|
616
|
+
className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${N ? "opacity-60 cursor-not-allowed" : ""} ${y} text-white`
|
|
589
617
|
},
|
|
590
|
-
|
|
591
|
-
|
|
618
|
+
N && Ne,
|
|
619
|
+
N ? t("SignUpPage.signUpSubmitting", {
|
|
592
620
|
defaultValue: "Creating account..."
|
|
593
621
|
}) : t("SignUpPage.signUp", { defaultValue: "Sign up" })
|
|
594
|
-
),
|
|
622
|
+
), S.length > 0 && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${y}` }), /* @__PURE__ */ e.createElement("span", { className: `${B} mx-3 text-sm` }, t("SignUpPage.orContinueWith", {
|
|
595
623
|
defaultValue: "Or continue with"
|
|
596
|
-
})), /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${
|
|
624
|
+
})), /* @__PURE__ */ e.createElement("div", { className: `flex-grow h-px ${y}` })), /* @__PURE__ */ e.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, S.map((x) => /* @__PURE__ */ e.createElement(
|
|
597
625
|
"button",
|
|
598
626
|
{
|
|
599
|
-
key:
|
|
627
|
+
key: x.id,
|
|
600
628
|
type: "button",
|
|
601
|
-
onClick: () =>
|
|
629
|
+
onClick: () => T(x.id),
|
|
602
630
|
className: "flex-1"
|
|
603
631
|
},
|
|
604
|
-
/* @__PURE__ */ e.createElement(
|
|
632
|
+
/* @__PURE__ */ e.createElement(ge, { icon: x.icon, label: x.label })
|
|
605
633
|
))))))));
|
|
606
|
-
},
|
|
607
|
-
const t = new URLSearchParams(window.location.search), a = t.get("accessToken"),
|
|
608
|
-
a && localStorage.setItem("authToken", a),
|
|
609
|
-
const
|
|
610
|
-
sessionStorage.removeItem("postLoginRedirect"), window.location.replace(
|
|
611
|
-
}, []), /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-center min-h-screen text-gray-700" }, "Finishing Google sign-in…")),
|
|
612
|
-
const { isAuthenticated: a } = z(),
|
|
613
|
-
return a ? t : /* @__PURE__ */ e.createElement(
|
|
614
|
-
},
|
|
615
|
-
const
|
|
634
|
+
}, ce = () => (V(() => {
|
|
635
|
+
const t = new URLSearchParams(window.location.search), a = t.get("accessToken"), r = t.get("refreshToken");
|
|
636
|
+
a && localStorage.setItem("authToken", a), r && localStorage.setItem("refreshToken", r);
|
|
637
|
+
const l = sessionStorage.getItem("postLoginRedirect") || "/";
|
|
638
|
+
sessionStorage.removeItem("postLoginRedirect"), window.location.replace(l);
|
|
639
|
+
}, []), /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-center min-h-screen text-gray-700" }, "Finishing Google sign-in…")), Re = ({ children: t }) => {
|
|
640
|
+
const { isAuthenticated: a } = z(), r = oe();
|
|
641
|
+
return a ? t : /* @__PURE__ */ e.createElement(J, { to: "/login", state: { from: r }, replace: !0 });
|
|
642
|
+
}, He = ({ config: t, children: a }) => {
|
|
643
|
+
const r = se(), [l, s] = m(
|
|
616
644
|
() => localStorage.getItem("authToken")
|
|
617
|
-
), [n, o] =
|
|
618
|
-
async function
|
|
645
|
+
), [n, o] = m(null), [i, c] = m(!0), [d, p] = m(!1);
|
|
646
|
+
async function w() {
|
|
619
647
|
try {
|
|
620
648
|
await E.post("/auth/logout");
|
|
621
|
-
} catch (
|
|
622
|
-
console.warn("Logout endpoint failed, proceeding with local logout:",
|
|
649
|
+
} catch (f) {
|
|
650
|
+
console.warn("Logout endpoint failed, proceeding with local logout:", f);
|
|
623
651
|
}
|
|
624
|
-
s(null), o(null), localStorage.removeItem("authToken"), sessionStorage.clear(), p(!1),
|
|
652
|
+
s(null), o(null), localStorage.removeItem("authToken"), sessionStorage.clear(), p(!1), r("/login", { replace: !0 });
|
|
625
653
|
}
|
|
626
|
-
const E =
|
|
627
|
-
const
|
|
654
|
+
const E = X(() => {
|
|
655
|
+
const f = le.create({
|
|
628
656
|
baseURL: t.baseUrl,
|
|
629
657
|
withCredentials: !0
|
|
630
658
|
});
|
|
631
|
-
return
|
|
659
|
+
return je(f, {
|
|
632
660
|
baseUrl: t.baseUrl,
|
|
633
|
-
getAccessToken: () =>
|
|
634
|
-
setAccessToken: (
|
|
661
|
+
getAccessToken: () => l,
|
|
662
|
+
setAccessToken: (h) => s(h),
|
|
635
663
|
logout: () => p(!0)
|
|
636
|
-
}),
|
|
637
|
-
}, [t.baseUrl,
|
|
638
|
-
|
|
664
|
+
}), f;
|
|
665
|
+
}, [t.baseUrl, l]);
|
|
666
|
+
V(() => {
|
|
639
667
|
(async () => {
|
|
640
|
-
if (
|
|
641
|
-
o(
|
|
668
|
+
if (l) {
|
|
669
|
+
o(te(l)), c(!1);
|
|
642
670
|
return;
|
|
643
671
|
}
|
|
644
672
|
try {
|
|
645
|
-
const { data:
|
|
673
|
+
const { data: h } = await le.post(
|
|
646
674
|
`${t.baseUrl}/auth/refresh-token`,
|
|
647
675
|
{},
|
|
648
676
|
{ withCredentials: !0 }
|
|
649
677
|
);
|
|
650
|
-
s(
|
|
678
|
+
s(h.accessToken), o(te(h.accessToken)), localStorage.setItem("authToken", h.accessToken);
|
|
651
679
|
} catch {
|
|
652
680
|
} finally {
|
|
653
|
-
|
|
681
|
+
c(!1);
|
|
654
682
|
}
|
|
655
683
|
})();
|
|
656
|
-
}, [
|
|
657
|
-
async function C(
|
|
658
|
-
const { data:
|
|
659
|
-
s(
|
|
684
|
+
}, [l, t.baseUrl]);
|
|
685
|
+
async function C(f) {
|
|
686
|
+
const { data: h } = await E.post("/api/auth/login", f);
|
|
687
|
+
s(h.accessToken), o(te(h.accessToken)), localStorage.setItem("authToken", h.accessToken), Ce(), r("/", { replace: !0 });
|
|
660
688
|
}
|
|
661
|
-
const
|
|
689
|
+
const v = X(
|
|
662
690
|
() => ({
|
|
663
|
-
isAuthenticated: !!
|
|
664
|
-
accessToken:
|
|
691
|
+
isAuthenticated: !!l,
|
|
692
|
+
accessToken: l,
|
|
665
693
|
user: n,
|
|
666
694
|
login: C,
|
|
667
|
-
logout:
|
|
695
|
+
logout: w,
|
|
668
696
|
api: E,
|
|
669
697
|
setUser: o
|
|
670
698
|
}),
|
|
671
|
-
[
|
|
699
|
+
[l, n, E]
|
|
672
700
|
);
|
|
673
|
-
return /* @__PURE__ */ e.createElement(
|
|
674
|
-
|
|
701
|
+
return /* @__PURE__ */ e.createElement(me.Provider, { value: t }, /* @__PURE__ */ e.createElement(ue.Provider, { value: v }, /* @__PURE__ */ e.createElement(Le, null, /* @__PURE__ */ e.createElement(
|
|
702
|
+
Y,
|
|
675
703
|
{
|
|
676
704
|
path: "login",
|
|
677
|
-
element:
|
|
705
|
+
element: l ? /* @__PURE__ */ e.createElement(J, { to: "/", replace: !0 }) : /* @__PURE__ */ e.createElement($e, { baseUrl: t.baseUrl, colors: t.colors })
|
|
678
706
|
}
|
|
679
707
|
), /* @__PURE__ */ e.createElement(
|
|
680
|
-
|
|
708
|
+
Y,
|
|
681
709
|
{
|
|
682
710
|
path: "signup",
|
|
683
|
-
element:
|
|
711
|
+
element: l ? /* @__PURE__ */ e.createElement(J, { to: "/", replace: !0 }) : /* @__PURE__ */ e.createElement(Ve, null)
|
|
684
712
|
}
|
|
685
713
|
), /* @__PURE__ */ e.createElement(
|
|
686
|
-
|
|
714
|
+
Y,
|
|
687
715
|
{
|
|
688
716
|
path: "oauth/google/callback",
|
|
689
|
-
element: /* @__PURE__ */ e.createElement(
|
|
717
|
+
element: /* @__PURE__ */ e.createElement(ce, null)
|
|
690
718
|
}
|
|
691
719
|
), /* @__PURE__ */ e.createElement(
|
|
692
|
-
|
|
720
|
+
Y,
|
|
693
721
|
{
|
|
694
722
|
path: "/oauth/microsoft/callback",
|
|
695
|
-
element: /* @__PURE__ */ e.createElement(
|
|
723
|
+
element: /* @__PURE__ */ e.createElement(ce, null)
|
|
696
724
|
}
|
|
697
725
|
), /* @__PURE__ */ e.createElement(
|
|
698
|
-
|
|
726
|
+
Y,
|
|
699
727
|
{
|
|
700
728
|
path: "*",
|
|
701
|
-
element: /* @__PURE__ */ e.createElement(
|
|
729
|
+
element: /* @__PURE__ */ e.createElement(Re, null, a)
|
|
702
730
|
}
|
|
703
|
-
)),
|
|
731
|
+
)), d && /* @__PURE__ */ e.createElement(Se, { onConfirm: w })));
|
|
704
732
|
};
|
|
705
|
-
function
|
|
706
|
-
const { user: a } = z(),
|
|
707
|
-
return t.some((
|
|
733
|
+
function Ee(...t) {
|
|
734
|
+
const { user: a } = z(), r = (a == null ? void 0 : a.roles) ?? [];
|
|
735
|
+
return t.some((l) => r.includes(l));
|
|
708
736
|
}
|
|
709
|
-
function
|
|
737
|
+
function Qe(t) {
|
|
710
738
|
const { user: a } = z();
|
|
711
739
|
return (a == null ? void 0 : a.modules.includes(t)) ?? !1;
|
|
712
740
|
}
|
|
713
|
-
function
|
|
714
|
-
const { user: a } = z(),
|
|
715
|
-
return t.every((
|
|
741
|
+
function ne(...t) {
|
|
742
|
+
const { user: a } = z(), r = (a == null ? void 0 : a.permissions) ?? [];
|
|
743
|
+
return t.every((l) => r.includes(l));
|
|
716
744
|
}
|
|
717
|
-
const
|
|
745
|
+
const Xe = ({
|
|
718
746
|
children: t,
|
|
719
747
|
fallbackpermessions: a = [],
|
|
720
|
-
anyPermessions:
|
|
721
|
-
fallbackRoles:
|
|
748
|
+
anyPermessions: r = [],
|
|
749
|
+
fallbackRoles: l = ["super-admin"],
|
|
722
750
|
redirectTo: s = "/dashboard"
|
|
723
751
|
}) => {
|
|
724
|
-
if (
|
|
752
|
+
if (l.some((c) => Ee(c)))
|
|
725
753
|
return /* @__PURE__ */ e.createElement(e.Fragment, null, t);
|
|
726
|
-
const o = a.length === 0 || a.every((
|
|
727
|
-
return o &&
|
|
728
|
-
},
|
|
729
|
-
function
|
|
754
|
+
const o = a.length === 0 || a.every((c) => ne(c)), i = r.length === 0 || r.some((c) => ne(c));
|
|
755
|
+
return o && i ? /* @__PURE__ */ e.createElement(e.Fragment, null, t) : /* @__PURE__ */ e.createElement(J, { to: s, replace: !0 });
|
|
756
|
+
}, ye = e.createContext({}), Je = ye.Provider;
|
|
757
|
+
function qe(t, a) {
|
|
730
758
|
var s, n, o;
|
|
731
|
-
const
|
|
732
|
-
return
|
|
759
|
+
const l = (s = e.useContext(ye)[t]) == null ? void 0 : s[a];
|
|
760
|
+
return l ? !!((n = l.perms) != null && n.some((i) => ne(i)) || (o = l.fallbackRoles) != null && o.some((i) => Ee(i))) : !1;
|
|
733
761
|
}
|
|
734
|
-
const
|
|
735
|
-
const { user: t, api: a, setUser:
|
|
762
|
+
const _e = () => {
|
|
763
|
+
const { user: t, api: a, setUser: r } = z(), [l, s] = m((t == null ? void 0 : t.name) ?? ""), [n, o] = m((t == null ? void 0 : t.email) ?? ""), [i, c] = m(!1), [d, p] = m(!1), [w, E] = m({
|
|
736
764
|
open: !1,
|
|
737
765
|
type: "success",
|
|
738
766
|
title: "",
|
|
739
767
|
message: ""
|
|
740
768
|
}), C = "+971 50 827 8229";
|
|
741
|
-
|
|
742
|
-
if (!
|
|
769
|
+
V(() => {
|
|
770
|
+
if (!w.open)
|
|
743
771
|
return;
|
|
744
|
-
const
|
|
745
|
-
return () => window.clearTimeout(
|
|
746
|
-
}, [
|
|
747
|
-
let
|
|
748
|
-
async function
|
|
772
|
+
const g = window.setTimeout(() => E((k) => ({ ...k, open: !1 })), 3e3);
|
|
773
|
+
return () => window.clearTimeout(g);
|
|
774
|
+
}, [w.open]), V(() => {
|
|
775
|
+
let g = !1;
|
|
776
|
+
async function k() {
|
|
749
777
|
try {
|
|
750
|
-
const { data:
|
|
751
|
-
if (
|
|
778
|
+
const { data: b } = await a.get("/auth/client/me");
|
|
779
|
+
if (g)
|
|
752
780
|
return;
|
|
753
|
-
|
|
754
|
-
} catch (
|
|
755
|
-
console.error("Failed to load profile details:",
|
|
781
|
+
r(b), s((b == null ? void 0 : b.name) ?? ""), o((b == null ? void 0 : b.email) ?? "");
|
|
782
|
+
} catch (b) {
|
|
783
|
+
console.error("Failed to load profile details:", b);
|
|
756
784
|
}
|
|
757
785
|
}
|
|
758
|
-
return
|
|
759
|
-
|
|
786
|
+
return k(), () => {
|
|
787
|
+
g = !0;
|
|
760
788
|
};
|
|
761
|
-
}, [a,
|
|
762
|
-
const
|
|
763
|
-
async function
|
|
789
|
+
}, [a, r]);
|
|
790
|
+
const v = X(() => (l || (t == null ? void 0 : t.name) || (t == null ? void 0 : t.email) || "").trim(), [l, t == null ? void 0 : t.name, t == null ? void 0 : t.email]), f = X(() => v.charAt(0).toUpperCase() || "?", [v]);
|
|
791
|
+
async function h() {
|
|
764
792
|
if (t) {
|
|
765
793
|
p(!0);
|
|
766
794
|
try {
|
|
767
|
-
await a.patch("/auth/client/me", { name:
|
|
795
|
+
await a.patch("/auth/client/me", { name: l }), r({ ...t, name: l }), c(!1), E({
|
|
768
796
|
open: !0,
|
|
769
797
|
type: "success",
|
|
770
798
|
title: "Changes saved",
|
|
771
799
|
message: "Your profile was updated successfully."
|
|
772
800
|
});
|
|
773
|
-
} catch (
|
|
774
|
-
console.error("Failed to update profile:",
|
|
801
|
+
} catch (g) {
|
|
802
|
+
console.error("Failed to update profile:", g), E({
|
|
775
803
|
open: !0,
|
|
776
804
|
type: "error",
|
|
777
805
|
title: "Save failed",
|
|
@@ -784,15 +812,15 @@ const Oe = () => {
|
|
|
784
812
|
}
|
|
785
813
|
if (!t)
|
|
786
814
|
return /* @__PURE__ */ e.createElement("p", { className: "text-sm text-gray-500" }, "No user data available.");
|
|
787
|
-
const
|
|
788
|
-
return /* @__PURE__ */ e.createElement("div", { className: "max-w-3xl mx-auto" },
|
|
815
|
+
const M = w.type === "success";
|
|
816
|
+
return /* @__PURE__ */ e.createElement("div", { className: "max-w-3xl mx-auto" }, w.open && /* @__PURE__ */ e.createElement(
|
|
789
817
|
"div",
|
|
790
818
|
{
|
|
791
819
|
className: "fixed top-6 right-6 z-[999999] flex items-center gap-3 rounded-xl border bg-white px-4 py-3 shadow-lg",
|
|
792
820
|
role: "status",
|
|
793
821
|
"aria-live": "polite",
|
|
794
822
|
style: {
|
|
795
|
-
borderColor:
|
|
823
|
+
borderColor: M ? "#BBF7D0" : "#FECACA"
|
|
796
824
|
}
|
|
797
825
|
},
|
|
798
826
|
/* @__PURE__ */ e.createElement(
|
|
@@ -800,10 +828,10 @@ const Oe = () => {
|
|
|
800
828
|
{
|
|
801
829
|
className: "flex h-9 w-9 items-center justify-center rounded-full",
|
|
802
830
|
style: {
|
|
803
|
-
backgroundColor:
|
|
831
|
+
backgroundColor: M ? "#ECFDF5" : "#FEF2F2"
|
|
804
832
|
}
|
|
805
833
|
},
|
|
806
|
-
|
|
834
|
+
M ? /* @__PURE__ */ e.createElement(
|
|
807
835
|
"svg",
|
|
808
836
|
{
|
|
809
837
|
width: "18",
|
|
@@ -866,15 +894,15 @@ const Oe = () => {
|
|
|
866
894
|
"span",
|
|
867
895
|
{
|
|
868
896
|
className: "text-sm font-semibold",
|
|
869
|
-
style: { color:
|
|
897
|
+
style: { color: M ? "#15803D" : "#B91C1C" }
|
|
870
898
|
},
|
|
871
|
-
|
|
872
|
-
),
|
|
899
|
+
w.title
|
|
900
|
+
), w.message && /* @__PURE__ */ e.createElement("span", { className: "text-xs text-gray-500" }, w.message)),
|
|
873
901
|
/* @__PURE__ */ e.createElement(
|
|
874
902
|
"button",
|
|
875
903
|
{
|
|
876
904
|
type: "button",
|
|
877
|
-
onClick: () => E((
|
|
905
|
+
onClick: () => E((g) => ({ ...g, open: !1 })),
|
|
878
906
|
className: "ml-2 rounded-md px-2 py-1 text-gray-500 hover:bg-gray-100",
|
|
879
907
|
"aria-label": "Close",
|
|
880
908
|
title: "Close"
|
|
@@ -908,7 +936,7 @@ const Oe = () => {
|
|
|
908
936
|
)
|
|
909
937
|
)
|
|
910
938
|
)
|
|
911
|
-
), /* @__PURE__ */ e.createElement("div", { className: "rounded-2xl border border-gray-200 bg-white shadow-sm" }, /* @__PURE__ */ e.createElement("div", { className: "px-6 pt-6 pb-4" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "h-16 w-16 rounded-full bg-blue-600 flex items-center justify-center text-white text-2xl font-semibold" },
|
|
939
|
+
), /* @__PURE__ */ e.createElement("div", { className: "rounded-2xl border border-gray-200 bg-white shadow-sm" }, /* @__PURE__ */ e.createElement("div", { className: "px-6 pt-6 pb-4" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement("div", { className: "h-16 w-16 rounded-full bg-blue-600 flex items-center justify-center text-white text-2xl font-semibold" }, f), /* @__PURE__ */ e.createElement(
|
|
912
940
|
"button",
|
|
913
941
|
{
|
|
914
942
|
type: "button",
|
|
@@ -943,20 +971,20 @@ const Oe = () => {
|
|
|
943
971
|
}
|
|
944
972
|
)
|
|
945
973
|
)
|
|
946
|
-
)), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("h1", { className: "text-2xl font-semibold" }, "My Profile"), /* @__PURE__ */ e.createElement("p", { className: "text-sm text-gray-500" }, "Personal details"))),
|
|
974
|
+
)), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("h1", { className: "text-2xl font-semibold" }, "My Profile"), /* @__PURE__ */ e.createElement("p", { className: "text-sm text-gray-500" }, "Personal details"))), i ? /* @__PURE__ */ e.createElement(
|
|
947
975
|
"button",
|
|
948
976
|
{
|
|
949
977
|
type: "button",
|
|
950
|
-
onClick:
|
|
951
|
-
disabled:
|
|
978
|
+
onClick: h,
|
|
979
|
+
disabled: d,
|
|
952
980
|
className: "rounded-full border border-blue-200 bg-blue-50 px-4 py-2 text-sm font-medium text-blue-700 hover:bg-blue-100 disabled:opacity-60"
|
|
953
981
|
},
|
|
954
|
-
|
|
982
|
+
d ? "Saving…" : "Save changes"
|
|
955
983
|
) : /* @__PURE__ */ e.createElement(
|
|
956
984
|
"button",
|
|
957
985
|
{
|
|
958
986
|
type: "button",
|
|
959
|
-
onClick: () =>
|
|
987
|
+
onClick: () => c(!0),
|
|
960
988
|
title: "Edit profile",
|
|
961
989
|
className: "h-9 w-9 rounded-full border border-gray-200 bg-white shadow-sm flex items-center justify-center hover:bg-gray-50"
|
|
962
990
|
},
|
|
@@ -992,10 +1020,10 @@ const Oe = () => {
|
|
|
992
1020
|
"input",
|
|
993
1021
|
{
|
|
994
1022
|
type: "text",
|
|
995
|
-
value:
|
|
996
|
-
disabled: !
|
|
997
|
-
onChange: (
|
|
998
|
-
className: `w-full rounded-lg border px-3 py-2 text-sm outline-none ${
|
|
1023
|
+
value: l,
|
|
1024
|
+
disabled: !i || d,
|
|
1025
|
+
onChange: (g) => s(g.target.value),
|
|
1026
|
+
className: `w-full rounded-lg border px-3 py-2 text-sm outline-none ${i ? "border-gray-300 bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-100" : "border-gray-200 bg-gray-50 text-gray-700"}`
|
|
999
1027
|
}
|
|
1000
1028
|
)), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Email ID"), /* @__PURE__ */ e.createElement(
|
|
1001
1029
|
"input",
|
|
@@ -1013,13 +1041,13 @@ const Oe = () => {
|
|
|
1013
1041
|
disabled: !0,
|
|
1014
1042
|
className: "w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 cursor-not-allowed"
|
|
1015
1043
|
}
|
|
1016
|
-
))),
|
|
1044
|
+
))), i && /* @__PURE__ */ e.createElement(
|
|
1017
1045
|
"button",
|
|
1018
1046
|
{
|
|
1019
1047
|
type: "button",
|
|
1020
|
-
disabled:
|
|
1048
|
+
disabled: d,
|
|
1021
1049
|
onClick: () => {
|
|
1022
|
-
|
|
1050
|
+
c(!1), s((t == null ? void 0 : t.name) ?? "");
|
|
1023
1051
|
},
|
|
1024
1052
|
className: "mt-6 text-sm font-medium text-gray-600 hover:text-gray-900"
|
|
1025
1053
|
},
|
|
@@ -1027,14 +1055,14 @@ const Oe = () => {
|
|
|
1027
1055
|
))));
|
|
1028
1056
|
};
|
|
1029
1057
|
export {
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1058
|
+
He as AuthProvider,
|
|
1059
|
+
_e as ProfilePage,
|
|
1060
|
+
ye as RbacContext,
|
|
1061
|
+
Je as RbacProvider,
|
|
1062
|
+
Xe as RequirePermissions,
|
|
1035
1063
|
z as useAuthState,
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1064
|
+
ne as useCan,
|
|
1065
|
+
qe as useGrant,
|
|
1066
|
+
Qe as useHasModule,
|
|
1067
|
+
Ee as useHasRole
|
|
1040
1068
|
};
|