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