@skylabs-digital/react-identity-access 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AppLoader.d.ts +10 -1
- package/dist/components/AppLoader.d.ts.map +1 -1
- package/dist/index.es.js +1105 -1108
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/providers/AppProvider.d.ts +4 -0
- package/dist/providers/AppProvider.d.ts.map +1 -1
- package/dist/providers/AuthProvider.d.ts +7 -0
- package/dist/providers/AuthProvider.d.ts.map +1 -1
- package/dist/providers/FeatureFlagProvider.d.ts +5 -0
- package/dist/providers/FeatureFlagProvider.d.ts.map +1 -1
- package/dist/providers/SubscriptionProvider.d.ts +5 -0
- package/dist/providers/SubscriptionProvider.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as n, Fragment as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useLocation as
|
|
1
|
+
import { jsx as n, Fragment as W, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ue, useMemo as X, useState as k, useCallback as se, useEffect as te, useContext as ne, useRef as Ve } from "react";
|
|
3
|
+
import { useLocation as Se, 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 a = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, p = (s == null ? void 0 : s.timeout) || this.timeout;
|
|
20
|
+
let w = {
|
|
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 b = await this.sessionManager.getAuthHeaders();
|
|
27
|
+
w = { ...w, ...b };
|
|
28
|
+
} catch (b) {
|
|
29
|
+
console.warn("Failed to inject auth headers:", b);
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const y = new AbortController(), x = setTimeout(() => y.abort(), p);
|
|
32
32
|
try {
|
|
33
|
-
const
|
|
33
|
+
const b = await fetch(a, {
|
|
34
34
|
method: e,
|
|
35
|
-
headers:
|
|
35
|
+
headers: w,
|
|
36
36
|
body: r ? JSON.stringify(r) : void 0,
|
|
37
|
-
signal:
|
|
37
|
+
signal: y.signal
|
|
38
38
|
});
|
|
39
|
-
if (clearTimeout(
|
|
39
|
+
if (clearTimeout(x), b.status === 401 && !(s != null && s.skipRetry) && !o && this.sessionManager)
|
|
40
40
|
try {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
41
|
+
const A = this.sessionManager.getTokens();
|
|
42
|
+
if (A != null && A.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 ${b.status}: ${b.statusText}`);
|
|
46
46
|
}
|
|
47
|
-
if (!
|
|
48
|
-
throw new Error(`HTTP ${
|
|
49
|
-
const
|
|
50
|
-
return !
|
|
51
|
-
} catch (
|
|
52
|
-
throw clearTimeout(
|
|
47
|
+
if (!b.ok)
|
|
48
|
+
throw new Error(`HTTP ${b.status}: ${b.statusText}`);
|
|
49
|
+
const f = b.headers.get("content-type");
|
|
50
|
+
return !f || !f.includes("application/json") ? {} : await b.json();
|
|
51
|
+
} catch (b) {
|
|
52
|
+
throw clearTimeout(x), b instanceof Error && b.name === "AbortError" ? new Error(`Request timeout after ${p}ms`) : b;
|
|
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 Pe {
|
|
69
69
|
constructor(e, t) {
|
|
70
70
|
this.httpService = e, this.sessionManager = t;
|
|
71
71
|
}
|
|
@@ -124,32 +124,32 @@ class ve {
|
|
|
124
124
|
})).data;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
const
|
|
128
|
-
function
|
|
127
|
+
const ve = ue(null);
|
|
128
|
+
function Nt({ config: i, children: e }) {
|
|
129
129
|
const t = X(
|
|
130
130
|
() => {
|
|
131
|
-
var
|
|
131
|
+
var f, A, L;
|
|
132
132
|
return {
|
|
133
|
-
enabled: ((
|
|
134
|
-
ttl: ((
|
|
133
|
+
enabled: ((f = i.cache) == null ? void 0 : f.enabled) ?? !0,
|
|
134
|
+
ttl: ((A = i.cache) == null ? void 0 : A.ttl) ?? 3e5,
|
|
135
135
|
// 5 minutes default
|
|
136
|
-
storageKey: ((
|
|
136
|
+
storageKey: ((L = i.cache) == null ? void 0 : L.storageKey) ?? `app_cache_${i.appId}`
|
|
137
137
|
};
|
|
138
138
|
},
|
|
139
139
|
[i.cache, i.appId]
|
|
140
|
-
), [r, s] =
|
|
140
|
+
), [r, s] = k(() => {
|
|
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 A = JSON.parse(f);
|
|
146
|
+
return Date.now() - A.timestamp < t.ttl && A.appId === i.appId ? A.data : (localStorage.removeItem(t.storageKey), null);
|
|
147
147
|
} catch {
|
|
148
148
|
return null;
|
|
149
149
|
}
|
|
150
|
-
}), [o,
|
|
151
|
-
const
|
|
152
|
-
|
|
150
|
+
}), [o, a] = k(!r), [p, w] = k(null), y = X(() => {
|
|
151
|
+
const f = () => {
|
|
152
|
+
x();
|
|
153
153
|
};
|
|
154
154
|
return {
|
|
155
155
|
appId: i.appId,
|
|
@@ -157,66 +157,69 @@ function Ct({ config: i, children: e }) {
|
|
|
157
157
|
// App info
|
|
158
158
|
appInfo: r,
|
|
159
159
|
isAppLoading: o,
|
|
160
|
-
appError:
|
|
161
|
-
retryApp:
|
|
160
|
+
appError: p,
|
|
161
|
+
retryApp: f
|
|
162
162
|
};
|
|
163
|
-
}, [i, r, o,
|
|
164
|
-
async (
|
|
165
|
-
if (!(!
|
|
163
|
+
}, [i, r, o, p]), x = se(
|
|
164
|
+
async (f = !1) => {
|
|
165
|
+
if (!(!f && t.enabled && r))
|
|
166
166
|
try {
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
if (s(
|
|
167
|
+
a(!0), w(null);
|
|
168
|
+
const A = new re(i.baseUrl), D = await new Pe(A, {}).getPublicAppInfo(i.appId);
|
|
169
|
+
if (s(D), t.enabled)
|
|
170
170
|
try {
|
|
171
|
-
const
|
|
172
|
-
data:
|
|
171
|
+
const I = {
|
|
172
|
+
data: D,
|
|
173
173
|
timestamp: Date.now(),
|
|
174
174
|
appId: i.appId
|
|
175
175
|
};
|
|
176
|
-
localStorage.setItem(t.storageKey, JSON.stringify(
|
|
177
|
-
} catch (
|
|
178
|
-
console.warn("Failed to cache app info:",
|
|
176
|
+
localStorage.setItem(t.storageKey, JSON.stringify(I));
|
|
177
|
+
} catch (I) {
|
|
178
|
+
console.warn("Failed to cache app info:", I);
|
|
179
179
|
}
|
|
180
|
-
} catch (
|
|
181
|
-
const
|
|
182
|
-
|
|
180
|
+
} catch (A) {
|
|
181
|
+
const L = A instanceof Error ? A : new Error("Failed to load app information");
|
|
182
|
+
w(L), s(null);
|
|
183
183
|
} finally {
|
|
184
|
-
|
|
184
|
+
a(!1);
|
|
185
185
|
}
|
|
186
186
|
},
|
|
187
187
|
[i.baseUrl, i.appId, t, r]
|
|
188
|
-
),
|
|
188
|
+
), b = se(async () => {
|
|
189
189
|
if (!(!t.enabled || !r))
|
|
190
190
|
try {
|
|
191
|
-
const
|
|
192
|
-
if (!
|
|
193
|
-
const
|
|
194
|
-
if (Date.now() -
|
|
195
|
-
const
|
|
196
|
-
s(
|
|
197
|
-
const
|
|
198
|
-
data:
|
|
191
|
+
const f = localStorage.getItem(t.storageKey);
|
|
192
|
+
if (!f) return;
|
|
193
|
+
const A = JSON.parse(f);
|
|
194
|
+
if (Date.now() - A.timestamp > t.ttl * 0.5) {
|
|
195
|
+
const D = new re(i.baseUrl), M = await new Pe(D, {}).getPublicAppInfo(i.appId);
|
|
196
|
+
s(M);
|
|
197
|
+
const u = {
|
|
198
|
+
data: M,
|
|
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(u));
|
|
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 ? b() : x();
|
|
210
|
+
}, []), /* @__PURE__ */ n(ve.Provider, { value: y, children: e });
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
const i =
|
|
212
|
+
function he() {
|
|
213
|
+
const i = ne(ve);
|
|
214
214
|
if (!i)
|
|
215
215
|
throw new Error("useApp must be used within an AppProvider");
|
|
216
216
|
return i;
|
|
217
217
|
}
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
function Ee() {
|
|
219
|
+
return ne(ve);
|
|
220
|
+
}
|
|
221
|
+
const Ut = he;
|
|
222
|
+
class be {
|
|
220
223
|
constructor(e = {}) {
|
|
221
224
|
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
225
|
}
|
|
@@ -369,7 +372,7 @@ class we {
|
|
|
369
372
|
return e !== null && !this.isTokenExpired(e);
|
|
370
373
|
}
|
|
371
374
|
}
|
|
372
|
-
class
|
|
375
|
+
class _e {
|
|
373
376
|
constructor(e) {
|
|
374
377
|
this.httpService = e;
|
|
375
378
|
}
|
|
@@ -414,7 +417,7 @@ class ze {
|
|
|
414
417
|
});
|
|
415
418
|
}
|
|
416
419
|
}
|
|
417
|
-
class
|
|
420
|
+
class Me {
|
|
418
421
|
constructor(e, t) {
|
|
419
422
|
this.httpService = e, this.sessionManager = t;
|
|
420
423
|
}
|
|
@@ -481,16 +484,16 @@ class ke {
|
|
|
481
484
|
throw new Error("SessionManager is required for private endpoints");
|
|
482
485
|
const r = await this.sessionManager.getAuthHeaders(), s = new URLSearchParams();
|
|
483
486
|
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()}` : ""}`,
|
|
487
|
+
const o = `/roles/user/${e}${s.toString() ? `?${s.toString()}` : ""}`, a = await this.httpService.get(o, {
|
|
485
488
|
headers: r
|
|
486
489
|
});
|
|
487
490
|
return {
|
|
488
|
-
roles:
|
|
489
|
-
meta:
|
|
491
|
+
roles: a.data,
|
|
492
|
+
meta: a.meta
|
|
490
493
|
};
|
|
491
494
|
}
|
|
492
495
|
}
|
|
493
|
-
class
|
|
496
|
+
class Ge {
|
|
494
497
|
constructor(e, t) {
|
|
495
498
|
this.httpService = e, this.sessionManager = t;
|
|
496
499
|
}
|
|
@@ -530,7 +533,7 @@ class Oe {
|
|
|
530
533
|
});
|
|
531
534
|
}
|
|
532
535
|
}
|
|
533
|
-
class
|
|
536
|
+
class de {
|
|
534
537
|
constructor(e, t, r) {
|
|
535
538
|
this.httpService = e, this.appId = t, this.sessionManager = r;
|
|
536
539
|
}
|
|
@@ -608,7 +611,7 @@ class ue {
|
|
|
608
611
|
)).data;
|
|
609
612
|
}
|
|
610
613
|
}
|
|
611
|
-
function
|
|
614
|
+
function Ke(i, e) {
|
|
612
615
|
if (i === "localhost" || i.startsWith("127.") || i.startsWith("192.168."))
|
|
613
616
|
return null;
|
|
614
617
|
if (e) {
|
|
@@ -616,34 +619,34 @@ function We(i, e) {
|
|
|
616
619
|
if (o === s || o === `www.${s}`)
|
|
617
620
|
return null;
|
|
618
621
|
if (o.endsWith(`.${s}`)) {
|
|
619
|
-
const
|
|
620
|
-
return
|
|
622
|
+
const a = o.slice(0, -(s.length + 1));
|
|
623
|
+
return a === "www" ? null : a;
|
|
621
624
|
}
|
|
622
625
|
return null;
|
|
623
626
|
}
|
|
624
627
|
const r = i.split(".");
|
|
625
628
|
return r.length >= 3 && r[0] !== "www" ? r[0] : null;
|
|
626
629
|
}
|
|
627
|
-
function
|
|
630
|
+
function Je(i, e = "tenant", t) {
|
|
628
631
|
const s = new URLSearchParams(i).get(e);
|
|
629
632
|
return s ? (t && t.setItem("tenant", s), s) : t ? t.getItem("tenant") : null;
|
|
630
633
|
}
|
|
631
|
-
function
|
|
634
|
+
function Ye(i, e, t) {
|
|
632
635
|
const { tenantMode: r, baseDomain: s, selectorParam: o } = i;
|
|
633
|
-
return r === "subdomain" ?
|
|
636
|
+
return r === "subdomain" ? Ke(e.hostname, s) : r === "selector" ? Je(e.search, o, t) : null;
|
|
634
637
|
}
|
|
635
|
-
function
|
|
638
|
+
function Qe(i, e, t) {
|
|
636
639
|
if (t)
|
|
637
640
|
return `${i}.${t}`;
|
|
638
641
|
const r = e.split(".");
|
|
639
642
|
return r.length === 2 ? `${i}.${e}` : r.length >= 3 ? (r[0] = i, r.join(".")) : null;
|
|
640
643
|
}
|
|
641
644
|
const fe = "_auth";
|
|
642
|
-
function
|
|
645
|
+
function Xe(i) {
|
|
643
646
|
const e = JSON.stringify(i);
|
|
644
647
|
return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
645
648
|
}
|
|
646
|
-
function
|
|
649
|
+
function Ze(i) {
|
|
647
650
|
try {
|
|
648
651
|
let e = i.replace(/-/g, "+").replace(/_/g, "/");
|
|
649
652
|
for (; e.length % 4; )
|
|
@@ -654,7 +657,7 @@ function Ke(i) {
|
|
|
654
657
|
return null;
|
|
655
658
|
}
|
|
656
659
|
}
|
|
657
|
-
function
|
|
660
|
+
function et() {
|
|
658
661
|
if (typeof window > "u")
|
|
659
662
|
return console.log("[CrossDomainAuth] SSR environment, skipping URL token extraction"), null;
|
|
660
663
|
const e = new URLSearchParams(window.location.search).get(fe);
|
|
@@ -663,7 +666,7 @@ function Je() {
|
|
|
663
666
|
searchParams: window.location.search,
|
|
664
667
|
encodedLength: e == null ? void 0 : e.length
|
|
665
668
|
}), !e) return null;
|
|
666
|
-
const t =
|
|
669
|
+
const t = Ze(e);
|
|
667
670
|
return console.log("[CrossDomainAuth] Token decode result:", {
|
|
668
671
|
success: !!t,
|
|
669
672
|
hasAccessToken: !!(t != null && t.accessToken),
|
|
@@ -671,7 +674,7 @@ function Je() {
|
|
|
671
674
|
expiresIn: t == null ? void 0 : t.expiresIn
|
|
672
675
|
}), t;
|
|
673
676
|
}
|
|
674
|
-
function
|
|
677
|
+
function tt() {
|
|
675
678
|
if (typeof window > "u") return;
|
|
676
679
|
const i = new URL(window.location.href);
|
|
677
680
|
i.searchParams.delete(fe), console.log("[CrossDomainAuth] Clearing auth tokens from URL", {
|
|
@@ -679,9 +682,9 @@ function Ye() {
|
|
|
679
682
|
newUrl: i.toString()
|
|
680
683
|
}), window.history.replaceState({}, "", i.toString());
|
|
681
684
|
}
|
|
682
|
-
const
|
|
683
|
-
function
|
|
684
|
-
const { baseUrl: t, appInfo: r, appId: s } =
|
|
685
|
+
const ke = ue(null);
|
|
686
|
+
function Bt({ config: i, children: e }) {
|
|
687
|
+
const { baseUrl: t, appInfo: r, appId: s } = he(), o = se(() => typeof window > "u" ? null : Ye(
|
|
685
688
|
{
|
|
686
689
|
tenantMode: i.tenantMode || "selector",
|
|
687
690
|
baseDomain: i.baseDomain,
|
|
@@ -692,118 +695,118 @@ function $t({ config: i, children: e }) {
|
|
|
692
695
|
search: window.location.search
|
|
693
696
|
},
|
|
694
697
|
window.localStorage
|
|
695
|
-
), [i.tenantMode, i.baseDomain, i.selectorParam]), [
|
|
698
|
+
), [i.tenantMode, i.baseDomain, i.selectorParam]), [a, p] = k(() => o()), w = X(
|
|
696
699
|
() => {
|
|
697
|
-
var
|
|
700
|
+
var d, F, v;
|
|
698
701
|
return {
|
|
699
|
-
enabled: ((
|
|
700
|
-
ttl: ((
|
|
702
|
+
enabled: ((d = i.cache) == null ? void 0 : d.enabled) ?? !0,
|
|
703
|
+
ttl: ((F = i.cache) == null ? void 0 : F.ttl) ?? 5 * 60 * 1e3,
|
|
701
704
|
// 5 minutes default
|
|
702
|
-
storageKey: ((
|
|
705
|
+
storageKey: ((v = i.cache) == null ? void 0 : v.storageKey) ?? `tenant_cache_${a || "default"}`
|
|
703
706
|
};
|
|
704
707
|
},
|
|
705
|
-
[i.cache,
|
|
706
|
-
), [
|
|
708
|
+
[i.cache, a]
|
|
709
|
+
), [y, x] = k(() => {
|
|
707
710
|
if (i.initialTenant) return i.initialTenant;
|
|
708
|
-
if (!
|
|
711
|
+
if (!w.enabled || !a) return null;
|
|
709
712
|
try {
|
|
710
|
-
const
|
|
711
|
-
if (!
|
|
712
|
-
const
|
|
713
|
-
return Date.now() -
|
|
713
|
+
const d = localStorage.getItem(w.storageKey);
|
|
714
|
+
if (!d) return null;
|
|
715
|
+
const F = JSON.parse(d);
|
|
716
|
+
return Date.now() - F.timestamp < w.ttl && F.tenantSlug === a ? F.data : (localStorage.removeItem(w.storageKey), null);
|
|
714
717
|
} catch {
|
|
715
718
|
return null;
|
|
716
719
|
}
|
|
717
|
-
}), [
|
|
720
|
+
}), [b, f] = k(!y && !i.initialTenant), [A, L] = k(null), [D, I] = k(null), [M, u] = k(!1), [R, m] = k(null);
|
|
718
721
|
te(() => {
|
|
719
|
-
const
|
|
720
|
-
|
|
722
|
+
const d = o();
|
|
723
|
+
p(d);
|
|
721
724
|
}, [o]);
|
|
722
|
-
const
|
|
723
|
-
async (
|
|
724
|
-
if (!(!
|
|
725
|
+
const H = (r == null ? void 0 : r.settingsSchema) || null, $ = se(
|
|
726
|
+
async (d, F = !1) => {
|
|
727
|
+
if (!(!F && w.enabled && y && y.domain === d))
|
|
725
728
|
try {
|
|
726
|
-
|
|
727
|
-
const
|
|
728
|
-
if (
|
|
729
|
+
f(!0), L(null);
|
|
730
|
+
const v = new re(t), g = await new de(v, s).getPublicTenantInfo(d);
|
|
731
|
+
if (x(g), w.enabled)
|
|
729
732
|
try {
|
|
730
|
-
const
|
|
731
|
-
data:
|
|
733
|
+
const c = {
|
|
734
|
+
data: g,
|
|
732
735
|
timestamp: Date.now(),
|
|
733
|
-
tenantSlug:
|
|
736
|
+
tenantSlug: d
|
|
734
737
|
};
|
|
735
|
-
localStorage.setItem(
|
|
736
|
-
} catch (
|
|
737
|
-
console.warn("Failed to cache tenant info:",
|
|
738
|
+
localStorage.setItem(w.storageKey, JSON.stringify(c));
|
|
739
|
+
} catch (c) {
|
|
740
|
+
console.warn("Failed to cache tenant info:", c);
|
|
738
741
|
}
|
|
739
|
-
} catch (
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
+
} catch (v) {
|
|
743
|
+
const h = v instanceof Error ? v : new Error("Failed to load tenant information");
|
|
744
|
+
L(h), x(null);
|
|
742
745
|
} finally {
|
|
743
|
-
|
|
746
|
+
f(!1);
|
|
744
747
|
}
|
|
745
748
|
},
|
|
746
|
-
[t, s,
|
|
747
|
-
),
|
|
748
|
-
if (!(!
|
|
749
|
+
[t, s, w, y]
|
|
750
|
+
), C = se(async () => {
|
|
751
|
+
if (!(!w.enabled || !y || !a))
|
|
749
752
|
try {
|
|
750
|
-
const
|
|
751
|
-
if (!
|
|
752
|
-
const
|
|
753
|
-
if (Date.now() -
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
const
|
|
757
|
-
data:
|
|
753
|
+
const d = localStorage.getItem(w.storageKey);
|
|
754
|
+
if (!d) return;
|
|
755
|
+
const F = JSON.parse(d);
|
|
756
|
+
if (Date.now() - F.timestamp > w.ttl * 0.5) {
|
|
757
|
+
const h = new re(t), c = await new de(h, s).getPublicTenantInfo(a);
|
|
758
|
+
x(c);
|
|
759
|
+
const j = {
|
|
760
|
+
data: c,
|
|
758
761
|
timestamp: Date.now(),
|
|
759
|
-
tenantSlug:
|
|
762
|
+
tenantSlug: a
|
|
760
763
|
};
|
|
761
|
-
localStorage.setItem(
|
|
764
|
+
localStorage.setItem(w.storageKey, JSON.stringify(j));
|
|
762
765
|
}
|
|
763
|
-
} catch (
|
|
764
|
-
console.warn("Background tenant refresh failed:",
|
|
766
|
+
} catch (d) {
|
|
767
|
+
console.warn("Background tenant refresh failed:", d);
|
|
765
768
|
}
|
|
766
|
-
}, [t, s,
|
|
767
|
-
if (
|
|
769
|
+
}, [t, s, w, y, a]), T = se(async () => {
|
|
770
|
+
if (y != null && y.id)
|
|
768
771
|
try {
|
|
769
|
-
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
} catch (
|
|
773
|
-
const
|
|
774
|
-
|
|
772
|
+
u(!0), m(null);
|
|
773
|
+
const d = new re(t), v = await new de(d, y.appId).getTenantSettings(y.id);
|
|
774
|
+
I(v);
|
|
775
|
+
} catch (d) {
|
|
776
|
+
const F = d instanceof Error ? d : new Error("Failed to load tenant settings");
|
|
777
|
+
m(F), I(null);
|
|
775
778
|
} finally {
|
|
776
|
-
|
|
779
|
+
u(!1);
|
|
777
780
|
}
|
|
778
|
-
}, [t,
|
|
779
|
-
|
|
780
|
-
}, [
|
|
781
|
-
(
|
|
782
|
-
if (!
|
|
781
|
+
}, [t, y]), q = se(() => {
|
|
782
|
+
T();
|
|
783
|
+
}, [T]), S = se(
|
|
784
|
+
(d) => {
|
|
785
|
+
if (!H)
|
|
783
786
|
return { isValid: !0, errors: [] };
|
|
784
|
-
const
|
|
787
|
+
const F = [];
|
|
785
788
|
try {
|
|
786
|
-
return
|
|
787
|
-
var
|
|
788
|
-
const
|
|
789
|
-
if ((
|
|
790
|
-
|
|
789
|
+
return H.properties && Object.entries(H.properties).forEach(([v, h]) => {
|
|
790
|
+
var c;
|
|
791
|
+
const g = d[v];
|
|
792
|
+
if ((c = H.required) != null && c.includes(v) && g == null) {
|
|
793
|
+
F.push(`Field '${v}' is required`);
|
|
791
794
|
return;
|
|
792
795
|
}
|
|
793
|
-
if (
|
|
794
|
-
if (
|
|
795
|
-
const
|
|
796
|
-
|
|
796
|
+
if (g != null) {
|
|
797
|
+
if (h.type) {
|
|
798
|
+
const j = h.type, K = typeof g;
|
|
799
|
+
j === "string" && K !== "string" ? F.push(`Field '${v}' must be a string`) : (j === "number" || j === "integer") && K !== "number" ? F.push(`Field '${v}' must be a number`) : j === "boolean" && K !== "boolean" ? F.push(`Field '${v}' must be a boolean`) : j === "array" && !Array.isArray(g) && F.push(`Field '${v}' must be an array`);
|
|
797
800
|
}
|
|
798
|
-
|
|
799
|
-
`Field '${
|
|
800
|
-
),
|
|
801
|
-
`Field '${
|
|
802
|
-
),
|
|
801
|
+
h.minLength !== void 0 && typeof g == "string" && g.length < h.minLength && F.push(
|
|
802
|
+
`Field '${v}' must be at least ${h.minLength} characters long`
|
|
803
|
+
), h.maxLength !== void 0 && typeof g == "string" && g.length > h.maxLength && F.push(
|
|
804
|
+
`Field '${v}' must be no more than ${h.maxLength} characters long`
|
|
805
|
+
), h.minimum !== void 0 && typeof g == "number" && g < h.minimum && F.push(`Field '${v}' must be at least ${h.minimum}`), h.maximum !== void 0 && typeof g == "number" && g > h.maximum && F.push(`Field '${v}' must be no more than ${h.maximum}`), h.pattern && typeof g == "string" && (new RegExp(h.pattern).test(g) || F.push(`Field '${v}' does not match the required pattern`)), h.enum && !h.enum.includes(g) && F.push(`Field '${v}' must be one of: ${h.enum.join(", ")}`);
|
|
803
806
|
}
|
|
804
807
|
}), {
|
|
805
|
-
isValid:
|
|
806
|
-
errors:
|
|
808
|
+
isValid: F.length === 0,
|
|
809
|
+
errors: F
|
|
807
810
|
};
|
|
808
811
|
} catch {
|
|
809
812
|
return {
|
|
@@ -812,90 +815,90 @@ function $t({ config: i, children: e }) {
|
|
|
812
815
|
};
|
|
813
816
|
}
|
|
814
817
|
},
|
|
815
|
-
[
|
|
818
|
+
[H]
|
|
816
819
|
);
|
|
817
820
|
te(() => {
|
|
818
|
-
!i.initialTenant &&
|
|
819
|
-
}, [i.initialTenant,
|
|
820
|
-
|
|
821
|
-
}, [
|
|
822
|
-
const
|
|
823
|
-
(
|
|
824
|
-
const { mode:
|
|
825
|
-
if (localStorage.setItem("tenant",
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
|
|
821
|
+
!i.initialTenant && a ? y ? C() : $(a) : !i.initialTenant && !a && (x(null), L(null), f(!1));
|
|
822
|
+
}, [i.initialTenant, a, y, $, C]), te(() => {
|
|
823
|
+
y != null && y.id ? T() : (I(null), m(null), u(!1));
|
|
824
|
+
}, [y == null ? void 0 : y.id, T]);
|
|
825
|
+
const P = se(
|
|
826
|
+
(d, F) => {
|
|
827
|
+
const { mode: v = "reload", tokens: h, redirectPath: g } = F || {}, c = i.tenantMode || "selector";
|
|
828
|
+
if (localStorage.setItem("tenant", d), c === "subdomain") {
|
|
829
|
+
const j = window.location.hostname, K = Qe(
|
|
830
|
+
d,
|
|
831
|
+
j,
|
|
829
832
|
i.baseDomain
|
|
830
833
|
);
|
|
831
834
|
if (!K) {
|
|
832
835
|
console.warn(
|
|
833
836
|
"[TenantProvider] Cannot switch subdomain, invalid hostname:",
|
|
834
|
-
|
|
837
|
+
j
|
|
835
838
|
);
|
|
836
839
|
return;
|
|
837
840
|
}
|
|
838
|
-
const
|
|
839
|
-
new URLSearchParams(window.location.search).forEach((
|
|
840
|
-
J !== fe &&
|
|
841
|
-
}),
|
|
842
|
-
} else if (
|
|
843
|
-
const
|
|
844
|
-
if (K.set(i.selectorParam || "tenant",
|
|
845
|
-
const
|
|
846
|
-
window.location.href =
|
|
841
|
+
const N = g || window.location.pathname, z = new URL(`${window.location.protocol}//${K}${N}`);
|
|
842
|
+
new URLSearchParams(window.location.search).forEach((U, J) => {
|
|
843
|
+
J !== fe && z.searchParams.set(J, U);
|
|
844
|
+
}), h && z.searchParams.set(fe, Xe(h)), window.location.href = z.toString();
|
|
845
|
+
} else if (c === "selector") {
|
|
846
|
+
const j = g || window.location.pathname, K = new URLSearchParams(window.location.search);
|
|
847
|
+
if (K.set(i.selectorParam || "tenant", d), v === "reload") {
|
|
848
|
+
const N = `${j}?${K.toString()}${window.location.hash}`;
|
|
849
|
+
window.location.href = N;
|
|
847
850
|
} else {
|
|
848
|
-
const
|
|
849
|
-
window.history.pushState({}, "",
|
|
851
|
+
const N = `${j}?${K.toString()}${window.location.hash}`;
|
|
852
|
+
window.history.pushState({}, "", N), p(d), $(d);
|
|
850
853
|
}
|
|
851
854
|
}
|
|
852
855
|
},
|
|
853
|
-
[i.tenantMode, i.selectorParam, i.baseDomain,
|
|
856
|
+
[i.tenantMode, i.selectorParam, i.baseDomain, $]
|
|
854
857
|
), E = X(() => ({
|
|
855
858
|
// Tenant info
|
|
856
|
-
tenant:
|
|
857
|
-
tenantSlug:
|
|
858
|
-
isTenantLoading:
|
|
859
|
-
tenantError:
|
|
859
|
+
tenant: y,
|
|
860
|
+
tenantSlug: a,
|
|
861
|
+
isTenantLoading: b,
|
|
862
|
+
tenantError: A,
|
|
860
863
|
retryTenant: () => {
|
|
861
|
-
|
|
864
|
+
a && $(a);
|
|
862
865
|
},
|
|
863
866
|
// Settings
|
|
864
|
-
settings:
|
|
865
|
-
settingsSchema:
|
|
866
|
-
isSettingsLoading:
|
|
867
|
-
settingsError:
|
|
867
|
+
settings: D,
|
|
868
|
+
settingsSchema: H,
|
|
869
|
+
isSettingsLoading: M,
|
|
870
|
+
settingsError: R,
|
|
868
871
|
// Actions
|
|
869
|
-
refreshSettings:
|
|
870
|
-
switchTenant:
|
|
872
|
+
refreshSettings: q,
|
|
873
|
+
switchTenant: P,
|
|
871
874
|
// Validation
|
|
872
|
-
validateSettings:
|
|
875
|
+
validateSettings: S
|
|
873
876
|
}), [
|
|
877
|
+
y,
|
|
878
|
+
a,
|
|
874
879
|
b,
|
|
875
|
-
h,
|
|
876
|
-
m,
|
|
877
|
-
u,
|
|
878
|
-
L,
|
|
879
|
-
C,
|
|
880
|
-
z,
|
|
881
880
|
A,
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
881
|
+
D,
|
|
882
|
+
H,
|
|
883
|
+
M,
|
|
884
|
+
R,
|
|
885
|
+
q,
|
|
886
|
+
P,
|
|
887
|
+
S
|
|
885
888
|
]);
|
|
886
|
-
return /* @__PURE__ */ n(
|
|
889
|
+
return /* @__PURE__ */ n(ke.Provider, { value: E, children: e });
|
|
887
890
|
}
|
|
888
891
|
function me() {
|
|
889
|
-
const i =
|
|
892
|
+
const i = ne(ke);
|
|
890
893
|
if (!i)
|
|
891
894
|
throw new Error("useTenant must be used within a TenantProvider");
|
|
892
895
|
return i;
|
|
893
896
|
}
|
|
894
|
-
function
|
|
895
|
-
return
|
|
897
|
+
function ye() {
|
|
898
|
+
return ne(ke);
|
|
896
899
|
}
|
|
897
|
-
const
|
|
898
|
-
function
|
|
900
|
+
const qt = me;
|
|
901
|
+
function zt() {
|
|
899
902
|
const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: s } = me();
|
|
900
903
|
return {
|
|
901
904
|
settings: i,
|
|
@@ -905,7 +908,7 @@ function Ht() {
|
|
|
905
908
|
validateSettings: s
|
|
906
909
|
};
|
|
907
910
|
}
|
|
908
|
-
function
|
|
911
|
+
function le() {
|
|
909
912
|
const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: s } = me();
|
|
910
913
|
return {
|
|
911
914
|
tenant: i,
|
|
@@ -915,326 +918,305 @@ function se() {
|
|
|
915
918
|
retry: s
|
|
916
919
|
};
|
|
917
920
|
}
|
|
918
|
-
const
|
|
919
|
-
function
|
|
920
|
-
const { appId: t, baseUrl: r } =
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
A.current.processed || (A.current.processed = !0, A.current.tokens = Je(), console.log("[AuthProvider] SYNC: URL tokens extracted on init", {
|
|
925
|
-
found: !!A.current.tokens,
|
|
926
|
-
url: typeof window < "u" ? window.location.href : "SSR"
|
|
927
|
-
}));
|
|
928
|
-
const d = X(() => {
|
|
929
|
-
const a = new we({
|
|
921
|
+
const xe = ue(null);
|
|
922
|
+
function Ot({ config: i = {}, children: e }) {
|
|
923
|
+
const { appId: t, baseUrl: r } = he(), { tenant: s, tenantSlug: o, switchTenant: a } = me(), [p, w] = k(i.initialRoles || []), [y, x] = k(!i.initialRoles), [b, f] = k(null), [A, L] = k(!1), [D, I] = k(null), [M, u] = k(0), R = Ve({ done: !1, urlTokens: null });
|
|
924
|
+
R.current.done || (R.current.done = !0, R.current.urlTokens = et(), R.current.urlTokens && console.log("[AuthProvider] SYNC: URL tokens found"));
|
|
925
|
+
const m = X(() => {
|
|
926
|
+
const c = new be({
|
|
930
927
|
tenantSlug: o,
|
|
931
|
-
// SessionManager will generate storageKey internally
|
|
932
928
|
onRefreshFailed: i.onRefreshFailed,
|
|
933
929
|
baseUrl: r
|
|
934
930
|
});
|
|
935
|
-
return
|
|
936
|
-
accessToken:
|
|
937
|
-
refreshToken:
|
|
938
|
-
expiresIn:
|
|
939
|
-
}), console.log(
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
)
|
|
943
|
-
}, [
|
|
944
|
-
const
|
|
945
|
-
return a.setSessionManager(d), a;
|
|
946
|
-
}, [r, d]), F = X(() => new ze(new re(r)), [r]), G = X(() => new Oe(C, d), [C, d]), U = X(() => new ke(new re(r)), [r]), _ = X(() => m || d.getUser(), [m, d]), x = X(() => _ != null && _.roleId && w.find((a) => a.id === _.roleId) || null, [_, w]), T = X(() => (x == null ? void 0 : x.permissions) || [], [x]), E = X(() => d.hasValidSession() && m !== null, [d, m]), c = 5 * 60 * 1e3, I = X(() => {
|
|
947
|
-
const a = async (D = !1) => {
|
|
931
|
+
return R.current.urlTokens && (console.log("[AuthProvider] SYNC: Saving URL tokens to session manager"), c.setTokens({
|
|
932
|
+
accessToken: R.current.urlTokens.accessToken,
|
|
933
|
+
refreshToken: R.current.urlTokens.refreshToken,
|
|
934
|
+
expiresIn: R.current.urlTokens.expiresIn
|
|
935
|
+
}), console.log("[AuthProvider] SYNC: Session valid:", c.hasValidSession())), c;
|
|
936
|
+
}, [o, r, i.onRefreshFailed]), H = R.current.done, $ = X(() => {
|
|
937
|
+
const c = new re(r);
|
|
938
|
+
return c.setSessionManager(m), c;
|
|
939
|
+
}, [r, m]), C = X(() => new _e(new re(r)), [r]), T = X(() => new Ge($, m), [$, m]), q = X(() => new Me(new re(r)), [r]), S = X(() => b || m.getUser(), [b, m]), P = X(() => S != null && S.roleId && p.find((c) => c.id === S.roleId) || null, [S, p]), E = X(() => (P == null ? void 0 : P.permissions) || [], [P]), d = X(() => m.hasValidSession() && b !== null, [m, b]), F = 5 * 60 * 1e3, v = X(() => {
|
|
940
|
+
const c = async (B = !1) => {
|
|
948
941
|
try {
|
|
949
|
-
if (!
|
|
942
|
+
if (!m.hasValidSession())
|
|
950
943
|
return;
|
|
951
|
-
const
|
|
952
|
-
if (!
|
|
944
|
+
const O = Date.now();
|
|
945
|
+
if (!B && O - M < F && b)
|
|
953
946
|
return;
|
|
954
|
-
const
|
|
955
|
-
if (!
|
|
947
|
+
const _ = m.getUserId();
|
|
948
|
+
if (!_) {
|
|
956
949
|
console.warn("[AuthProvider] No userId available in token or storage");
|
|
957
950
|
return;
|
|
958
951
|
}
|
|
959
|
-
|
|
960
|
-
const Z = await
|
|
961
|
-
|
|
962
|
-
} catch (
|
|
963
|
-
const Y =
|
|
964
|
-
|
|
952
|
+
L(!0), I(null);
|
|
953
|
+
const Z = await T.getUserById(_);
|
|
954
|
+
f(Z), m.setUser(Z), u(Date.now());
|
|
955
|
+
} catch (O) {
|
|
956
|
+
const Y = O instanceof Error ? O : new Error("Failed to load user data");
|
|
957
|
+
I(Y), console.error("[AuthProvider] Failed to load user data:", Y);
|
|
965
958
|
} finally {
|
|
966
|
-
|
|
959
|
+
L(!1);
|
|
967
960
|
}
|
|
968
|
-
},
|
|
969
|
-
await
|
|
970
|
-
},
|
|
971
|
-
const { username:
|
|
972
|
-
let Z = s == null ? void 0 : s.id, Q = o, ee =
|
|
973
|
-
|
|
974
|
-
const
|
|
975
|
-
username:
|
|
961
|
+
}, j = async () => {
|
|
962
|
+
await c();
|
|
963
|
+
}, K = async (B) => {
|
|
964
|
+
const { username: O, password: Y, tenantSlug: _ } = B;
|
|
965
|
+
let Z = s == null ? void 0 : s.id, Q = o, ee = m;
|
|
966
|
+
_ && (Z = (await new de($, t).getPublicTenantInfo(_)).id, Q = _);
|
|
967
|
+
const G = await C.login({
|
|
968
|
+
username: O,
|
|
976
969
|
password: Y,
|
|
977
970
|
appId: t,
|
|
978
971
|
tenantId: Z
|
|
979
|
-
}),
|
|
980
|
-
if (
|
|
972
|
+
}), ae = _ && _ !== o;
|
|
973
|
+
if (ae && (ee = new be({
|
|
981
974
|
tenantSlug: Q,
|
|
982
975
|
baseUrl: r
|
|
983
976
|
})), ee.setTokens({
|
|
984
|
-
accessToken:
|
|
985
|
-
refreshToken:
|
|
986
|
-
expiresIn:
|
|
987
|
-
}),
|
|
988
|
-
ee.setUser(
|
|
977
|
+
accessToken: G.accessToken,
|
|
978
|
+
refreshToken: G.refreshToken,
|
|
979
|
+
expiresIn: G.expiresIn
|
|
980
|
+
}), G.user) {
|
|
981
|
+
ee.setUser(G.user), f(G.user);
|
|
989
982
|
try {
|
|
990
|
-
await
|
|
991
|
-
} catch (
|
|
992
|
-
console.warn("Failed to load complete user data after login:",
|
|
983
|
+
await c();
|
|
984
|
+
} catch (ce) {
|
|
985
|
+
console.warn("Failed to load complete user data after login:", ce);
|
|
993
986
|
}
|
|
994
987
|
}
|
|
995
|
-
return
|
|
988
|
+
return ae && Q && Q !== o && a(Q, {
|
|
996
989
|
tokens: {
|
|
997
|
-
accessToken:
|
|
998
|
-
refreshToken:
|
|
999
|
-
expiresIn:
|
|
990
|
+
accessToken: G.accessToken,
|
|
991
|
+
refreshToken: G.refreshToken,
|
|
992
|
+
expiresIn: G.expiresIn
|
|
1000
993
|
}
|
|
1001
|
-
}),
|
|
1002
|
-
},
|
|
1003
|
-
const { email:
|
|
1004
|
-
if (!
|
|
994
|
+
}), G;
|
|
995
|
+
}, N = async (B) => {
|
|
996
|
+
const { email: O, phoneNumber: Y, name: _, password: Z, lastName: Q, tenantId: ee } = B;
|
|
997
|
+
if (!O && !Y)
|
|
1005
998
|
throw new Error("Either email or phoneNumber is required");
|
|
1006
|
-
if (!
|
|
999
|
+
if (!_ || !Z)
|
|
1007
1000
|
throw new Error("Name and password are required");
|
|
1008
|
-
const
|
|
1009
|
-
return await
|
|
1010
|
-
email:
|
|
1001
|
+
const G = ee ?? (s == null ? void 0 : s.id);
|
|
1002
|
+
return await C.signup({
|
|
1003
|
+
email: O,
|
|
1011
1004
|
phoneNumber: Y,
|
|
1012
|
-
name:
|
|
1005
|
+
name: _,
|
|
1013
1006
|
password: Z,
|
|
1014
|
-
tenantId:
|
|
1007
|
+
tenantId: G,
|
|
1015
1008
|
lastName: Q,
|
|
1016
1009
|
appId: t
|
|
1017
1010
|
});
|
|
1018
|
-
},
|
|
1019
|
-
const { email:
|
|
1020
|
-
if (!
|
|
1011
|
+
}, z = async (B) => {
|
|
1012
|
+
const { email: O, phoneNumber: Y, name: _, password: Z, tenantName: Q, lastName: ee } = B;
|
|
1013
|
+
if (!O && !Y)
|
|
1021
1014
|
throw new Error("Either email or phoneNumber is required");
|
|
1022
|
-
if (!
|
|
1015
|
+
if (!_ || !Z || !Q)
|
|
1023
1016
|
throw new Error("Name, password, and tenantName are required");
|
|
1024
|
-
return await
|
|
1025
|
-
email:
|
|
1017
|
+
return await C.signupTenantAdmin({
|
|
1018
|
+
email: O,
|
|
1026
1019
|
phoneNumber: Y,
|
|
1027
|
-
name:
|
|
1020
|
+
name: _,
|
|
1028
1021
|
password: Z,
|
|
1029
1022
|
tenantName: Q,
|
|
1030
1023
|
appId: t,
|
|
1031
1024
|
lastName: ee
|
|
1032
1025
|
});
|
|
1033
|
-
},
|
|
1034
|
-
const { currentPassword:
|
|
1035
|
-
await
|
|
1036
|
-
},
|
|
1037
|
-
const { email:
|
|
1038
|
-
if (!
|
|
1026
|
+
}, V = async (B) => {
|
|
1027
|
+
const { currentPassword: O, newPassword: Y } = B, _ = await m.getAuthHeaders();
|
|
1028
|
+
await C.changePassword({ currentPassword: O, newPassword: Y }, _);
|
|
1029
|
+
}, U = async (B) => {
|
|
1030
|
+
const { email: O, tenantId: Y } = B, _ = Y ?? (s == null ? void 0 : s.id);
|
|
1031
|
+
if (!_)
|
|
1039
1032
|
throw new Error("tenantId is required for password reset");
|
|
1040
|
-
await
|
|
1041
|
-
},
|
|
1042
|
-
const { token:
|
|
1043
|
-
await
|
|
1044
|
-
},
|
|
1045
|
-
const { email:
|
|
1033
|
+
await C.requestPasswordReset({ email: O, tenantId: _ });
|
|
1034
|
+
}, J = async (B) => {
|
|
1035
|
+
const { token: O, newPassword: Y } = B;
|
|
1036
|
+
await C.confirmPasswordReset({ token: O, newPassword: Y });
|
|
1037
|
+
}, ge = async (B) => {
|
|
1038
|
+
const { email: O, frontendUrl: Y, name: _, lastName: Z, tenantId: Q } = B, ee = Q ?? (s == null ? void 0 : s.id);
|
|
1046
1039
|
if (!ee)
|
|
1047
1040
|
throw new Error("tenantId is required for magic link authentication");
|
|
1048
|
-
return await
|
|
1049
|
-
email:
|
|
1041
|
+
return await C.sendMagicLink({
|
|
1042
|
+
email: O,
|
|
1050
1043
|
tenantId: ee,
|
|
1051
1044
|
frontendUrl: Y,
|
|
1052
|
-
name:
|
|
1045
|
+
name: _,
|
|
1053
1046
|
lastName: Z,
|
|
1054
1047
|
appId: t
|
|
1055
1048
|
});
|
|
1056
|
-
},
|
|
1057
|
-
const { token:
|
|
1058
|
-
let Z = s == null ? void 0 : s.id, Q = o, ee =
|
|
1059
|
-
|
|
1060
|
-
const
|
|
1061
|
-
token:
|
|
1049
|
+
}, He = async (B) => {
|
|
1050
|
+
const { token: O, email: Y, tenantSlug: _ } = B;
|
|
1051
|
+
let Z = s == null ? void 0 : s.id, Q = o, ee = m;
|
|
1052
|
+
_ && (Z = (await new de($, t).getPublicTenantInfo(_)).id, Q = _);
|
|
1053
|
+
const G = await C.verifyMagicLink({
|
|
1054
|
+
token: O,
|
|
1062
1055
|
email: Y,
|
|
1063
1056
|
appId: t,
|
|
1064
1057
|
tenantId: Z
|
|
1065
|
-
}),
|
|
1066
|
-
if (
|
|
1058
|
+
}), ae = _ && _ !== o;
|
|
1059
|
+
if (ae && (ee = new be({
|
|
1067
1060
|
tenantSlug: Q,
|
|
1068
1061
|
baseUrl: r
|
|
1069
1062
|
})), ee.setTokens({
|
|
1070
|
-
accessToken:
|
|
1071
|
-
refreshToken:
|
|
1072
|
-
expiresIn:
|
|
1073
|
-
}),
|
|
1074
|
-
ee.setUser(
|
|
1063
|
+
accessToken: G.accessToken,
|
|
1064
|
+
refreshToken: G.refreshToken,
|
|
1065
|
+
expiresIn: G.expiresIn
|
|
1066
|
+
}), G.user) {
|
|
1067
|
+
ee.setUser(G.user), f(G.user);
|
|
1075
1068
|
try {
|
|
1076
|
-
await
|
|
1077
|
-
} catch (
|
|
1078
|
-
console.warn("Failed to load complete user data after magic link login:",
|
|
1069
|
+
await c();
|
|
1070
|
+
} catch (ce) {
|
|
1071
|
+
console.warn("Failed to load complete user data after magic link login:", ce);
|
|
1079
1072
|
}
|
|
1080
1073
|
}
|
|
1081
|
-
return
|
|
1074
|
+
return ae && Q && Q !== o && a(Q, {
|
|
1082
1075
|
tokens: {
|
|
1083
|
-
accessToken:
|
|
1084
|
-
refreshToken:
|
|
1085
|
-
expiresIn:
|
|
1076
|
+
accessToken: G.accessToken,
|
|
1077
|
+
refreshToken: G.refreshToken,
|
|
1078
|
+
expiresIn: G.expiresIn
|
|
1086
1079
|
}
|
|
1087
|
-
}),
|
|
1088
|
-
},
|
|
1089
|
-
const
|
|
1090
|
-
if (!(
|
|
1080
|
+
}), G;
|
|
1081
|
+
}, Ne = async () => {
|
|
1082
|
+
const B = m.getTokens();
|
|
1083
|
+
if (!(B != null && B.refreshToken))
|
|
1091
1084
|
throw new Error("No refresh token available");
|
|
1092
|
-
const
|
|
1093
|
-
refreshToken:
|
|
1085
|
+
const O = await C.refreshToken({
|
|
1086
|
+
refreshToken: B.refreshToken
|
|
1094
1087
|
});
|
|
1095
|
-
|
|
1096
|
-
accessToken:
|
|
1097
|
-
refreshToken:
|
|
1098
|
-
expiresIn:
|
|
1088
|
+
m.setTokens({
|
|
1089
|
+
accessToken: O.accessToken,
|
|
1090
|
+
refreshToken: O.refreshToken || B.refreshToken,
|
|
1091
|
+
expiresIn: O.expiresIn
|
|
1099
1092
|
});
|
|
1100
|
-
},
|
|
1101
|
-
|
|
1102
|
-
},
|
|
1103
|
-
|
|
1104
|
-
},
|
|
1105
|
-
|
|
1106
|
-
},
|
|
1093
|
+
}, Ue = () => {
|
|
1094
|
+
m.clearSession(), f(null), I(null);
|
|
1095
|
+
}, Be = (B) => {
|
|
1096
|
+
m.setTokens(B);
|
|
1097
|
+
}, qe = () => m.hasValidSession(), ze = () => {
|
|
1098
|
+
m.clearSession(), f(null), I(null);
|
|
1099
|
+
}, Oe = async () => {
|
|
1107
1100
|
if (t)
|
|
1108
1101
|
try {
|
|
1109
|
-
|
|
1110
|
-
const { roles:
|
|
1111
|
-
|
|
1112
|
-
} catch (
|
|
1113
|
-
console.error("Failed to fetch roles:",
|
|
1102
|
+
x(!0);
|
|
1103
|
+
const { roles: B } = await q.getRolesByApp(t);
|
|
1104
|
+
w(B);
|
|
1105
|
+
} catch (B) {
|
|
1106
|
+
console.error("Failed to fetch roles:", B);
|
|
1114
1107
|
} finally {
|
|
1115
|
-
|
|
1108
|
+
x(!1);
|
|
1116
1109
|
}
|
|
1117
|
-
},
|
|
1118
|
-
await
|
|
1119
|
-
},
|
|
1120
|
-
if (!
|
|
1110
|
+
}, We = async () => {
|
|
1111
|
+
await Oe();
|
|
1112
|
+
}, we = (B) => {
|
|
1113
|
+
if (!E || E.length === 0)
|
|
1121
1114
|
return !1;
|
|
1122
|
-
if (typeof
|
|
1123
|
-
return
|
|
1124
|
-
const
|
|
1125
|
-
return
|
|
1115
|
+
if (typeof B == "string")
|
|
1116
|
+
return E.includes(B);
|
|
1117
|
+
const O = `${B.resource}.${B.action}`;
|
|
1118
|
+
return E.includes(O);
|
|
1126
1119
|
};
|
|
1127
1120
|
return {
|
|
1128
1121
|
// RFC-003: Authentication state
|
|
1129
|
-
isAuthenticated:
|
|
1130
|
-
sessionManager:
|
|
1131
|
-
authenticatedHttpService:
|
|
1132
|
-
login:
|
|
1133
|
-
signup:
|
|
1134
|
-
signupTenantAdmin:
|
|
1135
|
-
sendMagicLink:
|
|
1136
|
-
verifyMagicLink:
|
|
1137
|
-
changePassword:
|
|
1138
|
-
requestPasswordReset:
|
|
1139
|
-
confirmPasswordReset:
|
|
1140
|
-
refreshToken:
|
|
1141
|
-
logout:
|
|
1142
|
-
setTokens:
|
|
1143
|
-
hasValidSession:
|
|
1144
|
-
clearSession:
|
|
1145
|
-
currentUser:
|
|
1146
|
-
isUserLoading:
|
|
1147
|
-
userError:
|
|
1148
|
-
loadUserData:
|
|
1149
|
-
refreshUser:
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1122
|
+
isAuthenticated: d,
|
|
1123
|
+
sessionManager: m,
|
|
1124
|
+
authenticatedHttpService: $,
|
|
1125
|
+
login: K,
|
|
1126
|
+
signup: N,
|
|
1127
|
+
signupTenantAdmin: z,
|
|
1128
|
+
sendMagicLink: ge,
|
|
1129
|
+
verifyMagicLink: He,
|
|
1130
|
+
changePassword: V,
|
|
1131
|
+
requestPasswordReset: U,
|
|
1132
|
+
confirmPasswordReset: J,
|
|
1133
|
+
refreshToken: Ne,
|
|
1134
|
+
logout: Ue,
|
|
1135
|
+
setTokens: Be,
|
|
1136
|
+
hasValidSession: qe,
|
|
1137
|
+
clearSession: ze,
|
|
1138
|
+
currentUser: b,
|
|
1139
|
+
isUserLoading: A,
|
|
1140
|
+
userError: D,
|
|
1141
|
+
loadUserData: c,
|
|
1142
|
+
refreshUser: j,
|
|
1143
|
+
isAuthInitializing: !H,
|
|
1144
|
+
isAuthReady: H,
|
|
1145
|
+
userRole: P,
|
|
1146
|
+
userPermissions: E,
|
|
1147
|
+
availableRoles: p,
|
|
1148
|
+
rolesLoading: y,
|
|
1149
|
+
hasPermission: we,
|
|
1150
|
+
hasAnyPermission: (B) => B.some((O) => we(O)),
|
|
1151
|
+
hasAllPermissions: (B) => B.every((O) => we(O)),
|
|
1152
|
+
getUserPermissionStrings: () => E || [],
|
|
1153
|
+
refreshRoles: We
|
|
1159
1154
|
};
|
|
1160
1155
|
}, [
|
|
1161
|
-
E,
|
|
1162
1156
|
d,
|
|
1157
|
+
m,
|
|
1158
|
+
$,
|
|
1163
1159
|
C,
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
U,
|
|
1160
|
+
T,
|
|
1161
|
+
q,
|
|
1167
1162
|
t,
|
|
1168
1163
|
s,
|
|
1169
1164
|
o,
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1165
|
+
a,
|
|
1166
|
+
p,
|
|
1167
|
+
b,
|
|
1168
|
+
A,
|
|
1169
|
+
D,
|
|
1170
|
+
H,
|
|
1171
|
+
P,
|
|
1172
|
+
E,
|
|
1173
|
+
M,
|
|
1174
|
+
F
|
|
1179
1175
|
]);
|
|
1180
1176
|
te(() => {
|
|
1181
1177
|
!i.initialRoles && t && (async () => {
|
|
1182
1178
|
try {
|
|
1183
|
-
|
|
1184
|
-
const
|
|
1185
|
-
|
|
1186
|
-
} catch (
|
|
1187
|
-
console.error("Failed to fetch roles:",
|
|
1179
|
+
x(!0);
|
|
1180
|
+
const j = new re(r), K = new Me(j), { roles: N } = await K.getRolesByApp(t);
|
|
1181
|
+
w(N);
|
|
1182
|
+
} catch (j) {
|
|
1183
|
+
console.error("Failed to fetch roles:", j);
|
|
1188
1184
|
} finally {
|
|
1189
|
-
|
|
1185
|
+
x(!1);
|
|
1190
1186
|
}
|
|
1191
1187
|
})();
|
|
1192
1188
|
}, [t, r, i.initialRoles]);
|
|
1193
|
-
const [
|
|
1189
|
+
const [h, g] = k(!1);
|
|
1194
1190
|
return te(() => {
|
|
1195
|
-
|
|
1196
|
-
console.error(
|
|
1197
|
-
"[AuthProvider] Failed to load user data after URL token consumption:",
|
|
1198
|
-
a
|
|
1199
|
-
);
|
|
1191
|
+
h || (g(!0), R.current.urlTokens && (console.log("[AuthProvider] EFFECT: Cleaning up URL after sync token processing"), tt(), console.log("[AuthProvider] EFFECT: Loading user data..."), v.loadUserData().catch((c) => {
|
|
1192
|
+
console.error("[AuthProvider] Failed to load user data:", c);
|
|
1200
1193
|
})));
|
|
1201
|
-
}, [
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1204
|
-
}, [
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
urlTokensCleanedUp: S,
|
|
1210
|
-
hadUrlTokens: !!A.current.tokens
|
|
1211
|
-
}), !S) {
|
|
1212
|
-
console.log("[AuthProvider] Waiting for URL tokens cleanup before auto-load");
|
|
1213
|
-
return;
|
|
1214
|
-
}
|
|
1215
|
-
if (A.current.tokens) {
|
|
1216
|
-
console.log("[AuthProvider] URL tokens present, skipping auto-load (already handled)");
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
|
-
!m && !u && (console.log("[AuthProvider] Auto-loading user data..."), I.loadUserData().catch(() => {
|
|
1220
|
-
}));
|
|
1221
|
-
}, [m, u, I, d, S]), te(() => {
|
|
1222
|
-
if (!d.hasValidSession() || !m)
|
|
1194
|
+
}, [v, h]), te(() => {
|
|
1195
|
+
const c = m.getUser();
|
|
1196
|
+
c && m.hasValidSession() && f(c);
|
|
1197
|
+
}, [m]), te(() => {
|
|
1198
|
+
h && (R.current.urlTokens || !b && !A && m.hasValidSession() && (console.log("[AuthProvider] Auto-loading user data..."), v.loadUserData().catch(() => {
|
|
1199
|
+
})));
|
|
1200
|
+
}, [b, A, v, m, h]), te(() => {
|
|
1201
|
+
if (!m.hasValidSession() || !b)
|
|
1223
1202
|
return;
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1203
|
+
const c = setInterval(() => {
|
|
1204
|
+
v.loadUserData().catch(() => {
|
|
1226
1205
|
});
|
|
1227
|
-
},
|
|
1228
|
-
return () => clearInterval(
|
|
1229
|
-
}, [
|
|
1206
|
+
}, F);
|
|
1207
|
+
return () => clearInterval(c);
|
|
1208
|
+
}, [m, b, v, F]), /* @__PURE__ */ n(xe.Provider, { value: v, children: e });
|
|
1230
1209
|
}
|
|
1231
|
-
function
|
|
1232
|
-
const i =
|
|
1210
|
+
function oe() {
|
|
1211
|
+
const i = ne(xe);
|
|
1233
1212
|
if (!i)
|
|
1234
1213
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
1235
1214
|
return i;
|
|
1236
1215
|
}
|
|
1237
|
-
|
|
1216
|
+
function Fe() {
|
|
1217
|
+
return ne(xe);
|
|
1218
|
+
}
|
|
1219
|
+
class rt {
|
|
1238
1220
|
constructor(e, t) {
|
|
1239
1221
|
this.httpService = e, this.sessionManager = t;
|
|
1240
1222
|
}
|
|
@@ -1314,58 +1296,66 @@ class Qe {
|
|
|
1314
1296
|
})).data;
|
|
1315
1297
|
}
|
|
1316
1298
|
}
|
|
1317
|
-
const
|
|
1318
|
-
function
|
|
1319
|
-
const
|
|
1320
|
-
const
|
|
1321
|
-
return new
|
|
1322
|
-
}, [
|
|
1323
|
-
if (!(
|
|
1324
|
-
|
|
1299
|
+
const Ae = ue(null);
|
|
1300
|
+
function Wt({ config: i = {}, children: e }) {
|
|
1301
|
+
const t = Ee(), r = ye(), s = (t == null ? void 0 : t.baseUrl) ?? "", o = (t == null ? void 0 : t.appId) ?? "", a = (r == null ? void 0 : r.tenant) ?? null, [p, w] = k([]), [y, x] = k(!1), [b, f] = k(null), [A, L] = k(!1), D = X(() => {
|
|
1302
|
+
const u = new re(s);
|
|
1303
|
+
return new rt(u);
|
|
1304
|
+
}, [s]), I = async () => {
|
|
1305
|
+
if (!(a != null && a.id)) {
|
|
1306
|
+
w([]);
|
|
1325
1307
|
return;
|
|
1326
1308
|
}
|
|
1327
|
-
|
|
1309
|
+
x(!0), f(null);
|
|
1328
1310
|
try {
|
|
1329
|
-
const
|
|
1330
|
-
|
|
1331
|
-
} catch (
|
|
1332
|
-
const
|
|
1333
|
-
|
|
1311
|
+
const u = await D.getTenantFeatureFlags(a.id, o);
|
|
1312
|
+
w(u);
|
|
1313
|
+
} catch (u) {
|
|
1314
|
+
const R = u instanceof Error ? u.message : "Failed to fetch feature flags";
|
|
1315
|
+
f(R), i.onError && i.onError(u instanceof Error ? u : new Error(R));
|
|
1334
1316
|
} finally {
|
|
1335
|
-
|
|
1317
|
+
x(!1);
|
|
1336
1318
|
}
|
|
1337
1319
|
};
|
|
1338
1320
|
te(() => {
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1321
|
+
if (!s || !o) return;
|
|
1322
|
+
I().finally(() => L(!0));
|
|
1323
|
+
const u = i.refreshInterval || 5 * 60 * 1e3, R = setInterval(I, u);
|
|
1324
|
+
return () => clearInterval(R);
|
|
1325
|
+
}, [a == null ? void 0 : a.id, s, o, i.refreshInterval]);
|
|
1326
|
+
const M = X(() => {
|
|
1327
|
+
const u = (C) => {
|
|
1328
|
+
const T = p.find((q) => q.key === C);
|
|
1329
|
+
return (T == null ? void 0 : T.value) === !0;
|
|
1330
|
+
}, R = (C) => p.find((T) => T.key === C), m = (C) => {
|
|
1331
|
+
const T = p.find((q) => q.key === C);
|
|
1332
|
+
return T ? T.value ? "enabled" : "disabled" : "not_found";
|
|
1333
|
+
}, H = async () => {
|
|
1334
|
+
await I();
|
|
1335
|
+
}, $ = !!(s && o) && (A || !(a != null && a.id));
|
|
1336
|
+
return {
|
|
1337
|
+
featureFlags: p,
|
|
1338
|
+
loading: y,
|
|
1339
|
+
error: b,
|
|
1340
|
+
isReady: $,
|
|
1341
|
+
isEnabled: u,
|
|
1342
|
+
getFlag: R,
|
|
1343
|
+
getFlagState: m,
|
|
1344
|
+
refresh: H
|
|
1345
|
+
};
|
|
1346
|
+
}, [p, y, b, s, o, a == null ? void 0 : a.id, A]);
|
|
1347
|
+
return /* @__PURE__ */ n(Ae.Provider, { value: M, children: e });
|
|
1361
1348
|
}
|
|
1362
|
-
function
|
|
1363
|
-
const i =
|
|
1349
|
+
function nt() {
|
|
1350
|
+
const i = ne(Ae);
|
|
1364
1351
|
if (!i)
|
|
1365
1352
|
throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
|
|
1366
1353
|
return i;
|
|
1367
1354
|
}
|
|
1368
|
-
|
|
1355
|
+
function Ce() {
|
|
1356
|
+
return ne(Ae);
|
|
1357
|
+
}
|
|
1358
|
+
class st {
|
|
1369
1359
|
constructor(e, t) {
|
|
1370
1360
|
this.httpService = e, this.sessionManager = t;
|
|
1371
1361
|
}
|
|
@@ -1431,64 +1421,68 @@ class Ze {
|
|
|
1431
1421
|
)).data;
|
|
1432
1422
|
}
|
|
1433
1423
|
}
|
|
1434
|
-
const
|
|
1435
|
-
function
|
|
1436
|
-
const
|
|
1437
|
-
const
|
|
1438
|
-
return new
|
|
1439
|
-
}, [
|
|
1440
|
-
if (!(
|
|
1441
|
-
|
|
1424
|
+
const Te = ue(void 0);
|
|
1425
|
+
function jt({ config: i = {}, children: e }) {
|
|
1426
|
+
const t = Ee(), r = ye(), s = (t == null ? void 0 : t.baseUrl) ?? "", o = (r == null ? void 0 : r.tenant) ?? null, [a, p] = k(null), [w, y] = k(!1), [x, b] = k(null), [f, A] = k(!1), L = X(() => {
|
|
1427
|
+
const M = new re(s);
|
|
1428
|
+
return new st(M);
|
|
1429
|
+
}, [s]), D = async () => {
|
|
1430
|
+
if (!(o != null && o.id)) {
|
|
1431
|
+
p(null);
|
|
1442
1432
|
return;
|
|
1443
1433
|
}
|
|
1444
|
-
|
|
1434
|
+
y(!0), b(null);
|
|
1445
1435
|
try {
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1448
|
-
} catch (
|
|
1449
|
-
const
|
|
1450
|
-
b(
|
|
1436
|
+
const M = await L.getTenantSubscriptionFeatures(o.id);
|
|
1437
|
+
p(M);
|
|
1438
|
+
} catch (M) {
|
|
1439
|
+
const u = M instanceof Error ? M.message : "Failed to fetch subscription";
|
|
1440
|
+
b(u), i.onError && i.onError(M instanceof Error ? M : new Error(u));
|
|
1451
1441
|
} finally {
|
|
1452
|
-
|
|
1442
|
+
y(!1);
|
|
1453
1443
|
}
|
|
1454
1444
|
};
|
|
1455
1445
|
te(() => {
|
|
1456
|
-
if (
|
|
1457
|
-
const
|
|
1458
|
-
return () => clearInterval(
|
|
1459
|
-
}, [
|
|
1460
|
-
const
|
|
1461
|
-
const
|
|
1446
|
+
if (!s || (D().finally(() => A(!0)), !i.refreshInterval)) return;
|
|
1447
|
+
const M = i.refreshInterval || 10 * 60 * 1e3, u = setInterval(D, M);
|
|
1448
|
+
return () => clearInterval(u);
|
|
1449
|
+
}, [o == null ? void 0 : o.id, s, i.refreshInterval]);
|
|
1450
|
+
const I = X(() => {
|
|
1451
|
+
const M = (a == null ? void 0 : a.features) || [], u = (T) => {
|
|
1452
|
+
const q = M.find((S) => S.key === T);
|
|
1453
|
+
return q ? q.type === "BOOLEAN" || q.type === "boolean" ? q.value === !0 : !!q.value : !1;
|
|
1454
|
+
}, R = (T) => M.find((q) => q.key === T), m = (T, q) => {
|
|
1455
|
+
const S = M.find((P) => P.key === T);
|
|
1456
|
+
return S ? S.value : q;
|
|
1457
|
+
}, H = (T) => !a || !a.isActive ? !1 : T.includes(a.planId), $ = async () => {
|
|
1458
|
+
await D();
|
|
1459
|
+
}, C = !!s && (f || !(o != null && o.id));
|
|
1462
1460
|
return {
|
|
1463
|
-
subscription:
|
|
1464
|
-
features:
|
|
1465
|
-
loading:
|
|
1466
|
-
error:
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
const C = u.find((F) => F.key === A);
|
|
1474
|
-
return C ? C.value : d;
|
|
1475
|
-
},
|
|
1476
|
-
hasAllowedPlan: (A) => !s || !s.isActive ? !1 : A.includes(s.planId),
|
|
1477
|
-
refresh: async () => {
|
|
1478
|
-
await m();
|
|
1479
|
-
}
|
|
1461
|
+
subscription: a,
|
|
1462
|
+
features: M,
|
|
1463
|
+
loading: w,
|
|
1464
|
+
error: x,
|
|
1465
|
+
isReady: C,
|
|
1466
|
+
isFeatureEnabled: u,
|
|
1467
|
+
getFeature: R,
|
|
1468
|
+
getFeatureValue: m,
|
|
1469
|
+
hasAllowedPlan: H,
|
|
1470
|
+
refresh: $
|
|
1480
1471
|
};
|
|
1481
|
-
}, [s,
|
|
1482
|
-
return /* @__PURE__ */ n(
|
|
1472
|
+
}, [a, w, x, s, o == null ? void 0 : o.id, f]);
|
|
1473
|
+
return /* @__PURE__ */ n(Te.Provider, { value: I, children: e });
|
|
1483
1474
|
}
|
|
1484
|
-
function
|
|
1485
|
-
const i =
|
|
1475
|
+
function it() {
|
|
1476
|
+
const i = ne(Te);
|
|
1486
1477
|
if (i === void 0)
|
|
1487
1478
|
throw new Error("useSubscription must be used within a SubscriptionProvider");
|
|
1488
1479
|
return i;
|
|
1489
1480
|
}
|
|
1481
|
+
function De() {
|
|
1482
|
+
return ne(Te) ?? null;
|
|
1483
|
+
}
|
|
1490
1484
|
var ie = /* @__PURE__ */ ((i) => (i.SUPERUSER = "SUPERUSER", i.TENANT_ADMIN = "TENANT_ADMIN", i.USER = "USER", i))(ie || {});
|
|
1491
|
-
const
|
|
1485
|
+
const Ie = () => /* @__PURE__ */ l(
|
|
1492
1486
|
"div",
|
|
1493
1487
|
{
|
|
1494
1488
|
style: {
|
|
@@ -1525,7 +1519,7 @@ const xe = () => /* @__PURE__ */ l(
|
|
|
1525
1519
|
)
|
|
1526
1520
|
]
|
|
1527
1521
|
}
|
|
1528
|
-
),
|
|
1522
|
+
), Re = ({
|
|
1529
1523
|
userType: i,
|
|
1530
1524
|
minUserType: e,
|
|
1531
1525
|
missingPermissions: t
|
|
@@ -1547,7 +1541,7 @@ const xe = () => /* @__PURE__ */ l(
|
|
|
1547
1541
|
children: [
|
|
1548
1542
|
/* @__PURE__ */ n("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "⚠️" }),
|
|
1549
1543
|
/* @__PURE__ */ n("h3", { style: { color: "#856404", marginBottom: "10px" }, children: "Insufficient Permissions" }),
|
|
1550
|
-
e && i ? /* @__PURE__ */ l(
|
|
1544
|
+
e && i ? /* @__PURE__ */ l(W, { children: [
|
|
1551
1545
|
/* @__PURE__ */ l("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: [
|
|
1552
1546
|
"This content requires ",
|
|
1553
1547
|
/* @__PURE__ */ n("strong", { children: e }),
|
|
@@ -1557,7 +1551,7 @@ const xe = () => /* @__PURE__ */ l(
|
|
|
1557
1551
|
"Your current access level: ",
|
|
1558
1552
|
/* @__PURE__ */ n("strong", { children: i })
|
|
1559
1553
|
] })
|
|
1560
|
-
] }) : /* @__PURE__ */ l(
|
|
1554
|
+
] }) : /* @__PURE__ */ l(W, { children: [
|
|
1561
1555
|
/* @__PURE__ */ n("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: "You don't have the required permissions to view this content." }),
|
|
1562
1556
|
t && t.length > 0 && /* @__PURE__ */ l("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1563
1557
|
"Required permissions: ",
|
|
@@ -1566,7 +1560,7 @@ const xe = () => /* @__PURE__ */ l(
|
|
|
1566
1560
|
] })
|
|
1567
1561
|
]
|
|
1568
1562
|
}
|
|
1569
|
-
),
|
|
1563
|
+
), ot = (i, e) => {
|
|
1570
1564
|
const t = {
|
|
1571
1565
|
[ie.USER]: 1,
|
|
1572
1566
|
[ie.TENANT_ADMIN]: 2,
|
|
@@ -1574,28 +1568,28 @@ const xe = () => /* @__PURE__ */ l(
|
|
|
1574
1568
|
};
|
|
1575
1569
|
return t[i] >= t[e];
|
|
1576
1570
|
};
|
|
1577
|
-
function
|
|
1571
|
+
function Vt({
|
|
1578
1572
|
children: i,
|
|
1579
1573
|
fallback: e,
|
|
1580
1574
|
minUserType: t,
|
|
1581
1575
|
requiredPermissions: r,
|
|
1582
1576
|
requireAllPermissions: s = !1
|
|
1583
1577
|
}) {
|
|
1584
|
-
const { hasValidSession: o, sessionManager:
|
|
1578
|
+
const { hasValidSession: o, sessionManager: a, hasPermission: p, hasAnyPermission: w, hasAllPermissions: y } = oe();
|
|
1585
1579
|
if (!o())
|
|
1586
|
-
return /* @__PURE__ */ n(
|
|
1587
|
-
const
|
|
1588
|
-
if (!
|
|
1589
|
-
return /* @__PURE__ */ n(
|
|
1590
|
-
if (t && !
|
|
1591
|
-
return /* @__PURE__ */ n(
|
|
1592
|
-
if (r && r.length > 0 && !(s ?
|
|
1593
|
-
const
|
|
1594
|
-
return /* @__PURE__ */ n(
|
|
1595
|
-
}
|
|
1596
|
-
return /* @__PURE__ */ n(
|
|
1580
|
+
return /* @__PURE__ */ n(W, { children: e || /* @__PURE__ */ n(Ie, {}) });
|
|
1581
|
+
const x = a.getUser();
|
|
1582
|
+
if (!x)
|
|
1583
|
+
return /* @__PURE__ */ n(W, { children: e || /* @__PURE__ */ n(Ie, {}) });
|
|
1584
|
+
if (t && !ot(x.userType, t))
|
|
1585
|
+
return /* @__PURE__ */ n(Re, { userType: x.userType, minUserType: t });
|
|
1586
|
+
if (r && r.length > 0 && !(s ? y(r) : w(r))) {
|
|
1587
|
+
const f = r.filter((A) => !p(A)).map((A) => typeof A == "string" ? A : A.name);
|
|
1588
|
+
return /* @__PURE__ */ n(Re, { missingPermissions: f });
|
|
1589
|
+
}
|
|
1590
|
+
return /* @__PURE__ */ n(W, { children: i });
|
|
1597
1591
|
}
|
|
1598
|
-
const
|
|
1592
|
+
const at = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1599
1593
|
"div",
|
|
1600
1594
|
{
|
|
1601
1595
|
style: {
|
|
@@ -1631,7 +1625,7 @@ const rt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1631
1625
|
}
|
|
1632
1626
|
)
|
|
1633
1627
|
}
|
|
1634
|
-
),
|
|
1628
|
+
), Le = ({
|
|
1635
1629
|
userType: i,
|
|
1636
1630
|
minUserType: e,
|
|
1637
1631
|
missingPermissions: t
|
|
@@ -1661,7 +1655,7 @@ const rt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1661
1655
|
children: [
|
|
1662
1656
|
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "⚠️" }),
|
|
1663
1657
|
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Insufficient Permissions" }),
|
|
1664
|
-
e && i ? /* @__PURE__ */ l(
|
|
1658
|
+
e && i ? /* @__PURE__ */ l(W, { children: [
|
|
1665
1659
|
/* @__PURE__ */ l("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: [
|
|
1666
1660
|
"This page requires ",
|
|
1667
1661
|
/* @__PURE__ */ n("strong", { children: e }),
|
|
@@ -1671,7 +1665,7 @@ const rt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1671
1665
|
"Your current access level: ",
|
|
1672
1666
|
/* @__PURE__ */ n("strong", { children: i })
|
|
1673
1667
|
] })
|
|
1674
|
-
] }) : /* @__PURE__ */ l(
|
|
1668
|
+
] }) : /* @__PURE__ */ l(W, { children: [
|
|
1675
1669
|
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: "You don't have the required permissions to access this page." }),
|
|
1676
1670
|
t && t.length > 0 && /* @__PURE__ */ l("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1677
1671
|
"Required permissions: ",
|
|
@@ -1682,7 +1676,7 @@ const rt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1682
1676
|
}
|
|
1683
1677
|
)
|
|
1684
1678
|
}
|
|
1685
|
-
),
|
|
1679
|
+
), lt = (i, e) => {
|
|
1686
1680
|
const t = {
|
|
1687
1681
|
[ie.USER]: 1,
|
|
1688
1682
|
[ie.TENANT_ADMIN]: 2,
|
|
@@ -1690,7 +1684,7 @@ const rt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1690
1684
|
};
|
|
1691
1685
|
return t[i] >= t[e];
|
|
1692
1686
|
};
|
|
1693
|
-
function
|
|
1687
|
+
function _t({
|
|
1694
1688
|
children: i,
|
|
1695
1689
|
redirectTo: e = "/login",
|
|
1696
1690
|
minUserType: t,
|
|
@@ -1698,24 +1692,24 @@ function zt({
|
|
|
1698
1692
|
requireAllPermissions: s = !1,
|
|
1699
1693
|
fallback: o
|
|
1700
1694
|
}) {
|
|
1701
|
-
const { hasValidSession:
|
|
1702
|
-
if (!
|
|
1703
|
-
return o ? /* @__PURE__ */ n(
|
|
1704
|
-
/* @__PURE__ */ n(
|
|
1705
|
-
/* @__PURE__ */ n(pe, { to: e, state: { from:
|
|
1695
|
+
const { hasValidSession: a, sessionManager: p, hasPermission: w, hasAnyPermission: y, hasAllPermissions: x } = oe(), b = Se();
|
|
1696
|
+
if (!a())
|
|
1697
|
+
return o ? /* @__PURE__ */ n(W, { children: o }) : /* @__PURE__ */ l(W, { children: [
|
|
1698
|
+
/* @__PURE__ */ n(at, { redirectPath: e }),
|
|
1699
|
+
/* @__PURE__ */ n(pe, { to: e, state: { from: b.pathname }, replace: !0 })
|
|
1706
1700
|
] });
|
|
1707
|
-
const
|
|
1708
|
-
if (!
|
|
1709
|
-
return /* @__PURE__ */ n(pe, { to: e, state: { from:
|
|
1710
|
-
if (t && !
|
|
1711
|
-
return /* @__PURE__ */ n(
|
|
1712
|
-
if (r && r.length > 0 && !(s ?
|
|
1713
|
-
const
|
|
1714
|
-
return /* @__PURE__ */ n(
|
|
1715
|
-
}
|
|
1716
|
-
return /* @__PURE__ */ n(
|
|
1701
|
+
const f = p.getUser();
|
|
1702
|
+
if (!f)
|
|
1703
|
+
return /* @__PURE__ */ n(pe, { to: e, state: { from: b.pathname }, replace: !0 });
|
|
1704
|
+
if (t && !lt(f.userType, t))
|
|
1705
|
+
return /* @__PURE__ */ n(Le, { userType: f.userType, minUserType: t });
|
|
1706
|
+
if (r && r.length > 0 && !(s ? x(r) : y(r))) {
|
|
1707
|
+
const L = r.filter((D) => !w(D)).map((D) => typeof D == "string" ? D : D.name);
|
|
1708
|
+
return /* @__PURE__ */ n(Le, { missingPermissions: L });
|
|
1709
|
+
}
|
|
1710
|
+
return /* @__PURE__ */ n(W, { children: i });
|
|
1717
1711
|
}
|
|
1718
|
-
const
|
|
1712
|
+
const ct = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1719
1713
|
"div",
|
|
1720
1714
|
{
|
|
1721
1715
|
style: {
|
|
@@ -1752,14 +1746,14 @@ const st = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1752
1746
|
)
|
|
1753
1747
|
}
|
|
1754
1748
|
);
|
|
1755
|
-
function
|
|
1756
|
-
const { tenant: r, isLoading: s, error: o } =
|
|
1757
|
-
return s || o ? null : r ? /* @__PURE__ */ n(
|
|
1758
|
-
/* @__PURE__ */ n(
|
|
1759
|
-
/* @__PURE__ */ n(pe, { to: e, state: { from:
|
|
1749
|
+
function Gt({ children: i, redirectTo: e = "/", fallback: t }) {
|
|
1750
|
+
const { tenant: r, isLoading: s, error: o } = le(), a = Se();
|
|
1751
|
+
return s || o ? null : r ? /* @__PURE__ */ n(W, { children: i }) : t ? /* @__PURE__ */ n(W, { children: t }) : /* @__PURE__ */ l(W, { children: [
|
|
1752
|
+
/* @__PURE__ */ n(ct, { redirectPath: e }),
|
|
1753
|
+
/* @__PURE__ */ n(pe, { to: e, state: { from: a.pathname }, replace: !0 })
|
|
1760
1754
|
] });
|
|
1761
1755
|
}
|
|
1762
|
-
const
|
|
1756
|
+
const dt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1763
1757
|
"div",
|
|
1764
1758
|
{
|
|
1765
1759
|
style: {
|
|
@@ -1796,14 +1790,14 @@ const it = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1796
1790
|
)
|
|
1797
1791
|
}
|
|
1798
1792
|
);
|
|
1799
|
-
function
|
|
1800
|
-
const { tenant: r, isLoading: s, error: o } =
|
|
1801
|
-
return s || o ? null : r ? t ? /* @__PURE__ */ n(
|
|
1802
|
-
/* @__PURE__ */ n(
|
|
1803
|
-
/* @__PURE__ */ n(pe, { to: e, state: { from:
|
|
1804
|
-
] }) : /* @__PURE__ */ n(
|
|
1793
|
+
function Kt({ children: i, redirectTo: e = "/dashboard", fallback: t }) {
|
|
1794
|
+
const { tenant: r, isLoading: s, error: o } = le(), a = Se();
|
|
1795
|
+
return s || o ? null : r ? t ? /* @__PURE__ */ n(W, { children: t }) : /* @__PURE__ */ l(W, { children: [
|
|
1796
|
+
/* @__PURE__ */ n(dt, { redirectPath: e }),
|
|
1797
|
+
/* @__PURE__ */ n(pe, { to: e, state: { from: a.pathname }, replace: !0 })
|
|
1798
|
+
] }) : /* @__PURE__ */ n(W, { children: i });
|
|
1805
1799
|
}
|
|
1806
|
-
const
|
|
1800
|
+
const ut = () => /* @__PURE__ */ l(
|
|
1807
1801
|
"div",
|
|
1808
1802
|
{
|
|
1809
1803
|
style: {
|
|
@@ -1820,14 +1814,14 @@ const ot = () => /* @__PURE__ */ l(
|
|
|
1820
1814
|
]
|
|
1821
1815
|
}
|
|
1822
1816
|
);
|
|
1823
|
-
function
|
|
1817
|
+
function Jt({
|
|
1824
1818
|
children: i,
|
|
1825
|
-
fallback: e = /* @__PURE__ */ n(
|
|
1819
|
+
fallback: e = /* @__PURE__ */ n(ut, {}),
|
|
1826
1820
|
allowedPlans: t,
|
|
1827
1821
|
requiredFeature: r
|
|
1828
1822
|
}) {
|
|
1829
|
-
const { subscription: s, hasAllowedPlan: o, isFeatureEnabled:
|
|
1830
|
-
return
|
|
1823
|
+
const { subscription: s, hasAllowedPlan: o, isFeatureEnabled: a, loading: p } = it();
|
|
1824
|
+
return p ? /* @__PURE__ */ n(
|
|
1831
1825
|
"div",
|
|
1832
1826
|
{
|
|
1833
1827
|
style: {
|
|
@@ -1837,9 +1831,9 @@ function Vt({
|
|
|
1837
1831
|
},
|
|
1838
1832
|
children: "Loading subscription..."
|
|
1839
1833
|
}
|
|
1840
|
-
) : s ? s.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ n(
|
|
1834
|
+
) : s ? s.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ n(W, { children: e }) : r && !a(r) ? /* @__PURE__ */ n(W, { children: e }) : /* @__PURE__ */ n(W, { children: i }) : /* @__PURE__ */ n(W, { children: e }) : /* @__PURE__ */ n(W, { children: e });
|
|
1841
1835
|
}
|
|
1842
|
-
const
|
|
1836
|
+
const ht = ({ flagName: i }) => /* @__PURE__ */ l(
|
|
1843
1837
|
"div",
|
|
1844
1838
|
{
|
|
1845
1839
|
style: {
|
|
@@ -1866,8 +1860,8 @@ const at = ({ flagName: i }) => /* @__PURE__ */ l(
|
|
|
1866
1860
|
]
|
|
1867
1861
|
}
|
|
1868
1862
|
);
|
|
1869
|
-
function
|
|
1870
|
-
const { isEnabled: r, loading: s } =
|
|
1863
|
+
function Yt({ name: i, children: e, fallback: t }) {
|
|
1864
|
+
const { isEnabled: r, loading: s } = nt();
|
|
1871
1865
|
return s ? /* @__PURE__ */ n(
|
|
1872
1866
|
"div",
|
|
1873
1867
|
{
|
|
@@ -1881,9 +1875,9 @@ function jt({ name: i, children: e, fallback: t }) {
|
|
|
1881
1875
|
},
|
|
1882
1876
|
children: "Loading feature flags..."
|
|
1883
1877
|
}
|
|
1884
|
-
) : r(i) ? /* @__PURE__ */ n(
|
|
1878
|
+
) : r(i) ? /* @__PURE__ */ n(W, { children: e }) : /* @__PURE__ */ n(W, { children: t || /* @__PURE__ */ n(ht, { flagName: i }) });
|
|
1885
1879
|
}
|
|
1886
|
-
const
|
|
1880
|
+
const gt = () => /* @__PURE__ */ l(
|
|
1887
1881
|
"svg",
|
|
1888
1882
|
{
|
|
1889
1883
|
width: "16",
|
|
@@ -1900,7 +1894,7 @@ const lt = () => /* @__PURE__ */ l(
|
|
|
1900
1894
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
1901
1895
|
]
|
|
1902
1896
|
}
|
|
1903
|
-
),
|
|
1897
|
+
), pt = () => /* @__PURE__ */ l(
|
|
1904
1898
|
"svg",
|
|
1905
1899
|
{
|
|
1906
1900
|
width: "16",
|
|
@@ -1917,10 +1911,10 @@ const lt = () => /* @__PURE__ */ l(
|
|
|
1917
1911
|
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1918
1912
|
]
|
|
1919
1913
|
}
|
|
1920
|
-
),
|
|
1921
|
-
showPassword: /* @__PURE__ */ n(
|
|
1922
|
-
hidePassword: /* @__PURE__ */ n(
|
|
1923
|
-
},
|
|
1914
|
+
), ft = {
|
|
1915
|
+
showPassword: /* @__PURE__ */ n(gt, {}),
|
|
1916
|
+
hidePassword: /* @__PURE__ */ n(pt, {})
|
|
1917
|
+
}, mt = {
|
|
1924
1918
|
title: "Sign In",
|
|
1925
1919
|
usernameLabel: "Email or Phone",
|
|
1926
1920
|
usernamePlaceholder: "Enter your email or phone number",
|
|
@@ -1934,7 +1928,7 @@ const lt = () => /* @__PURE__ */ l(
|
|
|
1934
1928
|
magicLinkLink: "Use Magic Link",
|
|
1935
1929
|
errorMessage: "Invalid credentials",
|
|
1936
1930
|
loadingText: "Signing in..."
|
|
1937
|
-
},
|
|
1931
|
+
}, yt = {
|
|
1938
1932
|
container: {
|
|
1939
1933
|
maxWidth: "400px",
|
|
1940
1934
|
width: "100%",
|
|
@@ -2041,133 +2035,133 @@ const lt = () => /* @__PURE__ */ l(
|
|
|
2041
2035
|
fontSize: "0.875rem"
|
|
2042
2036
|
}
|
|
2043
2037
|
};
|
|
2044
|
-
function
|
|
2038
|
+
function Qt({
|
|
2045
2039
|
copy: i = {},
|
|
2046
2040
|
styles: e = {},
|
|
2047
2041
|
icons: t = {},
|
|
2048
2042
|
onSuccess: r,
|
|
2049
2043
|
onError: s,
|
|
2050
2044
|
onForgotPassword: o,
|
|
2051
|
-
onSignupClick:
|
|
2052
|
-
onMagicLinkClick:
|
|
2053
|
-
showForgotPassword:
|
|
2054
|
-
showSignupLink:
|
|
2055
|
-
showMagicLinkOption:
|
|
2056
|
-
className:
|
|
2045
|
+
onSignupClick: a,
|
|
2046
|
+
onMagicLinkClick: p,
|
|
2047
|
+
showForgotPassword: w = !0,
|
|
2048
|
+
showSignupLink: y = !0,
|
|
2049
|
+
showMagicLinkOption: x = !0,
|
|
2050
|
+
className: b
|
|
2057
2051
|
}) {
|
|
2058
|
-
const [
|
|
2059
|
-
const
|
|
2060
|
-
return
|
|
2061
|
-
},
|
|
2062
|
-
if (
|
|
2063
|
-
if (!(
|
|
2064
|
-
|
|
2052
|
+
const [f, A] = k(""), [L, D] = k(""), [I, M] = k(!1), [u, R] = k(!1), [m, H] = k(""), [$, C] = k({}), { login: T } = oe(), { tenant: q } = le(), S = { ...mt, ...i }, P = { ...yt, ...e }, E = { ...ft, ...t }, d = () => {
|
|
2053
|
+
const g = {};
|
|
2054
|
+
return f.trim() || (g.username = !0), L.trim() || (g.password = !0), C(g), Object.keys(g).length === 0;
|
|
2055
|
+
}, F = async (g) => {
|
|
2056
|
+
if (g.preventDefault(), !!d()) {
|
|
2057
|
+
if (!(q != null && q.id)) {
|
|
2058
|
+
H("Tenant not found");
|
|
2065
2059
|
return;
|
|
2066
2060
|
}
|
|
2067
|
-
|
|
2061
|
+
R(!0), H("");
|
|
2068
2062
|
try {
|
|
2069
|
-
const
|
|
2070
|
-
username:
|
|
2071
|
-
password:
|
|
2063
|
+
const c = await T({
|
|
2064
|
+
username: f,
|
|
2065
|
+
password: L
|
|
2072
2066
|
// tenantId inferred from context automatically
|
|
2073
2067
|
});
|
|
2074
|
-
r == null || r(
|
|
2075
|
-
} catch (
|
|
2076
|
-
const
|
|
2077
|
-
|
|
2068
|
+
r == null || r(c);
|
|
2069
|
+
} catch (c) {
|
|
2070
|
+
const j = c.message || S.errorMessage;
|
|
2071
|
+
H(j), s == null || s(j);
|
|
2078
2072
|
} finally {
|
|
2079
|
-
|
|
2073
|
+
R(!1);
|
|
2080
2074
|
}
|
|
2081
2075
|
}
|
|
2082
|
-
},
|
|
2083
|
-
...
|
|
2084
|
-
|
|
2085
|
-
}),
|
|
2086
|
-
...
|
|
2087
|
-
...
|
|
2088
|
-
...!
|
|
2076
|
+
}, v = (g) => ({
|
|
2077
|
+
...P.input,
|
|
2078
|
+
...$[g] ? P.inputError : {}
|
|
2079
|
+
}), h = () => ({
|
|
2080
|
+
...P.button,
|
|
2081
|
+
...u ? P.buttonLoading : {},
|
|
2082
|
+
...!f || !L || u ? P.buttonDisabled : {}
|
|
2089
2083
|
});
|
|
2090
|
-
return /* @__PURE__ */ l("div", { className:
|
|
2091
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2092
|
-
/* @__PURE__ */ l("form", { onSubmit:
|
|
2093
|
-
/* @__PURE__ */ l("div", { style:
|
|
2094
|
-
/* @__PURE__ */ n("label", { style:
|
|
2084
|
+
return /* @__PURE__ */ l("div", { className: b, style: P.container, children: [
|
|
2085
|
+
/* @__PURE__ */ n("h2", { style: P.title, children: S.title }),
|
|
2086
|
+
/* @__PURE__ */ l("form", { onSubmit: F, style: P.form, children: [
|
|
2087
|
+
/* @__PURE__ */ l("div", { style: P.fieldGroup, children: [
|
|
2088
|
+
/* @__PURE__ */ n("label", { style: P.label, children: S.usernameLabel }),
|
|
2095
2089
|
/* @__PURE__ */ n(
|
|
2096
2090
|
"input",
|
|
2097
2091
|
{
|
|
2098
2092
|
id: "username",
|
|
2099
2093
|
name: "username",
|
|
2100
2094
|
type: "text",
|
|
2101
|
-
value:
|
|
2102
|
-
onChange: (
|
|
2103
|
-
|
|
2095
|
+
value: f,
|
|
2096
|
+
onChange: (g) => {
|
|
2097
|
+
A(g.target.value), $.username && C((c) => ({ ...c, username: !1 }));
|
|
2104
2098
|
},
|
|
2105
|
-
placeholder:
|
|
2106
|
-
style:
|
|
2107
|
-
disabled:
|
|
2099
|
+
placeholder: S.usernamePlaceholder,
|
|
2100
|
+
style: v("username"),
|
|
2101
|
+
disabled: u
|
|
2108
2102
|
}
|
|
2109
2103
|
)
|
|
2110
2104
|
] }),
|
|
2111
|
-
/* @__PURE__ */ l("div", { style:
|
|
2112
|
-
/* @__PURE__ */ n("label", { style:
|
|
2113
|
-
/* @__PURE__ */ l("div", { style:
|
|
2105
|
+
/* @__PURE__ */ l("div", { style: P.fieldGroup, children: [
|
|
2106
|
+
/* @__PURE__ */ n("label", { style: P.label, children: S.passwordLabel }),
|
|
2107
|
+
/* @__PURE__ */ l("div", { style: P.inputContainer, children: [
|
|
2114
2108
|
/* @__PURE__ */ n(
|
|
2115
2109
|
"input",
|
|
2116
2110
|
{
|
|
2117
2111
|
id: "password",
|
|
2118
2112
|
name: "password",
|
|
2119
|
-
type:
|
|
2120
|
-
value:
|
|
2121
|
-
onChange: (
|
|
2122
|
-
|
|
2113
|
+
type: I ? "text" : "password",
|
|
2114
|
+
value: L,
|
|
2115
|
+
onChange: (g) => {
|
|
2116
|
+
D(g.target.value), $.password && C((c) => ({ ...c, password: !1 }));
|
|
2123
2117
|
},
|
|
2124
|
-
placeholder:
|
|
2118
|
+
placeholder: S.passwordPlaceholder,
|
|
2125
2119
|
style: {
|
|
2126
|
-
...
|
|
2120
|
+
...v("password"),
|
|
2127
2121
|
paddingRight: "2.5rem"
|
|
2128
2122
|
// Make room for the icon
|
|
2129
2123
|
},
|
|
2130
|
-
disabled:
|
|
2124
|
+
disabled: u
|
|
2131
2125
|
}
|
|
2132
2126
|
),
|
|
2133
2127
|
/* @__PURE__ */ n(
|
|
2134
2128
|
"button",
|
|
2135
2129
|
{
|
|
2136
2130
|
type: "button",
|
|
2137
|
-
onClick: () =>
|
|
2138
|
-
style:
|
|
2139
|
-
disabled:
|
|
2140
|
-
"aria-label":
|
|
2141
|
-
children:
|
|
2131
|
+
onClick: () => M(!I),
|
|
2132
|
+
style: P.passwordToggle,
|
|
2133
|
+
disabled: u,
|
|
2134
|
+
"aria-label": I ? "Hide password" : "Show password",
|
|
2135
|
+
children: I ? E.hidePassword : E.showPassword
|
|
2142
2136
|
}
|
|
2143
2137
|
)
|
|
2144
2138
|
] })
|
|
2145
2139
|
] }),
|
|
2146
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !
|
|
2147
|
-
|
|
2140
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !f || !L || u, style: h(), children: u ? S.loadingText : S.submitButton }),
|
|
2141
|
+
m && /* @__PURE__ */ n("div", { style: P.errorText, children: m })
|
|
2148
2142
|
] }),
|
|
2149
|
-
(
|
|
2150
|
-
|
|
2151
|
-
/* @__PURE__ */ l("span", { style:
|
|
2152
|
-
|
|
2143
|
+
(w || y || x) && /* @__PURE__ */ l("div", { style: P.linkContainer, children: [
|
|
2144
|
+
x && /* @__PURE__ */ l("div", { children: [
|
|
2145
|
+
/* @__PURE__ */ l("span", { style: P.divider, children: [
|
|
2146
|
+
S.magicLinkText,
|
|
2153
2147
|
" "
|
|
2154
2148
|
] }),
|
|
2155
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2149
|
+
/* @__PURE__ */ n("a", { onClick: p, style: P.link, children: S.magicLinkLink })
|
|
2156
2150
|
] }),
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
/* @__PURE__ */ l("span", { style:
|
|
2162
|
-
|
|
2151
|
+
x && (w || y) && /* @__PURE__ */ n("div", { style: P.divider, children: "•" }),
|
|
2152
|
+
w && /* @__PURE__ */ n("a", { onClick: o, style: P.link, children: S.forgotPasswordLink }),
|
|
2153
|
+
w && y && /* @__PURE__ */ n("div", { style: P.divider, children: "•" }),
|
|
2154
|
+
y && /* @__PURE__ */ l("div", { children: [
|
|
2155
|
+
/* @__PURE__ */ l("span", { style: P.divider, children: [
|
|
2156
|
+
S.signupText,
|
|
2163
2157
|
" "
|
|
2164
2158
|
] }),
|
|
2165
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2159
|
+
/* @__PURE__ */ n("a", { onClick: a, style: P.link, children: S.signupLink })
|
|
2166
2160
|
] })
|
|
2167
2161
|
] })
|
|
2168
2162
|
] });
|
|
2169
2163
|
}
|
|
2170
|
-
const
|
|
2164
|
+
const wt = {
|
|
2171
2165
|
title: "Create Account",
|
|
2172
2166
|
nameLabel: "First Name",
|
|
2173
2167
|
namePlaceholder: "Enter your first name",
|
|
@@ -2193,7 +2187,7 @@ const gt = {
|
|
|
2193
2187
|
passwordMismatchError: "Passwords do not match",
|
|
2194
2188
|
isAdminLabel: "Create new organization",
|
|
2195
2189
|
isAdminDescription: "Check this if you want to create a new organization"
|
|
2196
|
-
},
|
|
2190
|
+
}, bt = {
|
|
2197
2191
|
container: {
|
|
2198
2192
|
maxWidth: "400px",
|
|
2199
2193
|
width: "100%",
|
|
@@ -2292,134 +2286,134 @@ const gt = {
|
|
|
2292
2286
|
fontSize: "0.875rem"
|
|
2293
2287
|
}
|
|
2294
2288
|
};
|
|
2295
|
-
function
|
|
2289
|
+
function Xt({
|
|
2296
2290
|
copy: i = {},
|
|
2297
2291
|
styles: e = {},
|
|
2298
2292
|
signupType: t = "user",
|
|
2299
2293
|
onSuccess: r,
|
|
2300
2294
|
onError: s,
|
|
2301
2295
|
onLoginClick: o,
|
|
2302
|
-
onMagicLinkClick:
|
|
2303
|
-
showLoginLink:
|
|
2304
|
-
showMagicLinkOption:
|
|
2305
|
-
className:
|
|
2296
|
+
onMagicLinkClick: a,
|
|
2297
|
+
showLoginLink: p = !0,
|
|
2298
|
+
showMagicLinkOption: w = !0,
|
|
2299
|
+
className: y
|
|
2306
2300
|
}) {
|
|
2307
|
-
const [
|
|
2308
|
-
const
|
|
2309
|
-
return
|
|
2310
|
-
}, K = async (
|
|
2311
|
-
if (
|
|
2312
|
-
if (
|
|
2313
|
-
|
|
2301
|
+
const [x, b] = k(""), [f, A] = k(""), [L, D] = k(""), [I, M] = k(""), [u, R] = k(""), [m, H] = k(""), [$, C] = k(""), [T, q] = k(!1), [S, P] = k(""), [E, d] = k({}), { signup: F, signupTenantAdmin: v } = oe(), { tenant: h } = le(), g = { ...wt, ...i }, c = { ...bt, ...e }, j = () => {
|
|
2302
|
+
const U = {};
|
|
2303
|
+
return x.trim() || (U.name = !0), !L.trim() && !I.trim() && (U.email = !0, U.phoneNumber = !0), u.trim() || (U.password = !0), m.trim() || (U.confirmPassword = !0), t === "tenant" && !$.trim() && (U.tenantName = !0), d(U), Object.keys(U).length === 0;
|
|
2304
|
+
}, K = async (U) => {
|
|
2305
|
+
if (U.preventDefault(), !!j()) {
|
|
2306
|
+
if (u !== m) {
|
|
2307
|
+
P(g.passwordMismatchError), d({ confirmPassword: !0 });
|
|
2314
2308
|
return;
|
|
2315
2309
|
}
|
|
2316
|
-
if (t === "user" && !(
|
|
2317
|
-
|
|
2310
|
+
if (t === "user" && !(h != null && h.id)) {
|
|
2311
|
+
P("Tenant not found");
|
|
2318
2312
|
return;
|
|
2319
2313
|
}
|
|
2320
|
-
|
|
2314
|
+
q(!0), P("");
|
|
2321
2315
|
try {
|
|
2322
2316
|
let J;
|
|
2323
|
-
t === "tenant" ? J = await
|
|
2324
|
-
email:
|
|
2325
|
-
phoneNumber:
|
|
2326
|
-
name:
|
|
2327
|
-
password:
|
|
2328
|
-
tenantName:
|
|
2329
|
-
lastName:
|
|
2330
|
-
}) : J = await
|
|
2331
|
-
email:
|
|
2332
|
-
phoneNumber:
|
|
2333
|
-
name:
|
|
2334
|
-
password:
|
|
2335
|
-
tenantId:
|
|
2336
|
-
lastName:
|
|
2317
|
+
t === "tenant" ? J = await v({
|
|
2318
|
+
email: L || void 0,
|
|
2319
|
+
phoneNumber: I || void 0,
|
|
2320
|
+
name: x,
|
|
2321
|
+
password: u,
|
|
2322
|
+
tenantName: $,
|
|
2323
|
+
lastName: f || void 0
|
|
2324
|
+
}) : J = await F({
|
|
2325
|
+
email: L || void 0,
|
|
2326
|
+
phoneNumber: I || void 0,
|
|
2327
|
+
name: x,
|
|
2328
|
+
password: u,
|
|
2329
|
+
tenantId: h.id,
|
|
2330
|
+
lastName: f || void 0
|
|
2337
2331
|
}), r == null || r(J);
|
|
2338
2332
|
} catch (J) {
|
|
2339
|
-
const ge = J.message ||
|
|
2340
|
-
|
|
2333
|
+
const ge = J.message || g.errorMessage;
|
|
2334
|
+
P(ge), s == null || s(ge);
|
|
2341
2335
|
} finally {
|
|
2342
|
-
|
|
2336
|
+
q(!1);
|
|
2343
2337
|
}
|
|
2344
2338
|
}
|
|
2345
|
-
},
|
|
2346
|
-
...
|
|
2347
|
-
...E[
|
|
2348
|
-
}),
|
|
2349
|
-
...
|
|
2350
|
-
...
|
|
2351
|
-
...!
|
|
2352
|
-
}),
|
|
2353
|
-
return /* @__PURE__ */ l("div", { className:
|
|
2354
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2355
|
-
/* @__PURE__ */ l("form", { onSubmit: K, style:
|
|
2356
|
-
/* @__PURE__ */ l("div", { style:
|
|
2357
|
-
/* @__PURE__ */ n("label", { style:
|
|
2339
|
+
}, N = (U) => ({
|
|
2340
|
+
...c.input,
|
|
2341
|
+
...E[U] ? c.inputError : {}
|
|
2342
|
+
}), z = () => ({
|
|
2343
|
+
...c.button,
|
|
2344
|
+
...T ? c.buttonLoading : {},
|
|
2345
|
+
...!x || !L && !I || !u || !m || T || t === "tenant" && !$ ? c.buttonDisabled : {}
|
|
2346
|
+
}), V = x && (L || I) && u && m && (t === "user" || $);
|
|
2347
|
+
return /* @__PURE__ */ l("div", { className: y, style: c.container, children: [
|
|
2348
|
+
/* @__PURE__ */ n("h2", { style: c.title, children: g.title }),
|
|
2349
|
+
/* @__PURE__ */ l("form", { onSubmit: K, style: c.form, children: [
|
|
2350
|
+
/* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
|
|
2351
|
+
/* @__PURE__ */ n("label", { style: c.label, children: g.nameLabel }),
|
|
2358
2352
|
/* @__PURE__ */ n(
|
|
2359
2353
|
"input",
|
|
2360
2354
|
{
|
|
2361
2355
|
id: "name",
|
|
2362
2356
|
name: "name",
|
|
2363
2357
|
type: "text",
|
|
2364
|
-
value:
|
|
2365
|
-
onChange: (
|
|
2366
|
-
|
|
2358
|
+
value: x,
|
|
2359
|
+
onChange: (U) => {
|
|
2360
|
+
b(U.target.value), E.name && d((J) => ({ ...J, name: !1 }));
|
|
2367
2361
|
},
|
|
2368
|
-
placeholder:
|
|
2369
|
-
style:
|
|
2370
|
-
disabled:
|
|
2362
|
+
placeholder: g.namePlaceholder,
|
|
2363
|
+
style: N("name"),
|
|
2364
|
+
disabled: T
|
|
2371
2365
|
}
|
|
2372
2366
|
)
|
|
2373
2367
|
] }),
|
|
2374
|
-
/* @__PURE__ */ l("div", { style:
|
|
2375
|
-
/* @__PURE__ */ n("label", { style:
|
|
2368
|
+
/* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
|
|
2369
|
+
/* @__PURE__ */ n("label", { style: c.label, children: g.lastNameLabel }),
|
|
2376
2370
|
/* @__PURE__ */ n(
|
|
2377
2371
|
"input",
|
|
2378
2372
|
{
|
|
2379
2373
|
id: "lastName",
|
|
2380
2374
|
name: "lastName",
|
|
2381
2375
|
type: "text",
|
|
2382
|
-
value:
|
|
2383
|
-
onChange: (
|
|
2384
|
-
placeholder:
|
|
2385
|
-
style:
|
|
2386
|
-
disabled:
|
|
2376
|
+
value: f,
|
|
2377
|
+
onChange: (U) => A(U.target.value),
|
|
2378
|
+
placeholder: g.lastNamePlaceholder,
|
|
2379
|
+
style: c.input,
|
|
2380
|
+
disabled: T
|
|
2387
2381
|
}
|
|
2388
2382
|
)
|
|
2389
2383
|
] }),
|
|
2390
|
-
/* @__PURE__ */ l("div", { style:
|
|
2391
|
-
/* @__PURE__ */ n("label", { style:
|
|
2384
|
+
/* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
|
|
2385
|
+
/* @__PURE__ */ n("label", { style: c.label, children: g.emailLabel }),
|
|
2392
2386
|
/* @__PURE__ */ n(
|
|
2393
2387
|
"input",
|
|
2394
2388
|
{
|
|
2395
2389
|
id: "email",
|
|
2396
2390
|
name: "email",
|
|
2397
2391
|
type: "email",
|
|
2398
|
-
value:
|
|
2399
|
-
onChange: (
|
|
2400
|
-
|
|
2392
|
+
value: L,
|
|
2393
|
+
onChange: (U) => {
|
|
2394
|
+
D(U.target.value), E.email && d((J) => ({ ...J, email: !1, phoneNumber: !1 }));
|
|
2401
2395
|
},
|
|
2402
|
-
placeholder:
|
|
2403
|
-
style:
|
|
2404
|
-
disabled:
|
|
2396
|
+
placeholder: g.emailPlaceholder,
|
|
2397
|
+
style: N("email"),
|
|
2398
|
+
disabled: T
|
|
2405
2399
|
}
|
|
2406
2400
|
)
|
|
2407
2401
|
] }),
|
|
2408
|
-
/* @__PURE__ */ l("div", { style:
|
|
2409
|
-
/* @__PURE__ */ n("label", { style:
|
|
2402
|
+
/* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
|
|
2403
|
+
/* @__PURE__ */ n("label", { style: c.label, children: g.phoneNumberLabel }),
|
|
2410
2404
|
/* @__PURE__ */ n(
|
|
2411
2405
|
"input",
|
|
2412
2406
|
{
|
|
2413
2407
|
id: "phoneNumber",
|
|
2414
2408
|
name: "phoneNumber",
|
|
2415
2409
|
type: "tel",
|
|
2416
|
-
value:
|
|
2417
|
-
onChange: (
|
|
2418
|
-
|
|
2410
|
+
value: I,
|
|
2411
|
+
onChange: (U) => {
|
|
2412
|
+
M(U.target.value), E.phoneNumber && d((J) => ({ ...J, email: !1, phoneNumber: !1 }));
|
|
2419
2413
|
},
|
|
2420
|
-
placeholder:
|
|
2421
|
-
style:
|
|
2422
|
-
disabled:
|
|
2414
|
+
placeholder: g.phoneNumberPlaceholder,
|
|
2415
|
+
style: N("phoneNumber"),
|
|
2416
|
+
disabled: T
|
|
2423
2417
|
}
|
|
2424
2418
|
)
|
|
2425
2419
|
] }),
|
|
@@ -2435,83 +2429,83 @@ function Gt({
|
|
|
2435
2429
|
children: "At least one contact method (email or phone) is required"
|
|
2436
2430
|
}
|
|
2437
2431
|
),
|
|
2438
|
-
/* @__PURE__ */ l("div", { style:
|
|
2439
|
-
/* @__PURE__ */ n("label", { style:
|
|
2432
|
+
/* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
|
|
2433
|
+
/* @__PURE__ */ n("label", { style: c.label, children: g.passwordLabel }),
|
|
2440
2434
|
/* @__PURE__ */ n(
|
|
2441
2435
|
"input",
|
|
2442
2436
|
{
|
|
2443
2437
|
id: "password",
|
|
2444
2438
|
name: "password",
|
|
2445
2439
|
type: "password",
|
|
2446
|
-
value:
|
|
2447
|
-
onChange: (
|
|
2448
|
-
|
|
2440
|
+
value: u,
|
|
2441
|
+
onChange: (U) => {
|
|
2442
|
+
R(U.target.value), E.password && d((J) => ({ ...J, password: !1 }));
|
|
2449
2443
|
},
|
|
2450
|
-
placeholder:
|
|
2451
|
-
style:
|
|
2452
|
-
disabled:
|
|
2444
|
+
placeholder: g.passwordPlaceholder,
|
|
2445
|
+
style: N("password"),
|
|
2446
|
+
disabled: T
|
|
2453
2447
|
}
|
|
2454
2448
|
)
|
|
2455
2449
|
] }),
|
|
2456
|
-
/* @__PURE__ */ l("div", { style:
|
|
2457
|
-
/* @__PURE__ */ n("label", { style:
|
|
2450
|
+
/* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
|
|
2451
|
+
/* @__PURE__ */ n("label", { style: c.label, children: g.confirmPasswordLabel }),
|
|
2458
2452
|
/* @__PURE__ */ n(
|
|
2459
2453
|
"input",
|
|
2460
2454
|
{
|
|
2461
2455
|
id: "confirmPassword",
|
|
2462
2456
|
name: "confirmPassword",
|
|
2463
2457
|
type: "password",
|
|
2464
|
-
value:
|
|
2465
|
-
onChange: (
|
|
2466
|
-
|
|
2458
|
+
value: m,
|
|
2459
|
+
onChange: (U) => {
|
|
2460
|
+
H(U.target.value), E.confirmPassword && d((J) => ({ ...J, confirmPassword: !1 })), S === g.passwordMismatchError && P("");
|
|
2467
2461
|
},
|
|
2468
|
-
placeholder:
|
|
2469
|
-
style:
|
|
2470
|
-
disabled:
|
|
2462
|
+
placeholder: g.confirmPasswordPlaceholder,
|
|
2463
|
+
style: N("confirmPassword"),
|
|
2464
|
+
disabled: T
|
|
2471
2465
|
}
|
|
2472
2466
|
)
|
|
2473
2467
|
] }),
|
|
2474
|
-
t === "tenant" && /* @__PURE__ */ l("div", { style:
|
|
2475
|
-
/* @__PURE__ */ n("label", { style:
|
|
2468
|
+
t === "tenant" && /* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
|
|
2469
|
+
/* @__PURE__ */ n("label", { style: c.label, children: g.tenantNameLabel }),
|
|
2476
2470
|
/* @__PURE__ */ n(
|
|
2477
2471
|
"input",
|
|
2478
2472
|
{
|
|
2479
2473
|
id: "tenantName",
|
|
2480
2474
|
name: "tenantName",
|
|
2481
2475
|
type: "text",
|
|
2482
|
-
value:
|
|
2483
|
-
onChange: (
|
|
2484
|
-
|
|
2476
|
+
value: $,
|
|
2477
|
+
onChange: (U) => {
|
|
2478
|
+
C(U.target.value), E.tenantName && d((J) => ({ ...J, tenantName: !1 }));
|
|
2485
2479
|
},
|
|
2486
|
-
placeholder:
|
|
2487
|
-
style:
|
|
2488
|
-
disabled:
|
|
2480
|
+
placeholder: g.tenantNamePlaceholder,
|
|
2481
|
+
style: N("tenantName"),
|
|
2482
|
+
disabled: T
|
|
2489
2483
|
}
|
|
2490
2484
|
)
|
|
2491
2485
|
] }),
|
|
2492
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !
|
|
2493
|
-
|
|
2486
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !V || T, style: z(), children: T ? g.loadingText : g.submitButton }),
|
|
2487
|
+
S && /* @__PURE__ */ n("div", { style: c.errorText, children: S })
|
|
2494
2488
|
] }),
|
|
2495
|
-
(
|
|
2496
|
-
|
|
2497
|
-
/* @__PURE__ */ l("span", { style:
|
|
2498
|
-
|
|
2489
|
+
(p || w) && /* @__PURE__ */ l("div", { style: c.linkContainer, children: [
|
|
2490
|
+
w && /* @__PURE__ */ l("div", { children: [
|
|
2491
|
+
/* @__PURE__ */ l("span", { style: c.divider, children: [
|
|
2492
|
+
g.magicLinkText,
|
|
2499
2493
|
" "
|
|
2500
2494
|
] }),
|
|
2501
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2495
|
+
/* @__PURE__ */ n("a", { onClick: a, style: c.link, children: g.magicLinkLink })
|
|
2502
2496
|
] }),
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
/* @__PURE__ */ l("span", { style:
|
|
2506
|
-
|
|
2497
|
+
w && p && /* @__PURE__ */ n("div", { style: c.divider, children: "•" }),
|
|
2498
|
+
p && /* @__PURE__ */ l("div", { children: [
|
|
2499
|
+
/* @__PURE__ */ l("span", { style: c.divider, children: [
|
|
2500
|
+
g.loginText,
|
|
2507
2501
|
" "
|
|
2508
2502
|
] }),
|
|
2509
|
-
/* @__PURE__ */ n("a", { onClick: o, style:
|
|
2503
|
+
/* @__PURE__ */ n("a", { onClick: o, style: c.link, children: g.loginLink })
|
|
2510
2504
|
] })
|
|
2511
2505
|
] })
|
|
2512
2506
|
] });
|
|
2513
2507
|
}
|
|
2514
|
-
const
|
|
2508
|
+
const St = {
|
|
2515
2509
|
title: "Sign In with Magic Link",
|
|
2516
2510
|
emailLabel: "Email",
|
|
2517
2511
|
emailPlaceholder: "Enter your email",
|
|
@@ -2529,7 +2523,7 @@ const ft = {
|
|
|
2529
2523
|
loadingText: "Sending magic link...",
|
|
2530
2524
|
verifyingText: "Verifying magic link...",
|
|
2531
2525
|
description: "Enter your email to receive a magic link. If you don't have an account, we'll create one for you."
|
|
2532
|
-
},
|
|
2526
|
+
}, vt = {
|
|
2533
2527
|
container: {
|
|
2534
2528
|
maxWidth: "400px",
|
|
2535
2529
|
width: "100%",
|
|
@@ -2632,105 +2626,105 @@ const ft = {
|
|
|
2632
2626
|
fontSize: "0.875rem"
|
|
2633
2627
|
}
|
|
2634
2628
|
};
|
|
2635
|
-
function
|
|
2629
|
+
function Zt({
|
|
2636
2630
|
copy: i = {},
|
|
2637
2631
|
styles: e = {},
|
|
2638
2632
|
onSuccess: t,
|
|
2639
2633
|
onError: r,
|
|
2640
2634
|
onLoginClick: s,
|
|
2641
2635
|
onSignupClick: o,
|
|
2642
|
-
showTraditionalLinks:
|
|
2643
|
-
className:
|
|
2644
|
-
verifyToken:
|
|
2645
|
-
frontendUrl:
|
|
2636
|
+
showTraditionalLinks: a = !0,
|
|
2637
|
+
className: p,
|
|
2638
|
+
verifyToken: w,
|
|
2639
|
+
frontendUrl: y
|
|
2646
2640
|
}) {
|
|
2647
|
-
const [
|
|
2641
|
+
const [x, b] = k(""), [f, A] = k(""), [L, D] = k(""), [I, M] = k(!1), [u, R] = k(!1), [m, H] = k(""), [$, C] = k(""), [T, q] = k({}), [S, P] = k(!1), { sendMagicLink: E, verifyMagicLink: d } = oe(), { tenant: F } = le(), v = { ...St, ...i }, h = { ...vt, ...e };
|
|
2648
2642
|
te(() => {
|
|
2649
|
-
|
|
2650
|
-
}, [
|
|
2651
|
-
const
|
|
2652
|
-
if (!
|
|
2653
|
-
|
|
2643
|
+
w && g(w);
|
|
2644
|
+
}, [w]);
|
|
2645
|
+
const g = async (z) => {
|
|
2646
|
+
if (!F || !x) {
|
|
2647
|
+
H("Missing tenant or email");
|
|
2654
2648
|
return;
|
|
2655
2649
|
}
|
|
2656
|
-
|
|
2650
|
+
R(!0), H("");
|
|
2657
2651
|
try {
|
|
2658
|
-
const
|
|
2659
|
-
token:
|
|
2660
|
-
email:
|
|
2652
|
+
const V = await d({
|
|
2653
|
+
token: z,
|
|
2654
|
+
email: x
|
|
2661
2655
|
// tenantId inferred from context automatically
|
|
2662
2656
|
});
|
|
2663
|
-
t == null || t(
|
|
2664
|
-
} catch (
|
|
2665
|
-
const
|
|
2666
|
-
|
|
2657
|
+
t == null || t(V);
|
|
2658
|
+
} catch (V) {
|
|
2659
|
+
const U = V.message || "Failed to verify magic link";
|
|
2660
|
+
H(U), r == null || r(U);
|
|
2667
2661
|
} finally {
|
|
2668
|
-
|
|
2662
|
+
R(!1);
|
|
2669
2663
|
}
|
|
2670
|
-
},
|
|
2671
|
-
const
|
|
2672
|
-
return
|
|
2673
|
-
},
|
|
2674
|
-
if (
|
|
2675
|
-
if (!(
|
|
2676
|
-
|
|
2664
|
+
}, c = () => {
|
|
2665
|
+
const z = {};
|
|
2666
|
+
return x.trim() || (z.email = !0), S && !f.trim() && (z.name = !0), q(z), Object.keys(z).length === 0;
|
|
2667
|
+
}, j = async (z) => {
|
|
2668
|
+
if (z.preventDefault(), !!c()) {
|
|
2669
|
+
if (!(F != null && F.id)) {
|
|
2670
|
+
H("Tenant not found");
|
|
2677
2671
|
return;
|
|
2678
2672
|
}
|
|
2679
|
-
|
|
2673
|
+
M(!0), H(""), C("");
|
|
2680
2674
|
try {
|
|
2681
|
-
const
|
|
2682
|
-
email:
|
|
2683
|
-
tenantId:
|
|
2684
|
-
frontendUrl:
|
|
2685
|
-
name:
|
|
2686
|
-
lastName:
|
|
2675
|
+
const V = y || (typeof window < "u" ? window.location.origin : ""), U = await E({
|
|
2676
|
+
email: x,
|
|
2677
|
+
tenantId: F.id,
|
|
2678
|
+
frontendUrl: V,
|
|
2679
|
+
name: S ? f : void 0,
|
|
2680
|
+
lastName: S ? L : void 0
|
|
2687
2681
|
});
|
|
2688
|
-
|
|
2689
|
-
} catch (
|
|
2690
|
-
const
|
|
2691
|
-
|
|
2682
|
+
C(v.successMessage), t == null || t(U);
|
|
2683
|
+
} catch (V) {
|
|
2684
|
+
const U = V.message || v.errorMessage;
|
|
2685
|
+
H(U), r == null || r(U);
|
|
2692
2686
|
} finally {
|
|
2693
|
-
|
|
2687
|
+
M(!1);
|
|
2694
2688
|
}
|
|
2695
2689
|
}
|
|
2696
|
-
}, K = (
|
|
2697
|
-
...
|
|
2698
|
-
...
|
|
2699
|
-
}),
|
|
2700
|
-
...
|
|
2701
|
-
...
|
|
2702
|
-
...!
|
|
2690
|
+
}, K = (z) => ({
|
|
2691
|
+
...h.input,
|
|
2692
|
+
...T[z] ? h.inputError : {}
|
|
2693
|
+
}), N = () => ({
|
|
2694
|
+
...h.button,
|
|
2695
|
+
...I || u ? h.buttonLoading : {},
|
|
2696
|
+
...!x || I || u ? h.buttonDisabled : {}
|
|
2703
2697
|
});
|
|
2704
|
-
return
|
|
2705
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2698
|
+
return u ? /* @__PURE__ */ l("div", { className: p, style: h.container, children: [
|
|
2699
|
+
/* @__PURE__ */ n("h2", { style: h.title, children: v.verifyingText }),
|
|
2706
2700
|
/* @__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..." }) })
|
|
2707
|
-
] }) : /* @__PURE__ */ l("div", { className:
|
|
2708
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2709
|
-
/* @__PURE__ */ n("p", { style:
|
|
2710
|
-
/* @__PURE__ */ l("form", { onSubmit:
|
|
2711
|
-
/* @__PURE__ */ l("div", { style:
|
|
2712
|
-
/* @__PURE__ */ n("label", { style:
|
|
2701
|
+
] }) : /* @__PURE__ */ l("div", { className: p, style: h.container, children: [
|
|
2702
|
+
/* @__PURE__ */ n("h2", { style: h.title, children: v.title }),
|
|
2703
|
+
/* @__PURE__ */ n("p", { style: h.description, children: v.description }),
|
|
2704
|
+
/* @__PURE__ */ l("form", { onSubmit: j, style: h.form, children: [
|
|
2705
|
+
/* @__PURE__ */ l("div", { style: h.fieldGroup, children: [
|
|
2706
|
+
/* @__PURE__ */ n("label", { style: h.label, children: v.emailLabel }),
|
|
2713
2707
|
/* @__PURE__ */ n(
|
|
2714
2708
|
"input",
|
|
2715
2709
|
{
|
|
2716
2710
|
id: "email",
|
|
2717
2711
|
name: "email",
|
|
2718
2712
|
type: "email",
|
|
2719
|
-
value:
|
|
2720
|
-
onChange: (
|
|
2721
|
-
|
|
2713
|
+
value: x,
|
|
2714
|
+
onChange: (z) => {
|
|
2715
|
+
b(z.target.value), T.email && q((V) => ({ ...V, email: !1 }));
|
|
2722
2716
|
},
|
|
2723
|
-
placeholder:
|
|
2717
|
+
placeholder: v.emailPlaceholder,
|
|
2724
2718
|
style: K("email"),
|
|
2725
|
-
disabled:
|
|
2719
|
+
disabled: I || u
|
|
2726
2720
|
}
|
|
2727
2721
|
)
|
|
2728
2722
|
] }),
|
|
2729
|
-
!
|
|
2723
|
+
!S && /* @__PURE__ */ n("div", { style: { textAlign: "center", marginTop: "0.5rem" }, children: /* @__PURE__ */ n(
|
|
2730
2724
|
"button",
|
|
2731
2725
|
{
|
|
2732
2726
|
type: "button",
|
|
2733
|
-
onClick: () =>
|
|
2727
|
+
onClick: () => P(!0),
|
|
2734
2728
|
style: {
|
|
2735
2729
|
background: "none",
|
|
2736
2730
|
border: "none",
|
|
@@ -2742,38 +2736,38 @@ function Kt({
|
|
|
2742
2736
|
children: "New user? Add your name"
|
|
2743
2737
|
}
|
|
2744
2738
|
) }),
|
|
2745
|
-
|
|
2746
|
-
/* @__PURE__ */ l("div", { style:
|
|
2747
|
-
/* @__PURE__ */ n("label", { style:
|
|
2739
|
+
S && /* @__PURE__ */ l(W, { children: [
|
|
2740
|
+
/* @__PURE__ */ l("div", { style: h.fieldGroup, children: [
|
|
2741
|
+
/* @__PURE__ */ n("label", { style: h.label, children: v.nameLabel }),
|
|
2748
2742
|
/* @__PURE__ */ n(
|
|
2749
2743
|
"input",
|
|
2750
2744
|
{
|
|
2751
2745
|
id: "name",
|
|
2752
2746
|
name: "name",
|
|
2753
2747
|
type: "text",
|
|
2754
|
-
value:
|
|
2755
|
-
onChange: (
|
|
2756
|
-
|
|
2748
|
+
value: f,
|
|
2749
|
+
onChange: (z) => {
|
|
2750
|
+
A(z.target.value), T.name && q((V) => ({ ...V, name: !1 }));
|
|
2757
2751
|
},
|
|
2758
|
-
placeholder:
|
|
2752
|
+
placeholder: v.namePlaceholder,
|
|
2759
2753
|
style: K("name"),
|
|
2760
|
-
disabled:
|
|
2754
|
+
disabled: I || u
|
|
2761
2755
|
}
|
|
2762
2756
|
)
|
|
2763
2757
|
] }),
|
|
2764
|
-
/* @__PURE__ */ l("div", { style:
|
|
2765
|
-
/* @__PURE__ */ n("label", { style:
|
|
2758
|
+
/* @__PURE__ */ l("div", { style: h.fieldGroup, children: [
|
|
2759
|
+
/* @__PURE__ */ n("label", { style: h.label, children: v.lastNameLabel }),
|
|
2766
2760
|
/* @__PURE__ */ n(
|
|
2767
2761
|
"input",
|
|
2768
2762
|
{
|
|
2769
2763
|
id: "lastName",
|
|
2770
2764
|
name: "lastName",
|
|
2771
2765
|
type: "text",
|
|
2772
|
-
value:
|
|
2773
|
-
onChange: (
|
|
2774
|
-
placeholder:
|
|
2775
|
-
style:
|
|
2776
|
-
disabled:
|
|
2766
|
+
value: L,
|
|
2767
|
+
onChange: (z) => D(z.target.value),
|
|
2768
|
+
placeholder: v.lastNamePlaceholder,
|
|
2769
|
+
style: h.input,
|
|
2770
|
+
disabled: I || u
|
|
2777
2771
|
}
|
|
2778
2772
|
)
|
|
2779
2773
|
] }),
|
|
@@ -2782,7 +2776,7 @@ function Kt({
|
|
|
2782
2776
|
{
|
|
2783
2777
|
type: "button",
|
|
2784
2778
|
onClick: () => {
|
|
2785
|
-
|
|
2779
|
+
P(!1), A(""), D("");
|
|
2786
2780
|
},
|
|
2787
2781
|
style: {
|
|
2788
2782
|
background: "none",
|
|
@@ -2796,30 +2790,30 @@ function Kt({
|
|
|
2796
2790
|
}
|
|
2797
2791
|
) })
|
|
2798
2792
|
] }),
|
|
2799
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !
|
|
2800
|
-
|
|
2801
|
-
|
|
2793
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !x || I || u, style: N(), children: I ? v.loadingText : v.submitButton }),
|
|
2794
|
+
m && /* @__PURE__ */ n("div", { style: h.errorText, children: m }),
|
|
2795
|
+
$ && /* @__PURE__ */ n("div", { style: h.successText, children: $ })
|
|
2802
2796
|
] }),
|
|
2803
|
-
|
|
2797
|
+
a && /* @__PURE__ */ l("div", { style: h.linkContainer, children: [
|
|
2804
2798
|
/* @__PURE__ */ l("div", { children: [
|
|
2805
|
-
/* @__PURE__ */ l("span", { style:
|
|
2806
|
-
|
|
2799
|
+
/* @__PURE__ */ l("span", { style: h.divider, children: [
|
|
2800
|
+
v.loginText,
|
|
2807
2801
|
" "
|
|
2808
2802
|
] }),
|
|
2809
|
-
/* @__PURE__ */ n("a", { onClick: s, style:
|
|
2803
|
+
/* @__PURE__ */ n("a", { onClick: s, style: h.link, children: v.loginLink })
|
|
2810
2804
|
] }),
|
|
2811
|
-
/* @__PURE__ */ n("div", { style:
|
|
2805
|
+
/* @__PURE__ */ n("div", { style: h.divider, children: "•" }),
|
|
2812
2806
|
/* @__PURE__ */ l("div", { children: [
|
|
2813
|
-
/* @__PURE__ */ l("span", { style:
|
|
2814
|
-
|
|
2807
|
+
/* @__PURE__ */ l("span", { style: h.divider, children: [
|
|
2808
|
+
v.signupText,
|
|
2815
2809
|
" "
|
|
2816
2810
|
] }),
|
|
2817
|
-
/* @__PURE__ */ n("a", { onClick: o, style:
|
|
2811
|
+
/* @__PURE__ */ n("a", { onClick: o, style: h.link, children: v.signupLink })
|
|
2818
2812
|
] })
|
|
2819
2813
|
] })
|
|
2820
2814
|
] });
|
|
2821
2815
|
}
|
|
2822
|
-
const
|
|
2816
|
+
const kt = {
|
|
2823
2817
|
title: "Verifying Magic Link",
|
|
2824
2818
|
verifyingMessage: "Please wait while we verify your magic link...",
|
|
2825
2819
|
successMessage: "Magic link verified successfully! You are now logged in.",
|
|
@@ -2827,7 +2821,7 @@ const yt = {
|
|
|
2827
2821
|
redirectingMessage: "Redirecting you to the dashboard...",
|
|
2828
2822
|
retryButton: "Try Again",
|
|
2829
2823
|
backToLoginButton: "Back to Login"
|
|
2830
|
-
},
|
|
2824
|
+
}, $e = {
|
|
2831
2825
|
container: {
|
|
2832
2826
|
maxWidth: "400px",
|
|
2833
2827
|
width: "100%",
|
|
@@ -2914,7 +2908,7 @@ const yt = {
|
|
|
2914
2908
|
cursor: "pointer",
|
|
2915
2909
|
transition: "all 0.15s ease-in-out"
|
|
2916
2910
|
}
|
|
2917
|
-
},
|
|
2911
|
+
}, xt = () => /* @__PURE__ */ n("div", { style: $e.spinner }), At = () => /* @__PURE__ */ l(
|
|
2918
2912
|
"svg",
|
|
2919
2913
|
{
|
|
2920
2914
|
width: "48",
|
|
@@ -2931,7 +2925,7 @@ const yt = {
|
|
|
2931
2925
|
/* @__PURE__ */ n("polyline", { points: "22,4 12,14.01 9,11.01" })
|
|
2932
2926
|
]
|
|
2933
2927
|
}
|
|
2934
|
-
),
|
|
2928
|
+
), Tt = () => /* @__PURE__ */ l(
|
|
2935
2929
|
"svg",
|
|
2936
2930
|
{
|
|
2937
2931
|
width: "48",
|
|
@@ -2949,109 +2943,109 @@ const yt = {
|
|
|
2949
2943
|
/* @__PURE__ */ n("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
2950
2944
|
]
|
|
2951
2945
|
}
|
|
2952
|
-
),
|
|
2953
|
-
loading: /* @__PURE__ */ n(
|
|
2954
|
-
success: /* @__PURE__ */ n(
|
|
2955
|
-
error: /* @__PURE__ */ n(
|
|
2946
|
+
), Pt = {
|
|
2947
|
+
loading: /* @__PURE__ */ n(xt, {}),
|
|
2948
|
+
success: /* @__PURE__ */ n(At, {}),
|
|
2949
|
+
error: /* @__PURE__ */ n(Tt, {})
|
|
2956
2950
|
};
|
|
2957
|
-
function
|
|
2951
|
+
function er({
|
|
2958
2952
|
copy: i = {},
|
|
2959
2953
|
styles: e = {},
|
|
2960
2954
|
icons: t = {},
|
|
2961
2955
|
onSuccess: r,
|
|
2962
2956
|
onError: s,
|
|
2963
2957
|
onRetry: o,
|
|
2964
|
-
onBackToLogin:
|
|
2965
|
-
className:
|
|
2966
|
-
token:
|
|
2967
|
-
email:
|
|
2968
|
-
appId:
|
|
2969
|
-
tenantSlug:
|
|
2970
|
-
autoRedirectDelay:
|
|
2958
|
+
onBackToLogin: a,
|
|
2959
|
+
className: p,
|
|
2960
|
+
token: w,
|
|
2961
|
+
email: y,
|
|
2962
|
+
appId: x,
|
|
2963
|
+
tenantSlug: b,
|
|
2964
|
+
autoRedirectDelay: f = 3e3
|
|
2971
2965
|
}) {
|
|
2972
|
-
const [
|
|
2966
|
+
const [A, L] = k("verifying"), [D, I] = k(""), { verifyMagicLink: M } = oe(), u = { ...kt, ...i }, R = { ...$e, ...e }, m = { ...Pt, ...t }, H = () => {
|
|
2973
2967
|
if (typeof window > "u") return {};
|
|
2974
|
-
const
|
|
2968
|
+
const S = new URLSearchParams(window.location.search);
|
|
2975
2969
|
return {
|
|
2976
|
-
token:
|
|
2977
|
-
email:
|
|
2978
|
-
appId:
|
|
2979
|
-
tenantSlug:
|
|
2970
|
+
token: w || S.get("token") || "",
|
|
2971
|
+
email: y || S.get("email") || "",
|
|
2972
|
+
appId: x || S.get("appId") || "",
|
|
2973
|
+
tenantSlug: b || S.get("tenantSlug") || void 0
|
|
2980
2974
|
};
|
|
2981
|
-
},
|
|
2982
|
-
|
|
2975
|
+
}, $ = async () => {
|
|
2976
|
+
L("verifying"), I("");
|
|
2983
2977
|
try {
|
|
2984
|
-
const
|
|
2985
|
-
if (!
|
|
2978
|
+
const S = H();
|
|
2979
|
+
if (!S.token || !S.email)
|
|
2986
2980
|
throw new Error("Missing required parameters: token or email");
|
|
2987
|
-
const
|
|
2988
|
-
token:
|
|
2989
|
-
email:
|
|
2990
|
-
tenantSlug:
|
|
2981
|
+
const P = await M({
|
|
2982
|
+
token: S.token,
|
|
2983
|
+
email: S.email,
|
|
2984
|
+
tenantSlug: S.tenantSlug
|
|
2991
2985
|
});
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
},
|
|
2995
|
-
} catch (
|
|
2996
|
-
const
|
|
2997
|
-
|
|
2986
|
+
L("success"), r == null || r(P), f > 0 && setTimeout(() => {
|
|
2987
|
+
L("redirecting");
|
|
2988
|
+
}, f);
|
|
2989
|
+
} catch (S) {
|
|
2990
|
+
const P = S.message || u.errorMessage;
|
|
2991
|
+
I(P), L("error"), s == null || s(P);
|
|
2998
2992
|
}
|
|
2999
|
-
},
|
|
3000
|
-
o == null || o(),
|
|
3001
|
-
},
|
|
3002
|
-
|
|
2993
|
+
}, C = () => {
|
|
2994
|
+
o == null || o(), $();
|
|
2995
|
+
}, T = () => {
|
|
2996
|
+
a == null || a();
|
|
3003
2997
|
};
|
|
3004
2998
|
te(() => {
|
|
3005
|
-
|
|
2999
|
+
$();
|
|
3006
3000
|
}, []);
|
|
3007
|
-
const
|
|
3008
|
-
switch (
|
|
3001
|
+
const q = () => {
|
|
3002
|
+
switch (A) {
|
|
3009
3003
|
case "verifying":
|
|
3010
|
-
return /* @__PURE__ */ l("div", { style:
|
|
3011
|
-
|
|
3012
|
-
|
|
3004
|
+
return /* @__PURE__ */ l("div", { style: R.message, children: [
|
|
3005
|
+
m.loading,
|
|
3006
|
+
u.verifyingMessage
|
|
3013
3007
|
] });
|
|
3014
3008
|
case "success":
|
|
3015
|
-
return /* @__PURE__ */ l(
|
|
3016
|
-
|
|
3017
|
-
/* @__PURE__ */ n("div", { style:
|
|
3009
|
+
return /* @__PURE__ */ l(W, { children: [
|
|
3010
|
+
m.success,
|
|
3011
|
+
/* @__PURE__ */ n("div", { style: R.successMessage, children: u.successMessage })
|
|
3018
3012
|
] });
|
|
3019
3013
|
case "redirecting":
|
|
3020
|
-
return /* @__PURE__ */ l(
|
|
3021
|
-
|
|
3022
|
-
/* @__PURE__ */ n("div", { style:
|
|
3014
|
+
return /* @__PURE__ */ l(W, { children: [
|
|
3015
|
+
m.loading,
|
|
3016
|
+
/* @__PURE__ */ n("div", { style: R.message, children: u.redirectingMessage })
|
|
3023
3017
|
] });
|
|
3024
3018
|
case "error":
|
|
3025
|
-
return /* @__PURE__ */ l(
|
|
3026
|
-
|
|
3027
|
-
/* @__PURE__ */ n("div", { style:
|
|
3028
|
-
/* @__PURE__ */ l("div", { style:
|
|
3019
|
+
return /* @__PURE__ */ l(W, { children: [
|
|
3020
|
+
m.error,
|
|
3021
|
+
/* @__PURE__ */ n("div", { style: R.errorMessage, children: D || u.errorMessage }),
|
|
3022
|
+
/* @__PURE__ */ l("div", { style: R.buttonContainer, children: [
|
|
3029
3023
|
/* @__PURE__ */ n(
|
|
3030
3024
|
"button",
|
|
3031
3025
|
{
|
|
3032
|
-
onClick:
|
|
3033
|
-
style:
|
|
3034
|
-
onMouseOver: (
|
|
3035
|
-
|
|
3026
|
+
onClick: C,
|
|
3027
|
+
style: R.retryButton,
|
|
3028
|
+
onMouseOver: (S) => {
|
|
3029
|
+
S.currentTarget.style.backgroundColor = "#2563eb";
|
|
3036
3030
|
},
|
|
3037
|
-
onMouseOut: (
|
|
3038
|
-
|
|
3031
|
+
onMouseOut: (S) => {
|
|
3032
|
+
S.currentTarget.style.backgroundColor = "#3b82f6";
|
|
3039
3033
|
},
|
|
3040
|
-
children:
|
|
3034
|
+
children: u.retryButton
|
|
3041
3035
|
}
|
|
3042
3036
|
),
|
|
3043
3037
|
/* @__PURE__ */ n(
|
|
3044
3038
|
"button",
|
|
3045
3039
|
{
|
|
3046
|
-
onClick:
|
|
3047
|
-
style:
|
|
3048
|
-
onMouseOver: (
|
|
3049
|
-
|
|
3040
|
+
onClick: T,
|
|
3041
|
+
style: R.backButton,
|
|
3042
|
+
onMouseOver: (S) => {
|
|
3043
|
+
S.currentTarget.style.backgroundColor = "#e5e7eb";
|
|
3050
3044
|
},
|
|
3051
|
-
onMouseOut: (
|
|
3052
|
-
|
|
3045
|
+
onMouseOut: (S) => {
|
|
3046
|
+
S.currentTarget.style.backgroundColor = "#f3f4f6";
|
|
3053
3047
|
},
|
|
3054
|
-
children:
|
|
3048
|
+
children: u.backToLoginButton
|
|
3055
3049
|
}
|
|
3056
3050
|
)
|
|
3057
3051
|
] })
|
|
@@ -3060,18 +3054,18 @@ function Jt({
|
|
|
3060
3054
|
return null;
|
|
3061
3055
|
}
|
|
3062
3056
|
};
|
|
3063
|
-
return /* @__PURE__ */ l("div", { style:
|
|
3057
|
+
return /* @__PURE__ */ l("div", { style: R.container, className: p, children: [
|
|
3064
3058
|
/* @__PURE__ */ n("style", { children: `
|
|
3065
3059
|
@keyframes spin {
|
|
3066
3060
|
0% { transform: rotate(0deg); }
|
|
3067
3061
|
100% { transform: rotate(360deg); }
|
|
3068
3062
|
}
|
|
3069
3063
|
` }),
|
|
3070
|
-
/* @__PURE__ */ n("h1", { style:
|
|
3071
|
-
|
|
3064
|
+
/* @__PURE__ */ n("h1", { style: R.title, children: u.title }),
|
|
3065
|
+
q()
|
|
3072
3066
|
] });
|
|
3073
3067
|
}
|
|
3074
|
-
const
|
|
3068
|
+
const Mt = {
|
|
3075
3069
|
title: "Reset Password",
|
|
3076
3070
|
subtitle: "Enter your email address and we'll send you a link to reset your password.",
|
|
3077
3071
|
emailLabel: "Email",
|
|
@@ -3093,7 +3087,7 @@ const kt = {
|
|
|
3093
3087
|
resetLoadingText: "Resetting...",
|
|
3094
3088
|
resetSuccessMessage: "Password reset successfully!",
|
|
3095
3089
|
passwordMismatchError: "Passwords do not match"
|
|
3096
|
-
},
|
|
3090
|
+
}, It = {
|
|
3097
3091
|
container: {
|
|
3098
3092
|
maxWidth: "400px",
|
|
3099
3093
|
margin: "0 auto",
|
|
@@ -3185,113 +3179,113 @@ const kt = {
|
|
|
3185
3179
|
cursor: "pointer"
|
|
3186
3180
|
}
|
|
3187
3181
|
};
|
|
3188
|
-
function
|
|
3182
|
+
function tr({
|
|
3189
3183
|
copy: i = {},
|
|
3190
3184
|
styles: e = {},
|
|
3191
3185
|
mode: t = "request",
|
|
3192
3186
|
token: r = "",
|
|
3193
3187
|
onSuccess: s,
|
|
3194
3188
|
onError: o,
|
|
3195
|
-
onBackToLogin:
|
|
3196
|
-
onModeChange:
|
|
3197
|
-
className:
|
|
3189
|
+
onBackToLogin: a,
|
|
3190
|
+
onModeChange: p,
|
|
3191
|
+
className: w
|
|
3198
3192
|
}) {
|
|
3199
|
-
const [
|
|
3200
|
-
const
|
|
3201
|
-
return
|
|
3202
|
-
},
|
|
3203
|
-
const
|
|
3204
|
-
return
|
|
3205
|
-
},
|
|
3206
|
-
if (
|
|
3207
|
-
if (!(
|
|
3208
|
-
|
|
3193
|
+
const [y, x] = k(""), [b, f] = k(r), [A, L] = k(""), [D, I] = k(""), [M, u] = k(!1), [R, m] = k(""), [H, $] = k(""), [C, T] = k({}), { requestPasswordReset: q, confirmPasswordReset: S } = oe(), { tenant: P } = le(), E = { ...Mt, ...i }, d = { ...It, ...e }, F = () => {
|
|
3194
|
+
const N = {};
|
|
3195
|
+
return y.trim() || (N.email = !0), T(N), Object.keys(N).length === 0;
|
|
3196
|
+
}, v = () => {
|
|
3197
|
+
const N = {};
|
|
3198
|
+
return b.trim() || (N.token = !0), A.trim() || (N.newPassword = !0), D.trim() || (N.confirmPassword = !0), T(N), Object.keys(N).length === 0;
|
|
3199
|
+
}, h = async (N) => {
|
|
3200
|
+
if (N.preventDefault(), !!F()) {
|
|
3201
|
+
if (!(P != null && P.id)) {
|
|
3202
|
+
m("Tenant not found");
|
|
3209
3203
|
return;
|
|
3210
3204
|
}
|
|
3211
|
-
|
|
3205
|
+
u(!0), m(""), $("");
|
|
3212
3206
|
try {
|
|
3213
|
-
await
|
|
3214
|
-
} catch (
|
|
3215
|
-
const
|
|
3216
|
-
|
|
3207
|
+
await q({ email: y, tenantId: P.id }), $(E.successMessage), s == null || s();
|
|
3208
|
+
} catch (z) {
|
|
3209
|
+
const V = z.message || E.errorMessage;
|
|
3210
|
+
m(V), o == null || o(V);
|
|
3217
3211
|
} finally {
|
|
3218
|
-
|
|
3212
|
+
u(!1);
|
|
3219
3213
|
}
|
|
3220
3214
|
}
|
|
3221
|
-
},
|
|
3222
|
-
if (
|
|
3223
|
-
if (
|
|
3224
|
-
|
|
3215
|
+
}, g = async (N) => {
|
|
3216
|
+
if (N.preventDefault(), !!v()) {
|
|
3217
|
+
if (A !== D) {
|
|
3218
|
+
m(E.passwordMismatchError), T({ confirmPassword: !0 });
|
|
3225
3219
|
return;
|
|
3226
3220
|
}
|
|
3227
|
-
|
|
3221
|
+
u(!0), m(""), $("");
|
|
3228
3222
|
try {
|
|
3229
|
-
await
|
|
3230
|
-
} catch (
|
|
3231
|
-
const
|
|
3232
|
-
|
|
3223
|
+
await S({ token: b, newPassword: A }), $(E.resetSuccessMessage), s == null || s();
|
|
3224
|
+
} catch (z) {
|
|
3225
|
+
const V = z.message || E.errorMessage;
|
|
3226
|
+
m(V), o == null || o(V);
|
|
3233
3227
|
} finally {
|
|
3234
|
-
|
|
3228
|
+
u(!1);
|
|
3235
3229
|
}
|
|
3236
3230
|
}
|
|
3237
|
-
},
|
|
3238
|
-
...
|
|
3239
|
-
...
|
|
3240
|
-
}),
|
|
3241
|
-
...
|
|
3242
|
-
...
|
|
3231
|
+
}, c = (N) => ({
|
|
3232
|
+
...d.input,
|
|
3233
|
+
...C[N] ? d.inputError : {}
|
|
3234
|
+
}), j = () => ({
|
|
3235
|
+
...d.button,
|
|
3236
|
+
...M ? d.buttonLoading : {}
|
|
3243
3237
|
});
|
|
3244
3238
|
if (t === "reset") {
|
|
3245
|
-
const
|
|
3246
|
-
return /* @__PURE__ */ l("div", { className:
|
|
3247
|
-
/* @__PURE__ */ n("h2", { style:
|
|
3248
|
-
/* @__PURE__ */ n("p", { style:
|
|
3249
|
-
/* @__PURE__ */ l("form", { onSubmit:
|
|
3250
|
-
/* @__PURE__ */ l("div", { style:
|
|
3251
|
-
/* @__PURE__ */ n("label", { style:
|
|
3239
|
+
const N = b && A && D;
|
|
3240
|
+
return /* @__PURE__ */ l("div", { className: w, style: d.container, children: [
|
|
3241
|
+
/* @__PURE__ */ n("h2", { style: d.title, children: E.resetTitle }),
|
|
3242
|
+
/* @__PURE__ */ n("p", { style: d.subtitle, children: E.resetSubtitle }),
|
|
3243
|
+
/* @__PURE__ */ l("form", { onSubmit: g, style: d.form, children: [
|
|
3244
|
+
/* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
|
|
3245
|
+
/* @__PURE__ */ n("label", { style: d.label, children: E.tokenLabel }),
|
|
3252
3246
|
/* @__PURE__ */ n(
|
|
3253
3247
|
"input",
|
|
3254
3248
|
{
|
|
3255
3249
|
type: "text",
|
|
3256
|
-
value:
|
|
3257
|
-
onChange: (
|
|
3258
|
-
|
|
3250
|
+
value: b,
|
|
3251
|
+
onChange: (z) => {
|
|
3252
|
+
f(z.target.value), C.token && T((V) => ({ ...V, token: !1 }));
|
|
3259
3253
|
},
|
|
3260
3254
|
placeholder: E.tokenPlaceholder,
|
|
3261
|
-
style:
|
|
3262
|
-
disabled:
|
|
3255
|
+
style: c("token"),
|
|
3256
|
+
disabled: M
|
|
3263
3257
|
}
|
|
3264
3258
|
)
|
|
3265
3259
|
] }),
|
|
3266
|
-
/* @__PURE__ */ l("div", { style:
|
|
3267
|
-
/* @__PURE__ */ n("label", { style:
|
|
3260
|
+
/* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
|
|
3261
|
+
/* @__PURE__ */ n("label", { style: d.label, children: E.newPasswordLabel }),
|
|
3268
3262
|
/* @__PURE__ */ n(
|
|
3269
3263
|
"input",
|
|
3270
3264
|
{
|
|
3271
3265
|
type: "password",
|
|
3272
|
-
value:
|
|
3273
|
-
onChange: (
|
|
3274
|
-
|
|
3266
|
+
value: A,
|
|
3267
|
+
onChange: (z) => {
|
|
3268
|
+
L(z.target.value), C.newPassword && T((V) => ({ ...V, newPassword: !1 }));
|
|
3275
3269
|
},
|
|
3276
3270
|
placeholder: E.newPasswordPlaceholder,
|
|
3277
|
-
style:
|
|
3278
|
-
disabled:
|
|
3271
|
+
style: c("newPassword"),
|
|
3272
|
+
disabled: M
|
|
3279
3273
|
}
|
|
3280
3274
|
)
|
|
3281
3275
|
] }),
|
|
3282
|
-
/* @__PURE__ */ l("div", { style:
|
|
3283
|
-
/* @__PURE__ */ n("label", { style:
|
|
3276
|
+
/* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
|
|
3277
|
+
/* @__PURE__ */ n("label", { style: d.label, children: E.confirmPasswordLabel }),
|
|
3284
3278
|
/* @__PURE__ */ n(
|
|
3285
3279
|
"input",
|
|
3286
3280
|
{
|
|
3287
3281
|
type: "password",
|
|
3288
|
-
value:
|
|
3289
|
-
onChange: (
|
|
3290
|
-
|
|
3282
|
+
value: D,
|
|
3283
|
+
onChange: (z) => {
|
|
3284
|
+
I(z.target.value), C.confirmPassword && T((V) => ({ ...V, confirmPassword: !1 })), R === E.passwordMismatchError && m("");
|
|
3291
3285
|
},
|
|
3292
3286
|
placeholder: E.confirmPasswordPlaceholder,
|
|
3293
|
-
style:
|
|
3294
|
-
disabled:
|
|
3287
|
+
style: c("confirmPassword"),
|
|
3288
|
+
disabled: M
|
|
3295
3289
|
}
|
|
3296
3290
|
)
|
|
3297
3291
|
] }),
|
|
@@ -3299,44 +3293,44 @@ function Yt({
|
|
|
3299
3293
|
"button",
|
|
3300
3294
|
{
|
|
3301
3295
|
type: "submit",
|
|
3302
|
-
disabled: !
|
|
3296
|
+
disabled: !N || M,
|
|
3303
3297
|
style: {
|
|
3304
|
-
...
|
|
3305
|
-
...!
|
|
3298
|
+
...j(),
|
|
3299
|
+
...!N || M ? d.buttonDisabled : {}
|
|
3306
3300
|
},
|
|
3307
|
-
children:
|
|
3301
|
+
children: M ? E.resetLoadingText : E.resetSubmitButton
|
|
3308
3302
|
}
|
|
3309
3303
|
),
|
|
3310
|
-
|
|
3311
|
-
|
|
3304
|
+
R && /* @__PURE__ */ n("div", { style: d.errorText, children: R }),
|
|
3305
|
+
H && /* @__PURE__ */ n("div", { style: d.successText, children: H })
|
|
3312
3306
|
] }),
|
|
3313
|
-
/* @__PURE__ */ l("div", { style:
|
|
3314
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
3315
|
-
|
|
3307
|
+
/* @__PURE__ */ l("div", { style: d.linkContainer, children: [
|
|
3308
|
+
/* @__PURE__ */ n("a", { onClick: a, style: d.link, children: E.backToLoginLink }),
|
|
3309
|
+
p && /* @__PURE__ */ l(W, { children: [
|
|
3316
3310
|
/* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3317
|
-
/* @__PURE__ */ n("a", { onClick: () =>
|
|
3311
|
+
/* @__PURE__ */ n("a", { onClick: () => p("request"), style: d.link, children: "Request New Link" })
|
|
3318
3312
|
] })
|
|
3319
3313
|
] })
|
|
3320
3314
|
] });
|
|
3321
3315
|
}
|
|
3322
|
-
const K =
|
|
3323
|
-
return /* @__PURE__ */ l("div", { className:
|
|
3324
|
-
/* @__PURE__ */ n("h2", { style:
|
|
3325
|
-
/* @__PURE__ */ n("p", { style:
|
|
3326
|
-
/* @__PURE__ */ l("form", { onSubmit:
|
|
3327
|
-
/* @__PURE__ */ l("div", { style:
|
|
3328
|
-
/* @__PURE__ */ n("label", { style:
|
|
3316
|
+
const K = y;
|
|
3317
|
+
return /* @__PURE__ */ l("div", { className: w, style: d.container, children: [
|
|
3318
|
+
/* @__PURE__ */ n("h2", { style: d.title, children: E.title }),
|
|
3319
|
+
/* @__PURE__ */ n("p", { style: d.subtitle, children: E.subtitle }),
|
|
3320
|
+
/* @__PURE__ */ l("form", { onSubmit: h, style: d.form, children: [
|
|
3321
|
+
/* @__PURE__ */ l("div", { style: d.fieldGroup, children: [
|
|
3322
|
+
/* @__PURE__ */ n("label", { style: d.label, children: E.emailLabel }),
|
|
3329
3323
|
/* @__PURE__ */ n(
|
|
3330
3324
|
"input",
|
|
3331
3325
|
{
|
|
3332
3326
|
type: "email",
|
|
3333
|
-
value:
|
|
3334
|
-
onChange: (
|
|
3335
|
-
|
|
3327
|
+
value: y,
|
|
3328
|
+
onChange: (N) => {
|
|
3329
|
+
x(N.target.value), C.email && T((z) => ({ ...z, email: !1 }));
|
|
3336
3330
|
},
|
|
3337
3331
|
placeholder: E.emailPlaceholder,
|
|
3338
|
-
style:
|
|
3339
|
-
disabled:
|
|
3332
|
+
style: c("email"),
|
|
3333
|
+
disabled: M
|
|
3340
3334
|
}
|
|
3341
3335
|
)
|
|
3342
3336
|
] }),
|
|
@@ -3344,27 +3338,27 @@ function Yt({
|
|
|
3344
3338
|
"button",
|
|
3345
3339
|
{
|
|
3346
3340
|
type: "submit",
|
|
3347
|
-
disabled: !K ||
|
|
3341
|
+
disabled: !K || M,
|
|
3348
3342
|
style: {
|
|
3349
|
-
...
|
|
3350
|
-
...!K ||
|
|
3343
|
+
...j(),
|
|
3344
|
+
...!K || M ? d.buttonDisabled : {}
|
|
3351
3345
|
},
|
|
3352
|
-
children:
|
|
3346
|
+
children: M ? E.loadingText : E.submitButton
|
|
3353
3347
|
}
|
|
3354
3348
|
),
|
|
3355
|
-
|
|
3356
|
-
|
|
3349
|
+
R && /* @__PURE__ */ n("div", { style: d.errorText, children: R }),
|
|
3350
|
+
H && /* @__PURE__ */ n("div", { style: d.successText, children: H })
|
|
3357
3351
|
] }),
|
|
3358
|
-
/* @__PURE__ */ l("div", { style:
|
|
3359
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
3360
|
-
|
|
3352
|
+
/* @__PURE__ */ l("div", { style: d.linkContainer, children: [
|
|
3353
|
+
/* @__PURE__ */ n("a", { onClick: a, style: d.link, children: E.backToLoginLink }),
|
|
3354
|
+
p && /* @__PURE__ */ l(W, { children: [
|
|
3361
3355
|
/* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3362
|
-
/* @__PURE__ */ n("a", { onClick: () =>
|
|
3356
|
+
/* @__PURE__ */ n("a", { onClick: () => p("reset"), style: d.link, children: "I have a token" })
|
|
3363
3357
|
] })
|
|
3364
3358
|
] })
|
|
3365
3359
|
] });
|
|
3366
3360
|
}
|
|
3367
|
-
const
|
|
3361
|
+
const Rt = () => /* @__PURE__ */ n(
|
|
3368
3362
|
"div",
|
|
3369
3363
|
{
|
|
3370
3364
|
style: {
|
|
@@ -3376,7 +3370,7 @@ const At = () => /* @__PURE__ */ n(
|
|
|
3376
3370
|
},
|
|
3377
3371
|
children: /* @__PURE__ */ n("div", { children: "Loading..." })
|
|
3378
3372
|
}
|
|
3379
|
-
),
|
|
3373
|
+
), Lt = ({ error: i, retry: e }) => /* @__PURE__ */ l(
|
|
3380
3374
|
"div",
|
|
3381
3375
|
{
|
|
3382
3376
|
style: {
|
|
@@ -3410,40 +3404,43 @@ const At = () => /* @__PURE__ */ n(
|
|
|
3410
3404
|
]
|
|
3411
3405
|
}
|
|
3412
3406
|
);
|
|
3413
|
-
function
|
|
3407
|
+
function rr({
|
|
3414
3408
|
children: i,
|
|
3415
3409
|
loadingFallback: e,
|
|
3416
3410
|
errorFallback: t,
|
|
3417
3411
|
requireTenant: r = !0
|
|
3418
3412
|
}) {
|
|
3419
|
-
const { isAppLoading: s, appError: o, retryApp:
|
|
3420
|
-
}),
|
|
3421
|
-
o &&
|
|
3413
|
+
const { isAppLoading: s, appError: o, retryApp: a } = he(), p = ye(), w = Fe(), y = Ce(), x = De(), b = (p == null ? void 0 : p.isTenantLoading) ?? !1, f = (p == null ? void 0 : p.tenantError) ?? null, A = (p == null ? void 0 : p.tenantSlug) ?? null, L = (p == null ? void 0 : p.retryTenant) ?? (() => {
|
|
3414
|
+
}), D = (w == null ? void 0 : w.isAuthReady) ?? !0, I = (y == null ? void 0 : y.isReady) ?? !0, M = (x == null ? void 0 : x.isReady) ?? !0, u = r && p && A, $ = s || u && b || w && !D || y && !I || x && !M, C = o || (u ? f : null), T = () => {
|
|
3415
|
+
o && a(), f && p && L();
|
|
3422
3416
|
};
|
|
3423
|
-
if (
|
|
3424
|
-
return /* @__PURE__ */ n(
|
|
3425
|
-
if (
|
|
3426
|
-
const
|
|
3427
|
-
return /* @__PURE__ */ n(
|
|
3417
|
+
if ($)
|
|
3418
|
+
return /* @__PURE__ */ n(W, { children: e || /* @__PURE__ */ n(Rt, {}) });
|
|
3419
|
+
if (C) {
|
|
3420
|
+
const q = typeof t == "function" ? t(C, T) : t || /* @__PURE__ */ n(Lt, { error: C, retry: T });
|
|
3421
|
+
return /* @__PURE__ */ n(W, { children: q });
|
|
3428
3422
|
}
|
|
3429
|
-
return /* @__PURE__ */ n(
|
|
3423
|
+
return /* @__PURE__ */ n(W, { children: i });
|
|
3430
3424
|
}
|
|
3431
|
-
function
|
|
3432
|
-
const { isAppLoading: e, appError: t, retryApp: r, appInfo: s } =
|
|
3433
|
-
}),
|
|
3425
|
+
function nr(i = !0) {
|
|
3426
|
+
const { isAppLoading: e, appError: t, retryApp: r, appInfo: s } = he(), o = ye(), a = Fe(), p = Ce(), w = De(), y = (o == null ? void 0 : o.isTenantLoading) ?? !1, x = (o == null ? void 0 : o.tenantError) ?? null, b = (o == null ? void 0 : o.tenant) ?? null, f = (o == null ? void 0 : o.tenantSlug) ?? null, A = (o == null ? void 0 : o.retryTenant) ?? (() => {
|
|
3427
|
+
}), L = (a == null ? void 0 : a.isAuthReady) ?? !0, D = (p == null ? void 0 : p.isReady) ?? !0, I = (w == null ? void 0 : w.isReady) ?? !0, M = i && o && f, H = e || M && y || a && !L || p && !D || w && !I, $ = t || (M ? x : null);
|
|
3434
3428
|
return {
|
|
3435
|
-
isLoading:
|
|
3436
|
-
error:
|
|
3437
|
-
isReady: !
|
|
3429
|
+
isLoading: H,
|
|
3430
|
+
error: $,
|
|
3431
|
+
isReady: !H && !$ && s !== null && (!M || b !== null),
|
|
3438
3432
|
retry: () => {
|
|
3439
|
-
t && r(),
|
|
3433
|
+
t && r(), x && o && A();
|
|
3440
3434
|
},
|
|
3441
3435
|
// Individual states
|
|
3442
3436
|
app: { isLoading: e, error: t, data: s },
|
|
3443
|
-
tenant: o ? { isLoading:
|
|
3437
|
+
tenant: o ? { isLoading: y, error: x, data: b } : null,
|
|
3438
|
+
auth: a ? { isReady: L } : null,
|
|
3439
|
+
featureFlags: p ? { isReady: D } : null,
|
|
3440
|
+
subscription: w ? { isReady: I } : null
|
|
3444
3441
|
};
|
|
3445
3442
|
}
|
|
3446
|
-
class
|
|
3443
|
+
class sr {
|
|
3447
3444
|
constructor(e, t) {
|
|
3448
3445
|
this.httpService = e, this.sessionManager = t;
|
|
3449
3446
|
}
|
|
@@ -3511,7 +3508,7 @@ class Zt {
|
|
|
3511
3508
|
};
|
|
3512
3509
|
}
|
|
3513
3510
|
}
|
|
3514
|
-
class
|
|
3511
|
+
class ir {
|
|
3515
3512
|
constructor(e, t) {
|
|
3516
3513
|
this.httpService = e, this.sessionManager = t;
|
|
3517
3514
|
}
|
|
@@ -3562,7 +3559,7 @@ class er {
|
|
|
3562
3559
|
});
|
|
3563
3560
|
}
|
|
3564
3561
|
}
|
|
3565
|
-
class
|
|
3562
|
+
class or {
|
|
3566
3563
|
constructor(e) {
|
|
3567
3564
|
this.httpService = e;
|
|
3568
3565
|
}
|
|
@@ -3571,7 +3568,7 @@ class tr {
|
|
|
3571
3568
|
return await this.httpService.get("/health");
|
|
3572
3569
|
}
|
|
3573
3570
|
}
|
|
3574
|
-
class
|
|
3571
|
+
class ar {
|
|
3575
3572
|
// Date string to Date object
|
|
3576
3573
|
static toDate(e) {
|
|
3577
3574
|
return new Date(e);
|
|
@@ -3694,47 +3691,47 @@ class rr {
|
|
|
3694
3691
|
}
|
|
3695
3692
|
}
|
|
3696
3693
|
export {
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3694
|
+
ar as ApiMappers,
|
|
3695
|
+
Pe as AppApiService,
|
|
3696
|
+
rr as AppLoader,
|
|
3697
|
+
Nt as AppProvider,
|
|
3698
|
+
_e as AuthApiService,
|
|
3699
|
+
Ot as AuthProvider,
|
|
3700
|
+
Yt as FeatureFlag,
|
|
3701
|
+
rt as FeatureFlagApiService,
|
|
3702
|
+
Wt as FeatureFlagProvider,
|
|
3703
|
+
or as HealthApiService,
|
|
3707
3704
|
re as HttpService,
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3705
|
+
Kt as LandingRoute,
|
|
3706
|
+
Qt as LoginForm,
|
|
3707
|
+
Zt as MagicLinkForm,
|
|
3708
|
+
er as MagicLinkVerify,
|
|
3709
|
+
tr as PasswordRecoveryForm,
|
|
3710
|
+
sr as PermissionApiService,
|
|
3711
|
+
Vt as Protected,
|
|
3712
|
+
_t as ProtectedRoute,
|
|
3713
|
+
Me as RoleApiService,
|
|
3714
|
+
be as SessionManager,
|
|
3715
|
+
Xt as SignupForm,
|
|
3716
|
+
st as SubscriptionApiService,
|
|
3717
|
+
Jt as SubscriptionGuard,
|
|
3718
|
+
ir as SubscriptionPlanApiService,
|
|
3719
|
+
jt as SubscriptionProvider,
|
|
3720
|
+
de as TenantApiService,
|
|
3721
|
+
Bt as TenantProvider,
|
|
3722
|
+
Gt as TenantRoute,
|
|
3723
|
+
Ge as UserApiService,
|
|
3727
3724
|
ie as UserType,
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3725
|
+
Ut as useApi,
|
|
3726
|
+
he as useApp,
|
|
3727
|
+
nr as useAppLoaderState,
|
|
3728
|
+
oe as useAuth,
|
|
3729
|
+
nt as useFeatureFlags,
|
|
3730
|
+
zt as useSettings,
|
|
3731
|
+
it as useSubscription,
|
|
3735
3732
|
me as useTenant,
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3733
|
+
le as useTenantInfo,
|
|
3734
|
+
ye as useTenantOptional,
|
|
3735
|
+
qt as useTenantSettings
|
|
3739
3736
|
};
|
|
3740
3737
|
//# sourceMappingURL=index.es.js.map
|