@skylabs-digital/react-identity-access 1.5.0 → 1.6.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/README.md +203 -42
- package/dist/components/LoginForm.d.ts +7 -3
- package/dist/components/LoginForm.d.ts.map +1 -1
- package/dist/components/MagicLinkForm.d.ts +53 -0
- package/dist/components/MagicLinkForm.d.ts.map +1 -0
- package/dist/components/MagicLinkVerify.d.ts +45 -0
- package/dist/components/MagicLinkVerify.d.ts.map +1 -0
- package/dist/components/SignupForm.d.ts +9 -1
- package/dist/components/SignupForm.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1562 -855
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/providers/AuthProvider.d.ts +5 -3
- package/dist/providers/AuthProvider.d.ts.map +1 -1
- package/dist/services/AuthApiService.d.ts +6 -3
- package/dist/services/AuthApiService.d.ts.map +1 -1
- package/dist/types/api.d.ts +36 -6
- package/dist/types/api.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useLocation as
|
|
4
|
-
class
|
|
1
|
+
import { jsx as n, Fragment as D, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ae, useState as p, useMemo as _, useCallback as oe, useEffect as Z, useContext as le } from "react";
|
|
3
|
+
import { useLocation as he, Navigate as de } from "react-router-dom";
|
|
4
|
+
class te {
|
|
5
5
|
// SessionManager instance
|
|
6
6
|
constructor(e, t = 1e4) {
|
|
7
7
|
this.baseUrl = e.replace(/\/$/, ""), this.timeout = t;
|
|
@@ -12,44 +12,44 @@ class G {
|
|
|
12
12
|
getBaseUrl() {
|
|
13
13
|
return this.baseUrl;
|
|
14
14
|
}
|
|
15
|
-
async request(e, t, r,
|
|
16
|
-
return this.executeRequest(e, t, r,
|
|
15
|
+
async request(e, t, r, s) {
|
|
16
|
+
return this.executeRequest(e, t, r, s, !1);
|
|
17
17
|
}
|
|
18
|
-
async executeRequest(e, t, r,
|
|
19
|
-
const
|
|
20
|
-
let
|
|
18
|
+
async executeRequest(e, t, r, s, a = !1) {
|
|
19
|
+
const b = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, E = (s == null ? void 0 : s.timeout) || this.timeout;
|
|
20
|
+
let L = {
|
|
21
21
|
"Content-Type": "application/json",
|
|
22
|
-
...
|
|
22
|
+
...s == null ? void 0 : s.headers
|
|
23
23
|
};
|
|
24
|
-
if (!(
|
|
24
|
+
if (!(s != null && s.skipAuth) && this.sessionManager)
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
} catch (
|
|
29
|
-
console.warn("Failed to inject auth headers:",
|
|
26
|
+
const m = await this.sessionManager.getAuthHeaders();
|
|
27
|
+
L = { ...L, ...m };
|
|
28
|
+
} catch (m) {
|
|
29
|
+
console.warn("Failed to inject auth headers:", m);
|
|
30
30
|
}
|
|
31
|
-
const P = new AbortController(),
|
|
31
|
+
const P = new AbortController(), f = setTimeout(() => P.abort(), E);
|
|
32
32
|
try {
|
|
33
|
-
const
|
|
33
|
+
const m = await fetch(b, {
|
|
34
34
|
method: e,
|
|
35
|
-
headers:
|
|
35
|
+
headers: L,
|
|
36
36
|
body: r ? JSON.stringify(r) : void 0,
|
|
37
37
|
signal: P.signal
|
|
38
38
|
});
|
|
39
|
-
if (clearTimeout(
|
|
39
|
+
if (clearTimeout(f), m.status === 401 && !(s != null && s.skipRetry) && !a && this.sessionManager)
|
|
40
40
|
try {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
return await this.sessionManager.getAuthHeaders(), this.executeRequest(e, t, r,
|
|
41
|
+
const w = this.sessionManager.getTokens();
|
|
42
|
+
if (w != null && w.refreshToken)
|
|
43
|
+
return await this.sessionManager.getAuthHeaders(), this.executeRequest(e, t, r, s, !0);
|
|
44
44
|
} catch {
|
|
45
|
-
throw new Error(`HTTP ${
|
|
45
|
+
throw new Error(`HTTP ${m.status}: ${m.statusText}`);
|
|
46
46
|
}
|
|
47
|
-
if (!
|
|
48
|
-
throw new Error(`HTTP ${
|
|
49
|
-
const
|
|
50
|
-
return !
|
|
51
|
-
} catch (
|
|
52
|
-
throw clearTimeout(
|
|
47
|
+
if (!m.ok)
|
|
48
|
+
throw new Error(`HTTP ${m.status}: ${m.statusText}`);
|
|
49
|
+
const M = m.headers.get("content-type");
|
|
50
|
+
return !M || !M.includes("application/json") ? {} : await m.json();
|
|
51
|
+
} catch (m) {
|
|
52
|
+
throw clearTimeout(f), m instanceof Error && m.name === "AbortError" ? new Error(`Request timeout after ${E}ms`) : m;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
async get(e, t) {
|
|
@@ -65,7 +65,7 @@ class G {
|
|
|
65
65
|
return this.request("DELETE", e, void 0, t);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
class
|
|
68
|
+
class Te {
|
|
69
69
|
constructor(e, t) {
|
|
70
70
|
this.httpService = e, this.sessionManager = t;
|
|
71
71
|
}
|
|
@@ -78,12 +78,12 @@ class Se {
|
|
|
78
78
|
async getApps(e) {
|
|
79
79
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
80
80
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
|
|
81
|
-
const
|
|
81
|
+
const s = `/apps/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
|
|
82
82
|
headers: t
|
|
83
83
|
});
|
|
84
84
|
return {
|
|
85
|
-
apps:
|
|
86
|
-
meta:
|
|
85
|
+
apps: a.data,
|
|
86
|
+
meta: a.meta
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
async getAppById(e) {
|
|
@@ -110,11 +110,11 @@ class Se {
|
|
|
110
110
|
)).data;
|
|
111
111
|
}
|
|
112
112
|
async updateSettingsSchema(e, t, r) {
|
|
113
|
-
const
|
|
113
|
+
const s = await this.sessionManager.getAuthHeaders();
|
|
114
114
|
return (await this.httpService.put(
|
|
115
115
|
`/apps/${e}/settings-schema`,
|
|
116
116
|
{ schema: t, defaultSettings: r },
|
|
117
|
-
{ headers:
|
|
117
|
+
{ headers: s }
|
|
118
118
|
)).data;
|
|
119
119
|
}
|
|
120
120
|
async exportConfig(e) {
|
|
@@ -124,7 +124,7 @@ class Se {
|
|
|
124
124
|
})).data;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const we = ae(null), Me = () => /* @__PURE__ */ n(
|
|
128
128
|
"div",
|
|
129
129
|
{
|
|
130
130
|
style: {
|
|
@@ -134,9 +134,9 @@ const pe = te(null), ve = () => /* @__PURE__ */ s(
|
|
|
134
134
|
height: "100vh",
|
|
135
135
|
fontFamily: "system-ui, sans-serif"
|
|
136
136
|
},
|
|
137
|
-
children: /* @__PURE__ */
|
|
137
|
+
children: /* @__PURE__ */ n("div", { children: "Loading application..." })
|
|
138
138
|
}
|
|
139
|
-
),
|
|
139
|
+
), Ee = ({ error: i, retry: e }) => /* @__PURE__ */ l(
|
|
140
140
|
"div",
|
|
141
141
|
{
|
|
142
142
|
style: {
|
|
@@ -150,9 +150,9 @@ const pe = te(null), ve = () => /* @__PURE__ */ s(
|
|
|
150
150
|
padding: "20px"
|
|
151
151
|
},
|
|
152
152
|
children: [
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ n("h2", { style: { color: "#dc3545", marginBottom: "16px" }, children: "Application Error" }),
|
|
154
|
+
/* @__PURE__ */ n("p", { style: { color: "#6c757d", marginBottom: "24px" }, children: i.message || "Unable to load application" }),
|
|
155
|
+
/* @__PURE__ */ n(
|
|
156
156
|
"button",
|
|
157
157
|
{
|
|
158
158
|
onClick: e,
|
|
@@ -170,9 +170,9 @@ const pe = te(null), ve = () => /* @__PURE__ */ s(
|
|
|
170
170
|
]
|
|
171
171
|
}
|
|
172
172
|
);
|
|
173
|
-
function
|
|
174
|
-
const [t, r] =
|
|
175
|
-
const
|
|
173
|
+
function ht({ config: i, children: e }) {
|
|
174
|
+
const [t, r] = p(null), [s, a] = p(!0), [b, E] = p(null), L = _(() => {
|
|
175
|
+
const f = () => {
|
|
176
176
|
P();
|
|
177
177
|
};
|
|
178
178
|
return {
|
|
@@ -180,40 +180,40 @@ function et({ config: i, children: e }) {
|
|
|
180
180
|
baseUrl: i.baseUrl,
|
|
181
181
|
// App info
|
|
182
182
|
appInfo: t,
|
|
183
|
-
isAppLoading:
|
|
184
|
-
appError:
|
|
185
|
-
retryApp:
|
|
183
|
+
isAppLoading: s,
|
|
184
|
+
appError: b,
|
|
185
|
+
retryApp: f
|
|
186
186
|
};
|
|
187
|
-
}, [i, t,
|
|
187
|
+
}, [i, t, s, b]), P = oe(async () => {
|
|
188
188
|
try {
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
r(
|
|
192
|
-
} catch (
|
|
193
|
-
const
|
|
194
|
-
|
|
189
|
+
a(!0), E(null);
|
|
190
|
+
const f = new te(i.baseUrl), M = await new Te(f, {}).getPublicAppInfo(i.appId);
|
|
191
|
+
r(M);
|
|
192
|
+
} catch (f) {
|
|
193
|
+
const m = f instanceof Error ? f : new Error("Failed to load app information");
|
|
194
|
+
E(m), r(null);
|
|
195
195
|
} finally {
|
|
196
|
-
|
|
196
|
+
a(!1);
|
|
197
197
|
}
|
|
198
198
|
}, [i.baseUrl, i.appId]);
|
|
199
|
-
if (
|
|
199
|
+
if (Z(() => {
|
|
200
200
|
P();
|
|
201
|
-
}, [P]),
|
|
202
|
-
return /* @__PURE__ */
|
|
203
|
-
if (
|
|
204
|
-
const
|
|
205
|
-
return /* @__PURE__ */
|
|
201
|
+
}, [P]), s)
|
|
202
|
+
return /* @__PURE__ */ n(D, { children: i.loadingFallback || /* @__PURE__ */ n(Me, {}) });
|
|
203
|
+
if (b) {
|
|
204
|
+
const f = typeof i.errorFallback == "function" ? i.errorFallback(b, () => P()) : i.errorFallback || /* @__PURE__ */ n(Ee, { error: b, retry: () => P() });
|
|
205
|
+
return /* @__PURE__ */ n(D, { children: f });
|
|
206
206
|
}
|
|
207
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ n(we.Provider, { value: L, children: e });
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
const i =
|
|
209
|
+
function ne() {
|
|
210
|
+
const i = le(we);
|
|
211
211
|
if (!i)
|
|
212
212
|
throw new Error("useApp must be used within an AppProvider");
|
|
213
213
|
return i;
|
|
214
214
|
}
|
|
215
|
-
const
|
|
216
|
-
class
|
|
215
|
+
const gt = ne;
|
|
216
|
+
class Le {
|
|
217
217
|
constructor(e = {}) {
|
|
218
218
|
this.refreshPromise = null, this.refreshQueue = [], this.storageKey = e.storageKey || "auth_tokens", this.autoRefresh = e.autoRefresh ?? !0, this.refreshThreshold = e.refreshThreshold || 3e5, this.onRefreshFailed = e.onRefreshFailed, this.baseUrl = e.baseUrl || "", this.tokenStorage = e.tokenStorage || {
|
|
219
219
|
get: () => {
|
|
@@ -281,10 +281,10 @@ class Ae {
|
|
|
281
281
|
try {
|
|
282
282
|
await this.refreshPromise;
|
|
283
283
|
const t = this.getTokens(), r = t != null && t.accessToken ? { Authorization: `Bearer ${t.accessToken}` } : {};
|
|
284
|
-
return this.refreshQueue.forEach(({ resolve:
|
|
284
|
+
return this.refreshQueue.forEach(({ resolve: s }) => s(r)), this.refreshQueue = [], r;
|
|
285
285
|
} catch (t) {
|
|
286
286
|
const r = t instanceof Error ? t : new Error("Token refresh failed");
|
|
287
|
-
return this.refreshQueue.forEach(({ reject:
|
|
287
|
+
return this.refreshQueue.forEach(({ reject: s }) => s(r)), this.refreshQueue = [], this.clearSession(), this.onRefreshFailed && this.onRefreshFailed(), {};
|
|
288
288
|
} finally {
|
|
289
289
|
this.refreshPromise = null;
|
|
290
290
|
}
|
|
@@ -303,11 +303,11 @@ class Ae {
|
|
|
303
303
|
});
|
|
304
304
|
if (!r.ok)
|
|
305
305
|
throw new Error(`Token refresh failed: ${r.status} ${r.statusText}`);
|
|
306
|
-
const
|
|
306
|
+
const s = await r.json();
|
|
307
307
|
this.setTokens({
|
|
308
|
-
accessToken:
|
|
309
|
-
refreshToken:
|
|
310
|
-
expiresIn:
|
|
308
|
+
accessToken: s.accessToken,
|
|
309
|
+
refreshToken: s.refreshToken || e,
|
|
310
|
+
expiresIn: s.expiresIn
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
313
|
setUser(e) {
|
|
@@ -330,7 +330,7 @@ class Ae {
|
|
|
330
330
|
return e !== null && !this.isTokenExpired(e);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
class
|
|
333
|
+
class Re {
|
|
334
334
|
constructor(e) {
|
|
335
335
|
this.httpService = e;
|
|
336
336
|
}
|
|
@@ -354,6 +354,18 @@ class Pe {
|
|
|
354
354
|
async requestPasswordReset(e) {
|
|
355
355
|
await this.httpService.post("/auth/password-reset/request", e);
|
|
356
356
|
}
|
|
357
|
+
async sendMagicLink(e) {
|
|
358
|
+
return await this.httpService.post(
|
|
359
|
+
"/auth/magic-link/send",
|
|
360
|
+
e
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
async verifyMagicLink(e) {
|
|
364
|
+
return await this.httpService.post(
|
|
365
|
+
"/auth/magic-link/verify",
|
|
366
|
+
e
|
|
367
|
+
);
|
|
368
|
+
}
|
|
357
369
|
async confirmPasswordReset(e) {
|
|
358
370
|
await this.httpService.post("/auth/password-reset/confirm", e);
|
|
359
371
|
}
|
|
@@ -364,7 +376,7 @@ class Pe {
|
|
|
364
376
|
});
|
|
365
377
|
}
|
|
366
378
|
}
|
|
367
|
-
class
|
|
379
|
+
class pe {
|
|
368
380
|
constructor(e, t) {
|
|
369
381
|
this.httpService = e, this.sessionManager = t;
|
|
370
382
|
}
|
|
@@ -404,10 +416,10 @@ class ce {
|
|
|
404
416
|
async getRolesByApp(e, t) {
|
|
405
417
|
const r = new URLSearchParams();
|
|
406
418
|
t != null && t.page && r.append("page", t.page.toString()), t != null && t.limit && r.append("limit", t.limit.toString()), t != null && t.sortBy && r.append("sortBy", t.sortBy), t != null && t.sortOrder && r.append("sortOrder", t.sortOrder);
|
|
407
|
-
const
|
|
419
|
+
const s = `/roles/app/${e}${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s);
|
|
408
420
|
return {
|
|
409
|
-
roles:
|
|
410
|
-
meta:
|
|
421
|
+
roles: a.data,
|
|
422
|
+
meta: a.meta
|
|
411
423
|
};
|
|
412
424
|
}
|
|
413
425
|
async assignRole(e, t) {
|
|
@@ -429,18 +441,18 @@ class ce {
|
|
|
429
441
|
async getUserRoles(e, t) {
|
|
430
442
|
if (!this.sessionManager)
|
|
431
443
|
throw new Error("SessionManager is required for private endpoints");
|
|
432
|
-
const r = await this.sessionManager.getAuthHeaders(),
|
|
433
|
-
t != null && t.page &&
|
|
434
|
-
const
|
|
444
|
+
const r = await this.sessionManager.getAuthHeaders(), s = new URLSearchParams();
|
|
445
|
+
t != null && t.page && s.append("page", t.page.toString()), t != null && t.limit && s.append("limit", t.limit.toString()), t != null && t.sortBy && s.append("sortBy", t.sortBy), t != null && t.sortOrder && s.append("sortOrder", t.sortOrder);
|
|
446
|
+
const a = `/roles/user/${e}${s.toString() ? `?${s.toString()}` : ""}`, b = await this.httpService.get(a, {
|
|
435
447
|
headers: r
|
|
436
448
|
});
|
|
437
449
|
return {
|
|
438
|
-
roles:
|
|
439
|
-
meta:
|
|
450
|
+
roles: b.data,
|
|
451
|
+
meta: b.meta
|
|
440
452
|
};
|
|
441
453
|
}
|
|
442
454
|
}
|
|
443
|
-
class
|
|
455
|
+
class Ce {
|
|
444
456
|
constructor(e, t) {
|
|
445
457
|
this.httpService = e, this.sessionManager = t;
|
|
446
458
|
}
|
|
@@ -453,12 +465,12 @@ class ke {
|
|
|
453
465
|
async getUsers(e) {
|
|
454
466
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
455
467
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
|
|
456
|
-
const
|
|
468
|
+
const s = `/users/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
|
|
457
469
|
headers: t
|
|
458
470
|
});
|
|
459
471
|
return {
|
|
460
|
-
users:
|
|
461
|
-
meta:
|
|
472
|
+
users: a.data,
|
|
473
|
+
meta: a.meta
|
|
462
474
|
};
|
|
463
475
|
}
|
|
464
476
|
async getUserById(e) {
|
|
@@ -480,7 +492,7 @@ class ke {
|
|
|
480
492
|
});
|
|
481
493
|
}
|
|
482
494
|
}
|
|
483
|
-
class
|
|
495
|
+
class fe {
|
|
484
496
|
constructor(e, t, r) {
|
|
485
497
|
this.httpService = e, this.appId = t, this.sessionManager = r;
|
|
486
498
|
}
|
|
@@ -497,12 +509,12 @@ class de {
|
|
|
497
509
|
throw new Error("SessionManager is required for private endpoints");
|
|
498
510
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
499
511
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
|
|
500
|
-
const
|
|
512
|
+
const s = `/tenants/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
|
|
501
513
|
headers: t
|
|
502
514
|
});
|
|
503
515
|
return {
|
|
504
|
-
tenants:
|
|
505
|
-
meta:
|
|
516
|
+
tenants: a.data,
|
|
517
|
+
meta: a.meta
|
|
506
518
|
};
|
|
507
519
|
}
|
|
508
520
|
async getTenantById(e) {
|
|
@@ -558,7 +570,7 @@ class de {
|
|
|
558
570
|
)).data;
|
|
559
571
|
}
|
|
560
572
|
}
|
|
561
|
-
const
|
|
573
|
+
const ve = ae(null), Ie = () => /* @__PURE__ */ n(
|
|
562
574
|
"div",
|
|
563
575
|
{
|
|
564
576
|
style: {
|
|
@@ -568,9 +580,9 @@ const fe = te(null), Te = () => /* @__PURE__ */ s(
|
|
|
568
580
|
height: "100vh",
|
|
569
581
|
fontFamily: "system-ui, sans-serif"
|
|
570
582
|
},
|
|
571
|
-
children: /* @__PURE__ */
|
|
583
|
+
children: /* @__PURE__ */ n("div", { children: "Loading tenant..." })
|
|
572
584
|
}
|
|
573
|
-
),
|
|
585
|
+
), Fe = ({ error: i, retry: e }) => /* @__PURE__ */ l(
|
|
574
586
|
"div",
|
|
575
587
|
{
|
|
576
588
|
style: {
|
|
@@ -584,9 +596,9 @@ const fe = te(null), Te = () => /* @__PURE__ */ s(
|
|
|
584
596
|
padding: "20px"
|
|
585
597
|
},
|
|
586
598
|
children: [
|
|
587
|
-
/* @__PURE__ */
|
|
588
|
-
/* @__PURE__ */
|
|
589
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ n("h2", { style: { color: "#dc3545", marginBottom: "16px" }, children: "Tenant Error" }),
|
|
600
|
+
/* @__PURE__ */ n("p", { style: { color: "#6c757d", marginBottom: "24px" }, children: i.message || "Unable to load tenant" }),
|
|
601
|
+
/* @__PURE__ */ n(
|
|
590
602
|
"button",
|
|
591
603
|
{
|
|
592
604
|
onClick: e,
|
|
@@ -604,77 +616,77 @@ const fe = te(null), Te = () => /* @__PURE__ */ s(
|
|
|
604
616
|
]
|
|
605
617
|
}
|
|
606
618
|
);
|
|
607
|
-
function
|
|
608
|
-
const { baseUrl: t, appInfo: r, appId:
|
|
609
|
-
const
|
|
619
|
+
function pt({ config: i, children: e }) {
|
|
620
|
+
const { baseUrl: t, appInfo: r, appId: s } = ne(), [a, b] = p(i.initialTenant || null), [E, L] = p(!i.initialTenant), [P, f] = p(null), [m, M] = p(null), [w, v] = p(!1), [I, g] = p(null), U = oe(() => {
|
|
621
|
+
const S = i.tenantMode || "selector", c = "tenant";
|
|
610
622
|
if (typeof window > "u") return null;
|
|
611
|
-
if (
|
|
612
|
-
const
|
|
613
|
-
if (
|
|
614
|
-
const
|
|
615
|
-
return localStorage.setItem(
|
|
623
|
+
if (S === "subdomain") {
|
|
624
|
+
const o = window.location.hostname.split(".");
|
|
625
|
+
if (o.length >= 3) {
|
|
626
|
+
const d = o[0];
|
|
627
|
+
return localStorage.setItem(c, d), d;
|
|
616
628
|
}
|
|
617
|
-
return localStorage.getItem(
|
|
618
|
-
} else if (
|
|
619
|
-
const
|
|
620
|
-
return
|
|
629
|
+
return localStorage.getItem(c);
|
|
630
|
+
} else if (S === "selector") {
|
|
631
|
+
const o = new URLSearchParams(window.location.search).get(i.selectorParam || "tenant");
|
|
632
|
+
return o ? (localStorage.setItem(c, o), o) : localStorage.getItem(c);
|
|
621
633
|
}
|
|
622
634
|
return null;
|
|
623
|
-
}, [i.tenantMode, i.selectorParam]),
|
|
624
|
-
async (
|
|
635
|
+
}, [i.tenantMode, i.selectorParam]), u = _(() => U(), [U]), y = (r == null ? void 0 : r.settingsSchema) || null, x = oe(
|
|
636
|
+
async (S) => {
|
|
625
637
|
try {
|
|
626
|
-
|
|
627
|
-
const
|
|
628
|
-
|
|
629
|
-
} catch (
|
|
630
|
-
const
|
|
631
|
-
|
|
638
|
+
L(!0), f(null);
|
|
639
|
+
const c = new te(t), o = await new fe(c, s).getPublicTenantInfo(S);
|
|
640
|
+
b(o);
|
|
641
|
+
} catch (c) {
|
|
642
|
+
const h = c instanceof Error ? c : new Error("Failed to load tenant information");
|
|
643
|
+
f(h), b(null);
|
|
632
644
|
} finally {
|
|
633
|
-
|
|
645
|
+
L(!1);
|
|
634
646
|
}
|
|
635
647
|
},
|
|
636
|
-
[t,
|
|
637
|
-
),
|
|
638
|
-
if (
|
|
648
|
+
[t, s]
|
|
649
|
+
), F = oe(async () => {
|
|
650
|
+
if (a != null && a.id)
|
|
639
651
|
try {
|
|
640
|
-
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
} catch (
|
|
644
|
-
const
|
|
645
|
-
|
|
652
|
+
v(!0), g(null);
|
|
653
|
+
const S = new te(t), h = await new fe(S, a.appId).getTenantSettings(a.id);
|
|
654
|
+
M(h);
|
|
655
|
+
} catch (S) {
|
|
656
|
+
const c = S instanceof Error ? S : new Error("Failed to load tenant settings");
|
|
657
|
+
g(c), M(null);
|
|
646
658
|
} finally {
|
|
647
|
-
|
|
659
|
+
v(!1);
|
|
648
660
|
}
|
|
649
|
-
}, [t,
|
|
650
|
-
|
|
651
|
-
}, [
|
|
652
|
-
(
|
|
653
|
-
if (!
|
|
661
|
+
}, [t, a]), B = oe(() => {
|
|
662
|
+
F();
|
|
663
|
+
}, [F]), z = oe(
|
|
664
|
+
(S) => {
|
|
665
|
+
if (!y)
|
|
654
666
|
return { isValid: !0, errors: [] };
|
|
655
|
-
const
|
|
667
|
+
const c = [];
|
|
656
668
|
try {
|
|
657
|
-
return
|
|
658
|
-
var
|
|
659
|
-
const
|
|
660
|
-
if ((
|
|
661
|
-
|
|
669
|
+
return y.properties && Object.entries(y.properties).forEach(([h, o]) => {
|
|
670
|
+
var G;
|
|
671
|
+
const d = S[h];
|
|
672
|
+
if ((G = y.required) != null && G.includes(h) && d == null) {
|
|
673
|
+
c.push(`Field '${h}' is required`);
|
|
662
674
|
return;
|
|
663
675
|
}
|
|
664
|
-
if (
|
|
665
|
-
if (
|
|
666
|
-
const
|
|
667
|
-
|
|
676
|
+
if (d != null) {
|
|
677
|
+
if (o.type) {
|
|
678
|
+
const Y = o.type, H = typeof d;
|
|
679
|
+
Y === "string" && H !== "string" ? c.push(`Field '${h}' must be a string`) : (Y === "number" || Y === "integer") && H !== "number" ? c.push(`Field '${h}' must be a number`) : Y === "boolean" && H !== "boolean" ? c.push(`Field '${h}' must be a boolean`) : Y === "array" && !Array.isArray(d) && c.push(`Field '${h}' must be an array`);
|
|
668
680
|
}
|
|
669
|
-
|
|
670
|
-
`Field '${
|
|
671
|
-
),
|
|
672
|
-
`Field '${
|
|
673
|
-
),
|
|
681
|
+
o.minLength !== void 0 && typeof d == "string" && d.length < o.minLength && c.push(
|
|
682
|
+
`Field '${h}' must be at least ${o.minLength} characters long`
|
|
683
|
+
), o.maxLength !== void 0 && typeof d == "string" && d.length > o.maxLength && c.push(
|
|
684
|
+
`Field '${h}' must be no more than ${o.maxLength} characters long`
|
|
685
|
+
), o.minimum !== void 0 && typeof d == "number" && d < o.minimum && c.push(`Field '${h}' must be at least ${o.minimum}`), o.maximum !== void 0 && typeof d == "number" && d > o.maximum && c.push(`Field '${h}' must be no more than ${o.maximum}`), o.pattern && typeof d == "string" && (new RegExp(o.pattern).test(d) || c.push(`Field '${h}' does not match the required pattern`)), o.enum && !o.enum.includes(d) && c.push(`Field '${h}' must be one of: ${o.enum.join(", ")}`);
|
|
674
686
|
}
|
|
675
687
|
}), {
|
|
676
|
-
isValid:
|
|
677
|
-
errors:
|
|
688
|
+
isValid: c.length === 0,
|
|
689
|
+
errors: c
|
|
678
690
|
};
|
|
679
691
|
} catch {
|
|
680
692
|
return {
|
|
@@ -683,276 +695,321 @@ function rt({ config: i, children: e }) {
|
|
|
683
695
|
};
|
|
684
696
|
}
|
|
685
697
|
},
|
|
686
|
-
[
|
|
698
|
+
[y]
|
|
687
699
|
);
|
|
688
|
-
|
|
689
|
-
!i.initialTenant &&
|
|
690
|
-
}, [i.initialTenant,
|
|
691
|
-
|
|
692
|
-
}, [
|
|
693
|
-
const
|
|
700
|
+
Z(() => {
|
|
701
|
+
!i.initialTenant && u ? x(u) : !i.initialTenant && !u && (b(null), f(null), L(!1));
|
|
702
|
+
}, [i.initialTenant, u, x]), Z(() => {
|
|
703
|
+
a != null && a.id ? F() : (M(null), g(null), v(!1));
|
|
704
|
+
}, [a == null ? void 0 : a.id, F]);
|
|
705
|
+
const q = _(() => ({
|
|
694
706
|
// Tenant info
|
|
695
|
-
tenant:
|
|
696
|
-
tenantSlug:
|
|
697
|
-
isTenantLoading:
|
|
707
|
+
tenant: a,
|
|
708
|
+
tenantSlug: u,
|
|
709
|
+
isTenantLoading: E,
|
|
698
710
|
tenantError: P,
|
|
699
711
|
retryTenant: () => {
|
|
700
|
-
|
|
712
|
+
u && x(u);
|
|
701
713
|
},
|
|
702
714
|
// Settings
|
|
703
|
-
settings:
|
|
704
|
-
settingsSchema:
|
|
705
|
-
isSettingsLoading:
|
|
706
|
-
settingsError:
|
|
715
|
+
settings: m,
|
|
716
|
+
settingsSchema: y,
|
|
717
|
+
isSettingsLoading: w,
|
|
718
|
+
settingsError: I,
|
|
707
719
|
// Actions
|
|
708
|
-
refreshSettings:
|
|
720
|
+
refreshSettings: B,
|
|
709
721
|
// Validation
|
|
710
|
-
validateSettings:
|
|
722
|
+
validateSettings: z
|
|
711
723
|
}), [
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
724
|
+
a,
|
|
725
|
+
u,
|
|
726
|
+
E,
|
|
715
727
|
P,
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
728
|
+
m,
|
|
729
|
+
y,
|
|
730
|
+
w,
|
|
731
|
+
I,
|
|
732
|
+
B,
|
|
733
|
+
z
|
|
722
734
|
]);
|
|
723
|
-
if (
|
|
724
|
-
return /* @__PURE__ */
|
|
735
|
+
if (E)
|
|
736
|
+
return /* @__PURE__ */ n(D, { children: i.loadingFallback || /* @__PURE__ */ n(Ie, {}) });
|
|
725
737
|
if (P) {
|
|
726
|
-
const
|
|
727
|
-
return /* @__PURE__ */
|
|
738
|
+
const S = typeof i.errorFallback == "function" ? i.errorFallback(P, () => x(u || "")) : i.errorFallback || /* @__PURE__ */ n(Fe, { error: P, retry: () => x(u || "") });
|
|
739
|
+
return /* @__PURE__ */ n(D, { children: S });
|
|
728
740
|
}
|
|
729
|
-
return /* @__PURE__ */
|
|
741
|
+
return /* @__PURE__ */ n(ve.Provider, { value: q, children: e });
|
|
730
742
|
}
|
|
731
|
-
function
|
|
732
|
-
const i =
|
|
743
|
+
function ge() {
|
|
744
|
+
const i = le(ve);
|
|
733
745
|
if (!i)
|
|
734
746
|
throw new Error("useTenant must be used within a TenantProvider");
|
|
735
747
|
return i;
|
|
736
748
|
}
|
|
737
|
-
const
|
|
738
|
-
function
|
|
739
|
-
const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings:
|
|
749
|
+
const ft = ge;
|
|
750
|
+
function mt() {
|
|
751
|
+
const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: s } = ge();
|
|
740
752
|
return {
|
|
741
753
|
settings: i,
|
|
742
754
|
settingsSchema: e,
|
|
743
755
|
isLoading: t,
|
|
744
756
|
error: r,
|
|
745
|
-
validateSettings:
|
|
757
|
+
validateSettings: s
|
|
746
758
|
};
|
|
747
759
|
}
|
|
748
|
-
function
|
|
749
|
-
const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant:
|
|
760
|
+
function re() {
|
|
761
|
+
const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: s } = ge();
|
|
750
762
|
return {
|
|
751
763
|
tenant: i,
|
|
752
764
|
tenantSlug: e,
|
|
753
765
|
isLoading: t,
|
|
754
766
|
error: r,
|
|
755
|
-
retry:
|
|
767
|
+
retry: s
|
|
756
768
|
};
|
|
757
769
|
}
|
|
758
|
-
const
|
|
759
|
-
function
|
|
760
|
-
const { appId: t, baseUrl: r } =
|
|
761
|
-
const
|
|
770
|
+
const Se = ae(null);
|
|
771
|
+
function yt({ config: i = {}, children: e }) {
|
|
772
|
+
const { appId: t, baseUrl: r } = ne(), s = re(), a = (s == null ? void 0 : s.tenantSlug) || null, [b, E] = p(i.initialRoles || []), [L, P] = p(!i.initialRoles), [f, m] = p(null), [M, w] = p(!1), [v, I] = p(null), g = _(() => {
|
|
773
|
+
const S = a ? `auth_tokens_${a}` : "auth_tokens", c = {
|
|
762
774
|
get: () => {
|
|
763
775
|
try {
|
|
764
|
-
const
|
|
765
|
-
return
|
|
776
|
+
const h = localStorage.getItem(S);
|
|
777
|
+
return h ? JSON.parse(h) : null;
|
|
766
778
|
} catch {
|
|
767
779
|
return null;
|
|
768
780
|
}
|
|
769
781
|
},
|
|
770
|
-
set: (
|
|
782
|
+
set: (h) => {
|
|
771
783
|
try {
|
|
772
|
-
localStorage.setItem(
|
|
784
|
+
localStorage.setItem(S, JSON.stringify(h));
|
|
773
785
|
} catch {
|
|
774
786
|
}
|
|
775
787
|
},
|
|
776
788
|
clear: () => {
|
|
777
789
|
try {
|
|
778
|
-
localStorage.removeItem(
|
|
790
|
+
localStorage.removeItem(S);
|
|
779
791
|
} catch {
|
|
780
792
|
}
|
|
781
793
|
}
|
|
782
794
|
};
|
|
783
|
-
return new
|
|
795
|
+
return new Le({
|
|
784
796
|
onRefreshFailed: i.onRefreshFailed,
|
|
785
|
-
tokenStorage:
|
|
797
|
+
tokenStorage: c,
|
|
786
798
|
baseUrl: r
|
|
787
799
|
});
|
|
788
|
-
}, [
|
|
789
|
-
const
|
|
790
|
-
return
|
|
791
|
-
}, [r,
|
|
792
|
-
|
|
793
|
-
console.log("AuthProvider - userPermissions changed:",
|
|
794
|
-
}, [
|
|
795
|
-
const
|
|
796
|
-
const
|
|
800
|
+
}, [a, r, i.onRefreshFailed]), U = _(() => {
|
|
801
|
+
const S = new te(r);
|
|
802
|
+
return S.setSessionManager(g), S;
|
|
803
|
+
}, [r, g]), u = _(() => new Re(new te(r)), [r]), y = _(() => new Ce(U, g), [U, g]), x = _(() => new pe(new te(r)), [r]), F = _(() => f || g.getUser(), [f, g]), B = _(() => F != null && F.roleId && b.find((S) => S.id === F.roleId) || null, [F, b]), z = _(() => (B == null ? void 0 : B.permissions) || [], [B]);
|
|
804
|
+
Z(() => {
|
|
805
|
+
console.log("AuthProvider - userPermissions changed:", z);
|
|
806
|
+
}, [z]);
|
|
807
|
+
const q = _(() => {
|
|
808
|
+
const S = async () => {
|
|
797
809
|
try {
|
|
798
|
-
|
|
799
|
-
const
|
|
800
|
-
if (!(
|
|
810
|
+
w(!0), I(null);
|
|
811
|
+
const A = g.getUser();
|
|
812
|
+
if (!(A != null && A.id))
|
|
801
813
|
throw new Error("No user ID available in session");
|
|
802
|
-
const $ = await
|
|
803
|
-
|
|
804
|
-
} catch (
|
|
805
|
-
const $ =
|
|
806
|
-
|
|
814
|
+
const $ = await y.getUserById(A.id);
|
|
815
|
+
m($), g.setUser($);
|
|
816
|
+
} catch (A) {
|
|
817
|
+
const $ = A instanceof Error ? A : new Error("Failed to load user data");
|
|
818
|
+
I($), console.error("Failed to load user data:", $);
|
|
807
819
|
} finally {
|
|
808
|
-
|
|
820
|
+
w(!1);
|
|
809
821
|
}
|
|
810
|
-
},
|
|
811
|
-
await
|
|
812
|
-
},
|
|
813
|
-
const
|
|
814
|
-
|
|
822
|
+
}, c = async () => {
|
|
823
|
+
await S();
|
|
824
|
+
}, h = async (A, $, Q, X) => {
|
|
825
|
+
const W = await u.login({
|
|
826
|
+
username: A,
|
|
815
827
|
password: $,
|
|
816
|
-
|
|
828
|
+
appId: Q,
|
|
829
|
+
tenantId: X
|
|
817
830
|
});
|
|
818
|
-
if (
|
|
819
|
-
accessToken:
|
|
820
|
-
refreshToken:
|
|
821
|
-
expiresIn:
|
|
822
|
-
}),
|
|
823
|
-
|
|
831
|
+
if (g.setTokens({
|
|
832
|
+
accessToken: W.accessToken,
|
|
833
|
+
refreshToken: W.refreshToken,
|
|
834
|
+
expiresIn: W.expiresIn
|
|
835
|
+
}), W.user) {
|
|
836
|
+
g.setUser(W.user), m(W.user);
|
|
824
837
|
try {
|
|
825
|
-
await
|
|
838
|
+
await S();
|
|
826
839
|
} catch (ee) {
|
|
827
840
|
console.warn("Failed to load complete user data after login:", ee);
|
|
828
841
|
}
|
|
829
842
|
}
|
|
830
|
-
return
|
|
831
|
-
},
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
await
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
843
|
+
return W;
|
|
844
|
+
}, o = async (A, $, Q, X, W, ee, ce) => {
|
|
845
|
+
if (!A && !$)
|
|
846
|
+
throw new Error("Either email or phoneNumber is required");
|
|
847
|
+
if (!Q || !X)
|
|
848
|
+
throw new Error("Name and password are required");
|
|
849
|
+
return await u.signup({
|
|
850
|
+
email: A,
|
|
851
|
+
phoneNumber: $,
|
|
852
|
+
name: Q,
|
|
853
|
+
password: X,
|
|
854
|
+
tenantId: W,
|
|
855
|
+
lastName: ee,
|
|
856
|
+
appId: ce
|
|
857
|
+
});
|
|
858
|
+
}, d = async (A, $, Q, X, W, ee, ce) => {
|
|
859
|
+
if (!A && !$)
|
|
860
|
+
throw new Error("Either email or phoneNumber is required");
|
|
861
|
+
if (!Q || !X || !W)
|
|
862
|
+
throw new Error("Name, password, and tenantName are required");
|
|
863
|
+
return await u.signupTenantAdmin({
|
|
864
|
+
email: A,
|
|
865
|
+
phoneNumber: $,
|
|
866
|
+
name: Q,
|
|
867
|
+
password: X,
|
|
868
|
+
tenantName: W,
|
|
869
|
+
appId: ce,
|
|
870
|
+
lastName: ee
|
|
871
|
+
});
|
|
872
|
+
}, G = async (A, $) => {
|
|
873
|
+
const Q = await g.getAuthHeaders();
|
|
874
|
+
await u.changePassword({ currentPassword: A, newPassword: $ }, Q);
|
|
875
|
+
}, Y = async (A, $) => {
|
|
876
|
+
await u.requestPasswordReset({ email: A, tenantId: $ });
|
|
877
|
+
}, H = async (A, $) => {
|
|
878
|
+
await u.confirmPasswordReset({ token: A, newPassword: $ });
|
|
879
|
+
}, C = async (A, $, Q, X, W, ee) => await u.sendMagicLink({
|
|
880
|
+
email: A,
|
|
881
|
+
tenantId: $,
|
|
882
|
+
frontendUrl: Q,
|
|
883
|
+
name: X,
|
|
884
|
+
lastName: W,
|
|
885
|
+
appId: ee
|
|
886
|
+
}), k = async (A, $, Q, X) => {
|
|
887
|
+
const W = await u.verifyMagicLink({
|
|
888
|
+
token: A,
|
|
889
|
+
email: $,
|
|
890
|
+
appId: Q,
|
|
891
|
+
tenantId: X
|
|
892
|
+
});
|
|
893
|
+
if (g.setTokens({
|
|
894
|
+
accessToken: W.accessToken,
|
|
895
|
+
refreshToken: W.refreshToken,
|
|
896
|
+
expiresIn: W.expiresIn
|
|
897
|
+
}), W.user) {
|
|
898
|
+
g.setUser(W.user), m(W.user);
|
|
899
|
+
try {
|
|
900
|
+
await S();
|
|
901
|
+
} catch (ee) {
|
|
902
|
+
console.warn("Failed to load complete user data after magic link login:", ee);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
return W;
|
|
906
|
+
}, T = async () => {
|
|
907
|
+
const A = g.getTokens();
|
|
908
|
+
if (!(A != null && A.refreshToken))
|
|
854
909
|
throw new Error("No refresh token available");
|
|
855
|
-
const $ = await
|
|
856
|
-
refreshToken:
|
|
910
|
+
const $ = await u.refreshToken({
|
|
911
|
+
refreshToken: A.refreshToken
|
|
857
912
|
});
|
|
858
|
-
|
|
913
|
+
g.setTokens({
|
|
859
914
|
accessToken: $.accessToken,
|
|
860
|
-
refreshToken: $.refreshToken ||
|
|
915
|
+
refreshToken: $.refreshToken || A.refreshToken,
|
|
861
916
|
expiresIn: $.expiresIn
|
|
862
917
|
});
|
|
863
|
-
},
|
|
864
|
-
|
|
865
|
-
},
|
|
866
|
-
|
|
867
|
-
},
|
|
868
|
-
|
|
869
|
-
},
|
|
918
|
+
}, J = () => {
|
|
919
|
+
g.clearSession(), m(null), I(null);
|
|
920
|
+
}, O = (A) => {
|
|
921
|
+
g.setTokens(A);
|
|
922
|
+
}, j = () => g.hasValidSession(), N = () => {
|
|
923
|
+
g.clearSession(), m(null), I(null);
|
|
924
|
+
}, K = async () => {
|
|
870
925
|
if (t)
|
|
871
926
|
try {
|
|
872
927
|
P(!0);
|
|
873
|
-
const { roles:
|
|
874
|
-
|
|
875
|
-
} catch (
|
|
876
|
-
console.error("Failed to fetch roles:",
|
|
928
|
+
const { roles: A } = await x.getRolesByApp(t);
|
|
929
|
+
E(A);
|
|
930
|
+
} catch (A) {
|
|
931
|
+
console.error("Failed to fetch roles:", A);
|
|
877
932
|
} finally {
|
|
878
933
|
P(!1);
|
|
879
934
|
}
|
|
880
|
-
},
|
|
881
|
-
await
|
|
882
|
-
},
|
|
883
|
-
if (!
|
|
935
|
+
}, R = async () => {
|
|
936
|
+
await K();
|
|
937
|
+
}, V = (A) => {
|
|
938
|
+
if (!z || z.length === 0)
|
|
884
939
|
return !1;
|
|
885
|
-
if (typeof
|
|
886
|
-
return
|
|
887
|
-
const $ = `${
|
|
888
|
-
return
|
|
940
|
+
if (typeof A == "string")
|
|
941
|
+
return z.includes(A);
|
|
942
|
+
const $ = `${A.resource}.${A.action}`;
|
|
943
|
+
return z.includes($);
|
|
889
944
|
};
|
|
890
945
|
return {
|
|
891
|
-
sessionManager:
|
|
892
|
-
authenticatedHttpService:
|
|
893
|
-
login:
|
|
894
|
-
signup:
|
|
895
|
-
signupTenantAdmin:
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
946
|
+
sessionManager: g,
|
|
947
|
+
authenticatedHttpService: U,
|
|
948
|
+
login: h,
|
|
949
|
+
signup: o,
|
|
950
|
+
signupTenantAdmin: d,
|
|
951
|
+
sendMagicLink: C,
|
|
952
|
+
verifyMagicLink: k,
|
|
953
|
+
changePassword: G,
|
|
954
|
+
requestPasswordReset: Y,
|
|
955
|
+
confirmPasswordReset: H,
|
|
956
|
+
refreshToken: T,
|
|
957
|
+
logout: J,
|
|
958
|
+
setTokens: O,
|
|
959
|
+
hasValidSession: j,
|
|
960
|
+
clearSession: N,
|
|
961
|
+
currentUser: f,
|
|
962
|
+
isUserLoading: M,
|
|
963
|
+
userError: v,
|
|
964
|
+
refreshUser: c,
|
|
965
|
+
userRole: B,
|
|
966
|
+
userPermissions: z,
|
|
967
|
+
availableRoles: b,
|
|
968
|
+
rolesLoading: L,
|
|
969
|
+
hasPermission: V,
|
|
970
|
+
hasAnyPermission: (A) => A.some(($) => V($)),
|
|
971
|
+
hasAllPermissions: (A) => A.every(($) => V($)),
|
|
972
|
+
getUserPermissionStrings: () => z || [],
|
|
973
|
+
refreshRoles: R
|
|
917
974
|
};
|
|
918
975
|
}, [
|
|
919
|
-
f,
|
|
920
|
-
L,
|
|
921
|
-
y,
|
|
922
|
-
S,
|
|
923
|
-
k,
|
|
924
|
-
t,
|
|
925
|
-
m,
|
|
926
976
|
g,
|
|
977
|
+
U,
|
|
978
|
+
u,
|
|
979
|
+
y,
|
|
927
980
|
x,
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
981
|
+
t,
|
|
982
|
+
b,
|
|
983
|
+
f,
|
|
984
|
+
M,
|
|
985
|
+
v,
|
|
986
|
+
B,
|
|
987
|
+
z
|
|
931
988
|
]);
|
|
932
|
-
return
|
|
989
|
+
return Z(() => {
|
|
933
990
|
!i.initialRoles && t && (async () => {
|
|
934
991
|
try {
|
|
935
992
|
P(!0);
|
|
936
|
-
const
|
|
937
|
-
|
|
938
|
-
} catch (
|
|
939
|
-
console.error("Failed to fetch roles:",
|
|
993
|
+
const c = new te(r), h = new pe(c), { roles: o } = await h.getRolesByApp(t);
|
|
994
|
+
E(o);
|
|
995
|
+
} catch (c) {
|
|
996
|
+
console.error("Failed to fetch roles:", c);
|
|
940
997
|
} finally {
|
|
941
998
|
P(!1);
|
|
942
999
|
}
|
|
943
1000
|
})();
|
|
944
|
-
}, [t, r, i.initialRoles]),
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
}, [
|
|
1001
|
+
}, [t, r, i.initialRoles]), Z(() => {
|
|
1002
|
+
const S = g.getUser();
|
|
1003
|
+
S && g.hasValidSession() && m(S);
|
|
1004
|
+
}, [g]), /* @__PURE__ */ n(Se.Provider, { value: q, children: e });
|
|
948
1005
|
}
|
|
949
|
-
function
|
|
950
|
-
const i =
|
|
1006
|
+
function ie() {
|
|
1007
|
+
const i = le(Se);
|
|
951
1008
|
if (!i)
|
|
952
1009
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
953
1010
|
return i;
|
|
954
1011
|
}
|
|
955
|
-
class
|
|
1012
|
+
class He {
|
|
956
1013
|
constructor(e, t) {
|
|
957
1014
|
this.httpService = e, this.sessionManager = t;
|
|
958
1015
|
}
|
|
@@ -973,12 +1030,12 @@ class Ee {
|
|
|
973
1030
|
throw new Error("SessionManager is required for private endpoints");
|
|
974
1031
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
975
1032
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
|
|
976
|
-
const
|
|
1033
|
+
const s = `/feature-flags/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
|
|
977
1034
|
headers: t
|
|
978
1035
|
});
|
|
979
1036
|
return {
|
|
980
|
-
featureFlags:
|
|
981
|
-
meta:
|
|
1037
|
+
featureFlags: a.data,
|
|
1038
|
+
meta: a.meta
|
|
982
1039
|
};
|
|
983
1040
|
}
|
|
984
1041
|
async getFeatureFlagById(e) {
|
|
@@ -1015,8 +1072,8 @@ class Ee {
|
|
|
1015
1072
|
throw new Error("Tenant ID and App ID are required");
|
|
1016
1073
|
const r = new URLSearchParams();
|
|
1017
1074
|
r.append("tenantId", e), r.append("appId", t);
|
|
1018
|
-
const
|
|
1019
|
-
return (await this.httpService.get(
|
|
1075
|
+
const s = `/tenant-feature-flags${r.toString() ? `?${r.toString()}` : ""}`;
|
|
1076
|
+
return (await this.httpService.get(s, {
|
|
1020
1077
|
headers: { "X-Tenant-ID": e }
|
|
1021
1078
|
})).data;
|
|
1022
1079
|
}
|
|
@@ -1024,66 +1081,66 @@ class Ee {
|
|
|
1024
1081
|
async getTenantFeatureFlag(e, t, r) {
|
|
1025
1082
|
if (!e || !t || !r)
|
|
1026
1083
|
throw new Error("Flag Key, Tenant ID and App ID are required");
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1029
|
-
const
|
|
1030
|
-
return (await this.httpService.get(
|
|
1084
|
+
const s = new URLSearchParams();
|
|
1085
|
+
s.append("tenantId", t), s.append("appId", r);
|
|
1086
|
+
const a = `/tenant-feature-flags/${e}${s.toString() ? `?${s.toString()}` : ""}`;
|
|
1087
|
+
return (await this.httpService.get(a, {
|
|
1031
1088
|
headers: { "X-Tenant-ID": t }
|
|
1032
1089
|
})).data;
|
|
1033
1090
|
}
|
|
1034
1091
|
}
|
|
1035
|
-
const
|
|
1036
|
-
function
|
|
1037
|
-
const { baseUrl: t, appId: r } =
|
|
1038
|
-
const
|
|
1039
|
-
return new
|
|
1040
|
-
}, [t]),
|
|
1041
|
-
if (!(
|
|
1042
|
-
|
|
1092
|
+
const xe = ae(null);
|
|
1093
|
+
function bt({ config: i = {}, children: e }) {
|
|
1094
|
+
const { baseUrl: t, appId: r } = ne(), { tenant: s } = re(), [a, b] = p([]), [E, L] = p(!1), [P, f] = p(null), m = _(() => {
|
|
1095
|
+
const v = new te(t);
|
|
1096
|
+
return new He(v);
|
|
1097
|
+
}, [t]), M = async () => {
|
|
1098
|
+
if (!(s != null && s.id)) {
|
|
1099
|
+
b([]);
|
|
1043
1100
|
return;
|
|
1044
1101
|
}
|
|
1045
|
-
|
|
1102
|
+
L(!0), f(null);
|
|
1046
1103
|
try {
|
|
1047
|
-
const
|
|
1048
|
-
|
|
1049
|
-
} catch (
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1104
|
+
const v = await m.getTenantFeatureFlags(s.id, r);
|
|
1105
|
+
b(v);
|
|
1106
|
+
} catch (v) {
|
|
1107
|
+
const I = v instanceof Error ? v.message : "Failed to fetch feature flags";
|
|
1108
|
+
f(I), i.onError && i.onError(v instanceof Error ? v : new Error(I));
|
|
1052
1109
|
} finally {
|
|
1053
|
-
|
|
1110
|
+
L(!1);
|
|
1054
1111
|
}
|
|
1055
1112
|
};
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
const
|
|
1059
|
-
return () => clearInterval(
|
|
1060
|
-
}, [
|
|
1061
|
-
const
|
|
1062
|
-
featureFlags:
|
|
1063
|
-
loading:
|
|
1113
|
+
Z(() => {
|
|
1114
|
+
M();
|
|
1115
|
+
const v = i.refreshInterval || 5 * 60 * 1e3, I = setInterval(M, v);
|
|
1116
|
+
return () => clearInterval(I);
|
|
1117
|
+
}, [s == null ? void 0 : s.id, i.refreshInterval]);
|
|
1118
|
+
const w = _(() => ({
|
|
1119
|
+
featureFlags: a,
|
|
1120
|
+
loading: E,
|
|
1064
1121
|
error: P,
|
|
1065
|
-
isEnabled: (
|
|
1066
|
-
const
|
|
1067
|
-
return (
|
|
1122
|
+
isEnabled: (u) => {
|
|
1123
|
+
const y = a.find((x) => x.key === u);
|
|
1124
|
+
return (y == null ? void 0 : y.value) === !0;
|
|
1068
1125
|
},
|
|
1069
|
-
getFlag: (
|
|
1070
|
-
getFlagState: (
|
|
1071
|
-
const
|
|
1072
|
-
return
|
|
1126
|
+
getFlag: (u) => a.find((y) => y.key === u),
|
|
1127
|
+
getFlagState: (u) => {
|
|
1128
|
+
const y = a.find((x) => x.key === u);
|
|
1129
|
+
return y ? y.value ? "enabled" : "disabled" : "not_found";
|
|
1073
1130
|
},
|
|
1074
1131
|
refresh: async () => {
|
|
1075
|
-
await
|
|
1132
|
+
await M();
|
|
1076
1133
|
}
|
|
1077
|
-
}), [
|
|
1078
|
-
return /* @__PURE__ */
|
|
1134
|
+
}), [a, E, P]);
|
|
1135
|
+
return /* @__PURE__ */ n(xe.Provider, { value: w, children: e });
|
|
1079
1136
|
}
|
|
1080
|
-
function
|
|
1081
|
-
const i =
|
|
1137
|
+
function $e() {
|
|
1138
|
+
const i = le(xe);
|
|
1082
1139
|
if (!i)
|
|
1083
1140
|
throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
|
|
1084
1141
|
return i;
|
|
1085
1142
|
}
|
|
1086
|
-
class
|
|
1143
|
+
class De {
|
|
1087
1144
|
constructor(e, t) {
|
|
1088
1145
|
this.httpService = e, this.sessionManager = t;
|
|
1089
1146
|
}
|
|
@@ -1149,64 +1206,64 @@ class Fe {
|
|
|
1149
1206
|
)).data;
|
|
1150
1207
|
}
|
|
1151
1208
|
}
|
|
1152
|
-
const
|
|
1153
|
-
function
|
|
1154
|
-
const { baseUrl: t } =
|
|
1155
|
-
const
|
|
1156
|
-
return new
|
|
1157
|
-
}, [t]),
|
|
1209
|
+
const ke = ae(void 0);
|
|
1210
|
+
function wt({ config: i = {}, children: e }) {
|
|
1211
|
+
const { baseUrl: t } = ne(), { tenant: r } = re(), [s, a] = p(null), [b, E] = p(!1), [L, P] = p(null), f = _(() => {
|
|
1212
|
+
const w = new te(t);
|
|
1213
|
+
return new De(w);
|
|
1214
|
+
}, [t]), m = async () => {
|
|
1158
1215
|
if (!(r != null && r.id)) {
|
|
1159
|
-
|
|
1216
|
+
a(null);
|
|
1160
1217
|
return;
|
|
1161
1218
|
}
|
|
1162
|
-
|
|
1219
|
+
E(!0), P(null);
|
|
1163
1220
|
try {
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
} catch (
|
|
1167
|
-
const
|
|
1168
|
-
P(
|
|
1221
|
+
const w = await f.getTenantSubscriptionFeatures(r.id);
|
|
1222
|
+
a(w);
|
|
1223
|
+
} catch (w) {
|
|
1224
|
+
const v = w instanceof Error ? w.message : "Failed to fetch subscription";
|
|
1225
|
+
P(v), i.onError && i.onError(w instanceof Error ? w : new Error(v));
|
|
1169
1226
|
} finally {
|
|
1170
|
-
|
|
1227
|
+
E(!1);
|
|
1171
1228
|
}
|
|
1172
1229
|
};
|
|
1173
|
-
|
|
1174
|
-
if (
|
|
1175
|
-
const
|
|
1176
|
-
return () => clearInterval(
|
|
1230
|
+
Z(() => {
|
|
1231
|
+
if (m(), !i.refreshInterval) return;
|
|
1232
|
+
const w = i.refreshInterval || 10 * 60 * 1e3, v = setInterval(m, w);
|
|
1233
|
+
return () => clearInterval(v);
|
|
1177
1234
|
}, [r == null ? void 0 : r.id, i.refreshInterval]);
|
|
1178
|
-
const
|
|
1179
|
-
const
|
|
1235
|
+
const M = _(() => {
|
|
1236
|
+
const w = (s == null ? void 0 : s.features) || [];
|
|
1180
1237
|
return {
|
|
1181
|
-
subscription:
|
|
1182
|
-
features:
|
|
1183
|
-
loading:
|
|
1184
|
-
error:
|
|
1185
|
-
isFeatureEnabled: (
|
|
1186
|
-
const
|
|
1187
|
-
return
|
|
1238
|
+
subscription: s,
|
|
1239
|
+
features: w,
|
|
1240
|
+
loading: b,
|
|
1241
|
+
error: L,
|
|
1242
|
+
isFeatureEnabled: (y) => {
|
|
1243
|
+
const x = w.find((F) => F.key === y);
|
|
1244
|
+
return x ? x.type === "BOOLEAN" || x.type === "boolean" ? x.value === !0 : !!x.value : !1;
|
|
1188
1245
|
},
|
|
1189
|
-
getFeature: (
|
|
1190
|
-
getFeatureValue: (
|
|
1191
|
-
const
|
|
1192
|
-
return
|
|
1246
|
+
getFeature: (y) => w.find((x) => x.key === y),
|
|
1247
|
+
getFeatureValue: (y, x) => {
|
|
1248
|
+
const F = w.find((B) => B.key === y);
|
|
1249
|
+
return F ? F.value : x;
|
|
1193
1250
|
},
|
|
1194
|
-
hasAllowedPlan: (
|
|
1251
|
+
hasAllowedPlan: (y) => !s || !s.isActive ? !1 : y.includes(s.planId),
|
|
1195
1252
|
refresh: async () => {
|
|
1196
|
-
await
|
|
1253
|
+
await m();
|
|
1197
1254
|
}
|
|
1198
1255
|
};
|
|
1199
|
-
}, [
|
|
1200
|
-
return /* @__PURE__ */
|
|
1256
|
+
}, [s, b, L]);
|
|
1257
|
+
return /* @__PURE__ */ n(ke.Provider, { value: M, children: e });
|
|
1201
1258
|
}
|
|
1202
|
-
function
|
|
1203
|
-
const i =
|
|
1259
|
+
function Be() {
|
|
1260
|
+
const i = le(ke);
|
|
1204
1261
|
if (i === void 0)
|
|
1205
1262
|
throw new Error("useSubscription must be used within a SubscriptionProvider");
|
|
1206
1263
|
return i;
|
|
1207
1264
|
}
|
|
1208
|
-
var
|
|
1209
|
-
const
|
|
1265
|
+
var se = /* @__PURE__ */ ((i) => (i.SUPERUSER = "SUPERUSER", i.TENANT_ADMIN = "TENANT_ADMIN", i.USER = "USER", i))(se || {});
|
|
1266
|
+
const me = () => /* @__PURE__ */ l(
|
|
1210
1267
|
"div",
|
|
1211
1268
|
{
|
|
1212
1269
|
style: {
|
|
@@ -1222,10 +1279,10 @@ const ue = () => /* @__PURE__ */ c(
|
|
|
1222
1279
|
margin: "20px 0"
|
|
1223
1280
|
},
|
|
1224
1281
|
children: [
|
|
1225
|
-
/* @__PURE__ */
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1228
|
-
/* @__PURE__ */
|
|
1282
|
+
/* @__PURE__ */ n("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "🔒" }),
|
|
1283
|
+
/* @__PURE__ */ n("h3", { style: { color: "#495057", marginBottom: "10px" }, children: "Access Required" }),
|
|
1284
|
+
/* @__PURE__ */ n("p", { style: { color: "#6c757d", fontSize: "14px", marginBottom: "15px" }, children: "You need to be signed in to view this content." }),
|
|
1285
|
+
/* @__PURE__ */ n(
|
|
1229
1286
|
"button",
|
|
1230
1287
|
{
|
|
1231
1288
|
style: {
|
|
@@ -1243,11 +1300,11 @@ const ue = () => /* @__PURE__ */ c(
|
|
|
1243
1300
|
)
|
|
1244
1301
|
]
|
|
1245
1302
|
}
|
|
1246
|
-
),
|
|
1303
|
+
), ye = ({
|
|
1247
1304
|
userType: i,
|
|
1248
1305
|
minUserType: e,
|
|
1249
1306
|
missingPermissions: t
|
|
1250
|
-
}) => /* @__PURE__ */
|
|
1307
|
+
}) => /* @__PURE__ */ l(
|
|
1251
1308
|
"div",
|
|
1252
1309
|
{
|
|
1253
1310
|
style: {
|
|
@@ -1263,57 +1320,57 @@ const ue = () => /* @__PURE__ */ c(
|
|
|
1263
1320
|
margin: "20px 0"
|
|
1264
1321
|
},
|
|
1265
1322
|
children: [
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */
|
|
1268
|
-
e && i ? /* @__PURE__ */
|
|
1269
|
-
/* @__PURE__ */
|
|
1323
|
+
/* @__PURE__ */ n("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "⚠️" }),
|
|
1324
|
+
/* @__PURE__ */ n("h3", { style: { color: "#856404", marginBottom: "10px" }, children: "Insufficient Permissions" }),
|
|
1325
|
+
e && i ? /* @__PURE__ */ l(D, { children: [
|
|
1326
|
+
/* @__PURE__ */ l("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: [
|
|
1270
1327
|
"This content requires ",
|
|
1271
|
-
/* @__PURE__ */
|
|
1328
|
+
/* @__PURE__ */ n("strong", { children: e }),
|
|
1272
1329
|
" access level or higher."
|
|
1273
1330
|
] }),
|
|
1274
|
-
/* @__PURE__ */
|
|
1331
|
+
/* @__PURE__ */ l("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1275
1332
|
"Your current access level: ",
|
|
1276
|
-
/* @__PURE__ */
|
|
1333
|
+
/* @__PURE__ */ n("strong", { children: i })
|
|
1277
1334
|
] })
|
|
1278
|
-
] }) : /* @__PURE__ */
|
|
1279
|
-
/* @__PURE__ */
|
|
1280
|
-
t && t.length > 0 && /* @__PURE__ */
|
|
1335
|
+
] }) : /* @__PURE__ */ l(D, { children: [
|
|
1336
|
+
/* @__PURE__ */ n("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: "You don't have the required permissions to view this content." }),
|
|
1337
|
+
t && t.length > 0 && /* @__PURE__ */ l("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1281
1338
|
"Required permissions: ",
|
|
1282
|
-
/* @__PURE__ */
|
|
1339
|
+
/* @__PURE__ */ n("strong", { children: t.join(", ") })
|
|
1283
1340
|
] })
|
|
1284
1341
|
] })
|
|
1285
1342
|
]
|
|
1286
1343
|
}
|
|
1287
|
-
),
|
|
1344
|
+
), Ne = (i, e) => {
|
|
1288
1345
|
const t = {
|
|
1289
|
-
[
|
|
1290
|
-
[
|
|
1291
|
-
[
|
|
1346
|
+
[se.USER]: 1,
|
|
1347
|
+
[se.TENANT_ADMIN]: 2,
|
|
1348
|
+
[se.SUPERUSER]: 3
|
|
1292
1349
|
};
|
|
1293
1350
|
return t[i] >= t[e];
|
|
1294
1351
|
};
|
|
1295
|
-
function
|
|
1352
|
+
function vt({
|
|
1296
1353
|
children: i,
|
|
1297
1354
|
fallback: e,
|
|
1298
1355
|
minUserType: t,
|
|
1299
1356
|
requiredPermissions: r,
|
|
1300
|
-
requireAllPermissions:
|
|
1357
|
+
requireAllPermissions: s = !1
|
|
1301
1358
|
}) {
|
|
1302
|
-
const { hasValidSession:
|
|
1303
|
-
if (!
|
|
1304
|
-
return /* @__PURE__ */
|
|
1305
|
-
const
|
|
1306
|
-
if (!
|
|
1307
|
-
return /* @__PURE__ */
|
|
1308
|
-
if (t && !
|
|
1309
|
-
return /* @__PURE__ */
|
|
1310
|
-
if (r && r.length > 0 && !(
|
|
1311
|
-
const
|
|
1312
|
-
return /* @__PURE__ */
|
|
1313
|
-
}
|
|
1314
|
-
return /* @__PURE__ */
|
|
1359
|
+
const { hasValidSession: a, sessionManager: b, hasPermission: E, hasAnyPermission: L, hasAllPermissions: P } = ie();
|
|
1360
|
+
if (!a())
|
|
1361
|
+
return /* @__PURE__ */ n(D, { children: e || /* @__PURE__ */ n(me, {}) });
|
|
1362
|
+
const f = b.getUser();
|
|
1363
|
+
if (!f)
|
|
1364
|
+
return /* @__PURE__ */ n(D, { children: e || /* @__PURE__ */ n(me, {}) });
|
|
1365
|
+
if (t && !Ne(f.userType, t))
|
|
1366
|
+
return /* @__PURE__ */ n(ye, { userType: f.userType, minUserType: t });
|
|
1367
|
+
if (r && r.length > 0 && !(s ? P(r) : L(r))) {
|
|
1368
|
+
const M = r.filter((w) => !E(w)).map((w) => typeof w == "string" ? w : w.name);
|
|
1369
|
+
return /* @__PURE__ */ n(ye, { missingPermissions: M });
|
|
1370
|
+
}
|
|
1371
|
+
return /* @__PURE__ */ n(D, { children: i });
|
|
1315
1372
|
}
|
|
1316
|
-
const
|
|
1373
|
+
const qe = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1317
1374
|
"div",
|
|
1318
1375
|
{
|
|
1319
1376
|
style: {
|
|
@@ -1326,7 +1383,7 @@ const Ce = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1326
1383
|
backgroundColor: "#f9fafb",
|
|
1327
1384
|
textAlign: "center"
|
|
1328
1385
|
},
|
|
1329
|
-
children: /* @__PURE__ */
|
|
1386
|
+
children: /* @__PURE__ */ l(
|
|
1330
1387
|
"div",
|
|
1331
1388
|
{
|
|
1332
1389
|
style: {
|
|
@@ -1337,10 +1394,10 @@ const Ce = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1337
1394
|
maxWidth: "400px"
|
|
1338
1395
|
},
|
|
1339
1396
|
children: [
|
|
1340
|
-
/* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
/* @__PURE__ */
|
|
1343
|
-
/* @__PURE__ */
|
|
1397
|
+
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🔒" }),
|
|
1398
|
+
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Access Required" }),
|
|
1399
|
+
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You need to be signed in to access this page." }),
|
|
1400
|
+
/* @__PURE__ */ l("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1344
1401
|
"Redirecting to ",
|
|
1345
1402
|
i,
|
|
1346
1403
|
"..."
|
|
@@ -1349,11 +1406,11 @@ const Ce = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1349
1406
|
}
|
|
1350
1407
|
)
|
|
1351
1408
|
}
|
|
1352
|
-
),
|
|
1409
|
+
), be = ({
|
|
1353
1410
|
userType: i,
|
|
1354
1411
|
minUserType: e,
|
|
1355
1412
|
missingPermissions: t
|
|
1356
|
-
}) => /* @__PURE__ */
|
|
1413
|
+
}) => /* @__PURE__ */ n(
|
|
1357
1414
|
"div",
|
|
1358
1415
|
{
|
|
1359
1416
|
style: {
|
|
@@ -1366,7 +1423,7 @@ const Ce = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1366
1423
|
backgroundColor: "#f9fafb",
|
|
1367
1424
|
textAlign: "center"
|
|
1368
1425
|
},
|
|
1369
|
-
children: /* @__PURE__ */
|
|
1426
|
+
children: /* @__PURE__ */ l(
|
|
1370
1427
|
"div",
|
|
1371
1428
|
{
|
|
1372
1429
|
style: {
|
|
@@ -1377,63 +1434,63 @@ const Ce = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1377
1434
|
maxWidth: "400px"
|
|
1378
1435
|
},
|
|
1379
1436
|
children: [
|
|
1380
|
-
/* @__PURE__ */
|
|
1381
|
-
/* @__PURE__ */
|
|
1382
|
-
e && i ? /* @__PURE__ */
|
|
1383
|
-
/* @__PURE__ */
|
|
1437
|
+
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "⚠️" }),
|
|
1438
|
+
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Insufficient Permissions" }),
|
|
1439
|
+
e && i ? /* @__PURE__ */ l(D, { children: [
|
|
1440
|
+
/* @__PURE__ */ l("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: [
|
|
1384
1441
|
"This page requires ",
|
|
1385
|
-
/* @__PURE__ */
|
|
1442
|
+
/* @__PURE__ */ n("strong", { children: e }),
|
|
1386
1443
|
" access level or higher."
|
|
1387
1444
|
] }),
|
|
1388
|
-
/* @__PURE__ */
|
|
1445
|
+
/* @__PURE__ */ l("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1389
1446
|
"Your current access level: ",
|
|
1390
|
-
/* @__PURE__ */
|
|
1447
|
+
/* @__PURE__ */ n("strong", { children: i })
|
|
1391
1448
|
] })
|
|
1392
|
-
] }) : /* @__PURE__ */
|
|
1393
|
-
/* @__PURE__ */
|
|
1394
|
-
t && t.length > 0 && /* @__PURE__ */
|
|
1449
|
+
] }) : /* @__PURE__ */ l(D, { children: [
|
|
1450
|
+
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: "You don't have the required permissions to access this page." }),
|
|
1451
|
+
t && t.length > 0 && /* @__PURE__ */ l("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1395
1452
|
"Required permissions: ",
|
|
1396
|
-
/* @__PURE__ */
|
|
1453
|
+
/* @__PURE__ */ n("strong", { children: t.join(", ") })
|
|
1397
1454
|
] })
|
|
1398
1455
|
] })
|
|
1399
1456
|
]
|
|
1400
1457
|
}
|
|
1401
1458
|
)
|
|
1402
1459
|
}
|
|
1403
|
-
),
|
|
1460
|
+
), Ue = (i, e) => {
|
|
1404
1461
|
const t = {
|
|
1405
|
-
[
|
|
1406
|
-
[
|
|
1407
|
-
[
|
|
1462
|
+
[se.USER]: 1,
|
|
1463
|
+
[se.TENANT_ADMIN]: 2,
|
|
1464
|
+
[se.SUPERUSER]: 3
|
|
1408
1465
|
};
|
|
1409
1466
|
return t[i] >= t[e];
|
|
1410
1467
|
};
|
|
1411
|
-
function
|
|
1468
|
+
function St({
|
|
1412
1469
|
children: i,
|
|
1413
1470
|
redirectTo: e = "/login",
|
|
1414
1471
|
minUserType: t,
|
|
1415
1472
|
requiredPermissions: r,
|
|
1416
|
-
requireAllPermissions:
|
|
1417
|
-
fallback:
|
|
1473
|
+
requireAllPermissions: s = !1,
|
|
1474
|
+
fallback: a
|
|
1418
1475
|
}) {
|
|
1419
|
-
const { hasValidSession:
|
|
1420
|
-
if (!
|
|
1421
|
-
return
|
|
1422
|
-
/* @__PURE__ */
|
|
1423
|
-
/* @__PURE__ */
|
|
1476
|
+
const { hasValidSession: b, sessionManager: E, hasPermission: L, hasAnyPermission: P, hasAllPermissions: f } = ie(), m = he();
|
|
1477
|
+
if (!b())
|
|
1478
|
+
return a ? /* @__PURE__ */ n(D, { children: a }) : /* @__PURE__ */ l(D, { children: [
|
|
1479
|
+
/* @__PURE__ */ n(qe, { redirectPath: e }),
|
|
1480
|
+
/* @__PURE__ */ n(de, { to: e, state: { from: m.pathname }, replace: !0 })
|
|
1424
1481
|
] });
|
|
1425
|
-
const
|
|
1426
|
-
if (!
|
|
1427
|
-
return /* @__PURE__ */
|
|
1428
|
-
if (t &&
|
|
1429
|
-
return /* @__PURE__ */
|
|
1430
|
-
if (r && r.length > 0 && !(
|
|
1431
|
-
const
|
|
1432
|
-
return /* @__PURE__ */
|
|
1433
|
-
}
|
|
1434
|
-
return /* @__PURE__ */
|
|
1482
|
+
const M = E.getUser();
|
|
1483
|
+
if (!M)
|
|
1484
|
+
return /* @__PURE__ */ n(de, { to: e, state: { from: m.pathname }, replace: !0 });
|
|
1485
|
+
if (t && !Ue(M.userType, t))
|
|
1486
|
+
return /* @__PURE__ */ n(be, { userType: M.userType, minUserType: t });
|
|
1487
|
+
if (r && r.length > 0 && !(s ? f(r) : P(r))) {
|
|
1488
|
+
const v = r.filter((I) => !L(I)).map((I) => typeof I == "string" ? I : I.name);
|
|
1489
|
+
return /* @__PURE__ */ n(be, { missingPermissions: v });
|
|
1490
|
+
}
|
|
1491
|
+
return /* @__PURE__ */ n(D, { children: i });
|
|
1435
1492
|
}
|
|
1436
|
-
const
|
|
1493
|
+
const ze = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1437
1494
|
"div",
|
|
1438
1495
|
{
|
|
1439
1496
|
style: {
|
|
@@ -1446,7 +1503,7 @@ const Le = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1446
1503
|
backgroundColor: "#f9fafb",
|
|
1447
1504
|
textAlign: "center"
|
|
1448
1505
|
},
|
|
1449
|
-
children: /* @__PURE__ */
|
|
1506
|
+
children: /* @__PURE__ */ l(
|
|
1450
1507
|
"div",
|
|
1451
1508
|
{
|
|
1452
1509
|
style: {
|
|
@@ -1457,10 +1514,10 @@ const Le = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1457
1514
|
maxWidth: "400px"
|
|
1458
1515
|
},
|
|
1459
1516
|
children: [
|
|
1460
|
-
/* @__PURE__ */
|
|
1461
|
-
/* @__PURE__ */
|
|
1462
|
-
/* @__PURE__ */
|
|
1463
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🏢" }),
|
|
1518
|
+
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Tenant Required" }),
|
|
1519
|
+
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "This page requires a tenant context to access." }),
|
|
1520
|
+
/* @__PURE__ */ l("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1464
1521
|
"Redirecting to ",
|
|
1465
1522
|
i,
|
|
1466
1523
|
"..."
|
|
@@ -1470,14 +1527,14 @@ const Le = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1470
1527
|
)
|
|
1471
1528
|
}
|
|
1472
1529
|
);
|
|
1473
|
-
function
|
|
1474
|
-
const { tenant: r, isLoading:
|
|
1475
|
-
return
|
|
1476
|
-
/* @__PURE__ */
|
|
1477
|
-
/* @__PURE__ */
|
|
1530
|
+
function xt({ children: i, redirectTo: e = "/", fallback: t }) {
|
|
1531
|
+
const { tenant: r, isLoading: s, error: a } = re(), b = he();
|
|
1532
|
+
return s || a ? null : r ? /* @__PURE__ */ n(D, { children: i }) : t ? /* @__PURE__ */ n(D, { children: t }) : /* @__PURE__ */ l(D, { children: [
|
|
1533
|
+
/* @__PURE__ */ n(ze, { redirectPath: e }),
|
|
1534
|
+
/* @__PURE__ */ n(de, { to: e, state: { from: b.pathname }, replace: !0 })
|
|
1478
1535
|
] });
|
|
1479
1536
|
}
|
|
1480
|
-
const
|
|
1537
|
+
const Oe = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1481
1538
|
"div",
|
|
1482
1539
|
{
|
|
1483
1540
|
style: {
|
|
@@ -1490,7 +1547,7 @@ const De = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1490
1547
|
backgroundColor: "#f9fafb",
|
|
1491
1548
|
textAlign: "center"
|
|
1492
1549
|
},
|
|
1493
|
-
children: /* @__PURE__ */
|
|
1550
|
+
children: /* @__PURE__ */ l(
|
|
1494
1551
|
"div",
|
|
1495
1552
|
{
|
|
1496
1553
|
style: {
|
|
@@ -1501,10 +1558,10 @@ const De = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1501
1558
|
maxWidth: "400px"
|
|
1502
1559
|
},
|
|
1503
1560
|
children: [
|
|
1504
|
-
/* @__PURE__ */
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
/* @__PURE__ */
|
|
1561
|
+
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🚀" }),
|
|
1562
|
+
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Tenant Detected" }),
|
|
1563
|
+
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You are accessing a tenant-specific context. Redirecting to the appropriate page." }),
|
|
1564
|
+
/* @__PURE__ */ l("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1508
1565
|
"Redirecting to ",
|
|
1509
1566
|
i,
|
|
1510
1567
|
"..."
|
|
@@ -1514,14 +1571,14 @@ const De = ({ redirectPath: i }) => /* @__PURE__ */ s(
|
|
|
1514
1571
|
)
|
|
1515
1572
|
}
|
|
1516
1573
|
);
|
|
1517
|
-
function
|
|
1518
|
-
const { tenant: r, isLoading:
|
|
1519
|
-
return
|
|
1520
|
-
/* @__PURE__ */
|
|
1521
|
-
/* @__PURE__ */
|
|
1522
|
-
] }) : /* @__PURE__ */
|
|
1574
|
+
function kt({ children: i, redirectTo: e = "/dashboard", fallback: t }) {
|
|
1575
|
+
const { tenant: r, isLoading: s, error: a } = re(), b = he();
|
|
1576
|
+
return s || a ? null : r ? t ? /* @__PURE__ */ n(D, { children: t }) : /* @__PURE__ */ l(D, { children: [
|
|
1577
|
+
/* @__PURE__ */ n(Oe, { redirectPath: e }),
|
|
1578
|
+
/* @__PURE__ */ n(de, { to: e, state: { from: b.pathname }, replace: !0 })
|
|
1579
|
+
] }) : /* @__PURE__ */ n(D, { children: i });
|
|
1523
1580
|
}
|
|
1524
|
-
const
|
|
1581
|
+
const je = () => /* @__PURE__ */ l(
|
|
1525
1582
|
"div",
|
|
1526
1583
|
{
|
|
1527
1584
|
style: {
|
|
@@ -1533,19 +1590,19 @@ const Be = () => /* @__PURE__ */ c(
|
|
|
1533
1590
|
color: "#dc2626"
|
|
1534
1591
|
},
|
|
1535
1592
|
children: [
|
|
1536
|
-
/* @__PURE__ */
|
|
1537
|
-
/* @__PURE__ */
|
|
1593
|
+
/* @__PURE__ */ n("h3", { style: { margin: "0 0 1rem 0" }, children: "🔒 Subscription Required" }),
|
|
1594
|
+
/* @__PURE__ */ n("p", { style: { margin: 0 }, children: "This feature requires a higher subscription plan. Please upgrade your plan to access this content." })
|
|
1538
1595
|
]
|
|
1539
1596
|
}
|
|
1540
1597
|
);
|
|
1541
|
-
function
|
|
1598
|
+
function At({
|
|
1542
1599
|
children: i,
|
|
1543
|
-
fallback: e = /* @__PURE__ */
|
|
1600
|
+
fallback: e = /* @__PURE__ */ n(je, {}),
|
|
1544
1601
|
allowedPlans: t,
|
|
1545
1602
|
requiredFeature: r
|
|
1546
1603
|
}) {
|
|
1547
|
-
const { subscription:
|
|
1548
|
-
return
|
|
1604
|
+
const { subscription: s, hasAllowedPlan: a, isFeatureEnabled: b, loading: E } = Be();
|
|
1605
|
+
return E ? /* @__PURE__ */ n(
|
|
1549
1606
|
"div",
|
|
1550
1607
|
{
|
|
1551
1608
|
style: {
|
|
@@ -1555,9 +1612,9 @@ function ht({
|
|
|
1555
1612
|
},
|
|
1556
1613
|
children: "Loading subscription..."
|
|
1557
1614
|
}
|
|
1558
|
-
) :
|
|
1615
|
+
) : s ? s.isActive ? t && t.length > 0 && !a(t) ? /* @__PURE__ */ n(D, { children: e }) : r && !b(r) ? /* @__PURE__ */ n(D, { children: e }) : /* @__PURE__ */ n(D, { children: i }) : /* @__PURE__ */ n(D, { children: e }) : /* @__PURE__ */ n(D, { children: e });
|
|
1559
1616
|
}
|
|
1560
|
-
const
|
|
1617
|
+
const We = ({ flagName: i }) => /* @__PURE__ */ l(
|
|
1561
1618
|
"div",
|
|
1562
1619
|
{
|
|
1563
1620
|
style: {
|
|
@@ -1574,9 +1631,9 @@ const qe = ({ flagName: i }) => /* @__PURE__ */ c(
|
|
|
1574
1631
|
color: "#6c757d"
|
|
1575
1632
|
},
|
|
1576
1633
|
children: [
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ n("div", { style: { fontSize: "24px", marginBottom: "8px" }, children: "🚧" }),
|
|
1635
|
+
/* @__PURE__ */ n("div", { style: { fontSize: "14px", fontWeight: "500", marginBottom: "4px" }, children: "Feature Not Available" }),
|
|
1636
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", opacity: 0.7 }, children: [
|
|
1580
1637
|
'Feature flag "',
|
|
1581
1638
|
i,
|
|
1582
1639
|
'" is disabled'
|
|
@@ -1584,9 +1641,9 @@ const qe = ({ flagName: i }) => /* @__PURE__ */ c(
|
|
|
1584
1641
|
]
|
|
1585
1642
|
}
|
|
1586
1643
|
);
|
|
1587
|
-
function
|
|
1588
|
-
const { isEnabled: r, loading:
|
|
1589
|
-
return
|
|
1644
|
+
function Pt({ name: i, children: e, fallback: t }) {
|
|
1645
|
+
const { isEnabled: r, loading: s } = $e();
|
|
1646
|
+
return s ? /* @__PURE__ */ n(
|
|
1590
1647
|
"div",
|
|
1591
1648
|
{
|
|
1592
1649
|
style: {
|
|
@@ -1599,9 +1656,9 @@ function gt({ name: i, children: e, fallback: t }) {
|
|
|
1599
1656
|
},
|
|
1600
1657
|
children: "Loading feature flags..."
|
|
1601
1658
|
}
|
|
1602
|
-
) : (console.log(i, r(i)), r(i) ? /* @__PURE__ */
|
|
1659
|
+
) : (console.log(i, r(i)), r(i) ? /* @__PURE__ */ n(D, { children: e }) : /* @__PURE__ */ n(D, { children: t || /* @__PURE__ */ n(We, { flagName: i }) }));
|
|
1603
1660
|
}
|
|
1604
|
-
const
|
|
1661
|
+
const Ve = () => /* @__PURE__ */ l(
|
|
1605
1662
|
"svg",
|
|
1606
1663
|
{
|
|
1607
1664
|
width: "16",
|
|
@@ -1614,11 +1671,11 @@ const Ue = () => /* @__PURE__ */ c(
|
|
|
1614
1671
|
strokeLinejoin: "round",
|
|
1615
1672
|
style: { flexShrink: 0 },
|
|
1616
1673
|
children: [
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
/* @__PURE__ */
|
|
1674
|
+
/* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
1675
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
1619
1676
|
]
|
|
1620
1677
|
}
|
|
1621
|
-
),
|
|
1678
|
+
), Ge = () => /* @__PURE__ */ l(
|
|
1622
1679
|
"svg",
|
|
1623
1680
|
{
|
|
1624
1681
|
width: "16",
|
|
@@ -1631,26 +1688,28 @@ const Ue = () => /* @__PURE__ */ c(
|
|
|
1631
1688
|
strokeLinejoin: "round",
|
|
1632
1689
|
style: { flexShrink: 0 },
|
|
1633
1690
|
children: [
|
|
1634
|
-
/* @__PURE__ */
|
|
1635
|
-
/* @__PURE__ */
|
|
1691
|
+
/* @__PURE__ */ n("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
1692
|
+
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1636
1693
|
]
|
|
1637
1694
|
}
|
|
1638
|
-
),
|
|
1639
|
-
showPassword: /* @__PURE__ */
|
|
1640
|
-
hidePassword: /* @__PURE__ */
|
|
1641
|
-
},
|
|
1695
|
+
), Ye = {
|
|
1696
|
+
showPassword: /* @__PURE__ */ n(Ve, {}),
|
|
1697
|
+
hidePassword: /* @__PURE__ */ n(Ge, {})
|
|
1698
|
+
}, _e = {
|
|
1642
1699
|
title: "Sign In",
|
|
1643
|
-
|
|
1644
|
-
|
|
1700
|
+
usernameLabel: "Email or Phone",
|
|
1701
|
+
usernamePlaceholder: "Enter your email or phone number",
|
|
1645
1702
|
passwordLabel: "Password",
|
|
1646
1703
|
passwordPlaceholder: "Enter your password",
|
|
1647
1704
|
submitButton: "Sign In",
|
|
1648
1705
|
forgotPasswordLink: "Forgot your password?",
|
|
1649
1706
|
signupLink: "Sign up here",
|
|
1650
1707
|
signupText: "Don't have an account?",
|
|
1651
|
-
|
|
1708
|
+
magicLinkText: "Prefer passwordless?",
|
|
1709
|
+
magicLinkLink: "Use Magic Link",
|
|
1710
|
+
errorMessage: "Invalid credentials",
|
|
1652
1711
|
loadingText: "Signing in..."
|
|
1653
|
-
},
|
|
1712
|
+
}, Ke = {
|
|
1654
1713
|
container: {
|
|
1655
1714
|
maxWidth: "400px",
|
|
1656
1715
|
width: "100%",
|
|
@@ -1757,124 +1816,138 @@ const Ue = () => /* @__PURE__ */ c(
|
|
|
1757
1816
|
fontSize: "0.875rem"
|
|
1758
1817
|
}
|
|
1759
1818
|
};
|
|
1760
|
-
function
|
|
1819
|
+
function Tt({
|
|
1761
1820
|
copy: i = {},
|
|
1762
1821
|
styles: e = {},
|
|
1763
1822
|
icons: t = {},
|
|
1764
1823
|
onSuccess: r,
|
|
1765
|
-
onError:
|
|
1766
|
-
onForgotPassword:
|
|
1767
|
-
onSignupClick:
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1824
|
+
onError: s,
|
|
1825
|
+
onForgotPassword: a,
|
|
1826
|
+
onSignupClick: b,
|
|
1827
|
+
onMagicLinkClick: E,
|
|
1828
|
+
showForgotPassword: L = !0,
|
|
1829
|
+
showSignupLink: P = !0,
|
|
1830
|
+
showMagicLinkOption: f = !0,
|
|
1831
|
+
className: m
|
|
1771
1832
|
}) {
|
|
1772
|
-
const [
|
|
1773
|
-
const
|
|
1774
|
-
return
|
|
1775
|
-
},
|
|
1776
|
-
if (
|
|
1777
|
-
if (!(
|
|
1778
|
-
|
|
1833
|
+
const [M, w] = p(""), [v, I] = p(""), [g, U] = p(!1), [u, y] = p(!1), [x, F] = p(""), [B, z] = p({}), { login: q } = ie(), { tenant: S } = re(), { appId: c } = ne(), h = { ..._e, ...i }, o = { ...Ke, ...e }, d = { ...Ye, ...t }, G = () => {
|
|
1834
|
+
const k = {};
|
|
1835
|
+
return M.trim() || (k.username = !0), v.trim() || (k.password = !0), z(k), Object.keys(k).length === 0;
|
|
1836
|
+
}, Y = async (k) => {
|
|
1837
|
+
if (k.preventDefault(), !!G()) {
|
|
1838
|
+
if (!(S != null && S.id)) {
|
|
1839
|
+
F("Tenant not found");
|
|
1779
1840
|
return;
|
|
1780
1841
|
}
|
|
1781
|
-
|
|
1842
|
+
y(!0), F("");
|
|
1782
1843
|
try {
|
|
1783
|
-
const
|
|
1784
|
-
r == null || r(
|
|
1785
|
-
} catch (
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1844
|
+
const T = await q(M, v, c, S.id);
|
|
1845
|
+
r == null || r(T);
|
|
1846
|
+
} catch (T) {
|
|
1847
|
+
const J = T.message || h.errorMessage;
|
|
1848
|
+
F(J), s == null || s(J);
|
|
1788
1849
|
} finally {
|
|
1789
|
-
|
|
1850
|
+
y(!1);
|
|
1790
1851
|
}
|
|
1791
1852
|
}
|
|
1792
|
-
},
|
|
1793
|
-
...
|
|
1794
|
-
...k
|
|
1795
|
-
}),
|
|
1796
|
-
...
|
|
1797
|
-
...
|
|
1798
|
-
...!
|
|
1853
|
+
}, H = (k) => ({
|
|
1854
|
+
...o.input,
|
|
1855
|
+
...B[k] ? o.inputError : {}
|
|
1856
|
+
}), C = () => ({
|
|
1857
|
+
...o.button,
|
|
1858
|
+
...u ? o.buttonLoading : {},
|
|
1859
|
+
...!M || !v || u ? o.buttonDisabled : {}
|
|
1799
1860
|
});
|
|
1800
|
-
return /* @__PURE__ */
|
|
1801
|
-
/* @__PURE__ */
|
|
1802
|
-
/* @__PURE__ */
|
|
1803
|
-
/* @__PURE__ */
|
|
1804
|
-
/* @__PURE__ */
|
|
1805
|
-
/* @__PURE__ */
|
|
1861
|
+
return /* @__PURE__ */ l("div", { className: m, style: o.container, children: [
|
|
1862
|
+
/* @__PURE__ */ n("h2", { style: o.title, children: h.title }),
|
|
1863
|
+
/* @__PURE__ */ l("form", { onSubmit: Y, style: o.form, children: [
|
|
1864
|
+
/* @__PURE__ */ l("div", { style: o.fieldGroup, children: [
|
|
1865
|
+
/* @__PURE__ */ n("label", { style: o.label, children: h.usernameLabel }),
|
|
1866
|
+
/* @__PURE__ */ n(
|
|
1806
1867
|
"input",
|
|
1807
1868
|
{
|
|
1808
|
-
id: "
|
|
1809
|
-
name: "
|
|
1810
|
-
type: "
|
|
1811
|
-
value:
|
|
1812
|
-
onChange: (
|
|
1813
|
-
|
|
1869
|
+
id: "username",
|
|
1870
|
+
name: "username",
|
|
1871
|
+
type: "text",
|
|
1872
|
+
value: M,
|
|
1873
|
+
onChange: (k) => {
|
|
1874
|
+
w(k.target.value), B.username && z((T) => ({ ...T, username: !1 }));
|
|
1814
1875
|
},
|
|
1815
|
-
placeholder:
|
|
1816
|
-
style:
|
|
1817
|
-
disabled:
|
|
1876
|
+
placeholder: h.usernamePlaceholder,
|
|
1877
|
+
style: H("username"),
|
|
1878
|
+
disabled: u
|
|
1818
1879
|
}
|
|
1819
1880
|
)
|
|
1820
1881
|
] }),
|
|
1821
|
-
/* @__PURE__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
/* @__PURE__ */
|
|
1882
|
+
/* @__PURE__ */ l("div", { style: o.fieldGroup, children: [
|
|
1883
|
+
/* @__PURE__ */ n("label", { style: o.label, children: h.passwordLabel }),
|
|
1884
|
+
/* @__PURE__ */ l("div", { style: o.inputContainer, children: [
|
|
1885
|
+
/* @__PURE__ */ n(
|
|
1825
1886
|
"input",
|
|
1826
1887
|
{
|
|
1827
1888
|
id: "password",
|
|
1828
1889
|
name: "password",
|
|
1829
|
-
type:
|
|
1830
|
-
value:
|
|
1831
|
-
onChange: (
|
|
1832
|
-
|
|
1890
|
+
type: g ? "text" : "password",
|
|
1891
|
+
value: v,
|
|
1892
|
+
onChange: (k) => {
|
|
1893
|
+
I(k.target.value), B.password && z((T) => ({ ...T, password: !1 }));
|
|
1833
1894
|
},
|
|
1834
|
-
placeholder:
|
|
1895
|
+
placeholder: h.passwordPlaceholder,
|
|
1835
1896
|
style: {
|
|
1836
|
-
...
|
|
1897
|
+
...H("password"),
|
|
1837
1898
|
paddingRight: "2.5rem"
|
|
1838
1899
|
// Make room for the icon
|
|
1839
1900
|
},
|
|
1840
|
-
disabled:
|
|
1901
|
+
disabled: u
|
|
1841
1902
|
}
|
|
1842
1903
|
),
|
|
1843
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ n(
|
|
1844
1905
|
"button",
|
|
1845
1906
|
{
|
|
1846
1907
|
type: "button",
|
|
1847
|
-
onClick: () =>
|
|
1848
|
-
style:
|
|
1849
|
-
disabled:
|
|
1850
|
-
"aria-label":
|
|
1851
|
-
children:
|
|
1908
|
+
onClick: () => U(!g),
|
|
1909
|
+
style: o.passwordToggle,
|
|
1910
|
+
disabled: u,
|
|
1911
|
+
"aria-label": g ? "Hide password" : "Show password",
|
|
1912
|
+
children: g ? d.hidePassword : d.showPassword
|
|
1852
1913
|
}
|
|
1853
1914
|
)
|
|
1854
1915
|
] })
|
|
1855
1916
|
] }),
|
|
1856
|
-
/* @__PURE__ */
|
|
1857
|
-
|
|
1917
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !M || !v || u, style: C(), children: u ? h.loadingText : h.submitButton }),
|
|
1918
|
+
x && /* @__PURE__ */ n("div", { style: o.errorText, children: x })
|
|
1858
1919
|
] }),
|
|
1859
|
-
(
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1920
|
+
(L || P || f) && /* @__PURE__ */ l("div", { style: o.linkContainer, children: [
|
|
1921
|
+
f && /* @__PURE__ */ l("div", { children: [
|
|
1922
|
+
/* @__PURE__ */ l("span", { style: o.divider, children: [
|
|
1923
|
+
h.magicLinkText,
|
|
1924
|
+
" "
|
|
1925
|
+
] }),
|
|
1926
|
+
/* @__PURE__ */ n("a", { onClick: E, style: o.link, children: h.magicLinkLink })
|
|
1927
|
+
] }),
|
|
1928
|
+
f && (L || P) && /* @__PURE__ */ n("div", { style: o.divider, children: "•" }),
|
|
1929
|
+
L && /* @__PURE__ */ n("a", { onClick: a, style: o.link, children: h.forgotPasswordLink }),
|
|
1930
|
+
L && P && /* @__PURE__ */ n("div", { style: o.divider, children: "•" }),
|
|
1931
|
+
P && /* @__PURE__ */ l("div", { children: [
|
|
1932
|
+
/* @__PURE__ */ l("span", { style: o.divider, children: [
|
|
1933
|
+
h.signupText,
|
|
1865
1934
|
" "
|
|
1866
1935
|
] }),
|
|
1867
|
-
/* @__PURE__ */
|
|
1936
|
+
/* @__PURE__ */ n("a", { onClick: b, style: o.link, children: h.signupLink })
|
|
1868
1937
|
] })
|
|
1869
1938
|
] })
|
|
1870
1939
|
] });
|
|
1871
1940
|
}
|
|
1872
|
-
const
|
|
1941
|
+
const Qe = {
|
|
1873
1942
|
title: "Create Account",
|
|
1874
|
-
nameLabel: "
|
|
1875
|
-
namePlaceholder: "Enter your
|
|
1943
|
+
nameLabel: "First Name",
|
|
1944
|
+
namePlaceholder: "Enter your first name",
|
|
1945
|
+
lastNameLabel: "Last Name",
|
|
1946
|
+
lastNamePlaceholder: "Enter your last name",
|
|
1876
1947
|
emailLabel: "Email",
|
|
1877
1948
|
emailPlaceholder: "Enter your email",
|
|
1949
|
+
phoneNumberLabel: "Phone Number",
|
|
1950
|
+
phoneNumberPlaceholder: "Enter your phone number",
|
|
1878
1951
|
passwordLabel: "Password",
|
|
1879
1952
|
passwordPlaceholder: "Enter your password",
|
|
1880
1953
|
confirmPasswordLabel: "Confirm Password",
|
|
@@ -1884,12 +1957,14 @@ const Ve = {
|
|
|
1884
1957
|
submitButton: "Create Account",
|
|
1885
1958
|
loginLink: "Sign in here",
|
|
1886
1959
|
loginText: "Already have an account?",
|
|
1960
|
+
magicLinkText: "Prefer passwordless?",
|
|
1961
|
+
magicLinkLink: "Use Magic Link",
|
|
1887
1962
|
errorMessage: "Failed to create account",
|
|
1888
1963
|
loadingText: "Creating account...",
|
|
1889
1964
|
passwordMismatchError: "Passwords do not match",
|
|
1890
1965
|
isAdminLabel: "Create new organization",
|
|
1891
1966
|
isAdminDescription: "Check this if you want to create a new organization"
|
|
1892
|
-
},
|
|
1967
|
+
}, Je = {
|
|
1893
1968
|
container: {
|
|
1894
1969
|
maxWidth: "400px",
|
|
1895
1970
|
width: "100%",
|
|
@@ -1988,154 +2063,784 @@ const Ve = {
|
|
|
1988
2063
|
fontSize: "0.875rem"
|
|
1989
2064
|
}
|
|
1990
2065
|
};
|
|
1991
|
-
function
|
|
2066
|
+
function Mt({
|
|
1992
2067
|
copy: i = {},
|
|
1993
2068
|
styles: e = {},
|
|
1994
2069
|
signupType: t = "user",
|
|
1995
2070
|
onSuccess: r,
|
|
1996
|
-
onError:
|
|
1997
|
-
onLoginClick:
|
|
1998
|
-
|
|
1999
|
-
|
|
2071
|
+
onError: s,
|
|
2072
|
+
onLoginClick: a,
|
|
2073
|
+
onMagicLinkClick: b,
|
|
2074
|
+
showLoginLink: E = !0,
|
|
2075
|
+
showMagicLinkOption: L = !0,
|
|
2076
|
+
className: P
|
|
2000
2077
|
}) {
|
|
2001
|
-
const [M,
|
|
2002
|
-
const
|
|
2003
|
-
return
|
|
2004
|
-
},
|
|
2005
|
-
if (
|
|
2006
|
-
if (
|
|
2007
|
-
|
|
2078
|
+
const [f, m] = p(""), [M, w] = p(""), [v, I] = p(""), [g, U] = p(""), [u, y] = p(""), [x, F] = p(""), [B, z] = p(""), [q, S] = p(!1), [c, h] = p(""), [o, d] = p({}), { signup: G, signupTenantAdmin: Y } = ie(), { tenant: H } = re(), { appId: C } = ne(), k = { ...Qe, ...i }, T = { ...Je, ...e }, J = () => {
|
|
2079
|
+
const R = {};
|
|
2080
|
+
return f.trim() || (R.name = !0), !v.trim() && !g.trim() && (R.email = !0, R.phoneNumber = !0), u.trim() || (R.password = !0), x.trim() || (R.confirmPassword = !0), t === "tenant" && !B.trim() && (R.tenantName = !0), d(R), Object.keys(R).length === 0;
|
|
2081
|
+
}, O = async (R) => {
|
|
2082
|
+
if (R.preventDefault(), !!J()) {
|
|
2083
|
+
if (u !== x) {
|
|
2084
|
+
h(k.passwordMismatchError), d({ confirmPassword: !0 });
|
|
2008
2085
|
return;
|
|
2009
2086
|
}
|
|
2010
|
-
if (t === "user" && !(
|
|
2011
|
-
|
|
2087
|
+
if (t === "user" && !(H != null && H.id)) {
|
|
2088
|
+
h("Tenant not found");
|
|
2012
2089
|
return;
|
|
2013
2090
|
}
|
|
2014
|
-
S(!0),
|
|
2091
|
+
S(!0), h("");
|
|
2015
2092
|
try {
|
|
2016
|
-
let
|
|
2017
|
-
t === "tenant" ?
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2093
|
+
let V;
|
|
2094
|
+
t === "tenant" ? V = await Y(
|
|
2095
|
+
v || void 0,
|
|
2096
|
+
g || void 0,
|
|
2097
|
+
f,
|
|
2098
|
+
u,
|
|
2099
|
+
B,
|
|
2100
|
+
M || void 0,
|
|
2101
|
+
C
|
|
2102
|
+
) : V = await G(
|
|
2103
|
+
v || void 0,
|
|
2104
|
+
g || void 0,
|
|
2105
|
+
f,
|
|
2106
|
+
u,
|
|
2107
|
+
H.id,
|
|
2108
|
+
M || void 0,
|
|
2109
|
+
C
|
|
2110
|
+
), r == null || r(V);
|
|
2111
|
+
} catch (V) {
|
|
2112
|
+
const ue = V.message || k.errorMessage;
|
|
2113
|
+
h(ue), s == null || s(ue);
|
|
2021
2114
|
} finally {
|
|
2022
2115
|
S(!1);
|
|
2023
2116
|
}
|
|
2024
2117
|
}
|
|
2025
|
-
},
|
|
2026
|
-
...
|
|
2027
|
-
...
|
|
2118
|
+
}, j = (R) => ({
|
|
2119
|
+
...T.input,
|
|
2120
|
+
...o[R] ? T.inputError : {}
|
|
2028
2121
|
}), N = () => ({
|
|
2029
|
-
...
|
|
2030
|
-
...
|
|
2031
|
-
...!
|
|
2032
|
-
}),
|
|
2033
|
-
return /* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */
|
|
2036
|
-
/* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
2038
|
-
/* @__PURE__ */
|
|
2122
|
+
...T.button,
|
|
2123
|
+
...q ? T.buttonLoading : {},
|
|
2124
|
+
...!f || !v && !g || !u || !x || q || t === "tenant" && !B ? T.buttonDisabled : {}
|
|
2125
|
+
}), K = f && (v || g) && u && x && (t === "user" || B);
|
|
2126
|
+
return /* @__PURE__ */ l("div", { className: P, style: T.container, children: [
|
|
2127
|
+
/* @__PURE__ */ n("h2", { style: T.title, children: k.title }),
|
|
2128
|
+
/* @__PURE__ */ l("form", { onSubmit: O, style: T.form, children: [
|
|
2129
|
+
/* @__PURE__ */ l("div", { style: T.fieldGroup, children: [
|
|
2130
|
+
/* @__PURE__ */ n("label", { style: T.label, children: k.nameLabel }),
|
|
2131
|
+
/* @__PURE__ */ n(
|
|
2039
2132
|
"input",
|
|
2040
2133
|
{
|
|
2041
2134
|
id: "name",
|
|
2042
2135
|
name: "name",
|
|
2043
2136
|
type: "text",
|
|
2044
|
-
value:
|
|
2045
|
-
onChange: (
|
|
2046
|
-
|
|
2137
|
+
value: f,
|
|
2138
|
+
onChange: (R) => {
|
|
2139
|
+
m(R.target.value), o.name && d((V) => ({ ...V, name: !1 }));
|
|
2047
2140
|
},
|
|
2048
|
-
placeholder:
|
|
2049
|
-
style:
|
|
2050
|
-
disabled:
|
|
2141
|
+
placeholder: k.namePlaceholder,
|
|
2142
|
+
style: j("name"),
|
|
2143
|
+
disabled: q
|
|
2051
2144
|
}
|
|
2052
2145
|
)
|
|
2053
2146
|
] }),
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2147
|
+
/* @__PURE__ */ l("div", { style: T.fieldGroup, children: [
|
|
2148
|
+
/* @__PURE__ */ n("label", { style: T.label, children: k.lastNameLabel }),
|
|
2149
|
+
/* @__PURE__ */ n(
|
|
2150
|
+
"input",
|
|
2151
|
+
{
|
|
2152
|
+
id: "lastName",
|
|
2153
|
+
name: "lastName",
|
|
2154
|
+
type: "text",
|
|
2155
|
+
value: M,
|
|
2156
|
+
onChange: (R) => w(R.target.value),
|
|
2157
|
+
placeholder: k.lastNamePlaceholder,
|
|
2158
|
+
style: T.input,
|
|
2159
|
+
disabled: q
|
|
2160
|
+
}
|
|
2161
|
+
)
|
|
2162
|
+
] }),
|
|
2163
|
+
/* @__PURE__ */ l("div", { style: T.fieldGroup, children: [
|
|
2164
|
+
/* @__PURE__ */ n("label", { style: T.label, children: k.emailLabel }),
|
|
2165
|
+
/* @__PURE__ */ n(
|
|
2057
2166
|
"input",
|
|
2058
2167
|
{
|
|
2059
2168
|
id: "email",
|
|
2060
2169
|
name: "email",
|
|
2061
2170
|
type: "email",
|
|
2171
|
+
value: v,
|
|
2172
|
+
onChange: (R) => {
|
|
2173
|
+
I(R.target.value), o.email && d((V) => ({ ...V, email: !1, phoneNumber: !1 }));
|
|
2174
|
+
},
|
|
2175
|
+
placeholder: k.emailPlaceholder,
|
|
2176
|
+
style: j("email"),
|
|
2177
|
+
disabled: q
|
|
2178
|
+
}
|
|
2179
|
+
)
|
|
2180
|
+
] }),
|
|
2181
|
+
/* @__PURE__ */ l("div", { style: T.fieldGroup, children: [
|
|
2182
|
+
/* @__PURE__ */ n("label", { style: T.label, children: k.phoneNumberLabel }),
|
|
2183
|
+
/* @__PURE__ */ n(
|
|
2184
|
+
"input",
|
|
2185
|
+
{
|
|
2186
|
+
id: "phoneNumber",
|
|
2187
|
+
name: "phoneNumber",
|
|
2188
|
+
type: "tel",
|
|
2062
2189
|
value: g,
|
|
2063
|
-
onChange: (
|
|
2064
|
-
|
|
2190
|
+
onChange: (R) => {
|
|
2191
|
+
U(R.target.value), o.phoneNumber && d((V) => ({ ...V, email: !1, phoneNumber: !1 }));
|
|
2065
2192
|
},
|
|
2066
|
-
placeholder:
|
|
2067
|
-
style:
|
|
2068
|
-
disabled:
|
|
2193
|
+
placeholder: k.phoneNumberPlaceholder,
|
|
2194
|
+
style: j("phoneNumber"),
|
|
2195
|
+
disabled: q
|
|
2069
2196
|
}
|
|
2070
2197
|
)
|
|
2071
2198
|
] }),
|
|
2072
|
-
/* @__PURE__ */
|
|
2073
|
-
|
|
2074
|
-
|
|
2199
|
+
/* @__PURE__ */ n(
|
|
2200
|
+
"div",
|
|
2201
|
+
{
|
|
2202
|
+
style: {
|
|
2203
|
+
fontSize: "0.875rem",
|
|
2204
|
+
color: "#6b7280",
|
|
2205
|
+
textAlign: "center",
|
|
2206
|
+
margin: "0.5rem 0"
|
|
2207
|
+
},
|
|
2208
|
+
children: "At least one contact method (email or phone) is required"
|
|
2209
|
+
}
|
|
2210
|
+
),
|
|
2211
|
+
/* @__PURE__ */ l("div", { style: T.fieldGroup, children: [
|
|
2212
|
+
/* @__PURE__ */ n("label", { style: T.label, children: k.passwordLabel }),
|
|
2213
|
+
/* @__PURE__ */ n(
|
|
2075
2214
|
"input",
|
|
2076
2215
|
{
|
|
2077
2216
|
id: "password",
|
|
2078
2217
|
name: "password",
|
|
2079
2218
|
type: "password",
|
|
2080
|
-
value:
|
|
2081
|
-
onChange: (
|
|
2082
|
-
|
|
2219
|
+
value: u,
|
|
2220
|
+
onChange: (R) => {
|
|
2221
|
+
y(R.target.value), o.password && d((V) => ({ ...V, password: !1 }));
|
|
2083
2222
|
},
|
|
2084
|
-
placeholder:
|
|
2085
|
-
style:
|
|
2086
|
-
disabled:
|
|
2223
|
+
placeholder: k.passwordPlaceholder,
|
|
2224
|
+
style: j("password"),
|
|
2225
|
+
disabled: q
|
|
2087
2226
|
}
|
|
2088
2227
|
)
|
|
2089
2228
|
] }),
|
|
2090
|
-
/* @__PURE__ */
|
|
2091
|
-
/* @__PURE__ */
|
|
2092
|
-
/* @__PURE__ */
|
|
2229
|
+
/* @__PURE__ */ l("div", { style: T.fieldGroup, children: [
|
|
2230
|
+
/* @__PURE__ */ n("label", { style: T.label, children: k.confirmPasswordLabel }),
|
|
2231
|
+
/* @__PURE__ */ n(
|
|
2093
2232
|
"input",
|
|
2094
2233
|
{
|
|
2095
2234
|
id: "confirmPassword",
|
|
2096
2235
|
name: "confirmPassword",
|
|
2097
2236
|
type: "password",
|
|
2098
|
-
value:
|
|
2099
|
-
onChange: (
|
|
2100
|
-
F(
|
|
2237
|
+
value: x,
|
|
2238
|
+
onChange: (R) => {
|
|
2239
|
+
F(R.target.value), o.confirmPassword && d((V) => ({ ...V, confirmPassword: !1 })), c === k.passwordMismatchError && h("");
|
|
2101
2240
|
},
|
|
2102
|
-
placeholder:
|
|
2103
|
-
style:
|
|
2104
|
-
disabled:
|
|
2241
|
+
placeholder: k.confirmPasswordPlaceholder,
|
|
2242
|
+
style: j("confirmPassword"),
|
|
2243
|
+
disabled: q
|
|
2105
2244
|
}
|
|
2106
2245
|
)
|
|
2107
2246
|
] }),
|
|
2108
|
-
t === "tenant" && /* @__PURE__ */
|
|
2109
|
-
/* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2247
|
+
t === "tenant" && /* @__PURE__ */ l("div", { style: T.fieldGroup, children: [
|
|
2248
|
+
/* @__PURE__ */ n("label", { style: T.label, children: k.tenantNameLabel }),
|
|
2249
|
+
/* @__PURE__ */ n(
|
|
2111
2250
|
"input",
|
|
2112
2251
|
{
|
|
2113
2252
|
id: "tenantName",
|
|
2114
2253
|
name: "tenantName",
|
|
2115
2254
|
type: "text",
|
|
2255
|
+
value: B,
|
|
2256
|
+
onChange: (R) => {
|
|
2257
|
+
z(R.target.value), o.tenantName && d((V) => ({ ...V, tenantName: !1 }));
|
|
2258
|
+
},
|
|
2259
|
+
placeholder: k.tenantNamePlaceholder,
|
|
2260
|
+
style: j("tenantName"),
|
|
2261
|
+
disabled: q
|
|
2262
|
+
}
|
|
2263
|
+
)
|
|
2264
|
+
] }),
|
|
2265
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !K || q, style: N(), children: q ? k.loadingText : k.submitButton }),
|
|
2266
|
+
c && /* @__PURE__ */ n("div", { style: T.errorText, children: c })
|
|
2267
|
+
] }),
|
|
2268
|
+
(E || L) && /* @__PURE__ */ l("div", { style: T.linkContainer, children: [
|
|
2269
|
+
L && /* @__PURE__ */ l("div", { children: [
|
|
2270
|
+
/* @__PURE__ */ l("span", { style: T.divider, children: [
|
|
2271
|
+
k.magicLinkText,
|
|
2272
|
+
" "
|
|
2273
|
+
] }),
|
|
2274
|
+
/* @__PURE__ */ n("a", { onClick: b, style: T.link, children: k.magicLinkLink })
|
|
2275
|
+
] }),
|
|
2276
|
+
L && E && /* @__PURE__ */ n("div", { style: T.divider, children: "•" }),
|
|
2277
|
+
E && /* @__PURE__ */ l("div", { children: [
|
|
2278
|
+
/* @__PURE__ */ l("span", { style: T.divider, children: [
|
|
2279
|
+
k.loginText,
|
|
2280
|
+
" "
|
|
2281
|
+
] }),
|
|
2282
|
+
/* @__PURE__ */ n("a", { onClick: a, style: T.link, children: k.loginLink })
|
|
2283
|
+
] })
|
|
2284
|
+
] })
|
|
2285
|
+
] });
|
|
2286
|
+
}
|
|
2287
|
+
const Xe = {
|
|
2288
|
+
title: "Sign In with Magic Link",
|
|
2289
|
+
emailLabel: "Email",
|
|
2290
|
+
emailPlaceholder: "Enter your email",
|
|
2291
|
+
nameLabel: "Name",
|
|
2292
|
+
namePlaceholder: "Enter your name",
|
|
2293
|
+
lastNameLabel: "Last Name",
|
|
2294
|
+
lastNamePlaceholder: "Enter your last name",
|
|
2295
|
+
submitButton: "Send Magic Link",
|
|
2296
|
+
loginLink: "Sign in with password",
|
|
2297
|
+
signupLink: "Sign up with password",
|
|
2298
|
+
loginText: "Already have an account?",
|
|
2299
|
+
signupText: "Prefer traditional signup?",
|
|
2300
|
+
successMessage: "Magic link sent! Check your email and click the link to sign in.",
|
|
2301
|
+
errorMessage: "Failed to send magic link. Please try again.",
|
|
2302
|
+
loadingText: "Sending magic link...",
|
|
2303
|
+
verifyingText: "Verifying magic link...",
|
|
2304
|
+
description: "Enter your email to receive a magic link. If you don't have an account, we'll create one for you."
|
|
2305
|
+
}, Ze = {
|
|
2306
|
+
container: {
|
|
2307
|
+
maxWidth: "400px",
|
|
2308
|
+
width: "100%",
|
|
2309
|
+
margin: "0 auto",
|
|
2310
|
+
padding: "2rem",
|
|
2311
|
+
backgroundColor: "#ffffff",
|
|
2312
|
+
borderRadius: "8px",
|
|
2313
|
+
boxShadow: "0 2px 10px rgba(0, 0, 0, 0.1)"
|
|
2314
|
+
},
|
|
2315
|
+
title: {
|
|
2316
|
+
fontSize: "1.5rem",
|
|
2317
|
+
fontWeight: "bold",
|
|
2318
|
+
textAlign: "center",
|
|
2319
|
+
marginBottom: "1rem",
|
|
2320
|
+
color: "#333333"
|
|
2321
|
+
},
|
|
2322
|
+
description: {
|
|
2323
|
+
fontSize: "0.875rem",
|
|
2324
|
+
color: "#6b7280",
|
|
2325
|
+
textAlign: "center",
|
|
2326
|
+
marginBottom: "1.5rem",
|
|
2327
|
+
lineHeight: "1.5"
|
|
2328
|
+
},
|
|
2329
|
+
form: {
|
|
2330
|
+
display: "flex",
|
|
2331
|
+
flexDirection: "column",
|
|
2332
|
+
gap: "1rem"
|
|
2333
|
+
},
|
|
2334
|
+
fieldGroup: {
|
|
2335
|
+
display: "flex",
|
|
2336
|
+
flexDirection: "column",
|
|
2337
|
+
gap: "0.5rem"
|
|
2338
|
+
},
|
|
2339
|
+
label: {
|
|
2340
|
+
fontSize: "0.875rem",
|
|
2341
|
+
fontWeight: "500",
|
|
2342
|
+
color: "#374151"
|
|
2343
|
+
},
|
|
2344
|
+
input: {
|
|
2345
|
+
padding: "0.75rem",
|
|
2346
|
+
border: "1px solid #d1d5db",
|
|
2347
|
+
borderRadius: "6px",
|
|
2348
|
+
fontSize: "1rem",
|
|
2349
|
+
transition: "border-color 0.15s ease-in-out",
|
|
2350
|
+
outline: "none",
|
|
2351
|
+
width: "100%"
|
|
2352
|
+
},
|
|
2353
|
+
inputError: {
|
|
2354
|
+
borderColor: "#ef4444",
|
|
2355
|
+
boxShadow: "0 0 0 3px rgba(239, 68, 68, 0.1)"
|
|
2356
|
+
},
|
|
2357
|
+
button: {
|
|
2358
|
+
padding: "0.75rem 1rem",
|
|
2359
|
+
backgroundColor: "#3b82f6",
|
|
2360
|
+
color: "white",
|
|
2361
|
+
border: "none",
|
|
2362
|
+
borderRadius: "6px",
|
|
2363
|
+
fontSize: "1rem",
|
|
2364
|
+
fontWeight: "500",
|
|
2365
|
+
cursor: "pointer",
|
|
2366
|
+
transition: "background-color 0.15s ease-in-out",
|
|
2367
|
+
marginTop: "0.5rem"
|
|
2368
|
+
},
|
|
2369
|
+
buttonDisabled: {
|
|
2370
|
+
backgroundColor: "#9ca3af",
|
|
2371
|
+
cursor: "not-allowed"
|
|
2372
|
+
},
|
|
2373
|
+
buttonLoading: {
|
|
2374
|
+
backgroundColor: "#6b7280"
|
|
2375
|
+
},
|
|
2376
|
+
errorText: {
|
|
2377
|
+
color: "#ef4444",
|
|
2378
|
+
fontSize: "0.875rem",
|
|
2379
|
+
textAlign: "center",
|
|
2380
|
+
marginTop: "0.5rem"
|
|
2381
|
+
},
|
|
2382
|
+
successText: {
|
|
2383
|
+
color: "#10b981",
|
|
2384
|
+
fontSize: "0.875rem",
|
|
2385
|
+
textAlign: "center",
|
|
2386
|
+
marginTop: "0.5rem",
|
|
2387
|
+
padding: "0.75rem",
|
|
2388
|
+
backgroundColor: "#f0fdf4",
|
|
2389
|
+
borderRadius: "6px",
|
|
2390
|
+
border: "1px solid #bbf7d0"
|
|
2391
|
+
},
|
|
2392
|
+
linkContainer: {
|
|
2393
|
+
textAlign: "center",
|
|
2394
|
+
marginTop: "1rem"
|
|
2395
|
+
},
|
|
2396
|
+
link: {
|
|
2397
|
+
color: "#3b82f6",
|
|
2398
|
+
textDecoration: "none",
|
|
2399
|
+
fontSize: "0.875rem",
|
|
2400
|
+
cursor: "pointer"
|
|
2401
|
+
},
|
|
2402
|
+
divider: {
|
|
2403
|
+
margin: "0.5rem 0",
|
|
2404
|
+
color: "#6b7280",
|
|
2405
|
+
fontSize: "0.875rem"
|
|
2406
|
+
}
|
|
2407
|
+
};
|
|
2408
|
+
function Et({
|
|
2409
|
+
copy: i = {},
|
|
2410
|
+
styles: e = {},
|
|
2411
|
+
onSuccess: t,
|
|
2412
|
+
onError: r,
|
|
2413
|
+
onLoginClick: s,
|
|
2414
|
+
onSignupClick: a,
|
|
2415
|
+
showTraditionalLinks: b = !0,
|
|
2416
|
+
className: E,
|
|
2417
|
+
verifyToken: L,
|
|
2418
|
+
frontendUrl: P
|
|
2419
|
+
}) {
|
|
2420
|
+
const [f, m] = p(""), [M, w] = p(""), [v, I] = p(""), [g, U] = p(!1), [u, y] = p(!1), [x, F] = p(""), [B, z] = p(""), [q, S] = p({}), [c, h] = p(!1), { sendMagicLink: o, verifyMagicLink: d } = ie(), { tenant: G } = re(), { appId: Y } = ne(), H = { ...Xe, ...i }, C = { ...Ze, ...e };
|
|
2421
|
+
Z(() => {
|
|
2422
|
+
L && k(L);
|
|
2423
|
+
}, [L]);
|
|
2424
|
+
const k = async (N) => {
|
|
2425
|
+
y(!0), F("");
|
|
2426
|
+
try {
|
|
2427
|
+
if (!f || !Y)
|
|
2428
|
+
throw new Error("Email and App ID are required for magic link verification");
|
|
2429
|
+
const K = await d(N, f, Y, G == null ? void 0 : G.id);
|
|
2430
|
+
t == null || t(K);
|
|
2431
|
+
} catch (K) {
|
|
2432
|
+
const R = K.message || "Failed to verify magic link";
|
|
2433
|
+
F(R), r == null || r(R);
|
|
2434
|
+
} finally {
|
|
2435
|
+
y(!1);
|
|
2436
|
+
}
|
|
2437
|
+
}, T = () => {
|
|
2438
|
+
const N = {};
|
|
2439
|
+
return f.trim() || (N.email = !0), c && !M.trim() && (N.name = !0), S(N), Object.keys(N).length === 0;
|
|
2440
|
+
}, J = async (N) => {
|
|
2441
|
+
if (N.preventDefault(), !!T()) {
|
|
2442
|
+
if (!(G != null && G.id)) {
|
|
2443
|
+
F("Tenant not found");
|
|
2444
|
+
return;
|
|
2445
|
+
}
|
|
2446
|
+
U(!0), F(""), z("");
|
|
2447
|
+
try {
|
|
2448
|
+
const K = P || (typeof window < "u" ? window.location.origin : ""), R = await o(
|
|
2449
|
+
f,
|
|
2450
|
+
G.id,
|
|
2451
|
+
K,
|
|
2452
|
+
c ? M : void 0,
|
|
2453
|
+
c ? v : void 0,
|
|
2454
|
+
Y
|
|
2455
|
+
);
|
|
2456
|
+
z(H.successMessage), t == null || t(R);
|
|
2457
|
+
} catch (K) {
|
|
2458
|
+
const R = K.message || H.errorMessage;
|
|
2459
|
+
F(R), r == null || r(R);
|
|
2460
|
+
} finally {
|
|
2461
|
+
U(!1);
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
}, O = (N) => ({
|
|
2465
|
+
...C.input,
|
|
2466
|
+
...q[N] ? C.inputError : {}
|
|
2467
|
+
}), j = () => ({
|
|
2468
|
+
...C.button,
|
|
2469
|
+
...g || u ? C.buttonLoading : {},
|
|
2470
|
+
...!f || g || u ? C.buttonDisabled : {}
|
|
2471
|
+
});
|
|
2472
|
+
return u ? /* @__PURE__ */ l("div", { className: E, style: C.container, children: [
|
|
2473
|
+
/* @__PURE__ */ n("h2", { style: C.title, children: H.verifyingText }),
|
|
2474
|
+
/* @__PURE__ */ n("div", { style: { textAlign: "center", padding: "2rem" }, children: /* @__PURE__ */ n("div", { style: { fontSize: "1rem", color: "#6b7280" }, children: "Please wait while we verify your magic link..." }) })
|
|
2475
|
+
] }) : /* @__PURE__ */ l("div", { className: E, style: C.container, children: [
|
|
2476
|
+
/* @__PURE__ */ n("h2", { style: C.title, children: H.title }),
|
|
2477
|
+
/* @__PURE__ */ n("p", { style: C.description, children: H.description }),
|
|
2478
|
+
/* @__PURE__ */ l("form", { onSubmit: J, style: C.form, children: [
|
|
2479
|
+
/* @__PURE__ */ l("div", { style: C.fieldGroup, children: [
|
|
2480
|
+
/* @__PURE__ */ n("label", { style: C.label, children: H.emailLabel }),
|
|
2481
|
+
/* @__PURE__ */ n(
|
|
2482
|
+
"input",
|
|
2483
|
+
{
|
|
2484
|
+
id: "email",
|
|
2485
|
+
name: "email",
|
|
2486
|
+
type: "email",
|
|
2116
2487
|
value: f,
|
|
2117
|
-
onChange: (
|
|
2118
|
-
|
|
2488
|
+
onChange: (N) => {
|
|
2489
|
+
m(N.target.value), q.email && S((K) => ({ ...K, email: !1 }));
|
|
2119
2490
|
},
|
|
2120
|
-
placeholder:
|
|
2121
|
-
style:
|
|
2122
|
-
disabled:
|
|
2491
|
+
placeholder: H.emailPlaceholder,
|
|
2492
|
+
style: O("email"),
|
|
2493
|
+
disabled: g || u
|
|
2123
2494
|
}
|
|
2124
2495
|
)
|
|
2125
2496
|
] }),
|
|
2126
|
-
/* @__PURE__ */
|
|
2127
|
-
|
|
2497
|
+
!c && /* @__PURE__ */ n("div", { style: { textAlign: "center", marginTop: "0.5rem" }, children: /* @__PURE__ */ n(
|
|
2498
|
+
"button",
|
|
2499
|
+
{
|
|
2500
|
+
type: "button",
|
|
2501
|
+
onClick: () => h(!0),
|
|
2502
|
+
style: {
|
|
2503
|
+
background: "none",
|
|
2504
|
+
border: "none",
|
|
2505
|
+
color: "#3b82f6",
|
|
2506
|
+
fontSize: "0.875rem",
|
|
2507
|
+
cursor: "pointer",
|
|
2508
|
+
textDecoration: "underline"
|
|
2509
|
+
},
|
|
2510
|
+
children: "New user? Add your name"
|
|
2511
|
+
}
|
|
2512
|
+
) }),
|
|
2513
|
+
c && /* @__PURE__ */ l(D, { children: [
|
|
2514
|
+
/* @__PURE__ */ l("div", { style: C.fieldGroup, children: [
|
|
2515
|
+
/* @__PURE__ */ n("label", { style: C.label, children: H.nameLabel }),
|
|
2516
|
+
/* @__PURE__ */ n(
|
|
2517
|
+
"input",
|
|
2518
|
+
{
|
|
2519
|
+
id: "name",
|
|
2520
|
+
name: "name",
|
|
2521
|
+
type: "text",
|
|
2522
|
+
value: M,
|
|
2523
|
+
onChange: (N) => {
|
|
2524
|
+
w(N.target.value), q.name && S((K) => ({ ...K, name: !1 }));
|
|
2525
|
+
},
|
|
2526
|
+
placeholder: H.namePlaceholder,
|
|
2527
|
+
style: O("name"),
|
|
2528
|
+
disabled: g || u
|
|
2529
|
+
}
|
|
2530
|
+
)
|
|
2531
|
+
] }),
|
|
2532
|
+
/* @__PURE__ */ l("div", { style: C.fieldGroup, children: [
|
|
2533
|
+
/* @__PURE__ */ n("label", { style: C.label, children: H.lastNameLabel }),
|
|
2534
|
+
/* @__PURE__ */ n(
|
|
2535
|
+
"input",
|
|
2536
|
+
{
|
|
2537
|
+
id: "lastName",
|
|
2538
|
+
name: "lastName",
|
|
2539
|
+
type: "text",
|
|
2540
|
+
value: v,
|
|
2541
|
+
onChange: (N) => I(N.target.value),
|
|
2542
|
+
placeholder: H.lastNamePlaceholder,
|
|
2543
|
+
style: C.input,
|
|
2544
|
+
disabled: g || u
|
|
2545
|
+
}
|
|
2546
|
+
)
|
|
2547
|
+
] }),
|
|
2548
|
+
/* @__PURE__ */ n("div", { style: { textAlign: "center", marginTop: "0.5rem" }, children: /* @__PURE__ */ n(
|
|
2549
|
+
"button",
|
|
2550
|
+
{
|
|
2551
|
+
type: "button",
|
|
2552
|
+
onClick: () => {
|
|
2553
|
+
h(!1), w(""), I("");
|
|
2554
|
+
},
|
|
2555
|
+
style: {
|
|
2556
|
+
background: "none",
|
|
2557
|
+
border: "none",
|
|
2558
|
+
color: "#6b7280",
|
|
2559
|
+
fontSize: "0.875rem",
|
|
2560
|
+
cursor: "pointer",
|
|
2561
|
+
textDecoration: "underline"
|
|
2562
|
+
},
|
|
2563
|
+
children: "Existing user? Hide name fields"
|
|
2564
|
+
}
|
|
2565
|
+
) })
|
|
2566
|
+
] }),
|
|
2567
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !f || g || u, style: j(), children: g ? H.loadingText : H.submitButton }),
|
|
2568
|
+
x && /* @__PURE__ */ n("div", { style: C.errorText, children: x }),
|
|
2569
|
+
B && /* @__PURE__ */ n("div", { style: C.successText, children: B })
|
|
2128
2570
|
] }),
|
|
2129
|
-
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
|
|
2132
|
-
|
|
2571
|
+
b && /* @__PURE__ */ l("div", { style: C.linkContainer, children: [
|
|
2572
|
+
/* @__PURE__ */ l("div", { children: [
|
|
2573
|
+
/* @__PURE__ */ l("span", { style: C.divider, children: [
|
|
2574
|
+
H.loginText,
|
|
2575
|
+
" "
|
|
2576
|
+
] }),
|
|
2577
|
+
/* @__PURE__ */ n("a", { onClick: s, style: C.link, children: H.loginLink })
|
|
2133
2578
|
] }),
|
|
2134
|
-
/* @__PURE__ */
|
|
2579
|
+
/* @__PURE__ */ n("div", { style: C.divider, children: "•" }),
|
|
2580
|
+
/* @__PURE__ */ l("div", { children: [
|
|
2581
|
+
/* @__PURE__ */ l("span", { style: C.divider, children: [
|
|
2582
|
+
H.signupText,
|
|
2583
|
+
" "
|
|
2584
|
+
] }),
|
|
2585
|
+
/* @__PURE__ */ n("a", { onClick: a, style: C.link, children: H.signupLink })
|
|
2586
|
+
] })
|
|
2135
2587
|
] })
|
|
2136
2588
|
] });
|
|
2137
2589
|
}
|
|
2138
|
-
const
|
|
2590
|
+
const et = {
|
|
2591
|
+
title: "Verifying Magic Link",
|
|
2592
|
+
verifyingMessage: "Please wait while we verify your magic link...",
|
|
2593
|
+
successMessage: "Magic link verified successfully! You are now logged in.",
|
|
2594
|
+
errorMessage: "Failed to verify magic link. The link may be expired or invalid.",
|
|
2595
|
+
redirectingMessage: "Redirecting you to the dashboard...",
|
|
2596
|
+
retryButton: "Try Again",
|
|
2597
|
+
backToLoginButton: "Back to Login"
|
|
2598
|
+
}, Ae = {
|
|
2599
|
+
container: {
|
|
2600
|
+
maxWidth: "400px",
|
|
2601
|
+
width: "100%",
|
|
2602
|
+
margin: "0 auto",
|
|
2603
|
+
padding: "2rem",
|
|
2604
|
+
backgroundColor: "#ffffff",
|
|
2605
|
+
borderRadius: "8px",
|
|
2606
|
+
boxShadow: "0 2px 10px rgba(0, 0, 0, 0.1)"
|
|
2607
|
+
},
|
|
2608
|
+
card: {
|
|
2609
|
+
// Not used in new design, keeping for compatibility
|
|
2610
|
+
backgroundColor: "transparent",
|
|
2611
|
+
padding: "0",
|
|
2612
|
+
borderRadius: "0",
|
|
2613
|
+
boxShadow: "none",
|
|
2614
|
+
maxWidth: "100%",
|
|
2615
|
+
width: "100%",
|
|
2616
|
+
textAlign: "center"
|
|
2617
|
+
},
|
|
2618
|
+
title: {
|
|
2619
|
+
fontSize: "1.5rem",
|
|
2620
|
+
fontWeight: "bold",
|
|
2621
|
+
textAlign: "center",
|
|
2622
|
+
marginBottom: "1.5rem",
|
|
2623
|
+
color: "#333333"
|
|
2624
|
+
},
|
|
2625
|
+
message: {
|
|
2626
|
+
fontSize: "1rem",
|
|
2627
|
+
color: "#6b7280",
|
|
2628
|
+
marginBottom: "1.5rem",
|
|
2629
|
+
lineHeight: "1.5",
|
|
2630
|
+
textAlign: "center"
|
|
2631
|
+
},
|
|
2632
|
+
successMessage: {
|
|
2633
|
+
fontSize: "1rem",
|
|
2634
|
+
color: "#059669",
|
|
2635
|
+
marginBottom: "1.5rem",
|
|
2636
|
+
lineHeight: "1.5",
|
|
2637
|
+
textAlign: "center"
|
|
2638
|
+
},
|
|
2639
|
+
errorMessage: {
|
|
2640
|
+
fontSize: "0.875rem",
|
|
2641
|
+
color: "#ef4444",
|
|
2642
|
+
textAlign: "center",
|
|
2643
|
+
marginBottom: "1rem",
|
|
2644
|
+
lineHeight: "1.5"
|
|
2645
|
+
},
|
|
2646
|
+
spinner: {
|
|
2647
|
+
display: "inline-block",
|
|
2648
|
+
width: "20px",
|
|
2649
|
+
height: "20px",
|
|
2650
|
+
border: "2px solid #e5e7eb",
|
|
2651
|
+
borderTop: "2px solid #3b82f6",
|
|
2652
|
+
borderRadius: "50%",
|
|
2653
|
+
animation: "spin 1s linear infinite",
|
|
2654
|
+
marginRight: "0.5rem"
|
|
2655
|
+
},
|
|
2656
|
+
buttonContainer: {
|
|
2657
|
+
display: "flex",
|
|
2658
|
+
gap: "0.75rem",
|
|
2659
|
+
justifyContent: "center",
|
|
2660
|
+
flexWrap: "wrap",
|
|
2661
|
+
marginTop: "1rem"
|
|
2662
|
+
},
|
|
2663
|
+
retryButton: {
|
|
2664
|
+
padding: "0.75rem 1rem",
|
|
2665
|
+
backgroundColor: "#3b82f6",
|
|
2666
|
+
color: "white",
|
|
2667
|
+
border: "none",
|
|
2668
|
+
borderRadius: "6px",
|
|
2669
|
+
fontSize: "1rem",
|
|
2670
|
+
fontWeight: "500",
|
|
2671
|
+
cursor: "pointer",
|
|
2672
|
+
transition: "background-color 0.15s ease-in-out"
|
|
2673
|
+
},
|
|
2674
|
+
backButton: {
|
|
2675
|
+
padding: "0.75rem 1rem",
|
|
2676
|
+
backgroundColor: "#f3f4f6",
|
|
2677
|
+
color: "#374151",
|
|
2678
|
+
border: "1px solid #d1d5db",
|
|
2679
|
+
borderRadius: "6px",
|
|
2680
|
+
fontSize: "1rem",
|
|
2681
|
+
fontWeight: "500",
|
|
2682
|
+
cursor: "pointer",
|
|
2683
|
+
transition: "all 0.15s ease-in-out"
|
|
2684
|
+
}
|
|
2685
|
+
}, tt = () => /* @__PURE__ */ n("div", { style: Ae.spinner }), rt = () => /* @__PURE__ */ l(
|
|
2686
|
+
"svg",
|
|
2687
|
+
{
|
|
2688
|
+
width: "48",
|
|
2689
|
+
height: "48",
|
|
2690
|
+
viewBox: "0 0 24 24",
|
|
2691
|
+
fill: "none",
|
|
2692
|
+
stroke: "#059669",
|
|
2693
|
+
strokeWidth: "2",
|
|
2694
|
+
strokeLinecap: "round",
|
|
2695
|
+
strokeLinejoin: "round",
|
|
2696
|
+
style: { margin: "0 auto 1rem auto", display: "block" },
|
|
2697
|
+
children: [
|
|
2698
|
+
/* @__PURE__ */ n("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
2699
|
+
/* @__PURE__ */ n("polyline", { points: "22,4 12,14.01 9,11.01" })
|
|
2700
|
+
]
|
|
2701
|
+
}
|
|
2702
|
+
), nt = () => /* @__PURE__ */ l(
|
|
2703
|
+
"svg",
|
|
2704
|
+
{
|
|
2705
|
+
width: "48",
|
|
2706
|
+
height: "48",
|
|
2707
|
+
viewBox: "0 0 24 24",
|
|
2708
|
+
fill: "none",
|
|
2709
|
+
stroke: "#ef4444",
|
|
2710
|
+
strokeWidth: "2",
|
|
2711
|
+
strokeLinecap: "round",
|
|
2712
|
+
strokeLinejoin: "round",
|
|
2713
|
+
style: { margin: "0 auto 1rem auto", display: "block" },
|
|
2714
|
+
children: [
|
|
2715
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2716
|
+
/* @__PURE__ */ n("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
|
|
2717
|
+
/* @__PURE__ */ n("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
2718
|
+
]
|
|
2719
|
+
}
|
|
2720
|
+
), st = {
|
|
2721
|
+
loading: /* @__PURE__ */ n(tt, {}),
|
|
2722
|
+
success: /* @__PURE__ */ n(rt, {}),
|
|
2723
|
+
error: /* @__PURE__ */ n(nt, {})
|
|
2724
|
+
};
|
|
2725
|
+
function Lt({
|
|
2726
|
+
copy: i = {},
|
|
2727
|
+
styles: e = {},
|
|
2728
|
+
icons: t = {},
|
|
2729
|
+
onSuccess: r,
|
|
2730
|
+
onError: s,
|
|
2731
|
+
onRetry: a,
|
|
2732
|
+
onBackToLogin: b,
|
|
2733
|
+
className: E,
|
|
2734
|
+
token: L,
|
|
2735
|
+
email: P,
|
|
2736
|
+
appId: f,
|
|
2737
|
+
tenantId: m,
|
|
2738
|
+
autoRedirectDelay: M = 3e3
|
|
2739
|
+
}) {
|
|
2740
|
+
const [w, v] = p("verifying"), [I, g] = p(""), { verifyMagicLink: U } = ie(), u = { ...et, ...i }, y = { ...Ae, ...e }, x = { ...st, ...t }, F = () => {
|
|
2741
|
+
if (typeof window > "u") return {};
|
|
2742
|
+
const c = new URLSearchParams(window.location.search);
|
|
2743
|
+
return {
|
|
2744
|
+
token: L || c.get("token") || "",
|
|
2745
|
+
email: P || c.get("email") || "",
|
|
2746
|
+
appId: f || c.get("appId") || "",
|
|
2747
|
+
tenantId: m || c.get("tenantId") || void 0
|
|
2748
|
+
};
|
|
2749
|
+
}, B = async () => {
|
|
2750
|
+
v("verifying"), g("");
|
|
2751
|
+
try {
|
|
2752
|
+
const c = F();
|
|
2753
|
+
if (!c.token || !c.email || !c.appId)
|
|
2754
|
+
throw new Error("Missing required parameters: token, email, or appId");
|
|
2755
|
+
const h = await U(
|
|
2756
|
+
c.token,
|
|
2757
|
+
c.email,
|
|
2758
|
+
c.appId,
|
|
2759
|
+
c.tenantId
|
|
2760
|
+
);
|
|
2761
|
+
v("success"), r == null || r(h), M > 0 && setTimeout(() => {
|
|
2762
|
+
v("redirecting");
|
|
2763
|
+
}, M);
|
|
2764
|
+
} catch (c) {
|
|
2765
|
+
const h = c.message || u.errorMessage;
|
|
2766
|
+
g(h), v("error"), s == null || s(h);
|
|
2767
|
+
}
|
|
2768
|
+
}, z = () => {
|
|
2769
|
+
a == null || a(), B();
|
|
2770
|
+
}, q = () => {
|
|
2771
|
+
b == null || b();
|
|
2772
|
+
};
|
|
2773
|
+
Z(() => {
|
|
2774
|
+
B();
|
|
2775
|
+
}, []);
|
|
2776
|
+
const S = () => {
|
|
2777
|
+
switch (w) {
|
|
2778
|
+
case "verifying":
|
|
2779
|
+
return /* @__PURE__ */ l("div", { style: y.message, children: [
|
|
2780
|
+
x.loading,
|
|
2781
|
+
u.verifyingMessage
|
|
2782
|
+
] });
|
|
2783
|
+
case "success":
|
|
2784
|
+
return /* @__PURE__ */ l(D, { children: [
|
|
2785
|
+
x.success,
|
|
2786
|
+
/* @__PURE__ */ n("div", { style: y.successMessage, children: u.successMessage })
|
|
2787
|
+
] });
|
|
2788
|
+
case "redirecting":
|
|
2789
|
+
return /* @__PURE__ */ l(D, { children: [
|
|
2790
|
+
x.loading,
|
|
2791
|
+
/* @__PURE__ */ n("div", { style: y.message, children: u.redirectingMessage })
|
|
2792
|
+
] });
|
|
2793
|
+
case "error":
|
|
2794
|
+
return /* @__PURE__ */ l(D, { children: [
|
|
2795
|
+
x.error,
|
|
2796
|
+
/* @__PURE__ */ n("div", { style: y.errorMessage, children: I || u.errorMessage }),
|
|
2797
|
+
/* @__PURE__ */ l("div", { style: y.buttonContainer, children: [
|
|
2798
|
+
/* @__PURE__ */ n(
|
|
2799
|
+
"button",
|
|
2800
|
+
{
|
|
2801
|
+
onClick: z,
|
|
2802
|
+
style: y.retryButton,
|
|
2803
|
+
onMouseOver: (c) => {
|
|
2804
|
+
c.currentTarget.style.backgroundColor = "#2563eb";
|
|
2805
|
+
},
|
|
2806
|
+
onMouseOut: (c) => {
|
|
2807
|
+
c.currentTarget.style.backgroundColor = "#3b82f6";
|
|
2808
|
+
},
|
|
2809
|
+
children: u.retryButton
|
|
2810
|
+
}
|
|
2811
|
+
),
|
|
2812
|
+
/* @__PURE__ */ n(
|
|
2813
|
+
"button",
|
|
2814
|
+
{
|
|
2815
|
+
onClick: q,
|
|
2816
|
+
style: y.backButton,
|
|
2817
|
+
onMouseOver: (c) => {
|
|
2818
|
+
c.currentTarget.style.backgroundColor = "#e5e7eb";
|
|
2819
|
+
},
|
|
2820
|
+
onMouseOut: (c) => {
|
|
2821
|
+
c.currentTarget.style.backgroundColor = "#f3f4f6";
|
|
2822
|
+
},
|
|
2823
|
+
children: u.backToLoginButton
|
|
2824
|
+
}
|
|
2825
|
+
)
|
|
2826
|
+
] })
|
|
2827
|
+
] });
|
|
2828
|
+
default:
|
|
2829
|
+
return null;
|
|
2830
|
+
}
|
|
2831
|
+
};
|
|
2832
|
+
return /* @__PURE__ */ l("div", { style: y.container, className: E, children: [
|
|
2833
|
+
/* @__PURE__ */ n("style", { children: `
|
|
2834
|
+
@keyframes spin {
|
|
2835
|
+
0% { transform: rotate(0deg); }
|
|
2836
|
+
100% { transform: rotate(360deg); }
|
|
2837
|
+
}
|
|
2838
|
+
` }),
|
|
2839
|
+
/* @__PURE__ */ n("h1", { style: y.title, children: u.title }),
|
|
2840
|
+
S()
|
|
2841
|
+
] });
|
|
2842
|
+
}
|
|
2843
|
+
const it = {
|
|
2139
2844
|
title: "Reset Password",
|
|
2140
2845
|
subtitle: "Enter your email address and we'll send you a link to reset your password.",
|
|
2141
2846
|
emailLabel: "Email",
|
|
@@ -2157,7 +2862,7 @@ const Ge = {
|
|
|
2157
2862
|
resetLoadingText: "Resetting...",
|
|
2158
2863
|
resetSuccessMessage: "Password reset successfully!",
|
|
2159
2864
|
passwordMismatchError: "Passwords do not match"
|
|
2160
|
-
},
|
|
2865
|
+
}, ot = {
|
|
2161
2866
|
container: {
|
|
2162
2867
|
maxWidth: "400px",
|
|
2163
2868
|
margin: "0 auto",
|
|
@@ -2249,186 +2954,186 @@ const Ge = {
|
|
|
2249
2954
|
cursor: "pointer"
|
|
2250
2955
|
}
|
|
2251
2956
|
};
|
|
2252
|
-
function
|
|
2957
|
+
function Rt({
|
|
2253
2958
|
copy: i = {},
|
|
2254
2959
|
styles: e = {},
|
|
2255
2960
|
mode: t = "request",
|
|
2256
2961
|
token: r = "",
|
|
2257
|
-
onSuccess:
|
|
2258
|
-
onError:
|
|
2259
|
-
onBackToLogin:
|
|
2260
|
-
onModeChange:
|
|
2261
|
-
className:
|
|
2962
|
+
onSuccess: s,
|
|
2963
|
+
onError: a,
|
|
2964
|
+
onBackToLogin: b,
|
|
2965
|
+
onModeChange: E,
|
|
2966
|
+
className: L
|
|
2262
2967
|
}) {
|
|
2263
|
-
const [P,
|
|
2264
|
-
const
|
|
2265
|
-
return P.trim() || (
|
|
2266
|
-
},
|
|
2267
|
-
const
|
|
2268
|
-
return
|
|
2269
|
-
},
|
|
2270
|
-
if (
|
|
2271
|
-
if (!(
|
|
2272
|
-
|
|
2968
|
+
const [P, f] = p(""), [m, M] = p(r), [w, v] = p(""), [I, g] = p(""), [U, u] = p(!1), [y, x] = p(""), [F, B] = p(""), [z, q] = p({}), { requestPasswordReset: S, confirmPasswordReset: c } = ie(), { tenant: h } = re(), o = { ...it, ...i }, d = { ...ot, ...e }, G = () => {
|
|
2969
|
+
const O = {};
|
|
2970
|
+
return P.trim() || (O.email = !0), q(O), Object.keys(O).length === 0;
|
|
2971
|
+
}, Y = () => {
|
|
2972
|
+
const O = {};
|
|
2973
|
+
return m.trim() || (O.token = !0), w.trim() || (O.newPassword = !0), I.trim() || (O.confirmPassword = !0), q(O), Object.keys(O).length === 0;
|
|
2974
|
+
}, H = async (O) => {
|
|
2975
|
+
if (O.preventDefault(), !!G()) {
|
|
2976
|
+
if (!(h != null && h.id)) {
|
|
2977
|
+
x("Tenant not found");
|
|
2273
2978
|
return;
|
|
2274
2979
|
}
|
|
2275
|
-
|
|
2980
|
+
u(!0), x(""), B("");
|
|
2276
2981
|
try {
|
|
2277
|
-
await
|
|
2278
|
-
} catch (
|
|
2279
|
-
const
|
|
2280
|
-
|
|
2982
|
+
await S(P, h.id), B(o.successMessage), s == null || s();
|
|
2983
|
+
} catch (j) {
|
|
2984
|
+
const N = j.message || o.errorMessage;
|
|
2985
|
+
x(N), a == null || a(N);
|
|
2281
2986
|
} finally {
|
|
2282
|
-
|
|
2987
|
+
u(!1);
|
|
2283
2988
|
}
|
|
2284
2989
|
}
|
|
2285
|
-
},
|
|
2286
|
-
if (
|
|
2287
|
-
if (
|
|
2288
|
-
|
|
2990
|
+
}, C = async (O) => {
|
|
2991
|
+
if (O.preventDefault(), !!Y()) {
|
|
2992
|
+
if (w !== I) {
|
|
2993
|
+
x(o.passwordMismatchError), q({ confirmPassword: !0 });
|
|
2289
2994
|
return;
|
|
2290
2995
|
}
|
|
2291
|
-
|
|
2996
|
+
u(!0), x(""), B("");
|
|
2292
2997
|
try {
|
|
2293
|
-
await
|
|
2294
|
-
} catch (
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2998
|
+
await c(m, w), B(o.resetSuccessMessage), s == null || s();
|
|
2999
|
+
} catch (j) {
|
|
3000
|
+
const N = j.message || o.errorMessage;
|
|
3001
|
+
x(N), a == null || a(N);
|
|
2297
3002
|
} finally {
|
|
2298
|
-
|
|
3003
|
+
u(!1);
|
|
2299
3004
|
}
|
|
2300
3005
|
}
|
|
2301
|
-
},
|
|
2302
|
-
...
|
|
2303
|
-
...
|
|
2304
|
-
}),
|
|
2305
|
-
...
|
|
2306
|
-
...
|
|
3006
|
+
}, k = (O) => ({
|
|
3007
|
+
...d.input,
|
|
3008
|
+
...z[O] ? d.inputError : {}
|
|
3009
|
+
}), T = () => ({
|
|
3010
|
+
...d.button,
|
|
3011
|
+
...U ? d.buttonLoading : {}
|
|
2307
3012
|
});
|
|
2308
3013
|
if (t === "reset") {
|
|
2309
|
-
const
|
|
2310
|
-
return /* @__PURE__ */
|
|
2311
|
-
/* @__PURE__ */
|
|
2312
|
-
/* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2316
|
-
/* @__PURE__ */
|
|
3014
|
+
const O = m && w && I;
|
|
3015
|
+
return /* @__PURE__ */ l("div", { className: L, style: d.container, children: [
|
|
3016
|
+
/* @__PURE__ */ n("h2", { style: d.title, children: o.resetTitle }),
|
|
3017
|
+
/* @__PURE__ */ n("p", { style: d.subtitle, children: o.resetSubtitle }),
|
|
3018
|
+
/* @__PURE__ */ l("form", { onSubmit: C, style: d.form, children: [
|
|
3019
|
+
/* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
|
|
3020
|
+
/* @__PURE__ */ n("label", { style: d.label, children: o.tokenLabel }),
|
|
3021
|
+
/* @__PURE__ */ n(
|
|
2317
3022
|
"input",
|
|
2318
3023
|
{
|
|
2319
3024
|
type: "text",
|
|
2320
|
-
value:
|
|
2321
|
-
onChange: (
|
|
2322
|
-
|
|
3025
|
+
value: m,
|
|
3026
|
+
onChange: (j) => {
|
|
3027
|
+
M(j.target.value), z.token && q((N) => ({ ...N, token: !1 }));
|
|
2323
3028
|
},
|
|
2324
|
-
placeholder:
|
|
2325
|
-
style:
|
|
2326
|
-
disabled:
|
|
3029
|
+
placeholder: o.tokenPlaceholder,
|
|
3030
|
+
style: k("token"),
|
|
3031
|
+
disabled: U
|
|
2327
3032
|
}
|
|
2328
3033
|
)
|
|
2329
3034
|
] }),
|
|
2330
|
-
/* @__PURE__ */
|
|
2331
|
-
/* @__PURE__ */
|
|
2332
|
-
/* @__PURE__ */
|
|
3035
|
+
/* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
|
|
3036
|
+
/* @__PURE__ */ n("label", { style: d.label, children: o.newPasswordLabel }),
|
|
3037
|
+
/* @__PURE__ */ n(
|
|
2333
3038
|
"input",
|
|
2334
3039
|
{
|
|
2335
3040
|
type: "password",
|
|
2336
|
-
value:
|
|
2337
|
-
onChange: (
|
|
2338
|
-
|
|
3041
|
+
value: w,
|
|
3042
|
+
onChange: (j) => {
|
|
3043
|
+
v(j.target.value), z.newPassword && q((N) => ({ ...N, newPassword: !1 }));
|
|
2339
3044
|
},
|
|
2340
|
-
placeholder:
|
|
2341
|
-
style:
|
|
2342
|
-
disabled:
|
|
3045
|
+
placeholder: o.newPasswordPlaceholder,
|
|
3046
|
+
style: k("newPassword"),
|
|
3047
|
+
disabled: U
|
|
2343
3048
|
}
|
|
2344
3049
|
)
|
|
2345
3050
|
] }),
|
|
2346
|
-
/* @__PURE__ */
|
|
2347
|
-
/* @__PURE__ */
|
|
2348
|
-
/* @__PURE__ */
|
|
3051
|
+
/* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
|
|
3052
|
+
/* @__PURE__ */ n("label", { style: d.label, children: o.confirmPasswordLabel }),
|
|
3053
|
+
/* @__PURE__ */ n(
|
|
2349
3054
|
"input",
|
|
2350
3055
|
{
|
|
2351
3056
|
type: "password",
|
|
2352
|
-
value:
|
|
2353
|
-
onChange: (
|
|
2354
|
-
|
|
3057
|
+
value: I,
|
|
3058
|
+
onChange: (j) => {
|
|
3059
|
+
g(j.target.value), z.confirmPassword && q((N) => ({ ...N, confirmPassword: !1 })), y === o.passwordMismatchError && x("");
|
|
2355
3060
|
},
|
|
2356
|
-
placeholder:
|
|
2357
|
-
style:
|
|
2358
|
-
disabled:
|
|
3061
|
+
placeholder: o.confirmPasswordPlaceholder,
|
|
3062
|
+
style: k("confirmPassword"),
|
|
3063
|
+
disabled: U
|
|
2359
3064
|
}
|
|
2360
3065
|
)
|
|
2361
3066
|
] }),
|
|
2362
|
-
/* @__PURE__ */
|
|
3067
|
+
/* @__PURE__ */ n(
|
|
2363
3068
|
"button",
|
|
2364
3069
|
{
|
|
2365
3070
|
type: "submit",
|
|
2366
|
-
disabled: !
|
|
3071
|
+
disabled: !O || U,
|
|
2367
3072
|
style: {
|
|
2368
|
-
...
|
|
2369
|
-
...!
|
|
3073
|
+
...T(),
|
|
3074
|
+
...!O || U ? d.buttonDisabled : {}
|
|
2370
3075
|
},
|
|
2371
|
-
children:
|
|
3076
|
+
children: U ? o.resetLoadingText : o.resetSubmitButton
|
|
2372
3077
|
}
|
|
2373
3078
|
),
|
|
2374
|
-
|
|
2375
|
-
|
|
3079
|
+
y && /* @__PURE__ */ n("div", { style: d.errorText, children: y }),
|
|
3080
|
+
F && /* @__PURE__ */ n("div", { style: d.successText, children: F })
|
|
2376
3081
|
] }),
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
/* @__PURE__ */
|
|
2379
|
-
|
|
2380
|
-
/* @__PURE__ */
|
|
2381
|
-
/* @__PURE__ */
|
|
3082
|
+
/* @__PURE__ */ l("div", { style: d.linkContainer, children: [
|
|
3083
|
+
/* @__PURE__ */ n("a", { onClick: b, style: d.link, children: o.backToLoginLink }),
|
|
3084
|
+
E && /* @__PURE__ */ l(D, { children: [
|
|
3085
|
+
/* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3086
|
+
/* @__PURE__ */ n("a", { onClick: () => E("request"), style: d.link, children: "Request New Link" })
|
|
2382
3087
|
] })
|
|
2383
3088
|
] })
|
|
2384
3089
|
] });
|
|
2385
3090
|
}
|
|
2386
|
-
const
|
|
2387
|
-
return /* @__PURE__ */
|
|
2388
|
-
/* @__PURE__ */
|
|
2389
|
-
/* @__PURE__ */
|
|
2390
|
-
/* @__PURE__ */
|
|
2391
|
-
/* @__PURE__ */
|
|
2392
|
-
/* @__PURE__ */
|
|
2393
|
-
/* @__PURE__ */
|
|
3091
|
+
const J = P;
|
|
3092
|
+
return /* @__PURE__ */ l("div", { className: L, style: d.container, children: [
|
|
3093
|
+
/* @__PURE__ */ n("h2", { style: d.title, children: o.title }),
|
|
3094
|
+
/* @__PURE__ */ n("p", { style: d.subtitle, children: o.subtitle }),
|
|
3095
|
+
/* @__PURE__ */ l("form", { onSubmit: H, style: d.form, children: [
|
|
3096
|
+
/* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
|
|
3097
|
+
/* @__PURE__ */ n("label", { style: d.label, children: o.emailLabel }),
|
|
3098
|
+
/* @__PURE__ */ n(
|
|
2394
3099
|
"input",
|
|
2395
3100
|
{
|
|
2396
3101
|
type: "email",
|
|
2397
3102
|
value: P,
|
|
2398
|
-
onChange: (
|
|
2399
|
-
|
|
3103
|
+
onChange: (O) => {
|
|
3104
|
+
f(O.target.value), z.email && q((j) => ({ ...j, email: !1 }));
|
|
2400
3105
|
},
|
|
2401
|
-
placeholder:
|
|
2402
|
-
style:
|
|
2403
|
-
disabled:
|
|
3106
|
+
placeholder: o.emailPlaceholder,
|
|
3107
|
+
style: k("email"),
|
|
3108
|
+
disabled: U
|
|
2404
3109
|
}
|
|
2405
3110
|
)
|
|
2406
3111
|
] }),
|
|
2407
|
-
/* @__PURE__ */
|
|
3112
|
+
/* @__PURE__ */ n(
|
|
2408
3113
|
"button",
|
|
2409
3114
|
{
|
|
2410
3115
|
type: "submit",
|
|
2411
|
-
disabled: !
|
|
3116
|
+
disabled: !J || U,
|
|
2412
3117
|
style: {
|
|
2413
|
-
...
|
|
2414
|
-
...!
|
|
3118
|
+
...T(),
|
|
3119
|
+
...!J || U ? d.buttonDisabled : {}
|
|
2415
3120
|
},
|
|
2416
|
-
children:
|
|
3121
|
+
children: U ? o.loadingText : o.submitButton
|
|
2417
3122
|
}
|
|
2418
3123
|
),
|
|
2419
|
-
|
|
2420
|
-
|
|
3124
|
+
y && /* @__PURE__ */ n("div", { style: d.errorText, children: y }),
|
|
3125
|
+
F && /* @__PURE__ */ n("div", { style: d.successText, children: F })
|
|
2421
3126
|
] }),
|
|
2422
|
-
/* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
3127
|
+
/* @__PURE__ */ l("div", { style: d.linkContainer, children: [
|
|
3128
|
+
/* @__PURE__ */ n("a", { onClick: b, style: d.link, children: o.backToLoginLink }),
|
|
3129
|
+
E && /* @__PURE__ */ l(D, { children: [
|
|
3130
|
+
/* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3131
|
+
/* @__PURE__ */ n("a", { onClick: () => E("reset"), style: d.link, children: "I have a token" })
|
|
2427
3132
|
] })
|
|
2428
3133
|
] })
|
|
2429
3134
|
] });
|
|
2430
3135
|
}
|
|
2431
|
-
class
|
|
3136
|
+
class Ct {
|
|
2432
3137
|
constructor(e, t) {
|
|
2433
3138
|
this.httpService = e, this.sessionManager = t;
|
|
2434
3139
|
}
|
|
@@ -2449,12 +3154,12 @@ class wt {
|
|
|
2449
3154
|
throw new Error("SessionManager is required for private endpoints");
|
|
2450
3155
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
2451
3156
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
|
|
2452
|
-
const
|
|
3157
|
+
const s = `/permissions/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
|
|
2453
3158
|
headers: t
|
|
2454
3159
|
});
|
|
2455
3160
|
return {
|
|
2456
|
-
permissions:
|
|
2457
|
-
meta:
|
|
3161
|
+
permissions: a.data,
|
|
3162
|
+
meta: a.meta
|
|
2458
3163
|
};
|
|
2459
3164
|
}
|
|
2460
3165
|
async getPermissionById(e) {
|
|
@@ -2489,14 +3194,14 @@ class wt {
|
|
|
2489
3194
|
async getAppPermissions(e, t) {
|
|
2490
3195
|
const r = new URLSearchParams();
|
|
2491
3196
|
t != null && t.page && r.append("page", t.page.toString()), t != null && t.limit && r.append("limit", t.limit.toString()), t != null && t.sortBy && r.append("sortBy", t.sortBy), t != null && t.sortOrder && r.append("sortOrder", t.sortOrder);
|
|
2492
|
-
const
|
|
3197
|
+
const s = `/permissions/apps/${e}${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s);
|
|
2493
3198
|
return {
|
|
2494
|
-
permissions:
|
|
2495
|
-
meta:
|
|
3199
|
+
permissions: a.data,
|
|
3200
|
+
meta: a.meta
|
|
2496
3201
|
};
|
|
2497
3202
|
}
|
|
2498
3203
|
}
|
|
2499
|
-
class
|
|
3204
|
+
class It {
|
|
2500
3205
|
constructor(e, t) {
|
|
2501
3206
|
this.httpService = e, this.sessionManager = t;
|
|
2502
3207
|
}
|
|
@@ -2513,12 +3218,12 @@ class mt {
|
|
|
2513
3218
|
async getSubscriptionPlans(e) {
|
|
2514
3219
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
2515
3220
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder), e != null && e.appId && r.append("appId", e.appId);
|
|
2516
|
-
const
|
|
3221
|
+
const s = `/subscription-plans/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
|
|
2517
3222
|
headers: t
|
|
2518
3223
|
});
|
|
2519
3224
|
return {
|
|
2520
|
-
plans:
|
|
2521
|
-
meta:
|
|
3225
|
+
plans: a.data,
|
|
3226
|
+
meta: a.meta
|
|
2522
3227
|
};
|
|
2523
3228
|
}
|
|
2524
3229
|
async getSubscriptionPlanById(e) {
|
|
@@ -2547,7 +3252,7 @@ class mt {
|
|
|
2547
3252
|
});
|
|
2548
3253
|
}
|
|
2549
3254
|
}
|
|
2550
|
-
class
|
|
3255
|
+
class Ft {
|
|
2551
3256
|
constructor(e) {
|
|
2552
3257
|
this.httpService = e;
|
|
2553
3258
|
}
|
|
@@ -2556,7 +3261,7 @@ class bt {
|
|
|
2556
3261
|
return await this.httpService.get("/health");
|
|
2557
3262
|
}
|
|
2558
3263
|
}
|
|
2559
|
-
class
|
|
3264
|
+
class Ht {
|
|
2560
3265
|
// Date string to Date object
|
|
2561
3266
|
static toDate(e) {
|
|
2562
3267
|
return new Date(e);
|
|
@@ -2673,48 +3378,50 @@ class St {
|
|
|
2673
3378
|
// Transform query parameters for API calls
|
|
2674
3379
|
static transformQueryParams(e) {
|
|
2675
3380
|
const t = new URLSearchParams();
|
|
2676
|
-
return Object.entries(e).forEach(([r,
|
|
2677
|
-
|
|
3381
|
+
return Object.entries(e).forEach(([r, s]) => {
|
|
3382
|
+
s != null && s !== "" && t.append(r, String(s));
|
|
2678
3383
|
}), t;
|
|
2679
3384
|
}
|
|
2680
3385
|
}
|
|
2681
3386
|
export {
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
se as
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
3387
|
+
Ht as ApiMappers,
|
|
3388
|
+
Te as AppApiService,
|
|
3389
|
+
ht as AppProvider,
|
|
3390
|
+
Re as AuthApiService,
|
|
3391
|
+
yt as AuthProvider,
|
|
3392
|
+
Pt as FeatureFlag,
|
|
3393
|
+
He as FeatureFlagApiService,
|
|
3394
|
+
bt as FeatureFlagProvider,
|
|
3395
|
+
Ft as HealthApiService,
|
|
3396
|
+
te as HttpService,
|
|
3397
|
+
kt as LandingRoute,
|
|
3398
|
+
Tt as LoginForm,
|
|
3399
|
+
Et as MagicLinkForm,
|
|
3400
|
+
Lt as MagicLinkVerify,
|
|
3401
|
+
Rt as PasswordRecoveryForm,
|
|
3402
|
+
Ct as PermissionApiService,
|
|
3403
|
+
vt as Protected,
|
|
3404
|
+
St as ProtectedRoute,
|
|
3405
|
+
pe as RoleApiService,
|
|
3406
|
+
Le as SessionManager,
|
|
3407
|
+
Mt as SignupForm,
|
|
3408
|
+
De as SubscriptionApiService,
|
|
3409
|
+
At as SubscriptionGuard,
|
|
3410
|
+
It as SubscriptionPlanApiService,
|
|
3411
|
+
wt as SubscriptionProvider,
|
|
3412
|
+
fe as TenantApiService,
|
|
3413
|
+
pt as TenantProvider,
|
|
3414
|
+
xt as TenantRoute,
|
|
3415
|
+
Ce as UserApiService,
|
|
3416
|
+
se as UserType,
|
|
3417
|
+
gt as useApi,
|
|
3418
|
+
ne as useApp,
|
|
3419
|
+
ie as useAuth,
|
|
3420
|
+
$e as useFeatureFlags,
|
|
3421
|
+
mt as useSettings,
|
|
3422
|
+
Be as useSubscription,
|
|
3423
|
+
ge as useTenant,
|
|
3424
|
+
re as useTenantInfo,
|
|
3425
|
+
ft as useTenantSettings
|
|
2719
3426
|
};
|
|
2720
3427
|
//# sourceMappingURL=index.es.js.map
|