@skylabs-digital/react-identity-access 2.14.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +550 -545
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/providers/TenantProvider.d.ts +2 -1
- package/dist/providers/TenantProvider.d.ts.map +1 -1
- package/dist/utils/tenantDetection.d.ts +2 -1
- package/dist/utils/tenantDetection.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as s, Fragment as _, jsxs as d } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as ue, useMemo as Z, useState as
|
|
3
|
-
import { useLocation as be, Navigate as me, useNavigate as
|
|
4
|
-
class
|
|
2
|
+
import { createContext as ue, useMemo as Z, useState as x, useCallback as re, useEffect as X, useContext as ie, useRef as Ve } from "react";
|
|
3
|
+
import { useLocation as be, Navigate as me, useNavigate as ut, useSearchParams as ht } from "react-router-dom";
|
|
4
|
+
class oe {
|
|
5
5
|
// SessionManager instance
|
|
6
6
|
constructor(e, t = 1e4) {
|
|
7
7
|
this.baseUrl = e.replace(/\/$/, ""), this.timeout = t;
|
|
@@ -12,16 +12,16 @@ class ie {
|
|
|
12
12
|
getBaseUrl() {
|
|
13
13
|
return this.baseUrl;
|
|
14
14
|
}
|
|
15
|
-
async request(e, t, n,
|
|
16
|
-
return this.executeRequest(e, t, n,
|
|
15
|
+
async request(e, t, n, i) {
|
|
16
|
+
return this.executeRequest(e, t, n, i, !1);
|
|
17
17
|
}
|
|
18
|
-
async executeRequest(e, t, n,
|
|
19
|
-
const a = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, p = (
|
|
18
|
+
async executeRequest(e, t, n, i, o = !1) {
|
|
19
|
+
const a = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, p = (i == null ? void 0 : i.timeout) || this.timeout;
|
|
20
20
|
let f = {
|
|
21
21
|
"Content-Type": "application/json",
|
|
22
|
-
...
|
|
22
|
+
...i == null ? void 0 : i.headers
|
|
23
23
|
};
|
|
24
|
-
if (!(
|
|
24
|
+
if (!(i != null && i.skipAuth) && this.sessionManager)
|
|
25
25
|
try {
|
|
26
26
|
const b = await this.sessionManager.getAuthHeaders();
|
|
27
27
|
f = { ...f, ...b };
|
|
@@ -36,11 +36,11 @@ class ie {
|
|
|
36
36
|
body: n ? JSON.stringify(n) : void 0,
|
|
37
37
|
signal: w.signal
|
|
38
38
|
});
|
|
39
|
-
if (clearTimeout(u), b.status === 401 && !(
|
|
39
|
+
if (clearTimeout(u), b.status === 401 && !(i != null && i.skipRetry) && !o && this.sessionManager)
|
|
40
40
|
try {
|
|
41
41
|
const T = this.sessionManager.getTokens();
|
|
42
42
|
if (T != null && T.refreshToken)
|
|
43
|
-
return await this.sessionManager.getAuthHeaders(), this.executeRequest(e, t, n,
|
|
43
|
+
return await this.sessionManager.getAuthHeaders(), this.executeRequest(e, t, n, i, !0);
|
|
44
44
|
} catch {
|
|
45
45
|
throw new Error(`HTTP ${b.status}: ${b.statusText}`);
|
|
46
46
|
}
|
|
@@ -65,7 +65,7 @@ class ie {
|
|
|
65
65
|
return this.request("DELETE", e, void 0, t);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
class
|
|
68
|
+
class He {
|
|
69
69
|
constructor(e, t) {
|
|
70
70
|
this.httpService = e, this.sessionManager = t;
|
|
71
71
|
}
|
|
@@ -78,12 +78,12 @@ class $e {
|
|
|
78
78
|
async getApps(e) {
|
|
79
79
|
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
80
80
|
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder);
|
|
81
|
-
const
|
|
81
|
+
const i = `/apps/${n.toString() ? `?${n.toString()}` : ""}`, o = await this.httpService.get(i, {
|
|
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) {
|
|
@@ -110,11 +110,11 @@ class $e {
|
|
|
110
110
|
)).data;
|
|
111
111
|
}
|
|
112
112
|
async updateSettingsSchema(e, t, n) {
|
|
113
|
-
const
|
|
113
|
+
const i = await this.sessionManager.getAuthHeaders();
|
|
114
114
|
return (await this.httpService.put(
|
|
115
115
|
`/apps/${e}/settings-schema`,
|
|
116
116
|
{ schema: t, defaultSettings: n },
|
|
117
|
-
{ headers:
|
|
117
|
+
{ headers: i }
|
|
118
118
|
)).data;
|
|
119
119
|
}
|
|
120
120
|
async exportConfig(e) {
|
|
@@ -124,8 +124,8 @@ class $e {
|
|
|
124
124
|
})).data;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
const
|
|
128
|
-
function
|
|
127
|
+
const Ie = ue(null);
|
|
128
|
+
function hn({ config: r, children: e }) {
|
|
129
129
|
const t = Z(
|
|
130
130
|
() => {
|
|
131
131
|
var g, T, I;
|
|
@@ -137,7 +137,7 @@ function un({ config: r, children: e }) {
|
|
|
137
137
|
};
|
|
138
138
|
},
|
|
139
139
|
[r.cache, r.appId]
|
|
140
|
-
), [n,
|
|
140
|
+
), [n, i] = x(() => {
|
|
141
141
|
if (!t.enabled) return null;
|
|
142
142
|
try {
|
|
143
143
|
const g = localStorage.getItem(t.storageKey);
|
|
@@ -147,7 +147,7 @@ function un({ config: r, children: e }) {
|
|
|
147
147
|
} catch {
|
|
148
148
|
return null;
|
|
149
149
|
}
|
|
150
|
-
}), [
|
|
150
|
+
}), [o, a] = x(!n), [p, f] = x(null), w = Z(() => {
|
|
151
151
|
const g = () => {
|
|
152
152
|
u();
|
|
153
153
|
};
|
|
@@ -156,17 +156,17 @@ function un({ config: r, children: e }) {
|
|
|
156
156
|
baseUrl: r.baseUrl,
|
|
157
157
|
// App info
|
|
158
158
|
appInfo: n,
|
|
159
|
-
isAppLoading:
|
|
159
|
+
isAppLoading: o,
|
|
160
160
|
appError: p,
|
|
161
161
|
retryApp: g
|
|
162
162
|
};
|
|
163
|
-
}, [r, n,
|
|
163
|
+
}, [r, n, o, p]), u = re(
|
|
164
164
|
async (g = !1) => {
|
|
165
165
|
if (!(!g && t.enabled && n))
|
|
166
166
|
try {
|
|
167
167
|
a(!0), f(null);
|
|
168
|
-
const T = new
|
|
169
|
-
if (
|
|
168
|
+
const T = new oe(r.baseUrl), N = await new He(T, {}).getPublicAppInfo(r.appId);
|
|
169
|
+
if (i(N), t.enabled)
|
|
170
170
|
try {
|
|
171
171
|
const M = {
|
|
172
172
|
data: N,
|
|
@@ -179,7 +179,7 @@ function un({ config: r, children: e }) {
|
|
|
179
179
|
}
|
|
180
180
|
} catch (T) {
|
|
181
181
|
const I = T instanceof Error ? T : new Error("Failed to load app information");
|
|
182
|
-
f(I),
|
|
182
|
+
f(I), i(null);
|
|
183
183
|
} finally {
|
|
184
184
|
a(!1);
|
|
185
185
|
}
|
|
@@ -192,8 +192,8 @@ function un({ config: r, children: e }) {
|
|
|
192
192
|
if (!g) return;
|
|
193
193
|
const T = JSON.parse(g);
|
|
194
194
|
if (Date.now() - T.timestamp > t.ttl * 0.5) {
|
|
195
|
-
const N = new
|
|
196
|
-
|
|
195
|
+
const N = new oe(r.baseUrl), P = await new He(N, {}).getPublicAppInfo(r.appId);
|
|
196
|
+
i(P);
|
|
197
197
|
const h = {
|
|
198
198
|
data: P,
|
|
199
199
|
timestamp: Date.now(),
|
|
@@ -207,18 +207,18 @@ function un({ config: r, children: e }) {
|
|
|
207
207
|
}, [r, t, n]);
|
|
208
208
|
return X(() => {
|
|
209
209
|
n ? b() : u();
|
|
210
|
-
}, []), /* @__PURE__ */ s(
|
|
210
|
+
}, []), /* @__PURE__ */ s(Ie.Provider, { value: w, children: e });
|
|
211
211
|
}
|
|
212
212
|
function ye() {
|
|
213
|
-
const r =
|
|
213
|
+
const r = ie(Ie);
|
|
214
214
|
if (!r)
|
|
215
215
|
throw new Error("useApp must be used within an AppProvider");
|
|
216
216
|
return r;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
return
|
|
218
|
+
function je() {
|
|
219
|
+
return ie(Ie);
|
|
220
220
|
}
|
|
221
|
-
const
|
|
221
|
+
const gn = ye;
|
|
222
222
|
class Ae {
|
|
223
223
|
constructor(e = {}) {
|
|
224
224
|
this.refreshPromise = null, this.refreshQueue = [], e.tenantSlug !== void 0 ? this.storageKey = e.tenantSlug ? `auth_tokens_${e.tenantSlug}` : "auth_tokens" : this.storageKey = e.storageKey || "auth_tokens", this.autoRefresh = e.autoRefresh ?? !0, this.refreshThreshold = e.refreshThreshold || 3e5, this.onRefreshFailed = e.onRefreshFailed, this.baseUrl = e.baseUrl || "", this.tokenStorage = e.tokenStorage || this.createTokenStorage(this.storageKey);
|
|
@@ -256,13 +256,13 @@ class Ae {
|
|
|
256
256
|
this.tokenStorage.set(t);
|
|
257
257
|
}
|
|
258
258
|
getTokens() {
|
|
259
|
-
const { accessToken: e, refreshToken: t, expiresAt: n, expiresIn:
|
|
259
|
+
const { accessToken: e, refreshToken: t, expiresAt: n, expiresIn: i, tokenType: o } = this.tokenStorage.get() || {};
|
|
260
260
|
return e ? {
|
|
261
261
|
accessToken: e,
|
|
262
262
|
refreshToken: t,
|
|
263
263
|
expiresAt: n,
|
|
264
|
-
expiresIn:
|
|
265
|
-
tokenType:
|
|
264
|
+
expiresIn: i,
|
|
265
|
+
tokenType: o
|
|
266
266
|
} : null;
|
|
267
267
|
}
|
|
268
268
|
clearTokens() {
|
|
@@ -298,10 +298,10 @@ class Ae {
|
|
|
298
298
|
try {
|
|
299
299
|
await this.refreshPromise;
|
|
300
300
|
const t = this.getTokens(), n = t != null && t.accessToken ? { Authorization: `Bearer ${t.accessToken}` } : {};
|
|
301
|
-
return this.refreshQueue.forEach(({ resolve:
|
|
301
|
+
return this.refreshQueue.forEach(({ resolve: i }) => i(n)), this.refreshQueue = [], n;
|
|
302
302
|
} catch (t) {
|
|
303
303
|
const n = t instanceof Error ? t : new Error("Token refresh failed");
|
|
304
|
-
return this.refreshQueue.forEach(({ reject:
|
|
304
|
+
return this.refreshQueue.forEach(({ reject: i }) => i(n)), this.refreshQueue = [], this.clearSession(), this.onRefreshFailed && this.onRefreshFailed(), {};
|
|
305
305
|
} finally {
|
|
306
306
|
this.refreshPromise = null;
|
|
307
307
|
}
|
|
@@ -320,11 +320,11 @@ class Ae {
|
|
|
320
320
|
});
|
|
321
321
|
if (!n.ok)
|
|
322
322
|
throw new Error(`Token refresh failed: ${n.status} ${n.statusText}`);
|
|
323
|
-
const
|
|
323
|
+
const i = await n.json();
|
|
324
324
|
this.setTokens({
|
|
325
|
-
accessToken:
|
|
326
|
-
refreshToken:
|
|
327
|
-
expiresIn:
|
|
325
|
+
accessToken: i.accessToken,
|
|
326
|
+
refreshToken: i.refreshToken || e,
|
|
327
|
+
expiresIn: i.expiresIn
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
setUser(e) {
|
|
@@ -352,8 +352,8 @@ class Ae {
|
|
|
352
352
|
if (!(e != null && e.accessToken)) return null;
|
|
353
353
|
const t = e.accessToken.split(".");
|
|
354
354
|
if (t.length !== 3) return null;
|
|
355
|
-
const n = t[1],
|
|
356
|
-
return JSON.parse(
|
|
355
|
+
const n = t[1], i = atob(n.replace(/-/g, "+").replace(/_/g, "/"));
|
|
356
|
+
return JSON.parse(i);
|
|
357
357
|
} catch {
|
|
358
358
|
return null;
|
|
359
359
|
}
|
|
@@ -372,7 +372,7 @@ class Ae {
|
|
|
372
372
|
return e !== null && !this.isTokenExpired(e);
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
class
|
|
375
|
+
class gt {
|
|
376
376
|
constructor(e) {
|
|
377
377
|
this.httpService = e;
|
|
378
378
|
}
|
|
@@ -428,7 +428,7 @@ class ht {
|
|
|
428
428
|
});
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
class
|
|
431
|
+
class Be {
|
|
432
432
|
constructor(e, t) {
|
|
433
433
|
this.httpService = e, this.sessionManager = t;
|
|
434
434
|
}
|
|
@@ -468,10 +468,10 @@ class He {
|
|
|
468
468
|
async getRolesByApp(e, t) {
|
|
469
469
|
const n = new URLSearchParams();
|
|
470
470
|
t != null && t.page && n.append("page", t.page.toString()), t != null && t.limit && n.append("limit", t.limit.toString()), t != null && t.sortBy && n.append("sortBy", t.sortBy), t != null && t.sortOrder && n.append("sortOrder", t.sortOrder);
|
|
471
|
-
const
|
|
471
|
+
const i = `/roles/app/${e}${n.toString() ? `?${n.toString()}` : ""}`, o = await this.httpService.get(i);
|
|
472
472
|
return {
|
|
473
|
-
roles:
|
|
474
|
-
meta:
|
|
473
|
+
roles: o.data,
|
|
474
|
+
meta: o.meta
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
477
|
async assignRole(e, t) {
|
|
@@ -493,9 +493,9 @@ class He {
|
|
|
493
493
|
async getUserRoles(e, t) {
|
|
494
494
|
if (!this.sessionManager)
|
|
495
495
|
throw new Error("SessionManager is required for private endpoints");
|
|
496
|
-
const n = await this.sessionManager.getAuthHeaders(),
|
|
497
|
-
t != null && t.page &&
|
|
498
|
-
const
|
|
496
|
+
const n = await this.sessionManager.getAuthHeaders(), i = new URLSearchParams();
|
|
497
|
+
t != null && t.page && i.append("page", t.page.toString()), t != null && t.limit && i.append("limit", t.limit.toString()), t != null && t.sortBy && i.append("sortBy", t.sortBy), t != null && t.sortOrder && i.append("sortOrder", t.sortOrder);
|
|
498
|
+
const o = `/roles/user/${e}${i.toString() ? `?${i.toString()}` : ""}`, a = await this.httpService.get(o, {
|
|
499
499
|
headers: n
|
|
500
500
|
});
|
|
501
501
|
return {
|
|
@@ -504,7 +504,7 @@ class He {
|
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
class
|
|
507
|
+
class pt {
|
|
508
508
|
constructor(e, t) {
|
|
509
509
|
this.httpService = e, this.sessionManager = t;
|
|
510
510
|
}
|
|
@@ -517,12 +517,12 @@ class gt {
|
|
|
517
517
|
async getUsers(e) {
|
|
518
518
|
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
519
519
|
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder);
|
|
520
|
-
const
|
|
520
|
+
const i = `/users/${n.toString() ? `?${n.toString()}` : ""}`, o = await this.httpService.get(i, {
|
|
521
521
|
headers: t
|
|
522
522
|
});
|
|
523
523
|
return {
|
|
524
|
-
users:
|
|
525
|
-
meta:
|
|
524
|
+
users: o.data,
|
|
525
|
+
meta: o.meta
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
528
|
async getUserById(e) {
|
|
@@ -561,12 +561,12 @@ class fe {
|
|
|
561
561
|
throw new Error("SessionManager is required for private endpoints");
|
|
562
562
|
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
563
563
|
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder);
|
|
564
|
-
const
|
|
564
|
+
const i = `/tenants/${n.toString() ? `?${n.toString()}` : ""}`, o = await this.httpService.get(i, {
|
|
565
565
|
headers: t
|
|
566
566
|
});
|
|
567
567
|
return {
|
|
568
|
-
tenants:
|
|
569
|
-
meta:
|
|
568
|
+
tenants: o.data,
|
|
569
|
+
meta: o.meta
|
|
570
570
|
};
|
|
571
571
|
}
|
|
572
572
|
async getTenantById(e) {
|
|
@@ -622,15 +622,15 @@ class fe {
|
|
|
622
622
|
)).data;
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function ft(r, e) {
|
|
626
626
|
if (r === "localhost" || r.startsWith("127.") || r.startsWith("192.168."))
|
|
627
627
|
return null;
|
|
628
628
|
if (e) {
|
|
629
|
-
const
|
|
630
|
-
if (
|
|
629
|
+
const i = e.toLowerCase(), o = r.toLowerCase();
|
|
630
|
+
if (o === i || o === `www.${i}`)
|
|
631
631
|
return null;
|
|
632
|
-
if (
|
|
633
|
-
const a =
|
|
632
|
+
if (o.endsWith(`.${i}`)) {
|
|
633
|
+
const a = o.slice(0, -(i.length + 1));
|
|
634
634
|
return a === "www" ? null : a;
|
|
635
635
|
}
|
|
636
636
|
return null;
|
|
@@ -638,26 +638,26 @@ function pt(r, e) {
|
|
|
638
638
|
const n = r.split(".");
|
|
639
639
|
return n.length >= 3 && n[0] !== "www" ? n[0] : null;
|
|
640
640
|
}
|
|
641
|
-
function
|
|
642
|
-
const
|
|
643
|
-
return
|
|
644
|
-
}
|
|
645
|
-
function mt(r, e, t) {
|
|
646
|
-
const { tenantMode: n, baseDomain: o, selectorParam: i } = r;
|
|
647
|
-
return n === "subdomain" ? pt(e.hostname, o) : n === "selector" ? ft(e.search, i, t) : null;
|
|
641
|
+
function mt(r, e = "tenant", t) {
|
|
642
|
+
const i = new URLSearchParams(r).get(e);
|
|
643
|
+
return i ? (t && t.setItem("tenant", i), i) : t ? t.getItem("tenant") : null;
|
|
648
644
|
}
|
|
649
645
|
function yt(r, e, t) {
|
|
646
|
+
const { tenantMode: n, baseDomain: i, selectorParam: o, fixedTenantSlug: a } = r;
|
|
647
|
+
return n === "fixed" ? a || null : n === "subdomain" ? ft(e.hostname, i) : n === "selector" ? mt(e.search, o, t) : null;
|
|
648
|
+
}
|
|
649
|
+
function wt(r, e, t) {
|
|
650
650
|
if (t)
|
|
651
651
|
return `${r}.${t}`;
|
|
652
652
|
const n = e.split(".");
|
|
653
653
|
return n.length === 2 ? `${r}.${e}` : n.length >= 3 ? (n[0] = r, n.join(".")) : null;
|
|
654
654
|
}
|
|
655
655
|
const de = "_auth";
|
|
656
|
-
function
|
|
656
|
+
function qe(r) {
|
|
657
657
|
const e = JSON.stringify(r);
|
|
658
658
|
return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
659
659
|
}
|
|
660
|
-
function
|
|
660
|
+
function bt(r) {
|
|
661
661
|
try {
|
|
662
662
|
let e = r.replace(/-/g, "+").replace(/_/g, "/");
|
|
663
663
|
for (; e.length % 4; )
|
|
@@ -668,7 +668,7 @@ function wt(r) {
|
|
|
668
668
|
return null;
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function St() {
|
|
672
672
|
if (typeof window > "u")
|
|
673
673
|
return console.log("[CrossDomainAuth] SSR environment, skipping URL token extraction"), null;
|
|
674
674
|
const e = new URLSearchParams(window.location.search).get(de);
|
|
@@ -677,7 +677,7 @@ function bt() {
|
|
|
677
677
|
searchParams: window.location.search,
|
|
678
678
|
encodedLength: e == null ? void 0 : e.length
|
|
679
679
|
}), !e) return null;
|
|
680
|
-
const t =
|
|
680
|
+
const t = bt(e);
|
|
681
681
|
return console.log("[CrossDomainAuth] Token decode result:", {
|
|
682
682
|
success: !!t,
|
|
683
683
|
hasAccessToken: !!(t != null && t.accessToken),
|
|
@@ -685,7 +685,7 @@ function bt() {
|
|
|
685
685
|
expiresIn: t == null ? void 0 : t.expiresIn
|
|
686
686
|
}), t;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function vt() {
|
|
689
689
|
if (typeof window > "u") return;
|
|
690
690
|
const r = new URL(window.location.href);
|
|
691
691
|
r.searchParams.delete(de), console.log("[CrossDomainAuth] Clearing auth tokens from URL", {
|
|
@@ -693,20 +693,21 @@ function St() {
|
|
|
693
693
|
newUrl: r.toString()
|
|
694
694
|
}), window.history.replaceState({}, "", r.toString());
|
|
695
695
|
}
|
|
696
|
-
const
|
|
697
|
-
function
|
|
698
|
-
const { baseUrl: t, appInfo: n, appId:
|
|
696
|
+
const Me = ue(null);
|
|
697
|
+
function pn({ config: r, children: e }) {
|
|
698
|
+
const { baseUrl: t, appInfo: n, appId: i } = ye(), o = re(() => typeof window > "u" ? null : yt(
|
|
699
699
|
{
|
|
700
700
|
tenantMode: r.tenantMode || "selector",
|
|
701
701
|
baseDomain: r.baseDomain,
|
|
702
|
-
selectorParam: r.selectorParam
|
|
702
|
+
selectorParam: r.selectorParam,
|
|
703
|
+
fixedTenantSlug: r.fixedTenantSlug
|
|
703
704
|
},
|
|
704
705
|
{
|
|
705
706
|
hostname: window.location.hostname,
|
|
706
707
|
search: window.location.search
|
|
707
708
|
},
|
|
708
709
|
window.localStorage
|
|
709
|
-
), [r.tenantMode, r.baseDomain, r.selectorParam]), [a, p] =
|
|
710
|
+
), [r.tenantMode, r.baseDomain, r.selectorParam, r.fixedTenantSlug]), [a, p] = x(() => o()), f = Z(
|
|
710
711
|
() => {
|
|
711
712
|
var c, H, F;
|
|
712
713
|
return {
|
|
@@ -717,7 +718,7 @@ function gn({ config: r, children: e }) {
|
|
|
717
718
|
};
|
|
718
719
|
},
|
|
719
720
|
[r.cache, a]
|
|
720
|
-
), [w, u] =
|
|
721
|
+
), [w, u] = x(() => {
|
|
721
722
|
if (r.initialTenant) return r.initialTenant;
|
|
722
723
|
if (!f.enabled || !a) return null;
|
|
723
724
|
try {
|
|
@@ -728,17 +729,18 @@ function gn({ config: r, children: e }) {
|
|
|
728
729
|
} catch {
|
|
729
730
|
return null;
|
|
730
731
|
}
|
|
731
|
-
}), [b, g] =
|
|
732
|
+
}), [b, g] = x(!w && !r.initialTenant), [T, I] = x(null), [N, M] = x(null), [P, h] = x(!1), [A, S] = x(null);
|
|
732
733
|
X(() => {
|
|
733
|
-
|
|
734
|
+
if (r.tenantMode === "fixed") return;
|
|
735
|
+
const c = o();
|
|
734
736
|
p(c);
|
|
735
|
-
}, [
|
|
737
|
+
}, [o, r.tenantMode]);
|
|
736
738
|
const L = (n == null ? void 0 : n.settingsSchema) || null, E = re(
|
|
737
739
|
async (c, H = !1) => {
|
|
738
740
|
if (!(!H && f.enabled && w && w.domain === c))
|
|
739
741
|
try {
|
|
740
742
|
g(!0), I(null);
|
|
741
|
-
const F = new
|
|
743
|
+
const F = new oe(t), m = await new fe(F, i).getPublicTenantInfo(c);
|
|
742
744
|
if (u(m), f.enabled)
|
|
743
745
|
try {
|
|
744
746
|
const v = {
|
|
@@ -757,7 +759,7 @@ function gn({ config: r, children: e }) {
|
|
|
757
759
|
g(!1);
|
|
758
760
|
}
|
|
759
761
|
},
|
|
760
|
-
[t,
|
|
762
|
+
[t, i, f, w]
|
|
761
763
|
), C = re(async () => {
|
|
762
764
|
if (!(!f.enabled || !w || !a))
|
|
763
765
|
try {
|
|
@@ -765,7 +767,7 @@ function gn({ config: r, children: e }) {
|
|
|
765
767
|
if (!c) return;
|
|
766
768
|
const H = JSON.parse(c);
|
|
767
769
|
if (Date.now() - H.timestamp > f.ttl * 0.5) {
|
|
768
|
-
const y = new
|
|
770
|
+
const y = new oe(t), v = await new fe(y, i).getPublicTenantInfo(a);
|
|
769
771
|
u(v);
|
|
770
772
|
const G = {
|
|
771
773
|
data: v,
|
|
@@ -777,11 +779,11 @@ function gn({ config: r, children: e }) {
|
|
|
777
779
|
} catch (c) {
|
|
778
780
|
console.warn("Background tenant refresh failed:", c);
|
|
779
781
|
}
|
|
780
|
-
}, [t,
|
|
782
|
+
}, [t, i, f, w, a]), R = re(async () => {
|
|
781
783
|
if (w != null && w.id)
|
|
782
784
|
try {
|
|
783
785
|
h(!0), S(null);
|
|
784
|
-
const c = new
|
|
786
|
+
const c = new oe(t), F = await new fe(c, w.appId).getTenantSettings(w.id);
|
|
785
787
|
M(F);
|
|
786
788
|
} catch (c) {
|
|
787
789
|
const H = c instanceof Error ? c : new Error("Failed to load tenant settings");
|
|
@@ -806,8 +808,8 @@ function gn({ config: r, children: e }) {
|
|
|
806
808
|
}
|
|
807
809
|
if (m != null) {
|
|
808
810
|
if (y.type) {
|
|
809
|
-
const G = y.type,
|
|
810
|
-
G === "string" &&
|
|
811
|
+
const G = y.type, Y = typeof m;
|
|
812
|
+
G === "string" && Y !== "string" ? H.push(`Field '${F}' must be a string`) : (G === "number" || G === "integer") && Y !== "number" ? H.push(`Field '${F}' must be a number`) : G === "boolean" && Y !== "boolean" ? H.push(`Field '${F}' must be a boolean`) : G === "array" && !Array.isArray(m) && H.push(`Field '${F}' must be an array`);
|
|
811
813
|
}
|
|
812
814
|
y.minLength !== void 0 && typeof m == "string" && m.length < y.minLength && H.push(
|
|
813
815
|
`Field '${F}' must be at least ${y.minLength} characters long`
|
|
@@ -836,30 +838,37 @@ function gn({ config: r, children: e }) {
|
|
|
836
838
|
const D = re(
|
|
837
839
|
(c, H) => {
|
|
838
840
|
const { mode: F = "reload", tokens: y, redirectPath: m } = H || {}, v = r.tenantMode || "selector";
|
|
841
|
+
if (v === "fixed") {
|
|
842
|
+
console.warn(
|
|
843
|
+
"[TenantProvider] switchTenant is a no-op in fixed mode. Tenant is always:",
|
|
844
|
+
r.fixedTenantSlug
|
|
845
|
+
), m && (window.location.href = m);
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
839
848
|
if (localStorage.setItem("tenant", c), v === "subdomain") {
|
|
840
|
-
const G = window.location.hostname,
|
|
849
|
+
const G = window.location.hostname, Y = wt(
|
|
841
850
|
c,
|
|
842
851
|
G,
|
|
843
852
|
r.baseDomain
|
|
844
853
|
);
|
|
845
|
-
if (!
|
|
854
|
+
if (!Y) {
|
|
846
855
|
console.warn(
|
|
847
856
|
"[TenantProvider] Cannot switch subdomain, invalid hostname:",
|
|
848
857
|
G
|
|
849
858
|
);
|
|
850
859
|
return;
|
|
851
860
|
}
|
|
852
|
-
const q = m || window.location.pathname, O = new URL(`${window.location.protocol}//${
|
|
861
|
+
const q = m || window.location.pathname, O = new URL(`${window.location.protocol}//${Y}${q}`);
|
|
853
862
|
new URLSearchParams(window.location.search).forEach((k, K) => {
|
|
854
863
|
K !== de && O.searchParams.set(K, k);
|
|
855
|
-
}), y && O.searchParams.set(de,
|
|
864
|
+
}), y && O.searchParams.set(de, qe(y)), window.location.href = O.toString();
|
|
856
865
|
} else if (v === "selector") {
|
|
857
|
-
const G = m || window.location.pathname,
|
|
858
|
-
if (
|
|
859
|
-
const q = `${G}?${
|
|
866
|
+
const G = m || window.location.pathname, Y = new URLSearchParams(window.location.search);
|
|
867
|
+
if (Y.set(r.selectorParam || "tenant", c), Y.delete(de), y && Y.set(de, qe(y)), F === "reload") {
|
|
868
|
+
const q = `${G}?${Y.toString()}${window.location.hash}`;
|
|
860
869
|
window.location.href = q;
|
|
861
870
|
} else {
|
|
862
|
-
const q = `${G}?${
|
|
871
|
+
const q = `${G}?${Y.toString()}${window.location.hash}`;
|
|
863
872
|
window.history.pushState({}, "", q), p(c), E(c);
|
|
864
873
|
}
|
|
865
874
|
}
|
|
@@ -878,7 +887,7 @@ function gn({ config: r, children: e }) {
|
|
|
878
887
|
settings: N,
|
|
879
888
|
settingsSchema: L,
|
|
880
889
|
isSettingsLoading: P,
|
|
881
|
-
settingsError:
|
|
890
|
+
settingsError: A,
|
|
882
891
|
// Actions
|
|
883
892
|
refreshSettings: $,
|
|
884
893
|
switchTenant: D,
|
|
@@ -892,62 +901,62 @@ function gn({ config: r, children: e }) {
|
|
|
892
901
|
N,
|
|
893
902
|
L,
|
|
894
903
|
P,
|
|
895
|
-
|
|
904
|
+
A,
|
|
896
905
|
$,
|
|
897
906
|
D,
|
|
898
907
|
l
|
|
899
908
|
]);
|
|
900
|
-
return /* @__PURE__ */ s(
|
|
909
|
+
return /* @__PURE__ */ s(Me.Provider, { value: U, children: e });
|
|
901
910
|
}
|
|
902
911
|
function he() {
|
|
903
|
-
const r =
|
|
912
|
+
const r = ie(Me);
|
|
904
913
|
if (!r)
|
|
905
914
|
throw new Error("useTenant must be used within a TenantProvider");
|
|
906
915
|
return r;
|
|
907
916
|
}
|
|
908
917
|
function Se() {
|
|
909
|
-
return
|
|
918
|
+
return ie(Me);
|
|
910
919
|
}
|
|
911
|
-
const
|
|
912
|
-
function
|
|
913
|
-
const { settings: r, settingsSchema: e, isSettingsLoading: t, settingsError: n, validateSettings:
|
|
920
|
+
const fn = he;
|
|
921
|
+
function mn() {
|
|
922
|
+
const { settings: r, settingsSchema: e, isSettingsLoading: t, settingsError: n, validateSettings: i } = he();
|
|
914
923
|
return {
|
|
915
924
|
settings: r,
|
|
916
925
|
settingsSchema: e,
|
|
917
926
|
isLoading: t,
|
|
918
927
|
error: n,
|
|
919
|
-
validateSettings:
|
|
928
|
+
validateSettings: i
|
|
920
929
|
};
|
|
921
930
|
}
|
|
922
931
|
function ge() {
|
|
923
|
-
const { tenant: r, tenantSlug: e, isTenantLoading: t, tenantError: n, retryTenant:
|
|
932
|
+
const { tenant: r, tenantSlug: e, isTenantLoading: t, tenantError: n, retryTenant: i } = he();
|
|
924
933
|
return {
|
|
925
934
|
tenant: r,
|
|
926
935
|
tenantSlug: e,
|
|
927
936
|
isLoading: t,
|
|
928
937
|
error: n,
|
|
929
|
-
retry:
|
|
938
|
+
retry: i
|
|
930
939
|
};
|
|
931
940
|
}
|
|
932
|
-
const
|
|
933
|
-
function
|
|
934
|
-
const { appId: t, baseUrl: n } = ye(), { tenant:
|
|
941
|
+
const Le = ue(null);
|
|
942
|
+
function yn({ config: r = {}, children: e }) {
|
|
943
|
+
const { appId: t, baseUrl: n } = ye(), { tenant: i, tenantSlug: o, switchTenant: a } = he(), [p, f] = x(r.initialRoles || []), [w, u] = x(!r.initialRoles), [b, g] = x(null), [T, I] = x(!1), [N, M] = x(null), [P, h] = x(0), [A, S] = x(() => {
|
|
935
944
|
try {
|
|
936
945
|
const k = localStorage.getItem("userTenants");
|
|
937
946
|
return k ? JSON.parse(k) : [];
|
|
938
947
|
} catch {
|
|
939
948
|
return [];
|
|
940
949
|
}
|
|
941
|
-
}), [L, E] =
|
|
942
|
-
C.current.done || (C.current.done = !0, C.current.urlTokens =
|
|
950
|
+
}), [L, E] = x(!1), C = Ve({ done: !1, urlTokens: null });
|
|
951
|
+
C.current.done || (C.current.done = !0, C.current.urlTokens = St(), C.current.urlTokens && console.log(
|
|
943
952
|
"[AuthProvider] SYNC: URL tokens found, will block isAuthReady until user loaded"
|
|
944
953
|
));
|
|
945
|
-
const [R, $] =
|
|
954
|
+
const [R, $] = x(() => {
|
|
946
955
|
const k = C.current.urlTokens !== null;
|
|
947
956
|
return console.log("[AuthProvider] SYNC: isLoadingAfterUrlTokens initial:", k), k;
|
|
948
957
|
}), l = Z(() => {
|
|
949
958
|
const k = new Ae({
|
|
950
|
-
tenantSlug:
|
|
959
|
+
tenantSlug: o,
|
|
951
960
|
onRefreshFailed: r.onRefreshFailed,
|
|
952
961
|
baseUrl: n
|
|
953
962
|
});
|
|
@@ -956,16 +965,16 @@ function mn({ config: r = {}, children: e }) {
|
|
|
956
965
|
refreshToken: C.current.urlTokens.refreshToken,
|
|
957
966
|
expiresIn: C.current.urlTokens.expiresIn
|
|
958
967
|
}), console.log("[AuthProvider] SYNC: Session valid:", k.hasValidSession())), k;
|
|
959
|
-
}, [
|
|
960
|
-
const k = new
|
|
968
|
+
}, [o, n, r.onRefreshFailed]), D = C.current.done && !R, U = Z(() => {
|
|
969
|
+
const k = new oe(n);
|
|
961
970
|
return k.setSessionManager(l), k;
|
|
962
|
-
}, [n, l]), c = Z(() => new
|
|
971
|
+
}, [n, l]), c = Z(() => new gt(new oe(n)), [n]), H = Z(() => new pt(U, l), [U, l]), F = Z(() => new Be(new oe(n)), [n]), y = Z(() => b || l.getUser(), [b, l]), m = Z(() => y != null && y.roleId && p.find((k) => k.id === y.roleId) || null, [y, p]), v = Z(() => (m == null ? void 0 : m.permissions) || [], [m]), G = Z(() => l.hasValidSession() && b !== null, [l, b]), Y = 5 * 60 * 1e3, q = Z(() => {
|
|
963
972
|
const k = async (B = !1) => {
|
|
964
973
|
try {
|
|
965
974
|
if (!l.hasValidSession())
|
|
966
975
|
return;
|
|
967
976
|
const z = Date.now();
|
|
968
|
-
if (!B && z - P <
|
|
977
|
+
if (!B && z - P < Y && b)
|
|
969
978
|
return;
|
|
970
979
|
const W = l.getUserId();
|
|
971
980
|
if (!W) {
|
|
@@ -973,27 +982,27 @@ function mn({ config: r = {}, children: e }) {
|
|
|
973
982
|
return;
|
|
974
983
|
}
|
|
975
984
|
I(!0), M(null);
|
|
976
|
-
const
|
|
977
|
-
g(
|
|
985
|
+
const J = await H.getUserById(W);
|
|
986
|
+
g(J), l.setUser(J), h(Date.now());
|
|
978
987
|
} catch (z) {
|
|
979
|
-
const
|
|
980
|
-
M(
|
|
988
|
+
const Q = z instanceof Error ? z : new Error("Failed to load user data");
|
|
989
|
+
M(Q), console.error("[AuthProvider] Failed to load user data:", Q);
|
|
981
990
|
} finally {
|
|
982
991
|
I(!1);
|
|
983
992
|
}
|
|
984
993
|
}, K = async () => {
|
|
985
994
|
await k();
|
|
986
995
|
}, ce = async (B) => {
|
|
987
|
-
var
|
|
988
|
-
const { username: z, password:
|
|
989
|
-
let ee =
|
|
996
|
+
var Ue;
|
|
997
|
+
const { username: z, password: Q, tenantSlug: W, redirectPath: J } = B;
|
|
998
|
+
let ee = i == null ? void 0 : i.id, te = o, ne = l;
|
|
990
999
|
W && (ee = (await new fe(U, t).getPublicTenantInfo(W)).id, te = W);
|
|
991
1000
|
const j = await c.login({
|
|
992
1001
|
username: z,
|
|
993
|
-
password:
|
|
1002
|
+
password: Q,
|
|
994
1003
|
appId: t,
|
|
995
1004
|
tenantId: ee
|
|
996
|
-
}), pe = W && W !==
|
|
1005
|
+
}), pe = W && W !== o;
|
|
997
1006
|
if (pe && (ne = new Ae({
|
|
998
1007
|
tenantSlug: te,
|
|
999
1008
|
baseUrl: n
|
|
@@ -1016,93 +1025,89 @@ function mn({ config: r = {}, children: e }) {
|
|
|
1016
1025
|
} catch {
|
|
1017
1026
|
}
|
|
1018
1027
|
}
|
|
1019
|
-
const ke = ((
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
+
const ke = ((Ue = j.user) == null ? void 0 : Ue.tenantId) !== null;
|
|
1029
|
+
E(ke);
|
|
1030
|
+
const xe = {
|
|
1031
|
+
accessToken: j.accessToken,
|
|
1032
|
+
refreshToken: j.refreshToken,
|
|
1033
|
+
expiresIn: j.expiresIn
|
|
1034
|
+
};
|
|
1035
|
+
if (pe && te)
|
|
1036
|
+
return a(te, { tokens: xe, redirectPath: J }), j;
|
|
1037
|
+
if (J && J !== window.location.pathname)
|
|
1038
|
+
return a(te || o || "", { tokens: xe, redirectPath: J }), j;
|
|
1039
|
+
if (!ke && j.tenants && j.tenants.length > 0) {
|
|
1028
1040
|
const we = B.autoSwitch !== !1 && r.autoSwitchSingleTenant !== !1;
|
|
1029
1041
|
if (j.tenants.length === 1 && we) {
|
|
1030
|
-
const
|
|
1031
|
-
a(
|
|
1032
|
-
tokens: {
|
|
1033
|
-
accessToken: j.accessToken,
|
|
1034
|
-
refreshToken: j.refreshToken,
|
|
1035
|
-
expiresIn: j.expiresIn
|
|
1036
|
-
},
|
|
1037
|
-
redirectPath: Q
|
|
1038
|
-
});
|
|
1042
|
+
const $e = j.tenants[0];
|
|
1043
|
+
return a($e.subdomain, { tokens: xe, redirectPath: J }), j;
|
|
1039
1044
|
} else j.tenants.length > 1 && r.onTenantSelectionRequired && r.onTenantSelectionRequired(j.tenants);
|
|
1040
1045
|
}
|
|
1041
1046
|
return j;
|
|
1042
1047
|
}, ve = async (B) => {
|
|
1043
|
-
const { email: z, phoneNumber:
|
|
1044
|
-
if (!z && !
|
|
1048
|
+
const { email: z, phoneNumber: Q, name: W, password: J, lastName: ee, tenantId: te } = B;
|
|
1049
|
+
if (!z && !Q)
|
|
1045
1050
|
throw new Error("Either email or phoneNumber is required");
|
|
1046
|
-
if (!W || !
|
|
1051
|
+
if (!W || !J)
|
|
1047
1052
|
throw new Error("Name and password are required");
|
|
1048
|
-
const ne = te ?? (
|
|
1053
|
+
const ne = te ?? (i == null ? void 0 : i.id);
|
|
1049
1054
|
return await c.signup({
|
|
1050
1055
|
email: z,
|
|
1051
|
-
phoneNumber:
|
|
1056
|
+
phoneNumber: Q,
|
|
1052
1057
|
name: W,
|
|
1053
|
-
password:
|
|
1058
|
+
password: J,
|
|
1054
1059
|
tenantId: ne,
|
|
1055
1060
|
lastName: ee,
|
|
1056
1061
|
appId: t
|
|
1057
1062
|
});
|
|
1058
|
-
},
|
|
1059
|
-
const { email: z, phoneNumber:
|
|
1060
|
-
if (!z && !
|
|
1063
|
+
}, Qe = async (B) => {
|
|
1064
|
+
const { email: z, phoneNumber: Q, name: W, password: J, tenantName: ee, lastName: te } = B;
|
|
1065
|
+
if (!z && !Q)
|
|
1061
1066
|
throw new Error("Either email or phoneNumber is required");
|
|
1062
|
-
if (!W || !
|
|
1067
|
+
if (!W || !J || !ee)
|
|
1063
1068
|
throw new Error("Name, password, and tenantName are required");
|
|
1064
1069
|
return await c.signupTenantAdmin({
|
|
1065
1070
|
email: z,
|
|
1066
|
-
phoneNumber:
|
|
1071
|
+
phoneNumber: Q,
|
|
1067
1072
|
name: W,
|
|
1068
|
-
password:
|
|
1073
|
+
password: J,
|
|
1069
1074
|
tenantName: ee,
|
|
1070
1075
|
appId: t,
|
|
1071
1076
|
lastName: te
|
|
1072
1077
|
});
|
|
1073
|
-
}, Qe = async (B) => {
|
|
1074
|
-
const { currentPassword: z, newPassword: Y } = B, W = await l.getAuthHeaders();
|
|
1075
|
-
await c.changePassword({ currentPassword: z, newPassword: Y }, W);
|
|
1076
1078
|
}, Xe = async (B) => {
|
|
1077
|
-
const {
|
|
1079
|
+
const { currentPassword: z, newPassword: Q } = B, W = await l.getAuthHeaders();
|
|
1080
|
+
await c.changePassword({ currentPassword: z, newPassword: Q }, W);
|
|
1081
|
+
}, et = async (B) => {
|
|
1082
|
+
const { email: z, tenantId: Q } = B, W = Q ?? (i == null ? void 0 : i.id);
|
|
1078
1083
|
if (!W)
|
|
1079
1084
|
throw new Error("tenantId is required for password reset");
|
|
1080
1085
|
await c.requestPasswordReset({ email: z, tenantId: W });
|
|
1081
|
-
}, et = async (B) => {
|
|
1082
|
-
const { token: z, newPassword: Y } = B;
|
|
1083
|
-
await c.confirmPasswordReset({ token: z, newPassword: Y });
|
|
1084
1086
|
}, tt = async (B) => {
|
|
1085
|
-
const {
|
|
1087
|
+
const { token: z, newPassword: Q } = B;
|
|
1088
|
+
await c.confirmPasswordReset({ token: z, newPassword: Q });
|
|
1089
|
+
}, nt = async (B) => {
|
|
1090
|
+
const { email: z, frontendUrl: Q, name: W, lastName: J, tenantId: ee } = B, te = ee ?? (i == null ? void 0 : i.id);
|
|
1086
1091
|
if (!te)
|
|
1087
1092
|
throw new Error("tenantId is required for magic link authentication");
|
|
1088
1093
|
return await c.sendMagicLink({
|
|
1089
1094
|
email: z,
|
|
1090
1095
|
tenantId: te,
|
|
1091
|
-
frontendUrl:
|
|
1096
|
+
frontendUrl: Q,
|
|
1092
1097
|
name: W,
|
|
1093
|
-
lastName:
|
|
1098
|
+
lastName: J,
|
|
1094
1099
|
appId: t
|
|
1095
1100
|
});
|
|
1096
|
-
},
|
|
1097
|
-
const { token: z, email:
|
|
1098
|
-
let
|
|
1099
|
-
W && (
|
|
1101
|
+
}, rt = async (B) => {
|
|
1102
|
+
const { token: z, email: Q, tenantSlug: W } = B;
|
|
1103
|
+
let J = i == null ? void 0 : i.id, ee = o, te = l;
|
|
1104
|
+
W && (J = (await new fe(U, t).getPublicTenantInfo(W)).id, ee = W);
|
|
1100
1105
|
const ne = await c.verifyMagicLink({
|
|
1101
1106
|
token: z,
|
|
1102
|
-
email:
|
|
1107
|
+
email: Q,
|
|
1103
1108
|
appId: t,
|
|
1104
|
-
tenantId:
|
|
1105
|
-
}), j = W && W !==
|
|
1109
|
+
tenantId: J
|
|
1110
|
+
}), j = W && W !== o;
|
|
1106
1111
|
if (j && (te = new Ae({
|
|
1107
1112
|
tenantSlug: ee,
|
|
1108
1113
|
baseUrl: n
|
|
@@ -1118,14 +1123,14 @@ function mn({ config: r = {}, children: e }) {
|
|
|
1118
1123
|
console.warn("Failed to load complete user data after magic link login:", pe);
|
|
1119
1124
|
}
|
|
1120
1125
|
}
|
|
1121
|
-
return j && ee && ee !==
|
|
1126
|
+
return j && ee && ee !== o && a(ee, {
|
|
1122
1127
|
tokens: {
|
|
1123
1128
|
accessToken: ne.accessToken,
|
|
1124
1129
|
refreshToken: ne.refreshToken,
|
|
1125
1130
|
expiresIn: ne.expiresIn
|
|
1126
1131
|
}
|
|
1127
1132
|
}), ne;
|
|
1128
|
-
},
|
|
1133
|
+
}, st = async () => {
|
|
1129
1134
|
const B = l.getTokens();
|
|
1130
1135
|
if (!(B != null && B.refreshToken))
|
|
1131
1136
|
throw new Error("No refresh token available");
|
|
@@ -1137,7 +1142,7 @@ function mn({ config: r = {}, children: e }) {
|
|
|
1137
1142
|
refreshToken: z.refreshToken || B.refreshToken,
|
|
1138
1143
|
expiresIn: z.expiresIn
|
|
1139
1144
|
});
|
|
1140
|
-
},
|
|
1145
|
+
}, it = () => {
|
|
1141
1146
|
l.clearSession(), g(null), M(null), S([]), E(!1);
|
|
1142
1147
|
try {
|
|
1143
1148
|
localStorage.removeItem("userTenants");
|
|
@@ -1145,9 +1150,9 @@ function mn({ config: r = {}, children: e }) {
|
|
|
1145
1150
|
}
|
|
1146
1151
|
}, ot = (B) => {
|
|
1147
1152
|
l.setTokens(B);
|
|
1148
|
-
},
|
|
1153
|
+
}, at = () => l.hasValidSession(), lt = () => {
|
|
1149
1154
|
l.clearSession(), g(null), M(null);
|
|
1150
|
-
},
|
|
1155
|
+
}, ct = async () => {
|
|
1151
1156
|
if (t)
|
|
1152
1157
|
try {
|
|
1153
1158
|
u(!0);
|
|
@@ -1158,8 +1163,8 @@ function mn({ config: r = {}, children: e }) {
|
|
|
1158
1163
|
} finally {
|
|
1159
1164
|
u(!1);
|
|
1160
1165
|
}
|
|
1161
|
-
},
|
|
1162
|
-
await
|
|
1166
|
+
}, dt = async () => {
|
|
1167
|
+
await ct();
|
|
1163
1168
|
}, Te = (B) => {
|
|
1164
1169
|
if (!v || v.length === 0)
|
|
1165
1170
|
return !1;
|
|
@@ -1175,17 +1180,17 @@ function mn({ config: r = {}, children: e }) {
|
|
|
1175
1180
|
authenticatedHttpService: U,
|
|
1176
1181
|
login: ce,
|
|
1177
1182
|
signup: ve,
|
|
1178
|
-
signupTenantAdmin:
|
|
1179
|
-
sendMagicLink:
|
|
1180
|
-
verifyMagicLink:
|
|
1181
|
-
changePassword:
|
|
1182
|
-
requestPasswordReset:
|
|
1183
|
-
confirmPasswordReset:
|
|
1184
|
-
refreshToken:
|
|
1185
|
-
logout:
|
|
1183
|
+
signupTenantAdmin: Qe,
|
|
1184
|
+
sendMagicLink: nt,
|
|
1185
|
+
verifyMagicLink: rt,
|
|
1186
|
+
changePassword: Xe,
|
|
1187
|
+
requestPasswordReset: et,
|
|
1188
|
+
confirmPasswordReset: tt,
|
|
1189
|
+
refreshToken: st,
|
|
1190
|
+
logout: it,
|
|
1186
1191
|
setTokens: ot,
|
|
1187
|
-
hasValidSession:
|
|
1188
|
-
clearSession:
|
|
1192
|
+
hasValidSession: at,
|
|
1193
|
+
clearSession: lt,
|
|
1189
1194
|
currentUser: b,
|
|
1190
1195
|
isUserLoading: T,
|
|
1191
1196
|
userError: N,
|
|
@@ -1201,32 +1206,32 @@ function mn({ config: r = {}, children: e }) {
|
|
|
1201
1206
|
hasAnyPermission: (B) => B.some((z) => Te(z)),
|
|
1202
1207
|
hasAllPermissions: (B) => B.every((z) => Te(z)),
|
|
1203
1208
|
getUserPermissionStrings: () => v || [],
|
|
1204
|
-
refreshRoles:
|
|
1209
|
+
refreshRoles: dt,
|
|
1205
1210
|
// RFC-004: Multi-tenant user membership
|
|
1206
|
-
userTenants:
|
|
1211
|
+
userTenants: A,
|
|
1207
1212
|
hasTenantContext: L,
|
|
1208
1213
|
switchToTenant: async (B, z) => {
|
|
1209
|
-
const { redirectPath:
|
|
1214
|
+
const { redirectPath: Q } = z || {}, W = l.getTokens();
|
|
1210
1215
|
if (!(W != null && W.refreshToken))
|
|
1211
1216
|
throw new Error("No refresh token available for tenant switch");
|
|
1212
|
-
const
|
|
1217
|
+
const J = await c.switchTenant({
|
|
1213
1218
|
refreshToken: W.refreshToken,
|
|
1214
1219
|
tenantId: B
|
|
1215
1220
|
});
|
|
1216
1221
|
l.setTokens({
|
|
1217
|
-
accessToken:
|
|
1222
|
+
accessToken: J.accessToken,
|
|
1218
1223
|
refreshToken: W.refreshToken,
|
|
1219
1224
|
// Keep the same refresh token
|
|
1220
|
-
expiresIn:
|
|
1221
|
-
}), g(
|
|
1222
|
-
const ee =
|
|
1225
|
+
expiresIn: J.expiresIn
|
|
1226
|
+
}), g(J.user), l.setUser(J.user), E(!0);
|
|
1227
|
+
const ee = A.find((te) => te.id === B);
|
|
1223
1228
|
ee && a(ee.subdomain, {
|
|
1224
1229
|
tokens: {
|
|
1225
|
-
accessToken:
|
|
1230
|
+
accessToken: J.accessToken,
|
|
1226
1231
|
refreshToken: W.refreshToken,
|
|
1227
|
-
expiresIn:
|
|
1232
|
+
expiresIn: J.expiresIn
|
|
1228
1233
|
},
|
|
1229
|
-
redirectPath:
|
|
1234
|
+
redirectPath: Q
|
|
1230
1235
|
});
|
|
1231
1236
|
},
|
|
1232
1237
|
refreshUserTenants: async () => {
|
|
@@ -1247,26 +1252,26 @@ function mn({ config: r = {}, children: e }) {
|
|
|
1247
1252
|
H,
|
|
1248
1253
|
F,
|
|
1249
1254
|
t,
|
|
1250
|
-
o,
|
|
1251
1255
|
i,
|
|
1256
|
+
o,
|
|
1252
1257
|
a,
|
|
1253
1258
|
p,
|
|
1254
1259
|
b,
|
|
1255
1260
|
T,
|
|
1256
1261
|
N,
|
|
1257
|
-
|
|
1262
|
+
A,
|
|
1258
1263
|
L,
|
|
1259
1264
|
D,
|
|
1260
1265
|
m,
|
|
1261
1266
|
v,
|
|
1262
1267
|
P,
|
|
1263
|
-
|
|
1268
|
+
Y
|
|
1264
1269
|
]);
|
|
1265
1270
|
X(() => {
|
|
1266
1271
|
!r.initialRoles && t && (async () => {
|
|
1267
1272
|
try {
|
|
1268
1273
|
u(!0);
|
|
1269
|
-
const K = new
|
|
1274
|
+
const K = new oe(n), ce = new Be(K), { roles: ve } = await ce.getRolesByApp(t);
|
|
1270
1275
|
f(ve);
|
|
1271
1276
|
} catch (K) {
|
|
1272
1277
|
console.error("Failed to fetch roles:", K);
|
|
@@ -1275,9 +1280,9 @@ function mn({ config: r = {}, children: e }) {
|
|
|
1275
1280
|
}
|
|
1276
1281
|
})();
|
|
1277
1282
|
}, [t, n, r.initialRoles]);
|
|
1278
|
-
const [O, V] =
|
|
1283
|
+
const [O, V] = x(!1);
|
|
1279
1284
|
return X(() => {
|
|
1280
|
-
O || (V(!0), C.current.urlTokens && (console.log("[AuthProvider] EFFECT: Cleaning up URL after sync token processing"),
|
|
1285
|
+
O || (V(!0), C.current.urlTokens && (console.log("[AuthProvider] EFFECT: Cleaning up URL after sync token processing"), vt(), $(!0), console.log("[AuthProvider] EFFECT: Loading user data (blocking isAuthReady)..."), q.loadUserData().catch((k) => {
|
|
1281
1286
|
console.error("[AuthProvider] Failed to load user data:", k);
|
|
1282
1287
|
}).finally(() => {
|
|
1283
1288
|
console.log("[AuthProvider] EFFECT: User data loaded, releasing isAuthReady"), $(!1);
|
|
@@ -1294,20 +1299,20 @@ function mn({ config: r = {}, children: e }) {
|
|
|
1294
1299
|
const k = setInterval(() => {
|
|
1295
1300
|
q.loadUserData().catch(() => {
|
|
1296
1301
|
});
|
|
1297
|
-
},
|
|
1302
|
+
}, Y);
|
|
1298
1303
|
return () => clearInterval(k);
|
|
1299
|
-
}, [l, b, q,
|
|
1304
|
+
}, [l, b, q, Y]), /* @__PURE__ */ s(Le.Provider, { value: q, children: e });
|
|
1300
1305
|
}
|
|
1301
1306
|
function le() {
|
|
1302
|
-
const r =
|
|
1307
|
+
const r = ie(Le);
|
|
1303
1308
|
if (!r)
|
|
1304
1309
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
1305
1310
|
return r;
|
|
1306
1311
|
}
|
|
1307
|
-
function
|
|
1308
|
-
return
|
|
1312
|
+
function Ee() {
|
|
1313
|
+
return ie(Le);
|
|
1309
1314
|
}
|
|
1310
|
-
class
|
|
1315
|
+
class Tt {
|
|
1311
1316
|
constructor(e, t) {
|
|
1312
1317
|
this.httpService = e, this.sessionManager = t;
|
|
1313
1318
|
}
|
|
@@ -1328,12 +1333,12 @@ class vt {
|
|
|
1328
1333
|
throw new Error("SessionManager is required for private endpoints");
|
|
1329
1334
|
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
1330
1335
|
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder);
|
|
1331
|
-
const
|
|
1336
|
+
const i = `/feature-flags/${n.toString() ? `?${n.toString()}` : ""}`, o = await this.httpService.get(i, {
|
|
1332
1337
|
headers: t
|
|
1333
1338
|
});
|
|
1334
1339
|
return {
|
|
1335
|
-
featureFlags:
|
|
1336
|
-
meta:
|
|
1340
|
+
featureFlags: o.data,
|
|
1341
|
+
meta: o.meta
|
|
1337
1342
|
};
|
|
1338
1343
|
}
|
|
1339
1344
|
async getFeatureFlagById(e) {
|
|
@@ -1370,8 +1375,8 @@ class vt {
|
|
|
1370
1375
|
throw new Error("Tenant ID and App ID are required");
|
|
1371
1376
|
const n = new URLSearchParams();
|
|
1372
1377
|
n.append("tenantId", e), n.append("appId", t);
|
|
1373
|
-
const
|
|
1374
|
-
return (await this.httpService.get(
|
|
1378
|
+
const i = `/tenant-feature-flags${n.toString() ? `?${n.toString()}` : ""}`;
|
|
1379
|
+
return (await this.httpService.get(i, {
|
|
1375
1380
|
headers: { "X-Tenant-ID": e }
|
|
1376
1381
|
})).data;
|
|
1377
1382
|
}
|
|
@@ -1379,74 +1384,74 @@ class vt {
|
|
|
1379
1384
|
async getTenantFeatureFlag(e, t, n) {
|
|
1380
1385
|
if (!e || !t || !n)
|
|
1381
1386
|
throw new Error("Flag Key, Tenant ID and App ID are required");
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1384
|
-
const
|
|
1385
|
-
return (await this.httpService.get(
|
|
1387
|
+
const i = new URLSearchParams();
|
|
1388
|
+
i.append("tenantId", t), i.append("appId", n);
|
|
1389
|
+
const o = `/tenant-feature-flags/${e}${i.toString() ? `?${i.toString()}` : ""}`;
|
|
1390
|
+
return (await this.httpService.get(o, {
|
|
1386
1391
|
headers: { "X-Tenant-ID": t }
|
|
1387
1392
|
})).data;
|
|
1388
1393
|
}
|
|
1389
1394
|
}
|
|
1390
|
-
const
|
|
1391
|
-
function
|
|
1392
|
-
const t =
|
|
1393
|
-
const h = new
|
|
1394
|
-
return new
|
|
1395
|
-
}, [
|
|
1395
|
+
const Fe = ue(null);
|
|
1396
|
+
function wn({ config: r = {}, children: e }) {
|
|
1397
|
+
const t = je(), n = Se(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (t == null ? void 0 : t.appId) ?? "", a = (n == null ? void 0 : n.tenant) ?? null, [p, f] = x([]), [w, u] = x(!1), [b, g] = x(null), [T, I] = x(!1), N = Z(() => {
|
|
1398
|
+
const h = new oe(i);
|
|
1399
|
+
return new Tt(h);
|
|
1400
|
+
}, [i]), M = async () => {
|
|
1396
1401
|
if (!(a != null && a.id)) {
|
|
1397
1402
|
f([]);
|
|
1398
1403
|
return;
|
|
1399
1404
|
}
|
|
1400
1405
|
u(!0), g(null);
|
|
1401
1406
|
try {
|
|
1402
|
-
const h = await N.getTenantFeatureFlags(a.id,
|
|
1407
|
+
const h = await N.getTenantFeatureFlags(a.id, o);
|
|
1403
1408
|
f(h);
|
|
1404
1409
|
} catch (h) {
|
|
1405
|
-
const
|
|
1406
|
-
g(
|
|
1410
|
+
const A = h instanceof Error ? h.message : "Failed to fetch feature flags";
|
|
1411
|
+
g(A), r.onError && r.onError(h instanceof Error ? h : new Error(A));
|
|
1407
1412
|
} finally {
|
|
1408
1413
|
u(!1);
|
|
1409
1414
|
}
|
|
1410
1415
|
};
|
|
1411
1416
|
X(() => {
|
|
1412
|
-
if (!
|
|
1417
|
+
if (!i || !o) return;
|
|
1413
1418
|
M().finally(() => I(!0));
|
|
1414
|
-
const h = r.refreshInterval || 5 * 60 * 1e3,
|
|
1415
|
-
return () => clearInterval(
|
|
1416
|
-
}, [a == null ? void 0 : a.id,
|
|
1419
|
+
const h = r.refreshInterval || 5 * 60 * 1e3, A = setInterval(M, h);
|
|
1420
|
+
return () => clearInterval(A);
|
|
1421
|
+
}, [a == null ? void 0 : a.id, i, o, r.refreshInterval]);
|
|
1417
1422
|
const P = Z(() => {
|
|
1418
1423
|
const h = (C) => {
|
|
1419
1424
|
const R = p.find(($) => $.key === C);
|
|
1420
1425
|
return (R == null ? void 0 : R.value) === !0;
|
|
1421
|
-
},
|
|
1426
|
+
}, A = (C) => p.find((R) => R.key === C), S = (C) => {
|
|
1422
1427
|
const R = p.find(($) => $.key === C);
|
|
1423
1428
|
return R ? R.value ? "enabled" : "disabled" : "not_found";
|
|
1424
1429
|
}, L = async () => {
|
|
1425
1430
|
await M();
|
|
1426
|
-
}, E = !!(
|
|
1431
|
+
}, E = !!(i && o) && (T || !(a != null && a.id));
|
|
1427
1432
|
return {
|
|
1428
1433
|
featureFlags: p,
|
|
1429
1434
|
loading: w,
|
|
1430
1435
|
error: b,
|
|
1431
1436
|
isReady: E,
|
|
1432
1437
|
isEnabled: h,
|
|
1433
|
-
getFlag:
|
|
1438
|
+
getFlag: A,
|
|
1434
1439
|
getFlagState: S,
|
|
1435
1440
|
refresh: L
|
|
1436
1441
|
};
|
|
1437
|
-
}, [p, w, b,
|
|
1438
|
-
return /* @__PURE__ */ s(
|
|
1442
|
+
}, [p, w, b, i, o, a == null ? void 0 : a.id, T]);
|
|
1443
|
+
return /* @__PURE__ */ s(Fe.Provider, { value: P, children: e });
|
|
1439
1444
|
}
|
|
1440
|
-
function
|
|
1441
|
-
const r =
|
|
1445
|
+
function kt() {
|
|
1446
|
+
const r = ie(Fe);
|
|
1442
1447
|
if (!r)
|
|
1443
1448
|
throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
|
|
1444
1449
|
return r;
|
|
1445
1450
|
}
|
|
1446
|
-
function
|
|
1447
|
-
return
|
|
1451
|
+
function Ge() {
|
|
1452
|
+
return ie(Fe);
|
|
1448
1453
|
}
|
|
1449
|
-
class
|
|
1454
|
+
class xt {
|
|
1450
1455
|
constructor(e, t) {
|
|
1451
1456
|
this.httpService = e, this.sessionManager = t;
|
|
1452
1457
|
}
|
|
@@ -1512,19 +1517,19 @@ class kt {
|
|
|
1512
1517
|
)).data;
|
|
1513
1518
|
}
|
|
1514
1519
|
}
|
|
1515
|
-
const
|
|
1516
|
-
function
|
|
1517
|
-
const t =
|
|
1518
|
-
const P = new
|
|
1519
|
-
return new
|
|
1520
|
-
}, [
|
|
1521
|
-
if (!(
|
|
1520
|
+
const Ne = ue(void 0);
|
|
1521
|
+
function bn({ config: r = {}, children: e }) {
|
|
1522
|
+
const t = je(), n = Se(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (n == null ? void 0 : n.tenant) ?? null, [a, p] = x(null), [f, w] = x(!1), [u, b] = x(null), [g, T] = x(!1), I = Z(() => {
|
|
1523
|
+
const P = new oe(i);
|
|
1524
|
+
return new xt(P);
|
|
1525
|
+
}, [i]), N = async () => {
|
|
1526
|
+
if (!(o != null && o.id)) {
|
|
1522
1527
|
p(null);
|
|
1523
1528
|
return;
|
|
1524
1529
|
}
|
|
1525
1530
|
w(!0), b(null);
|
|
1526
1531
|
try {
|
|
1527
|
-
const P = await I.getTenantSubscriptionFeatures(
|
|
1532
|
+
const P = await I.getTenantSubscriptionFeatures(o.id);
|
|
1528
1533
|
p(P);
|
|
1529
1534
|
} catch (P) {
|
|
1530
1535
|
const h = P instanceof Error ? P.message : "Failed to fetch subscription";
|
|
@@ -1534,20 +1539,20 @@ function wn({ config: r = {}, children: e }) {
|
|
|
1534
1539
|
}
|
|
1535
1540
|
};
|
|
1536
1541
|
X(() => {
|
|
1537
|
-
if (!
|
|
1542
|
+
if (!i || (N().finally(() => T(!0)), !r.refreshInterval)) return;
|
|
1538
1543
|
const P = r.refreshInterval || 10 * 60 * 1e3, h = setInterval(N, P);
|
|
1539
1544
|
return () => clearInterval(h);
|
|
1540
|
-
}, [
|
|
1545
|
+
}, [o == null ? void 0 : o.id, i, r.refreshInterval]);
|
|
1541
1546
|
const M = Z(() => {
|
|
1542
1547
|
const P = (a == null ? void 0 : a.features) || [], h = (R) => {
|
|
1543
1548
|
const $ = P.find((l) => l.key === R);
|
|
1544
1549
|
return $ ? $.type === "BOOLEAN" || $.type === "boolean" ? $.value === !0 : !!$.value : !1;
|
|
1545
|
-
},
|
|
1550
|
+
}, A = (R) => P.find(($) => $.key === R), S = (R, $) => {
|
|
1546
1551
|
const l = P.find((D) => D.key === R);
|
|
1547
1552
|
return l ? l.value : $;
|
|
1548
1553
|
}, L = (R) => !a || !a.isActive ? !1 : R.includes(a.planId), E = async () => {
|
|
1549
1554
|
await N();
|
|
1550
|
-
}, C = !!
|
|
1555
|
+
}, C = !!i && (g || !(o != null && o.id));
|
|
1551
1556
|
return {
|
|
1552
1557
|
subscription: a,
|
|
1553
1558
|
features: P,
|
|
@@ -1555,25 +1560,25 @@ function wn({ config: r = {}, children: e }) {
|
|
|
1555
1560
|
error: u,
|
|
1556
1561
|
isReady: C,
|
|
1557
1562
|
isFeatureEnabled: h,
|
|
1558
|
-
getFeature:
|
|
1563
|
+
getFeature: A,
|
|
1559
1564
|
getFeatureValue: S,
|
|
1560
1565
|
hasAllowedPlan: L,
|
|
1561
1566
|
refresh: E
|
|
1562
1567
|
};
|
|
1563
|
-
}, [a, f, u,
|
|
1564
|
-
return /* @__PURE__ */ s(
|
|
1568
|
+
}, [a, f, u, i, o == null ? void 0 : o.id, g]);
|
|
1569
|
+
return /* @__PURE__ */ s(Ne.Provider, { value: M, children: e });
|
|
1565
1570
|
}
|
|
1566
1571
|
function At() {
|
|
1567
|
-
const r =
|
|
1572
|
+
const r = ie(Ne);
|
|
1568
1573
|
if (r === void 0)
|
|
1569
1574
|
throw new Error("useSubscription must be used within a SubscriptionProvider");
|
|
1570
1575
|
return r;
|
|
1571
1576
|
}
|
|
1572
|
-
function
|
|
1573
|
-
return
|
|
1577
|
+
function Ze() {
|
|
1578
|
+
return ie(Ne) ?? null;
|
|
1574
1579
|
}
|
|
1575
1580
|
var se = /* @__PURE__ */ ((r) => (r.SUPERUSER = "SUPERUSER", r.TENANT_ADMIN = "TENANT_ADMIN", r.USER = "USER", r))(se || {});
|
|
1576
|
-
const
|
|
1581
|
+
const De = {
|
|
1577
1582
|
publicGuest: "/",
|
|
1578
1583
|
publicUser: "/account",
|
|
1579
1584
|
publicAdmin: "/admin",
|
|
@@ -1581,7 +1586,7 @@ const Ne = {
|
|
|
1581
1586
|
tenantUser: "/dashboard",
|
|
1582
1587
|
tenantAdmin: "/admin/dashboard",
|
|
1583
1588
|
default: "/"
|
|
1584
|
-
},
|
|
1589
|
+
}, Ke = {
|
|
1585
1590
|
// Public/Landing zones
|
|
1586
1591
|
landing: { tenant: "forbidden", auth: "optional" },
|
|
1587
1592
|
publicOnly: { tenant: "forbidden", auth: "forbidden" },
|
|
@@ -1598,19 +1603,19 @@ const Ne = {
|
|
|
1598
1603
|
admin: { tenant: "required", auth: "required", userType: se.TENANT_ADMIN },
|
|
1599
1604
|
// Fully open
|
|
1600
1605
|
open: { tenant: "optional", auth: "optional" }
|
|
1601
|
-
},
|
|
1602
|
-
function
|
|
1606
|
+
}, Ce = ue(null);
|
|
1607
|
+
function Sn({ config: r = {}, children: e }) {
|
|
1603
1608
|
const t = Z(() => {
|
|
1604
1609
|
const n = {
|
|
1605
|
-
...
|
|
1610
|
+
...De,
|
|
1606
1611
|
...r.zoneRoots
|
|
1607
|
-
},
|
|
1608
|
-
...
|
|
1612
|
+
}, i = {
|
|
1613
|
+
...Ke,
|
|
1609
1614
|
...r.presets
|
|
1610
1615
|
};
|
|
1611
1616
|
return {
|
|
1612
1617
|
zoneRoots: n,
|
|
1613
|
-
presets:
|
|
1618
|
+
presets: i,
|
|
1614
1619
|
loadingFallback: r.loadingFallback ?? null,
|
|
1615
1620
|
accessDeniedFallback: r.accessDeniedFallback ?? null,
|
|
1616
1621
|
onAccessDenied: r.onAccessDenied,
|
|
@@ -1618,19 +1623,19 @@ function bn({ config: r = {}, children: e }) {
|
|
|
1618
1623
|
returnToStorage: r.returnToStorage ?? "url"
|
|
1619
1624
|
};
|
|
1620
1625
|
}, [r]);
|
|
1621
|
-
return /* @__PURE__ */ s(
|
|
1626
|
+
return /* @__PURE__ */ s(Ce.Provider, { value: t, children: e });
|
|
1622
1627
|
}
|
|
1623
|
-
function
|
|
1624
|
-
const r =
|
|
1628
|
+
function vn() {
|
|
1629
|
+
const r = ie(Ce);
|
|
1625
1630
|
if (!r)
|
|
1626
1631
|
throw new Error("useRouting must be used within a RoutingProvider");
|
|
1627
1632
|
return r;
|
|
1628
1633
|
}
|
|
1629
|
-
function
|
|
1630
|
-
const r =
|
|
1634
|
+
function Pt() {
|
|
1635
|
+
const r = ie(Ce);
|
|
1631
1636
|
return r || {
|
|
1632
|
-
zoneRoots:
|
|
1633
|
-
presets:
|
|
1637
|
+
zoneRoots: De,
|
|
1638
|
+
presets: Ke,
|
|
1634
1639
|
loadingFallback: null,
|
|
1635
1640
|
accessDeniedFallback: null,
|
|
1636
1641
|
onAccessDenied: void 0,
|
|
@@ -1638,7 +1643,7 @@ function xt() {
|
|
|
1638
1643
|
returnToStorage: "url"
|
|
1639
1644
|
};
|
|
1640
1645
|
}
|
|
1641
|
-
const
|
|
1646
|
+
const Oe = () => /* @__PURE__ */ d(
|
|
1642
1647
|
"div",
|
|
1643
1648
|
{
|
|
1644
1649
|
style: {
|
|
@@ -1675,7 +1680,7 @@ const qe = () => /* @__PURE__ */ d(
|
|
|
1675
1680
|
)
|
|
1676
1681
|
]
|
|
1677
1682
|
}
|
|
1678
|
-
),
|
|
1683
|
+
), ze = ({
|
|
1679
1684
|
userType: r,
|
|
1680
1685
|
minUserType: e,
|
|
1681
1686
|
missingPermissions: t
|
|
@@ -1716,7 +1721,7 @@ const qe = () => /* @__PURE__ */ d(
|
|
|
1716
1721
|
] })
|
|
1717
1722
|
]
|
|
1718
1723
|
}
|
|
1719
|
-
),
|
|
1724
|
+
), Rt = (r, e) => {
|
|
1720
1725
|
const t = {
|
|
1721
1726
|
[se.USER]: 1,
|
|
1722
1727
|
[se.TENANT_ADMIN]: 2,
|
|
@@ -1724,28 +1729,28 @@ const qe = () => /* @__PURE__ */ d(
|
|
|
1724
1729
|
};
|
|
1725
1730
|
return t[r] >= t[e];
|
|
1726
1731
|
};
|
|
1727
|
-
function
|
|
1732
|
+
function Tn({
|
|
1728
1733
|
children: r,
|
|
1729
1734
|
fallback: e,
|
|
1730
1735
|
minUserType: t,
|
|
1731
1736
|
requiredPermissions: n,
|
|
1732
|
-
requireAllPermissions:
|
|
1737
|
+
requireAllPermissions: i = !1
|
|
1733
1738
|
}) {
|
|
1734
|
-
const { hasValidSession:
|
|
1735
|
-
if (!
|
|
1736
|
-
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(
|
|
1739
|
+
const { hasValidSession: o, sessionManager: a, hasPermission: p, hasAnyPermission: f, hasAllPermissions: w } = le();
|
|
1740
|
+
if (!o())
|
|
1741
|
+
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(Oe, {}) });
|
|
1737
1742
|
const u = a.getUser();
|
|
1738
1743
|
if (!u)
|
|
1739
|
-
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(
|
|
1740
|
-
if (t && !
|
|
1741
|
-
return /* @__PURE__ */ s(
|
|
1742
|
-
if (n && n.length > 0 && !(
|
|
1744
|
+
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(Oe, {}) });
|
|
1745
|
+
if (t && !Rt(u.userType, t))
|
|
1746
|
+
return /* @__PURE__ */ s(ze, { userType: u.userType, minUserType: t });
|
|
1747
|
+
if (n && n.length > 0 && !(i ? w(n) : f(n))) {
|
|
1743
1748
|
const g = n.filter((T) => !p(T)).map((T) => typeof T == "string" ? T : T.name);
|
|
1744
|
-
return /* @__PURE__ */ s(
|
|
1749
|
+
return /* @__PURE__ */ s(ze, { missingPermissions: g });
|
|
1745
1750
|
}
|
|
1746
1751
|
return /* @__PURE__ */ s(_, { children: r });
|
|
1747
1752
|
}
|
|
1748
|
-
const
|
|
1753
|
+
const It = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
1749
1754
|
"div",
|
|
1750
1755
|
{
|
|
1751
1756
|
style: {
|
|
@@ -1781,7 +1786,7 @@ const Rt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
|
1781
1786
|
}
|
|
1782
1787
|
)
|
|
1783
1788
|
}
|
|
1784
|
-
),
|
|
1789
|
+
), _e = ({
|
|
1785
1790
|
userType: r,
|
|
1786
1791
|
requiredUserType: e,
|
|
1787
1792
|
missingPermissions: t
|
|
@@ -1832,14 +1837,14 @@ const Rt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
|
1832
1837
|
}
|
|
1833
1838
|
)
|
|
1834
1839
|
}
|
|
1835
|
-
),
|
|
1836
|
-
function
|
|
1840
|
+
), Mt = (r, e) => r === e;
|
|
1841
|
+
function kn({
|
|
1837
1842
|
children: r,
|
|
1838
1843
|
redirectTo: e = "/login",
|
|
1839
1844
|
requiredUserType: t,
|
|
1840
1845
|
requiredPermissions: n,
|
|
1841
|
-
requireAllPermissions:
|
|
1842
|
-
fallback:
|
|
1846
|
+
requireAllPermissions: i = !1,
|
|
1847
|
+
fallback: o
|
|
1843
1848
|
}) {
|
|
1844
1849
|
const { hasValidSession: a, sessionManager: p, hasPermission: f, hasAnyPermission: w, hasAllPermissions: u } = le(), b = be();
|
|
1845
1850
|
if (X(() => {
|
|
@@ -1847,28 +1852,28 @@ function Tn({
|
|
|
1847
1852
|
"[react-identity-access] ProtectedRoute is deprecated. Use AuthenticatedZone or AdminZone from ZoneRoute instead."
|
|
1848
1853
|
);
|
|
1849
1854
|
}, []), !a())
|
|
1850
|
-
return
|
|
1851
|
-
/* @__PURE__ */ s(
|
|
1855
|
+
return o ? /* @__PURE__ */ s(_, { children: o }) : /* @__PURE__ */ d(_, { children: [
|
|
1856
|
+
/* @__PURE__ */ s(It, { redirectPath: e }),
|
|
1852
1857
|
/* @__PURE__ */ s(me, { to: e, state: { from: b.pathname }, replace: !0 })
|
|
1853
1858
|
] });
|
|
1854
1859
|
const g = p.getUser();
|
|
1855
1860
|
if (!g)
|
|
1856
1861
|
return /* @__PURE__ */ s(me, { to: e, state: { from: b.pathname }, replace: !0 });
|
|
1857
|
-
if (t && !
|
|
1862
|
+
if (t && !Mt(g.userType, t))
|
|
1858
1863
|
return /* @__PURE__ */ s(
|
|
1859
|
-
|
|
1864
|
+
_e,
|
|
1860
1865
|
{
|
|
1861
1866
|
userType: g.userType,
|
|
1862
1867
|
requiredUserType: t
|
|
1863
1868
|
}
|
|
1864
1869
|
);
|
|
1865
|
-
if (n && n.length > 0 && !(
|
|
1870
|
+
if (n && n.length > 0 && !(i ? u(n) : w(n))) {
|
|
1866
1871
|
const I = n.filter((N) => !f(N)).map((N) => typeof N == "string" ? N : N.name);
|
|
1867
|
-
return /* @__PURE__ */ s(
|
|
1872
|
+
return /* @__PURE__ */ s(_e, { missingPermissions: I });
|
|
1868
1873
|
}
|
|
1869
1874
|
return /* @__PURE__ */ s(_, { children: r });
|
|
1870
1875
|
}
|
|
1871
|
-
const
|
|
1876
|
+
const Lt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
1872
1877
|
"div",
|
|
1873
1878
|
{
|
|
1874
1879
|
style: {
|
|
@@ -1905,18 +1910,18 @@ const Mt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
|
1905
1910
|
)
|
|
1906
1911
|
}
|
|
1907
1912
|
);
|
|
1908
|
-
function
|
|
1909
|
-
const { tenant: n, isLoading:
|
|
1913
|
+
function xn({ children: r, redirectTo: e = "/", fallback: t }) {
|
|
1914
|
+
const { tenant: n, isLoading: i, error: o } = ge(), a = be();
|
|
1910
1915
|
return X(() => {
|
|
1911
1916
|
process.env.NODE_ENV === "development" && console.warn(
|
|
1912
1917
|
"[react-identity-access] TenantRoute is deprecated. Use TenantZone from ZoneRoute instead."
|
|
1913
1918
|
);
|
|
1914
|
-
}, []),
|
|
1915
|
-
/* @__PURE__ */ s(
|
|
1919
|
+
}, []), i || o ? null : n ? /* @__PURE__ */ s(_, { children: r }) : t ? /* @__PURE__ */ s(_, { children: t }) : /* @__PURE__ */ d(_, { children: [
|
|
1920
|
+
/* @__PURE__ */ s(Lt, { redirectPath: e }),
|
|
1916
1921
|
/* @__PURE__ */ s(me, { to: e, state: { from: a.pathname }, replace: !0 })
|
|
1917
1922
|
] });
|
|
1918
1923
|
}
|
|
1919
|
-
const
|
|
1924
|
+
const Et = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
1920
1925
|
"div",
|
|
1921
1926
|
{
|
|
1922
1927
|
style: {
|
|
@@ -1954,46 +1959,46 @@ const Lt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
|
1954
1959
|
}
|
|
1955
1960
|
);
|
|
1956
1961
|
function An({ children: r, redirectTo: e = "/dashboard", fallback: t }) {
|
|
1957
|
-
const { tenant: n, isLoading:
|
|
1962
|
+
const { tenant: n, isLoading: i, error: o } = ge(), a = be();
|
|
1958
1963
|
return X(() => {
|
|
1959
1964
|
process.env.NODE_ENV === "development" && console.warn(
|
|
1960
1965
|
"[react-identity-access] LandingRoute is deprecated. Use PublicZone from ZoneRoute instead."
|
|
1961
1966
|
);
|
|
1962
|
-
}, []),
|
|
1963
|
-
/* @__PURE__ */ s(
|
|
1967
|
+
}, []), i || o ? null : n ? t ? /* @__PURE__ */ s(_, { children: t }) : /* @__PURE__ */ d(_, { children: [
|
|
1968
|
+
/* @__PURE__ */ s(Et, { redirectPath: e }),
|
|
1964
1969
|
/* @__PURE__ */ s(me, { to: e, state: { from: a.pathname }, replace: !0 })
|
|
1965
1970
|
] }) : /* @__PURE__ */ s(_, { children: r });
|
|
1966
1971
|
}
|
|
1967
|
-
function
|
|
1972
|
+
function Ft(r, e) {
|
|
1968
1973
|
return e ? r ? Array.isArray(e) ? e.includes(r) : r === e : !1 : !0;
|
|
1969
1974
|
}
|
|
1970
|
-
function
|
|
1975
|
+
function We(r, e) {
|
|
1971
1976
|
return !r || r === "optional" ? "skip" : r === "required" ? e ? "pass" : "fail" : r === "forbidden" ? e ? "fail" : "pass" : "skip";
|
|
1972
1977
|
}
|
|
1973
|
-
function Ft(r, e) {
|
|
1974
|
-
return _e(r.tenant, e.hasTenant) === "fail" ? e.hasTenant ? "has_tenant" : "no_tenant" : _e(r.auth, e.isAuthenticated) === "fail" ? e.isAuthenticated ? "already_authenticated" : "not_authenticated" : r.userType && e.isAuthenticated && !Et(e.userType, r.userType) ? "wrong_user_type" : r.permissions && r.permissions.length > 0 && !(r.requireAllPermissions !== !1 ? (i) => i.every((a) => e.permissions.includes(a)) : (i) => i.some((a) => e.permissions.includes(a)))(r.permissions) ? "missing_permissions" : null;
|
|
1975
|
-
}
|
|
1976
1978
|
function Nt(r, e) {
|
|
1979
|
+
return We(r.tenant, e.hasTenant) === "fail" ? e.hasTenant ? "has_tenant" : "no_tenant" : We(r.auth, e.isAuthenticated) === "fail" ? e.isAuthenticated ? "already_authenticated" : "not_authenticated" : r.userType && e.isAuthenticated && !Ft(e.userType, r.userType) ? "wrong_user_type" : r.permissions && r.permissions.length > 0 && !(r.requireAllPermissions !== !1 ? (o) => o.every((a) => e.permissions.includes(a)) : (o) => o.some((a) => e.permissions.includes(a)))(r.permissions) ? "missing_permissions" : null;
|
|
1980
|
+
}
|
|
1981
|
+
function Dt(r, e) {
|
|
1977
1982
|
return r.hasTenant ? r.isAuthenticated ? r.userType === se.TENANT_ADMIN ? e.tenantAdmin : e.tenantUser : e.tenantGuest : r.isAuthenticated ? r.userType === se.TENANT_ADMIN ? e.publicAdmin : e.publicUser : e.publicGuest;
|
|
1978
1983
|
}
|
|
1979
|
-
function
|
|
1980
|
-
if (!e ||
|
|
1984
|
+
function Ct(r, e, t, n, i) {
|
|
1985
|
+
if (!e || i !== "url")
|
|
1981
1986
|
return r;
|
|
1982
|
-
const
|
|
1983
|
-
return `${r}${a}${n}=${encodeURIComponent(
|
|
1987
|
+
const o = typeof e == "string" ? e : t, a = r.includes("?") ? "&" : "?";
|
|
1988
|
+
return `${r}${a}${n}=${encodeURIComponent(o)}`;
|
|
1984
1989
|
}
|
|
1985
|
-
function
|
|
1990
|
+
function Ut(r, e, t) {
|
|
1986
1991
|
if (!r || t === "url") return;
|
|
1987
|
-
const n = typeof r == "string" ? r : e,
|
|
1988
|
-
t === "session" ? sessionStorage.setItem(
|
|
1992
|
+
const n = typeof r == "string" ? r : e, i = "zone_return_to";
|
|
1993
|
+
t === "session" ? sessionStorage.setItem(i, n) : t === "local" && localStorage.setItem(i, n);
|
|
1989
1994
|
}
|
|
1990
1995
|
const ae = ({
|
|
1991
1996
|
children: r,
|
|
1992
1997
|
preset: e,
|
|
1993
1998
|
tenant: t,
|
|
1994
1999
|
auth: n,
|
|
1995
|
-
userType:
|
|
1996
|
-
requiredPermissions:
|
|
2000
|
+
userType: i,
|
|
2001
|
+
requiredPermissions: o,
|
|
1997
2002
|
requireAllPermissions: a = !0,
|
|
1998
2003
|
returnTo: p,
|
|
1999
2004
|
onAccessDenied: f,
|
|
@@ -2001,18 +2006,18 @@ const ae = ({
|
|
|
2001
2006
|
loadingFallback: u,
|
|
2002
2007
|
accessDeniedFallback: b
|
|
2003
2008
|
}) => {
|
|
2004
|
-
const g = be(), { isAuthenticated: T, isAuthInitializing: I, currentUser: N, userPermissions: M } = le(), { tenant: P, isTenantLoading: h } = he(),
|
|
2009
|
+
const g = be(), { isAuthenticated: T, isAuthInitializing: I, currentUser: N, userPermissions: M } = le(), { tenant: P, isTenantLoading: h } = he(), A = Pt(), S = Z(() => {
|
|
2005
2010
|
if (e)
|
|
2006
|
-
return
|
|
2007
|
-
}, [e,
|
|
2011
|
+
return A.presets[e];
|
|
2012
|
+
}, [e, A.presets]), L = Z(
|
|
2008
2013
|
() => ({
|
|
2009
2014
|
tenant: t ?? (S == null ? void 0 : S.tenant),
|
|
2010
2015
|
auth: n ?? (S == null ? void 0 : S.auth),
|
|
2011
|
-
userType:
|
|
2012
|
-
permissions:
|
|
2016
|
+
userType: i ?? (S == null ? void 0 : S.userType),
|
|
2017
|
+
permissions: o ?? (S == null ? void 0 : S.requiredPermissions),
|
|
2013
2018
|
requireAllPermissions: a
|
|
2014
2019
|
}),
|
|
2015
|
-
[t, n,
|
|
2020
|
+
[t, n, i, o, S, a]
|
|
2016
2021
|
), E = Z(
|
|
2017
2022
|
() => ({
|
|
2018
2023
|
hasTenant: !!P,
|
|
@@ -2029,7 +2034,7 @@ const ae = ({
|
|
|
2029
2034
|
I,
|
|
2030
2035
|
h
|
|
2031
2036
|
]
|
|
2032
|
-
), C = Z(() => E.isLoading ? null :
|
|
2037
|
+
), C = Z(() => E.isLoading ? null : Nt(L, E), [L, E]), R = Z(() => C ? w || Dt(E, A.zoneRoots) : null, [C, w, E, A.zoneRoots]), $ = Z(() => !C || !R ? null : {
|
|
2033
2038
|
type: C,
|
|
2034
2039
|
required: {
|
|
2035
2040
|
tenant: L.tenant,
|
|
@@ -2046,32 +2051,32 @@ const ae = ({
|
|
|
2046
2051
|
redirectTo: R
|
|
2047
2052
|
}, [C, R, L, E]);
|
|
2048
2053
|
if (X(() => {
|
|
2049
|
-
$ && (f ? f($) :
|
|
2050
|
-
}, [$, f,
|
|
2051
|
-
$ && p &&
|
|
2054
|
+
$ && (f ? f($) : A.onAccessDenied && A.onAccessDenied($));
|
|
2055
|
+
}, [$, f, A]), X(() => {
|
|
2056
|
+
$ && p && Ut(p, g.pathname + g.search, A.returnToStorage);
|
|
2052
2057
|
}, [
|
|
2053
2058
|
$,
|
|
2054
2059
|
p,
|
|
2055
2060
|
g.pathname,
|
|
2056
2061
|
g.search,
|
|
2057
|
-
|
|
2062
|
+
A.returnToStorage
|
|
2058
2063
|
]), E.isLoading)
|
|
2059
|
-
return /* @__PURE__ */ s(_, { children: u ??
|
|
2064
|
+
return /* @__PURE__ */ s(_, { children: u ?? A.loadingFallback ?? null });
|
|
2060
2065
|
if ($ && R) {
|
|
2061
|
-
const l = b ??
|
|
2066
|
+
const l = b ?? A.accessDeniedFallback;
|
|
2062
2067
|
if (l)
|
|
2063
2068
|
return /* @__PURE__ */ s(_, { children: l });
|
|
2064
|
-
const D =
|
|
2069
|
+
const D = Ct(
|
|
2065
2070
|
R,
|
|
2066
2071
|
p,
|
|
2067
2072
|
g.pathname + g.search,
|
|
2068
|
-
|
|
2069
|
-
|
|
2073
|
+
A.returnToParam,
|
|
2074
|
+
A.returnToStorage
|
|
2070
2075
|
);
|
|
2071
2076
|
return /* @__PURE__ */ s(me, { to: D, replace: !0 });
|
|
2072
2077
|
}
|
|
2073
2078
|
return /* @__PURE__ */ s(_, { children: r });
|
|
2074
|
-
},
|
|
2079
|
+
}, Pn = (r) => /* @__PURE__ */ s(ae, { tenant: "required", ...r }), Rn = (r) => /* @__PURE__ */ s(ae, { tenant: "forbidden", ...r }), In = (r) => /* @__PURE__ */ s(ae, { auth: "required", ...r }), Mn = (r) => /* @__PURE__ */ s(ae, { auth: "forbidden", ...r }), Ln = (r) => /* @__PURE__ */ s(ae, { auth: "required", userType: se.TENANT_ADMIN, ...r }), En = (r) => /* @__PURE__ */ s(ae, { auth: "required", userType: se.USER, ...r }), Fn = (r) => /* @__PURE__ */ s(ae, { tenant: "optional", auth: "optional", ...r }), Nn = (r) => /* @__PURE__ */ s(ae, { tenant: "required", auth: "required", ...r }), Dn = (r) => /* @__PURE__ */ s(ae, { tenant: "required", auth: "optional", ...r }), Cn = (r) => /* @__PURE__ */ s(ae, { tenant: "required", auth: "forbidden", ...r }), $t = () => /* @__PURE__ */ d(
|
|
2075
2080
|
"div",
|
|
2076
2081
|
{
|
|
2077
2082
|
style: {
|
|
@@ -2088,13 +2093,13 @@ const ae = ({
|
|
|
2088
2093
|
]
|
|
2089
2094
|
}
|
|
2090
2095
|
);
|
|
2091
|
-
function
|
|
2096
|
+
function Un({
|
|
2092
2097
|
children: r,
|
|
2093
|
-
fallback: e = /* @__PURE__ */ s(
|
|
2098
|
+
fallback: e = /* @__PURE__ */ s($t, {}),
|
|
2094
2099
|
allowedPlans: t,
|
|
2095
2100
|
requiredFeature: n
|
|
2096
2101
|
}) {
|
|
2097
|
-
const { subscription:
|
|
2102
|
+
const { subscription: i, hasAllowedPlan: o, isFeatureEnabled: a, loading: p } = At();
|
|
2098
2103
|
return p ? /* @__PURE__ */ s(
|
|
2099
2104
|
"div",
|
|
2100
2105
|
{
|
|
@@ -2105,9 +2110,9 @@ function Cn({
|
|
|
2105
2110
|
},
|
|
2106
2111
|
children: "Loading subscription..."
|
|
2107
2112
|
}
|
|
2108
|
-
) :
|
|
2113
|
+
) : i ? i.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ s(_, { children: e }) : n && !a(n) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: r }) : /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: e });
|
|
2109
2114
|
}
|
|
2110
|
-
const
|
|
2115
|
+
const Ht = ({ flagName: r }) => /* @__PURE__ */ d(
|
|
2111
2116
|
"div",
|
|
2112
2117
|
{
|
|
2113
2118
|
style: {
|
|
@@ -2134,9 +2139,9 @@ const $t = ({ flagName: r }) => /* @__PURE__ */ d(
|
|
|
2134
2139
|
]
|
|
2135
2140
|
}
|
|
2136
2141
|
);
|
|
2137
|
-
function
|
|
2138
|
-
const { isEnabled: n, loading:
|
|
2139
|
-
return
|
|
2142
|
+
function $n({ name: r, children: e, fallback: t }) {
|
|
2143
|
+
const { isEnabled: n, loading: i } = kt();
|
|
2144
|
+
return i ? /* @__PURE__ */ s(
|
|
2140
2145
|
"div",
|
|
2141
2146
|
{
|
|
2142
2147
|
style: {
|
|
@@ -2149,9 +2154,9 @@ function Un({ name: r, children: e, fallback: t }) {
|
|
|
2149
2154
|
},
|
|
2150
2155
|
children: "Loading feature flags..."
|
|
2151
2156
|
}
|
|
2152
|
-
) : n(r) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: t || /* @__PURE__ */ s(
|
|
2157
|
+
) : n(r) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: t || /* @__PURE__ */ s(Ht, { flagName: r }) });
|
|
2153
2158
|
}
|
|
2154
|
-
const
|
|
2159
|
+
const Bt = () => /* @__PURE__ */ d(
|
|
2155
2160
|
"svg",
|
|
2156
2161
|
{
|
|
2157
2162
|
width: "16",
|
|
@@ -2168,7 +2173,7 @@ const Ht = () => /* @__PURE__ */ d(
|
|
|
2168
2173
|
/* @__PURE__ */ s("circle", { cx: "12", cy: "12", r: "3" })
|
|
2169
2174
|
]
|
|
2170
2175
|
}
|
|
2171
|
-
),
|
|
2176
|
+
), qt = () => /* @__PURE__ */ d(
|
|
2172
2177
|
"svg",
|
|
2173
2178
|
{
|
|
2174
2179
|
width: "16",
|
|
@@ -2185,10 +2190,10 @@ const Ht = () => /* @__PURE__ */ d(
|
|
|
2185
2190
|
/* @__PURE__ */ s("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2186
2191
|
]
|
|
2187
2192
|
}
|
|
2188
|
-
),
|
|
2189
|
-
showPassword: /* @__PURE__ */ s(
|
|
2190
|
-
hidePassword: /* @__PURE__ */ s(
|
|
2191
|
-
},
|
|
2193
|
+
), Ot = {
|
|
2194
|
+
showPassword: /* @__PURE__ */ s(Bt, {}),
|
|
2195
|
+
hidePassword: /* @__PURE__ */ s(qt, {})
|
|
2196
|
+
}, zt = {
|
|
2192
2197
|
title: "Sign In",
|
|
2193
2198
|
usernameLabel: "Email or Phone",
|
|
2194
2199
|
usernamePlaceholder: "Enter your email or phone number",
|
|
@@ -2202,7 +2207,7 @@ const Ht = () => /* @__PURE__ */ d(
|
|
|
2202
2207
|
magicLinkLink: "Use Magic Link",
|
|
2203
2208
|
errorMessage: "Invalid credentials",
|
|
2204
2209
|
loadingText: "Signing in..."
|
|
2205
|
-
},
|
|
2210
|
+
}, _t = {
|
|
2206
2211
|
container: {
|
|
2207
2212
|
maxWidth: "400px",
|
|
2208
2213
|
width: "100%",
|
|
@@ -2309,13 +2314,13 @@ const Ht = () => /* @__PURE__ */ d(
|
|
|
2309
2314
|
fontSize: "0.875rem"
|
|
2310
2315
|
}
|
|
2311
2316
|
};
|
|
2312
|
-
function
|
|
2317
|
+
function Hn({
|
|
2313
2318
|
copy: r = {},
|
|
2314
2319
|
styles: e = {},
|
|
2315
2320
|
icons: t = {},
|
|
2316
2321
|
onSuccess: n,
|
|
2317
|
-
onError:
|
|
2318
|
-
onForgotPassword:
|
|
2322
|
+
onError: i,
|
|
2323
|
+
onForgotPassword: o,
|
|
2319
2324
|
onSignupClick: a,
|
|
2320
2325
|
onMagicLinkClick: p,
|
|
2321
2326
|
showForgotPassword: f = !0,
|
|
@@ -2323,7 +2328,7 @@ function $n({
|
|
|
2323
2328
|
showMagicLinkOption: u = !0,
|
|
2324
2329
|
className: b
|
|
2325
2330
|
}) {
|
|
2326
|
-
const [g, T] =
|
|
2331
|
+
const [g, T] = x(""), [I, N] = x(""), [M, P] = x(!1), [h, A] = x(!1), [S, L] = x(""), [E, C] = x({}), { login: R } = le(), { tenant: $ } = ge(), l = { ...zt, ...r }, D = { ..._t, ...e }, U = { ...Ot, ...t }, c = () => {
|
|
2327
2332
|
const m = {};
|
|
2328
2333
|
return g.trim() || (m.username = !0), I.trim() || (m.password = !0), C(m), Object.keys(m).length === 0;
|
|
2329
2334
|
}, H = async (m) => {
|
|
@@ -2332,7 +2337,7 @@ function $n({
|
|
|
2332
2337
|
L("Tenant not found");
|
|
2333
2338
|
return;
|
|
2334
2339
|
}
|
|
2335
|
-
|
|
2340
|
+
A(!0), L("");
|
|
2336
2341
|
try {
|
|
2337
2342
|
const v = await R({
|
|
2338
2343
|
username: g,
|
|
@@ -2342,9 +2347,9 @@ function $n({
|
|
|
2342
2347
|
n == null || n(v);
|
|
2343
2348
|
} catch (v) {
|
|
2344
2349
|
const G = v.message || l.errorMessage;
|
|
2345
|
-
L(G),
|
|
2350
|
+
L(G), i == null || i(G);
|
|
2346
2351
|
} finally {
|
|
2347
|
-
|
|
2352
|
+
A(!1);
|
|
2348
2353
|
}
|
|
2349
2354
|
}
|
|
2350
2355
|
}, F = (m) => ({
|
|
@@ -2423,7 +2428,7 @@ function $n({
|
|
|
2423
2428
|
/* @__PURE__ */ s("a", { onClick: p, style: D.link, children: l.magicLinkLink })
|
|
2424
2429
|
] }),
|
|
2425
2430
|
u && (f || w) && /* @__PURE__ */ s("div", { style: D.divider, children: "•" }),
|
|
2426
|
-
f && /* @__PURE__ */ s("a", { onClick:
|
|
2431
|
+
f && /* @__PURE__ */ s("a", { onClick: o, style: D.link, children: l.forgotPasswordLink }),
|
|
2427
2432
|
f && w && /* @__PURE__ */ s("div", { style: D.divider, children: "•" }),
|
|
2428
2433
|
w && /* @__PURE__ */ d("div", { children: [
|
|
2429
2434
|
/* @__PURE__ */ d("span", { style: D.divider, children: [
|
|
@@ -2435,7 +2440,7 @@ function $n({
|
|
|
2435
2440
|
] })
|
|
2436
2441
|
] });
|
|
2437
2442
|
}
|
|
2438
|
-
const
|
|
2443
|
+
const Wt = {
|
|
2439
2444
|
title: "Create Account",
|
|
2440
2445
|
nameLabel: "First Name",
|
|
2441
2446
|
namePlaceholder: "Enter your first name",
|
|
@@ -2461,7 +2466,7 @@ const _t = {
|
|
|
2461
2466
|
passwordMismatchError: "Passwords do not match",
|
|
2462
2467
|
isAdminLabel: "Create new organization",
|
|
2463
2468
|
isAdminDescription: "Check this if you want to create a new organization"
|
|
2464
|
-
},
|
|
2469
|
+
}, Vt = {
|
|
2465
2470
|
container: {
|
|
2466
2471
|
maxWidth: "400px",
|
|
2467
2472
|
width: "100%",
|
|
@@ -2560,22 +2565,22 @@ const _t = {
|
|
|
2560
2565
|
fontSize: "0.875rem"
|
|
2561
2566
|
}
|
|
2562
2567
|
};
|
|
2563
|
-
function
|
|
2568
|
+
function Bn({
|
|
2564
2569
|
copy: r = {},
|
|
2565
2570
|
styles: e = {},
|
|
2566
2571
|
signupType: t = "user",
|
|
2567
2572
|
onSuccess: n,
|
|
2568
|
-
onError:
|
|
2569
|
-
onLoginClick:
|
|
2573
|
+
onError: i,
|
|
2574
|
+
onLoginClick: o,
|
|
2570
2575
|
onMagicLinkClick: a,
|
|
2571
2576
|
showLoginLink: p = !0,
|
|
2572
2577
|
showMagicLinkOption: f = !0,
|
|
2573
2578
|
className: w
|
|
2574
2579
|
}) {
|
|
2575
|
-
const [u, b] =
|
|
2580
|
+
const [u, b] = x(""), [g, T] = x(""), [I, N] = x(""), [M, P] = x(""), [h, A] = x(""), [S, L] = x(""), [E, C] = x(""), [R, $] = x(!1), [l, D] = x(""), [U, c] = x({}), { signup: H, signupTenantAdmin: F } = le(), { tenant: y } = ge(), m = { ...Wt, ...r }, v = { ...Vt, ...e }, G = () => {
|
|
2576
2581
|
const k = {};
|
|
2577
2582
|
return u.trim() || (k.name = !0), !I.trim() && !M.trim() && (k.email = !0, k.phoneNumber = !0), h.trim() || (k.password = !0), S.trim() || (k.confirmPassword = !0), t === "tenant" && !E.trim() && (k.tenantName = !0), c(k), Object.keys(k).length === 0;
|
|
2578
|
-
},
|
|
2583
|
+
}, Y = async (k) => {
|
|
2579
2584
|
if (k.preventDefault(), !!G()) {
|
|
2580
2585
|
if (h !== S) {
|
|
2581
2586
|
D(m.passwordMismatchError), c({ confirmPassword: !0 });
|
|
@@ -2605,7 +2610,7 @@ function Hn({
|
|
|
2605
2610
|
}), n == null || n(K);
|
|
2606
2611
|
} catch (K) {
|
|
2607
2612
|
const ce = K.message || m.errorMessage;
|
|
2608
|
-
D(ce),
|
|
2613
|
+
D(ce), i == null || i(ce);
|
|
2609
2614
|
} finally {
|
|
2610
2615
|
$(!1);
|
|
2611
2616
|
}
|
|
@@ -2620,7 +2625,7 @@ function Hn({
|
|
|
2620
2625
|
}), V = u && (I || M) && h && S && (t === "user" || E);
|
|
2621
2626
|
return /* @__PURE__ */ d("div", { className: w, style: v.container, children: [
|
|
2622
2627
|
/* @__PURE__ */ s("h2", { style: v.title, children: m.title }),
|
|
2623
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
2628
|
+
/* @__PURE__ */ d("form", { onSubmit: Y, style: v.form, children: [
|
|
2624
2629
|
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2625
2630
|
/* @__PURE__ */ s("label", { style: v.label, children: m.nameLabel }),
|
|
2626
2631
|
/* @__PURE__ */ s(
|
|
@@ -2713,7 +2718,7 @@ function Hn({
|
|
|
2713
2718
|
type: "password",
|
|
2714
2719
|
value: h,
|
|
2715
2720
|
onChange: (k) => {
|
|
2716
|
-
|
|
2721
|
+
A(k.target.value), U.password && c((K) => ({ ...K, password: !1 }));
|
|
2717
2722
|
},
|
|
2718
2723
|
placeholder: m.passwordPlaceholder,
|
|
2719
2724
|
style: q("password"),
|
|
@@ -2774,12 +2779,12 @@ function Hn({
|
|
|
2774
2779
|
m.loginText,
|
|
2775
2780
|
" "
|
|
2776
2781
|
] }),
|
|
2777
|
-
/* @__PURE__ */ s("a", { onClick:
|
|
2782
|
+
/* @__PURE__ */ s("a", { onClick: o, style: v.link, children: m.loginLink })
|
|
2778
2783
|
] })
|
|
2779
2784
|
] })
|
|
2780
2785
|
] });
|
|
2781
2786
|
}
|
|
2782
|
-
const
|
|
2787
|
+
const jt = {
|
|
2783
2788
|
title: "Sign In with Magic Link",
|
|
2784
2789
|
emailLabel: "Email",
|
|
2785
2790
|
emailPlaceholder: "Enter your email",
|
|
@@ -2797,7 +2802,7 @@ const Vt = {
|
|
|
2797
2802
|
loadingText: "Sending magic link...",
|
|
2798
2803
|
verifyingText: "Verifying magic link...",
|
|
2799
2804
|
description: "Enter your email to receive a magic link. If you don't have an account, we'll create one for you."
|
|
2800
|
-
},
|
|
2805
|
+
}, Gt = {
|
|
2801
2806
|
container: {
|
|
2802
2807
|
maxWidth: "400px",
|
|
2803
2808
|
width: "100%",
|
|
@@ -2900,19 +2905,19 @@ const Vt = {
|
|
|
2900
2905
|
fontSize: "0.875rem"
|
|
2901
2906
|
}
|
|
2902
2907
|
};
|
|
2903
|
-
function
|
|
2908
|
+
function qn({
|
|
2904
2909
|
copy: r = {},
|
|
2905
2910
|
styles: e = {},
|
|
2906
2911
|
onSuccess: t,
|
|
2907
2912
|
onError: n,
|
|
2908
|
-
onLoginClick:
|
|
2909
|
-
onSignupClick:
|
|
2913
|
+
onLoginClick: i,
|
|
2914
|
+
onSignupClick: o,
|
|
2910
2915
|
showTraditionalLinks: a = !0,
|
|
2911
2916
|
className: p,
|
|
2912
2917
|
verifyToken: f,
|
|
2913
2918
|
frontendUrl: w
|
|
2914
2919
|
}) {
|
|
2915
|
-
const [u, b] =
|
|
2920
|
+
const [u, b] = x(""), [g, T] = x(""), [I, N] = x(""), [M, P] = x(!1), [h, A] = x(!1), [S, L] = x(""), [E, C] = x(""), [R, $] = x({}), [l, D] = x(!1), { sendMagicLink: U, verifyMagicLink: c } = le(), { tenant: H } = ge(), F = { ...jt, ...r }, y = { ...Gt, ...e };
|
|
2916
2921
|
X(() => {
|
|
2917
2922
|
f && m(f);
|
|
2918
2923
|
}, [f]);
|
|
@@ -2921,7 +2926,7 @@ function Bn({
|
|
|
2921
2926
|
L("Missing tenant or email");
|
|
2922
2927
|
return;
|
|
2923
2928
|
}
|
|
2924
|
-
|
|
2929
|
+
A(!0), L("");
|
|
2925
2930
|
try {
|
|
2926
2931
|
const V = await c({
|
|
2927
2932
|
token: O,
|
|
@@ -2933,7 +2938,7 @@ function Bn({
|
|
|
2933
2938
|
const k = V.message || "Failed to verify magic link";
|
|
2934
2939
|
L(k), n == null || n(k);
|
|
2935
2940
|
} finally {
|
|
2936
|
-
|
|
2941
|
+
A(!1);
|
|
2937
2942
|
}
|
|
2938
2943
|
}, v = () => {
|
|
2939
2944
|
const O = {};
|
|
@@ -2961,7 +2966,7 @@ function Bn({
|
|
|
2961
2966
|
P(!1);
|
|
2962
2967
|
}
|
|
2963
2968
|
}
|
|
2964
|
-
},
|
|
2969
|
+
}, Y = (O) => ({
|
|
2965
2970
|
...y.input,
|
|
2966
2971
|
...R[O] ? y.inputError : {}
|
|
2967
2972
|
}), q = () => ({
|
|
@@ -2989,7 +2994,7 @@ function Bn({
|
|
|
2989
2994
|
b(O.target.value), R.email && $((V) => ({ ...V, email: !1 }));
|
|
2990
2995
|
},
|
|
2991
2996
|
placeholder: F.emailPlaceholder,
|
|
2992
|
-
style:
|
|
2997
|
+
style: Y("email"),
|
|
2993
2998
|
disabled: M || h
|
|
2994
2999
|
}
|
|
2995
3000
|
)
|
|
@@ -3024,7 +3029,7 @@ function Bn({
|
|
|
3024
3029
|
T(O.target.value), R.name && $((V) => ({ ...V, name: !1 }));
|
|
3025
3030
|
},
|
|
3026
3031
|
placeholder: F.namePlaceholder,
|
|
3027
|
-
style:
|
|
3032
|
+
style: Y("name"),
|
|
3028
3033
|
disabled: M || h
|
|
3029
3034
|
}
|
|
3030
3035
|
)
|
|
@@ -3074,7 +3079,7 @@ function Bn({
|
|
|
3074
3079
|
F.loginText,
|
|
3075
3080
|
" "
|
|
3076
3081
|
] }),
|
|
3077
|
-
/* @__PURE__ */ s("a", { onClick:
|
|
3082
|
+
/* @__PURE__ */ s("a", { onClick: i, style: y.link, children: F.loginLink })
|
|
3078
3083
|
] }),
|
|
3079
3084
|
/* @__PURE__ */ s("div", { style: y.divider, children: "•" }),
|
|
3080
3085
|
/* @__PURE__ */ d("div", { children: [
|
|
@@ -3082,12 +3087,12 @@ function Bn({
|
|
|
3082
3087
|
F.signupText,
|
|
3083
3088
|
" "
|
|
3084
3089
|
] }),
|
|
3085
|
-
/* @__PURE__ */ s("a", { onClick:
|
|
3090
|
+
/* @__PURE__ */ s("a", { onClick: o, style: y.link, children: F.signupLink })
|
|
3086
3091
|
] })
|
|
3087
3092
|
] })
|
|
3088
3093
|
] });
|
|
3089
3094
|
}
|
|
3090
|
-
const
|
|
3095
|
+
const Zt = {
|
|
3091
3096
|
title: "Verifying Magic Link",
|
|
3092
3097
|
verifyingMessage: "Please wait while we verify your magic link...",
|
|
3093
3098
|
successMessage: "Magic link verified successfully! You are now logged in.",
|
|
@@ -3095,7 +3100,7 @@ const Gt = {
|
|
|
3095
3100
|
redirectingMessage: "Redirecting you to the dashboard...",
|
|
3096
3101
|
retryButton: "Try Again",
|
|
3097
3102
|
backToLoginButton: "Back to Login"
|
|
3098
|
-
},
|
|
3103
|
+
}, Je = {
|
|
3099
3104
|
container: {
|
|
3100
3105
|
maxWidth: "400px",
|
|
3101
3106
|
width: "100%",
|
|
@@ -3182,7 +3187,7 @@ const Gt = {
|
|
|
3182
3187
|
cursor: "pointer",
|
|
3183
3188
|
transition: "all 0.15s ease-in-out"
|
|
3184
3189
|
}
|
|
3185
|
-
},
|
|
3190
|
+
}, Kt = () => /* @__PURE__ */ s("div", { style: Je.spinner }), Jt = () => /* @__PURE__ */ d(
|
|
3186
3191
|
"svg",
|
|
3187
3192
|
{
|
|
3188
3193
|
width: "48",
|
|
@@ -3199,7 +3204,7 @@ const Gt = {
|
|
|
3199
3204
|
/* @__PURE__ */ s("polyline", { points: "22,4 12,14.01 9,11.01" })
|
|
3200
3205
|
]
|
|
3201
3206
|
}
|
|
3202
|
-
),
|
|
3207
|
+
), Yt = () => /* @__PURE__ */ d(
|
|
3203
3208
|
"svg",
|
|
3204
3209
|
{
|
|
3205
3210
|
width: "48",
|
|
@@ -3217,18 +3222,18 @@ const Gt = {
|
|
|
3217
3222
|
/* @__PURE__ */ s("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
3218
3223
|
]
|
|
3219
3224
|
}
|
|
3220
|
-
),
|
|
3221
|
-
loading: /* @__PURE__ */ s(
|
|
3222
|
-
success: /* @__PURE__ */ s(
|
|
3223
|
-
error: /* @__PURE__ */ s(
|
|
3225
|
+
), Qt = {
|
|
3226
|
+
loading: /* @__PURE__ */ s(Kt, {}),
|
|
3227
|
+
success: /* @__PURE__ */ s(Jt, {}),
|
|
3228
|
+
error: /* @__PURE__ */ s(Yt, {})
|
|
3224
3229
|
};
|
|
3225
|
-
function
|
|
3230
|
+
function On({
|
|
3226
3231
|
copy: r = {},
|
|
3227
3232
|
styles: e = {},
|
|
3228
3233
|
icons: t = {},
|
|
3229
3234
|
onSuccess: n,
|
|
3230
|
-
onError:
|
|
3231
|
-
onRetry:
|
|
3235
|
+
onError: i,
|
|
3236
|
+
onRetry: o,
|
|
3232
3237
|
onBackToLogin: a,
|
|
3233
3238
|
className: p,
|
|
3234
3239
|
token: f,
|
|
@@ -3237,7 +3242,7 @@ function qn({
|
|
|
3237
3242
|
tenantSlug: b,
|
|
3238
3243
|
autoRedirectDelay: g = 3e3
|
|
3239
3244
|
}) {
|
|
3240
|
-
const [T, I] =
|
|
3245
|
+
const [T, I] = x("verifying"), [N, M] = x(""), { verifyMagicLink: P } = le(), h = { ...Zt, ...r }, A = { ...Je, ...e }, S = { ...Qt, ...t }, L = () => {
|
|
3241
3246
|
if (typeof window > "u") return {};
|
|
3242
3247
|
const l = new URLSearchParams(window.location.search);
|
|
3243
3248
|
return {
|
|
@@ -3262,10 +3267,10 @@ function qn({
|
|
|
3262
3267
|
}, g);
|
|
3263
3268
|
} catch (l) {
|
|
3264
3269
|
const D = l.message || h.errorMessage;
|
|
3265
|
-
M(D), I("error"),
|
|
3270
|
+
M(D), I("error"), i == null || i(D);
|
|
3266
3271
|
}
|
|
3267
3272
|
}, C = () => {
|
|
3268
|
-
|
|
3273
|
+
o == null || o(), E();
|
|
3269
3274
|
}, R = () => {
|
|
3270
3275
|
a == null || a();
|
|
3271
3276
|
};
|
|
@@ -3275,30 +3280,30 @@ function qn({
|
|
|
3275
3280
|
const $ = () => {
|
|
3276
3281
|
switch (T) {
|
|
3277
3282
|
case "verifying":
|
|
3278
|
-
return /* @__PURE__ */ d("div", { style:
|
|
3283
|
+
return /* @__PURE__ */ d("div", { style: A.message, children: [
|
|
3279
3284
|
S.loading,
|
|
3280
3285
|
h.verifyingMessage
|
|
3281
3286
|
] });
|
|
3282
3287
|
case "success":
|
|
3283
3288
|
return /* @__PURE__ */ d(_, { children: [
|
|
3284
3289
|
S.success,
|
|
3285
|
-
/* @__PURE__ */ s("div", { style:
|
|
3290
|
+
/* @__PURE__ */ s("div", { style: A.successMessage, children: h.successMessage })
|
|
3286
3291
|
] });
|
|
3287
3292
|
case "redirecting":
|
|
3288
3293
|
return /* @__PURE__ */ d(_, { children: [
|
|
3289
3294
|
S.loading,
|
|
3290
|
-
/* @__PURE__ */ s("div", { style:
|
|
3295
|
+
/* @__PURE__ */ s("div", { style: A.message, children: h.redirectingMessage })
|
|
3291
3296
|
] });
|
|
3292
3297
|
case "error":
|
|
3293
3298
|
return /* @__PURE__ */ d(_, { children: [
|
|
3294
3299
|
S.error,
|
|
3295
|
-
/* @__PURE__ */ s("div", { style:
|
|
3296
|
-
/* @__PURE__ */ d("div", { style:
|
|
3300
|
+
/* @__PURE__ */ s("div", { style: A.errorMessage, children: N || h.errorMessage }),
|
|
3301
|
+
/* @__PURE__ */ d("div", { style: A.buttonContainer, children: [
|
|
3297
3302
|
/* @__PURE__ */ s(
|
|
3298
3303
|
"button",
|
|
3299
3304
|
{
|
|
3300
3305
|
onClick: C,
|
|
3301
|
-
style:
|
|
3306
|
+
style: A.retryButton,
|
|
3302
3307
|
onMouseOver: (l) => {
|
|
3303
3308
|
l.currentTarget.style.backgroundColor = "#2563eb";
|
|
3304
3309
|
},
|
|
@@ -3312,7 +3317,7 @@ function qn({
|
|
|
3312
3317
|
"button",
|
|
3313
3318
|
{
|
|
3314
3319
|
onClick: R,
|
|
3315
|
-
style:
|
|
3320
|
+
style: A.backButton,
|
|
3316
3321
|
onMouseOver: (l) => {
|
|
3317
3322
|
l.currentTarget.style.backgroundColor = "#e5e7eb";
|
|
3318
3323
|
},
|
|
@@ -3328,18 +3333,18 @@ function qn({
|
|
|
3328
3333
|
return null;
|
|
3329
3334
|
}
|
|
3330
3335
|
};
|
|
3331
|
-
return /* @__PURE__ */ d("div", { style:
|
|
3336
|
+
return /* @__PURE__ */ d("div", { style: A.container, className: p, children: [
|
|
3332
3337
|
/* @__PURE__ */ s("style", { children: `
|
|
3333
3338
|
@keyframes spin {
|
|
3334
3339
|
0% { transform: rotate(0deg); }
|
|
3335
3340
|
100% { transform: rotate(360deg); }
|
|
3336
3341
|
}
|
|
3337
3342
|
` }),
|
|
3338
|
-
/* @__PURE__ */ s("h1", { style:
|
|
3343
|
+
/* @__PURE__ */ s("h1", { style: A.title, children: h.title }),
|
|
3339
3344
|
$()
|
|
3340
3345
|
] });
|
|
3341
3346
|
}
|
|
3342
|
-
const
|
|
3347
|
+
const Xt = {
|
|
3343
3348
|
title: "Reset Password",
|
|
3344
3349
|
subtitle: "Enter your email address and we'll send you a link to reset your password.",
|
|
3345
3350
|
emailLabel: "Email",
|
|
@@ -3361,7 +3366,7 @@ const Qt = {
|
|
|
3361
3366
|
resetLoadingText: "Resetting...",
|
|
3362
3367
|
resetSuccessMessage: "Password reset successfully!",
|
|
3363
3368
|
passwordMismatchError: "Passwords do not match"
|
|
3364
|
-
},
|
|
3369
|
+
}, en = {
|
|
3365
3370
|
container: {
|
|
3366
3371
|
maxWidth: "400px",
|
|
3367
3372
|
margin: "0 auto",
|
|
@@ -3453,18 +3458,18 @@ const Qt = {
|
|
|
3453
3458
|
cursor: "pointer"
|
|
3454
3459
|
}
|
|
3455
3460
|
};
|
|
3456
|
-
function
|
|
3461
|
+
function zn({
|
|
3457
3462
|
copy: r = {},
|
|
3458
3463
|
styles: e = {},
|
|
3459
3464
|
mode: t = "request",
|
|
3460
3465
|
token: n = "",
|
|
3461
|
-
onSuccess:
|
|
3462
|
-
onError:
|
|
3466
|
+
onSuccess: i,
|
|
3467
|
+
onError: o,
|
|
3463
3468
|
onBackToLogin: a,
|
|
3464
3469
|
onModeChange: p,
|
|
3465
3470
|
className: f
|
|
3466
3471
|
}) {
|
|
3467
|
-
const [w, u] =
|
|
3472
|
+
const [w, u] = x(""), [b, g] = x(n), [T, I] = x(""), [N, M] = x(""), [P, h] = x(!1), [A, S] = x(""), [L, E] = x(""), [C, R] = x({}), { requestPasswordReset: $, confirmPasswordReset: l } = le(), { tenant: D } = ge(), U = { ...Xt, ...r }, c = { ...en, ...e }, H = () => {
|
|
3468
3473
|
const q = {};
|
|
3469
3474
|
return w.trim() || (q.email = !0), R(q), Object.keys(q).length === 0;
|
|
3470
3475
|
}, F = () => {
|
|
@@ -3478,10 +3483,10 @@ function On({
|
|
|
3478
3483
|
}
|
|
3479
3484
|
h(!0), S(""), E("");
|
|
3480
3485
|
try {
|
|
3481
|
-
await $({ email: w, tenantId: D.id }), E(U.successMessage),
|
|
3486
|
+
await $({ email: w, tenantId: D.id }), E(U.successMessage), i == null || i();
|
|
3482
3487
|
} catch (O) {
|
|
3483
3488
|
const V = O.message || U.errorMessage;
|
|
3484
|
-
S(V),
|
|
3489
|
+
S(V), o == null || o(V);
|
|
3485
3490
|
} finally {
|
|
3486
3491
|
h(!1);
|
|
3487
3492
|
}
|
|
@@ -3494,10 +3499,10 @@ function On({
|
|
|
3494
3499
|
}
|
|
3495
3500
|
h(!0), S(""), E("");
|
|
3496
3501
|
try {
|
|
3497
|
-
await l({ token: b, newPassword: T }), E(U.resetSuccessMessage),
|
|
3502
|
+
await l({ token: b, newPassword: T }), E(U.resetSuccessMessage), i == null || i();
|
|
3498
3503
|
} catch (O) {
|
|
3499
3504
|
const V = O.message || U.errorMessage;
|
|
3500
|
-
S(V),
|
|
3505
|
+
S(V), o == null || o(V);
|
|
3501
3506
|
} finally {
|
|
3502
3507
|
h(!1);
|
|
3503
3508
|
}
|
|
@@ -3555,7 +3560,7 @@ function On({
|
|
|
3555
3560
|
type: "password",
|
|
3556
3561
|
value: N,
|
|
3557
3562
|
onChange: (O) => {
|
|
3558
|
-
M(O.target.value), C.confirmPassword && R((V) => ({ ...V, confirmPassword: !1 })),
|
|
3563
|
+
M(O.target.value), C.confirmPassword && R((V) => ({ ...V, confirmPassword: !1 })), A === U.passwordMismatchError && S("");
|
|
3559
3564
|
},
|
|
3560
3565
|
placeholder: U.confirmPasswordPlaceholder,
|
|
3561
3566
|
style: v("confirmPassword"),
|
|
@@ -3575,7 +3580,7 @@ function On({
|
|
|
3575
3580
|
children: P ? U.resetLoadingText : U.resetSubmitButton
|
|
3576
3581
|
}
|
|
3577
3582
|
),
|
|
3578
|
-
|
|
3583
|
+
A && /* @__PURE__ */ s("div", { style: c.errorText, children: A }),
|
|
3579
3584
|
L && /* @__PURE__ */ s("div", { style: c.successText, children: L })
|
|
3580
3585
|
] }),
|
|
3581
3586
|
/* @__PURE__ */ d("div", { style: c.linkContainer, children: [
|
|
@@ -3587,7 +3592,7 @@ function On({
|
|
|
3587
3592
|
] })
|
|
3588
3593
|
] });
|
|
3589
3594
|
}
|
|
3590
|
-
const
|
|
3595
|
+
const Y = w;
|
|
3591
3596
|
return /* @__PURE__ */ d("div", { className: f, style: c.container, children: [
|
|
3592
3597
|
/* @__PURE__ */ s("h2", { style: c.title, children: U.title }),
|
|
3593
3598
|
/* @__PURE__ */ s("p", { style: c.subtitle, children: U.subtitle }),
|
|
@@ -3612,15 +3617,15 @@ function On({
|
|
|
3612
3617
|
"button",
|
|
3613
3618
|
{
|
|
3614
3619
|
type: "submit",
|
|
3615
|
-
disabled: !
|
|
3620
|
+
disabled: !Y || P,
|
|
3616
3621
|
style: {
|
|
3617
3622
|
...G(),
|
|
3618
|
-
...!
|
|
3623
|
+
...!Y || P ? c.buttonDisabled : {}
|
|
3619
3624
|
},
|
|
3620
3625
|
children: P ? U.loadingText : U.submitButton
|
|
3621
3626
|
}
|
|
3622
3627
|
),
|
|
3623
|
-
|
|
3628
|
+
A && /* @__PURE__ */ s("div", { style: c.errorText, children: A }),
|
|
3624
3629
|
L && /* @__PURE__ */ s("div", { style: c.successText, children: L })
|
|
3625
3630
|
] }),
|
|
3626
3631
|
/* @__PURE__ */ d("div", { style: c.linkContainer, children: [
|
|
@@ -3632,7 +3637,7 @@ function On({
|
|
|
3632
3637
|
] })
|
|
3633
3638
|
] });
|
|
3634
3639
|
}
|
|
3635
|
-
const
|
|
3640
|
+
const tn = () => /* @__PURE__ */ s(
|
|
3636
3641
|
"div",
|
|
3637
3642
|
{
|
|
3638
3643
|
style: {
|
|
@@ -3644,7 +3649,7 @@ const en = () => /* @__PURE__ */ s(
|
|
|
3644
3649
|
},
|
|
3645
3650
|
children: /* @__PURE__ */ s("div", { children: "Loading..." })
|
|
3646
3651
|
}
|
|
3647
|
-
),
|
|
3652
|
+
), nn = ({ error: r, retry: e }) => /* @__PURE__ */ d(
|
|
3648
3653
|
"div",
|
|
3649
3654
|
{
|
|
3650
3655
|
style: {
|
|
@@ -3678,56 +3683,56 @@ const en = () => /* @__PURE__ */ s(
|
|
|
3678
3683
|
]
|
|
3679
3684
|
}
|
|
3680
3685
|
);
|
|
3681
|
-
function
|
|
3686
|
+
function _n({
|
|
3682
3687
|
children: r,
|
|
3683
3688
|
loadingFallback: e,
|
|
3684
3689
|
errorFallback: t,
|
|
3685
3690
|
requireTenant: n = !0
|
|
3686
3691
|
}) {
|
|
3687
|
-
const { isAppLoading:
|
|
3688
|
-
}), N = (f == null ? void 0 : f.isAuthReady) ?? !0, M = (w == null ? void 0 : w.isReady) ?? !0, P = (u == null ? void 0 : u.isReady) ?? !0, h = n && p && T, E =
|
|
3689
|
-
|
|
3692
|
+
const { isAppLoading: i, appError: o, retryApp: a } = ye(), p = Se(), f = Ee(), w = Ge(), u = Ze(), b = (p == null ? void 0 : p.isTenantLoading) ?? !1, g = (p == null ? void 0 : p.tenantError) ?? null, T = (p == null ? void 0 : p.tenantSlug) ?? null, I = (p == null ? void 0 : p.retryTenant) ?? (() => {
|
|
3693
|
+
}), N = (f == null ? void 0 : f.isAuthReady) ?? !0, M = (w == null ? void 0 : w.isReady) ?? !0, P = (u == null ? void 0 : u.isReady) ?? !0, h = n && p && T, E = i || h && b || f && !N || w && !M || u && !P, C = o || (h ? g : null), R = () => {
|
|
3694
|
+
o && a(), g && p && I();
|
|
3690
3695
|
};
|
|
3691
3696
|
if (E)
|
|
3692
|
-
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(
|
|
3697
|
+
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(tn, {}) });
|
|
3693
3698
|
if (C) {
|
|
3694
|
-
const $ = typeof t == "function" ? t(C, R) : t || /* @__PURE__ */ s(
|
|
3699
|
+
const $ = typeof t == "function" ? t(C, R) : t || /* @__PURE__ */ s(nn, { error: C, retry: R });
|
|
3695
3700
|
return /* @__PURE__ */ s(_, { children: $ });
|
|
3696
3701
|
}
|
|
3697
3702
|
return /* @__PURE__ */ s(_, { children: r });
|
|
3698
3703
|
}
|
|
3699
|
-
function
|
|
3700
|
-
const { isAppLoading: e, appError: t, retryApp: n, appInfo:
|
|
3701
|
-
}), I = (a == null ? void 0 : a.isAuthReady) ?? !0, N = (p == null ? void 0 : p.isReady) ?? !0, M = (f == null ? void 0 : f.isReady) ?? !0, P = r &&
|
|
3704
|
+
function Wn(r = !0) {
|
|
3705
|
+
const { isAppLoading: e, appError: t, retryApp: n, appInfo: i } = ye(), o = Se(), a = Ee(), p = Ge(), f = Ze(), w = (o == null ? void 0 : o.isTenantLoading) ?? !1, u = (o == null ? void 0 : o.tenantError) ?? null, b = (o == null ? void 0 : o.tenant) ?? null, g = (o == null ? void 0 : o.tenantSlug) ?? null, T = (o == null ? void 0 : o.retryTenant) ?? (() => {
|
|
3706
|
+
}), I = (a == null ? void 0 : a.isAuthReady) ?? !0, N = (p == null ? void 0 : p.isReady) ?? !0, M = (f == null ? void 0 : f.isReady) ?? !0, P = r && o && g, L = e || P && w || a && !I || p && !N || f && !M, E = t || (P ? u : null);
|
|
3702
3707
|
return {
|
|
3703
3708
|
isLoading: L,
|
|
3704
3709
|
error: E,
|
|
3705
|
-
isReady: !L && !E &&
|
|
3710
|
+
isReady: !L && !E && i !== null && (!P || b !== null),
|
|
3706
3711
|
retry: () => {
|
|
3707
|
-
t && n(), u &&
|
|
3712
|
+
t && n(), u && o && T();
|
|
3708
3713
|
},
|
|
3709
3714
|
// Individual states
|
|
3710
|
-
app: { isLoading: e, error: t, data:
|
|
3711
|
-
tenant:
|
|
3715
|
+
app: { isLoading: e, error: t, data: i },
|
|
3716
|
+
tenant: o ? { isLoading: w, error: u, data: b } : null,
|
|
3712
3717
|
auth: a ? { isReady: I } : null,
|
|
3713
3718
|
featureFlags: p ? { isReady: N } : null,
|
|
3714
3719
|
subscription: f ? { isReady: M } : null
|
|
3715
3720
|
};
|
|
3716
3721
|
}
|
|
3717
|
-
function
|
|
3722
|
+
function Vn({
|
|
3718
3723
|
tenants: r,
|
|
3719
3724
|
currentTenantId: e,
|
|
3720
3725
|
onSelect: t,
|
|
3721
3726
|
className: n = "",
|
|
3722
|
-
dropdownClassName:
|
|
3723
|
-
itemClassName:
|
|
3727
|
+
dropdownClassName: i = "",
|
|
3728
|
+
itemClassName: o = "",
|
|
3724
3729
|
renderItem: a,
|
|
3725
3730
|
placeholder: p = "Select tenant",
|
|
3726
3731
|
disabled: f = !1,
|
|
3727
3732
|
showCurrentTenant: w = !0
|
|
3728
3733
|
}) {
|
|
3729
|
-
var
|
|
3730
|
-
const u =
|
|
3734
|
+
var A;
|
|
3735
|
+
const u = Ee(), [b, g] = x(!1), T = Ve(null), I = r ?? (u == null ? void 0 : u.userTenants) ?? [], N = e ?? ((A = u == null ? void 0 : u.currentUser) == null ? void 0 : A.tenantId) ?? null, M = async (S) => {
|
|
3731
3736
|
g(!1), t ? t(S) : u != null && u.switchToTenant && await u.switchToTenant(S);
|
|
3732
3737
|
};
|
|
3733
3738
|
X(() => {
|
|
@@ -3769,7 +3774,7 @@ function Wn({
|
|
|
3769
3774
|
b && /* @__PURE__ */ s(
|
|
3770
3775
|
"div",
|
|
3771
3776
|
{
|
|
3772
|
-
className:
|
|
3777
|
+
className: i,
|
|
3773
3778
|
style: {
|
|
3774
3779
|
position: "absolute",
|
|
3775
3780
|
top: "100%",
|
|
@@ -3788,7 +3793,7 @@ function Wn({
|
|
|
3788
3793
|
return /* @__PURE__ */ s(
|
|
3789
3794
|
"div",
|
|
3790
3795
|
{
|
|
3791
|
-
className:
|
|
3796
|
+
className: o,
|
|
3792
3797
|
onClick: () => M(S.id),
|
|
3793
3798
|
style: {
|
|
3794
3799
|
padding: "8px 12px",
|
|
@@ -3810,7 +3815,7 @@ function Wn({
|
|
|
3810
3815
|
)
|
|
3811
3816
|
] });
|
|
3812
3817
|
}
|
|
3813
|
-
class
|
|
3818
|
+
class jn {
|
|
3814
3819
|
constructor(e, t) {
|
|
3815
3820
|
this.httpService = e, this.sessionManager = t;
|
|
3816
3821
|
}
|
|
@@ -3831,12 +3836,12 @@ class Vn {
|
|
|
3831
3836
|
throw new Error("SessionManager is required for private endpoints");
|
|
3832
3837
|
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
3833
3838
|
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder);
|
|
3834
|
-
const
|
|
3839
|
+
const i = `/permissions/${n.toString() ? `?${n.toString()}` : ""}`, o = await this.httpService.get(i, {
|
|
3835
3840
|
headers: t
|
|
3836
3841
|
});
|
|
3837
3842
|
return {
|
|
3838
|
-
permissions:
|
|
3839
|
-
meta:
|
|
3843
|
+
permissions: o.data,
|
|
3844
|
+
meta: o.meta
|
|
3840
3845
|
};
|
|
3841
3846
|
}
|
|
3842
3847
|
async getPermissionById(e) {
|
|
@@ -3871,14 +3876,14 @@ class Vn {
|
|
|
3871
3876
|
async getAppPermissions(e, t) {
|
|
3872
3877
|
const n = new URLSearchParams();
|
|
3873
3878
|
t != null && t.page && n.append("page", t.page.toString()), t != null && t.limit && n.append("limit", t.limit.toString()), t != null && t.sortBy && n.append("sortBy", t.sortBy), t != null && t.sortOrder && n.append("sortOrder", t.sortOrder);
|
|
3874
|
-
const
|
|
3879
|
+
const i = `/permissions/apps/${e}${n.toString() ? `?${n.toString()}` : ""}`, o = await this.httpService.get(i);
|
|
3875
3880
|
return {
|
|
3876
|
-
permissions:
|
|
3877
|
-
meta:
|
|
3881
|
+
permissions: o.data,
|
|
3882
|
+
meta: o.meta
|
|
3878
3883
|
};
|
|
3879
3884
|
}
|
|
3880
3885
|
}
|
|
3881
|
-
class
|
|
3886
|
+
class Gn {
|
|
3882
3887
|
constructor(e, t) {
|
|
3883
3888
|
this.httpService = e, this.sessionManager = t;
|
|
3884
3889
|
}
|
|
@@ -3895,12 +3900,12 @@ class jn {
|
|
|
3895
3900
|
async getSubscriptionPlans(e) {
|
|
3896
3901
|
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
3897
3902
|
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder), e != null && e.appId && n.append("appId", e.appId);
|
|
3898
|
-
const
|
|
3903
|
+
const i = `/subscription-plans/${n.toString() ? `?${n.toString()}` : ""}`, o = await this.httpService.get(i, {
|
|
3899
3904
|
headers: t
|
|
3900
3905
|
});
|
|
3901
3906
|
return {
|
|
3902
|
-
plans:
|
|
3903
|
-
meta:
|
|
3907
|
+
plans: o.data,
|
|
3908
|
+
meta: o.meta
|
|
3904
3909
|
};
|
|
3905
3910
|
}
|
|
3906
3911
|
async getSubscriptionPlanById(e) {
|
|
@@ -3929,7 +3934,7 @@ class jn {
|
|
|
3929
3934
|
});
|
|
3930
3935
|
}
|
|
3931
3936
|
}
|
|
3932
|
-
class
|
|
3937
|
+
class Zn {
|
|
3933
3938
|
constructor(e) {
|
|
3934
3939
|
this.httpService = e;
|
|
3935
3940
|
}
|
|
@@ -3938,7 +3943,7 @@ class Gn {
|
|
|
3938
3943
|
return await this.httpService.get("/health");
|
|
3939
3944
|
}
|
|
3940
3945
|
}
|
|
3941
|
-
class
|
|
3946
|
+
class Kn {
|
|
3942
3947
|
// Date string to Date object
|
|
3943
3948
|
static toDate(e) {
|
|
3944
3949
|
return new Date(e);
|
|
@@ -4055,65 +4060,65 @@ class Zn {
|
|
|
4055
4060
|
// Transform query parameters for API calls
|
|
4056
4061
|
static transformQueryParams(e) {
|
|
4057
4062
|
const t = new URLSearchParams();
|
|
4058
|
-
return Object.entries(e).forEach(([n,
|
|
4059
|
-
|
|
4063
|
+
return Object.entries(e).forEach(([n, i]) => {
|
|
4064
|
+
i != null && i !== "" && t.append(n, String(i));
|
|
4060
4065
|
}), t;
|
|
4061
4066
|
}
|
|
4062
4067
|
}
|
|
4063
|
-
const
|
|
4064
|
-
function
|
|
4068
|
+
const Ye = "returnTo", Pe = "zone_return_to", Re = "zone_return_to";
|
|
4069
|
+
function Jn(r = {}) {
|
|
4065
4070
|
const {
|
|
4066
4071
|
zoneRoots: e = {},
|
|
4067
|
-
returnToParam: t =
|
|
4072
|
+
returnToParam: t = Ye,
|
|
4068
4073
|
returnToStorage: n = "url"
|
|
4069
|
-
} = r,
|
|
4074
|
+
} = r, i = ut(), [o, a] = ht(), { isAuthenticated: p, currentUser: f } = le(), { tenant: w } = he(), u = Z(() => ({ ...De, ...e }), [e]), b = !!w, g = f == null ? void 0 : f.userType, T = Z(() => {
|
|
4070
4075
|
switch (n) {
|
|
4071
4076
|
case "url":
|
|
4072
|
-
return
|
|
4077
|
+
return o.get(t);
|
|
4073
4078
|
case "session":
|
|
4074
|
-
return sessionStorage.getItem(
|
|
4079
|
+
return sessionStorage.getItem(Pe);
|
|
4075
4080
|
case "local":
|
|
4076
|
-
return localStorage.getItem(
|
|
4081
|
+
return localStorage.getItem(Re);
|
|
4077
4082
|
default:
|
|
4078
4083
|
return null;
|
|
4079
4084
|
}
|
|
4080
|
-
}, [n,
|
|
4085
|
+
}, [n, o, t]), I = re(() => {
|
|
4081
4086
|
switch (n) {
|
|
4082
4087
|
case "url": {
|
|
4083
|
-
const h = new URLSearchParams(
|
|
4088
|
+
const h = new URLSearchParams(o);
|
|
4084
4089
|
h.delete(t), a(h, { replace: !0 });
|
|
4085
4090
|
break;
|
|
4086
4091
|
}
|
|
4087
4092
|
case "session":
|
|
4088
|
-
sessionStorage.removeItem(
|
|
4093
|
+
sessionStorage.removeItem(Pe);
|
|
4089
4094
|
break;
|
|
4090
4095
|
case "local":
|
|
4091
|
-
localStorage.removeItem(
|
|
4096
|
+
localStorage.removeItem(Re);
|
|
4092
4097
|
break;
|
|
4093
4098
|
}
|
|
4094
|
-
}, [n,
|
|
4099
|
+
}, [n, o, t, a]), N = re(
|
|
4095
4100
|
(h) => {
|
|
4096
4101
|
switch (n) {
|
|
4097
4102
|
case "url": {
|
|
4098
|
-
const
|
|
4099
|
-
|
|
4103
|
+
const A = new URLSearchParams(o);
|
|
4104
|
+
A.set(t, h), a(A, { replace: !0 });
|
|
4100
4105
|
break;
|
|
4101
4106
|
}
|
|
4102
4107
|
case "session":
|
|
4103
|
-
sessionStorage.setItem(
|
|
4108
|
+
sessionStorage.setItem(Pe, h);
|
|
4104
4109
|
break;
|
|
4105
4110
|
case "local":
|
|
4106
|
-
localStorage.setItem(
|
|
4111
|
+
localStorage.setItem(Re, h);
|
|
4107
4112
|
break;
|
|
4108
4113
|
}
|
|
4109
4114
|
},
|
|
4110
|
-
[n,
|
|
4115
|
+
[n, o, t, a]
|
|
4111
4116
|
), M = re(
|
|
4112
4117
|
(h) => {
|
|
4113
|
-
const
|
|
4114
|
-
|
|
4118
|
+
const A = u[h] || u.default;
|
|
4119
|
+
i(A);
|
|
4115
4120
|
},
|
|
4116
|
-
[
|
|
4121
|
+
[i, u]
|
|
4117
4122
|
), P = re(() => b ? p ? g === se.TENANT_ADMIN ? u.tenantAdmin : u.tenantUser : u.tenantGuest : p ? g === se.TENANT_ADMIN ? u.publicAdmin : u.publicUser : u.publicGuest, [b, p, g, u]);
|
|
4118
4123
|
return {
|
|
4119
4124
|
returnToUrl: T,
|
|
@@ -4123,73 +4128,73 @@ function Kn(r = {}) {
|
|
|
4123
4128
|
getSmartRedirect: P
|
|
4124
4129
|
};
|
|
4125
4130
|
}
|
|
4126
|
-
function
|
|
4131
|
+
function Yn(r, e, t = Ye, n = "url") {
|
|
4127
4132
|
if (!e || n !== "url")
|
|
4128
4133
|
return r;
|
|
4129
|
-
const
|
|
4130
|
-
return
|
|
4134
|
+
const i = new URL(r, window.location.origin);
|
|
4135
|
+
return i.searchParams.set(t, e), i.pathname + i.search;
|
|
4131
4136
|
}
|
|
4132
4137
|
export {
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4138
|
+
Ln as AdminZone,
|
|
4139
|
+
Kn as ApiMappers,
|
|
4140
|
+
He as AppApiService,
|
|
4141
|
+
_n as AppLoader,
|
|
4142
|
+
hn as AppProvider,
|
|
4143
|
+
gt as AuthApiService,
|
|
4144
|
+
yn as AuthProvider,
|
|
4145
|
+
In as AuthenticatedZone,
|
|
4146
|
+
Ke as DEFAULT_ZONE_PRESETS,
|
|
4147
|
+
De as DEFAULT_ZONE_ROOTS,
|
|
4148
|
+
$n as FeatureFlag,
|
|
4149
|
+
Tt as FeatureFlagApiService,
|
|
4150
|
+
wn as FeatureFlagProvider,
|
|
4151
|
+
Mn as GuestZone,
|
|
4152
|
+
Zn as HealthApiService,
|
|
4153
|
+
oe as HttpService,
|
|
4149
4154
|
An as LandingRoute,
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4155
|
+
Hn as LoginForm,
|
|
4156
|
+
qn as MagicLinkForm,
|
|
4157
|
+
On as MagicLinkVerify,
|
|
4158
|
+
Fn as OpenZone,
|
|
4159
|
+
zn as PasswordRecoveryForm,
|
|
4160
|
+
jn as PermissionApiService,
|
|
4161
|
+
Tn as Protected,
|
|
4162
|
+
kn as ProtectedRoute,
|
|
4163
|
+
Rn as PublicZone,
|
|
4164
|
+
Be as RoleApiService,
|
|
4165
|
+
Sn as RoutingProvider,
|
|
4161
4166
|
Ae as SessionManager,
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
+
Bn as SignupForm,
|
|
4168
|
+
xt as SubscriptionApiService,
|
|
4169
|
+
Un as SubscriptionGuard,
|
|
4170
|
+
Gn as SubscriptionPlanApiService,
|
|
4171
|
+
bn as SubscriptionProvider,
|
|
4167
4172
|
fe as TenantApiService,
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4173
|
+
Nn as TenantAuthenticatedZone,
|
|
4174
|
+
Cn as TenantGuestZone,
|
|
4175
|
+
Dn as TenantOpenZone,
|
|
4176
|
+
pn as TenantProvider,
|
|
4177
|
+
xn as TenantRoute,
|
|
4178
|
+
Vn as TenantSelector,
|
|
4179
|
+
Pn as TenantZone,
|
|
4180
|
+
pt as UserApiService,
|
|
4176
4181
|
se as UserType,
|
|
4177
|
-
|
|
4182
|
+
En as UserZone,
|
|
4178
4183
|
ae as ZoneRoute,
|
|
4179
|
-
|
|
4180
|
-
|
|
4184
|
+
Yn as buildRedirectUrl,
|
|
4185
|
+
gn as useApi,
|
|
4181
4186
|
ye as useApp,
|
|
4182
|
-
|
|
4187
|
+
Wn as useAppLoaderState,
|
|
4183
4188
|
le as useAuth,
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4189
|
+
kt as useFeatureFlags,
|
|
4190
|
+
vn as useRouting,
|
|
4191
|
+
Pt as useRoutingOptional,
|
|
4192
|
+
mn as useSettings,
|
|
4188
4193
|
At as useSubscription,
|
|
4189
4194
|
he as useTenant,
|
|
4190
4195
|
ge as useTenantInfo,
|
|
4191
4196
|
Se as useTenantOptional,
|
|
4192
|
-
|
|
4193
|
-
|
|
4197
|
+
fn as useTenantSettings,
|
|
4198
|
+
Jn as useZoneNavigation
|
|
4194
4199
|
};
|
|
4195
4200
|
//# sourceMappingURL=index.es.js.map
|