@skylabs-digital/react-identity-access 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1048 -987
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/providers/AuthProvider.d.ts.map +1 -1
- package/dist/providers/TenantProvider.d.ts +6 -1
- package/dist/providers/TenantProvider.d.ts.map +1 -1
- package/dist/utils/crossDomainAuth.d.ts +37 -0
- package/dist/utils/crossDomainAuth.d.ts.map +1 -0
- package/dist/utils/tenantDetection.d.ts +8 -0
- package/dist/utils/tenantDetection.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as n, Fragment as
|
|
2
|
-
import { createContext as he, useMemo as
|
|
3
|
-
import { useLocation as
|
|
1
|
+
import { jsx as n, Fragment as U, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as he, useMemo as X, useState as x, useCallback as ne, useEffect as te, useContext as ce, useRef as Be } from "react";
|
|
3
|
+
import { useLocation as be, Navigate as pe } from "react-router-dom";
|
|
4
4
|
class re {
|
|
5
5
|
// SessionManager instance
|
|
6
6
|
constructor(e, t = 1e4) {
|
|
@@ -16,40 +16,40 @@ class re {
|
|
|
16
16
|
return this.executeRequest(e, t, r, s, !1);
|
|
17
17
|
}
|
|
18
18
|
async executeRequest(e, t, r, s, o = !1) {
|
|
19
|
-
const
|
|
20
|
-
let
|
|
19
|
+
const p = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, b = (s == null ? void 0 : s.timeout) || this.timeout;
|
|
20
|
+
let k = {
|
|
21
21
|
"Content-Type": "application/json",
|
|
22
22
|
...s == null ? void 0 : s.headers
|
|
23
23
|
};
|
|
24
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
|
+
k = { ...k, ...m };
|
|
28
|
+
} catch (m) {
|
|
29
|
+
console.warn("Failed to inject auth headers:", m);
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const S = new AbortController(), T = setTimeout(() => S.abort(), b);
|
|
32
32
|
try {
|
|
33
|
-
const
|
|
33
|
+
const m = await fetch(p, {
|
|
34
34
|
method: e,
|
|
35
|
-
headers:
|
|
35
|
+
headers: k,
|
|
36
36
|
body: r ? JSON.stringify(r) : void 0,
|
|
37
|
-
signal:
|
|
37
|
+
signal: S.signal
|
|
38
38
|
});
|
|
39
|
-
if (clearTimeout(T),
|
|
39
|
+
if (clearTimeout(T), m.status === 401 && !(s != null && s.skipRetry) && !o && this.sessionManager)
|
|
40
40
|
try {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
41
|
+
const u = this.sessionManager.getTokens();
|
|
42
|
+
if (u != null && u.refreshToken)
|
|
43
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(T),
|
|
47
|
+
if (!m.ok)
|
|
48
|
+
throw new Error(`HTTP ${m.status}: ${m.statusText}`);
|
|
49
|
+
const f = m.headers.get("content-type");
|
|
50
|
+
return !f || !f.includes("application/json") ? {} : await m.json();
|
|
51
|
+
} catch (m) {
|
|
52
|
+
throw clearTimeout(T), m instanceof Error && m.name === "AbortError" ? new Error(`Request timeout after ${b}ms`) : m;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
async get(e, t) {
|
|
@@ -65,7 +65,7 @@ class re {
|
|
|
65
65
|
return this.request("DELETE", e, void 0, t);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
class
|
|
68
|
+
class ve {
|
|
69
69
|
constructor(e, t) {
|
|
70
70
|
this.httpService = e, this.sessionManager = t;
|
|
71
71
|
}
|
|
@@ -124,31 +124,31 @@ class Se {
|
|
|
124
124
|
})).data;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
const
|
|
128
|
-
function
|
|
129
|
-
const t =
|
|
127
|
+
const Pe = he(null);
|
|
128
|
+
function Et({ config: i, children: e }) {
|
|
129
|
+
const t = X(
|
|
130
130
|
() => {
|
|
131
|
-
var
|
|
131
|
+
var f, u, y;
|
|
132
132
|
return {
|
|
133
|
-
enabled: ((
|
|
134
|
-
ttl: ((
|
|
133
|
+
enabled: ((f = i.cache) == null ? void 0 : f.enabled) ?? !0,
|
|
134
|
+
ttl: ((u = i.cache) == null ? void 0 : u.ttl) ?? 3e5,
|
|
135
135
|
// 5 minutes default
|
|
136
|
-
storageKey: ((
|
|
136
|
+
storageKey: ((y = i.cache) == null ? void 0 : y.storageKey) ?? `app_cache_${i.appId}`
|
|
137
137
|
};
|
|
138
138
|
},
|
|
139
139
|
[i.cache, i.appId]
|
|
140
|
-
), [r, s] =
|
|
140
|
+
), [r, s] = x(() => {
|
|
141
141
|
if (!t.enabled) return null;
|
|
142
142
|
try {
|
|
143
|
-
const
|
|
144
|
-
if (!
|
|
145
|
-
const
|
|
146
|
-
return Date.now() -
|
|
143
|
+
const f = localStorage.getItem(t.storageKey);
|
|
144
|
+
if (!f) return null;
|
|
145
|
+
const u = JSON.parse(f);
|
|
146
|
+
return Date.now() - u.timestamp < t.ttl && u.appId === i.appId ? u.data : (localStorage.removeItem(t.storageKey), null);
|
|
147
147
|
} catch {
|
|
148
148
|
return null;
|
|
149
149
|
}
|
|
150
|
-
}), [o,
|
|
151
|
-
const
|
|
150
|
+
}), [o, p] = x(!r), [b, k] = x(null), S = X(() => {
|
|
151
|
+
const f = () => {
|
|
152
152
|
T();
|
|
153
153
|
};
|
|
154
154
|
return {
|
|
@@ -157,15 +157,15 @@ function xt({ config: i, children: e }) {
|
|
|
157
157
|
// App info
|
|
158
158
|
appInfo: r,
|
|
159
159
|
isAppLoading: o,
|
|
160
|
-
appError:
|
|
161
|
-
retryApp:
|
|
160
|
+
appError: b,
|
|
161
|
+
retryApp: f
|
|
162
162
|
};
|
|
163
|
-
}, [i, r, o,
|
|
164
|
-
async (
|
|
165
|
-
if (!(!
|
|
163
|
+
}, [i, r, o, b]), T = ne(
|
|
164
|
+
async (f = !1) => {
|
|
165
|
+
if (!(!f && t.enabled && r))
|
|
166
166
|
try {
|
|
167
|
-
|
|
168
|
-
const
|
|
167
|
+
p(!0), k(null);
|
|
168
|
+
const u = new re(i.baseUrl), R = await new ve(u, {}).getPublicAppInfo(i.appId);
|
|
169
169
|
if (s(R), t.enabled)
|
|
170
170
|
try {
|
|
171
171
|
const C = {
|
|
@@ -177,46 +177,46 @@ function xt({ config: i, children: e }) {
|
|
|
177
177
|
} catch (C) {
|
|
178
178
|
console.warn("Failed to cache app info:", C);
|
|
179
179
|
}
|
|
180
|
-
} catch (
|
|
181
|
-
const
|
|
182
|
-
|
|
180
|
+
} catch (u) {
|
|
181
|
+
const y = u instanceof Error ? u : new Error("Failed to load app information");
|
|
182
|
+
k(y), s(null);
|
|
183
183
|
} finally {
|
|
184
|
-
|
|
184
|
+
p(!1);
|
|
185
185
|
}
|
|
186
186
|
},
|
|
187
187
|
[i.baseUrl, i.appId, t, r]
|
|
188
|
-
),
|
|
188
|
+
), m = ne(async () => {
|
|
189
189
|
if (!(!t.enabled || !r))
|
|
190
190
|
try {
|
|
191
|
-
const
|
|
192
|
-
if (!
|
|
193
|
-
const
|
|
194
|
-
if (Date.now() -
|
|
195
|
-
const R = new re(i.baseUrl),
|
|
196
|
-
s(
|
|
197
|
-
const
|
|
198
|
-
data:
|
|
191
|
+
const f = localStorage.getItem(t.storageKey);
|
|
192
|
+
if (!f) return;
|
|
193
|
+
const u = JSON.parse(f);
|
|
194
|
+
if (Date.now() - u.timestamp > t.ttl * 0.5) {
|
|
195
|
+
const R = new re(i.baseUrl), q = await new ve(R, {}).getPublicAppInfo(i.appId);
|
|
196
|
+
s(q);
|
|
197
|
+
const A = {
|
|
198
|
+
data: q,
|
|
199
199
|
timestamp: Date.now(),
|
|
200
200
|
appId: i.appId
|
|
201
201
|
};
|
|
202
|
-
localStorage.setItem(t.storageKey, JSON.stringify(
|
|
202
|
+
localStorage.setItem(t.storageKey, JSON.stringify(A));
|
|
203
203
|
}
|
|
204
|
-
} catch (
|
|
205
|
-
console.warn("Background app refresh failed:",
|
|
204
|
+
} catch (f) {
|
|
205
|
+
console.warn("Background app refresh failed:", f);
|
|
206
206
|
}
|
|
207
207
|
}, [i, t, r]);
|
|
208
208
|
return te(() => {
|
|
209
|
-
r ?
|
|
210
|
-
}, []), /* @__PURE__ */ n(
|
|
209
|
+
r ? m() : T();
|
|
210
|
+
}, []), /* @__PURE__ */ n(Pe.Provider, { value: S, children: e });
|
|
211
211
|
}
|
|
212
212
|
function oe() {
|
|
213
|
-
const i = ce(
|
|
213
|
+
const i = ce(Pe);
|
|
214
214
|
if (!i)
|
|
215
215
|
throw new Error("useApp must be used within an AppProvider");
|
|
216
216
|
return i;
|
|
217
217
|
}
|
|
218
|
-
const
|
|
219
|
-
class
|
|
218
|
+
const Rt = oe;
|
|
219
|
+
class we {
|
|
220
220
|
constructor(e = {}) {
|
|
221
221
|
this.refreshPromise = null, this.refreshQueue = [], e.tenantSlug !== void 0 ? this.storageKey = e.tenantSlug ? `auth_tokens_${e.tenantSlug}` : "auth_tokens" : 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 || this.createTokenStorage(this.storageKey);
|
|
222
222
|
}
|
|
@@ -369,7 +369,7 @@ class ye {
|
|
|
369
369
|
return e !== null && !this.isTokenExpired(e);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
class
|
|
372
|
+
class Ue {
|
|
373
373
|
constructor(e) {
|
|
374
374
|
this.httpService = e;
|
|
375
375
|
}
|
|
@@ -414,7 +414,7 @@ class He {
|
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
class
|
|
417
|
+
class xe {
|
|
418
418
|
constructor(e, t) {
|
|
419
419
|
this.httpService = e, this.sessionManager = t;
|
|
420
420
|
}
|
|
@@ -481,16 +481,16 @@ class ve {
|
|
|
481
481
|
throw new Error("SessionManager is required for private endpoints");
|
|
482
482
|
const r = await this.sessionManager.getAuthHeaders(), s = new URLSearchParams();
|
|
483
483
|
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);
|
|
484
|
-
const o = `/roles/user/${e}${s.toString() ? `?${s.toString()}` : ""}`,
|
|
484
|
+
const o = `/roles/user/${e}${s.toString() ? `?${s.toString()}` : ""}`, p = await this.httpService.get(o, {
|
|
485
485
|
headers: r
|
|
486
486
|
});
|
|
487
487
|
return {
|
|
488
|
-
roles:
|
|
489
|
-
meta:
|
|
488
|
+
roles: p.data,
|
|
489
|
+
meta: p.meta
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
class
|
|
493
|
+
class qe {
|
|
494
494
|
constructor(e, t) {
|
|
495
495
|
this.httpService = e, this.sessionManager = t;
|
|
496
496
|
}
|
|
@@ -608,7 +608,7 @@ class ue {
|
|
|
608
608
|
)).data;
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function ze(i, e) {
|
|
612
612
|
if (i === "localhost" || i.startsWith("127.") || i.startsWith("192.168."))
|
|
613
613
|
return null;
|
|
614
614
|
if (e) {
|
|
@@ -616,25 +616,57 @@ function Be(i, e) {
|
|
|
616
616
|
if (o === s || o === `www.${s}`)
|
|
617
617
|
return null;
|
|
618
618
|
if (o.endsWith(`.${s}`)) {
|
|
619
|
-
const
|
|
620
|
-
return
|
|
619
|
+
const p = o.slice(0, -(s.length + 1));
|
|
620
|
+
return p === "www" ? null : p;
|
|
621
621
|
}
|
|
622
622
|
return null;
|
|
623
623
|
}
|
|
624
624
|
const r = i.split(".");
|
|
625
625
|
return r.length >= 3 && r[0] !== "www" ? r[0] : null;
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function Oe(i, e = "tenant", t) {
|
|
628
628
|
const s = new URLSearchParams(i).get(e);
|
|
629
629
|
return s ? (t && t.setItem("tenant", s), s) : t ? t.getItem("tenant") : null;
|
|
630
630
|
}
|
|
631
|
-
function
|
|
631
|
+
function We(i, e, t) {
|
|
632
632
|
const { tenantMode: r, baseDomain: s, selectorParam: o } = i;
|
|
633
|
-
return r === "subdomain" ?
|
|
633
|
+
return r === "subdomain" ? ze(e.hostname, s) : r === "selector" ? Oe(e.search, o, t) : null;
|
|
634
|
+
}
|
|
635
|
+
function je(i, e, t) {
|
|
636
|
+
if (t)
|
|
637
|
+
return `${i}.${t}`;
|
|
638
|
+
const r = e.split(".");
|
|
639
|
+
return r.length === 2 ? `${i}.${e}` : r.length >= 3 ? (r[0] = i, r.join(".")) : null;
|
|
634
640
|
}
|
|
635
|
-
const
|
|
636
|
-
function
|
|
637
|
-
const
|
|
641
|
+
const fe = "_auth";
|
|
642
|
+
function Ve(i) {
|
|
643
|
+
const e = JSON.stringify(i);
|
|
644
|
+
return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
645
|
+
}
|
|
646
|
+
function _e(i) {
|
|
647
|
+
try {
|
|
648
|
+
let e = i.replace(/-/g, "+").replace(/_/g, "/");
|
|
649
|
+
for (; e.length % 4; )
|
|
650
|
+
e += "=";
|
|
651
|
+
const t = atob(e), r = JSON.parse(t);
|
|
652
|
+
return typeof r.accessToken == "string" && typeof r.refreshToken == "string" && typeof r.expiresIn == "number" ? r : null;
|
|
653
|
+
} catch {
|
|
654
|
+
return null;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
function Ge() {
|
|
658
|
+
if (typeof window > "u") return null;
|
|
659
|
+
const e = new URLSearchParams(window.location.search).get(fe);
|
|
660
|
+
return e ? _e(e) : null;
|
|
661
|
+
}
|
|
662
|
+
function Ke() {
|
|
663
|
+
if (typeof window > "u") return;
|
|
664
|
+
const i = new URL(window.location.href);
|
|
665
|
+
i.searchParams.delete(fe), window.history.replaceState({}, "", i.toString());
|
|
666
|
+
}
|
|
667
|
+
const Se = he(null);
|
|
668
|
+
function Ct({ config: i, children: e }) {
|
|
669
|
+
const { baseUrl: t, appInfo: r, appId: s } = oe(), o = ne(() => typeof window > "u" ? null : We(
|
|
638
670
|
{
|
|
639
671
|
tenantMode: i.tenantMode || "selector",
|
|
640
672
|
baseDomain: i.baseDomain,
|
|
@@ -645,118 +677,118 @@ function At({ config: i, children: e }) {
|
|
|
645
677
|
search: window.location.search
|
|
646
678
|
},
|
|
647
679
|
window.localStorage
|
|
648
|
-
), [i.tenantMode, i.baseDomain, i.selectorParam]), [
|
|
680
|
+
), [i.tenantMode, i.baseDomain, i.selectorParam]), [p, b] = x(() => o()), k = X(
|
|
649
681
|
() => {
|
|
650
|
-
var
|
|
682
|
+
var a, L, c;
|
|
651
683
|
return {
|
|
652
|
-
enabled: ((
|
|
653
|
-
ttl: ((
|
|
684
|
+
enabled: ((a = i.cache) == null ? void 0 : a.enabled) ?? !0,
|
|
685
|
+
ttl: ((L = i.cache) == null ? void 0 : L.ttl) ?? 5 * 60 * 1e3,
|
|
654
686
|
// 5 minutes default
|
|
655
|
-
storageKey: ((
|
|
687
|
+
storageKey: ((c = i.cache) == null ? void 0 : c.storageKey) ?? `tenant_cache_${p || "default"}`
|
|
656
688
|
};
|
|
657
689
|
},
|
|
658
|
-
[i.cache,
|
|
659
|
-
), [
|
|
690
|
+
[i.cache, p]
|
|
691
|
+
), [S, T] = x(() => {
|
|
660
692
|
if (i.initialTenant) return i.initialTenant;
|
|
661
|
-
if (!
|
|
693
|
+
if (!k.enabled || !p) return null;
|
|
662
694
|
try {
|
|
663
|
-
const
|
|
664
|
-
if (!
|
|
665
|
-
const
|
|
666
|
-
return Date.now() -
|
|
695
|
+
const a = localStorage.getItem(k.storageKey);
|
|
696
|
+
if (!a) return null;
|
|
697
|
+
const L = JSON.parse(a);
|
|
698
|
+
return Date.now() - L.timestamp < k.ttl && L.tenantSlug === p ? L.data : (localStorage.removeItem(k.storageKey), null);
|
|
667
699
|
} catch {
|
|
668
700
|
return null;
|
|
669
701
|
}
|
|
670
|
-
}), [
|
|
702
|
+
}), [m, f] = x(!S && !i.initialTenant), [u, y] = x(null), [R, C] = x(null), [q, A] = x(!1), [d, P] = x(null);
|
|
671
703
|
te(() => {
|
|
672
|
-
const
|
|
673
|
-
|
|
704
|
+
const a = o();
|
|
705
|
+
b(a);
|
|
674
706
|
}, [o]);
|
|
675
|
-
const E = (r == null ? void 0 : r.settingsSchema) || null,
|
|
676
|
-
async (
|
|
677
|
-
if (!(!
|
|
707
|
+
const E = (r == null ? void 0 : r.settingsSchema) || null, z = ne(
|
|
708
|
+
async (a, L = !1) => {
|
|
709
|
+
if (!(!L && k.enabled && S && S.domain === a))
|
|
678
710
|
try {
|
|
679
|
-
|
|
680
|
-
const
|
|
681
|
-
if (T(
|
|
711
|
+
f(!0), y(null);
|
|
712
|
+
const c = new re(t), g = await new ue(c, s).getPublicTenantInfo(a);
|
|
713
|
+
if (T(g), k.enabled)
|
|
682
714
|
try {
|
|
683
|
-
const
|
|
684
|
-
data:
|
|
715
|
+
const w = {
|
|
716
|
+
data: g,
|
|
685
717
|
timestamp: Date.now(),
|
|
686
|
-
tenantSlug:
|
|
718
|
+
tenantSlug: a
|
|
687
719
|
};
|
|
688
|
-
localStorage.setItem(
|
|
689
|
-
} catch (
|
|
690
|
-
console.warn("Failed to cache tenant info:",
|
|
720
|
+
localStorage.setItem(k.storageKey, JSON.stringify(w));
|
|
721
|
+
} catch (w) {
|
|
722
|
+
console.warn("Failed to cache tenant info:", w);
|
|
691
723
|
}
|
|
692
|
-
} catch (
|
|
693
|
-
const
|
|
694
|
-
|
|
724
|
+
} catch (c) {
|
|
725
|
+
const h = c instanceof Error ? c : new Error("Failed to load tenant information");
|
|
726
|
+
y(h), T(null);
|
|
695
727
|
} finally {
|
|
696
|
-
|
|
728
|
+
f(!1);
|
|
697
729
|
}
|
|
698
730
|
},
|
|
699
|
-
[t, s,
|
|
700
|
-
),
|
|
701
|
-
if (!(!
|
|
731
|
+
[t, s, k, S]
|
|
732
|
+
), G = ne(async () => {
|
|
733
|
+
if (!(!k.enabled || !S || !p))
|
|
702
734
|
try {
|
|
703
|
-
const
|
|
704
|
-
if (!
|
|
705
|
-
const
|
|
706
|
-
if (Date.now() -
|
|
707
|
-
const
|
|
708
|
-
T(
|
|
709
|
-
const
|
|
710
|
-
data:
|
|
735
|
+
const a = localStorage.getItem(k.storageKey);
|
|
736
|
+
if (!a) return;
|
|
737
|
+
const L = JSON.parse(a);
|
|
738
|
+
if (Date.now() - L.timestamp > k.ttl * 0.5) {
|
|
739
|
+
const h = new re(t), w = await new ue(h, s).getPublicTenantInfo(p);
|
|
740
|
+
T(w);
|
|
741
|
+
const j = {
|
|
742
|
+
data: w,
|
|
711
743
|
timestamp: Date.now(),
|
|
712
|
-
tenantSlug:
|
|
744
|
+
tenantSlug: p
|
|
713
745
|
};
|
|
714
|
-
localStorage.setItem(
|
|
746
|
+
localStorage.setItem(k.storageKey, JSON.stringify(j));
|
|
715
747
|
}
|
|
716
|
-
} catch (
|
|
717
|
-
console.warn("Background tenant refresh failed:",
|
|
748
|
+
} catch (a) {
|
|
749
|
+
console.warn("Background tenant refresh failed:", a);
|
|
718
750
|
}
|
|
719
|
-
}, [t, s,
|
|
720
|
-
if (
|
|
751
|
+
}, [t, s, k, S, p]), $ = ne(async () => {
|
|
752
|
+
if (S != null && S.id)
|
|
721
753
|
try {
|
|
722
|
-
|
|
723
|
-
const
|
|
724
|
-
C(
|
|
725
|
-
} catch (
|
|
726
|
-
const
|
|
727
|
-
|
|
754
|
+
A(!0), P(null);
|
|
755
|
+
const a = new re(t), c = await new ue(a, S.appId).getTenantSettings(S.id);
|
|
756
|
+
C(c);
|
|
757
|
+
} catch (a) {
|
|
758
|
+
const L = a instanceof Error ? a : new Error("Failed to load tenant settings");
|
|
759
|
+
P(L), C(null);
|
|
728
760
|
} finally {
|
|
729
|
-
|
|
761
|
+
A(!1);
|
|
730
762
|
}
|
|
731
|
-
}, [t,
|
|
763
|
+
}, [t, S]), _ = ne(() => {
|
|
732
764
|
$();
|
|
733
765
|
}, [$]), v = ne(
|
|
734
|
-
(
|
|
766
|
+
(a) => {
|
|
735
767
|
if (!E)
|
|
736
768
|
return { isValid: !0, errors: [] };
|
|
737
|
-
const
|
|
769
|
+
const L = [];
|
|
738
770
|
try {
|
|
739
|
-
return E.properties && Object.entries(E.properties).forEach(([
|
|
740
|
-
var
|
|
741
|
-
const
|
|
742
|
-
if ((
|
|
743
|
-
|
|
771
|
+
return E.properties && Object.entries(E.properties).forEach(([c, h]) => {
|
|
772
|
+
var w;
|
|
773
|
+
const g = a[c];
|
|
774
|
+
if ((w = E.required) != null && w.includes(c) && g == null) {
|
|
775
|
+
L.push(`Field '${c}' is required`);
|
|
744
776
|
return;
|
|
745
777
|
}
|
|
746
|
-
if (
|
|
747
|
-
if (
|
|
748
|
-
const
|
|
749
|
-
|
|
778
|
+
if (g != null) {
|
|
779
|
+
if (h.type) {
|
|
780
|
+
const j = h.type, Y = typeof g;
|
|
781
|
+
j === "string" && Y !== "string" ? L.push(`Field '${c}' must be a string`) : (j === "number" || j === "integer") && Y !== "number" ? L.push(`Field '${c}' must be a number`) : j === "boolean" && Y !== "boolean" ? L.push(`Field '${c}' must be a boolean`) : j === "array" && !Array.isArray(g) && L.push(`Field '${c}' must be an array`);
|
|
750
782
|
}
|
|
751
|
-
|
|
752
|
-
`Field '${
|
|
753
|
-
),
|
|
754
|
-
`Field '${
|
|
755
|
-
),
|
|
783
|
+
h.minLength !== void 0 && typeof g == "string" && g.length < h.minLength && L.push(
|
|
784
|
+
`Field '${c}' must be at least ${h.minLength} characters long`
|
|
785
|
+
), h.maxLength !== void 0 && typeof g == "string" && g.length > h.maxLength && L.push(
|
|
786
|
+
`Field '${c}' must be no more than ${h.maxLength} characters long`
|
|
787
|
+
), h.minimum !== void 0 && typeof g == "number" && g < h.minimum && L.push(`Field '${c}' must be at least ${h.minimum}`), h.maximum !== void 0 && typeof g == "number" && g > h.maximum && L.push(`Field '${c}' must be no more than ${h.maximum}`), h.pattern && typeof g == "string" && (new RegExp(h.pattern).test(g) || L.push(`Field '${c}' does not match the required pattern`)), h.enum && !h.enum.includes(g) && L.push(`Field '${c}' must be one of: ${h.enum.join(", ")}`);
|
|
756
788
|
}
|
|
757
789
|
}), {
|
|
758
|
-
isValid:
|
|
759
|
-
errors:
|
|
790
|
+
isValid: L.length === 0,
|
|
791
|
+
errors: L
|
|
760
792
|
};
|
|
761
793
|
} catch {
|
|
762
794
|
return {
|
|
@@ -768,82 +800,88 @@ function At({ config: i, children: e }) {
|
|
|
768
800
|
[E]
|
|
769
801
|
);
|
|
770
802
|
te(() => {
|
|
771
|
-
!i.initialTenant &&
|
|
772
|
-
}, [i.initialTenant,
|
|
773
|
-
|
|
774
|
-
}, [
|
|
775
|
-
const
|
|
776
|
-
(
|
|
777
|
-
const
|
|
778
|
-
if (localStorage.setItem("tenant",
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
803
|
+
!i.initialTenant && p ? S ? G() : z(p) : !i.initialTenant && !p && (T(null), y(null), f(!1));
|
|
804
|
+
}, [i.initialTenant, p, S, z, G]), te(() => {
|
|
805
|
+
S != null && S.id ? $() : (C(null), P(null), A(!1));
|
|
806
|
+
}, [S == null ? void 0 : S.id, $]);
|
|
807
|
+
const M = ne(
|
|
808
|
+
(a, L) => {
|
|
809
|
+
const { mode: c = "reload", tokens: h, redirectPath: g } = L || {}, w = i.tenantMode || "selector";
|
|
810
|
+
if (localStorage.setItem("tenant", a), w === "subdomain") {
|
|
811
|
+
const j = window.location.hostname, Y = je(
|
|
812
|
+
a,
|
|
813
|
+
j,
|
|
814
|
+
i.baseDomain
|
|
815
|
+
);
|
|
816
|
+
if (!Y) {
|
|
785
817
|
console.warn(
|
|
786
818
|
"[TenantProvider] Cannot switch subdomain, invalid hostname:",
|
|
787
|
-
|
|
819
|
+
j
|
|
788
820
|
);
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
const H = g || window.location.pathname, N = new URL(`${window.location.protocol}//${Y}${H}`);
|
|
824
|
+
new URLSearchParams(window.location.search).forEach((F, K) => {
|
|
825
|
+
K !== fe && N.searchParams.set(K, F);
|
|
826
|
+
}), h && N.searchParams.set(fe, Ve(h)), window.location.href = N.toString();
|
|
827
|
+
} else if (w === "selector") {
|
|
828
|
+
const j = g || window.location.pathname, Y = new URLSearchParams(window.location.search);
|
|
829
|
+
if (Y.set(i.selectorParam || "tenant", a), c === "reload") {
|
|
830
|
+
const H = `${j}?${Y.toString()}${window.location.hash}`;
|
|
831
|
+
window.location.href = H;
|
|
794
832
|
} else {
|
|
795
|
-
const
|
|
796
|
-
window.history.pushState({}, "",
|
|
833
|
+
const H = `${j}?${Y.toString()}${window.location.hash}`;
|
|
834
|
+
window.history.pushState({}, "", H), b(a), z(a);
|
|
797
835
|
}
|
|
798
836
|
}
|
|
799
837
|
},
|
|
800
|
-
[i.tenantMode, i.selectorParam,
|
|
801
|
-
),
|
|
838
|
+
[i.tenantMode, i.selectorParam, i.baseDomain, z]
|
|
839
|
+
), I = X(() => ({
|
|
802
840
|
// Tenant info
|
|
803
|
-
tenant:
|
|
804
|
-
tenantSlug:
|
|
805
|
-
isTenantLoading:
|
|
806
|
-
tenantError:
|
|
841
|
+
tenant: S,
|
|
842
|
+
tenantSlug: p,
|
|
843
|
+
isTenantLoading: m,
|
|
844
|
+
tenantError: u,
|
|
807
845
|
retryTenant: () => {
|
|
808
|
-
|
|
846
|
+
p && z(p);
|
|
809
847
|
},
|
|
810
848
|
// Settings
|
|
811
849
|
settings: R,
|
|
812
850
|
settingsSchema: E,
|
|
813
|
-
isSettingsLoading:
|
|
814
|
-
settingsError:
|
|
851
|
+
isSettingsLoading: q,
|
|
852
|
+
settingsError: d,
|
|
815
853
|
// Actions
|
|
816
|
-
refreshSettings:
|
|
817
|
-
switchTenant:
|
|
854
|
+
refreshSettings: _,
|
|
855
|
+
switchTenant: M,
|
|
818
856
|
// Validation
|
|
819
857
|
validateSettings: v
|
|
820
858
|
}), [
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
859
|
+
S,
|
|
860
|
+
p,
|
|
861
|
+
m,
|
|
862
|
+
u,
|
|
825
863
|
R,
|
|
826
864
|
E,
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
865
|
+
q,
|
|
866
|
+
d,
|
|
867
|
+
_,
|
|
868
|
+
M,
|
|
831
869
|
v
|
|
832
870
|
]);
|
|
833
|
-
return /* @__PURE__ */ n(
|
|
871
|
+
return /* @__PURE__ */ n(Se.Provider, { value: I, children: e });
|
|
834
872
|
}
|
|
835
|
-
function
|
|
836
|
-
const i = ce(
|
|
873
|
+
function me() {
|
|
874
|
+
const i = ce(Se);
|
|
837
875
|
if (!i)
|
|
838
876
|
throw new Error("useTenant must be used within a TenantProvider");
|
|
839
877
|
return i;
|
|
840
878
|
}
|
|
841
|
-
function
|
|
842
|
-
return ce(
|
|
879
|
+
function Me() {
|
|
880
|
+
return ce(Se);
|
|
843
881
|
}
|
|
844
|
-
const
|
|
845
|
-
function
|
|
846
|
-
const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: s } =
|
|
882
|
+
const $t = me;
|
|
883
|
+
function Ft() {
|
|
884
|
+
const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: s } = me();
|
|
847
885
|
return {
|
|
848
886
|
settings: i,
|
|
849
887
|
settingsSchema: e,
|
|
@@ -853,7 +891,7 @@ function Pt() {
|
|
|
853
891
|
};
|
|
854
892
|
}
|
|
855
893
|
function se() {
|
|
856
|
-
const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: s } =
|
|
894
|
+
const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: s } = me();
|
|
857
895
|
return {
|
|
858
896
|
tenant: i,
|
|
859
897
|
tenantSlug: e,
|
|
@@ -862,273 +900,296 @@ function se() {
|
|
|
862
900
|
retry: s
|
|
863
901
|
};
|
|
864
902
|
}
|
|
865
|
-
const
|
|
866
|
-
function
|
|
867
|
-
const { appId: t, baseUrl: r } = oe(), { tenant: s, tenantSlug: o, switchTenant:
|
|
903
|
+
const Ie = he(null);
|
|
904
|
+
function Dt({ config: i = {}, children: e }) {
|
|
905
|
+
const { appId: t, baseUrl: r } = oe(), { tenant: s, tenantSlug: o, switchTenant: p } = me(), [b, k] = x(i.initialRoles || []), [S, T] = x(!i.initialRoles), [m, f] = x(null), [u, y] = x(!1), [R, C] = x(null), [q, A] = x(0), d = X(() => new we({
|
|
868
906
|
tenantSlug: o,
|
|
869
907
|
// SessionManager will generate storageKey internally
|
|
870
908
|
onRefreshFailed: i.onRefreshFailed,
|
|
871
909
|
baseUrl: r
|
|
872
|
-
}), [o, r, i.onRefreshFailed]),
|
|
873
|
-
const
|
|
874
|
-
return
|
|
875
|
-
}, [r,
|
|
876
|
-
const
|
|
910
|
+
}), [o, r, i.onRefreshFailed]), P = X(() => {
|
|
911
|
+
const c = new re(r);
|
|
912
|
+
return c.setSessionManager(d), c;
|
|
913
|
+
}, [r, d]), E = X(() => new Ue(new re(r)), [r]), z = X(() => new qe(P, d), [P, d]), G = X(() => new xe(new re(r)), [r]), $ = X(() => m || d.getUser(), [m, d]), _ = X(() => $ != null && $.roleId && b.find((c) => c.id === $.roleId) || null, [$, b]), v = X(() => (_ == null ? void 0 : _.permissions) || [], [_]), M = X(() => d.hasValidSession() && m !== null, [d, m]), I = 5 * 60 * 1e3, a = X(() => {
|
|
914
|
+
const c = async (D = !1) => {
|
|
877
915
|
try {
|
|
878
|
-
if (!
|
|
916
|
+
if (!d.hasValidSession())
|
|
879
917
|
return;
|
|
880
|
-
const
|
|
881
|
-
if (!
|
|
918
|
+
const B = Date.now();
|
|
919
|
+
if (!D && B - q < I && m)
|
|
882
920
|
return;
|
|
883
|
-
const W =
|
|
921
|
+
const W = d.getUserId();
|
|
884
922
|
if (!W) {
|
|
885
923
|
console.warn("[AuthProvider] No userId available in token or storage");
|
|
886
924
|
return;
|
|
887
925
|
}
|
|
888
|
-
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
} catch (
|
|
892
|
-
const
|
|
893
|
-
C(
|
|
926
|
+
y(!0), C(null);
|
|
927
|
+
const Z = await z.getUserById(W);
|
|
928
|
+
f(Z), d.setUser(Z), A(Date.now());
|
|
929
|
+
} catch (B) {
|
|
930
|
+
const J = B instanceof Error ? B : new Error("Failed to load user data");
|
|
931
|
+
C(J), console.error("[AuthProvider] Failed to load user data:", J);
|
|
894
932
|
} finally {
|
|
895
|
-
|
|
933
|
+
y(!1);
|
|
896
934
|
}
|
|
897
|
-
},
|
|
898
|
-
await
|
|
899
|
-
},
|
|
900
|
-
const { username:
|
|
901
|
-
let
|
|
902
|
-
W && (
|
|
903
|
-
const
|
|
904
|
-
username:
|
|
905
|
-
password:
|
|
935
|
+
}, h = async () => {
|
|
936
|
+
await c();
|
|
937
|
+
}, g = async (D) => {
|
|
938
|
+
const { username: B, password: J, tenantSlug: W } = D;
|
|
939
|
+
let Z = s == null ? void 0 : s.id, Q = o, ee = d;
|
|
940
|
+
W && (Z = (await new ue(P, t).getPublicTenantInfo(W)).id, Q = W);
|
|
941
|
+
const V = await E.login({
|
|
942
|
+
username: B,
|
|
943
|
+
password: J,
|
|
906
944
|
appId: t,
|
|
907
|
-
tenantId:
|
|
945
|
+
tenantId: Z
|
|
908
946
|
}), le = W && W !== o;
|
|
909
|
-
if (le && (
|
|
910
|
-
tenantSlug:
|
|
947
|
+
if (le && (ee = new we({
|
|
948
|
+
tenantSlug: Q,
|
|
911
949
|
baseUrl: r
|
|
912
|
-
})),
|
|
913
|
-
accessToken:
|
|
914
|
-
refreshToken:
|
|
915
|
-
expiresIn:
|
|
916
|
-
}),
|
|
917
|
-
|
|
950
|
+
})), ee.setTokens({
|
|
951
|
+
accessToken: V.accessToken,
|
|
952
|
+
refreshToken: V.refreshToken,
|
|
953
|
+
expiresIn: V.expiresIn
|
|
954
|
+
}), V.user) {
|
|
955
|
+
ee.setUser(V.user), f(V.user);
|
|
918
956
|
try {
|
|
919
|
-
await
|
|
957
|
+
await c();
|
|
920
958
|
} catch (de) {
|
|
921
959
|
console.warn("Failed to load complete user data after login:", de);
|
|
922
960
|
}
|
|
923
961
|
}
|
|
924
|
-
return le &&
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
962
|
+
return le && Q && Q !== o && p(Q, {
|
|
963
|
+
tokens: {
|
|
964
|
+
accessToken: V.accessToken,
|
|
965
|
+
refreshToken: V.refreshToken,
|
|
966
|
+
expiresIn: V.expiresIn
|
|
967
|
+
}
|
|
968
|
+
}), V;
|
|
969
|
+
}, w = async (D) => {
|
|
970
|
+
const { email: B, phoneNumber: J, name: W, password: Z, lastName: Q, tenantId: ee } = D;
|
|
971
|
+
if (!B && !J)
|
|
928
972
|
throw new Error("Either email or phoneNumber is required");
|
|
929
|
-
if (!W || !
|
|
973
|
+
if (!W || !Z)
|
|
930
974
|
throw new Error("Name and password are required");
|
|
931
|
-
const
|
|
975
|
+
const V = ee ?? (s == null ? void 0 : s.id);
|
|
932
976
|
return await E.signup({
|
|
933
|
-
email:
|
|
934
|
-
phoneNumber:
|
|
977
|
+
email: B,
|
|
978
|
+
phoneNumber: J,
|
|
935
979
|
name: W,
|
|
936
|
-
password:
|
|
937
|
-
tenantId:
|
|
938
|
-
lastName:
|
|
980
|
+
password: Z,
|
|
981
|
+
tenantId: V,
|
|
982
|
+
lastName: Q,
|
|
939
983
|
appId: t
|
|
940
984
|
});
|
|
941
|
-
},
|
|
942
|
-
const { email:
|
|
943
|
-
if (!
|
|
985
|
+
}, j = async (D) => {
|
|
986
|
+
const { email: B, phoneNumber: J, name: W, password: Z, tenantName: Q, lastName: ee } = D;
|
|
987
|
+
if (!B && !J)
|
|
944
988
|
throw new Error("Either email or phoneNumber is required");
|
|
945
|
-
if (!W || !
|
|
989
|
+
if (!W || !Z || !Q)
|
|
946
990
|
throw new Error("Name, password, and tenantName are required");
|
|
947
991
|
return await E.signupTenantAdmin({
|
|
948
|
-
email:
|
|
949
|
-
phoneNumber:
|
|
992
|
+
email: B,
|
|
993
|
+
phoneNumber: J,
|
|
950
994
|
name: W,
|
|
951
|
-
password:
|
|
952
|
-
tenantName:
|
|
995
|
+
password: Z,
|
|
996
|
+
tenantName: Q,
|
|
953
997
|
appId: t,
|
|
954
|
-
lastName:
|
|
998
|
+
lastName: ee
|
|
955
999
|
});
|
|
956
|
-
},
|
|
957
|
-
const { currentPassword:
|
|
958
|
-
await E.changePassword({ currentPassword:
|
|
959
|
-
},
|
|
960
|
-
const { email:
|
|
1000
|
+
}, Y = async (D) => {
|
|
1001
|
+
const { currentPassword: B, newPassword: J } = D, W = await d.getAuthHeaders();
|
|
1002
|
+
await E.changePassword({ currentPassword: B, newPassword: J }, W);
|
|
1003
|
+
}, H = async (D) => {
|
|
1004
|
+
const { email: B, tenantId: J } = D, W = J ?? (s == null ? void 0 : s.id);
|
|
961
1005
|
if (!W)
|
|
962
1006
|
throw new Error("tenantId is required for password reset");
|
|
963
|
-
await E.requestPasswordReset({ email:
|
|
964
|
-
},
|
|
965
|
-
const { token:
|
|
966
|
-
await E.confirmPasswordReset({ token:
|
|
967
|
-
},
|
|
968
|
-
const { email:
|
|
969
|
-
if (!
|
|
1007
|
+
await E.requestPasswordReset({ email: B, tenantId: W });
|
|
1008
|
+
}, N = async (D) => {
|
|
1009
|
+
const { token: B, newPassword: J } = D;
|
|
1010
|
+
await E.confirmPasswordReset({ token: B, newPassword: J });
|
|
1011
|
+
}, O = async (D) => {
|
|
1012
|
+
const { email: B, frontendUrl: J, name: W, lastName: Z, tenantId: Q } = D, ee = Q ?? (s == null ? void 0 : s.id);
|
|
1013
|
+
if (!ee)
|
|
970
1014
|
throw new Error("tenantId is required for magic link authentication");
|
|
971
1015
|
return await E.sendMagicLink({
|
|
972
|
-
email:
|
|
973
|
-
tenantId:
|
|
974
|
-
frontendUrl:
|
|
1016
|
+
email: B,
|
|
1017
|
+
tenantId: ee,
|
|
1018
|
+
frontendUrl: J,
|
|
975
1019
|
name: W,
|
|
976
|
-
lastName:
|
|
1020
|
+
lastName: Z,
|
|
977
1021
|
appId: t
|
|
978
1022
|
});
|
|
979
|
-
},
|
|
980
|
-
const { token:
|
|
981
|
-
let
|
|
982
|
-
W && (
|
|
983
|
-
const
|
|
984
|
-
token:
|
|
985
|
-
email:
|
|
1023
|
+
}, F = async (D) => {
|
|
1024
|
+
const { token: B, email: J, tenantSlug: W } = D;
|
|
1025
|
+
let Z = s == null ? void 0 : s.id, Q = o, ee = d;
|
|
1026
|
+
W && (Z = (await new ue(P, t).getPublicTenantInfo(W)).id, Q = W);
|
|
1027
|
+
const V = await E.verifyMagicLink({
|
|
1028
|
+
token: B,
|
|
1029
|
+
email: J,
|
|
986
1030
|
appId: t,
|
|
987
|
-
tenantId:
|
|
1031
|
+
tenantId: Z
|
|
988
1032
|
}), le = W && W !== o;
|
|
989
|
-
if (le && (
|
|
990
|
-
tenantSlug:
|
|
1033
|
+
if (le && (ee = new we({
|
|
1034
|
+
tenantSlug: Q,
|
|
991
1035
|
baseUrl: r
|
|
992
|
-
})),
|
|
993
|
-
accessToken:
|
|
994
|
-
refreshToken:
|
|
995
|
-
expiresIn:
|
|
996
|
-
}),
|
|
997
|
-
|
|
1036
|
+
})), ee.setTokens({
|
|
1037
|
+
accessToken: V.accessToken,
|
|
1038
|
+
refreshToken: V.refreshToken,
|
|
1039
|
+
expiresIn: V.expiresIn
|
|
1040
|
+
}), V.user) {
|
|
1041
|
+
ee.setUser(V.user), f(V.user);
|
|
998
1042
|
try {
|
|
999
|
-
await
|
|
1043
|
+
await c();
|
|
1000
1044
|
} catch (de) {
|
|
1001
1045
|
console.warn("Failed to load complete user data after magic link login:", de);
|
|
1002
1046
|
}
|
|
1003
1047
|
}
|
|
1004
|
-
return le &&
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1048
|
+
return le && Q && Q !== o && p(Q, {
|
|
1049
|
+
tokens: {
|
|
1050
|
+
accessToken: V.accessToken,
|
|
1051
|
+
refreshToken: V.refreshToken,
|
|
1052
|
+
expiresIn: V.expiresIn
|
|
1053
|
+
}
|
|
1054
|
+
}), V;
|
|
1055
|
+
}, K = async () => {
|
|
1056
|
+
const D = d.getTokens();
|
|
1057
|
+
if (!(D != null && D.refreshToken))
|
|
1008
1058
|
throw new Error("No refresh token available");
|
|
1009
|
-
const
|
|
1010
|
-
refreshToken:
|
|
1059
|
+
const B = await E.refreshToken({
|
|
1060
|
+
refreshToken: D.refreshToken
|
|
1011
1061
|
});
|
|
1012
|
-
|
|
1013
|
-
accessToken:
|
|
1014
|
-
refreshToken:
|
|
1015
|
-
expiresIn:
|
|
1062
|
+
d.setTokens({
|
|
1063
|
+
accessToken: B.accessToken,
|
|
1064
|
+
refreshToken: B.refreshToken || D.refreshToken,
|
|
1065
|
+
expiresIn: B.expiresIn
|
|
1016
1066
|
});
|
|
1017
|
-
},
|
|
1018
|
-
|
|
1019
|
-
},
|
|
1020
|
-
|
|
1021
|
-
},
|
|
1022
|
-
|
|
1023
|
-
},
|
|
1067
|
+
}, ge = () => {
|
|
1068
|
+
d.clearSession(), f(null), C(null);
|
|
1069
|
+
}, Ce = (D) => {
|
|
1070
|
+
d.setTokens(D);
|
|
1071
|
+
}, $e = () => d.hasValidSession(), Fe = () => {
|
|
1072
|
+
d.clearSession(), f(null), C(null);
|
|
1073
|
+
}, De = async () => {
|
|
1024
1074
|
if (t)
|
|
1025
1075
|
try {
|
|
1026
1076
|
T(!0);
|
|
1027
|
-
const { roles:
|
|
1028
|
-
|
|
1029
|
-
} catch (
|
|
1030
|
-
console.error("Failed to fetch roles:",
|
|
1077
|
+
const { roles: D } = await G.getRolesByApp(t);
|
|
1078
|
+
k(D);
|
|
1079
|
+
} catch (D) {
|
|
1080
|
+
console.error("Failed to fetch roles:", D);
|
|
1031
1081
|
} finally {
|
|
1032
1082
|
T(!1);
|
|
1033
1083
|
}
|
|
1034
|
-
},
|
|
1035
|
-
await
|
|
1036
|
-
},
|
|
1084
|
+
}, He = async () => {
|
|
1085
|
+
await De();
|
|
1086
|
+
}, ye = (D) => {
|
|
1037
1087
|
if (!v || v.length === 0)
|
|
1038
1088
|
return !1;
|
|
1039
|
-
if (typeof
|
|
1040
|
-
return v.includes(
|
|
1041
|
-
const
|
|
1042
|
-
return v.includes(
|
|
1089
|
+
if (typeof D == "string")
|
|
1090
|
+
return v.includes(D);
|
|
1091
|
+
const B = `${D.resource}.${D.action}`;
|
|
1092
|
+
return v.includes(B);
|
|
1043
1093
|
};
|
|
1044
1094
|
return {
|
|
1045
1095
|
// RFC-003: Authentication state
|
|
1046
|
-
isAuthenticated:
|
|
1047
|
-
sessionManager:
|
|
1048
|
-
authenticatedHttpService:
|
|
1049
|
-
login:
|
|
1050
|
-
signup:
|
|
1051
|
-
signupTenantAdmin:
|
|
1052
|
-
sendMagicLink:
|
|
1053
|
-
verifyMagicLink:
|
|
1054
|
-
changePassword:
|
|
1055
|
-
requestPasswordReset:
|
|
1056
|
-
confirmPasswordReset:
|
|
1057
|
-
refreshToken:
|
|
1058
|
-
logout:
|
|
1059
|
-
setTokens:
|
|
1060
|
-
hasValidSession:
|
|
1061
|
-
clearSession:
|
|
1062
|
-
currentUser:
|
|
1063
|
-
isUserLoading:
|
|
1096
|
+
isAuthenticated: M,
|
|
1097
|
+
sessionManager: d,
|
|
1098
|
+
authenticatedHttpService: P,
|
|
1099
|
+
login: g,
|
|
1100
|
+
signup: w,
|
|
1101
|
+
signupTenantAdmin: j,
|
|
1102
|
+
sendMagicLink: O,
|
|
1103
|
+
verifyMagicLink: F,
|
|
1104
|
+
changePassword: Y,
|
|
1105
|
+
requestPasswordReset: H,
|
|
1106
|
+
confirmPasswordReset: N,
|
|
1107
|
+
refreshToken: K,
|
|
1108
|
+
logout: ge,
|
|
1109
|
+
setTokens: Ce,
|
|
1110
|
+
hasValidSession: $e,
|
|
1111
|
+
clearSession: Fe,
|
|
1112
|
+
currentUser: m,
|
|
1113
|
+
isUserLoading: u,
|
|
1064
1114
|
userError: R,
|
|
1065
|
-
loadUserData:
|
|
1066
|
-
refreshUser:
|
|
1067
|
-
userRole:
|
|
1115
|
+
loadUserData: c,
|
|
1116
|
+
refreshUser: h,
|
|
1117
|
+
userRole: _,
|
|
1068
1118
|
userPermissions: v,
|
|
1069
|
-
availableRoles:
|
|
1070
|
-
rolesLoading:
|
|
1071
|
-
hasPermission:
|
|
1072
|
-
hasAnyPermission: (
|
|
1073
|
-
hasAllPermissions: (
|
|
1119
|
+
availableRoles: b,
|
|
1120
|
+
rolesLoading: S,
|
|
1121
|
+
hasPermission: ye,
|
|
1122
|
+
hasAnyPermission: (D) => D.some((B) => ye(B)),
|
|
1123
|
+
hasAllPermissions: (D) => D.every((B) => ye(B)),
|
|
1074
1124
|
getUserPermissionStrings: () => v || [],
|
|
1075
|
-
refreshRoles:
|
|
1125
|
+
refreshRoles: He
|
|
1076
1126
|
};
|
|
1077
1127
|
}, [
|
|
1078
|
-
I,
|
|
1079
|
-
u,
|
|
1080
1128
|
M,
|
|
1129
|
+
d,
|
|
1130
|
+
P,
|
|
1081
1131
|
E,
|
|
1082
|
-
|
|
1083
|
-
|
|
1132
|
+
z,
|
|
1133
|
+
G,
|
|
1084
1134
|
t,
|
|
1085
1135
|
s,
|
|
1086
1136
|
o,
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1137
|
+
p,
|
|
1138
|
+
b,
|
|
1139
|
+
m,
|
|
1140
|
+
u,
|
|
1091
1141
|
R,
|
|
1092
|
-
|
|
1142
|
+
_,
|
|
1093
1143
|
v,
|
|
1094
|
-
|
|
1095
|
-
|
|
1144
|
+
q,
|
|
1145
|
+
I
|
|
1096
1146
|
]);
|
|
1097
|
-
|
|
1147
|
+
te(() => {
|
|
1098
1148
|
!i.initialRoles && t && (async () => {
|
|
1099
1149
|
try {
|
|
1100
1150
|
T(!0);
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1103
|
-
} catch (
|
|
1104
|
-
console.error("Failed to fetch roles:",
|
|
1151
|
+
const h = new re(r), g = new xe(h), { roles: w } = await g.getRolesByApp(t);
|
|
1152
|
+
k(w);
|
|
1153
|
+
} catch (h) {
|
|
1154
|
+
console.error("Failed to fetch roles:", h);
|
|
1105
1155
|
} finally {
|
|
1106
1156
|
T(!1);
|
|
1107
1157
|
}
|
|
1108
1158
|
})();
|
|
1109
|
-
}, [t, r, i.initialRoles])
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1159
|
+
}, [t, r, i.initialRoles]);
|
|
1160
|
+
const L = Be(!1);
|
|
1161
|
+
return te(() => {
|
|
1162
|
+
if (L.current) return;
|
|
1163
|
+
const c = Ge();
|
|
1164
|
+
c && (L.current = !0, d.setTokens({
|
|
1165
|
+
accessToken: c.accessToken,
|
|
1166
|
+
refreshToken: c.refreshToken,
|
|
1167
|
+
expiresIn: c.expiresIn
|
|
1168
|
+
}), Ke(), a.loadUserData().catch(() => {
|
|
1169
|
+
}));
|
|
1170
|
+
}, [d, a]), te(() => {
|
|
1171
|
+
const c = d.getUser();
|
|
1172
|
+
c && d.hasValidSession() && f(c);
|
|
1173
|
+
}, [d]), te(() => {
|
|
1174
|
+
!m && !u && a.loadUserData().catch(() => {
|
|
1114
1175
|
});
|
|
1115
|
-
}, [
|
|
1116
|
-
if (!
|
|
1176
|
+
}, [m, u, a]), te(() => {
|
|
1177
|
+
if (!d.hasValidSession() || !m)
|
|
1117
1178
|
return;
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1179
|
+
const c = setInterval(() => {
|
|
1180
|
+
a.loadUserData().catch(() => {
|
|
1120
1181
|
});
|
|
1121
|
-
},
|
|
1122
|
-
return () => clearInterval(
|
|
1123
|
-
}, [
|
|
1182
|
+
}, I);
|
|
1183
|
+
return () => clearInterval(c);
|
|
1184
|
+
}, [d, m, a, I]), /* @__PURE__ */ n(Ie.Provider, { value: a, children: e });
|
|
1124
1185
|
}
|
|
1125
1186
|
function ae() {
|
|
1126
|
-
const i = ce(
|
|
1187
|
+
const i = ce(Ie);
|
|
1127
1188
|
if (!i)
|
|
1128
1189
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
1129
1190
|
return i;
|
|
1130
1191
|
}
|
|
1131
|
-
class
|
|
1192
|
+
class Je {
|
|
1132
1193
|
constructor(e, t) {
|
|
1133
1194
|
this.httpService = e, this.sessionManager = t;
|
|
1134
1195
|
}
|
|
@@ -1208,58 +1269,58 @@ class ze {
|
|
|
1208
1269
|
})).data;
|
|
1209
1270
|
}
|
|
1210
1271
|
}
|
|
1211
|
-
const
|
|
1212
|
-
function
|
|
1213
|
-
const { baseUrl: t, appId: r } = oe(), { tenant: s } = se(), [o,
|
|
1214
|
-
const
|
|
1215
|
-
return new
|
|
1216
|
-
}, [t]),
|
|
1272
|
+
const Le = he(null);
|
|
1273
|
+
function Ht({ config: i = {}, children: e }) {
|
|
1274
|
+
const { baseUrl: t, appId: r } = oe(), { tenant: s } = se(), [o, p] = x([]), [b, k] = x(!1), [S, T] = x(null), m = X(() => {
|
|
1275
|
+
const y = new re(t);
|
|
1276
|
+
return new Je(y);
|
|
1277
|
+
}, [t]), f = async () => {
|
|
1217
1278
|
if (!(s != null && s.id)) {
|
|
1218
|
-
|
|
1279
|
+
p([]);
|
|
1219
1280
|
return;
|
|
1220
1281
|
}
|
|
1221
|
-
|
|
1282
|
+
k(!0), T(null);
|
|
1222
1283
|
try {
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1225
|
-
} catch (
|
|
1226
|
-
const R =
|
|
1227
|
-
T(R), i.onError && i.onError(
|
|
1284
|
+
const y = await m.getTenantFeatureFlags(s.id, r);
|
|
1285
|
+
p(y);
|
|
1286
|
+
} catch (y) {
|
|
1287
|
+
const R = y instanceof Error ? y.message : "Failed to fetch feature flags";
|
|
1288
|
+
T(R), i.onError && i.onError(y instanceof Error ? y : new Error(R));
|
|
1228
1289
|
} finally {
|
|
1229
|
-
|
|
1290
|
+
k(!1);
|
|
1230
1291
|
}
|
|
1231
1292
|
};
|
|
1232
1293
|
te(() => {
|
|
1233
|
-
|
|
1234
|
-
const
|
|
1294
|
+
f();
|
|
1295
|
+
const y = i.refreshInterval || 5 * 60 * 1e3, R = setInterval(f, y);
|
|
1235
1296
|
return () => clearInterval(R);
|
|
1236
1297
|
}, [s == null ? void 0 : s.id, i.refreshInterval]);
|
|
1237
|
-
const
|
|
1298
|
+
const u = X(() => ({
|
|
1238
1299
|
featureFlags: o,
|
|
1239
|
-
loading:
|
|
1240
|
-
error:
|
|
1241
|
-
isEnabled: (
|
|
1242
|
-
const
|
|
1243
|
-
return (
|
|
1300
|
+
loading: b,
|
|
1301
|
+
error: S,
|
|
1302
|
+
isEnabled: (A) => {
|
|
1303
|
+
const d = o.find((P) => P.key === A);
|
|
1304
|
+
return (d == null ? void 0 : d.value) === !0;
|
|
1244
1305
|
},
|
|
1245
|
-
getFlag: (
|
|
1246
|
-
getFlagState: (
|
|
1247
|
-
const
|
|
1248
|
-
return
|
|
1306
|
+
getFlag: (A) => o.find((d) => d.key === A),
|
|
1307
|
+
getFlagState: (A) => {
|
|
1308
|
+
const d = o.find((P) => P.key === A);
|
|
1309
|
+
return d ? d.value ? "enabled" : "disabled" : "not_found";
|
|
1249
1310
|
},
|
|
1250
1311
|
refresh: async () => {
|
|
1251
|
-
await
|
|
1312
|
+
await f();
|
|
1252
1313
|
}
|
|
1253
|
-
}), [o,
|
|
1254
|
-
return /* @__PURE__ */ n(
|
|
1314
|
+
}), [o, b, S]);
|
|
1315
|
+
return /* @__PURE__ */ n(Le.Provider, { value: u, children: e });
|
|
1255
1316
|
}
|
|
1256
|
-
function
|
|
1257
|
-
const i = ce(
|
|
1317
|
+
function Ye() {
|
|
1318
|
+
const i = ce(Le);
|
|
1258
1319
|
if (!i)
|
|
1259
1320
|
throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
|
|
1260
1321
|
return i;
|
|
1261
1322
|
}
|
|
1262
|
-
class
|
|
1323
|
+
class Qe {
|
|
1263
1324
|
constructor(e, t) {
|
|
1264
1325
|
this.httpService = e, this.sessionManager = t;
|
|
1265
1326
|
}
|
|
@@ -1325,64 +1386,64 @@ class We {
|
|
|
1325
1386
|
)).data;
|
|
1326
1387
|
}
|
|
1327
1388
|
}
|
|
1328
|
-
const
|
|
1329
|
-
function
|
|
1330
|
-
const { baseUrl: t } = oe(), { tenant: r } = se(), [s, o] =
|
|
1331
|
-
const
|
|
1332
|
-
return new
|
|
1333
|
-
}, [t]),
|
|
1389
|
+
const Ee = he(void 0);
|
|
1390
|
+
function Nt({ config: i = {}, children: e }) {
|
|
1391
|
+
const { baseUrl: t } = oe(), { tenant: r } = se(), [s, o] = x(null), [p, b] = x(!1), [k, S] = x(null), T = X(() => {
|
|
1392
|
+
const u = new re(t);
|
|
1393
|
+
return new Qe(u);
|
|
1394
|
+
}, [t]), m = async () => {
|
|
1334
1395
|
if (!(r != null && r.id)) {
|
|
1335
1396
|
o(null);
|
|
1336
1397
|
return;
|
|
1337
1398
|
}
|
|
1338
|
-
|
|
1399
|
+
b(!0), S(null);
|
|
1339
1400
|
try {
|
|
1340
|
-
const
|
|
1341
|
-
o(
|
|
1342
|
-
} catch (
|
|
1343
|
-
const
|
|
1344
|
-
|
|
1401
|
+
const u = await T.getTenantSubscriptionFeatures(r.id);
|
|
1402
|
+
o(u);
|
|
1403
|
+
} catch (u) {
|
|
1404
|
+
const y = u instanceof Error ? u.message : "Failed to fetch subscription";
|
|
1405
|
+
S(y), i.onError && i.onError(u instanceof Error ? u : new Error(y));
|
|
1345
1406
|
} finally {
|
|
1346
|
-
|
|
1407
|
+
b(!1);
|
|
1347
1408
|
}
|
|
1348
1409
|
};
|
|
1349
1410
|
te(() => {
|
|
1350
|
-
if (
|
|
1351
|
-
const
|
|
1352
|
-
return () => clearInterval(
|
|
1411
|
+
if (m(), !i.refreshInterval) return;
|
|
1412
|
+
const u = i.refreshInterval || 10 * 60 * 1e3, y = setInterval(m, u);
|
|
1413
|
+
return () => clearInterval(y);
|
|
1353
1414
|
}, [r == null ? void 0 : r.id, i.refreshInterval]);
|
|
1354
|
-
const
|
|
1355
|
-
const
|
|
1415
|
+
const f = X(() => {
|
|
1416
|
+
const u = (s == null ? void 0 : s.features) || [];
|
|
1356
1417
|
return {
|
|
1357
1418
|
subscription: s,
|
|
1358
|
-
features:
|
|
1359
|
-
loading:
|
|
1360
|
-
error:
|
|
1361
|
-
isFeatureEnabled: (
|
|
1362
|
-
const
|
|
1363
|
-
return
|
|
1419
|
+
features: u,
|
|
1420
|
+
loading: p,
|
|
1421
|
+
error: k,
|
|
1422
|
+
isFeatureEnabled: (d) => {
|
|
1423
|
+
const P = u.find((E) => E.key === d);
|
|
1424
|
+
return P ? P.type === "BOOLEAN" || P.type === "boolean" ? P.value === !0 : !!P.value : !1;
|
|
1364
1425
|
},
|
|
1365
|
-
getFeature: (
|
|
1366
|
-
getFeatureValue: (
|
|
1367
|
-
const E =
|
|
1368
|
-
return E ? E.value :
|
|
1426
|
+
getFeature: (d) => u.find((P) => P.key === d),
|
|
1427
|
+
getFeatureValue: (d, P) => {
|
|
1428
|
+
const E = u.find((z) => z.key === d);
|
|
1429
|
+
return E ? E.value : P;
|
|
1369
1430
|
},
|
|
1370
|
-
hasAllowedPlan: (
|
|
1431
|
+
hasAllowedPlan: (d) => !s || !s.isActive ? !1 : d.includes(s.planId),
|
|
1371
1432
|
refresh: async () => {
|
|
1372
|
-
await
|
|
1433
|
+
await m();
|
|
1373
1434
|
}
|
|
1374
1435
|
};
|
|
1375
|
-
}, [s,
|
|
1376
|
-
return /* @__PURE__ */ n(
|
|
1436
|
+
}, [s, p, k]);
|
|
1437
|
+
return /* @__PURE__ */ n(Ee.Provider, { value: f, children: e });
|
|
1377
1438
|
}
|
|
1378
|
-
function
|
|
1379
|
-
const i = ce(
|
|
1439
|
+
function Xe() {
|
|
1440
|
+
const i = ce(Ee);
|
|
1380
1441
|
if (i === void 0)
|
|
1381
1442
|
throw new Error("useSubscription must be used within a SubscriptionProvider");
|
|
1382
1443
|
return i;
|
|
1383
1444
|
}
|
|
1384
1445
|
var ie = /* @__PURE__ */ ((i) => (i.SUPERUSER = "SUPERUSER", i.TENANT_ADMIN = "TENANT_ADMIN", i.USER = "USER", i))(ie || {});
|
|
1385
|
-
const
|
|
1446
|
+
const ke = () => /* @__PURE__ */ l(
|
|
1386
1447
|
"div",
|
|
1387
1448
|
{
|
|
1388
1449
|
style: {
|
|
@@ -1419,11 +1480,11 @@ const xe = () => /* @__PURE__ */ a(
|
|
|
1419
1480
|
)
|
|
1420
1481
|
]
|
|
1421
1482
|
}
|
|
1422
|
-
),
|
|
1483
|
+
), Te = ({
|
|
1423
1484
|
userType: i,
|
|
1424
1485
|
minUserType: e,
|
|
1425
1486
|
missingPermissions: t
|
|
1426
|
-
}) => /* @__PURE__ */
|
|
1487
|
+
}) => /* @__PURE__ */ l(
|
|
1427
1488
|
"div",
|
|
1428
1489
|
{
|
|
1429
1490
|
style: {
|
|
@@ -1441,26 +1502,26 @@ const xe = () => /* @__PURE__ */ a(
|
|
|
1441
1502
|
children: [
|
|
1442
1503
|
/* @__PURE__ */ n("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "⚠️" }),
|
|
1443
1504
|
/* @__PURE__ */ n("h3", { style: { color: "#856404", marginBottom: "10px" }, children: "Insufficient Permissions" }),
|
|
1444
|
-
e && i ? /* @__PURE__ */
|
|
1445
|
-
/* @__PURE__ */
|
|
1505
|
+
e && i ? /* @__PURE__ */ l(U, { children: [
|
|
1506
|
+
/* @__PURE__ */ l("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: [
|
|
1446
1507
|
"This content requires ",
|
|
1447
1508
|
/* @__PURE__ */ n("strong", { children: e }),
|
|
1448
1509
|
" access level or higher."
|
|
1449
1510
|
] }),
|
|
1450
|
-
/* @__PURE__ */
|
|
1511
|
+
/* @__PURE__ */ l("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1451
1512
|
"Your current access level: ",
|
|
1452
1513
|
/* @__PURE__ */ n("strong", { children: i })
|
|
1453
1514
|
] })
|
|
1454
|
-
] }) : /* @__PURE__ */
|
|
1515
|
+
] }) : /* @__PURE__ */ l(U, { children: [
|
|
1455
1516
|
/* @__PURE__ */ n("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: "You don't have the required permissions to view this content." }),
|
|
1456
|
-
t && t.length > 0 && /* @__PURE__ */
|
|
1517
|
+
t && t.length > 0 && /* @__PURE__ */ l("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1457
1518
|
"Required permissions: ",
|
|
1458
1519
|
/* @__PURE__ */ n("strong", { children: t.join(", ") })
|
|
1459
1520
|
] })
|
|
1460
1521
|
] })
|
|
1461
1522
|
]
|
|
1462
1523
|
}
|
|
1463
|
-
),
|
|
1524
|
+
), Ze = (i, e) => {
|
|
1464
1525
|
const t = {
|
|
1465
1526
|
[ie.USER]: 1,
|
|
1466
1527
|
[ie.TENANT_ADMIN]: 2,
|
|
@@ -1468,28 +1529,28 @@ const xe = () => /* @__PURE__ */ a(
|
|
|
1468
1529
|
};
|
|
1469
1530
|
return t[i] >= t[e];
|
|
1470
1531
|
};
|
|
1471
|
-
function
|
|
1532
|
+
function Bt({
|
|
1472
1533
|
children: i,
|
|
1473
1534
|
fallback: e,
|
|
1474
1535
|
minUserType: t,
|
|
1475
1536
|
requiredPermissions: r,
|
|
1476
1537
|
requireAllPermissions: s = !1
|
|
1477
1538
|
}) {
|
|
1478
|
-
const { hasValidSession: o, sessionManager:
|
|
1539
|
+
const { hasValidSession: o, sessionManager: p, hasPermission: b, hasAnyPermission: k, hasAllPermissions: S } = ae();
|
|
1479
1540
|
if (!o())
|
|
1480
|
-
return /* @__PURE__ */ n(
|
|
1481
|
-
const T =
|
|
1541
|
+
return /* @__PURE__ */ n(U, { children: e || /* @__PURE__ */ n(ke, {}) });
|
|
1542
|
+
const T = p.getUser();
|
|
1482
1543
|
if (!T)
|
|
1483
|
-
return /* @__PURE__ */ n(
|
|
1484
|
-
if (t && !
|
|
1485
|
-
return /* @__PURE__ */ n(
|
|
1486
|
-
if (r && r.length > 0 && !(s ?
|
|
1487
|
-
const
|
|
1488
|
-
return /* @__PURE__ */ n(
|
|
1489
|
-
}
|
|
1490
|
-
return /* @__PURE__ */ n(
|
|
1544
|
+
return /* @__PURE__ */ n(U, { children: e || /* @__PURE__ */ n(ke, {}) });
|
|
1545
|
+
if (t && !Ze(T.userType, t))
|
|
1546
|
+
return /* @__PURE__ */ n(Te, { userType: T.userType, minUserType: t });
|
|
1547
|
+
if (r && r.length > 0 && !(s ? S(r) : k(r))) {
|
|
1548
|
+
const f = r.filter((u) => !b(u)).map((u) => typeof u == "string" ? u : u.name);
|
|
1549
|
+
return /* @__PURE__ */ n(Te, { missingPermissions: f });
|
|
1550
|
+
}
|
|
1551
|
+
return /* @__PURE__ */ n(U, { children: i });
|
|
1491
1552
|
}
|
|
1492
|
-
const
|
|
1553
|
+
const et = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1493
1554
|
"div",
|
|
1494
1555
|
{
|
|
1495
1556
|
style: {
|
|
@@ -1502,7 +1563,7 @@ const Ge = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1502
1563
|
backgroundColor: "#f9fafb",
|
|
1503
1564
|
textAlign: "center"
|
|
1504
1565
|
},
|
|
1505
|
-
children: /* @__PURE__ */
|
|
1566
|
+
children: /* @__PURE__ */ l(
|
|
1506
1567
|
"div",
|
|
1507
1568
|
{
|
|
1508
1569
|
style: {
|
|
@@ -1516,7 +1577,7 @@ const Ge = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1516
1577
|
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🔒" }),
|
|
1517
1578
|
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Access Required" }),
|
|
1518
1579
|
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You need to be signed in to access this page." }),
|
|
1519
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ l("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1520
1581
|
"Redirecting to ",
|
|
1521
1582
|
i,
|
|
1522
1583
|
"..."
|
|
@@ -1542,7 +1603,7 @@ const Ge = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1542
1603
|
backgroundColor: "#f9fafb",
|
|
1543
1604
|
textAlign: "center"
|
|
1544
1605
|
},
|
|
1545
|
-
children: /* @__PURE__ */
|
|
1606
|
+
children: /* @__PURE__ */ l(
|
|
1546
1607
|
"div",
|
|
1547
1608
|
{
|
|
1548
1609
|
style: {
|
|
@@ -1555,19 +1616,19 @@ const Ge = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1555
1616
|
children: [
|
|
1556
1617
|
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "⚠️" }),
|
|
1557
1618
|
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Insufficient Permissions" }),
|
|
1558
|
-
e && i ? /* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */
|
|
1619
|
+
e && i ? /* @__PURE__ */ l(U, { children: [
|
|
1620
|
+
/* @__PURE__ */ l("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: [
|
|
1560
1621
|
"This page requires ",
|
|
1561
1622
|
/* @__PURE__ */ n("strong", { children: e }),
|
|
1562
1623
|
" access level or higher."
|
|
1563
1624
|
] }),
|
|
1564
|
-
/* @__PURE__ */
|
|
1625
|
+
/* @__PURE__ */ l("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1565
1626
|
"Your current access level: ",
|
|
1566
1627
|
/* @__PURE__ */ n("strong", { children: i })
|
|
1567
1628
|
] })
|
|
1568
|
-
] }) : /* @__PURE__ */
|
|
1629
|
+
] }) : /* @__PURE__ */ l(U, { children: [
|
|
1569
1630
|
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: "You don't have the required permissions to access this page." }),
|
|
1570
|
-
t && t.length > 0 && /* @__PURE__ */
|
|
1631
|
+
t && t.length > 0 && /* @__PURE__ */ l("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1571
1632
|
"Required permissions: ",
|
|
1572
1633
|
/* @__PURE__ */ n("strong", { children: t.join(", ") })
|
|
1573
1634
|
] })
|
|
@@ -1576,7 +1637,7 @@ const Ge = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1576
1637
|
}
|
|
1577
1638
|
)
|
|
1578
1639
|
}
|
|
1579
|
-
),
|
|
1640
|
+
), tt = (i, e) => {
|
|
1580
1641
|
const t = {
|
|
1581
1642
|
[ie.USER]: 1,
|
|
1582
1643
|
[ie.TENANT_ADMIN]: 2,
|
|
@@ -1584,7 +1645,7 @@ const Ge = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1584
1645
|
};
|
|
1585
1646
|
return t[i] >= t[e];
|
|
1586
1647
|
};
|
|
1587
|
-
function
|
|
1648
|
+
function Ut({
|
|
1588
1649
|
children: i,
|
|
1589
1650
|
redirectTo: e = "/login",
|
|
1590
1651
|
minUserType: t,
|
|
@@ -1592,24 +1653,24 @@ function Rt({
|
|
|
1592
1653
|
requireAllPermissions: s = !1,
|
|
1593
1654
|
fallback: o
|
|
1594
1655
|
}) {
|
|
1595
|
-
const { hasValidSession:
|
|
1596
|
-
if (!
|
|
1597
|
-
return o ? /* @__PURE__ */ n(
|
|
1598
|
-
/* @__PURE__ */ n(
|
|
1599
|
-
/* @__PURE__ */ n(pe, { to: e, state: { from:
|
|
1656
|
+
const { hasValidSession: p, sessionManager: b, hasPermission: k, hasAnyPermission: S, hasAllPermissions: T } = ae(), m = be();
|
|
1657
|
+
if (!p())
|
|
1658
|
+
return o ? /* @__PURE__ */ n(U, { children: o }) : /* @__PURE__ */ l(U, { children: [
|
|
1659
|
+
/* @__PURE__ */ n(et, { redirectPath: e }),
|
|
1660
|
+
/* @__PURE__ */ n(pe, { to: e, state: { from: m.pathname }, replace: !0 })
|
|
1600
1661
|
] });
|
|
1601
|
-
const
|
|
1602
|
-
if (!
|
|
1603
|
-
return /* @__PURE__ */ n(pe, { to: e, state: { from:
|
|
1604
|
-
if (t && !
|
|
1605
|
-
return /* @__PURE__ */ n(Ae, { userType:
|
|
1606
|
-
if (r && r.length > 0 && !(s ? T(r) :
|
|
1607
|
-
const
|
|
1608
|
-
return /* @__PURE__ */ n(Ae, { missingPermissions:
|
|
1609
|
-
}
|
|
1610
|
-
return /* @__PURE__ */ n(
|
|
1662
|
+
const f = b.getUser();
|
|
1663
|
+
if (!f)
|
|
1664
|
+
return /* @__PURE__ */ n(pe, { to: e, state: { from: m.pathname }, replace: !0 });
|
|
1665
|
+
if (t && !tt(f.userType, t))
|
|
1666
|
+
return /* @__PURE__ */ n(Ae, { userType: f.userType, minUserType: t });
|
|
1667
|
+
if (r && r.length > 0 && !(s ? T(r) : S(r))) {
|
|
1668
|
+
const y = r.filter((R) => !k(R)).map((R) => typeof R == "string" ? R : R.name);
|
|
1669
|
+
return /* @__PURE__ */ n(Ae, { missingPermissions: y });
|
|
1670
|
+
}
|
|
1671
|
+
return /* @__PURE__ */ n(U, { children: i });
|
|
1611
1672
|
}
|
|
1612
|
-
const
|
|
1673
|
+
const rt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1613
1674
|
"div",
|
|
1614
1675
|
{
|
|
1615
1676
|
style: {
|
|
@@ -1622,7 +1683,7 @@ const Ke = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1622
1683
|
backgroundColor: "#f9fafb",
|
|
1623
1684
|
textAlign: "center"
|
|
1624
1685
|
},
|
|
1625
|
-
children: /* @__PURE__ */
|
|
1686
|
+
children: /* @__PURE__ */ l(
|
|
1626
1687
|
"div",
|
|
1627
1688
|
{
|
|
1628
1689
|
style: {
|
|
@@ -1636,7 +1697,7 @@ const Ke = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1636
1697
|
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🏢" }),
|
|
1637
1698
|
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Tenant Required" }),
|
|
1638
1699
|
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "This page requires a tenant context to access." }),
|
|
1639
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ l("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1640
1701
|
"Redirecting to ",
|
|
1641
1702
|
i,
|
|
1642
1703
|
"..."
|
|
@@ -1646,14 +1707,14 @@ const Ke = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1646
1707
|
)
|
|
1647
1708
|
}
|
|
1648
1709
|
);
|
|
1649
|
-
function
|
|
1650
|
-
const { tenant: r, isLoading: s, error: o } = se(),
|
|
1651
|
-
return s || o ? null : r ? /* @__PURE__ */ n(
|
|
1652
|
-
/* @__PURE__ */ n(
|
|
1653
|
-
/* @__PURE__ */ n(pe, { to: e, state: { from:
|
|
1710
|
+
function qt({ children: i, redirectTo: e = "/", fallback: t }) {
|
|
1711
|
+
const { tenant: r, isLoading: s, error: o } = se(), p = be();
|
|
1712
|
+
return s || o ? null : r ? /* @__PURE__ */ n(U, { children: i }) : t ? /* @__PURE__ */ n(U, { children: t }) : /* @__PURE__ */ l(U, { children: [
|
|
1713
|
+
/* @__PURE__ */ n(rt, { redirectPath: e }),
|
|
1714
|
+
/* @__PURE__ */ n(pe, { to: e, state: { from: p.pathname }, replace: !0 })
|
|
1654
1715
|
] });
|
|
1655
1716
|
}
|
|
1656
|
-
const
|
|
1717
|
+
const nt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1657
1718
|
"div",
|
|
1658
1719
|
{
|
|
1659
1720
|
style: {
|
|
@@ -1666,7 +1727,7 @@ const Je = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1666
1727
|
backgroundColor: "#f9fafb",
|
|
1667
1728
|
textAlign: "center"
|
|
1668
1729
|
},
|
|
1669
|
-
children: /* @__PURE__ */
|
|
1730
|
+
children: /* @__PURE__ */ l(
|
|
1670
1731
|
"div",
|
|
1671
1732
|
{
|
|
1672
1733
|
style: {
|
|
@@ -1680,7 +1741,7 @@ const Je = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1680
1741
|
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🚀" }),
|
|
1681
1742
|
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Tenant Detected" }),
|
|
1682
1743
|
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You are accessing a tenant-specific context. Redirecting to the appropriate page." }),
|
|
1683
|
-
/* @__PURE__ */
|
|
1744
|
+
/* @__PURE__ */ l("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1684
1745
|
"Redirecting to ",
|
|
1685
1746
|
i,
|
|
1686
1747
|
"..."
|
|
@@ -1690,14 +1751,14 @@ const Je = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1690
1751
|
)
|
|
1691
1752
|
}
|
|
1692
1753
|
);
|
|
1693
|
-
function
|
|
1694
|
-
const { tenant: r, isLoading: s, error: o } = se(),
|
|
1695
|
-
return s || o ? null : r ? t ? /* @__PURE__ */ n(
|
|
1696
|
-
/* @__PURE__ */ n(
|
|
1697
|
-
/* @__PURE__ */ n(pe, { to: e, state: { from:
|
|
1698
|
-
] }) : /* @__PURE__ */ n(
|
|
1754
|
+
function zt({ children: i, redirectTo: e = "/dashboard", fallback: t }) {
|
|
1755
|
+
const { tenant: r, isLoading: s, error: o } = se(), p = be();
|
|
1756
|
+
return s || o ? null : r ? t ? /* @__PURE__ */ n(U, { children: t }) : /* @__PURE__ */ l(U, { children: [
|
|
1757
|
+
/* @__PURE__ */ n(nt, { redirectPath: e }),
|
|
1758
|
+
/* @__PURE__ */ n(pe, { to: e, state: { from: p.pathname }, replace: !0 })
|
|
1759
|
+
] }) : /* @__PURE__ */ n(U, { children: i });
|
|
1699
1760
|
}
|
|
1700
|
-
const
|
|
1761
|
+
const st = () => /* @__PURE__ */ l(
|
|
1701
1762
|
"div",
|
|
1702
1763
|
{
|
|
1703
1764
|
style: {
|
|
@@ -1714,14 +1775,14 @@ const Ye = () => /* @__PURE__ */ a(
|
|
|
1714
1775
|
]
|
|
1715
1776
|
}
|
|
1716
1777
|
);
|
|
1717
|
-
function
|
|
1778
|
+
function Ot({
|
|
1718
1779
|
children: i,
|
|
1719
|
-
fallback: e = /* @__PURE__ */ n(
|
|
1780
|
+
fallback: e = /* @__PURE__ */ n(st, {}),
|
|
1720
1781
|
allowedPlans: t,
|
|
1721
1782
|
requiredFeature: r
|
|
1722
1783
|
}) {
|
|
1723
|
-
const { subscription: s, hasAllowedPlan: o, isFeatureEnabled:
|
|
1724
|
-
return
|
|
1784
|
+
const { subscription: s, hasAllowedPlan: o, isFeatureEnabled: p, loading: b } = Xe();
|
|
1785
|
+
return b ? /* @__PURE__ */ n(
|
|
1725
1786
|
"div",
|
|
1726
1787
|
{
|
|
1727
1788
|
style: {
|
|
@@ -1731,9 +1792,9 @@ function Ft({
|
|
|
1731
1792
|
},
|
|
1732
1793
|
children: "Loading subscription..."
|
|
1733
1794
|
}
|
|
1734
|
-
) : s ? s.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ n(
|
|
1795
|
+
) : s ? s.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ n(U, { children: e }) : r && !p(r) ? /* @__PURE__ */ n(U, { children: e }) : /* @__PURE__ */ n(U, { children: i }) : /* @__PURE__ */ n(U, { children: e }) : /* @__PURE__ */ n(U, { children: e });
|
|
1735
1796
|
}
|
|
1736
|
-
const
|
|
1797
|
+
const it = ({ flagName: i }) => /* @__PURE__ */ l(
|
|
1737
1798
|
"div",
|
|
1738
1799
|
{
|
|
1739
1800
|
style: {
|
|
@@ -1752,7 +1813,7 @@ const Qe = ({ flagName: i }) => /* @__PURE__ */ a(
|
|
|
1752
1813
|
children: [
|
|
1753
1814
|
/* @__PURE__ */ n("div", { style: { fontSize: "24px", marginBottom: "8px" }, children: "🚧" }),
|
|
1754
1815
|
/* @__PURE__ */ n("div", { style: { fontSize: "14px", fontWeight: "500", marginBottom: "4px" }, children: "Feature Not Available" }),
|
|
1755
|
-
/* @__PURE__ */
|
|
1816
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", opacity: 0.7 }, children: [
|
|
1756
1817
|
'Feature flag "',
|
|
1757
1818
|
i,
|
|
1758
1819
|
'" is disabled'
|
|
@@ -1760,8 +1821,8 @@ const Qe = ({ flagName: i }) => /* @__PURE__ */ a(
|
|
|
1760
1821
|
]
|
|
1761
1822
|
}
|
|
1762
1823
|
);
|
|
1763
|
-
function
|
|
1764
|
-
const { isEnabled: r, loading: s } =
|
|
1824
|
+
function Wt({ name: i, children: e, fallback: t }) {
|
|
1825
|
+
const { isEnabled: r, loading: s } = Ye();
|
|
1765
1826
|
return s ? /* @__PURE__ */ n(
|
|
1766
1827
|
"div",
|
|
1767
1828
|
{
|
|
@@ -1775,9 +1836,9 @@ function Dt({ name: i, children: e, fallback: t }) {
|
|
|
1775
1836
|
},
|
|
1776
1837
|
children: "Loading feature flags..."
|
|
1777
1838
|
}
|
|
1778
|
-
) : r(i) ? /* @__PURE__ */ n(
|
|
1839
|
+
) : r(i) ? /* @__PURE__ */ n(U, { children: e }) : /* @__PURE__ */ n(U, { children: t || /* @__PURE__ */ n(it, { flagName: i }) });
|
|
1779
1840
|
}
|
|
1780
|
-
const
|
|
1841
|
+
const ot = () => /* @__PURE__ */ l(
|
|
1781
1842
|
"svg",
|
|
1782
1843
|
{
|
|
1783
1844
|
width: "16",
|
|
@@ -1794,7 +1855,7 @@ const Xe = () => /* @__PURE__ */ a(
|
|
|
1794
1855
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
1795
1856
|
]
|
|
1796
1857
|
}
|
|
1797
|
-
),
|
|
1858
|
+
), at = () => /* @__PURE__ */ l(
|
|
1798
1859
|
"svg",
|
|
1799
1860
|
{
|
|
1800
1861
|
width: "16",
|
|
@@ -1811,10 +1872,10 @@ const Xe = () => /* @__PURE__ */ a(
|
|
|
1811
1872
|
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1812
1873
|
]
|
|
1813
1874
|
}
|
|
1814
|
-
),
|
|
1815
|
-
showPassword: /* @__PURE__ */ n(
|
|
1816
|
-
hidePassword: /* @__PURE__ */ n(
|
|
1817
|
-
},
|
|
1875
|
+
), lt = {
|
|
1876
|
+
showPassword: /* @__PURE__ */ n(ot, {}),
|
|
1877
|
+
hidePassword: /* @__PURE__ */ n(at, {})
|
|
1878
|
+
}, ct = {
|
|
1818
1879
|
title: "Sign In",
|
|
1819
1880
|
usernameLabel: "Email or Phone",
|
|
1820
1881
|
usernamePlaceholder: "Enter your email or phone number",
|
|
@@ -1828,7 +1889,7 @@ const Xe = () => /* @__PURE__ */ a(
|
|
|
1828
1889
|
magicLinkLink: "Use Magic Link",
|
|
1829
1890
|
errorMessage: "Invalid credentials",
|
|
1830
1891
|
loadingText: "Signing in..."
|
|
1831
|
-
},
|
|
1892
|
+
}, dt = {
|
|
1832
1893
|
container: {
|
|
1833
1894
|
maxWidth: "400px",
|
|
1834
1895
|
width: "100%",
|
|
@@ -1935,133 +1996,133 @@ const Xe = () => /* @__PURE__ */ a(
|
|
|
1935
1996
|
fontSize: "0.875rem"
|
|
1936
1997
|
}
|
|
1937
1998
|
};
|
|
1938
|
-
function
|
|
1999
|
+
function jt({
|
|
1939
2000
|
copy: i = {},
|
|
1940
2001
|
styles: e = {},
|
|
1941
2002
|
icons: t = {},
|
|
1942
2003
|
onSuccess: r,
|
|
1943
2004
|
onError: s,
|
|
1944
2005
|
onForgotPassword: o,
|
|
1945
|
-
onSignupClick:
|
|
1946
|
-
onMagicLinkClick:
|
|
1947
|
-
showForgotPassword:
|
|
1948
|
-
showSignupLink:
|
|
2006
|
+
onSignupClick: p,
|
|
2007
|
+
onMagicLinkClick: b,
|
|
2008
|
+
showForgotPassword: k = !0,
|
|
2009
|
+
showSignupLink: S = !0,
|
|
1949
2010
|
showMagicLinkOption: T = !0,
|
|
1950
|
-
className:
|
|
2011
|
+
className: m
|
|
1951
2012
|
}) {
|
|
1952
|
-
const [
|
|
1953
|
-
const
|
|
1954
|
-
return
|
|
1955
|
-
},
|
|
1956
|
-
if (
|
|
1957
|
-
if (!(
|
|
2013
|
+
const [f, u] = x(""), [y, R] = x(""), [C, q] = x(!1), [A, d] = x(!1), [P, E] = x(""), [z, G] = x({}), { login: $ } = ae(), { tenant: _ } = se(), v = { ...ct, ...i }, M = { ...dt, ...e }, I = { ...lt, ...t }, a = () => {
|
|
2014
|
+
const g = {};
|
|
2015
|
+
return f.trim() || (g.username = !0), y.trim() || (g.password = !0), G(g), Object.keys(g).length === 0;
|
|
2016
|
+
}, L = async (g) => {
|
|
2017
|
+
if (g.preventDefault(), !!a()) {
|
|
2018
|
+
if (!(_ != null && _.id)) {
|
|
1958
2019
|
E("Tenant not found");
|
|
1959
2020
|
return;
|
|
1960
2021
|
}
|
|
1961
|
-
|
|
2022
|
+
d(!0), E("");
|
|
1962
2023
|
try {
|
|
1963
|
-
const
|
|
1964
|
-
username:
|
|
1965
|
-
password:
|
|
2024
|
+
const w = await $({
|
|
2025
|
+
username: f,
|
|
2026
|
+
password: y
|
|
1966
2027
|
// tenantId inferred from context automatically
|
|
1967
2028
|
});
|
|
1968
|
-
r == null || r(
|
|
1969
|
-
} catch (
|
|
1970
|
-
const
|
|
1971
|
-
E(
|
|
2029
|
+
r == null || r(w);
|
|
2030
|
+
} catch (w) {
|
|
2031
|
+
const j = w.message || v.errorMessage;
|
|
2032
|
+
E(j), s == null || s(j);
|
|
1972
2033
|
} finally {
|
|
1973
|
-
|
|
2034
|
+
d(!1);
|
|
1974
2035
|
}
|
|
1975
2036
|
}
|
|
1976
|
-
},
|
|
1977
|
-
...
|
|
1978
|
-
...
|
|
1979
|
-
}),
|
|
1980
|
-
...
|
|
1981
|
-
...
|
|
1982
|
-
...!
|
|
2037
|
+
}, c = (g) => ({
|
|
2038
|
+
...M.input,
|
|
2039
|
+
...z[g] ? M.inputError : {}
|
|
2040
|
+
}), h = () => ({
|
|
2041
|
+
...M.button,
|
|
2042
|
+
...A ? M.buttonLoading : {},
|
|
2043
|
+
...!f || !y || A ? M.buttonDisabled : {}
|
|
1983
2044
|
});
|
|
1984
|
-
return /* @__PURE__ */
|
|
1985
|
-
/* @__PURE__ */ n("h2", { style:
|
|
1986
|
-
/* @__PURE__ */
|
|
1987
|
-
/* @__PURE__ */
|
|
1988
|
-
/* @__PURE__ */ n("label", { style:
|
|
2045
|
+
return /* @__PURE__ */ l("div", { className: m, style: M.container, children: [
|
|
2046
|
+
/* @__PURE__ */ n("h2", { style: M.title, children: v.title }),
|
|
2047
|
+
/* @__PURE__ */ l("form", { onSubmit: L, style: M.form, children: [
|
|
2048
|
+
/* @__PURE__ */ l("div", { style: M.fieldGroup, children: [
|
|
2049
|
+
/* @__PURE__ */ n("label", { style: M.label, children: v.usernameLabel }),
|
|
1989
2050
|
/* @__PURE__ */ n(
|
|
1990
2051
|
"input",
|
|
1991
2052
|
{
|
|
1992
2053
|
id: "username",
|
|
1993
2054
|
name: "username",
|
|
1994
2055
|
type: "text",
|
|
1995
|
-
value:
|
|
1996
|
-
onChange: (
|
|
1997
|
-
|
|
2056
|
+
value: f,
|
|
2057
|
+
onChange: (g) => {
|
|
2058
|
+
u(g.target.value), z.username && G((w) => ({ ...w, username: !1 }));
|
|
1998
2059
|
},
|
|
1999
2060
|
placeholder: v.usernamePlaceholder,
|
|
2000
|
-
style:
|
|
2001
|
-
disabled:
|
|
2061
|
+
style: c("username"),
|
|
2062
|
+
disabled: A
|
|
2002
2063
|
}
|
|
2003
2064
|
)
|
|
2004
2065
|
] }),
|
|
2005
|
-
/* @__PURE__ */
|
|
2006
|
-
/* @__PURE__ */ n("label", { style:
|
|
2007
|
-
/* @__PURE__ */
|
|
2066
|
+
/* @__PURE__ */ l("div", { style: M.fieldGroup, children: [
|
|
2067
|
+
/* @__PURE__ */ n("label", { style: M.label, children: v.passwordLabel }),
|
|
2068
|
+
/* @__PURE__ */ l("div", { style: M.inputContainer, children: [
|
|
2008
2069
|
/* @__PURE__ */ n(
|
|
2009
2070
|
"input",
|
|
2010
2071
|
{
|
|
2011
2072
|
id: "password",
|
|
2012
2073
|
name: "password",
|
|
2013
2074
|
type: C ? "text" : "password",
|
|
2014
|
-
value:
|
|
2015
|
-
onChange: (
|
|
2016
|
-
R(
|
|
2075
|
+
value: y,
|
|
2076
|
+
onChange: (g) => {
|
|
2077
|
+
R(g.target.value), z.password && G((w) => ({ ...w, password: !1 }));
|
|
2017
2078
|
},
|
|
2018
2079
|
placeholder: v.passwordPlaceholder,
|
|
2019
2080
|
style: {
|
|
2020
|
-
...
|
|
2081
|
+
...c("password"),
|
|
2021
2082
|
paddingRight: "2.5rem"
|
|
2022
2083
|
// Make room for the icon
|
|
2023
2084
|
},
|
|
2024
|
-
disabled:
|
|
2085
|
+
disabled: A
|
|
2025
2086
|
}
|
|
2026
2087
|
),
|
|
2027
2088
|
/* @__PURE__ */ n(
|
|
2028
2089
|
"button",
|
|
2029
2090
|
{
|
|
2030
2091
|
type: "button",
|
|
2031
|
-
onClick: () =>
|
|
2032
|
-
style:
|
|
2033
|
-
disabled:
|
|
2092
|
+
onClick: () => q(!C),
|
|
2093
|
+
style: M.passwordToggle,
|
|
2094
|
+
disabled: A,
|
|
2034
2095
|
"aria-label": C ? "Hide password" : "Show password",
|
|
2035
|
-
children: C ?
|
|
2096
|
+
children: C ? I.hidePassword : I.showPassword
|
|
2036
2097
|
}
|
|
2037
2098
|
)
|
|
2038
2099
|
] })
|
|
2039
2100
|
] }),
|
|
2040
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !
|
|
2041
|
-
|
|
2101
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !f || !y || A, style: h(), children: A ? v.loadingText : v.submitButton }),
|
|
2102
|
+
P && /* @__PURE__ */ n("div", { style: M.errorText, children: P })
|
|
2042
2103
|
] }),
|
|
2043
|
-
(
|
|
2044
|
-
T && /* @__PURE__ */
|
|
2045
|
-
/* @__PURE__ */
|
|
2104
|
+
(k || S || T) && /* @__PURE__ */ l("div", { style: M.linkContainer, children: [
|
|
2105
|
+
T && /* @__PURE__ */ l("div", { children: [
|
|
2106
|
+
/* @__PURE__ */ l("span", { style: M.divider, children: [
|
|
2046
2107
|
v.magicLinkText,
|
|
2047
2108
|
" "
|
|
2048
2109
|
] }),
|
|
2049
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2110
|
+
/* @__PURE__ */ n("a", { onClick: b, style: M.link, children: v.magicLinkLink })
|
|
2050
2111
|
] }),
|
|
2051
|
-
T && (
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
/* @__PURE__ */
|
|
2112
|
+
T && (k || S) && /* @__PURE__ */ n("div", { style: M.divider, children: "•" }),
|
|
2113
|
+
k && /* @__PURE__ */ n("a", { onClick: o, style: M.link, children: v.forgotPasswordLink }),
|
|
2114
|
+
k && S && /* @__PURE__ */ n("div", { style: M.divider, children: "•" }),
|
|
2115
|
+
S && /* @__PURE__ */ l("div", { children: [
|
|
2116
|
+
/* @__PURE__ */ l("span", { style: M.divider, children: [
|
|
2056
2117
|
v.signupText,
|
|
2057
2118
|
" "
|
|
2058
2119
|
] }),
|
|
2059
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2120
|
+
/* @__PURE__ */ n("a", { onClick: p, style: M.link, children: v.signupLink })
|
|
2060
2121
|
] })
|
|
2061
2122
|
] })
|
|
2062
2123
|
] });
|
|
2063
2124
|
}
|
|
2064
|
-
const
|
|
2125
|
+
const ut = {
|
|
2065
2126
|
title: "Create Account",
|
|
2066
2127
|
nameLabel: "First Name",
|
|
2067
2128
|
namePlaceholder: "Enter your first name",
|
|
@@ -2087,7 +2148,7 @@ const nt = {
|
|
|
2087
2148
|
passwordMismatchError: "Passwords do not match",
|
|
2088
2149
|
isAdminLabel: "Create new organization",
|
|
2089
2150
|
isAdminDescription: "Check this if you want to create a new organization"
|
|
2090
|
-
},
|
|
2151
|
+
}, ht = {
|
|
2091
2152
|
container: {
|
|
2092
2153
|
maxWidth: "400px",
|
|
2093
2154
|
width: "100%",
|
|
@@ -2186,69 +2247,69 @@ const nt = {
|
|
|
2186
2247
|
fontSize: "0.875rem"
|
|
2187
2248
|
}
|
|
2188
2249
|
};
|
|
2189
|
-
function
|
|
2250
|
+
function Vt({
|
|
2190
2251
|
copy: i = {},
|
|
2191
2252
|
styles: e = {},
|
|
2192
2253
|
signupType: t = "user",
|
|
2193
2254
|
onSuccess: r,
|
|
2194
2255
|
onError: s,
|
|
2195
2256
|
onLoginClick: o,
|
|
2196
|
-
onMagicLinkClick:
|
|
2197
|
-
showLoginLink:
|
|
2198
|
-
showMagicLinkOption:
|
|
2199
|
-
className:
|
|
2257
|
+
onMagicLinkClick: p,
|
|
2258
|
+
showLoginLink: b = !0,
|
|
2259
|
+
showMagicLinkOption: k = !0,
|
|
2260
|
+
className: S
|
|
2200
2261
|
}) {
|
|
2201
|
-
const [T,
|
|
2202
|
-
const
|
|
2203
|
-
return T.trim() || (
|
|
2204
|
-
},
|
|
2205
|
-
if (
|
|
2206
|
-
if (
|
|
2207
|
-
|
|
2262
|
+
const [T, m] = x(""), [f, u] = x(""), [y, R] = x(""), [C, q] = x(""), [A, d] = x(""), [P, E] = x(""), [z, G] = x(""), [$, _] = x(!1), [v, M] = x(""), [I, a] = x({}), { signup: L, signupTenantAdmin: c } = ae(), { tenant: h } = se(), g = { ...ut, ...i }, w = { ...ht, ...e }, j = () => {
|
|
2263
|
+
const F = {};
|
|
2264
|
+
return T.trim() || (F.name = !0), !y.trim() && !C.trim() && (F.email = !0, F.phoneNumber = !0), A.trim() || (F.password = !0), P.trim() || (F.confirmPassword = !0), t === "tenant" && !z.trim() && (F.tenantName = !0), a(F), Object.keys(F).length === 0;
|
|
2265
|
+
}, Y = async (F) => {
|
|
2266
|
+
if (F.preventDefault(), !!j()) {
|
|
2267
|
+
if (A !== P) {
|
|
2268
|
+
M(g.passwordMismatchError), a({ confirmPassword: !0 });
|
|
2208
2269
|
return;
|
|
2209
2270
|
}
|
|
2210
|
-
if (t === "user" && !(
|
|
2211
|
-
|
|
2271
|
+
if (t === "user" && !(h != null && h.id)) {
|
|
2272
|
+
M("Tenant not found");
|
|
2212
2273
|
return;
|
|
2213
2274
|
}
|
|
2214
|
-
|
|
2275
|
+
_(!0), M("");
|
|
2215
2276
|
try {
|
|
2216
2277
|
let K;
|
|
2217
|
-
t === "tenant" ? K = await
|
|
2218
|
-
email:
|
|
2278
|
+
t === "tenant" ? K = await c({
|
|
2279
|
+
email: y || void 0,
|
|
2219
2280
|
phoneNumber: C || void 0,
|
|
2220
2281
|
name: T,
|
|
2221
|
-
password:
|
|
2222
|
-
tenantName:
|
|
2223
|
-
lastName:
|
|
2224
|
-
}) : K = await
|
|
2225
|
-
email:
|
|
2282
|
+
password: A,
|
|
2283
|
+
tenantName: z,
|
|
2284
|
+
lastName: f || void 0
|
|
2285
|
+
}) : K = await L({
|
|
2286
|
+
email: y || void 0,
|
|
2226
2287
|
phoneNumber: C || void 0,
|
|
2227
2288
|
name: T,
|
|
2228
|
-
password:
|
|
2229
|
-
tenantId:
|
|
2230
|
-
lastName:
|
|
2289
|
+
password: A,
|
|
2290
|
+
tenantId: h.id,
|
|
2291
|
+
lastName: f || void 0
|
|
2231
2292
|
}), r == null || r(K);
|
|
2232
2293
|
} catch (K) {
|
|
2233
|
-
const ge = K.message ||
|
|
2234
|
-
|
|
2294
|
+
const ge = K.message || g.errorMessage;
|
|
2295
|
+
M(ge), s == null || s(ge);
|
|
2235
2296
|
} finally {
|
|
2236
|
-
|
|
2297
|
+
_(!1);
|
|
2237
2298
|
}
|
|
2238
2299
|
}
|
|
2239
|
-
},
|
|
2240
|
-
...
|
|
2241
|
-
...
|
|
2242
|
-
}),
|
|
2243
|
-
...
|
|
2244
|
-
...$ ?
|
|
2245
|
-
...!T || !
|
|
2246
|
-
}), O = T && (
|
|
2247
|
-
return /* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
/* @__PURE__ */
|
|
2251
|
-
/* @__PURE__ */ n("label", { style:
|
|
2300
|
+
}, H = (F) => ({
|
|
2301
|
+
...w.input,
|
|
2302
|
+
...I[F] ? w.inputError : {}
|
|
2303
|
+
}), N = () => ({
|
|
2304
|
+
...w.button,
|
|
2305
|
+
...$ ? w.buttonLoading : {},
|
|
2306
|
+
...!T || !y && !C || !A || !P || $ || t === "tenant" && !z ? w.buttonDisabled : {}
|
|
2307
|
+
}), O = T && (y || C) && A && P && (t === "user" || z);
|
|
2308
|
+
return /* @__PURE__ */ l("div", { className: S, style: w.container, children: [
|
|
2309
|
+
/* @__PURE__ */ n("h2", { style: w.title, children: g.title }),
|
|
2310
|
+
/* @__PURE__ */ l("form", { onSubmit: Y, style: w.form, children: [
|
|
2311
|
+
/* @__PURE__ */ l("div", { style: w.fieldGroup, children: [
|
|
2312
|
+
/* @__PURE__ */ n("label", { style: w.label, children: g.nameLabel }),
|
|
2252
2313
|
/* @__PURE__ */ n(
|
|
2253
2314
|
"input",
|
|
2254
2315
|
{
|
|
@@ -2256,51 +2317,51 @@ function Nt({
|
|
|
2256
2317
|
name: "name",
|
|
2257
2318
|
type: "text",
|
|
2258
2319
|
value: T,
|
|
2259
|
-
onChange: (
|
|
2260
|
-
|
|
2320
|
+
onChange: (F) => {
|
|
2321
|
+
m(F.target.value), I.name && a((K) => ({ ...K, name: !1 }));
|
|
2261
2322
|
},
|
|
2262
|
-
placeholder:
|
|
2263
|
-
style:
|
|
2323
|
+
placeholder: g.namePlaceholder,
|
|
2324
|
+
style: H("name"),
|
|
2264
2325
|
disabled: $
|
|
2265
2326
|
}
|
|
2266
2327
|
)
|
|
2267
2328
|
] }),
|
|
2268
|
-
/* @__PURE__ */
|
|
2269
|
-
/* @__PURE__ */ n("label", { style:
|
|
2329
|
+
/* @__PURE__ */ l("div", { style: w.fieldGroup, children: [
|
|
2330
|
+
/* @__PURE__ */ n("label", { style: w.label, children: g.lastNameLabel }),
|
|
2270
2331
|
/* @__PURE__ */ n(
|
|
2271
2332
|
"input",
|
|
2272
2333
|
{
|
|
2273
2334
|
id: "lastName",
|
|
2274
2335
|
name: "lastName",
|
|
2275
2336
|
type: "text",
|
|
2276
|
-
value:
|
|
2277
|
-
onChange: (
|
|
2278
|
-
placeholder:
|
|
2279
|
-
style:
|
|
2337
|
+
value: f,
|
|
2338
|
+
onChange: (F) => u(F.target.value),
|
|
2339
|
+
placeholder: g.lastNamePlaceholder,
|
|
2340
|
+
style: w.input,
|
|
2280
2341
|
disabled: $
|
|
2281
2342
|
}
|
|
2282
2343
|
)
|
|
2283
2344
|
] }),
|
|
2284
|
-
/* @__PURE__ */
|
|
2285
|
-
/* @__PURE__ */ n("label", { style:
|
|
2345
|
+
/* @__PURE__ */ l("div", { style: w.fieldGroup, children: [
|
|
2346
|
+
/* @__PURE__ */ n("label", { style: w.label, children: g.emailLabel }),
|
|
2286
2347
|
/* @__PURE__ */ n(
|
|
2287
2348
|
"input",
|
|
2288
2349
|
{
|
|
2289
2350
|
id: "email",
|
|
2290
2351
|
name: "email",
|
|
2291
2352
|
type: "email",
|
|
2292
|
-
value:
|
|
2293
|
-
onChange: (
|
|
2294
|
-
R(
|
|
2353
|
+
value: y,
|
|
2354
|
+
onChange: (F) => {
|
|
2355
|
+
R(F.target.value), I.email && a((K) => ({ ...K, email: !1, phoneNumber: !1 }));
|
|
2295
2356
|
},
|
|
2296
|
-
placeholder:
|
|
2297
|
-
style:
|
|
2357
|
+
placeholder: g.emailPlaceholder,
|
|
2358
|
+
style: H("email"),
|
|
2298
2359
|
disabled: $
|
|
2299
2360
|
}
|
|
2300
2361
|
)
|
|
2301
2362
|
] }),
|
|
2302
|
-
/* @__PURE__ */
|
|
2303
|
-
/* @__PURE__ */ n("label", { style:
|
|
2363
|
+
/* @__PURE__ */ l("div", { style: w.fieldGroup, children: [
|
|
2364
|
+
/* @__PURE__ */ n("label", { style: w.label, children: g.phoneNumberLabel }),
|
|
2304
2365
|
/* @__PURE__ */ n(
|
|
2305
2366
|
"input",
|
|
2306
2367
|
{
|
|
@@ -2308,11 +2369,11 @@ function Nt({
|
|
|
2308
2369
|
name: "phoneNumber",
|
|
2309
2370
|
type: "tel",
|
|
2310
2371
|
value: C,
|
|
2311
|
-
onChange: (
|
|
2312
|
-
|
|
2372
|
+
onChange: (F) => {
|
|
2373
|
+
q(F.target.value), I.phoneNumber && a((K) => ({ ...K, email: !1, phoneNumber: !1 }));
|
|
2313
2374
|
},
|
|
2314
|
-
placeholder:
|
|
2315
|
-
style:
|
|
2375
|
+
placeholder: g.phoneNumberPlaceholder,
|
|
2376
|
+
style: H("phoneNumber"),
|
|
2316
2377
|
disabled: $
|
|
2317
2378
|
}
|
|
2318
2379
|
)
|
|
@@ -2329,83 +2390,83 @@ function Nt({
|
|
|
2329
2390
|
children: "At least one contact method (email or phone) is required"
|
|
2330
2391
|
}
|
|
2331
2392
|
),
|
|
2332
|
-
/* @__PURE__ */
|
|
2333
|
-
/* @__PURE__ */ n("label", { style:
|
|
2393
|
+
/* @__PURE__ */ l("div", { style: w.fieldGroup, children: [
|
|
2394
|
+
/* @__PURE__ */ n("label", { style: w.label, children: g.passwordLabel }),
|
|
2334
2395
|
/* @__PURE__ */ n(
|
|
2335
2396
|
"input",
|
|
2336
2397
|
{
|
|
2337
2398
|
id: "password",
|
|
2338
2399
|
name: "password",
|
|
2339
2400
|
type: "password",
|
|
2340
|
-
value:
|
|
2341
|
-
onChange: (
|
|
2342
|
-
|
|
2401
|
+
value: A,
|
|
2402
|
+
onChange: (F) => {
|
|
2403
|
+
d(F.target.value), I.password && a((K) => ({ ...K, password: !1 }));
|
|
2343
2404
|
},
|
|
2344
|
-
placeholder:
|
|
2345
|
-
style:
|
|
2405
|
+
placeholder: g.passwordPlaceholder,
|
|
2406
|
+
style: H("password"),
|
|
2346
2407
|
disabled: $
|
|
2347
2408
|
}
|
|
2348
2409
|
)
|
|
2349
2410
|
] }),
|
|
2350
|
-
/* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */ n("label", { style:
|
|
2411
|
+
/* @__PURE__ */ l("div", { style: w.fieldGroup, children: [
|
|
2412
|
+
/* @__PURE__ */ n("label", { style: w.label, children: g.confirmPasswordLabel }),
|
|
2352
2413
|
/* @__PURE__ */ n(
|
|
2353
2414
|
"input",
|
|
2354
2415
|
{
|
|
2355
2416
|
id: "confirmPassword",
|
|
2356
2417
|
name: "confirmPassword",
|
|
2357
2418
|
type: "password",
|
|
2358
|
-
value:
|
|
2359
|
-
onChange: (
|
|
2360
|
-
E(
|
|
2419
|
+
value: P,
|
|
2420
|
+
onChange: (F) => {
|
|
2421
|
+
E(F.target.value), I.confirmPassword && a((K) => ({ ...K, confirmPassword: !1 })), v === g.passwordMismatchError && M("");
|
|
2361
2422
|
},
|
|
2362
|
-
placeholder:
|
|
2363
|
-
style:
|
|
2423
|
+
placeholder: g.confirmPasswordPlaceholder,
|
|
2424
|
+
style: H("confirmPassword"),
|
|
2364
2425
|
disabled: $
|
|
2365
2426
|
}
|
|
2366
2427
|
)
|
|
2367
2428
|
] }),
|
|
2368
|
-
t === "tenant" && /* @__PURE__ */
|
|
2369
|
-
/* @__PURE__ */ n("label", { style:
|
|
2429
|
+
t === "tenant" && /* @__PURE__ */ l("div", { style: w.fieldGroup, children: [
|
|
2430
|
+
/* @__PURE__ */ n("label", { style: w.label, children: g.tenantNameLabel }),
|
|
2370
2431
|
/* @__PURE__ */ n(
|
|
2371
2432
|
"input",
|
|
2372
2433
|
{
|
|
2373
2434
|
id: "tenantName",
|
|
2374
2435
|
name: "tenantName",
|
|
2375
2436
|
type: "text",
|
|
2376
|
-
value:
|
|
2377
|
-
onChange: (
|
|
2378
|
-
|
|
2437
|
+
value: z,
|
|
2438
|
+
onChange: (F) => {
|
|
2439
|
+
G(F.target.value), I.tenantName && a((K) => ({ ...K, tenantName: !1 }));
|
|
2379
2440
|
},
|
|
2380
|
-
placeholder:
|
|
2381
|
-
style:
|
|
2441
|
+
placeholder: g.tenantNamePlaceholder,
|
|
2442
|
+
style: H("tenantName"),
|
|
2382
2443
|
disabled: $
|
|
2383
2444
|
}
|
|
2384
2445
|
)
|
|
2385
2446
|
] }),
|
|
2386
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !O || $, style:
|
|
2387
|
-
v && /* @__PURE__ */ n("div", { style:
|
|
2447
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !O || $, style: N(), children: $ ? g.loadingText : g.submitButton }),
|
|
2448
|
+
v && /* @__PURE__ */ n("div", { style: w.errorText, children: v })
|
|
2388
2449
|
] }),
|
|
2389
|
-
(
|
|
2390
|
-
|
|
2391
|
-
/* @__PURE__ */
|
|
2392
|
-
|
|
2450
|
+
(b || k) && /* @__PURE__ */ l("div", { style: w.linkContainer, children: [
|
|
2451
|
+
k && /* @__PURE__ */ l("div", { children: [
|
|
2452
|
+
/* @__PURE__ */ l("span", { style: w.divider, children: [
|
|
2453
|
+
g.magicLinkText,
|
|
2393
2454
|
" "
|
|
2394
2455
|
] }),
|
|
2395
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2456
|
+
/* @__PURE__ */ n("a", { onClick: p, style: w.link, children: g.magicLinkLink })
|
|
2396
2457
|
] }),
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
|
|
2458
|
+
k && b && /* @__PURE__ */ n("div", { style: w.divider, children: "•" }),
|
|
2459
|
+
b && /* @__PURE__ */ l("div", { children: [
|
|
2460
|
+
/* @__PURE__ */ l("span", { style: w.divider, children: [
|
|
2461
|
+
g.loginText,
|
|
2401
2462
|
" "
|
|
2402
2463
|
] }),
|
|
2403
|
-
/* @__PURE__ */ n("a", { onClick: o, style:
|
|
2464
|
+
/* @__PURE__ */ n("a", { onClick: o, style: w.link, children: g.loginLink })
|
|
2404
2465
|
] })
|
|
2405
2466
|
] })
|
|
2406
2467
|
] });
|
|
2407
2468
|
}
|
|
2408
|
-
const
|
|
2469
|
+
const gt = {
|
|
2409
2470
|
title: "Sign In with Magic Link",
|
|
2410
2471
|
emailLabel: "Email",
|
|
2411
2472
|
emailPlaceholder: "Enter your email",
|
|
@@ -2423,7 +2484,7 @@ const it = {
|
|
|
2423
2484
|
loadingText: "Sending magic link...",
|
|
2424
2485
|
verifyingText: "Verifying magic link...",
|
|
2425
2486
|
description: "Enter your email to receive a magic link. If you don't have an account, we'll create one for you."
|
|
2426
|
-
},
|
|
2487
|
+
}, pt = {
|
|
2427
2488
|
container: {
|
|
2428
2489
|
maxWidth: "400px",
|
|
2429
2490
|
width: "100%",
|
|
@@ -2526,84 +2587,84 @@ const it = {
|
|
|
2526
2587
|
fontSize: "0.875rem"
|
|
2527
2588
|
}
|
|
2528
2589
|
};
|
|
2529
|
-
function
|
|
2590
|
+
function _t({
|
|
2530
2591
|
copy: i = {},
|
|
2531
2592
|
styles: e = {},
|
|
2532
2593
|
onSuccess: t,
|
|
2533
2594
|
onError: r,
|
|
2534
2595
|
onLoginClick: s,
|
|
2535
2596
|
onSignupClick: o,
|
|
2536
|
-
showTraditionalLinks:
|
|
2537
|
-
className:
|
|
2538
|
-
verifyToken:
|
|
2539
|
-
frontendUrl:
|
|
2597
|
+
showTraditionalLinks: p = !0,
|
|
2598
|
+
className: b,
|
|
2599
|
+
verifyToken: k,
|
|
2600
|
+
frontendUrl: S
|
|
2540
2601
|
}) {
|
|
2541
|
-
const [T,
|
|
2602
|
+
const [T, m] = x(""), [f, u] = x(""), [y, R] = x(""), [C, q] = x(!1), [A, d] = x(!1), [P, E] = x(""), [z, G] = x(""), [$, _] = x({}), [v, M] = x(!1), { sendMagicLink: I, verifyMagicLink: a } = ae(), { tenant: L } = se(), c = { ...gt, ...i }, h = { ...pt, ...e };
|
|
2542
2603
|
te(() => {
|
|
2543
|
-
|
|
2544
|
-
}, [
|
|
2545
|
-
const
|
|
2546
|
-
if (!
|
|
2604
|
+
k && g(k);
|
|
2605
|
+
}, [k]);
|
|
2606
|
+
const g = async (N) => {
|
|
2607
|
+
if (!L || !T) {
|
|
2547
2608
|
E("Missing tenant or email");
|
|
2548
2609
|
return;
|
|
2549
2610
|
}
|
|
2550
|
-
|
|
2611
|
+
d(!0), E("");
|
|
2551
2612
|
try {
|
|
2552
|
-
const O = await
|
|
2553
|
-
token:
|
|
2613
|
+
const O = await a({
|
|
2614
|
+
token: N,
|
|
2554
2615
|
email: T
|
|
2555
2616
|
// tenantId inferred from context automatically
|
|
2556
2617
|
});
|
|
2557
2618
|
t == null || t(O);
|
|
2558
2619
|
} catch (O) {
|
|
2559
|
-
const
|
|
2560
|
-
E(
|
|
2620
|
+
const F = O.message || "Failed to verify magic link";
|
|
2621
|
+
E(F), r == null || r(F);
|
|
2561
2622
|
} finally {
|
|
2562
|
-
|
|
2623
|
+
d(!1);
|
|
2563
2624
|
}
|
|
2564
|
-
},
|
|
2565
|
-
const
|
|
2566
|
-
return T.trim() || (
|
|
2567
|
-
},
|
|
2568
|
-
if (
|
|
2569
|
-
if (!(
|
|
2625
|
+
}, w = () => {
|
|
2626
|
+
const N = {};
|
|
2627
|
+
return T.trim() || (N.email = !0), v && !f.trim() && (N.name = !0), _(N), Object.keys(N).length === 0;
|
|
2628
|
+
}, j = async (N) => {
|
|
2629
|
+
if (N.preventDefault(), !!w()) {
|
|
2630
|
+
if (!(L != null && L.id)) {
|
|
2570
2631
|
E("Tenant not found");
|
|
2571
2632
|
return;
|
|
2572
2633
|
}
|
|
2573
|
-
|
|
2634
|
+
q(!0), E(""), G("");
|
|
2574
2635
|
try {
|
|
2575
|
-
const O =
|
|
2636
|
+
const O = S || (typeof window < "u" ? window.location.origin : ""), F = await I({
|
|
2576
2637
|
email: T,
|
|
2577
|
-
tenantId:
|
|
2638
|
+
tenantId: L.id,
|
|
2578
2639
|
frontendUrl: O,
|
|
2579
|
-
name: v ?
|
|
2580
|
-
lastName: v ?
|
|
2640
|
+
name: v ? f : void 0,
|
|
2641
|
+
lastName: v ? y : void 0
|
|
2581
2642
|
});
|
|
2582
|
-
|
|
2643
|
+
G(c.successMessage), t == null || t(F);
|
|
2583
2644
|
} catch (O) {
|
|
2584
|
-
const
|
|
2585
|
-
E(
|
|
2645
|
+
const F = O.message || c.errorMessage;
|
|
2646
|
+
E(F), r == null || r(F);
|
|
2586
2647
|
} finally {
|
|
2587
|
-
|
|
2648
|
+
q(!1);
|
|
2588
2649
|
}
|
|
2589
2650
|
}
|
|
2590
|
-
},
|
|
2591
|
-
...
|
|
2592
|
-
...$[
|
|
2593
|
-
}),
|
|
2594
|
-
...
|
|
2595
|
-
...C ||
|
|
2596
|
-
...!T || C ||
|
|
2651
|
+
}, Y = (N) => ({
|
|
2652
|
+
...h.input,
|
|
2653
|
+
...$[N] ? h.inputError : {}
|
|
2654
|
+
}), H = () => ({
|
|
2655
|
+
...h.button,
|
|
2656
|
+
...C || A ? h.buttonLoading : {},
|
|
2657
|
+
...!T || C || A ? h.buttonDisabled : {}
|
|
2597
2658
|
});
|
|
2598
|
-
return
|
|
2599
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2659
|
+
return A ? /* @__PURE__ */ l("div", { className: b, style: h.container, children: [
|
|
2660
|
+
/* @__PURE__ */ n("h2", { style: h.title, children: c.verifyingText }),
|
|
2600
2661
|
/* @__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..." }) })
|
|
2601
|
-
] }) : /* @__PURE__ */
|
|
2602
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2603
|
-
/* @__PURE__ */ n("p", { style:
|
|
2604
|
-
/* @__PURE__ */
|
|
2605
|
-
/* @__PURE__ */
|
|
2606
|
-
/* @__PURE__ */ n("label", { style:
|
|
2662
|
+
] }) : /* @__PURE__ */ l("div", { className: b, style: h.container, children: [
|
|
2663
|
+
/* @__PURE__ */ n("h2", { style: h.title, children: c.title }),
|
|
2664
|
+
/* @__PURE__ */ n("p", { style: h.description, children: c.description }),
|
|
2665
|
+
/* @__PURE__ */ l("form", { onSubmit: j, style: h.form, children: [
|
|
2666
|
+
/* @__PURE__ */ l("div", { style: h.fieldGroup, children: [
|
|
2667
|
+
/* @__PURE__ */ n("label", { style: h.label, children: c.emailLabel }),
|
|
2607
2668
|
/* @__PURE__ */ n(
|
|
2608
2669
|
"input",
|
|
2609
2670
|
{
|
|
@@ -2611,12 +2672,12 @@ function Bt({
|
|
|
2611
2672
|
name: "email",
|
|
2612
2673
|
type: "email",
|
|
2613
2674
|
value: T,
|
|
2614
|
-
onChange: (
|
|
2615
|
-
|
|
2675
|
+
onChange: (N) => {
|
|
2676
|
+
m(N.target.value), $.email && _((O) => ({ ...O, email: !1 }));
|
|
2616
2677
|
},
|
|
2617
|
-
placeholder:
|
|
2618
|
-
style:
|
|
2619
|
-
disabled: C ||
|
|
2678
|
+
placeholder: c.emailPlaceholder,
|
|
2679
|
+
style: Y("email"),
|
|
2680
|
+
disabled: C || A
|
|
2620
2681
|
}
|
|
2621
2682
|
)
|
|
2622
2683
|
] }),
|
|
@@ -2624,7 +2685,7 @@ function Bt({
|
|
|
2624
2685
|
"button",
|
|
2625
2686
|
{
|
|
2626
2687
|
type: "button",
|
|
2627
|
-
onClick: () =>
|
|
2688
|
+
onClick: () => M(!0),
|
|
2628
2689
|
style: {
|
|
2629
2690
|
background: "none",
|
|
2630
2691
|
border: "none",
|
|
@@ -2636,38 +2697,38 @@ function Bt({
|
|
|
2636
2697
|
children: "New user? Add your name"
|
|
2637
2698
|
}
|
|
2638
2699
|
) }),
|
|
2639
|
-
v && /* @__PURE__ */
|
|
2640
|
-
/* @__PURE__ */
|
|
2641
|
-
/* @__PURE__ */ n("label", { style:
|
|
2700
|
+
v && /* @__PURE__ */ l(U, { children: [
|
|
2701
|
+
/* @__PURE__ */ l("div", { style: h.fieldGroup, children: [
|
|
2702
|
+
/* @__PURE__ */ n("label", { style: h.label, children: c.nameLabel }),
|
|
2642
2703
|
/* @__PURE__ */ n(
|
|
2643
2704
|
"input",
|
|
2644
2705
|
{
|
|
2645
2706
|
id: "name",
|
|
2646
2707
|
name: "name",
|
|
2647
2708
|
type: "text",
|
|
2648
|
-
value:
|
|
2649
|
-
onChange: (
|
|
2650
|
-
|
|
2709
|
+
value: f,
|
|
2710
|
+
onChange: (N) => {
|
|
2711
|
+
u(N.target.value), $.name && _((O) => ({ ...O, name: !1 }));
|
|
2651
2712
|
},
|
|
2652
|
-
placeholder:
|
|
2653
|
-
style:
|
|
2654
|
-
disabled: C ||
|
|
2713
|
+
placeholder: c.namePlaceholder,
|
|
2714
|
+
style: Y("name"),
|
|
2715
|
+
disabled: C || A
|
|
2655
2716
|
}
|
|
2656
2717
|
)
|
|
2657
2718
|
] }),
|
|
2658
|
-
/* @__PURE__ */
|
|
2659
|
-
/* @__PURE__ */ n("label", { style:
|
|
2719
|
+
/* @__PURE__ */ l("div", { style: h.fieldGroup, children: [
|
|
2720
|
+
/* @__PURE__ */ n("label", { style: h.label, children: c.lastNameLabel }),
|
|
2660
2721
|
/* @__PURE__ */ n(
|
|
2661
2722
|
"input",
|
|
2662
2723
|
{
|
|
2663
2724
|
id: "lastName",
|
|
2664
2725
|
name: "lastName",
|
|
2665
2726
|
type: "text",
|
|
2666
|
-
value:
|
|
2667
|
-
onChange: (
|
|
2668
|
-
placeholder:
|
|
2669
|
-
style:
|
|
2670
|
-
disabled: C ||
|
|
2727
|
+
value: y,
|
|
2728
|
+
onChange: (N) => R(N.target.value),
|
|
2729
|
+
placeholder: c.lastNamePlaceholder,
|
|
2730
|
+
style: h.input,
|
|
2731
|
+
disabled: C || A
|
|
2671
2732
|
}
|
|
2672
2733
|
)
|
|
2673
2734
|
] }),
|
|
@@ -2676,7 +2737,7 @@ function Bt({
|
|
|
2676
2737
|
{
|
|
2677
2738
|
type: "button",
|
|
2678
2739
|
onClick: () => {
|
|
2679
|
-
|
|
2740
|
+
M(!1), u(""), R("");
|
|
2680
2741
|
},
|
|
2681
2742
|
style: {
|
|
2682
2743
|
background: "none",
|
|
@@ -2690,30 +2751,30 @@ function Bt({
|
|
|
2690
2751
|
}
|
|
2691
2752
|
) })
|
|
2692
2753
|
] }),
|
|
2693
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !T || C ||
|
|
2694
|
-
|
|
2695
|
-
|
|
2754
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !T || C || A, style: H(), children: C ? c.loadingText : c.submitButton }),
|
|
2755
|
+
P && /* @__PURE__ */ n("div", { style: h.errorText, children: P }),
|
|
2756
|
+
z && /* @__PURE__ */ n("div", { style: h.successText, children: z })
|
|
2696
2757
|
] }),
|
|
2697
|
-
|
|
2698
|
-
/* @__PURE__ */
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
|
|
2758
|
+
p && /* @__PURE__ */ l("div", { style: h.linkContainer, children: [
|
|
2759
|
+
/* @__PURE__ */ l("div", { children: [
|
|
2760
|
+
/* @__PURE__ */ l("span", { style: h.divider, children: [
|
|
2761
|
+
c.loginText,
|
|
2701
2762
|
" "
|
|
2702
2763
|
] }),
|
|
2703
|
-
/* @__PURE__ */ n("a", { onClick: s, style:
|
|
2764
|
+
/* @__PURE__ */ n("a", { onClick: s, style: h.link, children: c.loginLink })
|
|
2704
2765
|
] }),
|
|
2705
|
-
/* @__PURE__ */ n("div", { style:
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
2708
|
-
|
|
2766
|
+
/* @__PURE__ */ n("div", { style: h.divider, children: "•" }),
|
|
2767
|
+
/* @__PURE__ */ l("div", { children: [
|
|
2768
|
+
/* @__PURE__ */ l("span", { style: h.divider, children: [
|
|
2769
|
+
c.signupText,
|
|
2709
2770
|
" "
|
|
2710
2771
|
] }),
|
|
2711
|
-
/* @__PURE__ */ n("a", { onClick: o, style:
|
|
2772
|
+
/* @__PURE__ */ n("a", { onClick: o, style: h.link, children: c.signupLink })
|
|
2712
2773
|
] })
|
|
2713
2774
|
] })
|
|
2714
2775
|
] });
|
|
2715
2776
|
}
|
|
2716
|
-
const
|
|
2777
|
+
const ft = {
|
|
2717
2778
|
title: "Verifying Magic Link",
|
|
2718
2779
|
verifyingMessage: "Please wait while we verify your magic link...",
|
|
2719
2780
|
successMessage: "Magic link verified successfully! You are now logged in.",
|
|
@@ -2721,7 +2782,7 @@ const at = {
|
|
|
2721
2782
|
redirectingMessage: "Redirecting you to the dashboard...",
|
|
2722
2783
|
retryButton: "Try Again",
|
|
2723
2784
|
backToLoginButton: "Back to Login"
|
|
2724
|
-
},
|
|
2785
|
+
}, Re = {
|
|
2725
2786
|
container: {
|
|
2726
2787
|
maxWidth: "400px",
|
|
2727
2788
|
width: "100%",
|
|
@@ -2808,7 +2869,7 @@ const at = {
|
|
|
2808
2869
|
cursor: "pointer",
|
|
2809
2870
|
transition: "all 0.15s ease-in-out"
|
|
2810
2871
|
}
|
|
2811
|
-
},
|
|
2872
|
+
}, mt = () => /* @__PURE__ */ n("div", { style: Re.spinner }), yt = () => /* @__PURE__ */ l(
|
|
2812
2873
|
"svg",
|
|
2813
2874
|
{
|
|
2814
2875
|
width: "48",
|
|
@@ -2825,7 +2886,7 @@ const at = {
|
|
|
2825
2886
|
/* @__PURE__ */ n("polyline", { points: "22,4 12,14.01 9,11.01" })
|
|
2826
2887
|
]
|
|
2827
2888
|
}
|
|
2828
|
-
),
|
|
2889
|
+
), wt = () => /* @__PURE__ */ l(
|
|
2829
2890
|
"svg",
|
|
2830
2891
|
{
|
|
2831
2892
|
width: "48",
|
|
@@ -2843,109 +2904,109 @@ const at = {
|
|
|
2843
2904
|
/* @__PURE__ */ n("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
2844
2905
|
]
|
|
2845
2906
|
}
|
|
2846
|
-
),
|
|
2847
|
-
loading: /* @__PURE__ */ n(
|
|
2848
|
-
success: /* @__PURE__ */ n(
|
|
2849
|
-
error: /* @__PURE__ */ n(
|
|
2907
|
+
), bt = {
|
|
2908
|
+
loading: /* @__PURE__ */ n(mt, {}),
|
|
2909
|
+
success: /* @__PURE__ */ n(yt, {}),
|
|
2910
|
+
error: /* @__PURE__ */ n(wt, {})
|
|
2850
2911
|
};
|
|
2851
|
-
function
|
|
2912
|
+
function Gt({
|
|
2852
2913
|
copy: i = {},
|
|
2853
2914
|
styles: e = {},
|
|
2854
2915
|
icons: t = {},
|
|
2855
2916
|
onSuccess: r,
|
|
2856
2917
|
onError: s,
|
|
2857
2918
|
onRetry: o,
|
|
2858
|
-
onBackToLogin:
|
|
2859
|
-
className:
|
|
2860
|
-
token:
|
|
2861
|
-
email:
|
|
2919
|
+
onBackToLogin: p,
|
|
2920
|
+
className: b,
|
|
2921
|
+
token: k,
|
|
2922
|
+
email: S,
|
|
2862
2923
|
appId: T,
|
|
2863
|
-
tenantSlug:
|
|
2864
|
-
autoRedirectDelay:
|
|
2924
|
+
tenantSlug: m,
|
|
2925
|
+
autoRedirectDelay: f = 3e3
|
|
2865
2926
|
}) {
|
|
2866
|
-
const [
|
|
2927
|
+
const [u, y] = x("verifying"), [R, C] = x(""), { verifyMagicLink: q } = ae(), A = { ...ft, ...i }, d = { ...Re, ...e }, P = { ...bt, ...t }, E = () => {
|
|
2867
2928
|
if (typeof window > "u") return {};
|
|
2868
2929
|
const v = new URLSearchParams(window.location.search);
|
|
2869
2930
|
return {
|
|
2870
|
-
token:
|
|
2871
|
-
email:
|
|
2931
|
+
token: k || v.get("token") || "",
|
|
2932
|
+
email: S || v.get("email") || "",
|
|
2872
2933
|
appId: T || v.get("appId") || "",
|
|
2873
|
-
tenantSlug:
|
|
2934
|
+
tenantSlug: m || v.get("tenantSlug") || void 0
|
|
2874
2935
|
};
|
|
2875
|
-
},
|
|
2876
|
-
|
|
2936
|
+
}, z = async () => {
|
|
2937
|
+
y("verifying"), C("");
|
|
2877
2938
|
try {
|
|
2878
2939
|
const v = E();
|
|
2879
2940
|
if (!v.token || !v.email)
|
|
2880
2941
|
throw new Error("Missing required parameters: token or email");
|
|
2881
|
-
const
|
|
2942
|
+
const M = await q({
|
|
2882
2943
|
token: v.token,
|
|
2883
2944
|
email: v.email,
|
|
2884
2945
|
tenantSlug: v.tenantSlug
|
|
2885
2946
|
});
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
},
|
|
2947
|
+
y("success"), r == null || r(M), f > 0 && setTimeout(() => {
|
|
2948
|
+
y("redirecting");
|
|
2949
|
+
}, f);
|
|
2889
2950
|
} catch (v) {
|
|
2890
|
-
const
|
|
2891
|
-
C(
|
|
2951
|
+
const M = v.message || A.errorMessage;
|
|
2952
|
+
C(M), y("error"), s == null || s(M);
|
|
2892
2953
|
}
|
|
2893
|
-
},
|
|
2894
|
-
o == null || o(),
|
|
2954
|
+
}, G = () => {
|
|
2955
|
+
o == null || o(), z();
|
|
2895
2956
|
}, $ = () => {
|
|
2896
|
-
|
|
2957
|
+
p == null || p();
|
|
2897
2958
|
};
|
|
2898
2959
|
te(() => {
|
|
2899
|
-
|
|
2960
|
+
z();
|
|
2900
2961
|
}, []);
|
|
2901
|
-
const
|
|
2902
|
-
switch (
|
|
2962
|
+
const _ = () => {
|
|
2963
|
+
switch (u) {
|
|
2903
2964
|
case "verifying":
|
|
2904
|
-
return /* @__PURE__ */
|
|
2905
|
-
|
|
2906
|
-
|
|
2965
|
+
return /* @__PURE__ */ l("div", { style: d.message, children: [
|
|
2966
|
+
P.loading,
|
|
2967
|
+
A.verifyingMessage
|
|
2907
2968
|
] });
|
|
2908
2969
|
case "success":
|
|
2909
|
-
return /* @__PURE__ */
|
|
2910
|
-
|
|
2911
|
-
/* @__PURE__ */ n("div", { style:
|
|
2970
|
+
return /* @__PURE__ */ l(U, { children: [
|
|
2971
|
+
P.success,
|
|
2972
|
+
/* @__PURE__ */ n("div", { style: d.successMessage, children: A.successMessage })
|
|
2912
2973
|
] });
|
|
2913
2974
|
case "redirecting":
|
|
2914
|
-
return /* @__PURE__ */
|
|
2915
|
-
|
|
2916
|
-
/* @__PURE__ */ n("div", { style:
|
|
2975
|
+
return /* @__PURE__ */ l(U, { children: [
|
|
2976
|
+
P.loading,
|
|
2977
|
+
/* @__PURE__ */ n("div", { style: d.message, children: A.redirectingMessage })
|
|
2917
2978
|
] });
|
|
2918
2979
|
case "error":
|
|
2919
|
-
return /* @__PURE__ */
|
|
2920
|
-
|
|
2921
|
-
/* @__PURE__ */ n("div", { style:
|
|
2922
|
-
/* @__PURE__ */
|
|
2980
|
+
return /* @__PURE__ */ l(U, { children: [
|
|
2981
|
+
P.error,
|
|
2982
|
+
/* @__PURE__ */ n("div", { style: d.errorMessage, children: R || A.errorMessage }),
|
|
2983
|
+
/* @__PURE__ */ l("div", { style: d.buttonContainer, children: [
|
|
2923
2984
|
/* @__PURE__ */ n(
|
|
2924
2985
|
"button",
|
|
2925
2986
|
{
|
|
2926
|
-
onClick:
|
|
2927
|
-
style:
|
|
2987
|
+
onClick: G,
|
|
2988
|
+
style: d.retryButton,
|
|
2928
2989
|
onMouseOver: (v) => {
|
|
2929
2990
|
v.currentTarget.style.backgroundColor = "#2563eb";
|
|
2930
2991
|
},
|
|
2931
2992
|
onMouseOut: (v) => {
|
|
2932
2993
|
v.currentTarget.style.backgroundColor = "#3b82f6";
|
|
2933
2994
|
},
|
|
2934
|
-
children:
|
|
2995
|
+
children: A.retryButton
|
|
2935
2996
|
}
|
|
2936
2997
|
),
|
|
2937
2998
|
/* @__PURE__ */ n(
|
|
2938
2999
|
"button",
|
|
2939
3000
|
{
|
|
2940
3001
|
onClick: $,
|
|
2941
|
-
style:
|
|
3002
|
+
style: d.backButton,
|
|
2942
3003
|
onMouseOver: (v) => {
|
|
2943
3004
|
v.currentTarget.style.backgroundColor = "#e5e7eb";
|
|
2944
3005
|
},
|
|
2945
3006
|
onMouseOut: (v) => {
|
|
2946
3007
|
v.currentTarget.style.backgroundColor = "#f3f4f6";
|
|
2947
3008
|
},
|
|
2948
|
-
children:
|
|
3009
|
+
children: A.backToLoginButton
|
|
2949
3010
|
}
|
|
2950
3011
|
)
|
|
2951
3012
|
] })
|
|
@@ -2954,18 +3015,18 @@ function Ut({
|
|
|
2954
3015
|
return null;
|
|
2955
3016
|
}
|
|
2956
3017
|
};
|
|
2957
|
-
return /* @__PURE__ */
|
|
3018
|
+
return /* @__PURE__ */ l("div", { style: d.container, className: b, children: [
|
|
2958
3019
|
/* @__PURE__ */ n("style", { children: `
|
|
2959
3020
|
@keyframes spin {
|
|
2960
3021
|
0% { transform: rotate(0deg); }
|
|
2961
3022
|
100% { transform: rotate(360deg); }
|
|
2962
3023
|
}
|
|
2963
3024
|
` }),
|
|
2964
|
-
/* @__PURE__ */ n("h1", { style:
|
|
2965
|
-
|
|
3025
|
+
/* @__PURE__ */ n("h1", { style: d.title, children: A.title }),
|
|
3026
|
+
_()
|
|
2966
3027
|
] });
|
|
2967
3028
|
}
|
|
2968
|
-
const
|
|
3029
|
+
const St = {
|
|
2969
3030
|
title: "Reset Password",
|
|
2970
3031
|
subtitle: "Enter your email address and we'll send you a link to reset your password.",
|
|
2971
3032
|
emailLabel: "Email",
|
|
@@ -2987,7 +3048,7 @@ const ht = {
|
|
|
2987
3048
|
resetLoadingText: "Resetting...",
|
|
2988
3049
|
resetSuccessMessage: "Password reset successfully!",
|
|
2989
3050
|
passwordMismatchError: "Passwords do not match"
|
|
2990
|
-
},
|
|
3051
|
+
}, vt = {
|
|
2991
3052
|
container: {
|
|
2992
3053
|
maxWidth: "400px",
|
|
2993
3054
|
margin: "0 auto",
|
|
@@ -3079,113 +3140,113 @@ const ht = {
|
|
|
3079
3140
|
cursor: "pointer"
|
|
3080
3141
|
}
|
|
3081
3142
|
};
|
|
3082
|
-
function
|
|
3143
|
+
function Kt({
|
|
3083
3144
|
copy: i = {},
|
|
3084
3145
|
styles: e = {},
|
|
3085
3146
|
mode: t = "request",
|
|
3086
3147
|
token: r = "",
|
|
3087
3148
|
onSuccess: s,
|
|
3088
3149
|
onError: o,
|
|
3089
|
-
onBackToLogin:
|
|
3090
|
-
onModeChange:
|
|
3091
|
-
className:
|
|
3150
|
+
onBackToLogin: p,
|
|
3151
|
+
onModeChange: b,
|
|
3152
|
+
className: k
|
|
3092
3153
|
}) {
|
|
3093
|
-
const [
|
|
3094
|
-
const
|
|
3095
|
-
return
|
|
3096
|
-
},
|
|
3097
|
-
const
|
|
3098
|
-
return
|
|
3099
|
-
},
|
|
3100
|
-
if (
|
|
3101
|
-
if (!(
|
|
3102
|
-
|
|
3154
|
+
const [S, T] = x(""), [m, f] = x(r), [u, y] = x(""), [R, C] = x(""), [q, A] = x(!1), [d, P] = x(""), [E, z] = x(""), [G, $] = x({}), { requestPasswordReset: _, confirmPasswordReset: v } = ae(), { tenant: M } = se(), I = { ...St, ...i }, a = { ...vt, ...e }, L = () => {
|
|
3155
|
+
const H = {};
|
|
3156
|
+
return S.trim() || (H.email = !0), $(H), Object.keys(H).length === 0;
|
|
3157
|
+
}, c = () => {
|
|
3158
|
+
const H = {};
|
|
3159
|
+
return m.trim() || (H.token = !0), u.trim() || (H.newPassword = !0), R.trim() || (H.confirmPassword = !0), $(H), Object.keys(H).length === 0;
|
|
3160
|
+
}, h = async (H) => {
|
|
3161
|
+
if (H.preventDefault(), !!L()) {
|
|
3162
|
+
if (!(M != null && M.id)) {
|
|
3163
|
+
P("Tenant not found");
|
|
3103
3164
|
return;
|
|
3104
3165
|
}
|
|
3105
|
-
|
|
3166
|
+
A(!0), P(""), z("");
|
|
3106
3167
|
try {
|
|
3107
|
-
await
|
|
3108
|
-
} catch (
|
|
3109
|
-
const O =
|
|
3110
|
-
|
|
3168
|
+
await _({ email: S, tenantId: M.id }), z(I.successMessage), s == null || s();
|
|
3169
|
+
} catch (N) {
|
|
3170
|
+
const O = N.message || I.errorMessage;
|
|
3171
|
+
P(O), o == null || o(O);
|
|
3111
3172
|
} finally {
|
|
3112
|
-
|
|
3173
|
+
A(!1);
|
|
3113
3174
|
}
|
|
3114
3175
|
}
|
|
3115
|
-
},
|
|
3116
|
-
if (
|
|
3117
|
-
if (
|
|
3118
|
-
|
|
3176
|
+
}, g = async (H) => {
|
|
3177
|
+
if (H.preventDefault(), !!c()) {
|
|
3178
|
+
if (u !== R) {
|
|
3179
|
+
P(I.passwordMismatchError), $({ confirmPassword: !0 });
|
|
3119
3180
|
return;
|
|
3120
3181
|
}
|
|
3121
|
-
|
|
3182
|
+
A(!0), P(""), z("");
|
|
3122
3183
|
try {
|
|
3123
|
-
await v({ token:
|
|
3124
|
-
} catch (
|
|
3125
|
-
const O =
|
|
3126
|
-
|
|
3184
|
+
await v({ token: m, newPassword: u }), z(I.resetSuccessMessage), s == null || s();
|
|
3185
|
+
} catch (N) {
|
|
3186
|
+
const O = N.message || I.errorMessage;
|
|
3187
|
+
P(O), o == null || o(O);
|
|
3127
3188
|
} finally {
|
|
3128
|
-
|
|
3189
|
+
A(!1);
|
|
3129
3190
|
}
|
|
3130
3191
|
}
|
|
3131
|
-
},
|
|
3132
|
-
...
|
|
3133
|
-
...
|
|
3134
|
-
}),
|
|
3135
|
-
...
|
|
3136
|
-
...
|
|
3192
|
+
}, w = (H) => ({
|
|
3193
|
+
...a.input,
|
|
3194
|
+
...G[H] ? a.inputError : {}
|
|
3195
|
+
}), j = () => ({
|
|
3196
|
+
...a.button,
|
|
3197
|
+
...q ? a.buttonLoading : {}
|
|
3137
3198
|
});
|
|
3138
3199
|
if (t === "reset") {
|
|
3139
|
-
const
|
|
3140
|
-
return /* @__PURE__ */
|
|
3141
|
-
/* @__PURE__ */ n("h2", { style:
|
|
3142
|
-
/* @__PURE__ */ n("p", { style:
|
|
3143
|
-
/* @__PURE__ */
|
|
3144
|
-
/* @__PURE__ */
|
|
3145
|
-
/* @__PURE__ */ n("label", { style:
|
|
3200
|
+
const H = m && u && R;
|
|
3201
|
+
return /* @__PURE__ */ l("div", { className: k, style: a.container, children: [
|
|
3202
|
+
/* @__PURE__ */ n("h2", { style: a.title, children: I.resetTitle }),
|
|
3203
|
+
/* @__PURE__ */ n("p", { style: a.subtitle, children: I.resetSubtitle }),
|
|
3204
|
+
/* @__PURE__ */ l("form", { onSubmit: g, style: a.form, children: [
|
|
3205
|
+
/* @__PURE__ */ l("div", { style: a.fieldGroup, children: [
|
|
3206
|
+
/* @__PURE__ */ n("label", { style: a.label, children: I.tokenLabel }),
|
|
3146
3207
|
/* @__PURE__ */ n(
|
|
3147
3208
|
"input",
|
|
3148
3209
|
{
|
|
3149
3210
|
type: "text",
|
|
3150
|
-
value:
|
|
3151
|
-
onChange: (
|
|
3152
|
-
|
|
3211
|
+
value: m,
|
|
3212
|
+
onChange: (N) => {
|
|
3213
|
+
f(N.target.value), G.token && $((O) => ({ ...O, token: !1 }));
|
|
3153
3214
|
},
|
|
3154
|
-
placeholder:
|
|
3155
|
-
style:
|
|
3156
|
-
disabled:
|
|
3215
|
+
placeholder: I.tokenPlaceholder,
|
|
3216
|
+
style: w("token"),
|
|
3217
|
+
disabled: q
|
|
3157
3218
|
}
|
|
3158
3219
|
)
|
|
3159
3220
|
] }),
|
|
3160
|
-
/* @__PURE__ */
|
|
3161
|
-
/* @__PURE__ */ n("label", { style:
|
|
3221
|
+
/* @__PURE__ */ l("div", { style: a.fieldGroup, children: [
|
|
3222
|
+
/* @__PURE__ */ n("label", { style: a.label, children: I.newPasswordLabel }),
|
|
3162
3223
|
/* @__PURE__ */ n(
|
|
3163
3224
|
"input",
|
|
3164
3225
|
{
|
|
3165
3226
|
type: "password",
|
|
3166
|
-
value:
|
|
3167
|
-
onChange: (
|
|
3168
|
-
|
|
3227
|
+
value: u,
|
|
3228
|
+
onChange: (N) => {
|
|
3229
|
+
y(N.target.value), G.newPassword && $((O) => ({ ...O, newPassword: !1 }));
|
|
3169
3230
|
},
|
|
3170
|
-
placeholder:
|
|
3171
|
-
style:
|
|
3172
|
-
disabled:
|
|
3231
|
+
placeholder: I.newPasswordPlaceholder,
|
|
3232
|
+
style: w("newPassword"),
|
|
3233
|
+
disabled: q
|
|
3173
3234
|
}
|
|
3174
3235
|
)
|
|
3175
3236
|
] }),
|
|
3176
|
-
/* @__PURE__ */
|
|
3177
|
-
/* @__PURE__ */ n("label", { style:
|
|
3237
|
+
/* @__PURE__ */ l("div", { style: a.fieldGroup, children: [
|
|
3238
|
+
/* @__PURE__ */ n("label", { style: a.label, children: I.confirmPasswordLabel }),
|
|
3178
3239
|
/* @__PURE__ */ n(
|
|
3179
3240
|
"input",
|
|
3180
3241
|
{
|
|
3181
3242
|
type: "password",
|
|
3182
3243
|
value: R,
|
|
3183
|
-
onChange: (
|
|
3184
|
-
C(
|
|
3244
|
+
onChange: (N) => {
|
|
3245
|
+
C(N.target.value), G.confirmPassword && $((O) => ({ ...O, confirmPassword: !1 })), d === I.passwordMismatchError && P("");
|
|
3185
3246
|
},
|
|
3186
|
-
placeholder:
|
|
3187
|
-
style:
|
|
3188
|
-
disabled:
|
|
3247
|
+
placeholder: I.confirmPasswordPlaceholder,
|
|
3248
|
+
style: w("confirmPassword"),
|
|
3249
|
+
disabled: q
|
|
3189
3250
|
}
|
|
3190
3251
|
)
|
|
3191
3252
|
] }),
|
|
@@ -3193,44 +3254,44 @@ function qt({
|
|
|
3193
3254
|
"button",
|
|
3194
3255
|
{
|
|
3195
3256
|
type: "submit",
|
|
3196
|
-
disabled: !
|
|
3257
|
+
disabled: !H || q,
|
|
3197
3258
|
style: {
|
|
3198
|
-
...
|
|
3199
|
-
...!
|
|
3259
|
+
...j(),
|
|
3260
|
+
...!H || q ? a.buttonDisabled : {}
|
|
3200
3261
|
},
|
|
3201
|
-
children:
|
|
3262
|
+
children: q ? I.resetLoadingText : I.resetSubmitButton
|
|
3202
3263
|
}
|
|
3203
3264
|
),
|
|
3204
|
-
|
|
3205
|
-
E && /* @__PURE__ */ n("div", { style:
|
|
3265
|
+
d && /* @__PURE__ */ n("div", { style: a.errorText, children: d }),
|
|
3266
|
+
E && /* @__PURE__ */ n("div", { style: a.successText, children: E })
|
|
3206
3267
|
] }),
|
|
3207
|
-
/* @__PURE__ */
|
|
3208
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
3209
|
-
|
|
3268
|
+
/* @__PURE__ */ l("div", { style: a.linkContainer, children: [
|
|
3269
|
+
/* @__PURE__ */ n("a", { onClick: p, style: a.link, children: I.backToLoginLink }),
|
|
3270
|
+
b && /* @__PURE__ */ l(U, { children: [
|
|
3210
3271
|
/* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3211
|
-
/* @__PURE__ */ n("a", { onClick: () =>
|
|
3272
|
+
/* @__PURE__ */ n("a", { onClick: () => b("request"), style: a.link, children: "Request New Link" })
|
|
3212
3273
|
] })
|
|
3213
3274
|
] })
|
|
3214
3275
|
] });
|
|
3215
3276
|
}
|
|
3216
|
-
const
|
|
3217
|
-
return /* @__PURE__ */
|
|
3218
|
-
/* @__PURE__ */ n("h2", { style:
|
|
3219
|
-
/* @__PURE__ */ n("p", { style:
|
|
3220
|
-
/* @__PURE__ */
|
|
3221
|
-
/* @__PURE__ */
|
|
3222
|
-
/* @__PURE__ */ n("label", { style:
|
|
3277
|
+
const Y = S;
|
|
3278
|
+
return /* @__PURE__ */ l("div", { className: k, style: a.container, children: [
|
|
3279
|
+
/* @__PURE__ */ n("h2", { style: a.title, children: I.title }),
|
|
3280
|
+
/* @__PURE__ */ n("p", { style: a.subtitle, children: I.subtitle }),
|
|
3281
|
+
/* @__PURE__ */ l("form", { onSubmit: h, style: a.form, children: [
|
|
3282
|
+
/* @__PURE__ */ l("div", { style: a.fieldGroup, children: [
|
|
3283
|
+
/* @__PURE__ */ n("label", { style: a.label, children: I.emailLabel }),
|
|
3223
3284
|
/* @__PURE__ */ n(
|
|
3224
3285
|
"input",
|
|
3225
3286
|
{
|
|
3226
3287
|
type: "email",
|
|
3227
|
-
value:
|
|
3228
|
-
onChange: (
|
|
3229
|
-
T(
|
|
3288
|
+
value: S,
|
|
3289
|
+
onChange: (H) => {
|
|
3290
|
+
T(H.target.value), G.email && $((N) => ({ ...N, email: !1 }));
|
|
3230
3291
|
},
|
|
3231
|
-
placeholder:
|
|
3232
|
-
style:
|
|
3233
|
-
disabled:
|
|
3292
|
+
placeholder: I.emailPlaceholder,
|
|
3293
|
+
style: w("email"),
|
|
3294
|
+
disabled: q
|
|
3234
3295
|
}
|
|
3235
3296
|
)
|
|
3236
3297
|
] }),
|
|
@@ -3238,27 +3299,27 @@ function qt({
|
|
|
3238
3299
|
"button",
|
|
3239
3300
|
{
|
|
3240
3301
|
type: "submit",
|
|
3241
|
-
disabled: !
|
|
3302
|
+
disabled: !Y || q,
|
|
3242
3303
|
style: {
|
|
3243
|
-
...
|
|
3244
|
-
...!
|
|
3304
|
+
...j(),
|
|
3305
|
+
...!Y || q ? a.buttonDisabled : {}
|
|
3245
3306
|
},
|
|
3246
|
-
children:
|
|
3307
|
+
children: q ? I.loadingText : I.submitButton
|
|
3247
3308
|
}
|
|
3248
3309
|
),
|
|
3249
|
-
|
|
3250
|
-
E && /* @__PURE__ */ n("div", { style:
|
|
3310
|
+
d && /* @__PURE__ */ n("div", { style: a.errorText, children: d }),
|
|
3311
|
+
E && /* @__PURE__ */ n("div", { style: a.successText, children: E })
|
|
3251
3312
|
] }),
|
|
3252
|
-
/* @__PURE__ */
|
|
3253
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
3254
|
-
|
|
3313
|
+
/* @__PURE__ */ l("div", { style: a.linkContainer, children: [
|
|
3314
|
+
/* @__PURE__ */ n("a", { onClick: p, style: a.link, children: I.backToLoginLink }),
|
|
3315
|
+
b && /* @__PURE__ */ l(U, { children: [
|
|
3255
3316
|
/* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3256
|
-
/* @__PURE__ */ n("a", { onClick: () =>
|
|
3317
|
+
/* @__PURE__ */ n("a", { onClick: () => b("reset"), style: a.link, children: "I have a token" })
|
|
3257
3318
|
] })
|
|
3258
3319
|
] })
|
|
3259
3320
|
] });
|
|
3260
3321
|
}
|
|
3261
|
-
const
|
|
3322
|
+
const xt = () => /* @__PURE__ */ n(
|
|
3262
3323
|
"div",
|
|
3263
3324
|
{
|
|
3264
3325
|
style: {
|
|
@@ -3270,7 +3331,7 @@ const pt = () => /* @__PURE__ */ n(
|
|
|
3270
3331
|
},
|
|
3271
3332
|
children: /* @__PURE__ */ n("div", { children: "Loading..." })
|
|
3272
3333
|
}
|
|
3273
|
-
),
|
|
3334
|
+
), kt = ({ error: i, retry: e }) => /* @__PURE__ */ l(
|
|
3274
3335
|
"div",
|
|
3275
3336
|
{
|
|
3276
3337
|
style: {
|
|
@@ -3304,40 +3365,40 @@ const pt = () => /* @__PURE__ */ n(
|
|
|
3304
3365
|
]
|
|
3305
3366
|
}
|
|
3306
3367
|
);
|
|
3307
|
-
function
|
|
3368
|
+
function Jt({
|
|
3308
3369
|
children: i,
|
|
3309
3370
|
loadingFallback: e,
|
|
3310
3371
|
errorFallback: t,
|
|
3311
3372
|
requireTenant: r = !0
|
|
3312
3373
|
}) {
|
|
3313
|
-
const { isAppLoading: s, appError: o, retryApp:
|
|
3314
|
-
}),
|
|
3315
|
-
o &&
|
|
3374
|
+
const { isAppLoading: s, appError: o, retryApp: p } = oe(), b = Me(), k = (b == null ? void 0 : b.isTenantLoading) ?? !1, S = (b == null ? void 0 : b.tenantError) ?? null, T = (b == null ? void 0 : b.tenantSlug) ?? null, m = (b == null ? void 0 : b.retryTenant) ?? (() => {
|
|
3375
|
+
}), f = r && b && T, u = s || f && k, y = o || (f ? S : null), R = () => {
|
|
3376
|
+
o && p(), S && b && m();
|
|
3316
3377
|
};
|
|
3317
|
-
if (
|
|
3318
|
-
return /* @__PURE__ */ n(
|
|
3319
|
-
if (
|
|
3320
|
-
const C = typeof t == "function" ? t(
|
|
3321
|
-
return /* @__PURE__ */ n(
|
|
3378
|
+
if (u)
|
|
3379
|
+
return /* @__PURE__ */ n(U, { children: e || /* @__PURE__ */ n(xt, {}) });
|
|
3380
|
+
if (y) {
|
|
3381
|
+
const C = typeof t == "function" ? t(y, R) : t || /* @__PURE__ */ n(kt, { error: y, retry: R });
|
|
3382
|
+
return /* @__PURE__ */ n(U, { children: C });
|
|
3322
3383
|
}
|
|
3323
|
-
return /* @__PURE__ */ n(
|
|
3384
|
+
return /* @__PURE__ */ n(U, { children: i });
|
|
3324
3385
|
}
|
|
3325
|
-
function
|
|
3326
|
-
const { isAppLoading: e, appError: t, retryApp: r, appInfo: s } = oe(), o =
|
|
3327
|
-
}),
|
|
3386
|
+
function Yt(i = !0) {
|
|
3387
|
+
const { isAppLoading: e, appError: t, retryApp: r, appInfo: s } = oe(), o = Me(), p = (o == null ? void 0 : o.isTenantLoading) ?? !1, b = (o == null ? void 0 : o.tenantError) ?? null, k = (o == null ? void 0 : o.tenant) ?? null, S = (o == null ? void 0 : o.tenantSlug) ?? null, T = (o == null ? void 0 : o.retryTenant) ?? (() => {
|
|
3388
|
+
}), m = i && o && S, f = e || m && p, u = t || (m ? b : null);
|
|
3328
3389
|
return {
|
|
3329
|
-
isLoading:
|
|
3330
|
-
error:
|
|
3331
|
-
isReady: !
|
|
3390
|
+
isLoading: f,
|
|
3391
|
+
error: u,
|
|
3392
|
+
isReady: !f && !u && s !== null && (!m || k !== null),
|
|
3332
3393
|
retry: () => {
|
|
3333
|
-
t && r(),
|
|
3394
|
+
t && r(), b && o && T();
|
|
3334
3395
|
},
|
|
3335
3396
|
// Individual states
|
|
3336
3397
|
app: { isLoading: e, error: t, data: s },
|
|
3337
|
-
tenant: o ? { isLoading:
|
|
3398
|
+
tenant: o ? { isLoading: p, error: b, data: k } : null
|
|
3338
3399
|
};
|
|
3339
3400
|
}
|
|
3340
|
-
class
|
|
3401
|
+
class Qt {
|
|
3341
3402
|
constructor(e, t) {
|
|
3342
3403
|
this.httpService = e, this.sessionManager = t;
|
|
3343
3404
|
}
|
|
@@ -3405,7 +3466,7 @@ class Wt {
|
|
|
3405
3466
|
};
|
|
3406
3467
|
}
|
|
3407
3468
|
}
|
|
3408
|
-
class
|
|
3469
|
+
class Xt {
|
|
3409
3470
|
constructor(e, t) {
|
|
3410
3471
|
this.httpService = e, this.sessionManager = t;
|
|
3411
3472
|
}
|
|
@@ -3456,7 +3517,7 @@ class jt {
|
|
|
3456
3517
|
});
|
|
3457
3518
|
}
|
|
3458
3519
|
}
|
|
3459
|
-
class
|
|
3520
|
+
class Zt {
|
|
3460
3521
|
constructor(e) {
|
|
3461
3522
|
this.httpService = e;
|
|
3462
3523
|
}
|
|
@@ -3465,7 +3526,7 @@ class Vt {
|
|
|
3465
3526
|
return await this.httpService.get("/health");
|
|
3466
3527
|
}
|
|
3467
3528
|
}
|
|
3468
|
-
class
|
|
3529
|
+
class er {
|
|
3469
3530
|
// Date string to Date object
|
|
3470
3531
|
static toDate(e) {
|
|
3471
3532
|
return new Date(e);
|
|
@@ -3588,47 +3649,47 @@ class Gt {
|
|
|
3588
3649
|
}
|
|
3589
3650
|
}
|
|
3590
3651
|
export {
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3652
|
+
er as ApiMappers,
|
|
3653
|
+
ve as AppApiService,
|
|
3654
|
+
Jt as AppLoader,
|
|
3655
|
+
Et as AppProvider,
|
|
3656
|
+
Ue as AuthApiService,
|
|
3657
|
+
Dt as AuthProvider,
|
|
3658
|
+
Wt as FeatureFlag,
|
|
3659
|
+
Je as FeatureFlagApiService,
|
|
3660
|
+
Ht as FeatureFlagProvider,
|
|
3661
|
+
Zt as HealthApiService,
|
|
3601
3662
|
re as HttpService,
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3663
|
+
zt as LandingRoute,
|
|
3664
|
+
jt as LoginForm,
|
|
3665
|
+
_t as MagicLinkForm,
|
|
3666
|
+
Gt as MagicLinkVerify,
|
|
3667
|
+
Kt as PasswordRecoveryForm,
|
|
3668
|
+
Qt as PermissionApiService,
|
|
3669
|
+
Bt as Protected,
|
|
3670
|
+
Ut as ProtectedRoute,
|
|
3671
|
+
xe as RoleApiService,
|
|
3672
|
+
we as SessionManager,
|
|
3673
|
+
Vt as SignupForm,
|
|
3674
|
+
Qe as SubscriptionApiService,
|
|
3675
|
+
Ot as SubscriptionGuard,
|
|
3676
|
+
Xt as SubscriptionPlanApiService,
|
|
3677
|
+
Nt as SubscriptionProvider,
|
|
3617
3678
|
ue as TenantApiService,
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3679
|
+
Ct as TenantProvider,
|
|
3680
|
+
qt as TenantRoute,
|
|
3681
|
+
qe as UserApiService,
|
|
3621
3682
|
ie as UserType,
|
|
3622
|
-
|
|
3683
|
+
Rt as useApi,
|
|
3623
3684
|
oe as useApp,
|
|
3624
|
-
|
|
3685
|
+
Yt as useAppLoaderState,
|
|
3625
3686
|
ae as useAuth,
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3687
|
+
Ye as useFeatureFlags,
|
|
3688
|
+
Ft as useSettings,
|
|
3689
|
+
Xe as useSubscription,
|
|
3690
|
+
me as useTenant,
|
|
3630
3691
|
se as useTenantInfo,
|
|
3631
|
-
|
|
3632
|
-
|
|
3692
|
+
Me as useTenantOptional,
|
|
3693
|
+
$t as useTenantSettings
|
|
3633
3694
|
};
|
|
3634
3695
|
//# sourceMappingURL=index.es.js.map
|