@skylabs-digital/react-identity-access 2.2.0 → 2.4.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 +1084 -991
- 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/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as n, Fragment as B, jsxs as
|
|
2
|
-
import { createContext as he, useMemo as
|
|
3
|
-
import { useLocation as
|
|
1
|
+
import { jsx as n, Fragment as B, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as he, useMemo as X, useState as v, useCallback as ne, useEffect as te, useContext as ce, useRef as qe } 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 g = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`,
|
|
20
|
-
let
|
|
19
|
+
const g = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, w = (s == null ? void 0 : s.timeout) || this.timeout;
|
|
20
|
+
let x = {
|
|
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
|
+
x = { ...x, ...m };
|
|
28
|
+
} catch (m) {
|
|
29
|
+
console.warn("Failed to inject auth headers:", m);
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const b = new AbortController(), A = setTimeout(() => b.abort(), w);
|
|
32
32
|
try {
|
|
33
|
-
const
|
|
33
|
+
const m = await fetch(g, {
|
|
34
34
|
method: e,
|
|
35
|
-
headers:
|
|
35
|
+
headers: x,
|
|
36
36
|
body: r ? JSON.stringify(r) : void 0,
|
|
37
|
-
signal:
|
|
37
|
+
signal: b.signal
|
|
38
38
|
});
|
|
39
|
-
if (clearTimeout(
|
|
39
|
+
if (clearTimeout(A), 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(
|
|
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(A), m instanceof Error && m.name === "AbortError" ? new Error(`Request timeout after ${w}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,32 +124,32 @@ class Se {
|
|
|
124
124
|
})).data;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
const
|
|
128
|
-
function
|
|
129
|
-
const t =
|
|
127
|
+
const Pe = he(null);
|
|
128
|
+
function Ct({ 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] = v(() => {
|
|
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, g] =
|
|
151
|
-
const
|
|
152
|
-
|
|
150
|
+
}), [o, g] = v(!r), [w, x] = v(null), b = X(() => {
|
|
151
|
+
const f = () => {
|
|
152
|
+
A();
|
|
153
153
|
};
|
|
154
154
|
return {
|
|
155
155
|
appId: i.appId,
|
|
@@ -157,19 +157,19 @@ function kt({ config: i, children: e }) {
|
|
|
157
157
|
// App info
|
|
158
158
|
appInfo: r,
|
|
159
159
|
isAppLoading: o,
|
|
160
|
-
appError:
|
|
161
|
-
retryApp:
|
|
160
|
+
appError: w,
|
|
161
|
+
retryApp: f
|
|
162
162
|
};
|
|
163
|
-
}, [i, r, o,
|
|
164
|
-
async (
|
|
165
|
-
if (!(!
|
|
163
|
+
}, [i, r, o, w]), A = ne(
|
|
164
|
+
async (f = !1) => {
|
|
165
|
+
if (!(!f && t.enabled && r))
|
|
166
166
|
try {
|
|
167
|
-
g(!0),
|
|
168
|
-
const
|
|
169
|
-
if (s(
|
|
167
|
+
g(!0), x(null);
|
|
168
|
+
const u = new re(i.baseUrl), E = await new ve(u, {}).getPublicAppInfo(i.appId);
|
|
169
|
+
if (s(E), t.enabled)
|
|
170
170
|
try {
|
|
171
171
|
const C = {
|
|
172
|
-
data:
|
|
172
|
+
data: E,
|
|
173
173
|
timestamp: Date.now(),
|
|
174
174
|
appId: i.appId
|
|
175
175
|
};
|
|
@@ -177,46 +177,46 @@ function kt({ 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
|
+
x(y), s(null);
|
|
183
183
|
} finally {
|
|
184
184
|
g(!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
|
|
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 E = new re(i.baseUrl), q = await new ve(E, {}).getPublicAppInfo(i.appId);
|
|
196
|
+
s(q);
|
|
197
|
+
const T = {
|
|
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(T));
|
|
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() : A();
|
|
210
|
+
}, []), /* @__PURE__ */ n(Pe.Provider, { value: b, 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 $t = 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 ze {
|
|
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
|
}
|
|
@@ -490,7 +490,7 @@ class ve {
|
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
class
|
|
493
|
+
class Oe {
|
|
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 We(i, e) {
|
|
612
612
|
if (i === "localhost" || i.startsWith("127.") || i.startsWith("192.168."))
|
|
613
613
|
return null;
|
|
614
614
|
if (e) {
|
|
@@ -624,23 +624,64 @@ function Be(i, e) {
|
|
|
624
624
|
const r = i.split(".");
|
|
625
625
|
return r.length >= 3 && r[0] !== "www" ? r[0] : null;
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function Ve(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 je(i, e, t) {
|
|
632
632
|
const { tenantMode: r, baseDomain: s, selectorParam: o } = i;
|
|
633
|
-
return r === "subdomain" ?
|
|
633
|
+
return r === "subdomain" ? We(e.hostname, s) : r === "selector" ? Ve(e.search, o, t) : null;
|
|
634
634
|
}
|
|
635
|
-
function
|
|
635
|
+
function _e(i, e, t) {
|
|
636
636
|
if (t)
|
|
637
637
|
return `${i}.${t}`;
|
|
638
638
|
const r = e.split(".");
|
|
639
639
|
return r.length === 2 ? `${i}.${e}` : r.length >= 3 ? (r[0] = i, r.join(".")) : null;
|
|
640
640
|
}
|
|
641
|
-
const
|
|
642
|
-
function
|
|
643
|
-
const
|
|
641
|
+
const fe = "_auth";
|
|
642
|
+
function Ge(i) {
|
|
643
|
+
const e = JSON.stringify(i);
|
|
644
|
+
return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
645
|
+
}
|
|
646
|
+
function Ke(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 Je() {
|
|
658
|
+
if (typeof window > "u")
|
|
659
|
+
return console.log("[CrossDomainAuth] SSR environment, skipping URL token extraction"), null;
|
|
660
|
+
const e = new URLSearchParams(window.location.search).get(fe);
|
|
661
|
+
if (console.log("[CrossDomainAuth] extractAuthTokensFromUrl called", {
|
|
662
|
+
hasAuthParam: !!e,
|
|
663
|
+
searchParams: window.location.search,
|
|
664
|
+
encodedLength: e == null ? void 0 : e.length
|
|
665
|
+
}), !e) return null;
|
|
666
|
+
const t = Ke(e);
|
|
667
|
+
return console.log("[CrossDomainAuth] Token decode result:", {
|
|
668
|
+
success: !!t,
|
|
669
|
+
hasAccessToken: !!(t != null && t.accessToken),
|
|
670
|
+
hasRefreshToken: !!(t != null && t.refreshToken),
|
|
671
|
+
expiresIn: t == null ? void 0 : t.expiresIn
|
|
672
|
+
}), t;
|
|
673
|
+
}
|
|
674
|
+
function Ye() {
|
|
675
|
+
if (typeof window > "u") return;
|
|
676
|
+
const i = new URL(window.location.href);
|
|
677
|
+
i.searchParams.delete(fe), console.log("[CrossDomainAuth] Clearing auth tokens from URL", {
|
|
678
|
+
oldUrl: window.location.href,
|
|
679
|
+
newUrl: i.toString()
|
|
680
|
+
}), window.history.replaceState({}, "", i.toString());
|
|
681
|
+
}
|
|
682
|
+
const Se = he(null);
|
|
683
|
+
function Dt({ config: i, children: e }) {
|
|
684
|
+
const { baseUrl: t, appInfo: r, appId: s } = oe(), o = ne(() => typeof window > "u" ? null : je(
|
|
644
685
|
{
|
|
645
686
|
tenantMode: i.tenantMode || "selector",
|
|
646
687
|
baseDomain: i.baseDomain,
|
|
@@ -651,118 +692,118 @@ function Tt({ config: i, children: e }) {
|
|
|
651
692
|
search: window.location.search
|
|
652
693
|
},
|
|
653
694
|
window.localStorage
|
|
654
|
-
), [i.tenantMode, i.baseDomain, i.selectorParam]), [g,
|
|
695
|
+
), [i.tenantMode, i.baseDomain, i.selectorParam]), [g, w] = v(() => o()), x = X(
|
|
655
696
|
() => {
|
|
656
|
-
var l,
|
|
697
|
+
var l, I, k;
|
|
657
698
|
return {
|
|
658
699
|
enabled: ((l = i.cache) == null ? void 0 : l.enabled) ?? !0,
|
|
659
|
-
ttl: ((
|
|
700
|
+
ttl: ((I = i.cache) == null ? void 0 : I.ttl) ?? 5 * 60 * 1e3,
|
|
660
701
|
// 5 minutes default
|
|
661
|
-
storageKey: ((
|
|
702
|
+
storageKey: ((k = i.cache) == null ? void 0 : k.storageKey) ?? `tenant_cache_${g || "default"}`
|
|
662
703
|
};
|
|
663
704
|
},
|
|
664
705
|
[i.cache, g]
|
|
665
|
-
), [
|
|
706
|
+
), [b, A] = v(() => {
|
|
666
707
|
if (i.initialTenant) return i.initialTenant;
|
|
667
|
-
if (!
|
|
708
|
+
if (!x.enabled || !g) return null;
|
|
668
709
|
try {
|
|
669
|
-
const l = localStorage.getItem(
|
|
710
|
+
const l = localStorage.getItem(x.storageKey);
|
|
670
711
|
if (!l) return null;
|
|
671
|
-
const
|
|
672
|
-
return Date.now() -
|
|
712
|
+
const I = JSON.parse(l);
|
|
713
|
+
return Date.now() - I.timestamp < x.ttl && I.tenantSlug === g ? I.data : (localStorage.removeItem(x.storageKey), null);
|
|
673
714
|
} catch {
|
|
674
715
|
return null;
|
|
675
716
|
}
|
|
676
|
-
}), [
|
|
717
|
+
}), [m, f] = v(!b && !i.initialTenant), [u, y] = v(null), [E, C] = v(null), [q, T] = v(!1), [d, P] = v(null);
|
|
677
718
|
te(() => {
|
|
678
719
|
const l = o();
|
|
679
|
-
|
|
720
|
+
w(l);
|
|
680
721
|
}, [o]);
|
|
681
|
-
const
|
|
682
|
-
async (l,
|
|
683
|
-
if (!(!
|
|
722
|
+
const R = (r == null ? void 0 : r.settingsSchema) || null, z = ne(
|
|
723
|
+
async (l, I = !1) => {
|
|
724
|
+
if (!(!I && x.enabled && b && b.domain === l))
|
|
684
725
|
try {
|
|
685
|
-
|
|
686
|
-
const
|
|
687
|
-
if (
|
|
726
|
+
f(!0), y(null);
|
|
727
|
+
const k = new re(t), a = await new ue(k, s).getPublicTenantInfo(l);
|
|
728
|
+
if (A(a), x.enabled)
|
|
688
729
|
try {
|
|
689
|
-
const
|
|
690
|
-
data:
|
|
730
|
+
const p = {
|
|
731
|
+
data: a,
|
|
691
732
|
timestamp: Date.now(),
|
|
692
733
|
tenantSlug: l
|
|
693
734
|
};
|
|
694
|
-
localStorage.setItem(
|
|
695
|
-
} catch (
|
|
696
|
-
console.warn("Failed to cache tenant info:",
|
|
735
|
+
localStorage.setItem(x.storageKey, JSON.stringify(p));
|
|
736
|
+
} catch (p) {
|
|
737
|
+
console.warn("Failed to cache tenant info:", p);
|
|
697
738
|
}
|
|
698
|
-
} catch (
|
|
699
|
-
const
|
|
700
|
-
|
|
739
|
+
} catch (k) {
|
|
740
|
+
const h = k instanceof Error ? k : new Error("Failed to load tenant information");
|
|
741
|
+
y(h), A(null);
|
|
701
742
|
} finally {
|
|
702
|
-
|
|
743
|
+
f(!1);
|
|
703
744
|
}
|
|
704
745
|
},
|
|
705
|
-
[t, s,
|
|
706
|
-
),
|
|
707
|
-
if (!(!
|
|
746
|
+
[t, s, x, b]
|
|
747
|
+
), G = ne(async () => {
|
|
748
|
+
if (!(!x.enabled || !b || !g))
|
|
708
749
|
try {
|
|
709
|
-
const l = localStorage.getItem(
|
|
750
|
+
const l = localStorage.getItem(x.storageKey);
|
|
710
751
|
if (!l) return;
|
|
711
|
-
const
|
|
712
|
-
if (Date.now() -
|
|
713
|
-
const
|
|
714
|
-
|
|
715
|
-
const
|
|
716
|
-
data:
|
|
752
|
+
const I = JSON.parse(l);
|
|
753
|
+
if (Date.now() - I.timestamp > x.ttl * 0.5) {
|
|
754
|
+
const h = new re(t), p = await new ue(h, s).getPublicTenantInfo(g);
|
|
755
|
+
A(p);
|
|
756
|
+
const O = {
|
|
757
|
+
data: p,
|
|
717
758
|
timestamp: Date.now(),
|
|
718
759
|
tenantSlug: g
|
|
719
760
|
};
|
|
720
|
-
localStorage.setItem(
|
|
761
|
+
localStorage.setItem(x.storageKey, JSON.stringify(O));
|
|
721
762
|
}
|
|
722
763
|
} catch (l) {
|
|
723
764
|
console.warn("Background tenant refresh failed:", l);
|
|
724
765
|
}
|
|
725
|
-
}, [t, s,
|
|
726
|
-
if (
|
|
766
|
+
}, [t, s, x, b, g]), $ = ne(async () => {
|
|
767
|
+
if (b != null && b.id)
|
|
727
768
|
try {
|
|
728
|
-
|
|
729
|
-
const l = new re(t),
|
|
730
|
-
C(
|
|
769
|
+
T(!0), P(null);
|
|
770
|
+
const l = new re(t), k = await new ue(l, b.appId).getTenantSettings(b.id);
|
|
771
|
+
C(k);
|
|
731
772
|
} catch (l) {
|
|
732
|
-
const
|
|
733
|
-
|
|
773
|
+
const I = l instanceof Error ? l : new Error("Failed to load tenant settings");
|
|
774
|
+
P(I), C(null);
|
|
734
775
|
} finally {
|
|
735
|
-
|
|
776
|
+
T(!1);
|
|
736
777
|
}
|
|
737
|
-
}, [t,
|
|
778
|
+
}, [t, b]), _ = ne(() => {
|
|
738
779
|
$();
|
|
739
|
-
}, [$]),
|
|
780
|
+
}, [$]), S = ne(
|
|
740
781
|
(l) => {
|
|
741
|
-
if (!
|
|
782
|
+
if (!R)
|
|
742
783
|
return { isValid: !0, errors: [] };
|
|
743
|
-
const
|
|
784
|
+
const I = [];
|
|
744
785
|
try {
|
|
745
|
-
return
|
|
746
|
-
var
|
|
747
|
-
const
|
|
748
|
-
if ((
|
|
749
|
-
|
|
786
|
+
return R.properties && Object.entries(R.properties).forEach(([k, h]) => {
|
|
787
|
+
var p;
|
|
788
|
+
const a = l[k];
|
|
789
|
+
if ((p = R.required) != null && p.includes(k) && a == null) {
|
|
790
|
+
I.push(`Field '${k}' is required`);
|
|
750
791
|
return;
|
|
751
792
|
}
|
|
752
|
-
if (
|
|
753
|
-
if (
|
|
754
|
-
const
|
|
755
|
-
|
|
793
|
+
if (a != null) {
|
|
794
|
+
if (h.type) {
|
|
795
|
+
const O = h.type, K = typeof a;
|
|
796
|
+
O === "string" && K !== "string" ? I.push(`Field '${k}' must be a string`) : (O === "number" || O === "integer") && K !== "number" ? I.push(`Field '${k}' must be a number`) : O === "boolean" && K !== "boolean" ? I.push(`Field '${k}' must be a boolean`) : O === "array" && !Array.isArray(a) && I.push(`Field '${k}' must be an array`);
|
|
756
797
|
}
|
|
757
|
-
|
|
758
|
-
`Field '${
|
|
759
|
-
),
|
|
760
|
-
`Field '${
|
|
761
|
-
),
|
|
798
|
+
h.minLength !== void 0 && typeof a == "string" && a.length < h.minLength && I.push(
|
|
799
|
+
`Field '${k}' must be at least ${h.minLength} characters long`
|
|
800
|
+
), h.maxLength !== void 0 && typeof a == "string" && a.length > h.maxLength && I.push(
|
|
801
|
+
`Field '${k}' must be no more than ${h.maxLength} characters long`
|
|
802
|
+
), h.minimum !== void 0 && typeof a == "number" && a < h.minimum && I.push(`Field '${k}' must be at least ${h.minimum}`), h.maximum !== void 0 && typeof a == "number" && a > h.maximum && I.push(`Field '${k}' must be no more than ${h.maximum}`), h.pattern && typeof a == "string" && (new RegExp(h.pattern).test(a) || I.push(`Field '${k}' does not match the required pattern`)), h.enum && !h.enum.includes(a) && I.push(`Field '${k}' must be one of: ${h.enum.join(", ")}`);
|
|
762
803
|
}
|
|
763
804
|
}), {
|
|
764
|
-
isValid:
|
|
765
|
-
errors:
|
|
805
|
+
isValid: I.length === 0,
|
|
806
|
+
errors: I
|
|
766
807
|
};
|
|
767
808
|
} catch {
|
|
768
809
|
return {
|
|
@@ -771,89 +812,91 @@ function Tt({ config: i, children: e }) {
|
|
|
771
812
|
};
|
|
772
813
|
}
|
|
773
814
|
},
|
|
774
|
-
[
|
|
815
|
+
[R]
|
|
775
816
|
);
|
|
776
817
|
te(() => {
|
|
777
|
-
!i.initialTenant && g ?
|
|
778
|
-
}, [i.initialTenant, g,
|
|
779
|
-
|
|
780
|
-
}, [
|
|
781
|
-
const
|
|
782
|
-
(l,
|
|
783
|
-
const
|
|
784
|
-
if (localStorage.setItem("tenant", l),
|
|
785
|
-
const
|
|
818
|
+
!i.initialTenant && g ? b ? G() : z(g) : !i.initialTenant && !g && (A(null), y(null), f(!1));
|
|
819
|
+
}, [i.initialTenant, g, b, z, G]), te(() => {
|
|
820
|
+
b != null && b.id ? $() : (C(null), P(null), T(!1));
|
|
821
|
+
}, [b == null ? void 0 : b.id, $]);
|
|
822
|
+
const M = ne(
|
|
823
|
+
(l, I) => {
|
|
824
|
+
const { mode: k = "reload", tokens: h, redirectPath: a } = I || {}, p = i.tenantMode || "selector";
|
|
825
|
+
if (localStorage.setItem("tenant", l), p === "subdomain") {
|
|
826
|
+
const O = window.location.hostname, K = _e(
|
|
786
827
|
l,
|
|
787
|
-
|
|
828
|
+
O,
|
|
788
829
|
i.baseDomain
|
|
789
830
|
);
|
|
790
|
-
if (!
|
|
831
|
+
if (!K) {
|
|
791
832
|
console.warn(
|
|
792
833
|
"[TenantProvider] Cannot switch subdomain, invalid hostname:",
|
|
793
|
-
|
|
834
|
+
O
|
|
794
835
|
);
|
|
795
836
|
return;
|
|
796
837
|
}
|
|
797
|
-
const
|
|
798
|
-
window.location.
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
838
|
+
const H = a || window.location.pathname, N = new URL(`${window.location.protocol}//${K}${H}`);
|
|
839
|
+
new URLSearchParams(window.location.search).forEach((D, J) => {
|
|
840
|
+
J !== fe && N.searchParams.set(J, D);
|
|
841
|
+
}), h && N.searchParams.set(fe, Ge(h)), window.location.href = N.toString();
|
|
842
|
+
} else if (p === "selector") {
|
|
843
|
+
const O = a || window.location.pathname, K = new URLSearchParams(window.location.search);
|
|
844
|
+
if (K.set(i.selectorParam || "tenant", l), k === "reload") {
|
|
845
|
+
const H = `${O}?${K.toString()}${window.location.hash}`;
|
|
846
|
+
window.location.href = H;
|
|
804
847
|
} else {
|
|
805
|
-
const
|
|
806
|
-
window.history.pushState({}, "",
|
|
848
|
+
const H = `${O}?${K.toString()}${window.location.hash}`;
|
|
849
|
+
window.history.pushState({}, "", H), w(l), z(l);
|
|
807
850
|
}
|
|
808
851
|
}
|
|
809
852
|
},
|
|
810
|
-
[i.tenantMode, i.selectorParam,
|
|
811
|
-
), L =
|
|
853
|
+
[i.tenantMode, i.selectorParam, i.baseDomain, z]
|
|
854
|
+
), L = X(() => ({
|
|
812
855
|
// Tenant info
|
|
813
|
-
tenant:
|
|
856
|
+
tenant: b,
|
|
814
857
|
tenantSlug: g,
|
|
815
|
-
isTenantLoading:
|
|
816
|
-
tenantError:
|
|
858
|
+
isTenantLoading: m,
|
|
859
|
+
tenantError: u,
|
|
817
860
|
retryTenant: () => {
|
|
818
|
-
g &&
|
|
861
|
+
g && z(g);
|
|
819
862
|
},
|
|
820
863
|
// Settings
|
|
821
|
-
settings:
|
|
822
|
-
settingsSchema:
|
|
823
|
-
isSettingsLoading:
|
|
824
|
-
settingsError:
|
|
864
|
+
settings: E,
|
|
865
|
+
settingsSchema: R,
|
|
866
|
+
isSettingsLoading: q,
|
|
867
|
+
settingsError: d,
|
|
825
868
|
// Actions
|
|
826
|
-
refreshSettings:
|
|
827
|
-
switchTenant:
|
|
869
|
+
refreshSettings: _,
|
|
870
|
+
switchTenant: M,
|
|
828
871
|
// Validation
|
|
829
|
-
validateSettings:
|
|
872
|
+
validateSettings: S
|
|
830
873
|
}), [
|
|
831
|
-
|
|
874
|
+
b,
|
|
832
875
|
g,
|
|
833
|
-
|
|
834
|
-
h,
|
|
835
|
-
R,
|
|
836
|
-
E,
|
|
837
|
-
U,
|
|
876
|
+
m,
|
|
838
877
|
u,
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
878
|
+
E,
|
|
879
|
+
R,
|
|
880
|
+
q,
|
|
881
|
+
d,
|
|
882
|
+
_,
|
|
883
|
+
M,
|
|
884
|
+
S
|
|
842
885
|
]);
|
|
843
|
-
return /* @__PURE__ */ n(
|
|
886
|
+
return /* @__PURE__ */ n(Se.Provider, { value: L, children: e });
|
|
844
887
|
}
|
|
845
|
-
function
|
|
846
|
-
const i = ce(
|
|
888
|
+
function me() {
|
|
889
|
+
const i = ce(Se);
|
|
847
890
|
if (!i)
|
|
848
891
|
throw new Error("useTenant must be used within a TenantProvider");
|
|
849
892
|
return i;
|
|
850
893
|
}
|
|
851
|
-
function
|
|
852
|
-
return ce(
|
|
894
|
+
function Me() {
|
|
895
|
+
return ce(Se);
|
|
853
896
|
}
|
|
854
|
-
const
|
|
855
|
-
function
|
|
856
|
-
const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: s } =
|
|
897
|
+
const Ft = me;
|
|
898
|
+
function Ht() {
|
|
899
|
+
const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: s } = me();
|
|
857
900
|
return {
|
|
858
901
|
settings: i,
|
|
859
902
|
settingsSchema: e,
|
|
@@ -863,7 +906,7 @@ function Mt() {
|
|
|
863
906
|
};
|
|
864
907
|
}
|
|
865
908
|
function se() {
|
|
866
|
-
const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: s } =
|
|
909
|
+
const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: s } = me();
|
|
867
910
|
return {
|
|
868
911
|
tenant: i,
|
|
869
912
|
tenantSlug: e,
|
|
@@ -872,273 +915,323 @@ function se() {
|
|
|
872
915
|
retry: s
|
|
873
916
|
};
|
|
874
917
|
}
|
|
875
|
-
const
|
|
876
|
-
function
|
|
877
|
-
const { appId: t, baseUrl: r } = oe(), { tenant: s, tenantSlug: o, switchTenant: g } =
|
|
918
|
+
const Ie = he(null);
|
|
919
|
+
function Nt({ config: i = {}, children: e }) {
|
|
920
|
+
const { appId: t, baseUrl: r } = oe(), { tenant: s, tenantSlug: o, switchTenant: g } = me(), [w, x] = v(i.initialRoles || []), [b, A] = v(!i.initialRoles), [m, f] = v(null), [u, y] = v(!1), [E, C] = v(null), [q, T] = v(0), d = X(() => new we({
|
|
878
921
|
tenantSlug: o,
|
|
879
922
|
// SessionManager will generate storageKey internally
|
|
880
923
|
onRefreshFailed: i.onRefreshFailed,
|
|
881
924
|
baseUrl: r
|
|
882
|
-
}), [o, r, i.onRefreshFailed]),
|
|
883
|
-
const
|
|
884
|
-
return
|
|
885
|
-
}, [r,
|
|
886
|
-
const
|
|
925
|
+
}), [o, r, i.onRefreshFailed]), P = X(() => {
|
|
926
|
+
const a = new re(r);
|
|
927
|
+
return a.setSessionManager(d), a;
|
|
928
|
+
}, [r, d]), R = X(() => new ze(new re(r)), [r]), z = X(() => new Oe(P, d), [P, d]), G = X(() => new xe(new re(r)), [r]), $ = X(() => m || d.getUser(), [m, d]), _ = X(() => $ != null && $.roleId && w.find((a) => a.id === $.roleId) || null, [$, w]), S = X(() => (_ == null ? void 0 : _.permissions) || [], [_]), M = X(() => d.hasValidSession() && m !== null, [d, m]), L = 5 * 60 * 1e3, l = X(() => {
|
|
929
|
+
const a = async (F = !1) => {
|
|
887
930
|
try {
|
|
888
|
-
if (!
|
|
931
|
+
if (!d.hasValidSession())
|
|
889
932
|
return;
|
|
890
|
-
const
|
|
891
|
-
if (!F &&
|
|
933
|
+
const U = Date.now();
|
|
934
|
+
if (!F && U - q < L && m)
|
|
892
935
|
return;
|
|
893
|
-
const
|
|
894
|
-
if (!
|
|
936
|
+
const V = d.getUserId();
|
|
937
|
+
if (!V) {
|
|
895
938
|
console.warn("[AuthProvider] No userId available in token or storage");
|
|
896
939
|
return;
|
|
897
940
|
}
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
|
|
901
|
-
} catch (
|
|
902
|
-
const
|
|
903
|
-
C(
|
|
941
|
+
y(!0), C(null);
|
|
942
|
+
const Z = await z.getUserById(V);
|
|
943
|
+
f(Z), d.setUser(Z), T(Date.now());
|
|
944
|
+
} catch (U) {
|
|
945
|
+
const Y = U instanceof Error ? U : new Error("Failed to load user data");
|
|
946
|
+
C(Y), console.error("[AuthProvider] Failed to load user data:", Y);
|
|
904
947
|
} finally {
|
|
905
|
-
|
|
948
|
+
y(!1);
|
|
906
949
|
}
|
|
907
|
-
},
|
|
908
|
-
await
|
|
909
|
-
},
|
|
910
|
-
const { username:
|
|
911
|
-
let
|
|
912
|
-
|
|
913
|
-
const
|
|
914
|
-
username:
|
|
915
|
-
password:
|
|
950
|
+
}, p = async () => {
|
|
951
|
+
await a();
|
|
952
|
+
}, O = async (F) => {
|
|
953
|
+
const { username: U, password: Y, tenantSlug: V } = F;
|
|
954
|
+
let Z = s == null ? void 0 : s.id, Q = o, ee = d;
|
|
955
|
+
V && (Z = (await new ue(P, t).getPublicTenantInfo(V)).id, Q = V);
|
|
956
|
+
const j = await R.login({
|
|
957
|
+
username: U,
|
|
958
|
+
password: Y,
|
|
916
959
|
appId: t,
|
|
917
|
-
tenantId:
|
|
918
|
-
}), le =
|
|
919
|
-
if (le && (
|
|
920
|
-
tenantSlug:
|
|
960
|
+
tenantId: Z
|
|
961
|
+
}), le = V && V !== o;
|
|
962
|
+
if (le && (ee = new we({
|
|
963
|
+
tenantSlug: Q,
|
|
921
964
|
baseUrl: r
|
|
922
|
-
})),
|
|
923
|
-
accessToken:
|
|
924
|
-
refreshToken:
|
|
925
|
-
expiresIn:
|
|
926
|
-
}),
|
|
927
|
-
|
|
965
|
+
})), ee.setTokens({
|
|
966
|
+
accessToken: j.accessToken,
|
|
967
|
+
refreshToken: j.refreshToken,
|
|
968
|
+
expiresIn: j.expiresIn
|
|
969
|
+
}), j.user) {
|
|
970
|
+
ee.setUser(j.user), f(j.user);
|
|
928
971
|
try {
|
|
929
|
-
await
|
|
972
|
+
await a();
|
|
930
973
|
} catch (de) {
|
|
931
974
|
console.warn("Failed to load complete user data after login:", de);
|
|
932
975
|
}
|
|
933
976
|
}
|
|
934
|
-
return le &&
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
977
|
+
return le && Q && Q !== o && g(Q, {
|
|
978
|
+
tokens: {
|
|
979
|
+
accessToken: j.accessToken,
|
|
980
|
+
refreshToken: j.refreshToken,
|
|
981
|
+
expiresIn: j.expiresIn
|
|
982
|
+
}
|
|
983
|
+
}), j;
|
|
984
|
+
}, K = async (F) => {
|
|
985
|
+
const { email: U, phoneNumber: Y, name: V, password: Z, lastName: Q, tenantId: ee } = F;
|
|
986
|
+
if (!U && !Y)
|
|
938
987
|
throw new Error("Either email or phoneNumber is required");
|
|
939
|
-
if (!
|
|
988
|
+
if (!V || !Z)
|
|
940
989
|
throw new Error("Name and password are required");
|
|
941
|
-
const
|
|
942
|
-
return await
|
|
943
|
-
email:
|
|
944
|
-
phoneNumber:
|
|
945
|
-
name:
|
|
946
|
-
password:
|
|
947
|
-
tenantId:
|
|
948
|
-
lastName:
|
|
990
|
+
const j = ee ?? (s == null ? void 0 : s.id);
|
|
991
|
+
return await R.signup({
|
|
992
|
+
email: U,
|
|
993
|
+
phoneNumber: Y,
|
|
994
|
+
name: V,
|
|
995
|
+
password: Z,
|
|
996
|
+
tenantId: j,
|
|
997
|
+
lastName: Q,
|
|
949
998
|
appId: t
|
|
950
999
|
});
|
|
951
|
-
},
|
|
952
|
-
const { email:
|
|
953
|
-
if (!
|
|
1000
|
+
}, H = async (F) => {
|
|
1001
|
+
const { email: U, phoneNumber: Y, name: V, password: Z, tenantName: Q, lastName: ee } = F;
|
|
1002
|
+
if (!U && !Y)
|
|
954
1003
|
throw new Error("Either email or phoneNumber is required");
|
|
955
|
-
if (!
|
|
1004
|
+
if (!V || !Z || !Q)
|
|
956
1005
|
throw new Error("Name, password, and tenantName are required");
|
|
957
|
-
return await
|
|
958
|
-
email:
|
|
959
|
-
phoneNumber:
|
|
960
|
-
name:
|
|
961
|
-
password:
|
|
962
|
-
tenantName:
|
|
1006
|
+
return await R.signupTenantAdmin({
|
|
1007
|
+
email: U,
|
|
1008
|
+
phoneNumber: Y,
|
|
1009
|
+
name: V,
|
|
1010
|
+
password: Z,
|
|
1011
|
+
tenantName: Q,
|
|
963
1012
|
appId: t,
|
|
964
|
-
lastName:
|
|
1013
|
+
lastName: ee
|
|
965
1014
|
});
|
|
966
|
-
},
|
|
967
|
-
const { currentPassword:
|
|
968
|
-
await
|
|
969
|
-
},
|
|
970
|
-
const { email:
|
|
971
|
-
if (!
|
|
1015
|
+
}, N = async (F) => {
|
|
1016
|
+
const { currentPassword: U, newPassword: Y } = F, V = await d.getAuthHeaders();
|
|
1017
|
+
await R.changePassword({ currentPassword: U, newPassword: Y }, V);
|
|
1018
|
+
}, W = async (F) => {
|
|
1019
|
+
const { email: U, tenantId: Y } = F, V = Y ?? (s == null ? void 0 : s.id);
|
|
1020
|
+
if (!V)
|
|
972
1021
|
throw new Error("tenantId is required for password reset");
|
|
973
|
-
await
|
|
974
|
-
},
|
|
975
|
-
const { token:
|
|
976
|
-
await
|
|
977
|
-
},
|
|
978
|
-
const { email:
|
|
979
|
-
if (!
|
|
1022
|
+
await R.requestPasswordReset({ email: U, tenantId: V });
|
|
1023
|
+
}, D = async (F) => {
|
|
1024
|
+
const { token: U, newPassword: Y } = F;
|
|
1025
|
+
await R.confirmPasswordReset({ token: U, newPassword: Y });
|
|
1026
|
+
}, J = async (F) => {
|
|
1027
|
+
const { email: U, frontendUrl: Y, name: V, lastName: Z, tenantId: Q } = F, ee = Q ?? (s == null ? void 0 : s.id);
|
|
1028
|
+
if (!ee)
|
|
980
1029
|
throw new Error("tenantId is required for magic link authentication");
|
|
981
|
-
return await
|
|
982
|
-
email:
|
|
983
|
-
tenantId:
|
|
984
|
-
frontendUrl:
|
|
985
|
-
name:
|
|
986
|
-
lastName:
|
|
1030
|
+
return await R.sendMagicLink({
|
|
1031
|
+
email: U,
|
|
1032
|
+
tenantId: ee,
|
|
1033
|
+
frontendUrl: Y,
|
|
1034
|
+
name: V,
|
|
1035
|
+
lastName: Z,
|
|
987
1036
|
appId: t
|
|
988
1037
|
});
|
|
989
|
-
},
|
|
990
|
-
const { token:
|
|
991
|
-
let
|
|
992
|
-
|
|
993
|
-
const
|
|
994
|
-
token:
|
|
995
|
-
email:
|
|
1038
|
+
}, ge = async (F) => {
|
|
1039
|
+
const { token: U, email: Y, tenantSlug: V } = F;
|
|
1040
|
+
let Z = s == null ? void 0 : s.id, Q = o, ee = d;
|
|
1041
|
+
V && (Z = (await new ue(P, t).getPublicTenantInfo(V)).id, Q = V);
|
|
1042
|
+
const j = await R.verifyMagicLink({
|
|
1043
|
+
token: U,
|
|
1044
|
+
email: Y,
|
|
996
1045
|
appId: t,
|
|
997
|
-
tenantId:
|
|
998
|
-
}), le =
|
|
999
|
-
if (le && (
|
|
1000
|
-
tenantSlug:
|
|
1046
|
+
tenantId: Z
|
|
1047
|
+
}), le = V && V !== o;
|
|
1048
|
+
if (le && (ee = new we({
|
|
1049
|
+
tenantSlug: Q,
|
|
1001
1050
|
baseUrl: r
|
|
1002
|
-
})),
|
|
1003
|
-
accessToken:
|
|
1004
|
-
refreshToken:
|
|
1005
|
-
expiresIn:
|
|
1006
|
-
}),
|
|
1007
|
-
|
|
1051
|
+
})), ee.setTokens({
|
|
1052
|
+
accessToken: j.accessToken,
|
|
1053
|
+
refreshToken: j.refreshToken,
|
|
1054
|
+
expiresIn: j.expiresIn
|
|
1055
|
+
}), j.user) {
|
|
1056
|
+
ee.setUser(j.user), f(j.user);
|
|
1008
1057
|
try {
|
|
1009
|
-
await
|
|
1058
|
+
await a();
|
|
1010
1059
|
} catch (de) {
|
|
1011
1060
|
console.warn("Failed to load complete user data after magic link login:", de);
|
|
1012
1061
|
}
|
|
1013
1062
|
}
|
|
1014
|
-
return le &&
|
|
1015
|
-
|
|
1016
|
-
|
|
1063
|
+
return le && Q && Q !== o && g(Q, {
|
|
1064
|
+
tokens: {
|
|
1065
|
+
accessToken: j.accessToken,
|
|
1066
|
+
refreshToken: j.refreshToken,
|
|
1067
|
+
expiresIn: j.expiresIn
|
|
1068
|
+
}
|
|
1069
|
+
}), j;
|
|
1070
|
+
}, Ce = async () => {
|
|
1071
|
+
const F = d.getTokens();
|
|
1017
1072
|
if (!(F != null && F.refreshToken))
|
|
1018
1073
|
throw new Error("No refresh token available");
|
|
1019
|
-
const
|
|
1074
|
+
const U = await R.refreshToken({
|
|
1020
1075
|
refreshToken: F.refreshToken
|
|
1021
1076
|
});
|
|
1022
|
-
|
|
1023
|
-
accessToken:
|
|
1024
|
-
refreshToken:
|
|
1025
|
-
expiresIn:
|
|
1077
|
+
d.setTokens({
|
|
1078
|
+
accessToken: U.accessToken,
|
|
1079
|
+
refreshToken: U.refreshToken || F.refreshToken,
|
|
1080
|
+
expiresIn: U.expiresIn
|
|
1026
1081
|
});
|
|
1027
|
-
},
|
|
1028
|
-
|
|
1029
|
-
},
|
|
1030
|
-
|
|
1031
|
-
},
|
|
1032
|
-
|
|
1033
|
-
},
|
|
1082
|
+
}, $e = () => {
|
|
1083
|
+
d.clearSession(), f(null), C(null);
|
|
1084
|
+
}, De = (F) => {
|
|
1085
|
+
d.setTokens(F);
|
|
1086
|
+
}, Fe = () => d.hasValidSession(), He = () => {
|
|
1087
|
+
d.clearSession(), f(null), C(null);
|
|
1088
|
+
}, Ne = async () => {
|
|
1034
1089
|
if (t)
|
|
1035
1090
|
try {
|
|
1036
|
-
|
|
1037
|
-
const { roles: F } = await
|
|
1038
|
-
|
|
1091
|
+
A(!0);
|
|
1092
|
+
const { roles: F } = await G.getRolesByApp(t);
|
|
1093
|
+
x(F);
|
|
1039
1094
|
} catch (F) {
|
|
1040
1095
|
console.error("Failed to fetch roles:", F);
|
|
1041
1096
|
} finally {
|
|
1042
|
-
|
|
1097
|
+
A(!1);
|
|
1043
1098
|
}
|
|
1044
|
-
},
|
|
1045
|
-
await
|
|
1046
|
-
},
|
|
1047
|
-
if (!
|
|
1099
|
+
}, Ue = async () => {
|
|
1100
|
+
await Ne();
|
|
1101
|
+
}, ye = (F) => {
|
|
1102
|
+
if (!S || S.length === 0)
|
|
1048
1103
|
return !1;
|
|
1049
1104
|
if (typeof F == "string")
|
|
1050
|
-
return
|
|
1051
|
-
const
|
|
1052
|
-
return
|
|
1105
|
+
return S.includes(F);
|
|
1106
|
+
const U = `${F.resource}.${F.action}`;
|
|
1107
|
+
return S.includes(U);
|
|
1053
1108
|
};
|
|
1054
1109
|
return {
|
|
1055
1110
|
// RFC-003: Authentication state
|
|
1056
|
-
isAuthenticated:
|
|
1057
|
-
sessionManager:
|
|
1058
|
-
authenticatedHttpService:
|
|
1059
|
-
login:
|
|
1060
|
-
signup:
|
|
1061
|
-
signupTenantAdmin:
|
|
1062
|
-
sendMagicLink:
|
|
1063
|
-
verifyMagicLink:
|
|
1064
|
-
changePassword:
|
|
1065
|
-
requestPasswordReset:
|
|
1066
|
-
confirmPasswordReset:
|
|
1067
|
-
refreshToken:
|
|
1068
|
-
logout:
|
|
1069
|
-
setTokens:
|
|
1070
|
-
hasValidSession:
|
|
1071
|
-
clearSession:
|
|
1072
|
-
currentUser:
|
|
1073
|
-
isUserLoading:
|
|
1074
|
-
userError:
|
|
1075
|
-
loadUserData:
|
|
1076
|
-
refreshUser:
|
|
1077
|
-
userRole:
|
|
1078
|
-
userPermissions:
|
|
1079
|
-
availableRoles:
|
|
1080
|
-
rolesLoading:
|
|
1081
|
-
hasPermission:
|
|
1082
|
-
hasAnyPermission: (F) => F.some((
|
|
1083
|
-
hasAllPermissions: (F) => F.every((
|
|
1084
|
-
getUserPermissionStrings: () =>
|
|
1085
|
-
refreshRoles:
|
|
1111
|
+
isAuthenticated: M,
|
|
1112
|
+
sessionManager: d,
|
|
1113
|
+
authenticatedHttpService: P,
|
|
1114
|
+
login: O,
|
|
1115
|
+
signup: K,
|
|
1116
|
+
signupTenantAdmin: H,
|
|
1117
|
+
sendMagicLink: J,
|
|
1118
|
+
verifyMagicLink: ge,
|
|
1119
|
+
changePassword: N,
|
|
1120
|
+
requestPasswordReset: W,
|
|
1121
|
+
confirmPasswordReset: D,
|
|
1122
|
+
refreshToken: Ce,
|
|
1123
|
+
logout: $e,
|
|
1124
|
+
setTokens: De,
|
|
1125
|
+
hasValidSession: Fe,
|
|
1126
|
+
clearSession: He,
|
|
1127
|
+
currentUser: m,
|
|
1128
|
+
isUserLoading: u,
|
|
1129
|
+
userError: E,
|
|
1130
|
+
loadUserData: a,
|
|
1131
|
+
refreshUser: p,
|
|
1132
|
+
userRole: _,
|
|
1133
|
+
userPermissions: S,
|
|
1134
|
+
availableRoles: w,
|
|
1135
|
+
rolesLoading: b,
|
|
1136
|
+
hasPermission: ye,
|
|
1137
|
+
hasAnyPermission: (F) => F.some((U) => ye(U)),
|
|
1138
|
+
hasAllPermissions: (F) => F.every((U) => ye(U)),
|
|
1139
|
+
getUserPermissionStrings: () => S || [],
|
|
1140
|
+
refreshRoles: Ue
|
|
1086
1141
|
};
|
|
1087
1142
|
}, [
|
|
1088
|
-
I,
|
|
1089
|
-
u,
|
|
1090
1143
|
M,
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1144
|
+
d,
|
|
1145
|
+
P,
|
|
1146
|
+
R,
|
|
1147
|
+
z,
|
|
1148
|
+
G,
|
|
1094
1149
|
t,
|
|
1095
1150
|
s,
|
|
1096
1151
|
o,
|
|
1097
1152
|
g,
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1153
|
+
w,
|
|
1154
|
+
m,
|
|
1155
|
+
u,
|
|
1156
|
+
E,
|
|
1157
|
+
_,
|
|
1158
|
+
S,
|
|
1159
|
+
q,
|
|
1105
1160
|
L
|
|
1106
1161
|
]);
|
|
1107
|
-
|
|
1162
|
+
te(() => {
|
|
1108
1163
|
!i.initialRoles && t && (async () => {
|
|
1109
1164
|
try {
|
|
1110
|
-
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
-
} catch (
|
|
1114
|
-
console.error("Failed to fetch roles:",
|
|
1165
|
+
A(!0);
|
|
1166
|
+
const p = new re(r), O = new xe(p), { roles: K } = await O.getRolesByApp(t);
|
|
1167
|
+
x(K);
|
|
1168
|
+
} catch (p) {
|
|
1169
|
+
console.error("Failed to fetch roles:", p);
|
|
1115
1170
|
} finally {
|
|
1116
|
-
|
|
1171
|
+
A(!1);
|
|
1117
1172
|
}
|
|
1118
1173
|
})();
|
|
1119
|
-
}, [t, r, i.initialRoles])
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1174
|
+
}, [t, r, i.initialRoles]);
|
|
1175
|
+
const [I, k] = v(!1), h = qe(!1);
|
|
1176
|
+
return te(() => {
|
|
1177
|
+
if (console.log("[AuthProvider] Cross-subdomain auth effect running", {
|
|
1178
|
+
alreadyChecked: I,
|
|
1179
|
+
alreadyProcessed: h.current,
|
|
1180
|
+
currentUrl: typeof window < "u" ? window.location.href : "SSR"
|
|
1181
|
+
}), I) {
|
|
1182
|
+
console.log("[AuthProvider] URL tokens already checked, skipping");
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
k(!0);
|
|
1186
|
+
const a = Je();
|
|
1187
|
+
console.log("[AuthProvider] URL tokens extraction result:", {
|
|
1188
|
+
found: !!a,
|
|
1189
|
+
hasAccessToken: !!(a != null && a.accessToken)
|
|
1190
|
+
}), a && (h.current = !0, console.log("[AuthProvider] Saving URL tokens to session..."), d.setTokens({
|
|
1191
|
+
accessToken: a.accessToken,
|
|
1192
|
+
refreshToken: a.refreshToken,
|
|
1193
|
+
expiresIn: a.expiresIn
|
|
1194
|
+
}), console.log("[AuthProvider] Tokens saved, verifying session validity:", {
|
|
1195
|
+
hasValidSession: d.hasValidSession()
|
|
1196
|
+
}), Ye(), console.log("[AuthProvider] Loading user data after URL token consumption..."), l.loadUserData().catch((p) => {
|
|
1197
|
+
console.error(
|
|
1198
|
+
"[AuthProvider] Failed to load user data after URL token consumption:",
|
|
1199
|
+
p
|
|
1200
|
+
);
|
|
1201
|
+
}));
|
|
1202
|
+
}, [d, l, I]), te(() => {
|
|
1203
|
+
const a = d.getUser();
|
|
1204
|
+
a && d.hasValidSession() && f(a);
|
|
1205
|
+
}, [d]), te(() => {
|
|
1206
|
+
if (console.log("[AuthProvider] Auto-load effect running", {
|
|
1207
|
+
hasCurrentUser: !!m,
|
|
1208
|
+
isUserLoading: u,
|
|
1209
|
+
hasValidSession: d.hasValidSession(),
|
|
1210
|
+
urlTokensChecked: I,
|
|
1211
|
+
urlTokensProcessed: h.current
|
|
1212
|
+
}), !I) {
|
|
1213
|
+
console.log("[AuthProvider] Waiting for URL tokens check before auto-load");
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
!m && !u && (console.log("[AuthProvider] Auto-loading user data..."), l.loadUserData().catch(() => {
|
|
1217
|
+
}));
|
|
1218
|
+
}, [m, u, l, d, I]), te(() => {
|
|
1219
|
+
if (!d.hasValidSession() || !m)
|
|
1127
1220
|
return;
|
|
1128
|
-
const
|
|
1221
|
+
const a = setInterval(() => {
|
|
1129
1222
|
l.loadUserData().catch(() => {
|
|
1130
1223
|
});
|
|
1131
1224
|
}, L);
|
|
1132
|
-
return () => clearInterval(
|
|
1133
|
-
}, [
|
|
1225
|
+
return () => clearInterval(a);
|
|
1226
|
+
}, [d, m, l, L]), /* @__PURE__ */ n(Ie.Provider, { value: l, children: e });
|
|
1134
1227
|
}
|
|
1135
1228
|
function ae() {
|
|
1136
|
-
const i = ce(
|
|
1229
|
+
const i = ce(Ie);
|
|
1137
1230
|
if (!i)
|
|
1138
1231
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
1139
1232
|
return i;
|
|
1140
1233
|
}
|
|
1141
|
-
class
|
|
1234
|
+
class Qe {
|
|
1142
1235
|
constructor(e, t) {
|
|
1143
1236
|
this.httpService = e, this.sessionManager = t;
|
|
1144
1237
|
}
|
|
@@ -1218,58 +1311,58 @@ class Oe {
|
|
|
1218
1311
|
})).data;
|
|
1219
1312
|
}
|
|
1220
1313
|
}
|
|
1221
|
-
const
|
|
1222
|
-
function
|
|
1223
|
-
const { baseUrl: t, appId: r } = oe(), { tenant: s } = se(), [o, g] =
|
|
1224
|
-
const
|
|
1225
|
-
return new
|
|
1226
|
-
}, [t]),
|
|
1314
|
+
const Le = he(null);
|
|
1315
|
+
function Ut({ config: i = {}, children: e }) {
|
|
1316
|
+
const { baseUrl: t, appId: r } = oe(), { tenant: s } = se(), [o, g] = v([]), [w, x] = v(!1), [b, A] = v(null), m = X(() => {
|
|
1317
|
+
const y = new re(t);
|
|
1318
|
+
return new Qe(y);
|
|
1319
|
+
}, [t]), f = async () => {
|
|
1227
1320
|
if (!(s != null && s.id)) {
|
|
1228
1321
|
g([]);
|
|
1229
1322
|
return;
|
|
1230
1323
|
}
|
|
1231
|
-
|
|
1324
|
+
x(!0), A(null);
|
|
1232
1325
|
try {
|
|
1233
|
-
const
|
|
1234
|
-
g(
|
|
1235
|
-
} catch (
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1326
|
+
const y = await m.getTenantFeatureFlags(s.id, r);
|
|
1327
|
+
g(y);
|
|
1328
|
+
} catch (y) {
|
|
1329
|
+
const E = y instanceof Error ? y.message : "Failed to fetch feature flags";
|
|
1330
|
+
A(E), i.onError && i.onError(y instanceof Error ? y : new Error(E));
|
|
1238
1331
|
} finally {
|
|
1239
|
-
|
|
1332
|
+
x(!1);
|
|
1240
1333
|
}
|
|
1241
1334
|
};
|
|
1242
1335
|
te(() => {
|
|
1243
|
-
|
|
1244
|
-
const
|
|
1245
|
-
return () => clearInterval(
|
|
1336
|
+
f();
|
|
1337
|
+
const y = i.refreshInterval || 5 * 60 * 1e3, E = setInterval(f, y);
|
|
1338
|
+
return () => clearInterval(E);
|
|
1246
1339
|
}, [s == null ? void 0 : s.id, i.refreshInterval]);
|
|
1247
|
-
const
|
|
1340
|
+
const u = X(() => ({
|
|
1248
1341
|
featureFlags: o,
|
|
1249
|
-
loading:
|
|
1250
|
-
error:
|
|
1251
|
-
isEnabled: (
|
|
1252
|
-
const
|
|
1253
|
-
return (
|
|
1342
|
+
loading: w,
|
|
1343
|
+
error: b,
|
|
1344
|
+
isEnabled: (T) => {
|
|
1345
|
+
const d = o.find((P) => P.key === T);
|
|
1346
|
+
return (d == null ? void 0 : d.value) === !0;
|
|
1254
1347
|
},
|
|
1255
|
-
getFlag: (
|
|
1256
|
-
getFlagState: (
|
|
1257
|
-
const
|
|
1258
|
-
return
|
|
1348
|
+
getFlag: (T) => o.find((d) => d.key === T),
|
|
1349
|
+
getFlagState: (T) => {
|
|
1350
|
+
const d = o.find((P) => P.key === T);
|
|
1351
|
+
return d ? d.value ? "enabled" : "disabled" : "not_found";
|
|
1259
1352
|
},
|
|
1260
1353
|
refresh: async () => {
|
|
1261
|
-
await
|
|
1354
|
+
await f();
|
|
1262
1355
|
}
|
|
1263
|
-
}), [o,
|
|
1264
|
-
return /* @__PURE__ */ n(
|
|
1356
|
+
}), [o, w, b]);
|
|
1357
|
+
return /* @__PURE__ */ n(Le.Provider, { value: u, children: e });
|
|
1265
1358
|
}
|
|
1266
|
-
function
|
|
1267
|
-
const i = ce(
|
|
1359
|
+
function Xe() {
|
|
1360
|
+
const i = ce(Le);
|
|
1268
1361
|
if (!i)
|
|
1269
1362
|
throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
|
|
1270
1363
|
return i;
|
|
1271
1364
|
}
|
|
1272
|
-
class
|
|
1365
|
+
class Ze {
|
|
1273
1366
|
constructor(e, t) {
|
|
1274
1367
|
this.httpService = e, this.sessionManager = t;
|
|
1275
1368
|
}
|
|
@@ -1335,64 +1428,64 @@ class je {
|
|
|
1335
1428
|
)).data;
|
|
1336
1429
|
}
|
|
1337
1430
|
}
|
|
1338
|
-
const
|
|
1339
|
-
function
|
|
1340
|
-
const { baseUrl: t } = oe(), { tenant: r } = se(), [s, o] =
|
|
1341
|
-
const
|
|
1342
|
-
return new
|
|
1343
|
-
}, [t]),
|
|
1431
|
+
const Re = he(void 0);
|
|
1432
|
+
function Bt({ config: i = {}, children: e }) {
|
|
1433
|
+
const { baseUrl: t } = oe(), { tenant: r } = se(), [s, o] = v(null), [g, w] = v(!1), [x, b] = v(null), A = X(() => {
|
|
1434
|
+
const u = new re(t);
|
|
1435
|
+
return new Ze(u);
|
|
1436
|
+
}, [t]), m = async () => {
|
|
1344
1437
|
if (!(r != null && r.id)) {
|
|
1345
1438
|
o(null);
|
|
1346
1439
|
return;
|
|
1347
1440
|
}
|
|
1348
|
-
|
|
1441
|
+
w(!0), b(null);
|
|
1349
1442
|
try {
|
|
1350
|
-
const
|
|
1351
|
-
o(
|
|
1352
|
-
} catch (
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1443
|
+
const u = await A.getTenantSubscriptionFeatures(r.id);
|
|
1444
|
+
o(u);
|
|
1445
|
+
} catch (u) {
|
|
1446
|
+
const y = u instanceof Error ? u.message : "Failed to fetch subscription";
|
|
1447
|
+
b(y), i.onError && i.onError(u instanceof Error ? u : new Error(y));
|
|
1355
1448
|
} finally {
|
|
1356
|
-
|
|
1449
|
+
w(!1);
|
|
1357
1450
|
}
|
|
1358
1451
|
};
|
|
1359
1452
|
te(() => {
|
|
1360
|
-
if (
|
|
1361
|
-
const
|
|
1362
|
-
return () => clearInterval(
|
|
1453
|
+
if (m(), !i.refreshInterval) return;
|
|
1454
|
+
const u = i.refreshInterval || 10 * 60 * 1e3, y = setInterval(m, u);
|
|
1455
|
+
return () => clearInterval(y);
|
|
1363
1456
|
}, [r == null ? void 0 : r.id, i.refreshInterval]);
|
|
1364
|
-
const
|
|
1365
|
-
const
|
|
1457
|
+
const f = X(() => {
|
|
1458
|
+
const u = (s == null ? void 0 : s.features) || [];
|
|
1366
1459
|
return {
|
|
1367
1460
|
subscription: s,
|
|
1368
|
-
features:
|
|
1461
|
+
features: u,
|
|
1369
1462
|
loading: g,
|
|
1370
|
-
error:
|
|
1371
|
-
isFeatureEnabled: (
|
|
1372
|
-
const
|
|
1373
|
-
return
|
|
1463
|
+
error: x,
|
|
1464
|
+
isFeatureEnabled: (d) => {
|
|
1465
|
+
const P = u.find((R) => R.key === d);
|
|
1466
|
+
return P ? P.type === "BOOLEAN" || P.type === "boolean" ? P.value === !0 : !!P.value : !1;
|
|
1374
1467
|
},
|
|
1375
|
-
getFeature: (
|
|
1376
|
-
getFeatureValue: (
|
|
1377
|
-
const
|
|
1378
|
-
return
|
|
1468
|
+
getFeature: (d) => u.find((P) => P.key === d),
|
|
1469
|
+
getFeatureValue: (d, P) => {
|
|
1470
|
+
const R = u.find((z) => z.key === d);
|
|
1471
|
+
return R ? R.value : P;
|
|
1379
1472
|
},
|
|
1380
|
-
hasAllowedPlan: (
|
|
1473
|
+
hasAllowedPlan: (d) => !s || !s.isActive ? !1 : d.includes(s.planId),
|
|
1381
1474
|
refresh: async () => {
|
|
1382
|
-
await
|
|
1475
|
+
await m();
|
|
1383
1476
|
}
|
|
1384
1477
|
};
|
|
1385
|
-
}, [s, g,
|
|
1386
|
-
return /* @__PURE__ */ n(
|
|
1478
|
+
}, [s, g, x]);
|
|
1479
|
+
return /* @__PURE__ */ n(Re.Provider, { value: f, children: e });
|
|
1387
1480
|
}
|
|
1388
|
-
function
|
|
1389
|
-
const i = ce(
|
|
1481
|
+
function et() {
|
|
1482
|
+
const i = ce(Re);
|
|
1390
1483
|
if (i === void 0)
|
|
1391
1484
|
throw new Error("useSubscription must be used within a SubscriptionProvider");
|
|
1392
1485
|
return i;
|
|
1393
1486
|
}
|
|
1394
1487
|
var ie = /* @__PURE__ */ ((i) => (i.SUPERUSER = "SUPERUSER", i.TENANT_ADMIN = "TENANT_ADMIN", i.USER = "USER", i))(ie || {});
|
|
1395
|
-
const
|
|
1488
|
+
const ke = () => /* @__PURE__ */ c(
|
|
1396
1489
|
"div",
|
|
1397
1490
|
{
|
|
1398
1491
|
style: {
|
|
@@ -1429,11 +1522,11 @@ const xe = () => /* @__PURE__ */ a(
|
|
|
1429
1522
|
)
|
|
1430
1523
|
]
|
|
1431
1524
|
}
|
|
1432
|
-
),
|
|
1525
|
+
), Ae = ({
|
|
1433
1526
|
userType: i,
|
|
1434
1527
|
minUserType: e,
|
|
1435
1528
|
missingPermissions: t
|
|
1436
|
-
}) => /* @__PURE__ */
|
|
1529
|
+
}) => /* @__PURE__ */ c(
|
|
1437
1530
|
"div",
|
|
1438
1531
|
{
|
|
1439
1532
|
style: {
|
|
@@ -1451,26 +1544,26 @@ const xe = () => /* @__PURE__ */ a(
|
|
|
1451
1544
|
children: [
|
|
1452
1545
|
/* @__PURE__ */ n("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "⚠️" }),
|
|
1453
1546
|
/* @__PURE__ */ n("h3", { style: { color: "#856404", marginBottom: "10px" }, children: "Insufficient Permissions" }),
|
|
1454
|
-
e && i ? /* @__PURE__ */
|
|
1455
|
-
/* @__PURE__ */
|
|
1547
|
+
e && i ? /* @__PURE__ */ c(B, { children: [
|
|
1548
|
+
/* @__PURE__ */ c("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: [
|
|
1456
1549
|
"This content requires ",
|
|
1457
1550
|
/* @__PURE__ */ n("strong", { children: e }),
|
|
1458
1551
|
" access level or higher."
|
|
1459
1552
|
] }),
|
|
1460
|
-
/* @__PURE__ */
|
|
1553
|
+
/* @__PURE__ */ c("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1461
1554
|
"Your current access level: ",
|
|
1462
1555
|
/* @__PURE__ */ n("strong", { children: i })
|
|
1463
1556
|
] })
|
|
1464
|
-
] }) : /* @__PURE__ */
|
|
1557
|
+
] }) : /* @__PURE__ */ c(B, { children: [
|
|
1465
1558
|
/* @__PURE__ */ n("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: "You don't have the required permissions to view this content." }),
|
|
1466
|
-
t && t.length > 0 && /* @__PURE__ */
|
|
1559
|
+
t && t.length > 0 && /* @__PURE__ */ c("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1467
1560
|
"Required permissions: ",
|
|
1468
1561
|
/* @__PURE__ */ n("strong", { children: t.join(", ") })
|
|
1469
1562
|
] })
|
|
1470
1563
|
] })
|
|
1471
1564
|
]
|
|
1472
1565
|
}
|
|
1473
|
-
),
|
|
1566
|
+
), tt = (i, e) => {
|
|
1474
1567
|
const t = {
|
|
1475
1568
|
[ie.USER]: 1,
|
|
1476
1569
|
[ie.TENANT_ADMIN]: 2,
|
|
@@ -1478,28 +1571,28 @@ const xe = () => /* @__PURE__ */ a(
|
|
|
1478
1571
|
};
|
|
1479
1572
|
return t[i] >= t[e];
|
|
1480
1573
|
};
|
|
1481
|
-
function
|
|
1574
|
+
function qt({
|
|
1482
1575
|
children: i,
|
|
1483
1576
|
fallback: e,
|
|
1484
1577
|
minUserType: t,
|
|
1485
1578
|
requiredPermissions: r,
|
|
1486
1579
|
requireAllPermissions: s = !1
|
|
1487
1580
|
}) {
|
|
1488
|
-
const { hasValidSession: o, sessionManager: g, hasPermission:
|
|
1581
|
+
const { hasValidSession: o, sessionManager: g, hasPermission: w, hasAnyPermission: x, hasAllPermissions: b } = ae();
|
|
1489
1582
|
if (!o())
|
|
1490
|
-
return /* @__PURE__ */ n(B, { children: e || /* @__PURE__ */ n(
|
|
1491
|
-
const
|
|
1492
|
-
if (!
|
|
1493
|
-
return /* @__PURE__ */ n(B, { children: e || /* @__PURE__ */ n(
|
|
1494
|
-
if (t && !
|
|
1495
|
-
return /* @__PURE__ */ n(
|
|
1496
|
-
if (r && r.length > 0 && !(s ?
|
|
1497
|
-
const
|
|
1498
|
-
return /* @__PURE__ */ n(
|
|
1583
|
+
return /* @__PURE__ */ n(B, { children: e || /* @__PURE__ */ n(ke, {}) });
|
|
1584
|
+
const A = g.getUser();
|
|
1585
|
+
if (!A)
|
|
1586
|
+
return /* @__PURE__ */ n(B, { children: e || /* @__PURE__ */ n(ke, {}) });
|
|
1587
|
+
if (t && !tt(A.userType, t))
|
|
1588
|
+
return /* @__PURE__ */ n(Ae, { userType: A.userType, minUserType: t });
|
|
1589
|
+
if (r && r.length > 0 && !(s ? b(r) : x(r))) {
|
|
1590
|
+
const f = r.filter((u) => !w(u)).map((u) => typeof u == "string" ? u : u.name);
|
|
1591
|
+
return /* @__PURE__ */ n(Ae, { missingPermissions: f });
|
|
1499
1592
|
}
|
|
1500
1593
|
return /* @__PURE__ */ n(B, { children: i });
|
|
1501
1594
|
}
|
|
1502
|
-
const
|
|
1595
|
+
const rt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1503
1596
|
"div",
|
|
1504
1597
|
{
|
|
1505
1598
|
style: {
|
|
@@ -1512,7 +1605,7 @@ const _e = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1512
1605
|
backgroundColor: "#f9fafb",
|
|
1513
1606
|
textAlign: "center"
|
|
1514
1607
|
},
|
|
1515
|
-
children: /* @__PURE__ */
|
|
1608
|
+
children: /* @__PURE__ */ c(
|
|
1516
1609
|
"div",
|
|
1517
1610
|
{
|
|
1518
1611
|
style: {
|
|
@@ -1526,7 +1619,7 @@ const _e = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1526
1619
|
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🔒" }),
|
|
1527
1620
|
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Access Required" }),
|
|
1528
1621
|
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You need to be signed in to access this page." }),
|
|
1529
|
-
/* @__PURE__ */
|
|
1622
|
+
/* @__PURE__ */ c("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1530
1623
|
"Redirecting to ",
|
|
1531
1624
|
i,
|
|
1532
1625
|
"..."
|
|
@@ -1535,7 +1628,7 @@ const _e = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1535
1628
|
}
|
|
1536
1629
|
)
|
|
1537
1630
|
}
|
|
1538
|
-
),
|
|
1631
|
+
), Te = ({
|
|
1539
1632
|
userType: i,
|
|
1540
1633
|
minUserType: e,
|
|
1541
1634
|
missingPermissions: t
|
|
@@ -1552,7 +1645,7 @@ const _e = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1552
1645
|
backgroundColor: "#f9fafb",
|
|
1553
1646
|
textAlign: "center"
|
|
1554
1647
|
},
|
|
1555
|
-
children: /* @__PURE__ */
|
|
1648
|
+
children: /* @__PURE__ */ c(
|
|
1556
1649
|
"div",
|
|
1557
1650
|
{
|
|
1558
1651
|
style: {
|
|
@@ -1565,19 +1658,19 @@ const _e = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1565
1658
|
children: [
|
|
1566
1659
|
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "⚠️" }),
|
|
1567
1660
|
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Insufficient Permissions" }),
|
|
1568
|
-
e && i ? /* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1661
|
+
e && i ? /* @__PURE__ */ c(B, { children: [
|
|
1662
|
+
/* @__PURE__ */ c("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: [
|
|
1570
1663
|
"This page requires ",
|
|
1571
1664
|
/* @__PURE__ */ n("strong", { children: e }),
|
|
1572
1665
|
" access level or higher."
|
|
1573
1666
|
] }),
|
|
1574
|
-
/* @__PURE__ */
|
|
1667
|
+
/* @__PURE__ */ c("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1575
1668
|
"Your current access level: ",
|
|
1576
1669
|
/* @__PURE__ */ n("strong", { children: i })
|
|
1577
1670
|
] })
|
|
1578
|
-
] }) : /* @__PURE__ */
|
|
1671
|
+
] }) : /* @__PURE__ */ c(B, { children: [
|
|
1579
1672
|
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: "You don't have the required permissions to access this page." }),
|
|
1580
|
-
t && t.length > 0 && /* @__PURE__ */
|
|
1673
|
+
t && t.length > 0 && /* @__PURE__ */ c("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1581
1674
|
"Required permissions: ",
|
|
1582
1675
|
/* @__PURE__ */ n("strong", { children: t.join(", ") })
|
|
1583
1676
|
] })
|
|
@@ -1586,7 +1679,7 @@ const _e = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1586
1679
|
}
|
|
1587
1680
|
)
|
|
1588
1681
|
}
|
|
1589
|
-
),
|
|
1682
|
+
), nt = (i, e) => {
|
|
1590
1683
|
const t = {
|
|
1591
1684
|
[ie.USER]: 1,
|
|
1592
1685
|
[ie.TENANT_ADMIN]: 2,
|
|
@@ -1594,7 +1687,7 @@ const _e = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1594
1687
|
};
|
|
1595
1688
|
return t[i] >= t[e];
|
|
1596
1689
|
};
|
|
1597
|
-
function
|
|
1690
|
+
function zt({
|
|
1598
1691
|
children: i,
|
|
1599
1692
|
redirectTo: e = "/login",
|
|
1600
1693
|
minUserType: t,
|
|
@@ -1602,24 +1695,24 @@ function Ct({
|
|
|
1602
1695
|
requireAllPermissions: s = !1,
|
|
1603
1696
|
fallback: o
|
|
1604
1697
|
}) {
|
|
1605
|
-
const { hasValidSession: g, sessionManager:
|
|
1698
|
+
const { hasValidSession: g, sessionManager: w, hasPermission: x, hasAnyPermission: b, hasAllPermissions: A } = ae(), m = be();
|
|
1606
1699
|
if (!g())
|
|
1607
|
-
return o ? /* @__PURE__ */ n(B, { children: o }) : /* @__PURE__ */
|
|
1608
|
-
/* @__PURE__ */ n(
|
|
1609
|
-
/* @__PURE__ */ n(pe, { to: e, state: { from:
|
|
1700
|
+
return o ? /* @__PURE__ */ n(B, { children: o }) : /* @__PURE__ */ c(B, { children: [
|
|
1701
|
+
/* @__PURE__ */ n(rt, { redirectPath: e }),
|
|
1702
|
+
/* @__PURE__ */ n(pe, { to: e, state: { from: m.pathname }, replace: !0 })
|
|
1610
1703
|
] });
|
|
1611
|
-
const
|
|
1612
|
-
if (!
|
|
1613
|
-
return /* @__PURE__ */ n(pe, { to: e, state: { from:
|
|
1614
|
-
if (t && !
|
|
1615
|
-
return /* @__PURE__ */ n(
|
|
1616
|
-
if (r && r.length > 0 && !(s ?
|
|
1617
|
-
const
|
|
1618
|
-
return /* @__PURE__ */ n(
|
|
1704
|
+
const f = w.getUser();
|
|
1705
|
+
if (!f)
|
|
1706
|
+
return /* @__PURE__ */ n(pe, { to: e, state: { from: m.pathname }, replace: !0 });
|
|
1707
|
+
if (t && !nt(f.userType, t))
|
|
1708
|
+
return /* @__PURE__ */ n(Te, { userType: f.userType, minUserType: t });
|
|
1709
|
+
if (r && r.length > 0 && !(s ? A(r) : b(r))) {
|
|
1710
|
+
const y = r.filter((E) => !x(E)).map((E) => typeof E == "string" ? E : E.name);
|
|
1711
|
+
return /* @__PURE__ */ n(Te, { missingPermissions: y });
|
|
1619
1712
|
}
|
|
1620
1713
|
return /* @__PURE__ */ n(B, { children: i });
|
|
1621
1714
|
}
|
|
1622
|
-
const
|
|
1715
|
+
const st = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1623
1716
|
"div",
|
|
1624
1717
|
{
|
|
1625
1718
|
style: {
|
|
@@ -1632,7 +1725,7 @@ const Je = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1632
1725
|
backgroundColor: "#f9fafb",
|
|
1633
1726
|
textAlign: "center"
|
|
1634
1727
|
},
|
|
1635
|
-
children: /* @__PURE__ */
|
|
1728
|
+
children: /* @__PURE__ */ c(
|
|
1636
1729
|
"div",
|
|
1637
1730
|
{
|
|
1638
1731
|
style: {
|
|
@@ -1646,7 +1739,7 @@ const Je = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1646
1739
|
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🏢" }),
|
|
1647
1740
|
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Tenant Required" }),
|
|
1648
1741
|
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "This page requires a tenant context to access." }),
|
|
1649
|
-
/* @__PURE__ */
|
|
1742
|
+
/* @__PURE__ */ c("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1650
1743
|
"Redirecting to ",
|
|
1651
1744
|
i,
|
|
1652
1745
|
"..."
|
|
@@ -1656,14 +1749,14 @@ const Je = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1656
1749
|
)
|
|
1657
1750
|
}
|
|
1658
1751
|
);
|
|
1659
|
-
function
|
|
1660
|
-
const { tenant: r, isLoading: s, error: o } = se(), g =
|
|
1661
|
-
return s || o ? null : r ? /* @__PURE__ */ n(B, { children: i }) : t ? /* @__PURE__ */ n(B, { children: t }) : /* @__PURE__ */
|
|
1662
|
-
/* @__PURE__ */ n(
|
|
1752
|
+
function Ot({ children: i, redirectTo: e = "/", fallback: t }) {
|
|
1753
|
+
const { tenant: r, isLoading: s, error: o } = se(), g = be();
|
|
1754
|
+
return s || o ? null : r ? /* @__PURE__ */ n(B, { children: i }) : t ? /* @__PURE__ */ n(B, { children: t }) : /* @__PURE__ */ c(B, { children: [
|
|
1755
|
+
/* @__PURE__ */ n(st, { redirectPath: e }),
|
|
1663
1756
|
/* @__PURE__ */ n(pe, { to: e, state: { from: g.pathname }, replace: !0 })
|
|
1664
1757
|
] });
|
|
1665
1758
|
}
|
|
1666
|
-
const
|
|
1759
|
+
const it = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1667
1760
|
"div",
|
|
1668
1761
|
{
|
|
1669
1762
|
style: {
|
|
@@ -1676,7 +1769,7 @@ const Ye = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1676
1769
|
backgroundColor: "#f9fafb",
|
|
1677
1770
|
textAlign: "center"
|
|
1678
1771
|
},
|
|
1679
|
-
children: /* @__PURE__ */
|
|
1772
|
+
children: /* @__PURE__ */ c(
|
|
1680
1773
|
"div",
|
|
1681
1774
|
{
|
|
1682
1775
|
style: {
|
|
@@ -1690,7 +1783,7 @@ const Ye = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1690
1783
|
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🚀" }),
|
|
1691
1784
|
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Tenant Detected" }),
|
|
1692
1785
|
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You are accessing a tenant-specific context. Redirecting to the appropriate page." }),
|
|
1693
|
-
/* @__PURE__ */
|
|
1786
|
+
/* @__PURE__ */ c("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1694
1787
|
"Redirecting to ",
|
|
1695
1788
|
i,
|
|
1696
1789
|
"..."
|
|
@@ -1700,14 +1793,14 @@ const Ye = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1700
1793
|
)
|
|
1701
1794
|
}
|
|
1702
1795
|
);
|
|
1703
|
-
function
|
|
1704
|
-
const { tenant: r, isLoading: s, error: o } = se(), g =
|
|
1705
|
-
return s || o ? null : r ? t ? /* @__PURE__ */ n(B, { children: t }) : /* @__PURE__ */
|
|
1706
|
-
/* @__PURE__ */ n(
|
|
1796
|
+
function Wt({ children: i, redirectTo: e = "/dashboard", fallback: t }) {
|
|
1797
|
+
const { tenant: r, isLoading: s, error: o } = se(), g = be();
|
|
1798
|
+
return s || o ? null : r ? t ? /* @__PURE__ */ n(B, { children: t }) : /* @__PURE__ */ c(B, { children: [
|
|
1799
|
+
/* @__PURE__ */ n(it, { redirectPath: e }),
|
|
1707
1800
|
/* @__PURE__ */ n(pe, { to: e, state: { from: g.pathname }, replace: !0 })
|
|
1708
1801
|
] }) : /* @__PURE__ */ n(B, { children: i });
|
|
1709
1802
|
}
|
|
1710
|
-
const
|
|
1803
|
+
const ot = () => /* @__PURE__ */ c(
|
|
1711
1804
|
"div",
|
|
1712
1805
|
{
|
|
1713
1806
|
style: {
|
|
@@ -1724,14 +1817,14 @@ const Qe = () => /* @__PURE__ */ a(
|
|
|
1724
1817
|
]
|
|
1725
1818
|
}
|
|
1726
1819
|
);
|
|
1727
|
-
function
|
|
1820
|
+
function Vt({
|
|
1728
1821
|
children: i,
|
|
1729
|
-
fallback: e = /* @__PURE__ */ n(
|
|
1822
|
+
fallback: e = /* @__PURE__ */ n(ot, {}),
|
|
1730
1823
|
allowedPlans: t,
|
|
1731
1824
|
requiredFeature: r
|
|
1732
1825
|
}) {
|
|
1733
|
-
const { subscription: s, hasAllowedPlan: o, isFeatureEnabled: g, loading:
|
|
1734
|
-
return
|
|
1826
|
+
const { subscription: s, hasAllowedPlan: o, isFeatureEnabled: g, loading: w } = et();
|
|
1827
|
+
return w ? /* @__PURE__ */ n(
|
|
1735
1828
|
"div",
|
|
1736
1829
|
{
|
|
1737
1830
|
style: {
|
|
@@ -1743,7 +1836,7 @@ function Dt({
|
|
|
1743
1836
|
}
|
|
1744
1837
|
) : s ? s.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ n(B, { children: e }) : r && !g(r) ? /* @__PURE__ */ n(B, { children: e }) : /* @__PURE__ */ n(B, { children: i }) : /* @__PURE__ */ n(B, { children: e }) : /* @__PURE__ */ n(B, { children: e });
|
|
1745
1838
|
}
|
|
1746
|
-
const
|
|
1839
|
+
const at = ({ flagName: i }) => /* @__PURE__ */ c(
|
|
1747
1840
|
"div",
|
|
1748
1841
|
{
|
|
1749
1842
|
style: {
|
|
@@ -1762,7 +1855,7 @@ const Xe = ({ flagName: i }) => /* @__PURE__ */ a(
|
|
|
1762
1855
|
children: [
|
|
1763
1856
|
/* @__PURE__ */ n("div", { style: { fontSize: "24px", marginBottom: "8px" }, children: "🚧" }),
|
|
1764
1857
|
/* @__PURE__ */ n("div", { style: { fontSize: "14px", fontWeight: "500", marginBottom: "4px" }, children: "Feature Not Available" }),
|
|
1765
|
-
/* @__PURE__ */
|
|
1858
|
+
/* @__PURE__ */ c("div", { style: { fontSize: "12px", opacity: 0.7 }, children: [
|
|
1766
1859
|
'Feature flag "',
|
|
1767
1860
|
i,
|
|
1768
1861
|
'" is disabled'
|
|
@@ -1770,8 +1863,8 @@ const Xe = ({ flagName: i }) => /* @__PURE__ */ a(
|
|
|
1770
1863
|
]
|
|
1771
1864
|
}
|
|
1772
1865
|
);
|
|
1773
|
-
function
|
|
1774
|
-
const { isEnabled: r, loading: s } =
|
|
1866
|
+
function jt({ name: i, children: e, fallback: t }) {
|
|
1867
|
+
const { isEnabled: r, loading: s } = Xe();
|
|
1775
1868
|
return s ? /* @__PURE__ */ n(
|
|
1776
1869
|
"div",
|
|
1777
1870
|
{
|
|
@@ -1785,9 +1878,9 @@ function Ht({ name: i, children: e, fallback: t }) {
|
|
|
1785
1878
|
},
|
|
1786
1879
|
children: "Loading feature flags..."
|
|
1787
1880
|
}
|
|
1788
|
-
) : r(i) ? /* @__PURE__ */ n(B, { children: e }) : /* @__PURE__ */ n(B, { children: t || /* @__PURE__ */ n(
|
|
1881
|
+
) : r(i) ? /* @__PURE__ */ n(B, { children: e }) : /* @__PURE__ */ n(B, { children: t || /* @__PURE__ */ n(at, { flagName: i }) });
|
|
1789
1882
|
}
|
|
1790
|
-
const
|
|
1883
|
+
const lt = () => /* @__PURE__ */ c(
|
|
1791
1884
|
"svg",
|
|
1792
1885
|
{
|
|
1793
1886
|
width: "16",
|
|
@@ -1804,7 +1897,7 @@ const Ze = () => /* @__PURE__ */ a(
|
|
|
1804
1897
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
1805
1898
|
]
|
|
1806
1899
|
}
|
|
1807
|
-
),
|
|
1900
|
+
), ct = () => /* @__PURE__ */ c(
|
|
1808
1901
|
"svg",
|
|
1809
1902
|
{
|
|
1810
1903
|
width: "16",
|
|
@@ -1821,10 +1914,10 @@ const Ze = () => /* @__PURE__ */ a(
|
|
|
1821
1914
|
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1822
1915
|
]
|
|
1823
1916
|
}
|
|
1824
|
-
),
|
|
1825
|
-
showPassword: /* @__PURE__ */ n(
|
|
1826
|
-
hidePassword: /* @__PURE__ */ n(
|
|
1827
|
-
},
|
|
1917
|
+
), dt = {
|
|
1918
|
+
showPassword: /* @__PURE__ */ n(lt, {}),
|
|
1919
|
+
hidePassword: /* @__PURE__ */ n(ct, {})
|
|
1920
|
+
}, ut = {
|
|
1828
1921
|
title: "Sign In",
|
|
1829
1922
|
usernameLabel: "Email or Phone",
|
|
1830
1923
|
usernamePlaceholder: "Enter your email or phone number",
|
|
@@ -1838,7 +1931,7 @@ const Ze = () => /* @__PURE__ */ a(
|
|
|
1838
1931
|
magicLinkLink: "Use Magic Link",
|
|
1839
1932
|
errorMessage: "Invalid credentials",
|
|
1840
1933
|
loadingText: "Signing in..."
|
|
1841
|
-
},
|
|
1934
|
+
}, ht = {
|
|
1842
1935
|
container: {
|
|
1843
1936
|
maxWidth: "400px",
|
|
1844
1937
|
width: "100%",
|
|
@@ -1945,7 +2038,7 @@ const Ze = () => /* @__PURE__ */ a(
|
|
|
1945
2038
|
fontSize: "0.875rem"
|
|
1946
2039
|
}
|
|
1947
2040
|
};
|
|
1948
|
-
function
|
|
2041
|
+
function _t({
|
|
1949
2042
|
copy: i = {},
|
|
1950
2043
|
styles: e = {},
|
|
1951
2044
|
icons: t = {},
|
|
@@ -1953,125 +2046,125 @@ function Nt({
|
|
|
1953
2046
|
onError: s,
|
|
1954
2047
|
onForgotPassword: o,
|
|
1955
2048
|
onSignupClick: g,
|
|
1956
|
-
onMagicLinkClick:
|
|
1957
|
-
showForgotPassword:
|
|
1958
|
-
showSignupLink:
|
|
1959
|
-
showMagicLinkOption:
|
|
1960
|
-
className:
|
|
2049
|
+
onMagicLinkClick: w,
|
|
2050
|
+
showForgotPassword: x = !0,
|
|
2051
|
+
showSignupLink: b = !0,
|
|
2052
|
+
showMagicLinkOption: A = !0,
|
|
2053
|
+
className: m
|
|
1961
2054
|
}) {
|
|
1962
|
-
const [
|
|
1963
|
-
const
|
|
1964
|
-
return
|
|
1965
|
-
},
|
|
1966
|
-
if (
|
|
1967
|
-
if (!(
|
|
1968
|
-
|
|
2055
|
+
const [f, u] = v(""), [y, E] = v(""), [C, q] = v(!1), [T, d] = v(!1), [P, R] = v(""), [z, G] = v({}), { login: $ } = ae(), { tenant: _ } = se(), S = { ...ut, ...i }, M = { ...ht, ...e }, L = { ...dt, ...t }, l = () => {
|
|
2056
|
+
const a = {};
|
|
2057
|
+
return f.trim() || (a.username = !0), y.trim() || (a.password = !0), G(a), Object.keys(a).length === 0;
|
|
2058
|
+
}, I = async (a) => {
|
|
2059
|
+
if (a.preventDefault(), !!l()) {
|
|
2060
|
+
if (!(_ != null && _.id)) {
|
|
2061
|
+
R("Tenant not found");
|
|
1969
2062
|
return;
|
|
1970
2063
|
}
|
|
1971
|
-
|
|
2064
|
+
d(!0), R("");
|
|
1972
2065
|
try {
|
|
1973
|
-
const
|
|
1974
|
-
username:
|
|
1975
|
-
password:
|
|
2066
|
+
const p = await $({
|
|
2067
|
+
username: f,
|
|
2068
|
+
password: y
|
|
1976
2069
|
// tenantId inferred from context automatically
|
|
1977
2070
|
});
|
|
1978
|
-
r == null || r(
|
|
1979
|
-
} catch (
|
|
1980
|
-
const
|
|
1981
|
-
|
|
2071
|
+
r == null || r(p);
|
|
2072
|
+
} catch (p) {
|
|
2073
|
+
const O = p.message || S.errorMessage;
|
|
2074
|
+
R(O), s == null || s(O);
|
|
1982
2075
|
} finally {
|
|
1983
|
-
|
|
2076
|
+
d(!1);
|
|
1984
2077
|
}
|
|
1985
2078
|
}
|
|
1986
|
-
},
|
|
1987
|
-
...
|
|
1988
|
-
...
|
|
1989
|
-
}),
|
|
1990
|
-
...
|
|
1991
|
-
...
|
|
1992
|
-
...!
|
|
2079
|
+
}, k = (a) => ({
|
|
2080
|
+
...M.input,
|
|
2081
|
+
...z[a] ? M.inputError : {}
|
|
2082
|
+
}), h = () => ({
|
|
2083
|
+
...M.button,
|
|
2084
|
+
...T ? M.buttonLoading : {},
|
|
2085
|
+
...!f || !y || T ? M.buttonDisabled : {}
|
|
1993
2086
|
});
|
|
1994
|
-
return /* @__PURE__ */
|
|
1995
|
-
/* @__PURE__ */ n("h2", { style:
|
|
1996
|
-
/* @__PURE__ */
|
|
1997
|
-
/* @__PURE__ */
|
|
1998
|
-
/* @__PURE__ */ n("label", { style:
|
|
2087
|
+
return /* @__PURE__ */ c("div", { className: m, style: M.container, children: [
|
|
2088
|
+
/* @__PURE__ */ n("h2", { style: M.title, children: S.title }),
|
|
2089
|
+
/* @__PURE__ */ c("form", { onSubmit: I, style: M.form, children: [
|
|
2090
|
+
/* @__PURE__ */ c("div", { style: M.fieldGroup, children: [
|
|
2091
|
+
/* @__PURE__ */ n("label", { style: M.label, children: S.usernameLabel }),
|
|
1999
2092
|
/* @__PURE__ */ n(
|
|
2000
2093
|
"input",
|
|
2001
2094
|
{
|
|
2002
2095
|
id: "username",
|
|
2003
2096
|
name: "username",
|
|
2004
2097
|
type: "text",
|
|
2005
|
-
value:
|
|
2006
|
-
onChange: (
|
|
2007
|
-
|
|
2098
|
+
value: f,
|
|
2099
|
+
onChange: (a) => {
|
|
2100
|
+
u(a.target.value), z.username && G((p) => ({ ...p, username: !1 }));
|
|
2008
2101
|
},
|
|
2009
|
-
placeholder:
|
|
2010
|
-
style:
|
|
2011
|
-
disabled:
|
|
2102
|
+
placeholder: S.usernamePlaceholder,
|
|
2103
|
+
style: k("username"),
|
|
2104
|
+
disabled: T
|
|
2012
2105
|
}
|
|
2013
2106
|
)
|
|
2014
2107
|
] }),
|
|
2015
|
-
/* @__PURE__ */
|
|
2016
|
-
/* @__PURE__ */ n("label", { style:
|
|
2017
|
-
/* @__PURE__ */
|
|
2108
|
+
/* @__PURE__ */ c("div", { style: M.fieldGroup, children: [
|
|
2109
|
+
/* @__PURE__ */ n("label", { style: M.label, children: S.passwordLabel }),
|
|
2110
|
+
/* @__PURE__ */ c("div", { style: M.inputContainer, children: [
|
|
2018
2111
|
/* @__PURE__ */ n(
|
|
2019
2112
|
"input",
|
|
2020
2113
|
{
|
|
2021
2114
|
id: "password",
|
|
2022
2115
|
name: "password",
|
|
2023
2116
|
type: C ? "text" : "password",
|
|
2024
|
-
value:
|
|
2025
|
-
onChange: (
|
|
2026
|
-
|
|
2117
|
+
value: y,
|
|
2118
|
+
onChange: (a) => {
|
|
2119
|
+
E(a.target.value), z.password && G((p) => ({ ...p, password: !1 }));
|
|
2027
2120
|
},
|
|
2028
|
-
placeholder:
|
|
2121
|
+
placeholder: S.passwordPlaceholder,
|
|
2029
2122
|
style: {
|
|
2030
|
-
...
|
|
2123
|
+
...k("password"),
|
|
2031
2124
|
paddingRight: "2.5rem"
|
|
2032
2125
|
// Make room for the icon
|
|
2033
2126
|
},
|
|
2034
|
-
disabled:
|
|
2127
|
+
disabled: T
|
|
2035
2128
|
}
|
|
2036
2129
|
),
|
|
2037
2130
|
/* @__PURE__ */ n(
|
|
2038
2131
|
"button",
|
|
2039
2132
|
{
|
|
2040
2133
|
type: "button",
|
|
2041
|
-
onClick: () =>
|
|
2042
|
-
style:
|
|
2043
|
-
disabled:
|
|
2134
|
+
onClick: () => q(!C),
|
|
2135
|
+
style: M.passwordToggle,
|
|
2136
|
+
disabled: T,
|
|
2044
2137
|
"aria-label": C ? "Hide password" : "Show password",
|
|
2045
2138
|
children: C ? L.hidePassword : L.showPassword
|
|
2046
2139
|
}
|
|
2047
2140
|
)
|
|
2048
2141
|
] })
|
|
2049
2142
|
] }),
|
|
2050
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !
|
|
2051
|
-
|
|
2143
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !f || !y || T, style: h(), children: T ? S.loadingText : S.submitButton }),
|
|
2144
|
+
P && /* @__PURE__ */ n("div", { style: M.errorText, children: P })
|
|
2052
2145
|
] }),
|
|
2053
|
-
(
|
|
2054
|
-
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
|
|
2146
|
+
(x || b || A) && /* @__PURE__ */ c("div", { style: M.linkContainer, children: [
|
|
2147
|
+
A && /* @__PURE__ */ c("div", { children: [
|
|
2148
|
+
/* @__PURE__ */ c("span", { style: M.divider, children: [
|
|
2149
|
+
S.magicLinkText,
|
|
2057
2150
|
" "
|
|
2058
2151
|
] }),
|
|
2059
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2152
|
+
/* @__PURE__ */ n("a", { onClick: w, style: M.link, children: S.magicLinkLink })
|
|
2060
2153
|
] }),
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
/* @__PURE__ */
|
|
2066
|
-
|
|
2154
|
+
A && (x || b) && /* @__PURE__ */ n("div", { style: M.divider, children: "•" }),
|
|
2155
|
+
x && /* @__PURE__ */ n("a", { onClick: o, style: M.link, children: S.forgotPasswordLink }),
|
|
2156
|
+
x && b && /* @__PURE__ */ n("div", { style: M.divider, children: "•" }),
|
|
2157
|
+
b && /* @__PURE__ */ c("div", { children: [
|
|
2158
|
+
/* @__PURE__ */ c("span", { style: M.divider, children: [
|
|
2159
|
+
S.signupText,
|
|
2067
2160
|
" "
|
|
2068
2161
|
] }),
|
|
2069
|
-
/* @__PURE__ */ n("a", { onClick: g, style:
|
|
2162
|
+
/* @__PURE__ */ n("a", { onClick: g, style: M.link, children: S.signupLink })
|
|
2070
2163
|
] })
|
|
2071
2164
|
] })
|
|
2072
2165
|
] });
|
|
2073
2166
|
}
|
|
2074
|
-
const
|
|
2167
|
+
const gt = {
|
|
2075
2168
|
title: "Create Account",
|
|
2076
2169
|
nameLabel: "First Name",
|
|
2077
2170
|
namePlaceholder: "Enter your first name",
|
|
@@ -2097,7 +2190,7 @@ const st = {
|
|
|
2097
2190
|
passwordMismatchError: "Passwords do not match",
|
|
2098
2191
|
isAdminLabel: "Create new organization",
|
|
2099
2192
|
isAdminDescription: "Check this if you want to create a new organization"
|
|
2100
|
-
},
|
|
2193
|
+
}, pt = {
|
|
2101
2194
|
container: {
|
|
2102
2195
|
maxWidth: "400px",
|
|
2103
2196
|
width: "100%",
|
|
@@ -2196,7 +2289,7 @@ const st = {
|
|
|
2196
2289
|
fontSize: "0.875rem"
|
|
2197
2290
|
}
|
|
2198
2291
|
};
|
|
2199
|
-
function
|
|
2292
|
+
function Gt({
|
|
2200
2293
|
copy: i = {},
|
|
2201
2294
|
styles: e = {},
|
|
2202
2295
|
signupType: t = "user",
|
|
@@ -2204,113 +2297,113 @@ function Bt({
|
|
|
2204
2297
|
onError: s,
|
|
2205
2298
|
onLoginClick: o,
|
|
2206
2299
|
onMagicLinkClick: g,
|
|
2207
|
-
showLoginLink:
|
|
2208
|
-
showMagicLinkOption:
|
|
2209
|
-
className:
|
|
2300
|
+
showLoginLink: w = !0,
|
|
2301
|
+
showMagicLinkOption: x = !0,
|
|
2302
|
+
className: b
|
|
2210
2303
|
}) {
|
|
2211
|
-
const [
|
|
2304
|
+
const [A, m] = v(""), [f, u] = v(""), [y, E] = v(""), [C, q] = v(""), [T, d] = v(""), [P, R] = v(""), [z, G] = v(""), [$, _] = v(!1), [S, M] = v(""), [L, l] = v({}), { signup: I, signupTenantAdmin: k } = ae(), { tenant: h } = se(), a = { ...gt, ...i }, p = { ...pt, ...e }, O = () => {
|
|
2212
2305
|
const D = {};
|
|
2213
|
-
return
|
|
2214
|
-
},
|
|
2215
|
-
if (D.preventDefault(), !!
|
|
2216
|
-
if (
|
|
2217
|
-
|
|
2306
|
+
return A.trim() || (D.name = !0), !y.trim() && !C.trim() && (D.email = !0, D.phoneNumber = !0), T.trim() || (D.password = !0), P.trim() || (D.confirmPassword = !0), t === "tenant" && !z.trim() && (D.tenantName = !0), l(D), Object.keys(D).length === 0;
|
|
2307
|
+
}, K = async (D) => {
|
|
2308
|
+
if (D.preventDefault(), !!O()) {
|
|
2309
|
+
if (T !== P) {
|
|
2310
|
+
M(a.passwordMismatchError), l({ confirmPassword: !0 });
|
|
2218
2311
|
return;
|
|
2219
2312
|
}
|
|
2220
|
-
if (t === "user" && !(
|
|
2221
|
-
|
|
2313
|
+
if (t === "user" && !(h != null && h.id)) {
|
|
2314
|
+
M("Tenant not found");
|
|
2222
2315
|
return;
|
|
2223
2316
|
}
|
|
2224
|
-
|
|
2317
|
+
_(!0), M("");
|
|
2225
2318
|
try {
|
|
2226
|
-
let
|
|
2227
|
-
t === "tenant" ?
|
|
2228
|
-
email:
|
|
2319
|
+
let J;
|
|
2320
|
+
t === "tenant" ? J = await k({
|
|
2321
|
+
email: y || void 0,
|
|
2229
2322
|
phoneNumber: C || void 0,
|
|
2230
|
-
name:
|
|
2231
|
-
password:
|
|
2232
|
-
tenantName:
|
|
2233
|
-
lastName:
|
|
2234
|
-
}) :
|
|
2235
|
-
email:
|
|
2323
|
+
name: A,
|
|
2324
|
+
password: T,
|
|
2325
|
+
tenantName: z,
|
|
2326
|
+
lastName: f || void 0
|
|
2327
|
+
}) : J = await I({
|
|
2328
|
+
email: y || void 0,
|
|
2236
2329
|
phoneNumber: C || void 0,
|
|
2237
|
-
name:
|
|
2238
|
-
password:
|
|
2239
|
-
tenantId:
|
|
2240
|
-
lastName:
|
|
2241
|
-
}), r == null || r(
|
|
2242
|
-
} catch (
|
|
2243
|
-
const ge =
|
|
2244
|
-
|
|
2330
|
+
name: A,
|
|
2331
|
+
password: T,
|
|
2332
|
+
tenantId: h.id,
|
|
2333
|
+
lastName: f || void 0
|
|
2334
|
+
}), r == null || r(J);
|
|
2335
|
+
} catch (J) {
|
|
2336
|
+
const ge = J.message || a.errorMessage;
|
|
2337
|
+
M(ge), s == null || s(ge);
|
|
2245
2338
|
} finally {
|
|
2246
|
-
|
|
2339
|
+
_(!1);
|
|
2247
2340
|
}
|
|
2248
2341
|
}
|
|
2249
|
-
},
|
|
2250
|
-
...
|
|
2251
|
-
...L[D] ?
|
|
2252
|
-
}),
|
|
2253
|
-
...
|
|
2254
|
-
...$ ?
|
|
2255
|
-
...!
|
|
2256
|
-
}),
|
|
2257
|
-
return /* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
/* @__PURE__ */
|
|
2261
|
-
/* @__PURE__ */ n("label", { style:
|
|
2342
|
+
}, H = (D) => ({
|
|
2343
|
+
...p.input,
|
|
2344
|
+
...L[D] ? p.inputError : {}
|
|
2345
|
+
}), N = () => ({
|
|
2346
|
+
...p.button,
|
|
2347
|
+
...$ ? p.buttonLoading : {},
|
|
2348
|
+
...!A || !y && !C || !T || !P || $ || t === "tenant" && !z ? p.buttonDisabled : {}
|
|
2349
|
+
}), W = A && (y || C) && T && P && (t === "user" || z);
|
|
2350
|
+
return /* @__PURE__ */ c("div", { className: b, style: p.container, children: [
|
|
2351
|
+
/* @__PURE__ */ n("h2", { style: p.title, children: a.title }),
|
|
2352
|
+
/* @__PURE__ */ c("form", { onSubmit: K, style: p.form, children: [
|
|
2353
|
+
/* @__PURE__ */ c("div", { style: p.fieldGroup, children: [
|
|
2354
|
+
/* @__PURE__ */ n("label", { style: p.label, children: a.nameLabel }),
|
|
2262
2355
|
/* @__PURE__ */ n(
|
|
2263
2356
|
"input",
|
|
2264
2357
|
{
|
|
2265
2358
|
id: "name",
|
|
2266
2359
|
name: "name",
|
|
2267
2360
|
type: "text",
|
|
2268
|
-
value:
|
|
2361
|
+
value: A,
|
|
2269
2362
|
onChange: (D) => {
|
|
2270
|
-
|
|
2363
|
+
m(D.target.value), L.name && l((J) => ({ ...J, name: !1 }));
|
|
2271
2364
|
},
|
|
2272
|
-
placeholder:
|
|
2273
|
-
style:
|
|
2365
|
+
placeholder: a.namePlaceholder,
|
|
2366
|
+
style: H("name"),
|
|
2274
2367
|
disabled: $
|
|
2275
2368
|
}
|
|
2276
2369
|
)
|
|
2277
2370
|
] }),
|
|
2278
|
-
/* @__PURE__ */
|
|
2279
|
-
/* @__PURE__ */ n("label", { style:
|
|
2371
|
+
/* @__PURE__ */ c("div", { style: p.fieldGroup, children: [
|
|
2372
|
+
/* @__PURE__ */ n("label", { style: p.label, children: a.lastNameLabel }),
|
|
2280
2373
|
/* @__PURE__ */ n(
|
|
2281
2374
|
"input",
|
|
2282
2375
|
{
|
|
2283
2376
|
id: "lastName",
|
|
2284
2377
|
name: "lastName",
|
|
2285
2378
|
type: "text",
|
|
2286
|
-
value:
|
|
2287
|
-
onChange: (D) =>
|
|
2288
|
-
placeholder:
|
|
2289
|
-
style:
|
|
2379
|
+
value: f,
|
|
2380
|
+
onChange: (D) => u(D.target.value),
|
|
2381
|
+
placeholder: a.lastNamePlaceholder,
|
|
2382
|
+
style: p.input,
|
|
2290
2383
|
disabled: $
|
|
2291
2384
|
}
|
|
2292
2385
|
)
|
|
2293
2386
|
] }),
|
|
2294
|
-
/* @__PURE__ */
|
|
2295
|
-
/* @__PURE__ */ n("label", { style:
|
|
2387
|
+
/* @__PURE__ */ c("div", { style: p.fieldGroup, children: [
|
|
2388
|
+
/* @__PURE__ */ n("label", { style: p.label, children: a.emailLabel }),
|
|
2296
2389
|
/* @__PURE__ */ n(
|
|
2297
2390
|
"input",
|
|
2298
2391
|
{
|
|
2299
2392
|
id: "email",
|
|
2300
2393
|
name: "email",
|
|
2301
2394
|
type: "email",
|
|
2302
|
-
value:
|
|
2395
|
+
value: y,
|
|
2303
2396
|
onChange: (D) => {
|
|
2304
|
-
|
|
2397
|
+
E(D.target.value), L.email && l((J) => ({ ...J, email: !1, phoneNumber: !1 }));
|
|
2305
2398
|
},
|
|
2306
|
-
placeholder:
|
|
2307
|
-
style:
|
|
2399
|
+
placeholder: a.emailPlaceholder,
|
|
2400
|
+
style: H("email"),
|
|
2308
2401
|
disabled: $
|
|
2309
2402
|
}
|
|
2310
2403
|
)
|
|
2311
2404
|
] }),
|
|
2312
|
-
/* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */ n("label", { style:
|
|
2405
|
+
/* @__PURE__ */ c("div", { style: p.fieldGroup, children: [
|
|
2406
|
+
/* @__PURE__ */ n("label", { style: p.label, children: a.phoneNumberLabel }),
|
|
2314
2407
|
/* @__PURE__ */ n(
|
|
2315
2408
|
"input",
|
|
2316
2409
|
{
|
|
@@ -2319,10 +2412,10 @@ function Bt({
|
|
|
2319
2412
|
type: "tel",
|
|
2320
2413
|
value: C,
|
|
2321
2414
|
onChange: (D) => {
|
|
2322
|
-
|
|
2415
|
+
q(D.target.value), L.phoneNumber && l((J) => ({ ...J, email: !1, phoneNumber: !1 }));
|
|
2323
2416
|
},
|
|
2324
|
-
placeholder:
|
|
2325
|
-
style:
|
|
2417
|
+
placeholder: a.phoneNumberPlaceholder,
|
|
2418
|
+
style: H("phoneNumber"),
|
|
2326
2419
|
disabled: $
|
|
2327
2420
|
}
|
|
2328
2421
|
)
|
|
@@ -2339,83 +2432,83 @@ function Bt({
|
|
|
2339
2432
|
children: "At least one contact method (email or phone) is required"
|
|
2340
2433
|
}
|
|
2341
2434
|
),
|
|
2342
|
-
/* @__PURE__ */
|
|
2343
|
-
/* @__PURE__ */ n("label", { style:
|
|
2435
|
+
/* @__PURE__ */ c("div", { style: p.fieldGroup, children: [
|
|
2436
|
+
/* @__PURE__ */ n("label", { style: p.label, children: a.passwordLabel }),
|
|
2344
2437
|
/* @__PURE__ */ n(
|
|
2345
2438
|
"input",
|
|
2346
2439
|
{
|
|
2347
2440
|
id: "password",
|
|
2348
2441
|
name: "password",
|
|
2349
2442
|
type: "password",
|
|
2350
|
-
value:
|
|
2443
|
+
value: T,
|
|
2351
2444
|
onChange: (D) => {
|
|
2352
|
-
|
|
2445
|
+
d(D.target.value), L.password && l((J) => ({ ...J, password: !1 }));
|
|
2353
2446
|
},
|
|
2354
|
-
placeholder:
|
|
2355
|
-
style:
|
|
2447
|
+
placeholder: a.passwordPlaceholder,
|
|
2448
|
+
style: H("password"),
|
|
2356
2449
|
disabled: $
|
|
2357
2450
|
}
|
|
2358
2451
|
)
|
|
2359
2452
|
] }),
|
|
2360
|
-
/* @__PURE__ */
|
|
2361
|
-
/* @__PURE__ */ n("label", { style:
|
|
2453
|
+
/* @__PURE__ */ c("div", { style: p.fieldGroup, children: [
|
|
2454
|
+
/* @__PURE__ */ n("label", { style: p.label, children: a.confirmPasswordLabel }),
|
|
2362
2455
|
/* @__PURE__ */ n(
|
|
2363
2456
|
"input",
|
|
2364
2457
|
{
|
|
2365
2458
|
id: "confirmPassword",
|
|
2366
2459
|
name: "confirmPassword",
|
|
2367
2460
|
type: "password",
|
|
2368
|
-
value:
|
|
2461
|
+
value: P,
|
|
2369
2462
|
onChange: (D) => {
|
|
2370
|
-
|
|
2463
|
+
R(D.target.value), L.confirmPassword && l((J) => ({ ...J, confirmPassword: !1 })), S === a.passwordMismatchError && M("");
|
|
2371
2464
|
},
|
|
2372
|
-
placeholder:
|
|
2373
|
-
style:
|
|
2465
|
+
placeholder: a.confirmPasswordPlaceholder,
|
|
2466
|
+
style: H("confirmPassword"),
|
|
2374
2467
|
disabled: $
|
|
2375
2468
|
}
|
|
2376
2469
|
)
|
|
2377
2470
|
] }),
|
|
2378
|
-
t === "tenant" && /* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */ n("label", { style:
|
|
2471
|
+
t === "tenant" && /* @__PURE__ */ c("div", { style: p.fieldGroup, children: [
|
|
2472
|
+
/* @__PURE__ */ n("label", { style: p.label, children: a.tenantNameLabel }),
|
|
2380
2473
|
/* @__PURE__ */ n(
|
|
2381
2474
|
"input",
|
|
2382
2475
|
{
|
|
2383
2476
|
id: "tenantName",
|
|
2384
2477
|
name: "tenantName",
|
|
2385
2478
|
type: "text",
|
|
2386
|
-
value:
|
|
2479
|
+
value: z,
|
|
2387
2480
|
onChange: (D) => {
|
|
2388
|
-
|
|
2481
|
+
G(D.target.value), L.tenantName && l((J) => ({ ...J, tenantName: !1 }));
|
|
2389
2482
|
},
|
|
2390
|
-
placeholder:
|
|
2391
|
-
style:
|
|
2483
|
+
placeholder: a.tenantNamePlaceholder,
|
|
2484
|
+
style: H("tenantName"),
|
|
2392
2485
|
disabled: $
|
|
2393
2486
|
}
|
|
2394
2487
|
)
|
|
2395
2488
|
] }),
|
|
2396
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !
|
|
2397
|
-
|
|
2489
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !W || $, style: N(), children: $ ? a.loadingText : a.submitButton }),
|
|
2490
|
+
S && /* @__PURE__ */ n("div", { style: p.errorText, children: S })
|
|
2398
2491
|
] }),
|
|
2399
|
-
(
|
|
2400
|
-
|
|
2401
|
-
/* @__PURE__ */
|
|
2402
|
-
|
|
2492
|
+
(w || x) && /* @__PURE__ */ c("div", { style: p.linkContainer, children: [
|
|
2493
|
+
x && /* @__PURE__ */ c("div", { children: [
|
|
2494
|
+
/* @__PURE__ */ c("span", { style: p.divider, children: [
|
|
2495
|
+
a.magicLinkText,
|
|
2403
2496
|
" "
|
|
2404
2497
|
] }),
|
|
2405
|
-
/* @__PURE__ */ n("a", { onClick: g, style:
|
|
2498
|
+
/* @__PURE__ */ n("a", { onClick: g, style: p.link, children: a.magicLinkLink })
|
|
2406
2499
|
] }),
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
/* @__PURE__ */
|
|
2410
|
-
|
|
2500
|
+
x && w && /* @__PURE__ */ n("div", { style: p.divider, children: "•" }),
|
|
2501
|
+
w && /* @__PURE__ */ c("div", { children: [
|
|
2502
|
+
/* @__PURE__ */ c("span", { style: p.divider, children: [
|
|
2503
|
+
a.loginText,
|
|
2411
2504
|
" "
|
|
2412
2505
|
] }),
|
|
2413
|
-
/* @__PURE__ */ n("a", { onClick: o, style:
|
|
2506
|
+
/* @__PURE__ */ n("a", { onClick: o, style: p.link, children: a.loginLink })
|
|
2414
2507
|
] })
|
|
2415
2508
|
] })
|
|
2416
2509
|
] });
|
|
2417
2510
|
}
|
|
2418
|
-
const
|
|
2511
|
+
const ft = {
|
|
2419
2512
|
title: "Sign In with Magic Link",
|
|
2420
2513
|
emailLabel: "Email",
|
|
2421
2514
|
emailPlaceholder: "Enter your email",
|
|
@@ -2433,7 +2526,7 @@ const ot = {
|
|
|
2433
2526
|
loadingText: "Sending magic link...",
|
|
2434
2527
|
verifyingText: "Verifying magic link...",
|
|
2435
2528
|
description: "Enter your email to receive a magic link. If you don't have an account, we'll create one for you."
|
|
2436
|
-
},
|
|
2529
|
+
}, mt = {
|
|
2437
2530
|
container: {
|
|
2438
2531
|
maxWidth: "400px",
|
|
2439
2532
|
width: "100%",
|
|
@@ -2536,7 +2629,7 @@ const ot = {
|
|
|
2536
2629
|
fontSize: "0.875rem"
|
|
2537
2630
|
}
|
|
2538
2631
|
};
|
|
2539
|
-
function
|
|
2632
|
+
function Kt({
|
|
2540
2633
|
copy: i = {},
|
|
2541
2634
|
styles: e = {},
|
|
2542
2635
|
onSuccess: t,
|
|
@@ -2544,97 +2637,97 @@ function Ut({
|
|
|
2544
2637
|
onLoginClick: s,
|
|
2545
2638
|
onSignupClick: o,
|
|
2546
2639
|
showTraditionalLinks: g = !0,
|
|
2547
|
-
className:
|
|
2548
|
-
verifyToken:
|
|
2549
|
-
frontendUrl:
|
|
2640
|
+
className: w,
|
|
2641
|
+
verifyToken: x,
|
|
2642
|
+
frontendUrl: b
|
|
2550
2643
|
}) {
|
|
2551
|
-
const [
|
|
2644
|
+
const [A, m] = v(""), [f, u] = v(""), [y, E] = v(""), [C, q] = v(!1), [T, d] = v(!1), [P, R] = v(""), [z, G] = v(""), [$, _] = v({}), [S, M] = v(!1), { sendMagicLink: L, verifyMagicLink: l } = ae(), { tenant: I } = se(), k = { ...ft, ...i }, h = { ...mt, ...e };
|
|
2552
2645
|
te(() => {
|
|
2553
|
-
|
|
2554
|
-
}, [
|
|
2555
|
-
const
|
|
2556
|
-
if (!
|
|
2557
|
-
|
|
2646
|
+
x && a(x);
|
|
2647
|
+
}, [x]);
|
|
2648
|
+
const a = async (N) => {
|
|
2649
|
+
if (!I || !A) {
|
|
2650
|
+
R("Missing tenant or email");
|
|
2558
2651
|
return;
|
|
2559
2652
|
}
|
|
2560
|
-
|
|
2653
|
+
d(!0), R("");
|
|
2561
2654
|
try {
|
|
2562
|
-
const
|
|
2563
|
-
token:
|
|
2564
|
-
email:
|
|
2655
|
+
const W = await l({
|
|
2656
|
+
token: N,
|
|
2657
|
+
email: A
|
|
2565
2658
|
// tenantId inferred from context automatically
|
|
2566
2659
|
});
|
|
2567
|
-
t == null || t(
|
|
2568
|
-
} catch (
|
|
2569
|
-
const D =
|
|
2570
|
-
|
|
2660
|
+
t == null || t(W);
|
|
2661
|
+
} catch (W) {
|
|
2662
|
+
const D = W.message || "Failed to verify magic link";
|
|
2663
|
+
R(D), r == null || r(D);
|
|
2571
2664
|
} finally {
|
|
2572
|
-
|
|
2665
|
+
d(!1);
|
|
2573
2666
|
}
|
|
2574
|
-
},
|
|
2575
|
-
const
|
|
2576
|
-
return
|
|
2577
|
-
},
|
|
2578
|
-
if (
|
|
2579
|
-
if (!(
|
|
2580
|
-
|
|
2667
|
+
}, p = () => {
|
|
2668
|
+
const N = {};
|
|
2669
|
+
return A.trim() || (N.email = !0), S && !f.trim() && (N.name = !0), _(N), Object.keys(N).length === 0;
|
|
2670
|
+
}, O = async (N) => {
|
|
2671
|
+
if (N.preventDefault(), !!p()) {
|
|
2672
|
+
if (!(I != null && I.id)) {
|
|
2673
|
+
R("Tenant not found");
|
|
2581
2674
|
return;
|
|
2582
2675
|
}
|
|
2583
|
-
|
|
2676
|
+
q(!0), R(""), G("");
|
|
2584
2677
|
try {
|
|
2585
|
-
const
|
|
2586
|
-
email:
|
|
2587
|
-
tenantId:
|
|
2588
|
-
frontendUrl:
|
|
2589
|
-
name:
|
|
2590
|
-
lastName:
|
|
2678
|
+
const W = b || (typeof window < "u" ? window.location.origin : ""), D = await L({
|
|
2679
|
+
email: A,
|
|
2680
|
+
tenantId: I.id,
|
|
2681
|
+
frontendUrl: W,
|
|
2682
|
+
name: S ? f : void 0,
|
|
2683
|
+
lastName: S ? y : void 0
|
|
2591
2684
|
});
|
|
2592
|
-
|
|
2593
|
-
} catch (
|
|
2594
|
-
const D =
|
|
2595
|
-
|
|
2685
|
+
G(k.successMessage), t == null || t(D);
|
|
2686
|
+
} catch (W) {
|
|
2687
|
+
const D = W.message || k.errorMessage;
|
|
2688
|
+
R(D), r == null || r(D);
|
|
2596
2689
|
} finally {
|
|
2597
|
-
|
|
2690
|
+
q(!1);
|
|
2598
2691
|
}
|
|
2599
2692
|
}
|
|
2600
|
-
},
|
|
2601
|
-
...
|
|
2602
|
-
...$[
|
|
2603
|
-
}),
|
|
2604
|
-
...
|
|
2605
|
-
...C ||
|
|
2606
|
-
...!
|
|
2693
|
+
}, K = (N) => ({
|
|
2694
|
+
...h.input,
|
|
2695
|
+
...$[N] ? h.inputError : {}
|
|
2696
|
+
}), H = () => ({
|
|
2697
|
+
...h.button,
|
|
2698
|
+
...C || T ? h.buttonLoading : {},
|
|
2699
|
+
...!A || C || T ? h.buttonDisabled : {}
|
|
2607
2700
|
});
|
|
2608
|
-
return
|
|
2609
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2701
|
+
return T ? /* @__PURE__ */ c("div", { className: w, style: h.container, children: [
|
|
2702
|
+
/* @__PURE__ */ n("h2", { style: h.title, children: k.verifyingText }),
|
|
2610
2703
|
/* @__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..." }) })
|
|
2611
|
-
] }) : /* @__PURE__ */
|
|
2612
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2613
|
-
/* @__PURE__ */ n("p", { style:
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
/* @__PURE__ */
|
|
2616
|
-
/* @__PURE__ */ n("label", { style:
|
|
2704
|
+
] }) : /* @__PURE__ */ c("div", { className: w, style: h.container, children: [
|
|
2705
|
+
/* @__PURE__ */ n("h2", { style: h.title, children: k.title }),
|
|
2706
|
+
/* @__PURE__ */ n("p", { style: h.description, children: k.description }),
|
|
2707
|
+
/* @__PURE__ */ c("form", { onSubmit: O, style: h.form, children: [
|
|
2708
|
+
/* @__PURE__ */ c("div", { style: h.fieldGroup, children: [
|
|
2709
|
+
/* @__PURE__ */ n("label", { style: h.label, children: k.emailLabel }),
|
|
2617
2710
|
/* @__PURE__ */ n(
|
|
2618
2711
|
"input",
|
|
2619
2712
|
{
|
|
2620
2713
|
id: "email",
|
|
2621
2714
|
name: "email",
|
|
2622
2715
|
type: "email",
|
|
2623
|
-
value:
|
|
2624
|
-
onChange: (
|
|
2625
|
-
|
|
2716
|
+
value: A,
|
|
2717
|
+
onChange: (N) => {
|
|
2718
|
+
m(N.target.value), $.email && _((W) => ({ ...W, email: !1 }));
|
|
2626
2719
|
},
|
|
2627
|
-
placeholder:
|
|
2628
|
-
style:
|
|
2629
|
-
disabled: C ||
|
|
2720
|
+
placeholder: k.emailPlaceholder,
|
|
2721
|
+
style: K("email"),
|
|
2722
|
+
disabled: C || T
|
|
2630
2723
|
}
|
|
2631
2724
|
)
|
|
2632
2725
|
] }),
|
|
2633
|
-
!
|
|
2726
|
+
!S && /* @__PURE__ */ n("div", { style: { textAlign: "center", marginTop: "0.5rem" }, children: /* @__PURE__ */ n(
|
|
2634
2727
|
"button",
|
|
2635
2728
|
{
|
|
2636
2729
|
type: "button",
|
|
2637
|
-
onClick: () =>
|
|
2730
|
+
onClick: () => M(!0),
|
|
2638
2731
|
style: {
|
|
2639
2732
|
background: "none",
|
|
2640
2733
|
border: "none",
|
|
@@ -2646,38 +2739,38 @@ function Ut({
|
|
|
2646
2739
|
children: "New user? Add your name"
|
|
2647
2740
|
}
|
|
2648
2741
|
) }),
|
|
2649
|
-
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
/* @__PURE__ */ n("label", { style:
|
|
2742
|
+
S && /* @__PURE__ */ c(B, { children: [
|
|
2743
|
+
/* @__PURE__ */ c("div", { style: h.fieldGroup, children: [
|
|
2744
|
+
/* @__PURE__ */ n("label", { style: h.label, children: k.nameLabel }),
|
|
2652
2745
|
/* @__PURE__ */ n(
|
|
2653
2746
|
"input",
|
|
2654
2747
|
{
|
|
2655
2748
|
id: "name",
|
|
2656
2749
|
name: "name",
|
|
2657
2750
|
type: "text",
|
|
2658
|
-
value:
|
|
2659
|
-
onChange: (
|
|
2660
|
-
|
|
2751
|
+
value: f,
|
|
2752
|
+
onChange: (N) => {
|
|
2753
|
+
u(N.target.value), $.name && _((W) => ({ ...W, name: !1 }));
|
|
2661
2754
|
},
|
|
2662
|
-
placeholder:
|
|
2663
|
-
style:
|
|
2664
|
-
disabled: C ||
|
|
2755
|
+
placeholder: k.namePlaceholder,
|
|
2756
|
+
style: K("name"),
|
|
2757
|
+
disabled: C || T
|
|
2665
2758
|
}
|
|
2666
2759
|
)
|
|
2667
2760
|
] }),
|
|
2668
|
-
/* @__PURE__ */
|
|
2669
|
-
/* @__PURE__ */ n("label", { style:
|
|
2761
|
+
/* @__PURE__ */ c("div", { style: h.fieldGroup, children: [
|
|
2762
|
+
/* @__PURE__ */ n("label", { style: h.label, children: k.lastNameLabel }),
|
|
2670
2763
|
/* @__PURE__ */ n(
|
|
2671
2764
|
"input",
|
|
2672
2765
|
{
|
|
2673
2766
|
id: "lastName",
|
|
2674
2767
|
name: "lastName",
|
|
2675
2768
|
type: "text",
|
|
2676
|
-
value:
|
|
2677
|
-
onChange: (
|
|
2678
|
-
placeholder:
|
|
2679
|
-
style:
|
|
2680
|
-
disabled: C ||
|
|
2769
|
+
value: y,
|
|
2770
|
+
onChange: (N) => E(N.target.value),
|
|
2771
|
+
placeholder: k.lastNamePlaceholder,
|
|
2772
|
+
style: h.input,
|
|
2773
|
+
disabled: C || T
|
|
2681
2774
|
}
|
|
2682
2775
|
)
|
|
2683
2776
|
] }),
|
|
@@ -2686,7 +2779,7 @@ function Ut({
|
|
|
2686
2779
|
{
|
|
2687
2780
|
type: "button",
|
|
2688
2781
|
onClick: () => {
|
|
2689
|
-
|
|
2782
|
+
M(!1), u(""), E("");
|
|
2690
2783
|
},
|
|
2691
2784
|
style: {
|
|
2692
2785
|
background: "none",
|
|
@@ -2700,30 +2793,30 @@ function Ut({
|
|
|
2700
2793
|
}
|
|
2701
2794
|
) })
|
|
2702
2795
|
] }),
|
|
2703
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !
|
|
2704
|
-
|
|
2705
|
-
|
|
2796
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !A || C || T, style: H(), children: C ? k.loadingText : k.submitButton }),
|
|
2797
|
+
P && /* @__PURE__ */ n("div", { style: h.errorText, children: P }),
|
|
2798
|
+
z && /* @__PURE__ */ n("div", { style: h.successText, children: z })
|
|
2706
2799
|
] }),
|
|
2707
|
-
g && /* @__PURE__ */
|
|
2708
|
-
/* @__PURE__ */
|
|
2709
|
-
/* @__PURE__ */
|
|
2710
|
-
|
|
2800
|
+
g && /* @__PURE__ */ c("div", { style: h.linkContainer, children: [
|
|
2801
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2802
|
+
/* @__PURE__ */ c("span", { style: h.divider, children: [
|
|
2803
|
+
k.loginText,
|
|
2711
2804
|
" "
|
|
2712
2805
|
] }),
|
|
2713
|
-
/* @__PURE__ */ n("a", { onClick: s, style:
|
|
2806
|
+
/* @__PURE__ */ n("a", { onClick: s, style: h.link, children: k.loginLink })
|
|
2714
2807
|
] }),
|
|
2715
|
-
/* @__PURE__ */ n("div", { style:
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
|
|
2808
|
+
/* @__PURE__ */ n("div", { style: h.divider, children: "•" }),
|
|
2809
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2810
|
+
/* @__PURE__ */ c("span", { style: h.divider, children: [
|
|
2811
|
+
k.signupText,
|
|
2719
2812
|
" "
|
|
2720
2813
|
] }),
|
|
2721
|
-
/* @__PURE__ */ n("a", { onClick: o, style:
|
|
2814
|
+
/* @__PURE__ */ n("a", { onClick: o, style: h.link, children: k.signupLink })
|
|
2722
2815
|
] })
|
|
2723
2816
|
] })
|
|
2724
2817
|
] });
|
|
2725
2818
|
}
|
|
2726
|
-
const
|
|
2819
|
+
const yt = {
|
|
2727
2820
|
title: "Verifying Magic Link",
|
|
2728
2821
|
verifyingMessage: "Please wait while we verify your magic link...",
|
|
2729
2822
|
successMessage: "Magic link verified successfully! You are now logged in.",
|
|
@@ -2818,7 +2911,7 @@ const lt = {
|
|
|
2818
2911
|
cursor: "pointer",
|
|
2819
2912
|
transition: "all 0.15s ease-in-out"
|
|
2820
2913
|
}
|
|
2821
|
-
},
|
|
2914
|
+
}, wt = () => /* @__PURE__ */ n("div", { style: Ee.spinner }), bt = () => /* @__PURE__ */ c(
|
|
2822
2915
|
"svg",
|
|
2823
2916
|
{
|
|
2824
2917
|
width: "48",
|
|
@@ -2835,7 +2928,7 @@ const lt = {
|
|
|
2835
2928
|
/* @__PURE__ */ n("polyline", { points: "22,4 12,14.01 9,11.01" })
|
|
2836
2929
|
]
|
|
2837
2930
|
}
|
|
2838
|
-
),
|
|
2931
|
+
), St = () => /* @__PURE__ */ c(
|
|
2839
2932
|
"svg",
|
|
2840
2933
|
{
|
|
2841
2934
|
width: "48",
|
|
@@ -2853,12 +2946,12 @@ const lt = {
|
|
|
2853
2946
|
/* @__PURE__ */ n("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
2854
2947
|
]
|
|
2855
2948
|
}
|
|
2856
|
-
),
|
|
2857
|
-
loading: /* @__PURE__ */ n(
|
|
2858
|
-
success: /* @__PURE__ */ n(
|
|
2859
|
-
error: /* @__PURE__ */ n(
|
|
2949
|
+
), vt = {
|
|
2950
|
+
loading: /* @__PURE__ */ n(wt, {}),
|
|
2951
|
+
success: /* @__PURE__ */ n(bt, {}),
|
|
2952
|
+
error: /* @__PURE__ */ n(St, {})
|
|
2860
2953
|
};
|
|
2861
|
-
function
|
|
2954
|
+
function Jt({
|
|
2862
2955
|
copy: i = {},
|
|
2863
2956
|
styles: e = {},
|
|
2864
2957
|
icons: t = {},
|
|
@@ -2866,96 +2959,96 @@ function qt({
|
|
|
2866
2959
|
onError: s,
|
|
2867
2960
|
onRetry: o,
|
|
2868
2961
|
onBackToLogin: g,
|
|
2869
|
-
className:
|
|
2870
|
-
token:
|
|
2871
|
-
email:
|
|
2872
|
-
appId:
|
|
2873
|
-
tenantSlug:
|
|
2874
|
-
autoRedirectDelay:
|
|
2962
|
+
className: w,
|
|
2963
|
+
token: x,
|
|
2964
|
+
email: b,
|
|
2965
|
+
appId: A,
|
|
2966
|
+
tenantSlug: m,
|
|
2967
|
+
autoRedirectDelay: f = 3e3
|
|
2875
2968
|
}) {
|
|
2876
|
-
const [
|
|
2969
|
+
const [u, y] = v("verifying"), [E, C] = v(""), { verifyMagicLink: q } = ae(), T = { ...yt, ...i }, d = { ...Ee, ...e }, P = { ...vt, ...t }, R = () => {
|
|
2877
2970
|
if (typeof window > "u") return {};
|
|
2878
|
-
const
|
|
2971
|
+
const S = new URLSearchParams(window.location.search);
|
|
2879
2972
|
return {
|
|
2880
|
-
token:
|
|
2881
|
-
email:
|
|
2882
|
-
appId:
|
|
2883
|
-
tenantSlug:
|
|
2973
|
+
token: x || S.get("token") || "",
|
|
2974
|
+
email: b || S.get("email") || "",
|
|
2975
|
+
appId: A || S.get("appId") || "",
|
|
2976
|
+
tenantSlug: m || S.get("tenantSlug") || void 0
|
|
2884
2977
|
};
|
|
2885
|
-
},
|
|
2886
|
-
|
|
2978
|
+
}, z = async () => {
|
|
2979
|
+
y("verifying"), C("");
|
|
2887
2980
|
try {
|
|
2888
|
-
const
|
|
2889
|
-
if (!
|
|
2981
|
+
const S = R();
|
|
2982
|
+
if (!S.token || !S.email)
|
|
2890
2983
|
throw new Error("Missing required parameters: token or email");
|
|
2891
|
-
const
|
|
2892
|
-
token:
|
|
2893
|
-
email:
|
|
2894
|
-
tenantSlug:
|
|
2984
|
+
const M = await q({
|
|
2985
|
+
token: S.token,
|
|
2986
|
+
email: S.email,
|
|
2987
|
+
tenantSlug: S.tenantSlug
|
|
2895
2988
|
});
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
},
|
|
2899
|
-
} catch (
|
|
2900
|
-
const
|
|
2901
|
-
C(
|
|
2989
|
+
y("success"), r == null || r(M), f > 0 && setTimeout(() => {
|
|
2990
|
+
y("redirecting");
|
|
2991
|
+
}, f);
|
|
2992
|
+
} catch (S) {
|
|
2993
|
+
const M = S.message || T.errorMessage;
|
|
2994
|
+
C(M), y("error"), s == null || s(M);
|
|
2902
2995
|
}
|
|
2903
|
-
},
|
|
2904
|
-
o == null || o(),
|
|
2996
|
+
}, G = () => {
|
|
2997
|
+
o == null || o(), z();
|
|
2905
2998
|
}, $ = () => {
|
|
2906
2999
|
g == null || g();
|
|
2907
3000
|
};
|
|
2908
3001
|
te(() => {
|
|
2909
|
-
|
|
3002
|
+
z();
|
|
2910
3003
|
}, []);
|
|
2911
|
-
const
|
|
2912
|
-
switch (
|
|
3004
|
+
const _ = () => {
|
|
3005
|
+
switch (u) {
|
|
2913
3006
|
case "verifying":
|
|
2914
|
-
return /* @__PURE__ */
|
|
2915
|
-
|
|
2916
|
-
|
|
3007
|
+
return /* @__PURE__ */ c("div", { style: d.message, children: [
|
|
3008
|
+
P.loading,
|
|
3009
|
+
T.verifyingMessage
|
|
2917
3010
|
] });
|
|
2918
3011
|
case "success":
|
|
2919
|
-
return /* @__PURE__ */
|
|
2920
|
-
|
|
2921
|
-
/* @__PURE__ */ n("div", { style:
|
|
3012
|
+
return /* @__PURE__ */ c(B, { children: [
|
|
3013
|
+
P.success,
|
|
3014
|
+
/* @__PURE__ */ n("div", { style: d.successMessage, children: T.successMessage })
|
|
2922
3015
|
] });
|
|
2923
3016
|
case "redirecting":
|
|
2924
|
-
return /* @__PURE__ */
|
|
2925
|
-
|
|
2926
|
-
/* @__PURE__ */ n("div", { style:
|
|
3017
|
+
return /* @__PURE__ */ c(B, { children: [
|
|
3018
|
+
P.loading,
|
|
3019
|
+
/* @__PURE__ */ n("div", { style: d.message, children: T.redirectingMessage })
|
|
2927
3020
|
] });
|
|
2928
3021
|
case "error":
|
|
2929
|
-
return /* @__PURE__ */
|
|
2930
|
-
|
|
2931
|
-
/* @__PURE__ */ n("div", { style:
|
|
2932
|
-
/* @__PURE__ */
|
|
3022
|
+
return /* @__PURE__ */ c(B, { children: [
|
|
3023
|
+
P.error,
|
|
3024
|
+
/* @__PURE__ */ n("div", { style: d.errorMessage, children: E || T.errorMessage }),
|
|
3025
|
+
/* @__PURE__ */ c("div", { style: d.buttonContainer, children: [
|
|
2933
3026
|
/* @__PURE__ */ n(
|
|
2934
3027
|
"button",
|
|
2935
3028
|
{
|
|
2936
|
-
onClick:
|
|
2937
|
-
style:
|
|
2938
|
-
onMouseOver: (
|
|
2939
|
-
|
|
3029
|
+
onClick: G,
|
|
3030
|
+
style: d.retryButton,
|
|
3031
|
+
onMouseOver: (S) => {
|
|
3032
|
+
S.currentTarget.style.backgroundColor = "#2563eb";
|
|
2940
3033
|
},
|
|
2941
|
-
onMouseOut: (
|
|
2942
|
-
|
|
3034
|
+
onMouseOut: (S) => {
|
|
3035
|
+
S.currentTarget.style.backgroundColor = "#3b82f6";
|
|
2943
3036
|
},
|
|
2944
|
-
children:
|
|
3037
|
+
children: T.retryButton
|
|
2945
3038
|
}
|
|
2946
3039
|
),
|
|
2947
3040
|
/* @__PURE__ */ n(
|
|
2948
3041
|
"button",
|
|
2949
3042
|
{
|
|
2950
3043
|
onClick: $,
|
|
2951
|
-
style:
|
|
2952
|
-
onMouseOver: (
|
|
2953
|
-
|
|
3044
|
+
style: d.backButton,
|
|
3045
|
+
onMouseOver: (S) => {
|
|
3046
|
+
S.currentTarget.style.backgroundColor = "#e5e7eb";
|
|
2954
3047
|
},
|
|
2955
|
-
onMouseOut: (
|
|
2956
|
-
|
|
3048
|
+
onMouseOut: (S) => {
|
|
3049
|
+
S.currentTarget.style.backgroundColor = "#f3f4f6";
|
|
2957
3050
|
},
|
|
2958
|
-
children:
|
|
3051
|
+
children: T.backToLoginButton
|
|
2959
3052
|
}
|
|
2960
3053
|
)
|
|
2961
3054
|
] })
|
|
@@ -2964,18 +3057,18 @@ function qt({
|
|
|
2964
3057
|
return null;
|
|
2965
3058
|
}
|
|
2966
3059
|
};
|
|
2967
|
-
return /* @__PURE__ */
|
|
3060
|
+
return /* @__PURE__ */ c("div", { style: d.container, className: w, children: [
|
|
2968
3061
|
/* @__PURE__ */ n("style", { children: `
|
|
2969
3062
|
@keyframes spin {
|
|
2970
3063
|
0% { transform: rotate(0deg); }
|
|
2971
3064
|
100% { transform: rotate(360deg); }
|
|
2972
3065
|
}
|
|
2973
3066
|
` }),
|
|
2974
|
-
/* @__PURE__ */ n("h1", { style:
|
|
2975
|
-
|
|
3067
|
+
/* @__PURE__ */ n("h1", { style: d.title, children: T.title }),
|
|
3068
|
+
_()
|
|
2976
3069
|
] });
|
|
2977
3070
|
}
|
|
2978
|
-
const
|
|
3071
|
+
const xt = {
|
|
2979
3072
|
title: "Reset Password",
|
|
2980
3073
|
subtitle: "Enter your email address and we'll send you a link to reset your password.",
|
|
2981
3074
|
emailLabel: "Email",
|
|
@@ -2997,7 +3090,7 @@ const gt = {
|
|
|
2997
3090
|
resetLoadingText: "Resetting...",
|
|
2998
3091
|
resetSuccessMessage: "Password reset successfully!",
|
|
2999
3092
|
passwordMismatchError: "Passwords do not match"
|
|
3000
|
-
},
|
|
3093
|
+
}, kt = {
|
|
3001
3094
|
container: {
|
|
3002
3095
|
maxWidth: "400px",
|
|
3003
3096
|
margin: "0 auto",
|
|
@@ -3089,7 +3182,7 @@ const gt = {
|
|
|
3089
3182
|
cursor: "pointer"
|
|
3090
3183
|
}
|
|
3091
3184
|
};
|
|
3092
|
-
function
|
|
3185
|
+
function Yt({
|
|
3093
3186
|
copy: i = {},
|
|
3094
3187
|
styles: e = {},
|
|
3095
3188
|
mode: t = "request",
|
|
@@ -3097,105 +3190,105 @@ function zt({
|
|
|
3097
3190
|
onSuccess: s,
|
|
3098
3191
|
onError: o,
|
|
3099
3192
|
onBackToLogin: g,
|
|
3100
|
-
onModeChange:
|
|
3101
|
-
className:
|
|
3193
|
+
onModeChange: w,
|
|
3194
|
+
className: x
|
|
3102
3195
|
}) {
|
|
3103
|
-
const [
|
|
3104
|
-
const
|
|
3105
|
-
return
|
|
3106
|
-
},
|
|
3107
|
-
const
|
|
3108
|
-
return
|
|
3109
|
-
},
|
|
3110
|
-
if (
|
|
3111
|
-
if (!(
|
|
3112
|
-
|
|
3196
|
+
const [b, A] = v(""), [m, f] = v(r), [u, y] = v(""), [E, C] = v(""), [q, T] = v(!1), [d, P] = v(""), [R, z] = v(""), [G, $] = v({}), { requestPasswordReset: _, confirmPasswordReset: S } = ae(), { tenant: M } = se(), L = { ...xt, ...i }, l = { ...kt, ...e }, I = () => {
|
|
3197
|
+
const H = {};
|
|
3198
|
+
return b.trim() || (H.email = !0), $(H), Object.keys(H).length === 0;
|
|
3199
|
+
}, k = () => {
|
|
3200
|
+
const H = {};
|
|
3201
|
+
return m.trim() || (H.token = !0), u.trim() || (H.newPassword = !0), E.trim() || (H.confirmPassword = !0), $(H), Object.keys(H).length === 0;
|
|
3202
|
+
}, h = async (H) => {
|
|
3203
|
+
if (H.preventDefault(), !!I()) {
|
|
3204
|
+
if (!(M != null && M.id)) {
|
|
3205
|
+
P("Tenant not found");
|
|
3113
3206
|
return;
|
|
3114
3207
|
}
|
|
3115
|
-
|
|
3208
|
+
T(!0), P(""), z("");
|
|
3116
3209
|
try {
|
|
3117
|
-
await
|
|
3118
|
-
} catch (
|
|
3119
|
-
const
|
|
3120
|
-
|
|
3210
|
+
await _({ email: b, tenantId: M.id }), z(L.successMessage), s == null || s();
|
|
3211
|
+
} catch (N) {
|
|
3212
|
+
const W = N.message || L.errorMessage;
|
|
3213
|
+
P(W), o == null || o(W);
|
|
3121
3214
|
} finally {
|
|
3122
|
-
|
|
3215
|
+
T(!1);
|
|
3123
3216
|
}
|
|
3124
3217
|
}
|
|
3125
|
-
},
|
|
3126
|
-
if (
|
|
3127
|
-
if (
|
|
3128
|
-
|
|
3218
|
+
}, a = async (H) => {
|
|
3219
|
+
if (H.preventDefault(), !!k()) {
|
|
3220
|
+
if (u !== E) {
|
|
3221
|
+
P(L.passwordMismatchError), $({ confirmPassword: !0 });
|
|
3129
3222
|
return;
|
|
3130
3223
|
}
|
|
3131
|
-
|
|
3224
|
+
T(!0), P(""), z("");
|
|
3132
3225
|
try {
|
|
3133
|
-
await
|
|
3134
|
-
} catch (
|
|
3135
|
-
const
|
|
3136
|
-
|
|
3226
|
+
await S({ token: m, newPassword: u }), z(L.resetSuccessMessage), s == null || s();
|
|
3227
|
+
} catch (N) {
|
|
3228
|
+
const W = N.message || L.errorMessage;
|
|
3229
|
+
P(W), o == null || o(W);
|
|
3137
3230
|
} finally {
|
|
3138
|
-
|
|
3231
|
+
T(!1);
|
|
3139
3232
|
}
|
|
3140
3233
|
}
|
|
3141
|
-
},
|
|
3234
|
+
}, p = (H) => ({
|
|
3142
3235
|
...l.input,
|
|
3143
|
-
...
|
|
3144
|
-
}),
|
|
3236
|
+
...G[H] ? l.inputError : {}
|
|
3237
|
+
}), O = () => ({
|
|
3145
3238
|
...l.button,
|
|
3146
|
-
...
|
|
3239
|
+
...q ? l.buttonLoading : {}
|
|
3147
3240
|
});
|
|
3148
3241
|
if (t === "reset") {
|
|
3149
|
-
const
|
|
3150
|
-
return /* @__PURE__ */
|
|
3242
|
+
const H = m && u && E;
|
|
3243
|
+
return /* @__PURE__ */ c("div", { className: x, style: l.container, children: [
|
|
3151
3244
|
/* @__PURE__ */ n("h2", { style: l.title, children: L.resetTitle }),
|
|
3152
3245
|
/* @__PURE__ */ n("p", { style: l.subtitle, children: L.resetSubtitle }),
|
|
3153
|
-
/* @__PURE__ */
|
|
3154
|
-
/* @__PURE__ */
|
|
3246
|
+
/* @__PURE__ */ c("form", { onSubmit: a, style: l.form, children: [
|
|
3247
|
+
/* @__PURE__ */ c("div", { style: l.fieldGroup, children: [
|
|
3155
3248
|
/* @__PURE__ */ n("label", { style: l.label, children: L.tokenLabel }),
|
|
3156
3249
|
/* @__PURE__ */ n(
|
|
3157
3250
|
"input",
|
|
3158
3251
|
{
|
|
3159
3252
|
type: "text",
|
|
3160
|
-
value:
|
|
3161
|
-
onChange: (
|
|
3162
|
-
|
|
3253
|
+
value: m,
|
|
3254
|
+
onChange: (N) => {
|
|
3255
|
+
f(N.target.value), G.token && $((W) => ({ ...W, token: !1 }));
|
|
3163
3256
|
},
|
|
3164
3257
|
placeholder: L.tokenPlaceholder,
|
|
3165
|
-
style:
|
|
3166
|
-
disabled:
|
|
3258
|
+
style: p("token"),
|
|
3259
|
+
disabled: q
|
|
3167
3260
|
}
|
|
3168
3261
|
)
|
|
3169
3262
|
] }),
|
|
3170
|
-
/* @__PURE__ */
|
|
3263
|
+
/* @__PURE__ */ c("div", { style: l.fieldGroup, children: [
|
|
3171
3264
|
/* @__PURE__ */ n("label", { style: l.label, children: L.newPasswordLabel }),
|
|
3172
3265
|
/* @__PURE__ */ n(
|
|
3173
3266
|
"input",
|
|
3174
3267
|
{
|
|
3175
3268
|
type: "password",
|
|
3176
|
-
value:
|
|
3177
|
-
onChange: (
|
|
3178
|
-
|
|
3269
|
+
value: u,
|
|
3270
|
+
onChange: (N) => {
|
|
3271
|
+
y(N.target.value), G.newPassword && $((W) => ({ ...W, newPassword: !1 }));
|
|
3179
3272
|
},
|
|
3180
3273
|
placeholder: L.newPasswordPlaceholder,
|
|
3181
|
-
style:
|
|
3182
|
-
disabled:
|
|
3274
|
+
style: p("newPassword"),
|
|
3275
|
+
disabled: q
|
|
3183
3276
|
}
|
|
3184
3277
|
)
|
|
3185
3278
|
] }),
|
|
3186
|
-
/* @__PURE__ */
|
|
3279
|
+
/* @__PURE__ */ c("div", { style: l.fieldGroup, children: [
|
|
3187
3280
|
/* @__PURE__ */ n("label", { style: l.label, children: L.confirmPasswordLabel }),
|
|
3188
3281
|
/* @__PURE__ */ n(
|
|
3189
3282
|
"input",
|
|
3190
3283
|
{
|
|
3191
3284
|
type: "password",
|
|
3192
|
-
value:
|
|
3193
|
-
onChange: (
|
|
3194
|
-
C(
|
|
3285
|
+
value: E,
|
|
3286
|
+
onChange: (N) => {
|
|
3287
|
+
C(N.target.value), G.confirmPassword && $((W) => ({ ...W, confirmPassword: !1 })), d === L.passwordMismatchError && P("");
|
|
3195
3288
|
},
|
|
3196
3289
|
placeholder: L.confirmPasswordPlaceholder,
|
|
3197
|
-
style:
|
|
3198
|
-
disabled:
|
|
3290
|
+
style: p("confirmPassword"),
|
|
3291
|
+
disabled: q
|
|
3199
3292
|
}
|
|
3200
3293
|
)
|
|
3201
3294
|
] }),
|
|
@@ -3203,44 +3296,44 @@ function zt({
|
|
|
3203
3296
|
"button",
|
|
3204
3297
|
{
|
|
3205
3298
|
type: "submit",
|
|
3206
|
-
disabled: !
|
|
3299
|
+
disabled: !H || q,
|
|
3207
3300
|
style: {
|
|
3208
|
-
...
|
|
3209
|
-
...!
|
|
3301
|
+
...O(),
|
|
3302
|
+
...!H || q ? l.buttonDisabled : {}
|
|
3210
3303
|
},
|
|
3211
|
-
children:
|
|
3304
|
+
children: q ? L.resetLoadingText : L.resetSubmitButton
|
|
3212
3305
|
}
|
|
3213
3306
|
),
|
|
3214
|
-
|
|
3215
|
-
|
|
3307
|
+
d && /* @__PURE__ */ n("div", { style: l.errorText, children: d }),
|
|
3308
|
+
R && /* @__PURE__ */ n("div", { style: l.successText, children: R })
|
|
3216
3309
|
] }),
|
|
3217
|
-
/* @__PURE__ */
|
|
3310
|
+
/* @__PURE__ */ c("div", { style: l.linkContainer, children: [
|
|
3218
3311
|
/* @__PURE__ */ n("a", { onClick: g, style: l.link, children: L.backToLoginLink }),
|
|
3219
|
-
|
|
3312
|
+
w && /* @__PURE__ */ c(B, { children: [
|
|
3220
3313
|
/* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3221
|
-
/* @__PURE__ */ n("a", { onClick: () =>
|
|
3314
|
+
/* @__PURE__ */ n("a", { onClick: () => w("request"), style: l.link, children: "Request New Link" })
|
|
3222
3315
|
] })
|
|
3223
3316
|
] })
|
|
3224
3317
|
] });
|
|
3225
3318
|
}
|
|
3226
|
-
const
|
|
3227
|
-
return /* @__PURE__ */
|
|
3319
|
+
const K = b;
|
|
3320
|
+
return /* @__PURE__ */ c("div", { className: x, style: l.container, children: [
|
|
3228
3321
|
/* @__PURE__ */ n("h2", { style: l.title, children: L.title }),
|
|
3229
3322
|
/* @__PURE__ */ n("p", { style: l.subtitle, children: L.subtitle }),
|
|
3230
|
-
/* @__PURE__ */
|
|
3231
|
-
/* @__PURE__ */
|
|
3323
|
+
/* @__PURE__ */ c("form", { onSubmit: h, style: l.form, children: [
|
|
3324
|
+
/* @__PURE__ */ c("div", { style: l.fieldGroup, children: [
|
|
3232
3325
|
/* @__PURE__ */ n("label", { style: l.label, children: L.emailLabel }),
|
|
3233
3326
|
/* @__PURE__ */ n(
|
|
3234
3327
|
"input",
|
|
3235
3328
|
{
|
|
3236
3329
|
type: "email",
|
|
3237
|
-
value:
|
|
3238
|
-
onChange: (
|
|
3239
|
-
|
|
3330
|
+
value: b,
|
|
3331
|
+
onChange: (H) => {
|
|
3332
|
+
A(H.target.value), G.email && $((N) => ({ ...N, email: !1 }));
|
|
3240
3333
|
},
|
|
3241
3334
|
placeholder: L.emailPlaceholder,
|
|
3242
|
-
style:
|
|
3243
|
-
disabled:
|
|
3335
|
+
style: p("email"),
|
|
3336
|
+
disabled: q
|
|
3244
3337
|
}
|
|
3245
3338
|
)
|
|
3246
3339
|
] }),
|
|
@@ -3248,27 +3341,27 @@ function zt({
|
|
|
3248
3341
|
"button",
|
|
3249
3342
|
{
|
|
3250
3343
|
type: "submit",
|
|
3251
|
-
disabled: !
|
|
3344
|
+
disabled: !K || q,
|
|
3252
3345
|
style: {
|
|
3253
|
-
...
|
|
3254
|
-
...!
|
|
3346
|
+
...O(),
|
|
3347
|
+
...!K || q ? l.buttonDisabled : {}
|
|
3255
3348
|
},
|
|
3256
|
-
children:
|
|
3349
|
+
children: q ? L.loadingText : L.submitButton
|
|
3257
3350
|
}
|
|
3258
3351
|
),
|
|
3259
|
-
|
|
3260
|
-
|
|
3352
|
+
d && /* @__PURE__ */ n("div", { style: l.errorText, children: d }),
|
|
3353
|
+
R && /* @__PURE__ */ n("div", { style: l.successText, children: R })
|
|
3261
3354
|
] }),
|
|
3262
|
-
/* @__PURE__ */
|
|
3355
|
+
/* @__PURE__ */ c("div", { style: l.linkContainer, children: [
|
|
3263
3356
|
/* @__PURE__ */ n("a", { onClick: g, style: l.link, children: L.backToLoginLink }),
|
|
3264
|
-
|
|
3357
|
+
w && /* @__PURE__ */ c(B, { children: [
|
|
3265
3358
|
/* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3266
|
-
/* @__PURE__ */ n("a", { onClick: () =>
|
|
3359
|
+
/* @__PURE__ */ n("a", { onClick: () => w("reset"), style: l.link, children: "I have a token" })
|
|
3267
3360
|
] })
|
|
3268
3361
|
] })
|
|
3269
3362
|
] });
|
|
3270
3363
|
}
|
|
3271
|
-
const
|
|
3364
|
+
const At = () => /* @__PURE__ */ n(
|
|
3272
3365
|
"div",
|
|
3273
3366
|
{
|
|
3274
3367
|
style: {
|
|
@@ -3280,7 +3373,7 @@ const ft = () => /* @__PURE__ */ n(
|
|
|
3280
3373
|
},
|
|
3281
3374
|
children: /* @__PURE__ */ n("div", { children: "Loading..." })
|
|
3282
3375
|
}
|
|
3283
|
-
),
|
|
3376
|
+
), Tt = ({ error: i, retry: e }) => /* @__PURE__ */ c(
|
|
3284
3377
|
"div",
|
|
3285
3378
|
{
|
|
3286
3379
|
style: {
|
|
@@ -3314,40 +3407,40 @@ const ft = () => /* @__PURE__ */ n(
|
|
|
3314
3407
|
]
|
|
3315
3408
|
}
|
|
3316
3409
|
);
|
|
3317
|
-
function
|
|
3410
|
+
function Qt({
|
|
3318
3411
|
children: i,
|
|
3319
3412
|
loadingFallback: e,
|
|
3320
3413
|
errorFallback: t,
|
|
3321
3414
|
requireTenant: r = !0
|
|
3322
3415
|
}) {
|
|
3323
|
-
const { isAppLoading: s, appError: o, retryApp: g } = oe(),
|
|
3324
|
-
}),
|
|
3325
|
-
o && g(),
|
|
3416
|
+
const { isAppLoading: s, appError: o, retryApp: g } = oe(), w = Me(), x = (w == null ? void 0 : w.isTenantLoading) ?? !1, b = (w == null ? void 0 : w.tenantError) ?? null, A = (w == null ? void 0 : w.tenantSlug) ?? null, m = (w == null ? void 0 : w.retryTenant) ?? (() => {
|
|
3417
|
+
}), f = r && w && A, u = s || f && x, y = o || (f ? b : null), E = () => {
|
|
3418
|
+
o && g(), b && w && m();
|
|
3326
3419
|
};
|
|
3327
|
-
if (
|
|
3328
|
-
return /* @__PURE__ */ n(B, { children: e || /* @__PURE__ */ n(
|
|
3329
|
-
if (
|
|
3330
|
-
const C = typeof t == "function" ? t(
|
|
3420
|
+
if (u)
|
|
3421
|
+
return /* @__PURE__ */ n(B, { children: e || /* @__PURE__ */ n(At, {}) });
|
|
3422
|
+
if (y) {
|
|
3423
|
+
const C = typeof t == "function" ? t(y, E) : t || /* @__PURE__ */ n(Tt, { error: y, retry: E });
|
|
3331
3424
|
return /* @__PURE__ */ n(B, { children: C });
|
|
3332
3425
|
}
|
|
3333
3426
|
return /* @__PURE__ */ n(B, { children: i });
|
|
3334
3427
|
}
|
|
3335
|
-
function
|
|
3336
|
-
const { isAppLoading: e, appError: t, retryApp: r, appInfo: s } = oe(), o =
|
|
3337
|
-
}),
|
|
3428
|
+
function Xt(i = !0) {
|
|
3429
|
+
const { isAppLoading: e, appError: t, retryApp: r, appInfo: s } = oe(), o = Me(), g = (o == null ? void 0 : o.isTenantLoading) ?? !1, w = (o == null ? void 0 : o.tenantError) ?? null, x = (o == null ? void 0 : o.tenant) ?? null, b = (o == null ? void 0 : o.tenantSlug) ?? null, A = (o == null ? void 0 : o.retryTenant) ?? (() => {
|
|
3430
|
+
}), m = i && o && b, f = e || m && g, u = t || (m ? w : null);
|
|
3338
3431
|
return {
|
|
3339
|
-
isLoading:
|
|
3340
|
-
error:
|
|
3341
|
-
isReady: !
|
|
3432
|
+
isLoading: f,
|
|
3433
|
+
error: u,
|
|
3434
|
+
isReady: !f && !u && s !== null && (!m || x !== null),
|
|
3342
3435
|
retry: () => {
|
|
3343
|
-
t && r(),
|
|
3436
|
+
t && r(), w && o && A();
|
|
3344
3437
|
},
|
|
3345
3438
|
// Individual states
|
|
3346
3439
|
app: { isLoading: e, error: t, data: s },
|
|
3347
|
-
tenant: o ? { isLoading: g, error:
|
|
3440
|
+
tenant: o ? { isLoading: g, error: w, data: x } : null
|
|
3348
3441
|
};
|
|
3349
3442
|
}
|
|
3350
|
-
class
|
|
3443
|
+
class Zt {
|
|
3351
3444
|
constructor(e, t) {
|
|
3352
3445
|
this.httpService = e, this.sessionManager = t;
|
|
3353
3446
|
}
|
|
@@ -3415,7 +3508,7 @@ class jt {
|
|
|
3415
3508
|
};
|
|
3416
3509
|
}
|
|
3417
3510
|
}
|
|
3418
|
-
class
|
|
3511
|
+
class er {
|
|
3419
3512
|
constructor(e, t) {
|
|
3420
3513
|
this.httpService = e, this.sessionManager = t;
|
|
3421
3514
|
}
|
|
@@ -3466,7 +3559,7 @@ class Vt {
|
|
|
3466
3559
|
});
|
|
3467
3560
|
}
|
|
3468
3561
|
}
|
|
3469
|
-
class
|
|
3562
|
+
class tr {
|
|
3470
3563
|
constructor(e) {
|
|
3471
3564
|
this.httpService = e;
|
|
3472
3565
|
}
|
|
@@ -3475,7 +3568,7 @@ class Gt {
|
|
|
3475
3568
|
return await this.httpService.get("/health");
|
|
3476
3569
|
}
|
|
3477
3570
|
}
|
|
3478
|
-
class
|
|
3571
|
+
class rr {
|
|
3479
3572
|
// Date string to Date object
|
|
3480
3573
|
static toDate(e) {
|
|
3481
3574
|
return new Date(e);
|
|
@@ -3598,47 +3691,47 @@ class _t {
|
|
|
3598
3691
|
}
|
|
3599
3692
|
}
|
|
3600
3693
|
export {
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3694
|
+
rr as ApiMappers,
|
|
3695
|
+
ve as AppApiService,
|
|
3696
|
+
Qt as AppLoader,
|
|
3697
|
+
Ct as AppProvider,
|
|
3698
|
+
ze as AuthApiService,
|
|
3699
|
+
Nt as AuthProvider,
|
|
3700
|
+
jt as FeatureFlag,
|
|
3701
|
+
Qe as FeatureFlagApiService,
|
|
3702
|
+
Ut as FeatureFlagProvider,
|
|
3703
|
+
tr as HealthApiService,
|
|
3611
3704
|
re as HttpService,
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3705
|
+
Wt as LandingRoute,
|
|
3706
|
+
_t as LoginForm,
|
|
3707
|
+
Kt as MagicLinkForm,
|
|
3708
|
+
Jt as MagicLinkVerify,
|
|
3709
|
+
Yt as PasswordRecoveryForm,
|
|
3710
|
+
Zt as PermissionApiService,
|
|
3711
|
+
qt as Protected,
|
|
3712
|
+
zt as ProtectedRoute,
|
|
3713
|
+
xe as RoleApiService,
|
|
3714
|
+
we as SessionManager,
|
|
3715
|
+
Gt as SignupForm,
|
|
3716
|
+
Ze as SubscriptionApiService,
|
|
3717
|
+
Vt as SubscriptionGuard,
|
|
3718
|
+
er as SubscriptionPlanApiService,
|
|
3719
|
+
Bt as SubscriptionProvider,
|
|
3627
3720
|
ue as TenantApiService,
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3721
|
+
Dt as TenantProvider,
|
|
3722
|
+
Ot as TenantRoute,
|
|
3723
|
+
Oe as UserApiService,
|
|
3631
3724
|
ie as UserType,
|
|
3632
|
-
|
|
3725
|
+
$t as useApi,
|
|
3633
3726
|
oe as useApp,
|
|
3634
|
-
|
|
3727
|
+
Xt as useAppLoaderState,
|
|
3635
3728
|
ae as useAuth,
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3729
|
+
Xe as useFeatureFlags,
|
|
3730
|
+
Ht as useSettings,
|
|
3731
|
+
et as useSubscription,
|
|
3732
|
+
me as useTenant,
|
|
3640
3733
|
se as useTenantInfo,
|
|
3641
|
-
|
|
3642
|
-
|
|
3734
|
+
Me as useTenantOptional,
|
|
3735
|
+
Ft as useTenantSettings
|
|
3643
3736
|
};
|
|
3644
3737
|
//# sourceMappingURL=index.es.js.map
|