@skylabs-digital/react-identity-access 1.6.0 → 2.0.1
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/FeatureFlag.d.ts.map +1 -1
- package/dist/components/LoginForm.d.ts.map +1 -1
- package/dist/components/MagicLinkForm.d.ts.map +1 -1
- package/dist/components/MagicLinkVerify.d.ts +2 -2
- package/dist/components/MagicLinkVerify.d.ts.map +1 -1
- package/dist/components/SignupForm.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1247 -1043
- 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 +5 -0
- package/dist/providers/AppProvider.d.ts.map +1 -1
- package/dist/providers/AuthProvider.d.ts +15 -9
- package/dist/providers/AuthProvider.d.ts.map +1 -1
- package/dist/providers/TenantProvider.d.ts +6 -0
- package/dist/providers/TenantProvider.d.ts.map +1 -1
- package/dist/services/AuthApiService.d.ts.map +1 -1
- package/dist/services/SessionManager.d.ts +22 -0
- package/dist/services/SessionManager.d.ts.map +1 -1
- package/dist/types/api.d.ts +4 -2
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/authParams.d.ts +49 -0
- package/dist/types/authParams.d.ts.map +1 -0
- package/package.json +4 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as n, Fragment as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useLocation as
|
|
4
|
-
class
|
|
1
|
+
import { jsx as n, Fragment as N, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as de, useMemo as Q, useState as v, useCallback as ne, useEffect as te, useContext as ue } from "react";
|
|
3
|
+
import { useLocation as we, Navigate as pe } from "react-router-dom";
|
|
4
|
+
class re {
|
|
5
5
|
// SessionManager instance
|
|
6
6
|
constructor(e, t = 1e4) {
|
|
7
7
|
this.baseUrl = e.replace(/\/$/, ""), this.timeout = t;
|
|
@@ -15,41 +15,41 @@ class te {
|
|
|
15
15
|
async request(e, t, r, s) {
|
|
16
16
|
return this.executeRequest(e, t, r, s, !1);
|
|
17
17
|
}
|
|
18
|
-
async executeRequest(e, t, r, s,
|
|
19
|
-
const
|
|
20
|
-
let
|
|
18
|
+
async executeRequest(e, t, r, s, o = !1) {
|
|
19
|
+
const p = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, I = (s == null ? void 0 : s.timeout) || this.timeout;
|
|
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
|
-
|
|
28
|
-
} catch (
|
|
29
|
-
console.warn("Failed to inject auth headers:",
|
|
26
|
+
const b = await this.sessionManager.getAuthHeaders();
|
|
27
|
+
A = { ...A, ...b };
|
|
28
|
+
} catch (b) {
|
|
29
|
+
console.warn("Failed to inject auth headers:", b);
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const x = new AbortController(), T = setTimeout(() => x.abort(), I);
|
|
32
32
|
try {
|
|
33
|
-
const
|
|
33
|
+
const b = await fetch(p, {
|
|
34
34
|
method: e,
|
|
35
|
-
headers:
|
|
35
|
+
headers: A,
|
|
36
36
|
body: r ? JSON.stringify(r) : void 0,
|
|
37
|
-
signal:
|
|
37
|
+
signal: x.signal
|
|
38
38
|
});
|
|
39
|
-
if (clearTimeout(
|
|
39
|
+
if (clearTimeout(T), b.status === 401 && !(s != null && s.skipRetry) && !o && this.sessionManager)
|
|
40
40
|
try {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
41
|
+
const h = this.sessionManager.getTokens();
|
|
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 ${b.status}: ${b.statusText}`);
|
|
46
46
|
}
|
|
47
|
-
if (!
|
|
48
|
-
throw new Error(`HTTP ${
|
|
49
|
-
const
|
|
50
|
-
return !
|
|
51
|
-
} catch (
|
|
52
|
-
throw clearTimeout(
|
|
47
|
+
if (!b.ok)
|
|
48
|
+
throw new Error(`HTTP ${b.status}: ${b.statusText}`);
|
|
49
|
+
const f = b.headers.get("content-type");
|
|
50
|
+
return !f || !f.includes("application/json") ? {} : await b.json();
|
|
51
|
+
} catch (b) {
|
|
52
|
+
throw clearTimeout(T), b instanceof Error && b.name === "AbortError" ? new Error(`Request timeout after ${I}ms`) : b;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
async get(e, t) {
|
|
@@ -65,7 +65,7 @@ class te {
|
|
|
65
65
|
return this.request("DELETE", e, void 0, t);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
class
|
|
68
|
+
class be {
|
|
69
69
|
constructor(e, t) {
|
|
70
70
|
this.httpService = e, this.sessionManager = t;
|
|
71
71
|
}
|
|
@@ -78,12 +78,12 @@ class Te {
|
|
|
78
78
|
async getApps(e) {
|
|
79
79
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
80
80
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
|
|
81
|
-
const s = `/apps/${r.toString() ? `?${r.toString()}` : ""}`,
|
|
81
|
+
const s = `/apps/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(s, {
|
|
82
82
|
headers: t
|
|
83
83
|
});
|
|
84
84
|
return {
|
|
85
|
-
apps:
|
|
86
|
-
meta:
|
|
85
|
+
apps: o.data,
|
|
86
|
+
meta: o.meta
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
async getAppById(e) {
|
|
@@ -124,7 +124,7 @@ class Te {
|
|
|
124
124
|
})).data;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const Ae = de(null), De = () => /* @__PURE__ */ n(
|
|
128
128
|
"div",
|
|
129
129
|
{
|
|
130
130
|
style: {
|
|
@@ -136,7 +136,7 @@ const we = ae(null), Me = () => /* @__PURE__ */ n(
|
|
|
136
136
|
},
|
|
137
137
|
children: /* @__PURE__ */ n("div", { children: "Loading application..." })
|
|
138
138
|
}
|
|
139
|
-
),
|
|
139
|
+
), He = ({ error: i, retry: e }) => /* @__PURE__ */ l(
|
|
140
140
|
"div",
|
|
141
141
|
{
|
|
142
142
|
style: {
|
|
@@ -170,55 +170,113 @@ const we = ae(null), Me = () => /* @__PURE__ */ n(
|
|
|
170
170
|
]
|
|
171
171
|
}
|
|
172
172
|
);
|
|
173
|
-
function
|
|
174
|
-
const
|
|
173
|
+
function St({ config: i, children: e }) {
|
|
174
|
+
const t = Q(
|
|
175
|
+
() => {
|
|
176
|
+
var f, h, S;
|
|
177
|
+
return {
|
|
178
|
+
enabled: ((f = i.cache) == null ? void 0 : f.enabled) ?? !0,
|
|
179
|
+
ttl: ((h = i.cache) == null ? void 0 : h.ttl) ?? 3e5,
|
|
180
|
+
// 5 minutes default
|
|
181
|
+
storageKey: ((S = i.cache) == null ? void 0 : S.storageKey) ?? `app_cache_${i.appId}`
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
[i.cache, i.appId]
|
|
185
|
+
), [r, s] = v(() => {
|
|
186
|
+
if (!t.enabled) return null;
|
|
187
|
+
try {
|
|
188
|
+
const f = localStorage.getItem(t.storageKey);
|
|
189
|
+
if (!f) return null;
|
|
190
|
+
const h = JSON.parse(f);
|
|
191
|
+
return Date.now() - h.timestamp < t.ttl && h.appId === i.appId ? h.data : (localStorage.removeItem(t.storageKey), null);
|
|
192
|
+
} catch {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
}), [o, p] = v(!r), [I, A] = v(null), x = Q(() => {
|
|
175
196
|
const f = () => {
|
|
176
|
-
|
|
197
|
+
T();
|
|
177
198
|
};
|
|
178
199
|
return {
|
|
179
200
|
appId: i.appId,
|
|
180
201
|
baseUrl: i.baseUrl,
|
|
181
202
|
// App info
|
|
182
|
-
appInfo:
|
|
183
|
-
isAppLoading:
|
|
184
|
-
appError:
|
|
203
|
+
appInfo: r,
|
|
204
|
+
isAppLoading: o,
|
|
205
|
+
appError: I,
|
|
185
206
|
retryApp: f
|
|
186
207
|
};
|
|
187
|
-
}, [i,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
+
}, [i, r, o, I]), T = ne(
|
|
209
|
+
async (f = !1) => {
|
|
210
|
+
if (!(!f && t.enabled && r))
|
|
211
|
+
try {
|
|
212
|
+
p(!0), A(null);
|
|
213
|
+
const h = new re(i.baseUrl), L = await new be(h, {}).getPublicAppInfo(i.appId);
|
|
214
|
+
if (s(L), t.enabled)
|
|
215
|
+
try {
|
|
216
|
+
const R = {
|
|
217
|
+
data: L,
|
|
218
|
+
timestamp: Date.now(),
|
|
219
|
+
appId: i.appId
|
|
220
|
+
};
|
|
221
|
+
localStorage.setItem(t.storageKey, JSON.stringify(R));
|
|
222
|
+
} catch (R) {
|
|
223
|
+
console.warn("Failed to cache app info:", R);
|
|
224
|
+
}
|
|
225
|
+
} catch (h) {
|
|
226
|
+
const S = h instanceof Error ? h : new Error("Failed to load app information");
|
|
227
|
+
A(S), s(null);
|
|
228
|
+
} finally {
|
|
229
|
+
p(!1);
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
[i.baseUrl, i.appId, t, r]
|
|
233
|
+
), b = ne(async () => {
|
|
234
|
+
if (!(!t.enabled || !r))
|
|
235
|
+
try {
|
|
236
|
+
const f = localStorage.getItem(t.storageKey);
|
|
237
|
+
if (!f) return;
|
|
238
|
+
const h = JSON.parse(f);
|
|
239
|
+
if (Date.now() - h.timestamp > t.ttl * 0.5) {
|
|
240
|
+
const L = new re(i.baseUrl), q = await new be(L, {}).getPublicAppInfo(i.appId);
|
|
241
|
+
s(q);
|
|
242
|
+
const k = {
|
|
243
|
+
data: q,
|
|
244
|
+
timestamp: Date.now(),
|
|
245
|
+
appId: i.appId
|
|
246
|
+
};
|
|
247
|
+
localStorage.setItem(t.storageKey, JSON.stringify(k));
|
|
248
|
+
}
|
|
249
|
+
} catch (f) {
|
|
250
|
+
console.warn("Background app refresh failed:", f);
|
|
251
|
+
}
|
|
252
|
+
}, [i, t, r]);
|
|
253
|
+
if (te(() => {
|
|
254
|
+
r ? b() : T();
|
|
255
|
+
}, []), o)
|
|
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
262
|
}
|
|
209
|
-
function
|
|
210
|
-
const i =
|
|
263
|
+
function he() {
|
|
264
|
+
const i = ue(Ae);
|
|
211
265
|
if (!i)
|
|
212
266
|
throw new Error("useApp must be used within an AppProvider");
|
|
213
267
|
return i;
|
|
214
268
|
}
|
|
215
|
-
const
|
|
216
|
-
class
|
|
269
|
+
const vt = he;
|
|
270
|
+
class ye {
|
|
217
271
|
constructor(e = {}) {
|
|
218
|
-
this.refreshPromise = null, this.refreshQueue = [], 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 ||
|
|
272
|
+
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);
|
|
273
|
+
}
|
|
274
|
+
// Helper to create a TokenStorage for a specific key
|
|
275
|
+
createTokenStorage(e) {
|
|
276
|
+
return {
|
|
219
277
|
get: () => {
|
|
220
278
|
try {
|
|
221
|
-
const t = localStorage.getItem(
|
|
279
|
+
const t = localStorage.getItem(e);
|
|
222
280
|
return t ? JSON.parse(t) : null;
|
|
223
281
|
} catch {
|
|
224
282
|
return null;
|
|
@@ -226,13 +284,13 @@ class Le {
|
|
|
226
284
|
},
|
|
227
285
|
set: (t) => {
|
|
228
286
|
try {
|
|
229
|
-
localStorage.setItem(
|
|
287
|
+
localStorage.setItem(e, JSON.stringify(t));
|
|
230
288
|
} catch {
|
|
231
289
|
}
|
|
232
290
|
},
|
|
233
291
|
clear: () => {
|
|
234
292
|
try {
|
|
235
|
-
localStorage.removeItem(
|
|
293
|
+
localStorage.removeItem(e);
|
|
236
294
|
} catch {
|
|
237
295
|
}
|
|
238
296
|
}
|
|
@@ -246,7 +304,14 @@ class Le {
|
|
|
246
304
|
this.tokenStorage.set(t);
|
|
247
305
|
}
|
|
248
306
|
getTokens() {
|
|
249
|
-
|
|
307
|
+
const { accessToken: e, refreshToken: t, expiresAt: r, expiresIn: s, tokenType: o } = this.tokenStorage.get() || {};
|
|
308
|
+
return e ? {
|
|
309
|
+
accessToken: e,
|
|
310
|
+
refreshToken: t,
|
|
311
|
+
expiresAt: r,
|
|
312
|
+
expiresIn: s,
|
|
313
|
+
tokenType: o
|
|
314
|
+
} : null;
|
|
250
315
|
}
|
|
251
316
|
clearTokens() {
|
|
252
317
|
this.tokenStorage.clear();
|
|
@@ -325,19 +390,43 @@ class Le {
|
|
|
325
390
|
clearSession() {
|
|
326
391
|
this.clearTokens(), this.clearUser();
|
|
327
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Decode JWT token and extract payload
|
|
395
|
+
* Returns null if token is invalid or cannot be decoded
|
|
396
|
+
*/
|
|
397
|
+
getTokenPayload() {
|
|
398
|
+
try {
|
|
399
|
+
const e = this.getTokens();
|
|
400
|
+
if (!(e != null && e.accessToken)) return null;
|
|
401
|
+
const t = e.accessToken.split(".");
|
|
402
|
+
if (t.length !== 3) return null;
|
|
403
|
+
const r = t[1], s = atob(r.replace(/-/g, "+").replace(/_/g, "/"));
|
|
404
|
+
return JSON.parse(s);
|
|
405
|
+
} catch {
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Get userId from token (source of truth) or fallback to stored user
|
|
411
|
+
*/
|
|
412
|
+
getUserId() {
|
|
413
|
+
const e = this.getTokenPayload();
|
|
414
|
+
if (e != null && e.userId) return e.userId;
|
|
415
|
+
const t = this.getUser();
|
|
416
|
+
return (t == null ? void 0 : t.id) || null;
|
|
417
|
+
}
|
|
328
418
|
hasValidSession() {
|
|
329
419
|
const e = this.getTokens();
|
|
330
420
|
return e !== null && !this.isTokenExpired(e);
|
|
331
421
|
}
|
|
332
422
|
}
|
|
333
|
-
class
|
|
423
|
+
class Ne {
|
|
334
424
|
constructor(e) {
|
|
335
425
|
this.httpService = e;
|
|
336
426
|
}
|
|
337
427
|
// Public endpoints - no auth required
|
|
338
428
|
async login(e) {
|
|
339
|
-
|
|
340
|
-
return console.log(t), t;
|
|
429
|
+
return await this.httpService.post("/auth/login", e);
|
|
341
430
|
}
|
|
342
431
|
async signup(e) {
|
|
343
432
|
return await this.httpService.post("/auth/signup", e);
|
|
@@ -376,7 +465,7 @@ class Re {
|
|
|
376
465
|
});
|
|
377
466
|
}
|
|
378
467
|
}
|
|
379
|
-
class
|
|
468
|
+
class Se {
|
|
380
469
|
constructor(e, t) {
|
|
381
470
|
this.httpService = e, this.sessionManager = t;
|
|
382
471
|
}
|
|
@@ -416,10 +505,10 @@ class pe {
|
|
|
416
505
|
async getRolesByApp(e, t) {
|
|
417
506
|
const r = new URLSearchParams();
|
|
418
507
|
t != null && t.page && r.append("page", t.page.toString()), t != null && t.limit && r.append("limit", t.limit.toString()), t != null && t.sortBy && r.append("sortBy", t.sortBy), t != null && t.sortOrder && r.append("sortOrder", t.sortOrder);
|
|
419
|
-
const s = `/roles/app/${e}${r.toString() ? `?${r.toString()}` : ""}`,
|
|
508
|
+
const s = `/roles/app/${e}${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(s);
|
|
420
509
|
return {
|
|
421
|
-
roles:
|
|
422
|
-
meta:
|
|
510
|
+
roles: o.data,
|
|
511
|
+
meta: o.meta
|
|
423
512
|
};
|
|
424
513
|
}
|
|
425
514
|
async assignRole(e, t) {
|
|
@@ -443,16 +532,16 @@ class pe {
|
|
|
443
532
|
throw new Error("SessionManager is required for private endpoints");
|
|
444
533
|
const r = await this.sessionManager.getAuthHeaders(), s = new URLSearchParams();
|
|
445
534
|
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);
|
|
446
|
-
const
|
|
535
|
+
const o = `/roles/user/${e}${s.toString() ? `?${s.toString()}` : ""}`, p = await this.httpService.get(o, {
|
|
447
536
|
headers: r
|
|
448
537
|
});
|
|
449
538
|
return {
|
|
450
|
-
roles:
|
|
451
|
-
meta:
|
|
539
|
+
roles: p.data,
|
|
540
|
+
meta: p.meta
|
|
452
541
|
};
|
|
453
542
|
}
|
|
454
543
|
}
|
|
455
|
-
class
|
|
544
|
+
class Be {
|
|
456
545
|
constructor(e, t) {
|
|
457
546
|
this.httpService = e, this.sessionManager = t;
|
|
458
547
|
}
|
|
@@ -465,12 +554,12 @@ class Ce {
|
|
|
465
554
|
async getUsers(e) {
|
|
466
555
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
467
556
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
|
|
468
|
-
const s = `/users/${r.toString() ? `?${r.toString()}` : ""}`,
|
|
557
|
+
const s = `/users/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(s, {
|
|
469
558
|
headers: t
|
|
470
559
|
});
|
|
471
560
|
return {
|
|
472
|
-
users:
|
|
473
|
-
meta:
|
|
561
|
+
users: o.data,
|
|
562
|
+
meta: o.meta
|
|
474
563
|
};
|
|
475
564
|
}
|
|
476
565
|
async getUserById(e) {
|
|
@@ -492,7 +581,7 @@ class Ce {
|
|
|
492
581
|
});
|
|
493
582
|
}
|
|
494
583
|
}
|
|
495
|
-
class
|
|
584
|
+
class ce {
|
|
496
585
|
constructor(e, t, r) {
|
|
497
586
|
this.httpService = e, this.appId = t, this.sessionManager = r;
|
|
498
587
|
}
|
|
@@ -509,12 +598,12 @@ class fe {
|
|
|
509
598
|
throw new Error("SessionManager is required for private endpoints");
|
|
510
599
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
511
600
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
|
|
512
|
-
const s = `/tenants/${r.toString() ? `?${r.toString()}` : ""}`,
|
|
601
|
+
const s = `/tenants/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(s, {
|
|
513
602
|
headers: t
|
|
514
603
|
});
|
|
515
604
|
return {
|
|
516
|
-
tenants:
|
|
517
|
-
meta:
|
|
605
|
+
tenants: o.data,
|
|
606
|
+
meta: o.meta
|
|
518
607
|
};
|
|
519
608
|
}
|
|
520
609
|
async getTenantById(e) {
|
|
@@ -570,7 +659,7 @@ class fe {
|
|
|
570
659
|
)).data;
|
|
571
660
|
}
|
|
572
661
|
}
|
|
573
|
-
const
|
|
662
|
+
const Te = de(null), Ue = () => /* @__PURE__ */ n(
|
|
574
663
|
"div",
|
|
575
664
|
{
|
|
576
665
|
style: {
|
|
@@ -582,7 +671,7 @@ const ve = ae(null), Ie = () => /* @__PURE__ */ n(
|
|
|
582
671
|
},
|
|
583
672
|
children: /* @__PURE__ */ n("div", { children: "Loading tenant..." })
|
|
584
673
|
}
|
|
585
|
-
),
|
|
674
|
+
), qe = ({ error: i, retry: e }) => /* @__PURE__ */ l(
|
|
586
675
|
"div",
|
|
587
676
|
{
|
|
588
677
|
style: {
|
|
@@ -616,77 +705,134 @@ const ve = ae(null), Ie = () => /* @__PURE__ */ n(
|
|
|
616
705
|
]
|
|
617
706
|
}
|
|
618
707
|
);
|
|
619
|
-
function
|
|
620
|
-
const { baseUrl: t, appInfo: r, appId: s } =
|
|
621
|
-
const
|
|
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";
|
|
622
711
|
if (typeof window > "u") return null;
|
|
623
|
-
if (
|
|
624
|
-
const
|
|
625
|
-
if (
|
|
626
|
-
const d =
|
|
627
|
-
return localStorage.setItem(
|
|
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;
|
|
628
717
|
}
|
|
629
|
-
return localStorage.getItem(
|
|
630
|
-
} else if (
|
|
631
|
-
const
|
|
632
|
-
return
|
|
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);
|
|
633
722
|
}
|
|
634
723
|
return null;
|
|
635
|
-
}, [i.tenantMode, i.selectorParam]),
|
|
636
|
-
|
|
724
|
+
}, [i.tenantMode, i.selectorParam]), [p, I] = v(() => o()), A = Q(
|
|
725
|
+
() => {
|
|
726
|
+
var a, g, m;
|
|
727
|
+
return {
|
|
728
|
+
enabled: ((a = i.cache) == null ? void 0 : a.enabled) ?? !0,
|
|
729
|
+
ttl: ((g = i.cache) == null ? void 0 : g.ttl) ?? 5 * 60 * 1e3,
|
|
730
|
+
// 5 minutes default
|
|
731
|
+
storageKey: ((m = i.cache) == null ? void 0 : m.storageKey) ?? `tenant_cache_${p || "default"}`
|
|
732
|
+
};
|
|
733
|
+
},
|
|
734
|
+
[i.cache, p]
|
|
735
|
+
), [x, T] = v(() => {
|
|
736
|
+
if (i.initialTenant) return i.initialTenant;
|
|
737
|
+
if (!A.enabled || !p) return null;
|
|
738
|
+
try {
|
|
739
|
+
const a = localStorage.getItem(A.storageKey);
|
|
740
|
+
if (!a) return null;
|
|
741
|
+
const g = JSON.parse(a);
|
|
742
|
+
return Date.now() - g.timestamp < A.ttl && g.tenantSlug === p ? g.data : (localStorage.removeItem(A.storageKey), null);
|
|
743
|
+
} catch {
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
}), [b, f] = v(!x && !i.initialTenant), [h, S] = v(null), [L, R] = v(null), [q, k] = v(!1), [u, P] = v(null);
|
|
747
|
+
te(() => {
|
|
748
|
+
const a = o();
|
|
749
|
+
I(a);
|
|
750
|
+
}, [o]);
|
|
751
|
+
const C = (r == null ? void 0 : r.settingsSchema) || null, H = ne(
|
|
752
|
+
async (a, g = !1) => {
|
|
753
|
+
if (!(!g && A.enabled && x && x.domain === a))
|
|
754
|
+
try {
|
|
755
|
+
f(!0), S(null);
|
|
756
|
+
const m = new re(t), d = await new ce(m, s).getPublicTenantInfo(a);
|
|
757
|
+
if (T(d), A.enabled)
|
|
758
|
+
try {
|
|
759
|
+
const y = {
|
|
760
|
+
data: d,
|
|
761
|
+
timestamp: Date.now(),
|
|
762
|
+
tenantSlug: a
|
|
763
|
+
};
|
|
764
|
+
localStorage.setItem(A.storageKey, JSON.stringify(y));
|
|
765
|
+
} catch (y) {
|
|
766
|
+
console.warn("Failed to cache tenant info:", y);
|
|
767
|
+
}
|
|
768
|
+
} catch (m) {
|
|
769
|
+
const c = m instanceof Error ? m : new Error("Failed to load tenant information");
|
|
770
|
+
S(c), T(null);
|
|
771
|
+
} finally {
|
|
772
|
+
f(!1);
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
[t, s, A, x]
|
|
776
|
+
), W = ne(async () => {
|
|
777
|
+
if (!(!A.enabled || !x || !p))
|
|
637
778
|
try {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
779
|
+
const a = localStorage.getItem(A.storageKey);
|
|
780
|
+
if (!a) return;
|
|
781
|
+
const g = JSON.parse(a);
|
|
782
|
+
if (Date.now() - g.timestamp > A.ttl * 0.5) {
|
|
783
|
+
const c = new re(t), y = await new ce(c, s).getPublicTenantInfo(p);
|
|
784
|
+
T(y);
|
|
785
|
+
const G = {
|
|
786
|
+
data: y,
|
|
787
|
+
timestamp: Date.now(),
|
|
788
|
+
tenantSlug: p
|
|
789
|
+
};
|
|
790
|
+
localStorage.setItem(A.storageKey, JSON.stringify(G));
|
|
791
|
+
}
|
|
792
|
+
} catch (a) {
|
|
793
|
+
console.warn("Background tenant refresh failed:", a);
|
|
646
794
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
), F = oe(async () => {
|
|
650
|
-
if (a != null && a.id)
|
|
795
|
+
}, [t, s, A, x, p]), F = ne(async () => {
|
|
796
|
+
if (x != null && x.id)
|
|
651
797
|
try {
|
|
652
|
-
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
} catch (
|
|
656
|
-
const
|
|
657
|
-
g
|
|
798
|
+
k(!0), P(null);
|
|
799
|
+
const a = new re(t), m = await new ce(a, x.appId).getTenantSettings(x.id);
|
|
800
|
+
R(m);
|
|
801
|
+
} catch (a) {
|
|
802
|
+
const g = a instanceof Error ? a : new Error("Failed to load tenant settings");
|
|
803
|
+
P(g), R(null);
|
|
658
804
|
} finally {
|
|
659
|
-
|
|
805
|
+
k(!1);
|
|
660
806
|
}
|
|
661
|
-
}, [t,
|
|
807
|
+
}, [t, x]), V = ne(() => {
|
|
662
808
|
F();
|
|
663
|
-
}, [F]),
|
|
664
|
-
(
|
|
665
|
-
if (!
|
|
809
|
+
}, [F]), w = ne(
|
|
810
|
+
(a) => {
|
|
811
|
+
if (!C)
|
|
666
812
|
return { isValid: !0, errors: [] };
|
|
667
|
-
const
|
|
813
|
+
const g = [];
|
|
668
814
|
try {
|
|
669
|
-
return
|
|
670
|
-
var
|
|
671
|
-
const d =
|
|
672
|
-
if ((
|
|
673
|
-
|
|
815
|
+
return C.properties && Object.entries(C.properties).forEach(([m, c]) => {
|
|
816
|
+
var y;
|
|
817
|
+
const d = a[m];
|
|
818
|
+
if ((y = C.required) != null && y.includes(m) && d == null) {
|
|
819
|
+
g.push(`Field '${m}' is required`);
|
|
674
820
|
return;
|
|
675
821
|
}
|
|
676
822
|
if (d != null) {
|
|
677
|
-
if (
|
|
678
|
-
const
|
|
679
|
-
|
|
823
|
+
if (c.type) {
|
|
824
|
+
const G = c.type, ee = typeof d;
|
|
825
|
+
G === "string" && ee !== "string" ? g.push(`Field '${m}' must be a string`) : (G === "number" || G === "integer") && ee !== "number" ? g.push(`Field '${m}' must be a number`) : G === "boolean" && ee !== "boolean" ? g.push(`Field '${m}' must be a boolean`) : G === "array" && !Array.isArray(d) && g.push(`Field '${m}' must be an array`);
|
|
680
826
|
}
|
|
681
|
-
|
|
682
|
-
`Field '${
|
|
683
|
-
),
|
|
684
|
-
`Field '${
|
|
685
|
-
),
|
|
827
|
+
c.minLength !== void 0 && typeof d == "string" && d.length < c.minLength && g.push(
|
|
828
|
+
`Field '${m}' must be at least ${c.minLength} characters long`
|
|
829
|
+
), c.maxLength !== void 0 && typeof d == "string" && d.length > c.maxLength && g.push(
|
|
830
|
+
`Field '${m}' must be no more than ${c.maxLength} characters long`
|
|
831
|
+
), c.minimum !== void 0 && typeof d == "number" && d < c.minimum && g.push(`Field '${m}' must be at least ${c.minimum}`), c.maximum !== void 0 && typeof d == "number" && d > c.maximum && g.push(`Field '${m}' must be no more than ${c.maximum}`), c.pattern && typeof d == "string" && (new RegExp(c.pattern).test(d) || g.push(`Field '${m}' does not match the required pattern`)), c.enum && !c.enum.includes(d) && g.push(`Field '${m}' must be one of: ${c.enum.join(", ")}`);
|
|
686
832
|
}
|
|
687
833
|
}), {
|
|
688
|
-
isValid:
|
|
689
|
-
errors:
|
|
834
|
+
isValid: g.length === 0,
|
|
835
|
+
errors: g
|
|
690
836
|
};
|
|
691
837
|
} catch {
|
|
692
838
|
return {
|
|
@@ -695,60 +841,88 @@ function pt({ config: i, children: e }) {
|
|
|
695
841
|
};
|
|
696
842
|
}
|
|
697
843
|
},
|
|
698
|
-
[
|
|
844
|
+
[C]
|
|
699
845
|
);
|
|
700
|
-
|
|
701
|
-
!i.initialTenant &&
|
|
702
|
-
}, [i.initialTenant,
|
|
703
|
-
|
|
704
|
-
}, [
|
|
705
|
-
const
|
|
846
|
+
te(() => {
|
|
847
|
+
!i.initialTenant && p ? x ? W() : H(p) : !i.initialTenant && !p && (T(null), S(null), f(!1));
|
|
848
|
+
}, [i.initialTenant, p, x, H, W]), te(() => {
|
|
849
|
+
x != null && x.id ? F() : (R(null), P(null), k(!1));
|
|
850
|
+
}, [x == null ? void 0 : x.id, F]);
|
|
851
|
+
const M = ne(
|
|
852
|
+
(a, g = "reload") => {
|
|
853
|
+
const m = i.tenantMode || "selector";
|
|
854
|
+
if (localStorage.setItem("tenant", a), m === "subdomain") {
|
|
855
|
+
const c = window.location.hostname, d = c.split(".");
|
|
856
|
+
if (d.length >= 2) {
|
|
857
|
+
d[0] = a;
|
|
858
|
+
const y = d.join("."), G = `${window.location.protocol}//${y}${window.location.pathname}${window.location.search}`;
|
|
859
|
+
window.location.href = G;
|
|
860
|
+
} else
|
|
861
|
+
console.warn(
|
|
862
|
+
"[TenantProvider] Cannot switch subdomain, invalid hostname:",
|
|
863
|
+
c
|
|
864
|
+
);
|
|
865
|
+
} else if (m === "selector") {
|
|
866
|
+
const c = new URLSearchParams(window.location.search);
|
|
867
|
+
if (c.set(i.selectorParam || "tenant", a), g === "reload") {
|
|
868
|
+
const d = `${window.location.pathname}?${c.toString()}${window.location.hash}`;
|
|
869
|
+
window.location.href = d;
|
|
870
|
+
} else {
|
|
871
|
+
const d = `${window.location.pathname}?${c.toString()}${window.location.hash}`;
|
|
872
|
+
window.history.pushState({}, "", d), I(a), H(a);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
[i.tenantMode, i.selectorParam, H, p]
|
|
877
|
+
), E = Q(() => ({
|
|
706
878
|
// Tenant info
|
|
707
|
-
tenant:
|
|
708
|
-
tenantSlug:
|
|
709
|
-
isTenantLoading:
|
|
710
|
-
tenantError:
|
|
879
|
+
tenant: x,
|
|
880
|
+
tenantSlug: p,
|
|
881
|
+
isTenantLoading: b,
|
|
882
|
+
tenantError: h,
|
|
711
883
|
retryTenant: () => {
|
|
712
|
-
|
|
884
|
+
p && H(p);
|
|
713
885
|
},
|
|
714
886
|
// Settings
|
|
715
|
-
settings:
|
|
716
|
-
settingsSchema:
|
|
717
|
-
isSettingsLoading:
|
|
718
|
-
settingsError:
|
|
887
|
+
settings: L,
|
|
888
|
+
settingsSchema: C,
|
|
889
|
+
isSettingsLoading: q,
|
|
890
|
+
settingsError: u,
|
|
719
891
|
// Actions
|
|
720
|
-
refreshSettings:
|
|
892
|
+
refreshSettings: V,
|
|
893
|
+
switchTenant: M,
|
|
721
894
|
// Validation
|
|
722
|
-
validateSettings:
|
|
895
|
+
validateSettings: w
|
|
723
896
|
}), [
|
|
724
|
-
|
|
897
|
+
x,
|
|
898
|
+
p,
|
|
899
|
+
b,
|
|
900
|
+
h,
|
|
901
|
+
L,
|
|
902
|
+
C,
|
|
903
|
+
q,
|
|
725
904
|
u,
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
y,
|
|
730
|
-
w,
|
|
731
|
-
I,
|
|
732
|
-
B,
|
|
733
|
-
z
|
|
905
|
+
V,
|
|
906
|
+
M,
|
|
907
|
+
w
|
|
734
908
|
]);
|
|
735
|
-
if (
|
|
736
|
-
return /* @__PURE__ */ n(
|
|
737
|
-
if (
|
|
738
|
-
const
|
|
739
|
-
return /* @__PURE__ */ n(
|
|
909
|
+
if (b)
|
|
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 });
|
|
740
914
|
}
|
|
741
|
-
return /* @__PURE__ */ n(
|
|
915
|
+
return /* @__PURE__ */ n(Te.Provider, { value: E, children: e });
|
|
742
916
|
}
|
|
743
|
-
function
|
|
744
|
-
const i =
|
|
917
|
+
function fe() {
|
|
918
|
+
const i = ue(Te);
|
|
745
919
|
if (!i)
|
|
746
920
|
throw new Error("useTenant must be used within a TenantProvider");
|
|
747
921
|
return i;
|
|
748
922
|
}
|
|
749
|
-
const
|
|
750
|
-
function
|
|
751
|
-
const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: s } =
|
|
923
|
+
const kt = fe;
|
|
924
|
+
function At() {
|
|
925
|
+
const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: s } = fe();
|
|
752
926
|
return {
|
|
753
927
|
settings: i,
|
|
754
928
|
settingsSchema: e,
|
|
@@ -757,8 +931,8 @@ function mt() {
|
|
|
757
931
|
validateSettings: s
|
|
758
932
|
};
|
|
759
933
|
}
|
|
760
|
-
function
|
|
761
|
-
const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: s } =
|
|
934
|
+
function se() {
|
|
935
|
+
const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: s } = fe();
|
|
762
936
|
return {
|
|
763
937
|
tenant: i,
|
|
764
938
|
tenantSlug: e,
|
|
@@ -767,249 +941,273 @@ function re() {
|
|
|
767
941
|
retry: s
|
|
768
942
|
};
|
|
769
943
|
}
|
|
770
|
-
const
|
|
771
|
-
function
|
|
772
|
-
const { appId: t, baseUrl: r } =
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
set: (h) => {
|
|
783
|
-
try {
|
|
784
|
-
localStorage.setItem(S, JSON.stringify(h));
|
|
785
|
-
} catch {
|
|
786
|
-
}
|
|
787
|
-
},
|
|
788
|
-
clear: () => {
|
|
789
|
-
try {
|
|
790
|
-
localStorage.removeItem(S);
|
|
791
|
-
} catch {
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
};
|
|
795
|
-
return new Le({
|
|
796
|
-
onRefreshFailed: i.onRefreshFailed,
|
|
797
|
-
tokenStorage: c,
|
|
798
|
-
baseUrl: r
|
|
799
|
-
});
|
|
800
|
-
}, [a, r, i.onRefreshFailed]), U = _(() => {
|
|
801
|
-
const S = new te(r);
|
|
802
|
-
return S.setSessionManager(g), S;
|
|
803
|
-
}, [r, g]), u = _(() => new Re(new te(r)), [r]), y = _(() => new Ce(U, g), [U, g]), x = _(() => new pe(new te(r)), [r]), F = _(() => f || g.getUser(), [f, g]), B = _(() => F != null && F.roleId && b.find((S) => S.id === F.roleId) || null, [F, b]), z = _(() => (B == null ? void 0 : B.permissions) || [], [B]);
|
|
804
|
-
Z(() => {
|
|
805
|
-
console.log("AuthProvider - userPermissions changed:", z);
|
|
806
|
-
}, [z]);
|
|
807
|
-
const q = _(() => {
|
|
808
|
-
const S = async () => {
|
|
944
|
+
const Pe = de(null);
|
|
945
|
+
function Tt({ config: i = {}, children: e }) {
|
|
946
|
+
const { appId: t, baseUrl: r } = he(), { tenant: s, tenantSlug: o, switchTenant: p } = fe(), [I, A] = v(i.initialRoles || []), [x, T] = v(!i.initialRoles), [b, f] = v(null), [h, S] = v(!1), [L, R] = v(null), [q, k] = v(0), u = Q(() => new ye({
|
|
947
|
+
tenantSlug: o,
|
|
948
|
+
// SessionManager will generate storageKey internally
|
|
949
|
+
onRefreshFailed: i.onRefreshFailed,
|
|
950
|
+
baseUrl: r
|
|
951
|
+
}), [o, r, i.onRefreshFailed]), P = Q(() => {
|
|
952
|
+
const g = new re(r);
|
|
953
|
+
return g.setSessionManager(u), g;
|
|
954
|
+
}, [r, u]), C = Q(() => new Ne(new re(r)), [r]), H = Q(() => new Be(P, u), [P, u]), W = Q(() => new Se(new re(r)), [r]), F = Q(() => b || u.getUser(), [b, u]), V = Q(() => F != null && F.roleId && I.find((g) => g.id === F.roleId) || null, [F, I]), w = Q(() => (V == null ? void 0 : V.permissions) || [], [V]), M = Q(() => u.hasValidSession() && b !== null, [u, b]), E = 5 * 60 * 1e3, a = Q(() => {
|
|
955
|
+
const g = async ($ = !1) => {
|
|
809
956
|
try {
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
957
|
+
if (!u.hasValidSession())
|
|
958
|
+
return;
|
|
959
|
+
const U = Date.now();
|
|
960
|
+
if (!$ && U - q < E && b)
|
|
961
|
+
return;
|
|
962
|
+
const j = u.getUserId();
|
|
963
|
+
if (!j) {
|
|
964
|
+
console.warn("[AuthProvider] No userId available in token or storage");
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
S(!0), R(null);
|
|
968
|
+
const X = await H.getUserById(j);
|
|
969
|
+
f(X), u.setUser(X), k(Date.now());
|
|
970
|
+
} catch (U) {
|
|
971
|
+
const K = U instanceof Error ? U : new Error("Failed to load user data");
|
|
972
|
+
R(K), console.error("[AuthProvider] Failed to load user data:", K);
|
|
819
973
|
} finally {
|
|
820
|
-
|
|
974
|
+
S(!1);
|
|
821
975
|
}
|
|
822
|
-
},
|
|
823
|
-
await
|
|
824
|
-
},
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
976
|
+
}, m = async () => {
|
|
977
|
+
await g();
|
|
978
|
+
}, c = async ($) => {
|
|
979
|
+
const { username: U, password: K, tenantSlug: j } = $;
|
|
980
|
+
let X = s == null ? void 0 : s.id, Y = o, Z = u;
|
|
981
|
+
j && (X = (await new ce(P, t).getPublicTenantInfo(j)).id, Y = j);
|
|
982
|
+
const J = await C.login({
|
|
983
|
+
username: U,
|
|
984
|
+
password: K,
|
|
985
|
+
appId: t,
|
|
829
986
|
tenantId: X
|
|
830
|
-
});
|
|
831
|
-
if (
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
987
|
+
}), ae = j && j !== o;
|
|
988
|
+
if (ae && (Z = new ye({
|
|
989
|
+
tenantSlug: Y,
|
|
990
|
+
baseUrl: r
|
|
991
|
+
})), Z.setTokens({
|
|
992
|
+
accessToken: J.accessToken,
|
|
993
|
+
refreshToken: J.refreshToken,
|
|
994
|
+
expiresIn: J.expiresIn
|
|
995
|
+
}), J.user) {
|
|
996
|
+
Z.setUser(J.user), f(J.user);
|
|
837
997
|
try {
|
|
838
|
-
await
|
|
839
|
-
} catch (
|
|
840
|
-
console.warn("Failed to load complete user data after login:",
|
|
998
|
+
await g();
|
|
999
|
+
} catch (le) {
|
|
1000
|
+
console.warn("Failed to load complete user data after login:", le);
|
|
841
1001
|
}
|
|
842
1002
|
}
|
|
843
|
-
return
|
|
844
|
-
},
|
|
845
|
-
|
|
1003
|
+
return ae && Y && Y !== o && p(Y), J;
|
|
1004
|
+
}, d = async ($) => {
|
|
1005
|
+
const { email: U, phoneNumber: K, name: j, password: X, lastName: Y, tenantId: Z } = $;
|
|
1006
|
+
if (!U && !K)
|
|
846
1007
|
throw new Error("Either email or phoneNumber is required");
|
|
847
|
-
if (!
|
|
1008
|
+
if (!j || !X)
|
|
848
1009
|
throw new Error("Name and password are required");
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
1010
|
+
const J = Z ?? (s == null ? void 0 : s.id);
|
|
1011
|
+
return await C.signup({
|
|
1012
|
+
email: U,
|
|
1013
|
+
phoneNumber: K,
|
|
1014
|
+
name: j,
|
|
853
1015
|
password: X,
|
|
854
|
-
tenantId:
|
|
855
|
-
lastName:
|
|
856
|
-
appId:
|
|
1016
|
+
tenantId: J,
|
|
1017
|
+
lastName: Y,
|
|
1018
|
+
appId: t
|
|
857
1019
|
});
|
|
858
|
-
},
|
|
859
|
-
|
|
1020
|
+
}, y = async ($) => {
|
|
1021
|
+
const { email: U, phoneNumber: K, name: j, password: X, tenantName: Y, lastName: Z } = $;
|
|
1022
|
+
if (!U && !K)
|
|
860
1023
|
throw new Error("Either email or phoneNumber is required");
|
|
861
|
-
if (!
|
|
1024
|
+
if (!j || !X || !Y)
|
|
862
1025
|
throw new Error("Name, password, and tenantName are required");
|
|
863
|
-
return await
|
|
864
|
-
email:
|
|
865
|
-
phoneNumber:
|
|
866
|
-
name:
|
|
1026
|
+
return await C.signupTenantAdmin({
|
|
1027
|
+
email: U,
|
|
1028
|
+
phoneNumber: K,
|
|
1029
|
+
name: j,
|
|
867
1030
|
password: X,
|
|
868
|
-
tenantName:
|
|
869
|
-
appId:
|
|
870
|
-
lastName:
|
|
1031
|
+
tenantName: Y,
|
|
1032
|
+
appId: t,
|
|
1033
|
+
lastName: Z
|
|
871
1034
|
});
|
|
872
|
-
}, G = async (
|
|
873
|
-
const
|
|
874
|
-
await
|
|
875
|
-
},
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
lastName:
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1035
|
+
}, G = async ($) => {
|
|
1036
|
+
const { currentPassword: U, newPassword: K } = $, j = await u.getAuthHeaders();
|
|
1037
|
+
await C.changePassword({ currentPassword: U, newPassword: K }, j);
|
|
1038
|
+
}, ee = async ($) => {
|
|
1039
|
+
const { email: U, tenantId: K } = $, j = K ?? (s == null ? void 0 : s.id);
|
|
1040
|
+
if (!j)
|
|
1041
|
+
throw new Error("tenantId is required for password reset");
|
|
1042
|
+
await C.requestPasswordReset({ email: U, tenantId: j });
|
|
1043
|
+
}, z = async ($) => {
|
|
1044
|
+
const { token: U, newPassword: K } = $;
|
|
1045
|
+
await C.confirmPasswordReset({ token: U, newPassword: K });
|
|
1046
|
+
}, B = async ($) => {
|
|
1047
|
+
const { email: U, frontendUrl: K, name: j, lastName: X, tenantId: Y } = $, Z = Y ?? (s == null ? void 0 : s.id);
|
|
1048
|
+
if (!Z)
|
|
1049
|
+
throw new Error("tenantId is required for magic link authentication");
|
|
1050
|
+
return await C.sendMagicLink({
|
|
1051
|
+
email: U,
|
|
1052
|
+
tenantId: Z,
|
|
1053
|
+
frontendUrl: K,
|
|
1054
|
+
name: j,
|
|
1055
|
+
lastName: X,
|
|
1056
|
+
appId: t
|
|
892
1057
|
});
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
1058
|
+
}, O = async ($) => {
|
|
1059
|
+
const { token: U, email: K, tenantSlug: j } = $;
|
|
1060
|
+
let X = s == null ? void 0 : s.id, Y = o, Z = u;
|
|
1061
|
+
j && (X = (await new ce(P, t).getPublicTenantInfo(j)).id, Y = j);
|
|
1062
|
+
const J = await C.verifyMagicLink({
|
|
1063
|
+
token: U,
|
|
1064
|
+
email: K,
|
|
1065
|
+
appId: t,
|
|
1066
|
+
tenantId: X
|
|
1067
|
+
}), ae = j && j !== o;
|
|
1068
|
+
if (ae && (Z = new ye({
|
|
1069
|
+
tenantSlug: Y,
|
|
1070
|
+
baseUrl: r
|
|
1071
|
+
})), Z.setTokens({
|
|
1072
|
+
accessToken: J.accessToken,
|
|
1073
|
+
refreshToken: J.refreshToken,
|
|
1074
|
+
expiresIn: J.expiresIn
|
|
1075
|
+
}), J.user) {
|
|
1076
|
+
Z.setUser(J.user), f(J.user);
|
|
899
1077
|
try {
|
|
900
|
-
await
|
|
901
|
-
} catch (
|
|
902
|
-
console.warn("Failed to load complete user data after magic link login:",
|
|
1078
|
+
await g();
|
|
1079
|
+
} catch (le) {
|
|
1080
|
+
console.warn("Failed to load complete user data after magic link login:", le);
|
|
903
1081
|
}
|
|
904
1082
|
}
|
|
905
|
-
return
|
|
906
|
-
},
|
|
907
|
-
const
|
|
908
|
-
if (!(
|
|
1083
|
+
return ae && Y && Y !== o && p(Y), J;
|
|
1084
|
+
}, D = async () => {
|
|
1085
|
+
const $ = u.getTokens();
|
|
1086
|
+
if (!($ != null && $.refreshToken))
|
|
909
1087
|
throw new Error("No refresh token available");
|
|
910
|
-
const
|
|
911
|
-
refreshToken:
|
|
1088
|
+
const U = await C.refreshToken({
|
|
1089
|
+
refreshToken: $.refreshToken
|
|
912
1090
|
});
|
|
913
|
-
|
|
914
|
-
accessToken:
|
|
915
|
-
refreshToken:
|
|
916
|
-
expiresIn:
|
|
1091
|
+
u.setTokens({
|
|
1092
|
+
accessToken: U.accessToken,
|
|
1093
|
+
refreshToken: U.refreshToken || $.refreshToken,
|
|
1094
|
+
expiresIn: U.expiresIn
|
|
917
1095
|
});
|
|
918
|
-
},
|
|
919
|
-
|
|
920
|
-
},
|
|
921
|
-
|
|
922
|
-
},
|
|
923
|
-
|
|
924
|
-
},
|
|
1096
|
+
}, _ = () => {
|
|
1097
|
+
u.clearSession(), f(null), R(null);
|
|
1098
|
+
}, ge = ($) => {
|
|
1099
|
+
u.setTokens($);
|
|
1100
|
+
}, Ce = () => u.hasValidSession(), Re = () => {
|
|
1101
|
+
u.clearSession(), f(null), R(null);
|
|
1102
|
+
}, Le = async () => {
|
|
925
1103
|
if (t)
|
|
926
1104
|
try {
|
|
927
|
-
|
|
928
|
-
const { roles:
|
|
929
|
-
|
|
930
|
-
} catch (
|
|
931
|
-
console.error("Failed to fetch roles:",
|
|
1105
|
+
T(!0);
|
|
1106
|
+
const { roles: $ } = await W.getRolesByApp(t);
|
|
1107
|
+
A($);
|
|
1108
|
+
} catch ($) {
|
|
1109
|
+
console.error("Failed to fetch roles:", $);
|
|
932
1110
|
} finally {
|
|
933
|
-
|
|
1111
|
+
T(!1);
|
|
934
1112
|
}
|
|
935
|
-
},
|
|
936
|
-
await
|
|
937
|
-
},
|
|
938
|
-
if (!
|
|
1113
|
+
}, Fe = async () => {
|
|
1114
|
+
await Le();
|
|
1115
|
+
}, me = ($) => {
|
|
1116
|
+
if (!w || w.length === 0)
|
|
939
1117
|
return !1;
|
|
940
|
-
if (typeof
|
|
941
|
-
return
|
|
942
|
-
const
|
|
943
|
-
return
|
|
1118
|
+
if (typeof $ == "string")
|
|
1119
|
+
return w.includes($);
|
|
1120
|
+
const U = `${$.resource}.${$.action}`;
|
|
1121
|
+
return w.includes(U);
|
|
944
1122
|
};
|
|
945
1123
|
return {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1124
|
+
// RFC-003: Authentication state
|
|
1125
|
+
isAuthenticated: M,
|
|
1126
|
+
sessionManager: u,
|
|
1127
|
+
authenticatedHttpService: P,
|
|
1128
|
+
login: c,
|
|
1129
|
+
signup: d,
|
|
1130
|
+
signupTenantAdmin: y,
|
|
1131
|
+
sendMagicLink: B,
|
|
1132
|
+
verifyMagicLink: O,
|
|
953
1133
|
changePassword: G,
|
|
954
|
-
requestPasswordReset:
|
|
955
|
-
confirmPasswordReset:
|
|
956
|
-
refreshToken:
|
|
957
|
-
logout:
|
|
958
|
-
setTokens:
|
|
959
|
-
hasValidSession:
|
|
960
|
-
clearSession:
|
|
961
|
-
currentUser:
|
|
962
|
-
isUserLoading:
|
|
963
|
-
userError:
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1134
|
+
requestPasswordReset: ee,
|
|
1135
|
+
confirmPasswordReset: z,
|
|
1136
|
+
refreshToken: D,
|
|
1137
|
+
logout: _,
|
|
1138
|
+
setTokens: ge,
|
|
1139
|
+
hasValidSession: Ce,
|
|
1140
|
+
clearSession: Re,
|
|
1141
|
+
currentUser: b,
|
|
1142
|
+
isUserLoading: h,
|
|
1143
|
+
userError: L,
|
|
1144
|
+
loadUserData: g,
|
|
1145
|
+
refreshUser: m,
|
|
1146
|
+
userRole: V,
|
|
1147
|
+
userPermissions: w,
|
|
1148
|
+
availableRoles: I,
|
|
1149
|
+
rolesLoading: x,
|
|
1150
|
+
hasPermission: me,
|
|
1151
|
+
hasAnyPermission: ($) => $.some((U) => me(U)),
|
|
1152
|
+
hasAllPermissions: ($) => $.every((U) => me(U)),
|
|
1153
|
+
getUserPermissionStrings: () => w || [],
|
|
1154
|
+
refreshRoles: Fe
|
|
974
1155
|
};
|
|
975
1156
|
}, [
|
|
976
|
-
|
|
977
|
-
U,
|
|
1157
|
+
M,
|
|
978
1158
|
u,
|
|
979
|
-
|
|
980
|
-
|
|
1159
|
+
P,
|
|
1160
|
+
C,
|
|
1161
|
+
H,
|
|
1162
|
+
W,
|
|
981
1163
|
t,
|
|
1164
|
+
s,
|
|
1165
|
+
o,
|
|
1166
|
+
p,
|
|
1167
|
+
I,
|
|
982
1168
|
b,
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1169
|
+
h,
|
|
1170
|
+
L,
|
|
1171
|
+
V,
|
|
1172
|
+
w,
|
|
1173
|
+
q,
|
|
1174
|
+
E
|
|
988
1175
|
]);
|
|
989
|
-
return
|
|
1176
|
+
return te(() => {
|
|
990
1177
|
!i.initialRoles && t && (async () => {
|
|
991
1178
|
try {
|
|
992
|
-
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
} catch (
|
|
996
|
-
console.error("Failed to fetch roles:",
|
|
1179
|
+
T(!0);
|
|
1180
|
+
const m = new re(r), c = new Se(m), { roles: d } = await c.getRolesByApp(t);
|
|
1181
|
+
A(d);
|
|
1182
|
+
} catch (m) {
|
|
1183
|
+
console.error("Failed to fetch roles:", m);
|
|
997
1184
|
} finally {
|
|
998
|
-
|
|
1185
|
+
T(!1);
|
|
999
1186
|
}
|
|
1000
1187
|
})();
|
|
1001
|
-
}, [t, r, i.initialRoles]),
|
|
1002
|
-
const
|
|
1003
|
-
|
|
1004
|
-
}, [
|
|
1188
|
+
}, [t, r, i.initialRoles]), te(() => {
|
|
1189
|
+
const g = u.getUser();
|
|
1190
|
+
g && u.hasValidSession() && f(g);
|
|
1191
|
+
}, [u]), te(() => {
|
|
1192
|
+
!b && !h && a.loadUserData().catch(() => {
|
|
1193
|
+
});
|
|
1194
|
+
}, [b, h, a]), te(() => {
|
|
1195
|
+
if (!u.hasValidSession() || !b)
|
|
1196
|
+
return;
|
|
1197
|
+
const g = setInterval(() => {
|
|
1198
|
+
a.loadUserData().catch(() => {
|
|
1199
|
+
});
|
|
1200
|
+
}, E);
|
|
1201
|
+
return () => clearInterval(g);
|
|
1202
|
+
}, [u, b, a, E]), /* @__PURE__ */ n(Pe.Provider, { value: a, children: e });
|
|
1005
1203
|
}
|
|
1006
|
-
function
|
|
1007
|
-
const i =
|
|
1204
|
+
function oe() {
|
|
1205
|
+
const i = ue(Pe);
|
|
1008
1206
|
if (!i)
|
|
1009
1207
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
1010
1208
|
return i;
|
|
1011
1209
|
}
|
|
1012
|
-
class
|
|
1210
|
+
class ze {
|
|
1013
1211
|
constructor(e, t) {
|
|
1014
1212
|
this.httpService = e, this.sessionManager = t;
|
|
1015
1213
|
}
|
|
@@ -1030,12 +1228,12 @@ class He {
|
|
|
1030
1228
|
throw new Error("SessionManager is required for private endpoints");
|
|
1031
1229
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
1032
1230
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
|
|
1033
|
-
const s = `/feature-flags/${r.toString() ? `?${r.toString()}` : ""}`,
|
|
1231
|
+
const s = `/feature-flags/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(s, {
|
|
1034
1232
|
headers: t
|
|
1035
1233
|
});
|
|
1036
1234
|
return {
|
|
1037
|
-
featureFlags:
|
|
1038
|
-
meta:
|
|
1235
|
+
featureFlags: o.data,
|
|
1236
|
+
meta: o.meta
|
|
1039
1237
|
};
|
|
1040
1238
|
}
|
|
1041
1239
|
async getFeatureFlagById(e) {
|
|
@@ -1083,64 +1281,64 @@ class He {
|
|
|
1083
1281
|
throw new Error("Flag Key, Tenant ID and App ID are required");
|
|
1084
1282
|
const s = new URLSearchParams();
|
|
1085
1283
|
s.append("tenantId", t), s.append("appId", r);
|
|
1086
|
-
const
|
|
1087
|
-
return (await this.httpService.get(
|
|
1284
|
+
const o = `/tenant-feature-flags/${e}${s.toString() ? `?${s.toString()}` : ""}`;
|
|
1285
|
+
return (await this.httpService.get(o, {
|
|
1088
1286
|
headers: { "X-Tenant-ID": t }
|
|
1089
1287
|
})).data;
|
|
1090
1288
|
}
|
|
1091
1289
|
}
|
|
1092
|
-
const
|
|
1093
|
-
function
|
|
1094
|
-
const { baseUrl: t, appId: r } =
|
|
1095
|
-
const
|
|
1096
|
-
return new
|
|
1097
|
-
}, [t]),
|
|
1290
|
+
const Me = de(null);
|
|
1291
|
+
function Pt({ config: i = {}, children: e }) {
|
|
1292
|
+
const { baseUrl: t, appId: r } = he(), { tenant: s } = se(), [o, p] = v([]), [I, A] = v(!1), [x, T] = v(null), b = Q(() => {
|
|
1293
|
+
const S = new re(t);
|
|
1294
|
+
return new ze(S);
|
|
1295
|
+
}, [t]), f = async () => {
|
|
1098
1296
|
if (!(s != null && s.id)) {
|
|
1099
|
-
|
|
1297
|
+
p([]);
|
|
1100
1298
|
return;
|
|
1101
1299
|
}
|
|
1102
|
-
|
|
1300
|
+
A(!0), T(null);
|
|
1103
1301
|
try {
|
|
1104
|
-
const
|
|
1105
|
-
|
|
1106
|
-
} catch (
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1302
|
+
const S = await b.getTenantFeatureFlags(s.id, r);
|
|
1303
|
+
p(S);
|
|
1304
|
+
} catch (S) {
|
|
1305
|
+
const L = S instanceof Error ? S.message : "Failed to fetch feature flags";
|
|
1306
|
+
T(L), i.onError && i.onError(S instanceof Error ? S : new Error(L));
|
|
1109
1307
|
} finally {
|
|
1110
|
-
|
|
1308
|
+
A(!1);
|
|
1111
1309
|
}
|
|
1112
1310
|
};
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
const
|
|
1116
|
-
return () => clearInterval(
|
|
1311
|
+
te(() => {
|
|
1312
|
+
f();
|
|
1313
|
+
const S = i.refreshInterval || 5 * 60 * 1e3, L = setInterval(f, S);
|
|
1314
|
+
return () => clearInterval(L);
|
|
1117
1315
|
}, [s == null ? void 0 : s.id, i.refreshInterval]);
|
|
1118
|
-
const
|
|
1119
|
-
featureFlags:
|
|
1120
|
-
loading:
|
|
1121
|
-
error:
|
|
1122
|
-
isEnabled: (
|
|
1123
|
-
const
|
|
1124
|
-
return (
|
|
1316
|
+
const h = Q(() => ({
|
|
1317
|
+
featureFlags: o,
|
|
1318
|
+
loading: I,
|
|
1319
|
+
error: x,
|
|
1320
|
+
isEnabled: (k) => {
|
|
1321
|
+
const u = o.find((P) => P.key === k);
|
|
1322
|
+
return (u == null ? void 0 : u.value) === !0;
|
|
1125
1323
|
},
|
|
1126
|
-
getFlag: (
|
|
1127
|
-
getFlagState: (
|
|
1128
|
-
const
|
|
1129
|
-
return
|
|
1324
|
+
getFlag: (k) => o.find((u) => u.key === k),
|
|
1325
|
+
getFlagState: (k) => {
|
|
1326
|
+
const u = o.find((P) => P.key === k);
|
|
1327
|
+
return u ? u.value ? "enabled" : "disabled" : "not_found";
|
|
1130
1328
|
},
|
|
1131
1329
|
refresh: async () => {
|
|
1132
|
-
await
|
|
1330
|
+
await f();
|
|
1133
1331
|
}
|
|
1134
|
-
}), [
|
|
1135
|
-
return /* @__PURE__ */ n(
|
|
1332
|
+
}), [o, I, x]);
|
|
1333
|
+
return /* @__PURE__ */ n(Me.Provider, { value: h, children: e });
|
|
1136
1334
|
}
|
|
1137
|
-
function
|
|
1138
|
-
const i =
|
|
1335
|
+
function Oe() {
|
|
1336
|
+
const i = ue(Me);
|
|
1139
1337
|
if (!i)
|
|
1140
1338
|
throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
|
|
1141
1339
|
return i;
|
|
1142
1340
|
}
|
|
1143
|
-
class
|
|
1341
|
+
class je {
|
|
1144
1342
|
constructor(e, t) {
|
|
1145
1343
|
this.httpService = e, this.sessionManager = t;
|
|
1146
1344
|
}
|
|
@@ -1206,64 +1404,64 @@ class De {
|
|
|
1206
1404
|
)).data;
|
|
1207
1405
|
}
|
|
1208
1406
|
}
|
|
1209
|
-
const
|
|
1210
|
-
function
|
|
1211
|
-
const { baseUrl: t } =
|
|
1212
|
-
const
|
|
1213
|
-
return new
|
|
1214
|
-
}, [t]),
|
|
1407
|
+
const Ie = de(void 0);
|
|
1408
|
+
function Mt({ config: i = {}, children: e }) {
|
|
1409
|
+
const { baseUrl: t } = he(), { tenant: r } = se(), [s, o] = v(null), [p, I] = v(!1), [A, x] = v(null), T = Q(() => {
|
|
1410
|
+
const h = new re(t);
|
|
1411
|
+
return new je(h);
|
|
1412
|
+
}, [t]), b = async () => {
|
|
1215
1413
|
if (!(r != null && r.id)) {
|
|
1216
|
-
|
|
1414
|
+
o(null);
|
|
1217
1415
|
return;
|
|
1218
1416
|
}
|
|
1219
|
-
|
|
1417
|
+
I(!0), x(null);
|
|
1220
1418
|
try {
|
|
1221
|
-
const
|
|
1222
|
-
|
|
1223
|
-
} catch (
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1419
|
+
const h = await T.getTenantSubscriptionFeatures(r.id);
|
|
1420
|
+
o(h);
|
|
1421
|
+
} catch (h) {
|
|
1422
|
+
const S = h instanceof Error ? h.message : "Failed to fetch subscription";
|
|
1423
|
+
x(S), i.onError && i.onError(h instanceof Error ? h : new Error(S));
|
|
1226
1424
|
} finally {
|
|
1227
|
-
|
|
1425
|
+
I(!1);
|
|
1228
1426
|
}
|
|
1229
1427
|
};
|
|
1230
|
-
|
|
1231
|
-
if (
|
|
1232
|
-
const
|
|
1233
|
-
return () => clearInterval(
|
|
1428
|
+
te(() => {
|
|
1429
|
+
if (b(), !i.refreshInterval) return;
|
|
1430
|
+
const h = i.refreshInterval || 10 * 60 * 1e3, S = setInterval(b, h);
|
|
1431
|
+
return () => clearInterval(S);
|
|
1234
1432
|
}, [r == null ? void 0 : r.id, i.refreshInterval]);
|
|
1235
|
-
const
|
|
1236
|
-
const
|
|
1433
|
+
const f = Q(() => {
|
|
1434
|
+
const h = (s == null ? void 0 : s.features) || [];
|
|
1237
1435
|
return {
|
|
1238
1436
|
subscription: s,
|
|
1239
|
-
features:
|
|
1240
|
-
loading:
|
|
1241
|
-
error:
|
|
1242
|
-
isFeatureEnabled: (
|
|
1243
|
-
const
|
|
1244
|
-
return
|
|
1437
|
+
features: h,
|
|
1438
|
+
loading: p,
|
|
1439
|
+
error: A,
|
|
1440
|
+
isFeatureEnabled: (u) => {
|
|
1441
|
+
const P = h.find((C) => C.key === u);
|
|
1442
|
+
return P ? P.type === "BOOLEAN" || P.type === "boolean" ? P.value === !0 : !!P.value : !1;
|
|
1245
1443
|
},
|
|
1246
|
-
getFeature: (
|
|
1247
|
-
getFeatureValue: (
|
|
1248
|
-
const
|
|
1249
|
-
return
|
|
1444
|
+
getFeature: (u) => h.find((P) => P.key === u),
|
|
1445
|
+
getFeatureValue: (u, P) => {
|
|
1446
|
+
const C = h.find((H) => H.key === u);
|
|
1447
|
+
return C ? C.value : P;
|
|
1250
1448
|
},
|
|
1251
|
-
hasAllowedPlan: (
|
|
1449
|
+
hasAllowedPlan: (u) => !s || !s.isActive ? !1 : u.includes(s.planId),
|
|
1252
1450
|
refresh: async () => {
|
|
1253
|
-
await
|
|
1451
|
+
await b();
|
|
1254
1452
|
}
|
|
1255
1453
|
};
|
|
1256
|
-
}, [s,
|
|
1257
|
-
return /* @__PURE__ */ n(
|
|
1454
|
+
}, [s, p, A]);
|
|
1455
|
+
return /* @__PURE__ */ n(Ie.Provider, { value: f, children: e });
|
|
1258
1456
|
}
|
|
1259
|
-
function
|
|
1260
|
-
const i =
|
|
1457
|
+
function Ve() {
|
|
1458
|
+
const i = ue(Ie);
|
|
1261
1459
|
if (i === void 0)
|
|
1262
1460
|
throw new Error("useSubscription must be used within a SubscriptionProvider");
|
|
1263
1461
|
return i;
|
|
1264
1462
|
}
|
|
1265
|
-
var
|
|
1266
|
-
const
|
|
1463
|
+
var ie = /* @__PURE__ */ ((i) => (i.SUPERUSER = "SUPERUSER", i.TENANT_ADMIN = "TENANT_ADMIN", i.USER = "USER", i))(ie || {});
|
|
1464
|
+
const ve = () => /* @__PURE__ */ l(
|
|
1267
1465
|
"div",
|
|
1268
1466
|
{
|
|
1269
1467
|
style: {
|
|
@@ -1300,7 +1498,7 @@ const me = () => /* @__PURE__ */ l(
|
|
|
1300
1498
|
)
|
|
1301
1499
|
]
|
|
1302
1500
|
}
|
|
1303
|
-
),
|
|
1501
|
+
), xe = ({
|
|
1304
1502
|
userType: i,
|
|
1305
1503
|
minUserType: e,
|
|
1306
1504
|
missingPermissions: t
|
|
@@ -1322,7 +1520,7 @@ const me = () => /* @__PURE__ */ l(
|
|
|
1322
1520
|
children: [
|
|
1323
1521
|
/* @__PURE__ */ n("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "⚠️" }),
|
|
1324
1522
|
/* @__PURE__ */ n("h3", { style: { color: "#856404", marginBottom: "10px" }, children: "Insufficient Permissions" }),
|
|
1325
|
-
e && i ? /* @__PURE__ */ l(
|
|
1523
|
+
e && i ? /* @__PURE__ */ l(N, { children: [
|
|
1326
1524
|
/* @__PURE__ */ l("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: [
|
|
1327
1525
|
"This content requires ",
|
|
1328
1526
|
/* @__PURE__ */ n("strong", { children: e }),
|
|
@@ -1332,7 +1530,7 @@ const me = () => /* @__PURE__ */ l(
|
|
|
1332
1530
|
"Your current access level: ",
|
|
1333
1531
|
/* @__PURE__ */ n("strong", { children: i })
|
|
1334
1532
|
] })
|
|
1335
|
-
] }) : /* @__PURE__ */ l(
|
|
1533
|
+
] }) : /* @__PURE__ */ l(N, { children: [
|
|
1336
1534
|
/* @__PURE__ */ n("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: "You don't have the required permissions to view this content." }),
|
|
1337
1535
|
t && t.length > 0 && /* @__PURE__ */ l("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1338
1536
|
"Required permissions: ",
|
|
@@ -1341,36 +1539,36 @@ const me = () => /* @__PURE__ */ l(
|
|
|
1341
1539
|
] })
|
|
1342
1540
|
]
|
|
1343
1541
|
}
|
|
1344
|
-
),
|
|
1542
|
+
), We = (i, e) => {
|
|
1345
1543
|
const t = {
|
|
1346
|
-
[
|
|
1347
|
-
[
|
|
1348
|
-
[
|
|
1544
|
+
[ie.USER]: 1,
|
|
1545
|
+
[ie.TENANT_ADMIN]: 2,
|
|
1546
|
+
[ie.SUPERUSER]: 3
|
|
1349
1547
|
};
|
|
1350
1548
|
return t[i] >= t[e];
|
|
1351
1549
|
};
|
|
1352
|
-
function
|
|
1550
|
+
function It({
|
|
1353
1551
|
children: i,
|
|
1354
1552
|
fallback: e,
|
|
1355
1553
|
minUserType: t,
|
|
1356
1554
|
requiredPermissions: r,
|
|
1357
1555
|
requireAllPermissions: s = !1
|
|
1358
1556
|
}) {
|
|
1359
|
-
const { hasValidSession:
|
|
1360
|
-
if (!
|
|
1361
|
-
return /* @__PURE__ */ n(
|
|
1362
|
-
const
|
|
1363
|
-
if (!
|
|
1364
|
-
return /* @__PURE__ */ n(
|
|
1365
|
-
if (t && !
|
|
1366
|
-
return /* @__PURE__ */ n(
|
|
1367
|
-
if (r && r.length > 0 && !(s ?
|
|
1368
|
-
const
|
|
1369
|
-
return /* @__PURE__ */ n(
|
|
1370
|
-
}
|
|
1371
|
-
return /* @__PURE__ */ n(
|
|
1557
|
+
const { hasValidSession: o, sessionManager: p, hasPermission: I, hasAnyPermission: A, hasAllPermissions: x } = oe();
|
|
1558
|
+
if (!o())
|
|
1559
|
+
return /* @__PURE__ */ n(N, { children: e || /* @__PURE__ */ n(ve, {}) });
|
|
1560
|
+
const T = p.getUser();
|
|
1561
|
+
if (!T)
|
|
1562
|
+
return /* @__PURE__ */ n(N, { children: e || /* @__PURE__ */ n(ve, {}) });
|
|
1563
|
+
if (t && !We(T.userType, t))
|
|
1564
|
+
return /* @__PURE__ */ n(xe, { userType: T.userType, minUserType: t });
|
|
1565
|
+
if (r && r.length > 0 && !(s ? x(r) : A(r))) {
|
|
1566
|
+
const f = r.filter((h) => !I(h)).map((h) => typeof h == "string" ? h : h.name);
|
|
1567
|
+
return /* @__PURE__ */ n(xe, { missingPermissions: f });
|
|
1568
|
+
}
|
|
1569
|
+
return /* @__PURE__ */ n(N, { children: i });
|
|
1372
1570
|
}
|
|
1373
|
-
const
|
|
1571
|
+
const Ge = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1374
1572
|
"div",
|
|
1375
1573
|
{
|
|
1376
1574
|
style: {
|
|
@@ -1406,7 +1604,7 @@ const qe = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1406
1604
|
}
|
|
1407
1605
|
)
|
|
1408
1606
|
}
|
|
1409
|
-
),
|
|
1607
|
+
), ke = ({
|
|
1410
1608
|
userType: i,
|
|
1411
1609
|
minUserType: e,
|
|
1412
1610
|
missingPermissions: t
|
|
@@ -1436,7 +1634,7 @@ const qe = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1436
1634
|
children: [
|
|
1437
1635
|
/* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "⚠️" }),
|
|
1438
1636
|
/* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Insufficient Permissions" }),
|
|
1439
|
-
e && i ? /* @__PURE__ */ l(
|
|
1637
|
+
e && i ? /* @__PURE__ */ l(N, { children: [
|
|
1440
1638
|
/* @__PURE__ */ l("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: [
|
|
1441
1639
|
"This page requires ",
|
|
1442
1640
|
/* @__PURE__ */ n("strong", { children: e }),
|
|
@@ -1446,7 +1644,7 @@ const qe = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1446
1644
|
"Your current access level: ",
|
|
1447
1645
|
/* @__PURE__ */ n("strong", { children: i })
|
|
1448
1646
|
] })
|
|
1449
|
-
] }) : /* @__PURE__ */ l(
|
|
1647
|
+
] }) : /* @__PURE__ */ l(N, { children: [
|
|
1450
1648
|
/* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: "You don't have the required permissions to access this page." }),
|
|
1451
1649
|
t && t.length > 0 && /* @__PURE__ */ l("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1452
1650
|
"Required permissions: ",
|
|
@@ -1457,40 +1655,40 @@ const qe = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1457
1655
|
}
|
|
1458
1656
|
)
|
|
1459
1657
|
}
|
|
1460
|
-
),
|
|
1658
|
+
), Ke = (i, e) => {
|
|
1461
1659
|
const t = {
|
|
1462
|
-
[
|
|
1463
|
-
[
|
|
1464
|
-
[
|
|
1660
|
+
[ie.USER]: 1,
|
|
1661
|
+
[ie.TENANT_ADMIN]: 2,
|
|
1662
|
+
[ie.SUPERUSER]: 3
|
|
1465
1663
|
};
|
|
1466
1664
|
return t[i] >= t[e];
|
|
1467
1665
|
};
|
|
1468
|
-
function
|
|
1666
|
+
function Et({
|
|
1469
1667
|
children: i,
|
|
1470
1668
|
redirectTo: e = "/login",
|
|
1471
1669
|
minUserType: t,
|
|
1472
1670
|
requiredPermissions: r,
|
|
1473
1671
|
requireAllPermissions: s = !1,
|
|
1474
|
-
fallback:
|
|
1672
|
+
fallback: o
|
|
1475
1673
|
}) {
|
|
1476
|
-
const { hasValidSession:
|
|
1477
|
-
if (!
|
|
1478
|
-
return
|
|
1479
|
-
/* @__PURE__ */ n(
|
|
1480
|
-
/* @__PURE__ */ n(
|
|
1674
|
+
const { hasValidSession: p, sessionManager: I, hasPermission: A, hasAnyPermission: x, hasAllPermissions: T } = oe(), b = we();
|
|
1675
|
+
if (!p())
|
|
1676
|
+
return o ? /* @__PURE__ */ n(N, { children: o }) : /* @__PURE__ */ l(N, { children: [
|
|
1677
|
+
/* @__PURE__ */ n(Ge, { redirectPath: e }),
|
|
1678
|
+
/* @__PURE__ */ n(pe, { to: e, state: { from: b.pathname }, replace: !0 })
|
|
1481
1679
|
] });
|
|
1482
|
-
const
|
|
1483
|
-
if (!
|
|
1484
|
-
return /* @__PURE__ */ n(
|
|
1485
|
-
if (t && !
|
|
1486
|
-
return /* @__PURE__ */ n(
|
|
1487
|
-
if (r && r.length > 0 && !(s ?
|
|
1488
|
-
const
|
|
1489
|
-
return /* @__PURE__ */ n(
|
|
1490
|
-
}
|
|
1491
|
-
return /* @__PURE__ */ n(
|
|
1680
|
+
const f = I.getUser();
|
|
1681
|
+
if (!f)
|
|
1682
|
+
return /* @__PURE__ */ n(pe, { to: e, state: { from: b.pathname }, replace: !0 });
|
|
1683
|
+
if (t && !Ke(f.userType, t))
|
|
1684
|
+
return /* @__PURE__ */ n(ke, { userType: f.userType, minUserType: t });
|
|
1685
|
+
if (r && r.length > 0 && !(s ? T(r) : x(r))) {
|
|
1686
|
+
const S = r.filter((L) => !A(L)).map((L) => typeof L == "string" ? L : L.name);
|
|
1687
|
+
return /* @__PURE__ */ n(ke, { missingPermissions: S });
|
|
1688
|
+
}
|
|
1689
|
+
return /* @__PURE__ */ n(N, { children: i });
|
|
1492
1690
|
}
|
|
1493
|
-
const
|
|
1691
|
+
const _e = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1494
1692
|
"div",
|
|
1495
1693
|
{
|
|
1496
1694
|
style: {
|
|
@@ -1527,14 +1725,14 @@ const ze = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1527
1725
|
)
|
|
1528
1726
|
}
|
|
1529
1727
|
);
|
|
1530
|
-
function
|
|
1531
|
-
const { tenant: r, isLoading: s, error:
|
|
1532
|
-
return s ||
|
|
1533
|
-
/* @__PURE__ */ n(
|
|
1534
|
-
/* @__PURE__ */ n(
|
|
1728
|
+
function Ct({ children: i, redirectTo: e = "/", fallback: t }) {
|
|
1729
|
+
const { tenant: r, isLoading: s, error: o } = se(), p = we();
|
|
1730
|
+
return s || o ? null : r ? /* @__PURE__ */ n(N, { children: i }) : t ? /* @__PURE__ */ n(N, { children: t }) : /* @__PURE__ */ l(N, { children: [
|
|
1731
|
+
/* @__PURE__ */ n(_e, { redirectPath: e }),
|
|
1732
|
+
/* @__PURE__ */ n(pe, { to: e, state: { from: p.pathname }, replace: !0 })
|
|
1535
1733
|
] });
|
|
1536
1734
|
}
|
|
1537
|
-
const
|
|
1735
|
+
const Je = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
1538
1736
|
"div",
|
|
1539
1737
|
{
|
|
1540
1738
|
style: {
|
|
@@ -1571,14 +1769,14 @@ const Oe = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1571
1769
|
)
|
|
1572
1770
|
}
|
|
1573
1771
|
);
|
|
1574
|
-
function
|
|
1575
|
-
const { tenant: r, isLoading: s, error:
|
|
1576
|
-
return s ||
|
|
1577
|
-
/* @__PURE__ */ n(
|
|
1578
|
-
/* @__PURE__ */ n(
|
|
1579
|
-
] }) : /* @__PURE__ */ n(
|
|
1772
|
+
function Rt({ children: i, redirectTo: e = "/dashboard", fallback: t }) {
|
|
1773
|
+
const { tenant: r, isLoading: s, error: o } = se(), p = we();
|
|
1774
|
+
return s || o ? null : r ? t ? /* @__PURE__ */ n(N, { children: t }) : /* @__PURE__ */ l(N, { children: [
|
|
1775
|
+
/* @__PURE__ */ n(Je, { redirectPath: e }),
|
|
1776
|
+
/* @__PURE__ */ n(pe, { to: e, state: { from: p.pathname }, replace: !0 })
|
|
1777
|
+
] }) : /* @__PURE__ */ n(N, { children: i });
|
|
1580
1778
|
}
|
|
1581
|
-
const
|
|
1779
|
+
const Ye = () => /* @__PURE__ */ l(
|
|
1582
1780
|
"div",
|
|
1583
1781
|
{
|
|
1584
1782
|
style: {
|
|
@@ -1595,14 +1793,14 @@ const je = () => /* @__PURE__ */ l(
|
|
|
1595
1793
|
]
|
|
1596
1794
|
}
|
|
1597
1795
|
);
|
|
1598
|
-
function
|
|
1796
|
+
function Lt({
|
|
1599
1797
|
children: i,
|
|
1600
|
-
fallback: e = /* @__PURE__ */ n(
|
|
1798
|
+
fallback: e = /* @__PURE__ */ n(Ye, {}),
|
|
1601
1799
|
allowedPlans: t,
|
|
1602
1800
|
requiredFeature: r
|
|
1603
1801
|
}) {
|
|
1604
|
-
const { subscription: s, hasAllowedPlan:
|
|
1605
|
-
return
|
|
1802
|
+
const { subscription: s, hasAllowedPlan: o, isFeatureEnabled: p, loading: I } = Ve();
|
|
1803
|
+
return I ? /* @__PURE__ */ n(
|
|
1606
1804
|
"div",
|
|
1607
1805
|
{
|
|
1608
1806
|
style: {
|
|
@@ -1612,9 +1810,9 @@ function At({
|
|
|
1612
1810
|
},
|
|
1613
1811
|
children: "Loading subscription..."
|
|
1614
1812
|
}
|
|
1615
|
-
) : s ? s.isActive ? t && t.length > 0 && !
|
|
1813
|
+
) : s ? s.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ n(N, { children: e }) : r && !p(r) ? /* @__PURE__ */ n(N, { children: e }) : /* @__PURE__ */ n(N, { children: i }) : /* @__PURE__ */ n(N, { children: e }) : /* @__PURE__ */ n(N, { children: e });
|
|
1616
1814
|
}
|
|
1617
|
-
const
|
|
1815
|
+
const Qe = ({ flagName: i }) => /* @__PURE__ */ l(
|
|
1618
1816
|
"div",
|
|
1619
1817
|
{
|
|
1620
1818
|
style: {
|
|
@@ -1641,8 +1839,8 @@ const We = ({ flagName: i }) => /* @__PURE__ */ l(
|
|
|
1641
1839
|
]
|
|
1642
1840
|
}
|
|
1643
1841
|
);
|
|
1644
|
-
function
|
|
1645
|
-
const { isEnabled: r, loading: s } =
|
|
1842
|
+
function Ft({ name: i, children: e, fallback: t }) {
|
|
1843
|
+
const { isEnabled: r, loading: s } = Oe();
|
|
1646
1844
|
return s ? /* @__PURE__ */ n(
|
|
1647
1845
|
"div",
|
|
1648
1846
|
{
|
|
@@ -1656,9 +1854,9 @@ function Pt({ name: i, children: e, fallback: t }) {
|
|
|
1656
1854
|
},
|
|
1657
1855
|
children: "Loading feature flags..."
|
|
1658
1856
|
}
|
|
1659
|
-
) :
|
|
1857
|
+
) : r(i) ? /* @__PURE__ */ n(N, { children: e }) : /* @__PURE__ */ n(N, { children: t || /* @__PURE__ */ n(Qe, { flagName: i }) });
|
|
1660
1858
|
}
|
|
1661
|
-
const
|
|
1859
|
+
const Xe = () => /* @__PURE__ */ l(
|
|
1662
1860
|
"svg",
|
|
1663
1861
|
{
|
|
1664
1862
|
width: "16",
|
|
@@ -1675,7 +1873,7 @@ const Ve = () => /* @__PURE__ */ l(
|
|
|
1675
1873
|
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
|
|
1676
1874
|
]
|
|
1677
1875
|
}
|
|
1678
|
-
),
|
|
1876
|
+
), Ze = () => /* @__PURE__ */ l(
|
|
1679
1877
|
"svg",
|
|
1680
1878
|
{
|
|
1681
1879
|
width: "16",
|
|
@@ -1692,10 +1890,10 @@ const Ve = () => /* @__PURE__ */ l(
|
|
|
1692
1890
|
/* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1693
1891
|
]
|
|
1694
1892
|
}
|
|
1695
|
-
),
|
|
1696
|
-
showPassword: /* @__PURE__ */ n(
|
|
1697
|
-
hidePassword: /* @__PURE__ */ n(
|
|
1698
|
-
},
|
|
1893
|
+
), et = {
|
|
1894
|
+
showPassword: /* @__PURE__ */ n(Xe, {}),
|
|
1895
|
+
hidePassword: /* @__PURE__ */ n(Ze, {})
|
|
1896
|
+
}, tt = {
|
|
1699
1897
|
title: "Sign In",
|
|
1700
1898
|
usernameLabel: "Email or Phone",
|
|
1701
1899
|
usernamePlaceholder: "Enter your email or phone number",
|
|
@@ -1709,7 +1907,7 @@ const Ve = () => /* @__PURE__ */ l(
|
|
|
1709
1907
|
magicLinkLink: "Use Magic Link",
|
|
1710
1908
|
errorMessage: "Invalid credentials",
|
|
1711
1909
|
loadingText: "Signing in..."
|
|
1712
|
-
},
|
|
1910
|
+
}, rt = {
|
|
1713
1911
|
container: {
|
|
1714
1912
|
maxWidth: "400px",
|
|
1715
1913
|
width: "100%",
|
|
@@ -1816,129 +2014,133 @@ const Ve = () => /* @__PURE__ */ l(
|
|
|
1816
2014
|
fontSize: "0.875rem"
|
|
1817
2015
|
}
|
|
1818
2016
|
};
|
|
1819
|
-
function
|
|
2017
|
+
function $t({
|
|
1820
2018
|
copy: i = {},
|
|
1821
2019
|
styles: e = {},
|
|
1822
2020
|
icons: t = {},
|
|
1823
2021
|
onSuccess: r,
|
|
1824
2022
|
onError: s,
|
|
1825
|
-
onForgotPassword:
|
|
1826
|
-
onSignupClick:
|
|
1827
|
-
onMagicLinkClick:
|
|
1828
|
-
showForgotPassword:
|
|
1829
|
-
showSignupLink:
|
|
1830
|
-
showMagicLinkOption:
|
|
1831
|
-
className:
|
|
2023
|
+
onForgotPassword: o,
|
|
2024
|
+
onSignupClick: p,
|
|
2025
|
+
onMagicLinkClick: I,
|
|
2026
|
+
showForgotPassword: A = !0,
|
|
2027
|
+
showSignupLink: x = !0,
|
|
2028
|
+
showMagicLinkOption: T = !0,
|
|
2029
|
+
className: b
|
|
1832
2030
|
}) {
|
|
1833
|
-
const [
|
|
1834
|
-
const
|
|
1835
|
-
return
|
|
1836
|
-
},
|
|
1837
|
-
if (
|
|
1838
|
-
if (!(
|
|
1839
|
-
|
|
2031
|
+
const [f, h] = v(""), [S, L] = v(""), [R, q] = v(!1), [k, u] = v(!1), [P, C] = v(""), [H, W] = v({}), { login: F } = oe(), { tenant: V } = se(), w = { ...tt, ...i }, M = { ...rt, ...e }, E = { ...et, ...t }, a = () => {
|
|
2032
|
+
const d = {};
|
|
2033
|
+
return f.trim() || (d.username = !0), S.trim() || (d.password = !0), W(d), Object.keys(d).length === 0;
|
|
2034
|
+
}, g = async (d) => {
|
|
2035
|
+
if (d.preventDefault(), !!a()) {
|
|
2036
|
+
if (!(V != null && V.id)) {
|
|
2037
|
+
C("Tenant not found");
|
|
1840
2038
|
return;
|
|
1841
2039
|
}
|
|
1842
|
-
|
|
2040
|
+
u(!0), C("");
|
|
1843
2041
|
try {
|
|
1844
|
-
const
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
2042
|
+
const y = await F({
|
|
2043
|
+
username: f,
|
|
2044
|
+
password: S
|
|
2045
|
+
// tenantId inferred from context automatically
|
|
2046
|
+
});
|
|
2047
|
+
r == null || r(y);
|
|
2048
|
+
} catch (y) {
|
|
2049
|
+
const G = y.message || w.errorMessage;
|
|
2050
|
+
C(G), s == null || s(G);
|
|
1849
2051
|
} finally {
|
|
1850
|
-
|
|
2052
|
+
u(!1);
|
|
1851
2053
|
}
|
|
1852
2054
|
}
|
|
1853
|
-
},
|
|
1854
|
-
...
|
|
1855
|
-
...
|
|
1856
|
-
}),
|
|
1857
|
-
...
|
|
1858
|
-
...
|
|
1859
|
-
...!
|
|
2055
|
+
}, m = (d) => ({
|
|
2056
|
+
...M.input,
|
|
2057
|
+
...H[d] ? M.inputError : {}
|
|
2058
|
+
}), c = () => ({
|
|
2059
|
+
...M.button,
|
|
2060
|
+
...k ? M.buttonLoading : {},
|
|
2061
|
+
...!f || !S || k ? M.buttonDisabled : {}
|
|
1860
2062
|
});
|
|
1861
|
-
return /* @__PURE__ */ l("div", { className:
|
|
1862
|
-
/* @__PURE__ */ n("h2", { style:
|
|
1863
|
-
/* @__PURE__ */ l("form", { onSubmit:
|
|
1864
|
-
/* @__PURE__ */ l("div", { style:
|
|
1865
|
-
/* @__PURE__ */ n("label", { style:
|
|
2063
|
+
return /* @__PURE__ */ l("div", { className: b, style: M.container, children: [
|
|
2064
|
+
/* @__PURE__ */ n("h2", { style: M.title, children: w.title }),
|
|
2065
|
+
/* @__PURE__ */ l("form", { onSubmit: g, style: M.form, children: [
|
|
2066
|
+
/* @__PURE__ */ l("div", { style: M.fieldGroup, children: [
|
|
2067
|
+
/* @__PURE__ */ n("label", { style: M.label, children: w.usernameLabel }),
|
|
1866
2068
|
/* @__PURE__ */ n(
|
|
1867
2069
|
"input",
|
|
1868
2070
|
{
|
|
1869
2071
|
id: "username",
|
|
1870
2072
|
name: "username",
|
|
1871
2073
|
type: "text",
|
|
1872
|
-
value:
|
|
1873
|
-
onChange: (
|
|
1874
|
-
|
|
2074
|
+
value: f,
|
|
2075
|
+
onChange: (d) => {
|
|
2076
|
+
h(d.target.value), H.username && W((y) => ({ ...y, username: !1 }));
|
|
1875
2077
|
},
|
|
1876
|
-
placeholder:
|
|
1877
|
-
style:
|
|
1878
|
-
disabled:
|
|
2078
|
+
placeholder: w.usernamePlaceholder,
|
|
2079
|
+
style: m("username"),
|
|
2080
|
+
disabled: k
|
|
1879
2081
|
}
|
|
1880
2082
|
)
|
|
1881
2083
|
] }),
|
|
1882
|
-
/* @__PURE__ */ l("div", { style:
|
|
1883
|
-
/* @__PURE__ */ n("label", { style:
|
|
1884
|
-
/* @__PURE__ */ l("div", { style:
|
|
2084
|
+
/* @__PURE__ */ l("div", { style: M.fieldGroup, children: [
|
|
2085
|
+
/* @__PURE__ */ n("label", { style: M.label, children: w.passwordLabel }),
|
|
2086
|
+
/* @__PURE__ */ l("div", { style: M.inputContainer, children: [
|
|
1885
2087
|
/* @__PURE__ */ n(
|
|
1886
2088
|
"input",
|
|
1887
2089
|
{
|
|
1888
2090
|
id: "password",
|
|
1889
2091
|
name: "password",
|
|
1890
|
-
type:
|
|
1891
|
-
value:
|
|
1892
|
-
onChange: (
|
|
1893
|
-
|
|
2092
|
+
type: R ? "text" : "password",
|
|
2093
|
+
value: S,
|
|
2094
|
+
onChange: (d) => {
|
|
2095
|
+
L(d.target.value), H.password && W((y) => ({ ...y, password: !1 }));
|
|
1894
2096
|
},
|
|
1895
|
-
placeholder:
|
|
2097
|
+
placeholder: w.passwordPlaceholder,
|
|
1896
2098
|
style: {
|
|
1897
|
-
...
|
|
2099
|
+
...m("password"),
|
|
1898
2100
|
paddingRight: "2.5rem"
|
|
1899
2101
|
// Make room for the icon
|
|
1900
2102
|
},
|
|
1901
|
-
disabled:
|
|
2103
|
+
disabled: k
|
|
1902
2104
|
}
|
|
1903
2105
|
),
|
|
1904
2106
|
/* @__PURE__ */ n(
|
|
1905
2107
|
"button",
|
|
1906
2108
|
{
|
|
1907
2109
|
type: "button",
|
|
1908
|
-
onClick: () =>
|
|
1909
|
-
style:
|
|
1910
|
-
disabled:
|
|
1911
|
-
"aria-label":
|
|
1912
|
-
children:
|
|
2110
|
+
onClick: () => q(!R),
|
|
2111
|
+
style: M.passwordToggle,
|
|
2112
|
+
disabled: k,
|
|
2113
|
+
"aria-label": R ? "Hide password" : "Show password",
|
|
2114
|
+
children: R ? E.hidePassword : E.showPassword
|
|
1913
2115
|
}
|
|
1914
2116
|
)
|
|
1915
2117
|
] })
|
|
1916
2118
|
] }),
|
|
1917
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !
|
|
1918
|
-
|
|
2119
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !f || !S || k, style: c(), children: k ? w.loadingText : w.submitButton }),
|
|
2120
|
+
P && /* @__PURE__ */ n("div", { style: M.errorText, children: P })
|
|
1919
2121
|
] }),
|
|
1920
|
-
(
|
|
1921
|
-
|
|
1922
|
-
/* @__PURE__ */ l("span", { style:
|
|
1923
|
-
|
|
2122
|
+
(A || x || T) && /* @__PURE__ */ l("div", { style: M.linkContainer, children: [
|
|
2123
|
+
T && /* @__PURE__ */ l("div", { children: [
|
|
2124
|
+
/* @__PURE__ */ l("span", { style: M.divider, children: [
|
|
2125
|
+
w.magicLinkText,
|
|
1924
2126
|
" "
|
|
1925
2127
|
] }),
|
|
1926
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2128
|
+
/* @__PURE__ */ n("a", { onClick: I, style: M.link, children: w.magicLinkLink })
|
|
1927
2129
|
] }),
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
/* @__PURE__ */ l("span", { style:
|
|
1933
|
-
|
|
2130
|
+
T && (A || x) && /* @__PURE__ */ n("div", { style: M.divider, children: "•" }),
|
|
2131
|
+
A && /* @__PURE__ */ n("a", { onClick: o, style: M.link, children: w.forgotPasswordLink }),
|
|
2132
|
+
A && x && /* @__PURE__ */ n("div", { style: M.divider, children: "•" }),
|
|
2133
|
+
x && /* @__PURE__ */ l("div", { children: [
|
|
2134
|
+
/* @__PURE__ */ l("span", { style: M.divider, children: [
|
|
2135
|
+
w.signupText,
|
|
1934
2136
|
" "
|
|
1935
2137
|
] }),
|
|
1936
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2138
|
+
/* @__PURE__ */ n("a", { onClick: p, style: M.link, children: w.signupLink })
|
|
1937
2139
|
] })
|
|
1938
2140
|
] })
|
|
1939
2141
|
] });
|
|
1940
2142
|
}
|
|
1941
|
-
const
|
|
2143
|
+
const nt = {
|
|
1942
2144
|
title: "Create Account",
|
|
1943
2145
|
nameLabel: "First Name",
|
|
1944
2146
|
namePlaceholder: "Enter your first name",
|
|
@@ -1964,7 +2166,7 @@ const Qe = {
|
|
|
1964
2166
|
passwordMismatchError: "Passwords do not match",
|
|
1965
2167
|
isAdminLabel: "Create new organization",
|
|
1966
2168
|
isAdminDescription: "Check this if you want to create a new organization"
|
|
1967
|
-
},
|
|
2169
|
+
}, st = {
|
|
1968
2170
|
container: {
|
|
1969
2171
|
maxWidth: "400px",
|
|
1970
2172
|
width: "100%",
|
|
@@ -2063,136 +2265,134 @@ const Qe = {
|
|
|
2063
2265
|
fontSize: "0.875rem"
|
|
2064
2266
|
}
|
|
2065
2267
|
};
|
|
2066
|
-
function
|
|
2268
|
+
function Dt({
|
|
2067
2269
|
copy: i = {},
|
|
2068
2270
|
styles: e = {},
|
|
2069
2271
|
signupType: t = "user",
|
|
2070
2272
|
onSuccess: r,
|
|
2071
2273
|
onError: s,
|
|
2072
|
-
onLoginClick:
|
|
2073
|
-
onMagicLinkClick:
|
|
2074
|
-
showLoginLink:
|
|
2075
|
-
showMagicLinkOption:
|
|
2076
|
-
className:
|
|
2274
|
+
onLoginClick: o,
|
|
2275
|
+
onMagicLinkClick: p,
|
|
2276
|
+
showLoginLink: I = !0,
|
|
2277
|
+
showMagicLinkOption: A = !0,
|
|
2278
|
+
className: x
|
|
2077
2279
|
}) {
|
|
2078
|
-
const [
|
|
2079
|
-
const
|
|
2080
|
-
return
|
|
2081
|
-
},
|
|
2082
|
-
if (
|
|
2083
|
-
if (
|
|
2084
|
-
|
|
2280
|
+
const [T, b] = v(""), [f, h] = v(""), [S, L] = v(""), [R, q] = v(""), [k, u] = v(""), [P, C] = v(""), [H, W] = v(""), [F, V] = v(!1), [w, M] = v(""), [E, a] = v({}), { signup: g, signupTenantAdmin: m } = oe(), { tenant: c } = se(), d = { ...nt, ...i }, y = { ...st, ...e }, G = () => {
|
|
2281
|
+
const D = {};
|
|
2282
|
+
return T.trim() || (D.name = !0), !S.trim() && !R.trim() && (D.email = !0, D.phoneNumber = !0), k.trim() || (D.password = !0), P.trim() || (D.confirmPassword = !0), t === "tenant" && !H.trim() && (D.tenantName = !0), a(D), Object.keys(D).length === 0;
|
|
2283
|
+
}, ee = async (D) => {
|
|
2284
|
+
if (D.preventDefault(), !!G()) {
|
|
2285
|
+
if (k !== P) {
|
|
2286
|
+
M(d.passwordMismatchError), a({ confirmPassword: !0 });
|
|
2085
2287
|
return;
|
|
2086
2288
|
}
|
|
2087
|
-
if (t === "user" && !(
|
|
2088
|
-
|
|
2289
|
+
if (t === "user" && !(c != null && c.id)) {
|
|
2290
|
+
M("Tenant not found");
|
|
2089
2291
|
return;
|
|
2090
2292
|
}
|
|
2091
|
-
|
|
2293
|
+
V(!0), M("");
|
|
2092
2294
|
try {
|
|
2093
|
-
let
|
|
2094
|
-
t === "tenant" ?
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
const ue = V.message || k.errorMessage;
|
|
2113
|
-
h(ue), s == null || s(ue);
|
|
2295
|
+
let _;
|
|
2296
|
+
t === "tenant" ? _ = await m({
|
|
2297
|
+
email: S || void 0,
|
|
2298
|
+
phoneNumber: R || void 0,
|
|
2299
|
+
name: T,
|
|
2300
|
+
password: k,
|
|
2301
|
+
tenantName: H,
|
|
2302
|
+
lastName: f || void 0
|
|
2303
|
+
}) : _ = await g({
|
|
2304
|
+
email: S || void 0,
|
|
2305
|
+
phoneNumber: R || void 0,
|
|
2306
|
+
name: T,
|
|
2307
|
+
password: k,
|
|
2308
|
+
tenantId: c.id,
|
|
2309
|
+
lastName: f || void 0
|
|
2310
|
+
}), r == null || r(_);
|
|
2311
|
+
} catch (_) {
|
|
2312
|
+
const ge = _.message || d.errorMessage;
|
|
2313
|
+
M(ge), s == null || s(ge);
|
|
2114
2314
|
} finally {
|
|
2115
|
-
|
|
2315
|
+
V(!1);
|
|
2116
2316
|
}
|
|
2117
2317
|
}
|
|
2118
|
-
},
|
|
2119
|
-
...
|
|
2120
|
-
...
|
|
2121
|
-
}),
|
|
2122
|
-
...
|
|
2123
|
-
...
|
|
2124
|
-
...!
|
|
2125
|
-
}),
|
|
2126
|
-
return /* @__PURE__ */ l("div", { className:
|
|
2127
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2128
|
-
/* @__PURE__ */ l("form", { onSubmit:
|
|
2129
|
-
/* @__PURE__ */ l("div", { style:
|
|
2130
|
-
/* @__PURE__ */ n("label", { style:
|
|
2318
|
+
}, z = (D) => ({
|
|
2319
|
+
...y.input,
|
|
2320
|
+
...E[D] ? y.inputError : {}
|
|
2321
|
+
}), B = () => ({
|
|
2322
|
+
...y.button,
|
|
2323
|
+
...F ? y.buttonLoading : {},
|
|
2324
|
+
...!T || !S && !R || !k || !P || F || t === "tenant" && !H ? y.buttonDisabled : {}
|
|
2325
|
+
}), O = T && (S || R) && k && P && (t === "user" || H);
|
|
2326
|
+
return /* @__PURE__ */ l("div", { className: x, style: y.container, children: [
|
|
2327
|
+
/* @__PURE__ */ n("h2", { style: y.title, children: d.title }),
|
|
2328
|
+
/* @__PURE__ */ l("form", { onSubmit: ee, style: y.form, children: [
|
|
2329
|
+
/* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
|
|
2330
|
+
/* @__PURE__ */ n("label", { style: y.label, children: d.nameLabel }),
|
|
2131
2331
|
/* @__PURE__ */ n(
|
|
2132
2332
|
"input",
|
|
2133
2333
|
{
|
|
2134
2334
|
id: "name",
|
|
2135
2335
|
name: "name",
|
|
2136
2336
|
type: "text",
|
|
2137
|
-
value:
|
|
2138
|
-
onChange: (
|
|
2139
|
-
|
|
2337
|
+
value: T,
|
|
2338
|
+
onChange: (D) => {
|
|
2339
|
+
b(D.target.value), E.name && a((_) => ({ ..._, name: !1 }));
|
|
2140
2340
|
},
|
|
2141
|
-
placeholder:
|
|
2142
|
-
style:
|
|
2143
|
-
disabled:
|
|
2341
|
+
placeholder: d.namePlaceholder,
|
|
2342
|
+
style: z("name"),
|
|
2343
|
+
disabled: F
|
|
2144
2344
|
}
|
|
2145
2345
|
)
|
|
2146
2346
|
] }),
|
|
2147
|
-
/* @__PURE__ */ l("div", { style:
|
|
2148
|
-
/* @__PURE__ */ n("label", { style:
|
|
2347
|
+
/* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
|
|
2348
|
+
/* @__PURE__ */ n("label", { style: y.label, children: d.lastNameLabel }),
|
|
2149
2349
|
/* @__PURE__ */ n(
|
|
2150
2350
|
"input",
|
|
2151
2351
|
{
|
|
2152
2352
|
id: "lastName",
|
|
2153
2353
|
name: "lastName",
|
|
2154
2354
|
type: "text",
|
|
2155
|
-
value:
|
|
2156
|
-
onChange: (
|
|
2157
|
-
placeholder:
|
|
2158
|
-
style:
|
|
2159
|
-
disabled:
|
|
2355
|
+
value: f,
|
|
2356
|
+
onChange: (D) => h(D.target.value),
|
|
2357
|
+
placeholder: d.lastNamePlaceholder,
|
|
2358
|
+
style: y.input,
|
|
2359
|
+
disabled: F
|
|
2160
2360
|
}
|
|
2161
2361
|
)
|
|
2162
2362
|
] }),
|
|
2163
|
-
/* @__PURE__ */ l("div", { style:
|
|
2164
|
-
/* @__PURE__ */ n("label", { style:
|
|
2363
|
+
/* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
|
|
2364
|
+
/* @__PURE__ */ n("label", { style: y.label, children: d.emailLabel }),
|
|
2165
2365
|
/* @__PURE__ */ n(
|
|
2166
2366
|
"input",
|
|
2167
2367
|
{
|
|
2168
2368
|
id: "email",
|
|
2169
2369
|
name: "email",
|
|
2170
2370
|
type: "email",
|
|
2171
|
-
value:
|
|
2172
|
-
onChange: (
|
|
2173
|
-
|
|
2371
|
+
value: S,
|
|
2372
|
+
onChange: (D) => {
|
|
2373
|
+
L(D.target.value), E.email && a((_) => ({ ..._, email: !1, phoneNumber: !1 }));
|
|
2174
2374
|
},
|
|
2175
|
-
placeholder:
|
|
2176
|
-
style:
|
|
2177
|
-
disabled:
|
|
2375
|
+
placeholder: d.emailPlaceholder,
|
|
2376
|
+
style: z("email"),
|
|
2377
|
+
disabled: F
|
|
2178
2378
|
}
|
|
2179
2379
|
)
|
|
2180
2380
|
] }),
|
|
2181
|
-
/* @__PURE__ */ l("div", { style:
|
|
2182
|
-
/* @__PURE__ */ n("label", { style:
|
|
2381
|
+
/* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
|
|
2382
|
+
/* @__PURE__ */ n("label", { style: y.label, children: d.phoneNumberLabel }),
|
|
2183
2383
|
/* @__PURE__ */ n(
|
|
2184
2384
|
"input",
|
|
2185
2385
|
{
|
|
2186
2386
|
id: "phoneNumber",
|
|
2187
2387
|
name: "phoneNumber",
|
|
2188
2388
|
type: "tel",
|
|
2189
|
-
value:
|
|
2190
|
-
onChange: (
|
|
2191
|
-
|
|
2389
|
+
value: R,
|
|
2390
|
+
onChange: (D) => {
|
|
2391
|
+
q(D.target.value), E.phoneNumber && a((_) => ({ ..._, email: !1, phoneNumber: !1 }));
|
|
2192
2392
|
},
|
|
2193
|
-
placeholder:
|
|
2194
|
-
style:
|
|
2195
|
-
disabled:
|
|
2393
|
+
placeholder: d.phoneNumberPlaceholder,
|
|
2394
|
+
style: z("phoneNumber"),
|
|
2395
|
+
disabled: F
|
|
2196
2396
|
}
|
|
2197
2397
|
)
|
|
2198
2398
|
] }),
|
|
@@ -2208,83 +2408,83 @@ function Mt({
|
|
|
2208
2408
|
children: "At least one contact method (email or phone) is required"
|
|
2209
2409
|
}
|
|
2210
2410
|
),
|
|
2211
|
-
/* @__PURE__ */ l("div", { style:
|
|
2212
|
-
/* @__PURE__ */ n("label", { style:
|
|
2411
|
+
/* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
|
|
2412
|
+
/* @__PURE__ */ n("label", { style: y.label, children: d.passwordLabel }),
|
|
2213
2413
|
/* @__PURE__ */ n(
|
|
2214
2414
|
"input",
|
|
2215
2415
|
{
|
|
2216
2416
|
id: "password",
|
|
2217
2417
|
name: "password",
|
|
2218
2418
|
type: "password",
|
|
2219
|
-
value:
|
|
2220
|
-
onChange: (
|
|
2221
|
-
|
|
2419
|
+
value: k,
|
|
2420
|
+
onChange: (D) => {
|
|
2421
|
+
u(D.target.value), E.password && a((_) => ({ ..._, password: !1 }));
|
|
2222
2422
|
},
|
|
2223
|
-
placeholder:
|
|
2224
|
-
style:
|
|
2225
|
-
disabled:
|
|
2423
|
+
placeholder: d.passwordPlaceholder,
|
|
2424
|
+
style: z("password"),
|
|
2425
|
+
disabled: F
|
|
2226
2426
|
}
|
|
2227
2427
|
)
|
|
2228
2428
|
] }),
|
|
2229
|
-
/* @__PURE__ */ l("div", { style:
|
|
2230
|
-
/* @__PURE__ */ n("label", { style:
|
|
2429
|
+
/* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
|
|
2430
|
+
/* @__PURE__ */ n("label", { style: y.label, children: d.confirmPasswordLabel }),
|
|
2231
2431
|
/* @__PURE__ */ n(
|
|
2232
2432
|
"input",
|
|
2233
2433
|
{
|
|
2234
2434
|
id: "confirmPassword",
|
|
2235
2435
|
name: "confirmPassword",
|
|
2236
2436
|
type: "password",
|
|
2237
|
-
value:
|
|
2238
|
-
onChange: (
|
|
2239
|
-
|
|
2437
|
+
value: P,
|
|
2438
|
+
onChange: (D) => {
|
|
2439
|
+
C(D.target.value), E.confirmPassword && a((_) => ({ ..._, confirmPassword: !1 })), w === d.passwordMismatchError && M("");
|
|
2240
2440
|
},
|
|
2241
|
-
placeholder:
|
|
2242
|
-
style:
|
|
2243
|
-
disabled:
|
|
2441
|
+
placeholder: d.confirmPasswordPlaceholder,
|
|
2442
|
+
style: z("confirmPassword"),
|
|
2443
|
+
disabled: F
|
|
2244
2444
|
}
|
|
2245
2445
|
)
|
|
2246
2446
|
] }),
|
|
2247
|
-
t === "tenant" && /* @__PURE__ */ l("div", { style:
|
|
2248
|
-
/* @__PURE__ */ n("label", { style:
|
|
2447
|
+
t === "tenant" && /* @__PURE__ */ l("div", { style: y.fieldGroup, children: [
|
|
2448
|
+
/* @__PURE__ */ n("label", { style: y.label, children: d.tenantNameLabel }),
|
|
2249
2449
|
/* @__PURE__ */ n(
|
|
2250
2450
|
"input",
|
|
2251
2451
|
{
|
|
2252
2452
|
id: "tenantName",
|
|
2253
2453
|
name: "tenantName",
|
|
2254
2454
|
type: "text",
|
|
2255
|
-
value:
|
|
2256
|
-
onChange: (
|
|
2257
|
-
|
|
2455
|
+
value: H,
|
|
2456
|
+
onChange: (D) => {
|
|
2457
|
+
W(D.target.value), E.tenantName && a((_) => ({ ..._, tenantName: !1 }));
|
|
2258
2458
|
},
|
|
2259
|
-
placeholder:
|
|
2260
|
-
style:
|
|
2261
|
-
disabled:
|
|
2459
|
+
placeholder: d.tenantNamePlaceholder,
|
|
2460
|
+
style: z("tenantName"),
|
|
2461
|
+
disabled: F
|
|
2262
2462
|
}
|
|
2263
2463
|
)
|
|
2264
2464
|
] }),
|
|
2265
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !
|
|
2266
|
-
|
|
2465
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !O || F, style: B(), children: F ? d.loadingText : d.submitButton }),
|
|
2466
|
+
w && /* @__PURE__ */ n("div", { style: y.errorText, children: w })
|
|
2267
2467
|
] }),
|
|
2268
|
-
(
|
|
2269
|
-
|
|
2270
|
-
/* @__PURE__ */ l("span", { style:
|
|
2271
|
-
|
|
2468
|
+
(I || A) && /* @__PURE__ */ l("div", { style: y.linkContainer, children: [
|
|
2469
|
+
A && /* @__PURE__ */ l("div", { children: [
|
|
2470
|
+
/* @__PURE__ */ l("span", { style: y.divider, children: [
|
|
2471
|
+
d.magicLinkText,
|
|
2272
2472
|
" "
|
|
2273
2473
|
] }),
|
|
2274
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2474
|
+
/* @__PURE__ */ n("a", { onClick: p, style: y.link, children: d.magicLinkLink })
|
|
2275
2475
|
] }),
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
/* @__PURE__ */ l("span", { style:
|
|
2279
|
-
|
|
2476
|
+
A && I && /* @__PURE__ */ n("div", { style: y.divider, children: "•" }),
|
|
2477
|
+
I && /* @__PURE__ */ l("div", { children: [
|
|
2478
|
+
/* @__PURE__ */ l("span", { style: y.divider, children: [
|
|
2479
|
+
d.loginText,
|
|
2280
2480
|
" "
|
|
2281
2481
|
] }),
|
|
2282
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2482
|
+
/* @__PURE__ */ n("a", { onClick: o, style: y.link, children: d.loginLink })
|
|
2283
2483
|
] })
|
|
2284
2484
|
] })
|
|
2285
2485
|
] });
|
|
2286
2486
|
}
|
|
2287
|
-
const
|
|
2487
|
+
const it = {
|
|
2288
2488
|
title: "Sign In with Magic Link",
|
|
2289
2489
|
emailLabel: "Email",
|
|
2290
2490
|
emailPlaceholder: "Enter your email",
|
|
@@ -2302,7 +2502,7 @@ const Xe = {
|
|
|
2302
2502
|
loadingText: "Sending magic link...",
|
|
2303
2503
|
verifyingText: "Verifying magic link...",
|
|
2304
2504
|
description: "Enter your email to receive a magic link. If you don't have an account, we'll create one for you."
|
|
2305
|
-
},
|
|
2505
|
+
}, ot = {
|
|
2306
2506
|
container: {
|
|
2307
2507
|
maxWidth: "400px",
|
|
2308
2508
|
width: "100%",
|
|
@@ -2405,100 +2605,105 @@ const Xe = {
|
|
|
2405
2605
|
fontSize: "0.875rem"
|
|
2406
2606
|
}
|
|
2407
2607
|
};
|
|
2408
|
-
function
|
|
2608
|
+
function Ht({
|
|
2409
2609
|
copy: i = {},
|
|
2410
2610
|
styles: e = {},
|
|
2411
2611
|
onSuccess: t,
|
|
2412
2612
|
onError: r,
|
|
2413
2613
|
onLoginClick: s,
|
|
2414
|
-
onSignupClick:
|
|
2415
|
-
showTraditionalLinks:
|
|
2416
|
-
className:
|
|
2417
|
-
verifyToken:
|
|
2418
|
-
frontendUrl:
|
|
2614
|
+
onSignupClick: o,
|
|
2615
|
+
showTraditionalLinks: p = !0,
|
|
2616
|
+
className: I,
|
|
2617
|
+
verifyToken: A,
|
|
2618
|
+
frontendUrl: x
|
|
2419
2619
|
}) {
|
|
2420
|
-
const [
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
}, [
|
|
2424
|
-
const
|
|
2425
|
-
|
|
2620
|
+
const [T, b] = v(""), [f, h] = v(""), [S, L] = v(""), [R, q] = v(!1), [k, u] = v(!1), [P, C] = v(""), [H, W] = v(""), [F, V] = v({}), [w, M] = v(!1), { sendMagicLink: E, verifyMagicLink: a } = oe(), { tenant: g } = se(), m = { ...it, ...i }, c = { ...ot, ...e };
|
|
2621
|
+
te(() => {
|
|
2622
|
+
A && d(A);
|
|
2623
|
+
}, [A]);
|
|
2624
|
+
const d = async (B) => {
|
|
2625
|
+
if (!g || !T) {
|
|
2626
|
+
C("Missing tenant or email");
|
|
2627
|
+
return;
|
|
2628
|
+
}
|
|
2629
|
+
u(!0), C("");
|
|
2426
2630
|
try {
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2631
|
+
const O = await a({
|
|
2632
|
+
token: B,
|
|
2633
|
+
email: T
|
|
2634
|
+
// tenantId inferred from context automatically
|
|
2635
|
+
});
|
|
2636
|
+
t == null || t(O);
|
|
2637
|
+
} catch (O) {
|
|
2638
|
+
const D = O.message || "Failed to verify magic link";
|
|
2639
|
+
C(D), r == null || r(D);
|
|
2434
2640
|
} finally {
|
|
2435
|
-
|
|
2641
|
+
u(!1);
|
|
2436
2642
|
}
|
|
2437
|
-
},
|
|
2438
|
-
const
|
|
2439
|
-
return
|
|
2440
|
-
},
|
|
2441
|
-
if (
|
|
2442
|
-
if (!(
|
|
2443
|
-
|
|
2643
|
+
}, y = () => {
|
|
2644
|
+
const B = {};
|
|
2645
|
+
return T.trim() || (B.email = !0), w && !f.trim() && (B.name = !0), V(B), Object.keys(B).length === 0;
|
|
2646
|
+
}, G = async (B) => {
|
|
2647
|
+
if (B.preventDefault(), !!y()) {
|
|
2648
|
+
if (!(g != null && g.id)) {
|
|
2649
|
+
C("Tenant not found");
|
|
2444
2650
|
return;
|
|
2445
2651
|
}
|
|
2446
|
-
|
|
2652
|
+
q(!0), C(""), W("");
|
|
2447
2653
|
try {
|
|
2448
|
-
const
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
);
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
F(R), r == null || r(R);
|
|
2654
|
+
const O = x || (typeof window < "u" ? window.location.origin : ""), D = await E({
|
|
2655
|
+
email: T,
|
|
2656
|
+
tenantId: g.id,
|
|
2657
|
+
frontendUrl: O,
|
|
2658
|
+
name: w ? f : void 0,
|
|
2659
|
+
lastName: w ? S : void 0
|
|
2660
|
+
});
|
|
2661
|
+
W(m.successMessage), t == null || t(D);
|
|
2662
|
+
} catch (O) {
|
|
2663
|
+
const D = O.message || m.errorMessage;
|
|
2664
|
+
C(D), r == null || r(D);
|
|
2460
2665
|
} finally {
|
|
2461
|
-
|
|
2666
|
+
q(!1);
|
|
2462
2667
|
}
|
|
2463
2668
|
}
|
|
2464
|
-
},
|
|
2465
|
-
...
|
|
2466
|
-
...
|
|
2467
|
-
}),
|
|
2468
|
-
...
|
|
2469
|
-
...
|
|
2470
|
-
...!
|
|
2669
|
+
}, ee = (B) => ({
|
|
2670
|
+
...c.input,
|
|
2671
|
+
...F[B] ? c.inputError : {}
|
|
2672
|
+
}), z = () => ({
|
|
2673
|
+
...c.button,
|
|
2674
|
+
...R || k ? c.buttonLoading : {},
|
|
2675
|
+
...!T || R || k ? c.buttonDisabled : {}
|
|
2471
2676
|
});
|
|
2472
|
-
return
|
|
2473
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2677
|
+
return k ? /* @__PURE__ */ l("div", { className: I, style: c.container, children: [
|
|
2678
|
+
/* @__PURE__ */ n("h2", { style: c.title, children: m.verifyingText }),
|
|
2474
2679
|
/* @__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..." }) })
|
|
2475
|
-
] }) : /* @__PURE__ */ l("div", { className:
|
|
2476
|
-
/* @__PURE__ */ n("h2", { style:
|
|
2477
|
-
/* @__PURE__ */ n("p", { style:
|
|
2478
|
-
/* @__PURE__ */ l("form", { onSubmit:
|
|
2479
|
-
/* @__PURE__ */ l("div", { style:
|
|
2480
|
-
/* @__PURE__ */ n("label", { style:
|
|
2680
|
+
] }) : /* @__PURE__ */ l("div", { className: I, style: c.container, children: [
|
|
2681
|
+
/* @__PURE__ */ n("h2", { style: c.title, children: m.title }),
|
|
2682
|
+
/* @__PURE__ */ n("p", { style: c.description, children: m.description }),
|
|
2683
|
+
/* @__PURE__ */ l("form", { onSubmit: G, style: c.form, children: [
|
|
2684
|
+
/* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
|
|
2685
|
+
/* @__PURE__ */ n("label", { style: c.label, children: m.emailLabel }),
|
|
2481
2686
|
/* @__PURE__ */ n(
|
|
2482
2687
|
"input",
|
|
2483
2688
|
{
|
|
2484
2689
|
id: "email",
|
|
2485
2690
|
name: "email",
|
|
2486
2691
|
type: "email",
|
|
2487
|
-
value:
|
|
2488
|
-
onChange: (
|
|
2489
|
-
|
|
2692
|
+
value: T,
|
|
2693
|
+
onChange: (B) => {
|
|
2694
|
+
b(B.target.value), F.email && V((O) => ({ ...O, email: !1 }));
|
|
2490
2695
|
},
|
|
2491
|
-
placeholder:
|
|
2492
|
-
style:
|
|
2493
|
-
disabled:
|
|
2696
|
+
placeholder: m.emailPlaceholder,
|
|
2697
|
+
style: ee("email"),
|
|
2698
|
+
disabled: R || k
|
|
2494
2699
|
}
|
|
2495
2700
|
)
|
|
2496
2701
|
] }),
|
|
2497
|
-
!
|
|
2702
|
+
!w && /* @__PURE__ */ n("div", { style: { textAlign: "center", marginTop: "0.5rem" }, children: /* @__PURE__ */ n(
|
|
2498
2703
|
"button",
|
|
2499
2704
|
{
|
|
2500
2705
|
type: "button",
|
|
2501
|
-
onClick: () =>
|
|
2706
|
+
onClick: () => M(!0),
|
|
2502
2707
|
style: {
|
|
2503
2708
|
background: "none",
|
|
2504
2709
|
border: "none",
|
|
@@ -2510,38 +2715,38 @@ function Et({
|
|
|
2510
2715
|
children: "New user? Add your name"
|
|
2511
2716
|
}
|
|
2512
2717
|
) }),
|
|
2513
|
-
|
|
2514
|
-
/* @__PURE__ */ l("div", { style:
|
|
2515
|
-
/* @__PURE__ */ n("label", { style:
|
|
2718
|
+
w && /* @__PURE__ */ l(N, { children: [
|
|
2719
|
+
/* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
|
|
2720
|
+
/* @__PURE__ */ n("label", { style: c.label, children: m.nameLabel }),
|
|
2516
2721
|
/* @__PURE__ */ n(
|
|
2517
2722
|
"input",
|
|
2518
2723
|
{
|
|
2519
2724
|
id: "name",
|
|
2520
2725
|
name: "name",
|
|
2521
2726
|
type: "text",
|
|
2522
|
-
value:
|
|
2523
|
-
onChange: (
|
|
2524
|
-
|
|
2727
|
+
value: f,
|
|
2728
|
+
onChange: (B) => {
|
|
2729
|
+
h(B.target.value), F.name && V((O) => ({ ...O, name: !1 }));
|
|
2525
2730
|
},
|
|
2526
|
-
placeholder:
|
|
2527
|
-
style:
|
|
2528
|
-
disabled:
|
|
2731
|
+
placeholder: m.namePlaceholder,
|
|
2732
|
+
style: ee("name"),
|
|
2733
|
+
disabled: R || k
|
|
2529
2734
|
}
|
|
2530
2735
|
)
|
|
2531
2736
|
] }),
|
|
2532
|
-
/* @__PURE__ */ l("div", { style:
|
|
2533
|
-
/* @__PURE__ */ n("label", { style:
|
|
2737
|
+
/* @__PURE__ */ l("div", { style: c.fieldGroup, children: [
|
|
2738
|
+
/* @__PURE__ */ n("label", { style: c.label, children: m.lastNameLabel }),
|
|
2534
2739
|
/* @__PURE__ */ n(
|
|
2535
2740
|
"input",
|
|
2536
2741
|
{
|
|
2537
2742
|
id: "lastName",
|
|
2538
2743
|
name: "lastName",
|
|
2539
2744
|
type: "text",
|
|
2540
|
-
value:
|
|
2541
|
-
onChange: (
|
|
2542
|
-
placeholder:
|
|
2543
|
-
style:
|
|
2544
|
-
disabled:
|
|
2745
|
+
value: S,
|
|
2746
|
+
onChange: (B) => L(B.target.value),
|
|
2747
|
+
placeholder: m.lastNamePlaceholder,
|
|
2748
|
+
style: c.input,
|
|
2749
|
+
disabled: R || k
|
|
2545
2750
|
}
|
|
2546
2751
|
)
|
|
2547
2752
|
] }),
|
|
@@ -2550,7 +2755,7 @@ function Et({
|
|
|
2550
2755
|
{
|
|
2551
2756
|
type: "button",
|
|
2552
2757
|
onClick: () => {
|
|
2553
|
-
|
|
2758
|
+
M(!1), h(""), L("");
|
|
2554
2759
|
},
|
|
2555
2760
|
style: {
|
|
2556
2761
|
background: "none",
|
|
@@ -2564,30 +2769,30 @@ function Et({
|
|
|
2564
2769
|
}
|
|
2565
2770
|
) })
|
|
2566
2771
|
] }),
|
|
2567
|
-
/* @__PURE__ */ n("button", { type: "submit", disabled: !
|
|
2568
|
-
|
|
2569
|
-
|
|
2772
|
+
/* @__PURE__ */ n("button", { type: "submit", disabled: !T || R || k, style: z(), children: R ? m.loadingText : m.submitButton }),
|
|
2773
|
+
P && /* @__PURE__ */ n("div", { style: c.errorText, children: P }),
|
|
2774
|
+
H && /* @__PURE__ */ n("div", { style: c.successText, children: H })
|
|
2570
2775
|
] }),
|
|
2571
|
-
|
|
2776
|
+
p && /* @__PURE__ */ l("div", { style: c.linkContainer, children: [
|
|
2572
2777
|
/* @__PURE__ */ l("div", { children: [
|
|
2573
|
-
/* @__PURE__ */ l("span", { style:
|
|
2574
|
-
|
|
2778
|
+
/* @__PURE__ */ l("span", { style: c.divider, children: [
|
|
2779
|
+
m.loginText,
|
|
2575
2780
|
" "
|
|
2576
2781
|
] }),
|
|
2577
|
-
/* @__PURE__ */ n("a", { onClick: s, style:
|
|
2782
|
+
/* @__PURE__ */ n("a", { onClick: s, style: c.link, children: m.loginLink })
|
|
2578
2783
|
] }),
|
|
2579
|
-
/* @__PURE__ */ n("div", { style:
|
|
2784
|
+
/* @__PURE__ */ n("div", { style: c.divider, children: "•" }),
|
|
2580
2785
|
/* @__PURE__ */ l("div", { children: [
|
|
2581
|
-
/* @__PURE__ */ l("span", { style:
|
|
2582
|
-
|
|
2786
|
+
/* @__PURE__ */ l("span", { style: c.divider, children: [
|
|
2787
|
+
m.signupText,
|
|
2583
2788
|
" "
|
|
2584
2789
|
] }),
|
|
2585
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
2790
|
+
/* @__PURE__ */ n("a", { onClick: o, style: c.link, children: m.signupLink })
|
|
2586
2791
|
] })
|
|
2587
2792
|
] })
|
|
2588
2793
|
] });
|
|
2589
2794
|
}
|
|
2590
|
-
const
|
|
2795
|
+
const at = {
|
|
2591
2796
|
title: "Verifying Magic Link",
|
|
2592
2797
|
verifyingMessage: "Please wait while we verify your magic link...",
|
|
2593
2798
|
successMessage: "Magic link verified successfully! You are now logged in.",
|
|
@@ -2595,7 +2800,7 @@ const et = {
|
|
|
2595
2800
|
redirectingMessage: "Redirecting you to the dashboard...",
|
|
2596
2801
|
retryButton: "Try Again",
|
|
2597
2802
|
backToLoginButton: "Back to Login"
|
|
2598
|
-
},
|
|
2803
|
+
}, Ee = {
|
|
2599
2804
|
container: {
|
|
2600
2805
|
maxWidth: "400px",
|
|
2601
2806
|
width: "100%",
|
|
@@ -2682,7 +2887,7 @@ const et = {
|
|
|
2682
2887
|
cursor: "pointer",
|
|
2683
2888
|
transition: "all 0.15s ease-in-out"
|
|
2684
2889
|
}
|
|
2685
|
-
},
|
|
2890
|
+
}, lt = () => /* @__PURE__ */ n("div", { style: Ee.spinner }), ct = () => /* @__PURE__ */ l(
|
|
2686
2891
|
"svg",
|
|
2687
2892
|
{
|
|
2688
2893
|
width: "48",
|
|
@@ -2699,7 +2904,7 @@ const et = {
|
|
|
2699
2904
|
/* @__PURE__ */ n("polyline", { points: "22,4 12,14.01 9,11.01" })
|
|
2700
2905
|
]
|
|
2701
2906
|
}
|
|
2702
|
-
),
|
|
2907
|
+
), dt = () => /* @__PURE__ */ l(
|
|
2703
2908
|
"svg",
|
|
2704
2909
|
{
|
|
2705
2910
|
width: "48",
|
|
@@ -2717,110 +2922,109 @@ const et = {
|
|
|
2717
2922
|
/* @__PURE__ */ n("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
2718
2923
|
]
|
|
2719
2924
|
}
|
|
2720
|
-
),
|
|
2721
|
-
loading: /* @__PURE__ */ n(
|
|
2722
|
-
success: /* @__PURE__ */ n(
|
|
2723
|
-
error: /* @__PURE__ */ n(
|
|
2925
|
+
), ut = {
|
|
2926
|
+
loading: /* @__PURE__ */ n(lt, {}),
|
|
2927
|
+
success: /* @__PURE__ */ n(ct, {}),
|
|
2928
|
+
error: /* @__PURE__ */ n(dt, {})
|
|
2724
2929
|
};
|
|
2725
|
-
function
|
|
2930
|
+
function Nt({
|
|
2726
2931
|
copy: i = {},
|
|
2727
2932
|
styles: e = {},
|
|
2728
2933
|
icons: t = {},
|
|
2729
2934
|
onSuccess: r,
|
|
2730
2935
|
onError: s,
|
|
2731
|
-
onRetry:
|
|
2732
|
-
onBackToLogin:
|
|
2733
|
-
className:
|
|
2734
|
-
token:
|
|
2735
|
-
email:
|
|
2736
|
-
appId:
|
|
2737
|
-
|
|
2738
|
-
autoRedirectDelay:
|
|
2936
|
+
onRetry: o,
|
|
2937
|
+
onBackToLogin: p,
|
|
2938
|
+
className: I,
|
|
2939
|
+
token: A,
|
|
2940
|
+
email: x,
|
|
2941
|
+
appId: T,
|
|
2942
|
+
tenantSlug: b,
|
|
2943
|
+
autoRedirectDelay: f = 3e3
|
|
2739
2944
|
}) {
|
|
2740
|
-
const [
|
|
2945
|
+
const [h, S] = v("verifying"), [L, R] = v(""), { verifyMagicLink: q } = oe(), k = { ...at, ...i }, u = { ...Ee, ...e }, P = { ...ut, ...t }, C = () => {
|
|
2741
2946
|
if (typeof window > "u") return {};
|
|
2742
|
-
const
|
|
2947
|
+
const w = new URLSearchParams(window.location.search);
|
|
2743
2948
|
return {
|
|
2744
|
-
token:
|
|
2745
|
-
email:
|
|
2746
|
-
appId:
|
|
2747
|
-
|
|
2949
|
+
token: A || w.get("token") || "",
|
|
2950
|
+
email: x || w.get("email") || "",
|
|
2951
|
+
appId: T || w.get("appId") || "",
|
|
2952
|
+
tenantSlug: b || w.get("tenantSlug") || void 0
|
|
2748
2953
|
};
|
|
2749
|
-
},
|
|
2750
|
-
|
|
2954
|
+
}, H = async () => {
|
|
2955
|
+
S("verifying"), R("");
|
|
2751
2956
|
try {
|
|
2752
|
-
const
|
|
2753
|
-
if (!
|
|
2754
|
-
throw new Error("Missing required parameters: token
|
|
2755
|
-
const
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
)
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
g(h), v("error"), s == null || s(h);
|
|
2957
|
+
const w = C();
|
|
2958
|
+
if (!w.token || !w.email)
|
|
2959
|
+
throw new Error("Missing required parameters: token or email");
|
|
2960
|
+
const M = await q({
|
|
2961
|
+
token: w.token,
|
|
2962
|
+
email: w.email,
|
|
2963
|
+
tenantSlug: w.tenantSlug
|
|
2964
|
+
});
|
|
2965
|
+
S("success"), r == null || r(M), f > 0 && setTimeout(() => {
|
|
2966
|
+
S("redirecting");
|
|
2967
|
+
}, f);
|
|
2968
|
+
} catch (w) {
|
|
2969
|
+
const M = w.message || k.errorMessage;
|
|
2970
|
+
R(M), S("error"), s == null || s(M);
|
|
2767
2971
|
}
|
|
2768
|
-
},
|
|
2769
|
-
|
|
2770
|
-
},
|
|
2771
|
-
|
|
2972
|
+
}, W = () => {
|
|
2973
|
+
o == null || o(), H();
|
|
2974
|
+
}, F = () => {
|
|
2975
|
+
p == null || p();
|
|
2772
2976
|
};
|
|
2773
|
-
|
|
2774
|
-
|
|
2977
|
+
te(() => {
|
|
2978
|
+
H();
|
|
2775
2979
|
}, []);
|
|
2776
|
-
const
|
|
2777
|
-
switch (
|
|
2980
|
+
const V = () => {
|
|
2981
|
+
switch (h) {
|
|
2778
2982
|
case "verifying":
|
|
2779
|
-
return /* @__PURE__ */ l("div", { style:
|
|
2780
|
-
|
|
2781
|
-
|
|
2983
|
+
return /* @__PURE__ */ l("div", { style: u.message, children: [
|
|
2984
|
+
P.loading,
|
|
2985
|
+
k.verifyingMessage
|
|
2782
2986
|
] });
|
|
2783
2987
|
case "success":
|
|
2784
|
-
return /* @__PURE__ */ l(
|
|
2785
|
-
|
|
2786
|
-
/* @__PURE__ */ n("div", { style:
|
|
2988
|
+
return /* @__PURE__ */ l(N, { children: [
|
|
2989
|
+
P.success,
|
|
2990
|
+
/* @__PURE__ */ n("div", { style: u.successMessage, children: k.successMessage })
|
|
2787
2991
|
] });
|
|
2788
2992
|
case "redirecting":
|
|
2789
|
-
return /* @__PURE__ */ l(
|
|
2790
|
-
|
|
2791
|
-
/* @__PURE__ */ n("div", { style:
|
|
2993
|
+
return /* @__PURE__ */ l(N, { children: [
|
|
2994
|
+
P.loading,
|
|
2995
|
+
/* @__PURE__ */ n("div", { style: u.message, children: k.redirectingMessage })
|
|
2792
2996
|
] });
|
|
2793
2997
|
case "error":
|
|
2794
|
-
return /* @__PURE__ */ l(
|
|
2795
|
-
|
|
2796
|
-
/* @__PURE__ */ n("div", { style:
|
|
2797
|
-
/* @__PURE__ */ l("div", { style:
|
|
2998
|
+
return /* @__PURE__ */ l(N, { children: [
|
|
2999
|
+
P.error,
|
|
3000
|
+
/* @__PURE__ */ n("div", { style: u.errorMessage, children: L || k.errorMessage }),
|
|
3001
|
+
/* @__PURE__ */ l("div", { style: u.buttonContainer, children: [
|
|
2798
3002
|
/* @__PURE__ */ n(
|
|
2799
3003
|
"button",
|
|
2800
3004
|
{
|
|
2801
|
-
onClick:
|
|
2802
|
-
style:
|
|
2803
|
-
onMouseOver: (
|
|
2804
|
-
|
|
3005
|
+
onClick: W,
|
|
3006
|
+
style: u.retryButton,
|
|
3007
|
+
onMouseOver: (w) => {
|
|
3008
|
+
w.currentTarget.style.backgroundColor = "#2563eb";
|
|
2805
3009
|
},
|
|
2806
|
-
onMouseOut: (
|
|
2807
|
-
|
|
3010
|
+
onMouseOut: (w) => {
|
|
3011
|
+
w.currentTarget.style.backgroundColor = "#3b82f6";
|
|
2808
3012
|
},
|
|
2809
|
-
children:
|
|
3013
|
+
children: k.retryButton
|
|
2810
3014
|
}
|
|
2811
3015
|
),
|
|
2812
3016
|
/* @__PURE__ */ n(
|
|
2813
3017
|
"button",
|
|
2814
3018
|
{
|
|
2815
|
-
onClick:
|
|
2816
|
-
style:
|
|
2817
|
-
onMouseOver: (
|
|
2818
|
-
|
|
3019
|
+
onClick: F,
|
|
3020
|
+
style: u.backButton,
|
|
3021
|
+
onMouseOver: (w) => {
|
|
3022
|
+
w.currentTarget.style.backgroundColor = "#e5e7eb";
|
|
2819
3023
|
},
|
|
2820
|
-
onMouseOut: (
|
|
2821
|
-
|
|
3024
|
+
onMouseOut: (w) => {
|
|
3025
|
+
w.currentTarget.style.backgroundColor = "#f3f4f6";
|
|
2822
3026
|
},
|
|
2823
|
-
children:
|
|
3027
|
+
children: k.backToLoginButton
|
|
2824
3028
|
}
|
|
2825
3029
|
)
|
|
2826
3030
|
] })
|
|
@@ -2829,18 +3033,18 @@ function Lt({
|
|
|
2829
3033
|
return null;
|
|
2830
3034
|
}
|
|
2831
3035
|
};
|
|
2832
|
-
return /* @__PURE__ */ l("div", { style:
|
|
3036
|
+
return /* @__PURE__ */ l("div", { style: u.container, className: I, children: [
|
|
2833
3037
|
/* @__PURE__ */ n("style", { children: `
|
|
2834
3038
|
@keyframes spin {
|
|
2835
3039
|
0% { transform: rotate(0deg); }
|
|
2836
3040
|
100% { transform: rotate(360deg); }
|
|
2837
3041
|
}
|
|
2838
3042
|
` }),
|
|
2839
|
-
/* @__PURE__ */ n("h1", { style:
|
|
2840
|
-
|
|
3043
|
+
/* @__PURE__ */ n("h1", { style: u.title, children: k.title }),
|
|
3044
|
+
V()
|
|
2841
3045
|
] });
|
|
2842
3046
|
}
|
|
2843
|
-
const
|
|
3047
|
+
const ht = {
|
|
2844
3048
|
title: "Reset Password",
|
|
2845
3049
|
subtitle: "Enter your email address and we'll send you a link to reset your password.",
|
|
2846
3050
|
emailLabel: "Email",
|
|
@@ -2862,7 +3066,7 @@ const it = {
|
|
|
2862
3066
|
resetLoadingText: "Resetting...",
|
|
2863
3067
|
resetSuccessMessage: "Password reset successfully!",
|
|
2864
3068
|
passwordMismatchError: "Passwords do not match"
|
|
2865
|
-
},
|
|
3069
|
+
}, gt = {
|
|
2866
3070
|
container: {
|
|
2867
3071
|
maxWidth: "400px",
|
|
2868
3072
|
margin: "0 auto",
|
|
@@ -2954,113 +3158,113 @@ const it = {
|
|
|
2954
3158
|
cursor: "pointer"
|
|
2955
3159
|
}
|
|
2956
3160
|
};
|
|
2957
|
-
function
|
|
3161
|
+
function Bt({
|
|
2958
3162
|
copy: i = {},
|
|
2959
3163
|
styles: e = {},
|
|
2960
3164
|
mode: t = "request",
|
|
2961
3165
|
token: r = "",
|
|
2962
3166
|
onSuccess: s,
|
|
2963
|
-
onError:
|
|
2964
|
-
onBackToLogin:
|
|
2965
|
-
onModeChange:
|
|
2966
|
-
className:
|
|
3167
|
+
onError: o,
|
|
3168
|
+
onBackToLogin: p,
|
|
3169
|
+
onModeChange: I,
|
|
3170
|
+
className: A
|
|
2967
3171
|
}) {
|
|
2968
|
-
const [
|
|
2969
|
-
const
|
|
2970
|
-
return
|
|
2971
|
-
},
|
|
2972
|
-
const
|
|
2973
|
-
return
|
|
2974
|
-
},
|
|
2975
|
-
if (
|
|
2976
|
-
if (!(
|
|
2977
|
-
|
|
3172
|
+
const [x, T] = v(""), [b, f] = v(r), [h, S] = v(""), [L, R] = v(""), [q, k] = v(!1), [u, P] = v(""), [C, H] = v(""), [W, F] = v({}), { requestPasswordReset: V, confirmPasswordReset: w } = oe(), { tenant: M } = se(), E = { ...ht, ...i }, a = { ...gt, ...e }, g = () => {
|
|
3173
|
+
const z = {};
|
|
3174
|
+
return x.trim() || (z.email = !0), F(z), Object.keys(z).length === 0;
|
|
3175
|
+
}, m = () => {
|
|
3176
|
+
const z = {};
|
|
3177
|
+
return b.trim() || (z.token = !0), h.trim() || (z.newPassword = !0), L.trim() || (z.confirmPassword = !0), F(z), Object.keys(z).length === 0;
|
|
3178
|
+
}, c = async (z) => {
|
|
3179
|
+
if (z.preventDefault(), !!g()) {
|
|
3180
|
+
if (!(M != null && M.id)) {
|
|
3181
|
+
P("Tenant not found");
|
|
2978
3182
|
return;
|
|
2979
3183
|
}
|
|
2980
|
-
|
|
3184
|
+
k(!0), P(""), H("");
|
|
2981
3185
|
try {
|
|
2982
|
-
await
|
|
2983
|
-
} catch (
|
|
2984
|
-
const
|
|
2985
|
-
|
|
3186
|
+
await V({ email: x, tenantId: M.id }), H(E.successMessage), s == null || s();
|
|
3187
|
+
} catch (B) {
|
|
3188
|
+
const O = B.message || E.errorMessage;
|
|
3189
|
+
P(O), o == null || o(O);
|
|
2986
3190
|
} finally {
|
|
2987
|
-
|
|
3191
|
+
k(!1);
|
|
2988
3192
|
}
|
|
2989
3193
|
}
|
|
2990
|
-
},
|
|
2991
|
-
if (
|
|
2992
|
-
if (
|
|
2993
|
-
|
|
3194
|
+
}, d = async (z) => {
|
|
3195
|
+
if (z.preventDefault(), !!m()) {
|
|
3196
|
+
if (h !== L) {
|
|
3197
|
+
P(E.passwordMismatchError), F({ confirmPassword: !0 });
|
|
2994
3198
|
return;
|
|
2995
3199
|
}
|
|
2996
|
-
|
|
3200
|
+
k(!0), P(""), H("");
|
|
2997
3201
|
try {
|
|
2998
|
-
await
|
|
2999
|
-
} catch (
|
|
3000
|
-
const
|
|
3001
|
-
|
|
3202
|
+
await w({ token: b, newPassword: h }), H(E.resetSuccessMessage), s == null || s();
|
|
3203
|
+
} catch (B) {
|
|
3204
|
+
const O = B.message || E.errorMessage;
|
|
3205
|
+
P(O), o == null || o(O);
|
|
3002
3206
|
} finally {
|
|
3003
|
-
|
|
3207
|
+
k(!1);
|
|
3004
3208
|
}
|
|
3005
3209
|
}
|
|
3006
|
-
},
|
|
3007
|
-
...
|
|
3008
|
-
...z
|
|
3009
|
-
}),
|
|
3010
|
-
...
|
|
3011
|
-
...
|
|
3210
|
+
}, y = (z) => ({
|
|
3211
|
+
...a.input,
|
|
3212
|
+
...W[z] ? a.inputError : {}
|
|
3213
|
+
}), G = () => ({
|
|
3214
|
+
...a.button,
|
|
3215
|
+
...q ? a.buttonLoading : {}
|
|
3012
3216
|
});
|
|
3013
3217
|
if (t === "reset") {
|
|
3014
|
-
const
|
|
3015
|
-
return /* @__PURE__ */ l("div", { className:
|
|
3016
|
-
/* @__PURE__ */ n("h2", { style:
|
|
3017
|
-
/* @__PURE__ */ n("p", { style:
|
|
3018
|
-
/* @__PURE__ */ l("form", { onSubmit:
|
|
3019
|
-
/* @__PURE__ */ l("div", { style:
|
|
3020
|
-
/* @__PURE__ */ n("label", { style:
|
|
3218
|
+
const z = b && h && L;
|
|
3219
|
+
return /* @__PURE__ */ l("div", { className: A, style: a.container, children: [
|
|
3220
|
+
/* @__PURE__ */ n("h2", { style: a.title, children: E.resetTitle }),
|
|
3221
|
+
/* @__PURE__ */ n("p", { style: a.subtitle, children: E.resetSubtitle }),
|
|
3222
|
+
/* @__PURE__ */ l("form", { onSubmit: d, style: a.form, children: [
|
|
3223
|
+
/* @__PURE__ */ l("div", { style: a.fieldGroup, children: [
|
|
3224
|
+
/* @__PURE__ */ n("label", { style: a.label, children: E.tokenLabel }),
|
|
3021
3225
|
/* @__PURE__ */ n(
|
|
3022
3226
|
"input",
|
|
3023
3227
|
{
|
|
3024
3228
|
type: "text",
|
|
3025
|
-
value:
|
|
3026
|
-
onChange: (
|
|
3027
|
-
|
|
3229
|
+
value: b,
|
|
3230
|
+
onChange: (B) => {
|
|
3231
|
+
f(B.target.value), W.token && F((O) => ({ ...O, token: !1 }));
|
|
3028
3232
|
},
|
|
3029
|
-
placeholder:
|
|
3030
|
-
style:
|
|
3031
|
-
disabled:
|
|
3233
|
+
placeholder: E.tokenPlaceholder,
|
|
3234
|
+
style: y("token"),
|
|
3235
|
+
disabled: q
|
|
3032
3236
|
}
|
|
3033
3237
|
)
|
|
3034
3238
|
] }),
|
|
3035
|
-
/* @__PURE__ */ l("div", { style:
|
|
3036
|
-
/* @__PURE__ */ n("label", { style:
|
|
3239
|
+
/* @__PURE__ */ l("div", { style: a.fieldGroup, children: [
|
|
3240
|
+
/* @__PURE__ */ n("label", { style: a.label, children: E.newPasswordLabel }),
|
|
3037
3241
|
/* @__PURE__ */ n(
|
|
3038
3242
|
"input",
|
|
3039
3243
|
{
|
|
3040
3244
|
type: "password",
|
|
3041
|
-
value:
|
|
3042
|
-
onChange: (
|
|
3043
|
-
|
|
3245
|
+
value: h,
|
|
3246
|
+
onChange: (B) => {
|
|
3247
|
+
S(B.target.value), W.newPassword && F((O) => ({ ...O, newPassword: !1 }));
|
|
3044
3248
|
},
|
|
3045
|
-
placeholder:
|
|
3046
|
-
style:
|
|
3047
|
-
disabled:
|
|
3249
|
+
placeholder: E.newPasswordPlaceholder,
|
|
3250
|
+
style: y("newPassword"),
|
|
3251
|
+
disabled: q
|
|
3048
3252
|
}
|
|
3049
3253
|
)
|
|
3050
3254
|
] }),
|
|
3051
|
-
/* @__PURE__ */ l("div", { style:
|
|
3052
|
-
/* @__PURE__ */ n("label", { style:
|
|
3255
|
+
/* @__PURE__ */ l("div", { style: a.fieldGroup, children: [
|
|
3256
|
+
/* @__PURE__ */ n("label", { style: a.label, children: E.confirmPasswordLabel }),
|
|
3053
3257
|
/* @__PURE__ */ n(
|
|
3054
3258
|
"input",
|
|
3055
3259
|
{
|
|
3056
3260
|
type: "password",
|
|
3057
|
-
value:
|
|
3058
|
-
onChange: (
|
|
3059
|
-
|
|
3261
|
+
value: L,
|
|
3262
|
+
onChange: (B) => {
|
|
3263
|
+
R(B.target.value), W.confirmPassword && F((O) => ({ ...O, confirmPassword: !1 })), u === E.passwordMismatchError && P("");
|
|
3060
3264
|
},
|
|
3061
|
-
placeholder:
|
|
3062
|
-
style:
|
|
3063
|
-
disabled:
|
|
3265
|
+
placeholder: E.confirmPasswordPlaceholder,
|
|
3266
|
+
style: y("confirmPassword"),
|
|
3267
|
+
disabled: q
|
|
3064
3268
|
}
|
|
3065
3269
|
)
|
|
3066
3270
|
] }),
|
|
@@ -3068,44 +3272,44 @@ function Rt({
|
|
|
3068
3272
|
"button",
|
|
3069
3273
|
{
|
|
3070
3274
|
type: "submit",
|
|
3071
|
-
disabled: !
|
|
3275
|
+
disabled: !z || q,
|
|
3072
3276
|
style: {
|
|
3073
|
-
...
|
|
3074
|
-
...!
|
|
3277
|
+
...G(),
|
|
3278
|
+
...!z || q ? a.buttonDisabled : {}
|
|
3075
3279
|
},
|
|
3076
|
-
children:
|
|
3280
|
+
children: q ? E.resetLoadingText : E.resetSubmitButton
|
|
3077
3281
|
}
|
|
3078
3282
|
),
|
|
3079
|
-
|
|
3080
|
-
|
|
3283
|
+
u && /* @__PURE__ */ n("div", { style: a.errorText, children: u }),
|
|
3284
|
+
C && /* @__PURE__ */ n("div", { style: a.successText, children: C })
|
|
3081
3285
|
] }),
|
|
3082
|
-
/* @__PURE__ */ l("div", { style:
|
|
3083
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
3084
|
-
|
|
3286
|
+
/* @__PURE__ */ l("div", { style: a.linkContainer, children: [
|
|
3287
|
+
/* @__PURE__ */ n("a", { onClick: p, style: a.link, children: E.backToLoginLink }),
|
|
3288
|
+
I && /* @__PURE__ */ l(N, { children: [
|
|
3085
3289
|
/* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3086
|
-
/* @__PURE__ */ n("a", { onClick: () =>
|
|
3290
|
+
/* @__PURE__ */ n("a", { onClick: () => I("request"), style: a.link, children: "Request New Link" })
|
|
3087
3291
|
] })
|
|
3088
3292
|
] })
|
|
3089
3293
|
] });
|
|
3090
3294
|
}
|
|
3091
|
-
const
|
|
3092
|
-
return /* @__PURE__ */ l("div", { className:
|
|
3093
|
-
/* @__PURE__ */ n("h2", { style:
|
|
3094
|
-
/* @__PURE__ */ n("p", { style:
|
|
3095
|
-
/* @__PURE__ */ l("form", { onSubmit:
|
|
3096
|
-
/* @__PURE__ */ l("div", { style:
|
|
3097
|
-
/* @__PURE__ */ n("label", { style:
|
|
3295
|
+
const ee = x;
|
|
3296
|
+
return /* @__PURE__ */ l("div", { className: A, style: a.container, children: [
|
|
3297
|
+
/* @__PURE__ */ n("h2", { style: a.title, children: E.title }),
|
|
3298
|
+
/* @__PURE__ */ n("p", { style: a.subtitle, children: E.subtitle }),
|
|
3299
|
+
/* @__PURE__ */ l("form", { onSubmit: c, style: a.form, children: [
|
|
3300
|
+
/* @__PURE__ */ l("div", { style: a.fieldGroup, children: [
|
|
3301
|
+
/* @__PURE__ */ n("label", { style: a.label, children: E.emailLabel }),
|
|
3098
3302
|
/* @__PURE__ */ n(
|
|
3099
3303
|
"input",
|
|
3100
3304
|
{
|
|
3101
3305
|
type: "email",
|
|
3102
|
-
value:
|
|
3103
|
-
onChange: (
|
|
3104
|
-
|
|
3306
|
+
value: x,
|
|
3307
|
+
onChange: (z) => {
|
|
3308
|
+
T(z.target.value), W.email && F((B) => ({ ...B, email: !1 }));
|
|
3105
3309
|
},
|
|
3106
|
-
placeholder:
|
|
3107
|
-
style:
|
|
3108
|
-
disabled:
|
|
3310
|
+
placeholder: E.emailPlaceholder,
|
|
3311
|
+
style: y("email"),
|
|
3312
|
+
disabled: q
|
|
3109
3313
|
}
|
|
3110
3314
|
)
|
|
3111
3315
|
] }),
|
|
@@ -3113,27 +3317,27 @@ function Rt({
|
|
|
3113
3317
|
"button",
|
|
3114
3318
|
{
|
|
3115
3319
|
type: "submit",
|
|
3116
|
-
disabled: !
|
|
3320
|
+
disabled: !ee || q,
|
|
3117
3321
|
style: {
|
|
3118
|
-
...
|
|
3119
|
-
...!
|
|
3322
|
+
...G(),
|
|
3323
|
+
...!ee || q ? a.buttonDisabled : {}
|
|
3120
3324
|
},
|
|
3121
|
-
children:
|
|
3325
|
+
children: q ? E.loadingText : E.submitButton
|
|
3122
3326
|
}
|
|
3123
3327
|
),
|
|
3124
|
-
|
|
3125
|
-
|
|
3328
|
+
u && /* @__PURE__ */ n("div", { style: a.errorText, children: u }),
|
|
3329
|
+
C && /* @__PURE__ */ n("div", { style: a.successText, children: C })
|
|
3126
3330
|
] }),
|
|
3127
|
-
/* @__PURE__ */ l("div", { style:
|
|
3128
|
-
/* @__PURE__ */ n("a", { onClick:
|
|
3129
|
-
|
|
3331
|
+
/* @__PURE__ */ l("div", { style: a.linkContainer, children: [
|
|
3332
|
+
/* @__PURE__ */ n("a", { onClick: p, style: a.link, children: E.backToLoginLink }),
|
|
3333
|
+
I && /* @__PURE__ */ l(N, { children: [
|
|
3130
3334
|
/* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3131
|
-
/* @__PURE__ */ n("a", { onClick: () =>
|
|
3335
|
+
/* @__PURE__ */ n("a", { onClick: () => I("reset"), style: a.link, children: "I have a token" })
|
|
3132
3336
|
] })
|
|
3133
3337
|
] })
|
|
3134
3338
|
] });
|
|
3135
3339
|
}
|
|
3136
|
-
class
|
|
3340
|
+
class Ut {
|
|
3137
3341
|
constructor(e, t) {
|
|
3138
3342
|
this.httpService = e, this.sessionManager = t;
|
|
3139
3343
|
}
|
|
@@ -3154,12 +3358,12 @@ class Ct {
|
|
|
3154
3358
|
throw new Error("SessionManager is required for private endpoints");
|
|
3155
3359
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
3156
3360
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
|
|
3157
|
-
const s = `/permissions/${r.toString() ? `?${r.toString()}` : ""}`,
|
|
3361
|
+
const s = `/permissions/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(s, {
|
|
3158
3362
|
headers: t
|
|
3159
3363
|
});
|
|
3160
3364
|
return {
|
|
3161
|
-
permissions:
|
|
3162
|
-
meta:
|
|
3365
|
+
permissions: o.data,
|
|
3366
|
+
meta: o.meta
|
|
3163
3367
|
};
|
|
3164
3368
|
}
|
|
3165
3369
|
async getPermissionById(e) {
|
|
@@ -3194,14 +3398,14 @@ class Ct {
|
|
|
3194
3398
|
async getAppPermissions(e, t) {
|
|
3195
3399
|
const r = new URLSearchParams();
|
|
3196
3400
|
t != null && t.page && r.append("page", t.page.toString()), t != null && t.limit && r.append("limit", t.limit.toString()), t != null && t.sortBy && r.append("sortBy", t.sortBy), t != null && t.sortOrder && r.append("sortOrder", t.sortOrder);
|
|
3197
|
-
const s = `/permissions/apps/${e}${r.toString() ? `?${r.toString()}` : ""}`,
|
|
3401
|
+
const s = `/permissions/apps/${e}${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(s);
|
|
3198
3402
|
return {
|
|
3199
|
-
permissions:
|
|
3200
|
-
meta:
|
|
3403
|
+
permissions: o.data,
|
|
3404
|
+
meta: o.meta
|
|
3201
3405
|
};
|
|
3202
3406
|
}
|
|
3203
3407
|
}
|
|
3204
|
-
class
|
|
3408
|
+
class qt {
|
|
3205
3409
|
constructor(e, t) {
|
|
3206
3410
|
this.httpService = e, this.sessionManager = t;
|
|
3207
3411
|
}
|
|
@@ -3218,12 +3422,12 @@ class It {
|
|
|
3218
3422
|
async getSubscriptionPlans(e) {
|
|
3219
3423
|
const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
|
|
3220
3424
|
e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder), e != null && e.appId && r.append("appId", e.appId);
|
|
3221
|
-
const s = `/subscription-plans/${r.toString() ? `?${r.toString()}` : ""}`,
|
|
3425
|
+
const s = `/subscription-plans/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(s, {
|
|
3222
3426
|
headers: t
|
|
3223
3427
|
});
|
|
3224
3428
|
return {
|
|
3225
|
-
plans:
|
|
3226
|
-
meta:
|
|
3429
|
+
plans: o.data,
|
|
3430
|
+
meta: o.meta
|
|
3227
3431
|
};
|
|
3228
3432
|
}
|
|
3229
3433
|
async getSubscriptionPlanById(e) {
|
|
@@ -3252,7 +3456,7 @@ class It {
|
|
|
3252
3456
|
});
|
|
3253
3457
|
}
|
|
3254
3458
|
}
|
|
3255
|
-
class
|
|
3459
|
+
class zt {
|
|
3256
3460
|
constructor(e) {
|
|
3257
3461
|
this.httpService = e;
|
|
3258
3462
|
}
|
|
@@ -3261,7 +3465,7 @@ class Ft {
|
|
|
3261
3465
|
return await this.httpService.get("/health");
|
|
3262
3466
|
}
|
|
3263
3467
|
}
|
|
3264
|
-
class
|
|
3468
|
+
class Ot {
|
|
3265
3469
|
// Date string to Date object
|
|
3266
3470
|
static toDate(e) {
|
|
3267
3471
|
return new Date(e);
|
|
@@ -3384,44 +3588,44 @@ class Ht {
|
|
|
3384
3588
|
}
|
|
3385
3589
|
}
|
|
3386
3590
|
export {
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3591
|
+
Ot as ApiMappers,
|
|
3592
|
+
be as AppApiService,
|
|
3593
|
+
St as AppProvider,
|
|
3594
|
+
Ne as AuthApiService,
|
|
3595
|
+
Tt as AuthProvider,
|
|
3596
|
+
Ft as FeatureFlag,
|
|
3597
|
+
ze as FeatureFlagApiService,
|
|
3598
|
+
Pt as FeatureFlagProvider,
|
|
3599
|
+
zt as HealthApiService,
|
|
3600
|
+
re as HttpService,
|
|
3601
|
+
Rt as LandingRoute,
|
|
3602
|
+
$t as LoginForm,
|
|
3603
|
+
Ht as MagicLinkForm,
|
|
3604
|
+
Nt as MagicLinkVerify,
|
|
3605
|
+
Bt as PasswordRecoveryForm,
|
|
3606
|
+
Ut as PermissionApiService,
|
|
3607
|
+
It as Protected,
|
|
3608
|
+
Et as ProtectedRoute,
|
|
3609
|
+
Se as RoleApiService,
|
|
3610
|
+
ye as SessionManager,
|
|
3611
|
+
Dt as SignupForm,
|
|
3612
|
+
je as SubscriptionApiService,
|
|
3613
|
+
Lt as SubscriptionGuard,
|
|
3614
|
+
qt as SubscriptionPlanApiService,
|
|
3615
|
+
Mt as SubscriptionProvider,
|
|
3616
|
+
ce as TenantApiService,
|
|
3617
|
+
xt as TenantProvider,
|
|
3618
|
+
Ct as TenantRoute,
|
|
3619
|
+
Be as UserApiService,
|
|
3620
|
+
ie as UserType,
|
|
3621
|
+
vt as useApi,
|
|
3622
|
+
he as useApp,
|
|
3623
|
+
oe as useAuth,
|
|
3624
|
+
Oe as useFeatureFlags,
|
|
3625
|
+
At as useSettings,
|
|
3626
|
+
Ve as useSubscription,
|
|
3627
|
+
fe as useTenant,
|
|
3628
|
+
se as useTenantInfo,
|
|
3629
|
+
kt as useTenantSettings
|
|
3426
3630
|
};
|
|
3427
3631
|
//# sourceMappingURL=index.es.js.map
|