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