@skylabs-digital/react-identity-access 2.29.0 → 2.31.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 +428 -413
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/services/SessionManager.d.ts +5 -0
- package/dist/services/SessionManager.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as s, Fragment as _, jsxs as h } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as ye, useMemo as
|
|
2
|
+
import { createContext as ye, useMemo as J, useState as x, useCallback as oe, useEffect as ne, useContext as le, useRef as Ne } from "react";
|
|
3
3
|
import { useLocation as xe, Navigate as Se, useNavigate as mt, useSearchParams as yt } from "react-router-dom";
|
|
4
4
|
class de {
|
|
5
5
|
constructor(e, t = 1e4) {
|
|
@@ -18,23 +18,23 @@ class de {
|
|
|
18
18
|
...i == null ? void 0 : i.headers
|
|
19
19
|
};
|
|
20
20
|
if (!(i != null && i.skipAuth) && this.sessionManager) {
|
|
21
|
-
const
|
|
22
|
-
d = { ...d, Authorization: `Bearer ${
|
|
21
|
+
const c = await this.sessionManager.getValidAccessToken();
|
|
22
|
+
d = { ...d, Authorization: `Bearer ${c}` };
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const f = new AbortController(), y = setTimeout(() => f.abort(), a);
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
26
|
+
const c = await fetch(o, {
|
|
27
27
|
method: e,
|
|
28
28
|
headers: d,
|
|
29
29
|
body: r ? JSON.stringify(r) : void 0,
|
|
30
|
-
signal:
|
|
30
|
+
signal: f.signal
|
|
31
31
|
});
|
|
32
|
-
if (clearTimeout(y), !
|
|
33
|
-
throw new Error(`HTTP ${
|
|
34
|
-
const
|
|
35
|
-
return !
|
|
36
|
-
} catch (
|
|
37
|
-
throw clearTimeout(y),
|
|
32
|
+
if (clearTimeout(y), !c.ok)
|
|
33
|
+
throw new Error(`HTTP ${c.status}: ${c.statusText}`);
|
|
34
|
+
const L = c.headers.get("content-type");
|
|
35
|
+
return !L || !L.includes("application/json") ? {} : await c.json();
|
|
36
|
+
} catch (c) {
|
|
37
|
+
throw clearTimeout(y), c instanceof Error && c.name === "AbortError" ? new Error(`Request timeout after ${a}ms`) : c;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
async get(e, t) {
|
|
@@ -111,7 +111,7 @@ class Ve {
|
|
|
111
111
|
}
|
|
112
112
|
const Fe = ye(null);
|
|
113
113
|
function br({ config: n, children: e }) {
|
|
114
|
-
const t =
|
|
114
|
+
const t = J(
|
|
115
115
|
() => {
|
|
116
116
|
var m, T, A;
|
|
117
117
|
return {
|
|
@@ -132,9 +132,9 @@ function br({ config: n, children: e }) {
|
|
|
132
132
|
} catch {
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
135
|
-
}), [o, a] = x(!r), [d,
|
|
135
|
+
}), [o, a] = x(!r), [d, f] = x(null), y = J(() => {
|
|
136
136
|
const m = () => {
|
|
137
|
-
|
|
137
|
+
c();
|
|
138
138
|
};
|
|
139
139
|
return {
|
|
140
140
|
appId: n.appId,
|
|
@@ -145,16 +145,16 @@ function br({ config: n, children: e }) {
|
|
|
145
145
|
appError: d,
|
|
146
146
|
retryApp: m
|
|
147
147
|
};
|
|
148
|
-
}, [n, r, o, d]),
|
|
148
|
+
}, [n, r, o, d]), c = oe(
|
|
149
149
|
async (m = !1) => {
|
|
150
150
|
if (!(!m && t.enabled && r))
|
|
151
151
|
try {
|
|
152
|
-
a(!0),
|
|
153
|
-
const T = new de(n.baseUrl),
|
|
154
|
-
if (i(
|
|
152
|
+
a(!0), f(null);
|
|
153
|
+
const T = new de(n.baseUrl), N = await new Ve(T, {}).getPublicAppInfo(n.appId);
|
|
154
|
+
if (i(N), t.enabled)
|
|
155
155
|
try {
|
|
156
156
|
const M = {
|
|
157
|
-
data:
|
|
157
|
+
data: N,
|
|
158
158
|
timestamp: Date.now(),
|
|
159
159
|
appId: n.appId
|
|
160
160
|
};
|
|
@@ -164,20 +164,20 @@ function br({ config: n, children: e }) {
|
|
|
164
164
|
}
|
|
165
165
|
} catch (T) {
|
|
166
166
|
const A = T instanceof Error ? T : new Error("Failed to load app information");
|
|
167
|
-
|
|
167
|
+
f(A), i(null);
|
|
168
168
|
} finally {
|
|
169
169
|
a(!1);
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
172
|
[n.baseUrl, n.appId, t, r]
|
|
173
|
-
),
|
|
173
|
+
), L = oe(async () => {
|
|
174
174
|
if (!(!t.enabled || !r))
|
|
175
175
|
try {
|
|
176
176
|
const m = localStorage.getItem(t.storageKey);
|
|
177
177
|
if (!m) return;
|
|
178
178
|
const T = JSON.parse(m);
|
|
179
179
|
if (Date.now() - T.timestamp > t.ttl * 0.5) {
|
|
180
|
-
const
|
|
180
|
+
const N = new de(n.baseUrl), P = await new Ve(N, {}).getPublicAppInfo(n.appId);
|
|
181
181
|
i(P);
|
|
182
182
|
const u = {
|
|
183
183
|
data: P,
|
|
@@ -191,7 +191,7 @@ function br({ config: n, children: e }) {
|
|
|
191
191
|
}
|
|
192
192
|
}, [n, t, r]);
|
|
193
193
|
return ne(() => {
|
|
194
|
-
r ?
|
|
194
|
+
r ? L() : c();
|
|
195
195
|
}, []), /* @__PURE__ */ s(Fe.Provider, { value: y, children: e });
|
|
196
196
|
}
|
|
197
197
|
function Ae() {
|
|
@@ -295,6 +295,20 @@ const ie = class ie {
|
|
|
295
295
|
return;
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Extract an arbitrary claim from a JWT token.
|
|
300
|
+
* Returns undefined if the token cannot be decoded or the claim is missing.
|
|
301
|
+
*/
|
|
302
|
+
static extractJwtClaim(e, t) {
|
|
303
|
+
try {
|
|
304
|
+
const r = e.split(".");
|
|
305
|
+
if (r.length !== 3) return;
|
|
306
|
+
const i = JSON.parse(atob(r[1].replace(/-/g, "+").replace(/_/g, "/")));
|
|
307
|
+
return typeof i[t] == "string" ? i[t] : void 0;
|
|
308
|
+
} catch {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
298
312
|
setTokens(e) {
|
|
299
313
|
const t = e.expiresAt || (e.expiresIn ? Date.now() + e.expiresIn * 1e3 : void 0) || ie.extractJwtExpiry(e.accessToken), r = {
|
|
300
314
|
...e,
|
|
@@ -493,34 +507,35 @@ const ie = class ie {
|
|
|
493
507
|
const r = this.getTokens();
|
|
494
508
|
if (r != null && r.accessToken && !this.isTokenExpired(r) && !this.shouldRefreshToken(r))
|
|
495
509
|
return;
|
|
496
|
-
const i = (r == null ? void 0 : r.refreshToken) || e, o = `${this.baseUrl}/auth/refresh
|
|
497
|
-
|
|
510
|
+
const i = (r == null ? void 0 : r.refreshToken) || e, o = `${this.baseUrl}/auth/refresh`, a = ie.extractJwtClaim(i, "deviceId"), d = { refreshToken: i };
|
|
511
|
+
a && (d.deviceId = a);
|
|
512
|
+
let f;
|
|
498
513
|
try {
|
|
499
|
-
|
|
514
|
+
f = await fetch(o, {
|
|
500
515
|
method: "POST",
|
|
501
516
|
headers: { "Content-Type": "application/json" },
|
|
502
|
-
body: JSON.stringify(
|
|
517
|
+
body: JSON.stringify(d)
|
|
503
518
|
});
|
|
504
519
|
} catch (c) {
|
|
505
520
|
throw c instanceof Error ? c : new Error("Network error during token refresh");
|
|
506
521
|
}
|
|
507
|
-
if (!
|
|
522
|
+
if (!f.ok) {
|
|
508
523
|
let c = "";
|
|
509
524
|
try {
|
|
510
|
-
const
|
|
511
|
-
c = (
|
|
525
|
+
const L = await f.json();
|
|
526
|
+
c = (L.message || L.error || "").toLowerCase();
|
|
512
527
|
} catch {
|
|
513
|
-
c =
|
|
528
|
+
c = f.statusText.toLowerCase();
|
|
514
529
|
}
|
|
515
|
-
throw
|
|
530
|
+
throw f.status === 401 ? c.includes("expired") ? new se("token_expired") : c.includes("invalid") ? new se("token_invalid") : new se("token_invalid", `Unauthorized: ${c}`) : f.status === 400 ? c.includes("inactive") ? new se("user_inactive") : c.includes("expired") || c.includes("invalid") ? new se("token_invalid", c) : c.includes("reuse") || c.includes("revoked") ? new se("token_invalid", c) : new Error(`Token refresh failed (400): ${c}`) : new Error(`Token refresh failed: ${f.status} ${c}`);
|
|
516
531
|
}
|
|
517
532
|
if (this.sessionGeneration !== t)
|
|
518
533
|
throw new se("token_invalid", "Session cleared during refresh");
|
|
519
|
-
const
|
|
534
|
+
const y = await f.json();
|
|
520
535
|
this.setTokens({
|
|
521
|
-
accessToken:
|
|
522
|
-
refreshToken:
|
|
523
|
-
expiresIn:
|
|
536
|
+
accessToken: y.accessToken,
|
|
537
|
+
refreshToken: y.refreshToken || i,
|
|
538
|
+
expiresIn: y.expiresIn
|
|
524
539
|
});
|
|
525
540
|
}
|
|
526
541
|
// --- Session expiry handler ---
|
|
@@ -916,102 +931,102 @@ function Sr({ config: n, children: e }) {
|
|
|
916
931
|
search: window.location.search
|
|
917
932
|
},
|
|
918
933
|
window.localStorage
|
|
919
|
-
), [n.tenantMode, n.baseDomain, n.selectorParam, n.fixedTenantSlug]), [a, d] = x(() => o()),
|
|
934
|
+
), [n.tenantMode, n.baseDomain, n.selectorParam, n.fixedTenantSlug]), [a, d] = x(() => o()), f = J(
|
|
920
935
|
() => {
|
|
921
|
-
var
|
|
936
|
+
var g, U, b;
|
|
922
937
|
return {
|
|
923
|
-
enabled: ((
|
|
938
|
+
enabled: ((g = n.cache) == null ? void 0 : g.enabled) ?? !0,
|
|
924
939
|
ttl: ((U = n.cache) == null ? void 0 : U.ttl) ?? 5 * 60 * 1e3,
|
|
925
940
|
// 5 minutes default
|
|
926
941
|
storageKey: ((b = n.cache) == null ? void 0 : b.storageKey) ?? `tenant_cache_${a || "default"}`
|
|
927
942
|
};
|
|
928
943
|
},
|
|
929
944
|
[n.cache, a]
|
|
930
|
-
), [y,
|
|
945
|
+
), [y, c] = x(() => {
|
|
931
946
|
if (n.initialTenant) return n.initialTenant;
|
|
932
|
-
if (!
|
|
947
|
+
if (!f.enabled || !a) return null;
|
|
933
948
|
try {
|
|
934
|
-
const
|
|
935
|
-
if (!
|
|
936
|
-
const U = JSON.parse(
|
|
937
|
-
return Date.now() - U.timestamp <
|
|
949
|
+
const g = localStorage.getItem(f.storageKey);
|
|
950
|
+
if (!g) return null;
|
|
951
|
+
const U = JSON.parse(g);
|
|
952
|
+
return Date.now() - U.timestamp < f.ttl && U.tenantSlug === a ? U.data : (localStorage.removeItem(f.storageKey), null);
|
|
938
953
|
} catch {
|
|
939
954
|
return null;
|
|
940
955
|
}
|
|
941
|
-
}), [
|
|
956
|
+
}), [L, m] = x(!y && !n.initialTenant), [T, A] = x(null), [N, M] = x(null), [P, u] = x(!1), [v, F] = x(null);
|
|
942
957
|
ne(() => {
|
|
943
958
|
if (n.tenantMode === "fixed") return;
|
|
944
|
-
const
|
|
945
|
-
d(
|
|
959
|
+
const g = o();
|
|
960
|
+
d(g);
|
|
946
961
|
}, [o, n.tenantMode]);
|
|
947
|
-
const
|
|
948
|
-
async (
|
|
949
|
-
if (!(!U &&
|
|
962
|
+
const B = (r == null ? void 0 : r.settingsSchema) || null, w = oe(
|
|
963
|
+
async (g, U = !1) => {
|
|
964
|
+
if (!(!U && f.enabled && y && y.domain === g))
|
|
950
965
|
try {
|
|
951
966
|
m(!0), A(null);
|
|
952
|
-
const b = new de(t), S = await new ve(b, i).getPublicTenantInfo(
|
|
953
|
-
if (
|
|
967
|
+
const b = new de(t), S = await new ve(b, i).getPublicTenantInfo(g);
|
|
968
|
+
if (c(S), f.enabled)
|
|
954
969
|
try {
|
|
955
970
|
const E = {
|
|
956
971
|
data: S,
|
|
957
972
|
timestamp: Date.now(),
|
|
958
|
-
tenantSlug:
|
|
973
|
+
tenantSlug: g
|
|
959
974
|
};
|
|
960
|
-
localStorage.setItem(
|
|
975
|
+
localStorage.setItem(f.storageKey, JSON.stringify(E));
|
|
961
976
|
} catch (E) {
|
|
962
977
|
process.env.NODE_ENV === "development" && console.warn("[TenantProvider] Failed to cache tenant info:", E);
|
|
963
978
|
}
|
|
964
979
|
} catch (b) {
|
|
965
980
|
const p = b instanceof Error ? b : new Error("Failed to load tenant information");
|
|
966
|
-
A(p),
|
|
981
|
+
A(p), c(null);
|
|
967
982
|
} finally {
|
|
968
983
|
m(!1);
|
|
969
984
|
}
|
|
970
985
|
},
|
|
971
|
-
[t, i,
|
|
986
|
+
[t, i, f, y]
|
|
972
987
|
), R = oe(async () => {
|
|
973
|
-
if (!(!
|
|
988
|
+
if (!(!f.enabled || !y || !a))
|
|
974
989
|
try {
|
|
975
|
-
const
|
|
976
|
-
if (!
|
|
977
|
-
const U = JSON.parse(
|
|
978
|
-
if (Date.now() - U.timestamp >
|
|
990
|
+
const g = localStorage.getItem(f.storageKey);
|
|
991
|
+
if (!g) return;
|
|
992
|
+
const U = JSON.parse(g);
|
|
993
|
+
if (Date.now() - U.timestamp > f.ttl * 0.5) {
|
|
979
994
|
const p = new de(t), E = await new ve(p, i).getPublicTenantInfo(a);
|
|
980
|
-
|
|
995
|
+
c(E);
|
|
981
996
|
const K = {
|
|
982
997
|
data: E,
|
|
983
998
|
timestamp: Date.now(),
|
|
984
999
|
tenantSlug: a
|
|
985
1000
|
};
|
|
986
|
-
localStorage.setItem(
|
|
1001
|
+
localStorage.setItem(f.storageKey, JSON.stringify(K));
|
|
987
1002
|
}
|
|
988
|
-
} catch (
|
|
989
|
-
process.env.NODE_ENV === "development" && console.warn("[TenantProvider] Background tenant refresh failed:",
|
|
1003
|
+
} catch (g) {
|
|
1004
|
+
process.env.NODE_ENV === "development" && console.warn("[TenantProvider] Background tenant refresh failed:", g);
|
|
990
1005
|
}
|
|
991
|
-
}, [t, i,
|
|
1006
|
+
}, [t, i, f, y, a]), k = oe(async () => {
|
|
992
1007
|
if (y != null && y.id)
|
|
993
1008
|
try {
|
|
994
|
-
u(!0),
|
|
995
|
-
const
|
|
1009
|
+
u(!0), F(null);
|
|
1010
|
+
const g = new de(t), b = await new ve(g, y.appId).getTenantSettings(y.id);
|
|
996
1011
|
M(b);
|
|
997
|
-
} catch (
|
|
998
|
-
const U =
|
|
999
|
-
|
|
1012
|
+
} catch (g) {
|
|
1013
|
+
const U = g instanceof Error ? g : new Error("Failed to load tenant settings");
|
|
1014
|
+
F(U), M(null);
|
|
1000
1015
|
} finally {
|
|
1001
1016
|
u(!1);
|
|
1002
1017
|
}
|
|
1003
1018
|
}, [t, y]), I = oe(() => {
|
|
1004
1019
|
k();
|
|
1005
1020
|
}, [k]), l = oe(
|
|
1006
|
-
(
|
|
1007
|
-
if (
|
|
1021
|
+
(g) => {
|
|
1022
|
+
if (!B)
|
|
1008
1023
|
return { isValid: !0, errors: [] };
|
|
1009
1024
|
const U = [];
|
|
1010
1025
|
try {
|
|
1011
|
-
return
|
|
1026
|
+
return B.properties && Object.entries(B.properties).forEach(([b, p]) => {
|
|
1012
1027
|
var E;
|
|
1013
|
-
const S =
|
|
1014
|
-
if ((E =
|
|
1028
|
+
const S = g[b];
|
|
1029
|
+
if ((E = B.required) != null && E.includes(b) && S == null) {
|
|
1015
1030
|
U.push(`Field '${b}' is required`);
|
|
1016
1031
|
return;
|
|
1017
1032
|
}
|
|
@@ -1037,15 +1052,15 @@ function Sr({ config: n, children: e }) {
|
|
|
1037
1052
|
};
|
|
1038
1053
|
}
|
|
1039
1054
|
},
|
|
1040
|
-
[
|
|
1055
|
+
[B]
|
|
1041
1056
|
);
|
|
1042
1057
|
ne(() => {
|
|
1043
|
-
!n.initialTenant && a ? y ? R() : w(a) : !n.initialTenant && !a && (
|
|
1058
|
+
!n.initialTenant && a ? y ? R() : w(a) : !n.initialTenant && !a && (c(null), A(null), m(!1));
|
|
1044
1059
|
}, [n.initialTenant, a, y, w, R]), ne(() => {
|
|
1045
|
-
y != null && y.id ? k() : (M(null),
|
|
1060
|
+
y != null && y.id ? k() : (M(null), F(null), u(!1));
|
|
1046
1061
|
}, [y == null ? void 0 : y.id, k]);
|
|
1047
1062
|
const z = oe(
|
|
1048
|
-
(
|
|
1063
|
+
(g, U) => {
|
|
1049
1064
|
const { mode: b = "reload", tokens: p, redirectPath: S } = U || {}, E = n.tenantMode || "selector";
|
|
1050
1065
|
if (E === "fixed") {
|
|
1051
1066
|
process.env.NODE_ENV === "development" && console.warn(
|
|
@@ -1054,9 +1069,9 @@ function Sr({ config: n, children: e }) {
|
|
|
1054
1069
|
), S && (window.location.href = S);
|
|
1055
1070
|
return;
|
|
1056
1071
|
}
|
|
1057
|
-
if (localStorage.setItem("tenant",
|
|
1072
|
+
if (localStorage.setItem("tenant", g), E === "subdomain") {
|
|
1058
1073
|
const K = window.location.hostname, G = At(
|
|
1059
|
-
|
|
1074
|
+
g,
|
|
1060
1075
|
K,
|
|
1061
1076
|
n.baseDomain
|
|
1062
1077
|
);
|
|
@@ -1073,28 +1088,28 @@ function Sr({ config: n, children: e }) {
|
|
|
1073
1088
|
}), p && W.searchParams.set(me, je(p)), window.location.href = W.toString();
|
|
1074
1089
|
} else if (E === "selector") {
|
|
1075
1090
|
const K = S || window.location.pathname, G = new URLSearchParams(window.location.search);
|
|
1076
|
-
if (G.set(n.selectorParam || "tenant",
|
|
1091
|
+
if (G.set(n.selectorParam || "tenant", g), G.delete(me), p && G.set(me, je(p)), b === "reload") {
|
|
1077
1092
|
const X = `${K}?${G.toString()}${window.location.hash}`;
|
|
1078
1093
|
window.location.href = X;
|
|
1079
1094
|
} else {
|
|
1080
1095
|
const X = `${K}?${G.toString()}${window.location.hash}`;
|
|
1081
|
-
window.history.pushState({}, "", X), d(
|
|
1096
|
+
window.history.pushState({}, "", X), d(g), w(g);
|
|
1082
1097
|
}
|
|
1083
1098
|
}
|
|
1084
1099
|
},
|
|
1085
1100
|
[n.tenantMode, n.selectorParam, n.baseDomain, w]
|
|
1086
|
-
), D =
|
|
1101
|
+
), D = J(() => ({
|
|
1087
1102
|
// Tenant info
|
|
1088
1103
|
tenant: y,
|
|
1089
1104
|
tenantSlug: a,
|
|
1090
|
-
isTenantLoading:
|
|
1105
|
+
isTenantLoading: L,
|
|
1091
1106
|
tenantError: T,
|
|
1092
1107
|
retryTenant: () => {
|
|
1093
1108
|
a && w(a);
|
|
1094
1109
|
},
|
|
1095
1110
|
// Settings
|
|
1096
|
-
settings:
|
|
1097
|
-
settingsSchema:
|
|
1111
|
+
settings: N,
|
|
1112
|
+
settingsSchema: B,
|
|
1098
1113
|
isSettingsLoading: P,
|
|
1099
1114
|
settingsError: v,
|
|
1100
1115
|
// Actions
|
|
@@ -1105,10 +1120,10 @@ function Sr({ config: n, children: e }) {
|
|
|
1105
1120
|
}), [
|
|
1106
1121
|
y,
|
|
1107
1122
|
a,
|
|
1108
|
-
F,
|
|
1109
|
-
T,
|
|
1110
1123
|
L,
|
|
1111
|
-
|
|
1124
|
+
T,
|
|
1125
|
+
N,
|
|
1126
|
+
B,
|
|
1112
1127
|
P,
|
|
1113
1128
|
v,
|
|
1114
1129
|
I,
|
|
@@ -1137,7 +1152,7 @@ function kr() {
|
|
|
1137
1152
|
validateSettings: i
|
|
1138
1153
|
};
|
|
1139
1154
|
}
|
|
1140
|
-
function
|
|
1155
|
+
function Ze() {
|
|
1141
1156
|
const { tenant: n, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: i } = Te();
|
|
1142
1157
|
return {
|
|
1143
1158
|
tenant: n,
|
|
@@ -1147,31 +1162,31 @@ function Je() {
|
|
|
1147
1162
|
retry: i
|
|
1148
1163
|
};
|
|
1149
1164
|
}
|
|
1150
|
-
const
|
|
1165
|
+
const Be = ye(null);
|
|
1151
1166
|
function xr({ config: n = {}, children: e }) {
|
|
1152
|
-
const t = De(), r = pe(), i = (t == null ? void 0 : t.baseUrl) ?? n.baseUrl ?? "", o = (t == null ? void 0 : t.appId) ?? n.appId, a = (r == null ? void 0 : r.tenant) ?? null, d = (r == null ? void 0 : r.tenantSlug) ?? null,
|
|
1167
|
+
const t = De(), r = pe(), i = (t == null ? void 0 : t.baseUrl) ?? n.baseUrl ?? "", o = (t == null ? void 0 : t.appId) ?? n.appId, a = (r == null ? void 0 : r.tenant) ?? null, d = (r == null ? void 0 : r.tenantSlug) ?? null, f = (r == null ? void 0 : r.switchTenant) ?? (() => {
|
|
1153
1168
|
});
|
|
1154
1169
|
if (!i)
|
|
1155
1170
|
throw new Error(
|
|
1156
1171
|
"[AuthProvider] baseUrl is required. Provide it via AppProvider or AuthConfig.baseUrl."
|
|
1157
1172
|
);
|
|
1158
|
-
const [y,
|
|
1173
|
+
const [y, c] = x(n.initialRoles || []), [L, m] = x(!n.initialRoles), [T, A] = x(null), [N, M] = x(!1), [P, u] = x(null), [v, F] = x(() => {
|
|
1159
1174
|
try {
|
|
1160
|
-
const
|
|
1161
|
-
return
|
|
1175
|
+
const $ = localStorage.getItem("userTenants");
|
|
1176
|
+
return $ ? JSON.parse($) : [];
|
|
1162
1177
|
} catch {
|
|
1163
1178
|
return [];
|
|
1164
1179
|
}
|
|
1165
|
-
}), [
|
|
1180
|
+
}), [B, w] = x(!1), R = Ne({ done: !1, urlTokens: null });
|
|
1166
1181
|
R.current.done || (R.current.done = !0, R.current.urlTokens = Rt());
|
|
1167
|
-
const [k, I] = x(() => R.current.urlTokens !== null), l =
|
|
1168
|
-
const
|
|
1182
|
+
const [k, I] = x(() => R.current.urlTokens !== null), l = J(() => {
|
|
1183
|
+
const $ = be.getInstance({
|
|
1169
1184
|
tenantSlug: d,
|
|
1170
1185
|
baseUrl: i,
|
|
1171
1186
|
refreshQueueTimeout: n.refreshQueueTimeout,
|
|
1172
1187
|
proactiveRefreshMargin: n.proactiveRefreshMargin,
|
|
1173
1188
|
onSessionExpired: (ce) => {
|
|
1174
|
-
A(null), u(null),
|
|
1189
|
+
A(null), u(null), F([]), w(!1);
|
|
1175
1190
|
try {
|
|
1176
1191
|
localStorage.removeItem("userTenants");
|
|
1177
1192
|
} catch {
|
|
@@ -1179,21 +1194,21 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1179
1194
|
n.onSessionExpired ? n.onSessionExpired(ce) : n.onRefreshFailed && n.onRefreshFailed();
|
|
1180
1195
|
}
|
|
1181
1196
|
});
|
|
1182
|
-
return R.current.urlTokens &&
|
|
1197
|
+
return R.current.urlTokens && $.setTokens({
|
|
1183
1198
|
accessToken: R.current.urlTokens.accessToken,
|
|
1184
1199
|
refreshToken: R.current.urlTokens.refreshToken,
|
|
1185
1200
|
expiresIn: R.current.urlTokens.expiresIn
|
|
1186
|
-
}),
|
|
1201
|
+
}), $;
|
|
1187
1202
|
}, [d, i, n.refreshQueueTimeout, n.proactiveRefreshMargin]), [z, D] = x(() => {
|
|
1188
1203
|
if (R.current.urlTokens) return !1;
|
|
1189
|
-
const
|
|
1190
|
-
return
|
|
1191
|
-
}),
|
|
1192
|
-
const
|
|
1193
|
-
return
|
|
1194
|
-
}, [i, l]), b =
|
|
1195
|
-
}), q =
|
|
1196
|
-
const
|
|
1204
|
+
const $ = l.getTokens();
|
|
1205
|
+
return $ ? l.hasValidSession() || !!$.refreshToken : !1;
|
|
1206
|
+
}), g = R.current.done && !k && !z, U = J(() => {
|
|
1207
|
+
const $ = new de(i);
|
|
1208
|
+
return $.setSessionManager(l), $;
|
|
1209
|
+
}, [i, l]), b = J(() => new vt(new de(i)), [i]), p = J(() => new St(U, l), [U, l]), S = J(() => new We(new de(i)), [i]), E = J(() => T || l.getUser(), [T, l]), K = J(() => E != null && E.roleId && y.find(($) => $.id === E.roleId) || null, [E, y]), G = J(() => (K == null ? void 0 : K.permissions) || [], [K]), X = J(() => l.hasValidSession() && T !== null, [l, T]), W = Ne(async () => {
|
|
1210
|
+
}), q = J(() => {
|
|
1211
|
+
const $ = async (C = !1) => {
|
|
1197
1212
|
try {
|
|
1198
1213
|
if (!l.hasValidSession() || !C && T)
|
|
1199
1214
|
return;
|
|
@@ -1203,24 +1218,24 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1203
1218
|
return;
|
|
1204
1219
|
}
|
|
1205
1220
|
M(!0), u(null);
|
|
1206
|
-
const
|
|
1207
|
-
A(
|
|
1221
|
+
const Z = await p.getUserById(O);
|
|
1222
|
+
A(Z), l.setUser(Z);
|
|
1208
1223
|
} catch (O) {
|
|
1209
|
-
const
|
|
1210
|
-
u(
|
|
1224
|
+
const Z = O instanceof Error ? O : new Error("Failed to load user data");
|
|
1225
|
+
u(Z), process.env.NODE_ENV === "development" && console.error("[AuthProvider] Failed to load user data:", Z);
|
|
1211
1226
|
} finally {
|
|
1212
1227
|
M(!1);
|
|
1213
1228
|
}
|
|
1214
1229
|
}, ce = async () => {
|
|
1215
|
-
await
|
|
1230
|
+
await $();
|
|
1216
1231
|
}, fe = async (C) => {
|
|
1217
1232
|
var _e;
|
|
1218
|
-
const { username: O, password:
|
|
1233
|
+
const { username: O, password: Z, tenantSlug: j, redirectPath: Y } = C;
|
|
1219
1234
|
let ee = a == null ? void 0 : a.id, te = d, re = l;
|
|
1220
1235
|
j && (ee = (await new ve(U, o).getPublicTenantInfo(j)).id, te = j);
|
|
1221
1236
|
const Q = await b.login({
|
|
1222
1237
|
username: O,
|
|
1223
|
-
password:
|
|
1238
|
+
password: Z,
|
|
1224
1239
|
appId: o,
|
|
1225
1240
|
tenantId: ee
|
|
1226
1241
|
}), we = j && j !== d;
|
|
@@ -1234,13 +1249,13 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1234
1249
|
}), Q.user) {
|
|
1235
1250
|
re.setUser(Q.user), A(Q.user);
|
|
1236
1251
|
try {
|
|
1237
|
-
await
|
|
1252
|
+
await $();
|
|
1238
1253
|
} catch (ke) {
|
|
1239
1254
|
process.env.NODE_ENV === "development" && console.warn("[AuthProvider] Failed to load complete user data after login:", ke);
|
|
1240
1255
|
}
|
|
1241
1256
|
}
|
|
1242
1257
|
if (Q.tenants && Q.tenants.length > 0) {
|
|
1243
|
-
|
|
1258
|
+
F(Q.tenants);
|
|
1244
1259
|
try {
|
|
1245
1260
|
localStorage.setItem("userTenants", JSON.stringify(Q.tenants));
|
|
1246
1261
|
} catch {
|
|
@@ -1254,27 +1269,27 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1254
1269
|
expiresIn: Q.expiresIn
|
|
1255
1270
|
};
|
|
1256
1271
|
if (we && te)
|
|
1257
|
-
return
|
|
1272
|
+
return f(te, { tokens: Ee, redirectPath: Y }), Q;
|
|
1258
1273
|
if (Y && Y !== window.location.pathname)
|
|
1259
|
-
return
|
|
1274
|
+
return f(te || d || "", { tokens: Ee, redirectPath: Y }), Q;
|
|
1260
1275
|
if (!Re && Q.tenants && Q.tenants.length > 0) {
|
|
1261
1276
|
const ke = C.autoSwitch !== !1 && n.autoSwitchSingleTenant !== !1;
|
|
1262
1277
|
if (Q.tenants.length === 1 && ke) {
|
|
1263
1278
|
const ze = Q.tenants[0];
|
|
1264
|
-
return
|
|
1279
|
+
return f(ze.subdomain, { tokens: Ee, redirectPath: Y }), Q;
|
|
1265
1280
|
} else Q.tenants.length > 1 && n.onTenantSelectionRequired && n.onTenantSelectionRequired(Q.tenants);
|
|
1266
1281
|
}
|
|
1267
1282
|
return Q;
|
|
1268
1283
|
}, ge = async (C) => {
|
|
1269
|
-
const { email: O, phoneNumber:
|
|
1270
|
-
if (!O && !
|
|
1284
|
+
const { email: O, phoneNumber: Z, name: j, password: Y, lastName: ee, tenantId: te } = C;
|
|
1285
|
+
if (!O && !Z)
|
|
1271
1286
|
throw new Error("Either email or phoneNumber is required");
|
|
1272
1287
|
if (!j || !Y)
|
|
1273
1288
|
throw new Error("Name and password are required");
|
|
1274
1289
|
const re = te ?? (a == null ? void 0 : a.id);
|
|
1275
1290
|
return await b.signup({
|
|
1276
1291
|
email: O,
|
|
1277
|
-
phoneNumber:
|
|
1292
|
+
phoneNumber: Z,
|
|
1278
1293
|
name: j,
|
|
1279
1294
|
password: Y,
|
|
1280
1295
|
tenantId: re,
|
|
@@ -1282,14 +1297,14 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1282
1297
|
appId: o
|
|
1283
1298
|
});
|
|
1284
1299
|
}, nt = async (C) => {
|
|
1285
|
-
const { email: O, phoneNumber:
|
|
1286
|
-
if (!O && !
|
|
1300
|
+
const { email: O, phoneNumber: Z, name: j, password: Y, tenantName: ee, lastName: te } = C;
|
|
1301
|
+
if (!O && !Z)
|
|
1287
1302
|
throw new Error("Either email or phoneNumber is required");
|
|
1288
1303
|
if (!j || !Y || !ee)
|
|
1289
1304
|
throw new Error("Name, password, and tenantName are required");
|
|
1290
1305
|
return await b.signupTenantAdmin({
|
|
1291
1306
|
email: O,
|
|
1292
|
-
phoneNumber:
|
|
1307
|
+
phoneNumber: Z,
|
|
1293
1308
|
name: j,
|
|
1294
1309
|
password: Y,
|
|
1295
1310
|
tenantName: ee,
|
|
@@ -1297,35 +1312,35 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1297
1312
|
lastName: te
|
|
1298
1313
|
});
|
|
1299
1314
|
}, st = async (C) => {
|
|
1300
|
-
const { currentPassword: O, newPassword:
|
|
1301
|
-
await b.changePassword({ currentPassword: O, newPassword:
|
|
1315
|
+
const { currentPassword: O, newPassword: Z } = C, j = await l.getAuthHeaders();
|
|
1316
|
+
await b.changePassword({ currentPassword: O, newPassword: Z }, j);
|
|
1302
1317
|
}, it = async (C) => {
|
|
1303
|
-
const { email: O, tenantId:
|
|
1318
|
+
const { email: O, tenantId: Z } = C, j = Z ?? (a == null ? void 0 : a.id);
|
|
1304
1319
|
if (!j)
|
|
1305
1320
|
throw new Error("tenantId is required for password reset");
|
|
1306
1321
|
await b.requestPasswordReset({ email: O, tenantId: j });
|
|
1307
1322
|
}, ot = async (C) => {
|
|
1308
|
-
const { token: O, newPassword:
|
|
1309
|
-
await b.confirmPasswordReset({ token: O, newPassword:
|
|
1323
|
+
const { token: O, newPassword: Z } = C;
|
|
1324
|
+
await b.confirmPasswordReset({ token: O, newPassword: Z });
|
|
1310
1325
|
}, at = async (C) => {
|
|
1311
|
-
const { email: O, frontendUrl:
|
|
1326
|
+
const { email: O, frontendUrl: Z, name: j, lastName: Y, tenantId: ee } = C, te = ee ?? (a == null ? void 0 : a.id);
|
|
1312
1327
|
if (!te)
|
|
1313
1328
|
throw new Error("tenantId is required for magic link authentication");
|
|
1314
1329
|
return await b.sendMagicLink({
|
|
1315
1330
|
email: O,
|
|
1316
1331
|
tenantId: te,
|
|
1317
|
-
frontendUrl:
|
|
1332
|
+
frontendUrl: Z,
|
|
1318
1333
|
name: j,
|
|
1319
1334
|
lastName: Y,
|
|
1320
1335
|
appId: o
|
|
1321
1336
|
});
|
|
1322
1337
|
}, lt = async (C) => {
|
|
1323
|
-
const { token: O, email:
|
|
1338
|
+
const { token: O, email: Z, tenantSlug: j } = C;
|
|
1324
1339
|
let Y = a == null ? void 0 : a.id, ee = d, te = l;
|
|
1325
1340
|
j && (Y = (await new ve(U, o).getPublicTenantInfo(j)).id, ee = j);
|
|
1326
1341
|
const re = await b.verifyMagicLink({
|
|
1327
1342
|
token: O,
|
|
1328
|
-
email:
|
|
1343
|
+
email: Z,
|
|
1329
1344
|
appId: o,
|
|
1330
1345
|
tenantId: Y
|
|
1331
1346
|
}), Q = j && j !== d;
|
|
@@ -1339,7 +1354,7 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1339
1354
|
}), re.user) {
|
|
1340
1355
|
te.setUser(re.user), A(re.user);
|
|
1341
1356
|
try {
|
|
1342
|
-
await
|
|
1357
|
+
await $();
|
|
1343
1358
|
} catch (we) {
|
|
1344
1359
|
process.env.NODE_ENV === "development" && console.warn(
|
|
1345
1360
|
"[AuthProvider] Failed to load complete user data after magic link:",
|
|
@@ -1347,7 +1362,7 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1347
1362
|
);
|
|
1348
1363
|
}
|
|
1349
1364
|
}
|
|
1350
|
-
return Q && ee && ee !== d &&
|
|
1365
|
+
return Q && ee && ee !== d && f(ee, {
|
|
1351
1366
|
tokens: {
|
|
1352
1367
|
accessToken: re.accessToken,
|
|
1353
1368
|
refreshToken: re.refreshToken,
|
|
@@ -1367,7 +1382,7 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1367
1382
|
expiresIn: O.expiresIn
|
|
1368
1383
|
});
|
|
1369
1384
|
}, dt = () => {
|
|
1370
|
-
l.clearSession(), A(null), u(null),
|
|
1385
|
+
l.clearSession(), A(null), u(null), F([]), w(!1);
|
|
1371
1386
|
try {
|
|
1372
1387
|
localStorage.removeItem("userTenants");
|
|
1373
1388
|
} catch {
|
|
@@ -1381,7 +1396,7 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1381
1396
|
try {
|
|
1382
1397
|
m(!0);
|
|
1383
1398
|
const { roles: C } = await S.getRolesByApp(o);
|
|
1384
|
-
|
|
1399
|
+
c(C);
|
|
1385
1400
|
} catch (C) {
|
|
1386
1401
|
process.env.NODE_ENV === "development" && console.error("[AuthProvider] Failed to fetch roles:", C);
|
|
1387
1402
|
} finally {
|
|
@@ -1416,16 +1431,16 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1416
1431
|
hasValidSession: ht,
|
|
1417
1432
|
clearSession: pt,
|
|
1418
1433
|
currentUser: T,
|
|
1419
|
-
isUserLoading:
|
|
1434
|
+
isUserLoading: N,
|
|
1420
1435
|
userError: P,
|
|
1421
|
-
loadUserData:
|
|
1436
|
+
loadUserData: $,
|
|
1422
1437
|
refreshUser: ce,
|
|
1423
|
-
isAuthInitializing: !
|
|
1424
|
-
isAuthReady:
|
|
1438
|
+
isAuthInitializing: !g,
|
|
1439
|
+
isAuthReady: g,
|
|
1425
1440
|
userRole: K,
|
|
1426
1441
|
userPermissions: G,
|
|
1427
1442
|
availableRoles: y,
|
|
1428
|
-
rolesLoading:
|
|
1443
|
+
rolesLoading: L,
|
|
1429
1444
|
hasPermission: Pe,
|
|
1430
1445
|
hasAnyPermission: (C) => C.some((O) => Pe(O)),
|
|
1431
1446
|
hasAllPermissions: (C) => C.every((O) => Pe(O)),
|
|
@@ -1433,9 +1448,9 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1433
1448
|
refreshRoles: gt,
|
|
1434
1449
|
// RFC-004: Multi-tenant user membership
|
|
1435
1450
|
userTenants: v,
|
|
1436
|
-
hasTenantContext:
|
|
1451
|
+
hasTenantContext: B,
|
|
1437
1452
|
switchToTenant: async (C, O) => {
|
|
1438
|
-
const { redirectPath:
|
|
1453
|
+
const { redirectPath: Z } = O || {}, j = l.getTokens();
|
|
1439
1454
|
if (!(j != null && j.refreshToken))
|
|
1440
1455
|
throw new Error("No refresh token available for tenant switch");
|
|
1441
1456
|
const Y = await b.switchTenant({
|
|
@@ -1449,18 +1464,18 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1449
1464
|
expiresIn: Y.expiresIn
|
|
1450
1465
|
}), A(Y.user), l.setUser(Y.user), w(!0);
|
|
1451
1466
|
const ee = v.find((te) => te.id === C);
|
|
1452
|
-
ee &&
|
|
1467
|
+
ee && f(ee.subdomain, {
|
|
1453
1468
|
tokens: {
|
|
1454
1469
|
accessToken: Y.accessToken,
|
|
1455
1470
|
refreshToken: j.refreshToken,
|
|
1456
1471
|
expiresIn: Y.expiresIn
|
|
1457
1472
|
},
|
|
1458
|
-
redirectPath:
|
|
1473
|
+
redirectPath: Z
|
|
1459
1474
|
});
|
|
1460
1475
|
},
|
|
1461
1476
|
refreshUserTenants: async () => {
|
|
1462
1477
|
const C = await l.getAuthHeaders(), O = await b.getUserTenants(C);
|
|
1463
|
-
|
|
1478
|
+
F(O);
|
|
1464
1479
|
try {
|
|
1465
1480
|
localStorage.setItem("userTenants", JSON.stringify(O));
|
|
1466
1481
|
} catch {
|
|
@@ -1478,14 +1493,14 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1478
1493
|
o,
|
|
1479
1494
|
a,
|
|
1480
1495
|
d,
|
|
1481
|
-
|
|
1496
|
+
f,
|
|
1482
1497
|
y,
|
|
1483
1498
|
T,
|
|
1484
|
-
|
|
1499
|
+
N,
|
|
1485
1500
|
P,
|
|
1486
1501
|
v,
|
|
1487
|
-
|
|
1488
|
-
|
|
1502
|
+
B,
|
|
1503
|
+
g,
|
|
1489
1504
|
K,
|
|
1490
1505
|
G
|
|
1491
1506
|
]);
|
|
@@ -1494,7 +1509,7 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1494
1509
|
try {
|
|
1495
1510
|
m(!0);
|
|
1496
1511
|
const ce = new de(i), fe = new We(ce), { roles: ge } = await fe.getRolesByApp(o);
|
|
1497
|
-
|
|
1512
|
+
c(ge);
|
|
1498
1513
|
} catch (ce) {
|
|
1499
1514
|
process.env.NODE_ENV === "development" && console.error("[AuthProvider] Failed to fetch roles:", ce);
|
|
1500
1515
|
} finally {
|
|
@@ -1504,36 +1519,36 @@ function xr({ config: n = {}, children: e }) {
|
|
|
1504
1519
|
}, [o, i, n.initialRoles]);
|
|
1505
1520
|
const [V, H] = x(!1);
|
|
1506
1521
|
return ne(() => {
|
|
1507
|
-
V || (H(!0), R.current.urlTokens && (Et(), I(!0), q.loadUserData().catch((
|
|
1508
|
-
process.env.NODE_ENV === "development" && console.error("[AuthProvider] Failed to load user data after URL tokens:",
|
|
1522
|
+
V || (H(!0), R.current.urlTokens && (Et(), I(!0), q.loadUserData().catch(($) => {
|
|
1523
|
+
process.env.NODE_ENV === "development" && console.error("[AuthProvider] Failed to load user data after URL tokens:", $);
|
|
1509
1524
|
}).finally(() => {
|
|
1510
1525
|
I(!1);
|
|
1511
1526
|
})));
|
|
1512
1527
|
}, [q, V]), ne(() => {
|
|
1513
|
-
let
|
|
1528
|
+
let $ = !1;
|
|
1514
1529
|
return (async () => {
|
|
1515
1530
|
var ge;
|
|
1516
|
-
if (!l.hasValidSession() && ((ge = l.getTokens()) != null && ge.refreshToken) && await l.waitForPendingRefresh(),
|
|
1531
|
+
if (!l.hasValidSession() && ((ge = l.getTokens()) != null && ge.refreshToken) && await l.waitForPendingRefresh(), $) return;
|
|
1517
1532
|
const fe = l.getUser();
|
|
1518
1533
|
fe && l.hasValidSession() && A(fe), D(!1);
|
|
1519
1534
|
})(), () => {
|
|
1520
|
-
|
|
1535
|
+
$ = !0;
|
|
1521
1536
|
};
|
|
1522
1537
|
}, [l]), ne(() => {
|
|
1523
|
-
V && (R.current.urlTokens || (!T && !
|
|
1538
|
+
V && (R.current.urlTokens || (!T && !N && !P && l.hasValidSession() ? W.current().catch(() => {
|
|
1524
1539
|
}).finally(() => {
|
|
1525
1540
|
D(!1);
|
|
1526
1541
|
}) : D(!1)));
|
|
1527
|
-
}, [T,
|
|
1542
|
+
}, [T, N, P, l, V]), /* @__PURE__ */ s(Be.Provider, { value: q, children: e });
|
|
1528
1543
|
}
|
|
1529
1544
|
function he() {
|
|
1530
|
-
const n = le(
|
|
1545
|
+
const n = le(Be);
|
|
1531
1546
|
if (!n)
|
|
1532
1547
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
1533
1548
|
return n;
|
|
1534
1549
|
}
|
|
1535
|
-
function
|
|
1536
|
-
return le(
|
|
1550
|
+
function $e() {
|
|
1551
|
+
return le(Be);
|
|
1537
1552
|
}
|
|
1538
1553
|
class It {
|
|
1539
1554
|
constructor(e, t) {
|
|
@@ -1617,23 +1632,23 @@ class It {
|
|
|
1617
1632
|
}
|
|
1618
1633
|
const Ce = ye(null);
|
|
1619
1634
|
function Ar({ config: n = {}, children: e }) {
|
|
1620
|
-
const t = De(), r = pe(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (t == null ? void 0 : t.appId) ?? "", a = (r == null ? void 0 : r.tenant) ?? null, [d,
|
|
1635
|
+
const t = De(), r = pe(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (t == null ? void 0 : t.appId) ?? "", a = (r == null ? void 0 : r.tenant) ?? null, [d, f] = x([]), [y, c] = x(!1), [L, m] = x(null), [T, A] = x(!1), N = J(() => {
|
|
1621
1636
|
const u = new de(i);
|
|
1622
1637
|
return new It(u);
|
|
1623
1638
|
}, [i]), M = async () => {
|
|
1624
1639
|
if (!(a != null && a.id)) {
|
|
1625
|
-
|
|
1640
|
+
f([]);
|
|
1626
1641
|
return;
|
|
1627
1642
|
}
|
|
1628
|
-
|
|
1643
|
+
c(!0), m(null);
|
|
1629
1644
|
try {
|
|
1630
|
-
const u = await
|
|
1631
|
-
|
|
1645
|
+
const u = await N.getTenantFeatureFlags(a.id, o);
|
|
1646
|
+
f(u);
|
|
1632
1647
|
} catch (u) {
|
|
1633
1648
|
const v = u instanceof Error ? u.message : "Failed to fetch feature flags";
|
|
1634
1649
|
m(v), n.onError && n.onError(u instanceof Error ? u : new Error(v));
|
|
1635
1650
|
} finally {
|
|
1636
|
-
|
|
1651
|
+
c(!1);
|
|
1637
1652
|
}
|
|
1638
1653
|
};
|
|
1639
1654
|
ne(() => {
|
|
@@ -1642,27 +1657,27 @@ function Ar({ config: n = {}, children: e }) {
|
|
|
1642
1657
|
const u = n.refreshInterval || 5 * 60 * 1e3, v = setInterval(M, u);
|
|
1643
1658
|
return () => clearInterval(v);
|
|
1644
1659
|
}, [a == null ? void 0 : a.id, i, o, n.refreshInterval]);
|
|
1645
|
-
const P =
|
|
1660
|
+
const P = J(() => {
|
|
1646
1661
|
const u = (R) => {
|
|
1647
1662
|
const k = d.find((I) => I.key === R);
|
|
1648
1663
|
return (k == null ? void 0 : k.value) === !0;
|
|
1649
|
-
}, v = (R) => d.find((k) => k.key === R),
|
|
1664
|
+
}, v = (R) => d.find((k) => k.key === R), F = (R) => {
|
|
1650
1665
|
const k = d.find((I) => I.key === R);
|
|
1651
1666
|
return k ? k.value ? "enabled" : "disabled" : "not_found";
|
|
1652
|
-
},
|
|
1667
|
+
}, B = async () => {
|
|
1653
1668
|
await M();
|
|
1654
1669
|
}, w = !!(i && o) && (T || !(a != null && a.id));
|
|
1655
1670
|
return {
|
|
1656
1671
|
featureFlags: d,
|
|
1657
1672
|
loading: y,
|
|
1658
|
-
error:
|
|
1673
|
+
error: L,
|
|
1659
1674
|
isReady: w,
|
|
1660
1675
|
isEnabled: u,
|
|
1661
1676
|
getFlag: v,
|
|
1662
|
-
getFlagState:
|
|
1663
|
-
refresh:
|
|
1677
|
+
getFlagState: F,
|
|
1678
|
+
refresh: B
|
|
1664
1679
|
};
|
|
1665
|
-
}, [d, y,
|
|
1680
|
+
}, [d, y, L, i, o, a == null ? void 0 : a.id, T]);
|
|
1666
1681
|
return /* @__PURE__ */ s(Ce.Provider, { value: P, children: e });
|
|
1667
1682
|
}
|
|
1668
1683
|
function Mt() {
|
|
@@ -1742,53 +1757,53 @@ class Lt {
|
|
|
1742
1757
|
}
|
|
1743
1758
|
const He = ye(void 0);
|
|
1744
1759
|
function Pr({ config: n = {}, children: e }) {
|
|
1745
|
-
const t = De(), r = pe(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (r == null ? void 0 : r.tenant) ?? null, [a, d] = x(null), [
|
|
1760
|
+
const t = De(), r = pe(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (r == null ? void 0 : r.tenant) ?? null, [a, d] = x(null), [f, y] = x(!1), [c, L] = x(null), [m, T] = x(!1), A = J(() => {
|
|
1746
1761
|
const P = new de(i);
|
|
1747
1762
|
return new Lt(P);
|
|
1748
|
-
}, [i]),
|
|
1763
|
+
}, [i]), N = async () => {
|
|
1749
1764
|
if (!(o != null && o.id)) {
|
|
1750
1765
|
d(null);
|
|
1751
1766
|
return;
|
|
1752
1767
|
}
|
|
1753
|
-
y(!0),
|
|
1768
|
+
y(!0), L(null);
|
|
1754
1769
|
try {
|
|
1755
1770
|
const P = await A.getTenantSubscriptionFeatures(o.id);
|
|
1756
1771
|
d(P);
|
|
1757
1772
|
} catch (P) {
|
|
1758
1773
|
const u = P instanceof Error ? P.message : "Failed to fetch subscription";
|
|
1759
|
-
|
|
1774
|
+
L(u), n.onError && n.onError(P instanceof Error ? P : new Error(u));
|
|
1760
1775
|
} finally {
|
|
1761
1776
|
y(!1);
|
|
1762
1777
|
}
|
|
1763
1778
|
};
|
|
1764
1779
|
ne(() => {
|
|
1765
|
-
if (!i || (
|
|
1766
|
-
const P = n.refreshInterval || 10 * 60 * 1e3, u = setInterval(
|
|
1780
|
+
if (!i || (N().finally(() => T(!0)), !n.refreshInterval)) return;
|
|
1781
|
+
const P = n.refreshInterval || 10 * 60 * 1e3, u = setInterval(N, P);
|
|
1767
1782
|
return () => clearInterval(u);
|
|
1768
1783
|
}, [o == null ? void 0 : o.id, i, n.refreshInterval]);
|
|
1769
|
-
const M =
|
|
1784
|
+
const M = J(() => {
|
|
1770
1785
|
const P = (a == null ? void 0 : a.features) || [], u = (k) => {
|
|
1771
1786
|
const I = P.find((l) => l.key === k);
|
|
1772
1787
|
return I ? I.type === "BOOLEAN" || I.type === "boolean" ? I.value === !0 : !!I.value : !1;
|
|
1773
|
-
}, v = (k) => P.find((I) => I.key === k),
|
|
1788
|
+
}, v = (k) => P.find((I) => I.key === k), F = (k, I) => {
|
|
1774
1789
|
const l = P.find((z) => z.key === k);
|
|
1775
1790
|
return l ? l.value : I;
|
|
1776
|
-
},
|
|
1777
|
-
await
|
|
1791
|
+
}, B = (k) => !a || !a.isActive ? !1 : k.includes(a.planId), w = async () => {
|
|
1792
|
+
await N();
|
|
1778
1793
|
}, R = !!i && (m || !(o != null && o.id));
|
|
1779
1794
|
return {
|
|
1780
1795
|
subscription: a,
|
|
1781
1796
|
features: P,
|
|
1782
|
-
loading:
|
|
1783
|
-
error:
|
|
1797
|
+
loading: f,
|
|
1798
|
+
error: c,
|
|
1784
1799
|
isReady: R,
|
|
1785
1800
|
isFeatureEnabled: u,
|
|
1786
1801
|
getFeature: v,
|
|
1787
|
-
getFeatureValue:
|
|
1788
|
-
hasAllowedPlan:
|
|
1802
|
+
getFeatureValue: F,
|
|
1803
|
+
hasAllowedPlan: B,
|
|
1789
1804
|
refresh: w
|
|
1790
1805
|
};
|
|
1791
|
-
}, [a,
|
|
1806
|
+
}, [a, f, c, i, o == null ? void 0 : o.id, m]);
|
|
1792
1807
|
return /* @__PURE__ */ s(He.Provider, { value: M, children: e });
|
|
1793
1808
|
}
|
|
1794
1809
|
function Nt() {
|
|
@@ -1828,7 +1843,7 @@ const Oe = {
|
|
|
1828
1843
|
open: { tenant: "optional", auth: "optional" }
|
|
1829
1844
|
}, qe = ye(null);
|
|
1830
1845
|
function Rr({ config: n = {}, children: e }) {
|
|
1831
|
-
const t =
|
|
1846
|
+
const t = J(() => {
|
|
1832
1847
|
const r = {
|
|
1833
1848
|
...Oe,
|
|
1834
1849
|
...n.zoneRoots
|
|
@@ -1959,15 +1974,15 @@ function Ir({
|
|
|
1959
1974
|
requiredPermissions: r,
|
|
1960
1975
|
requireAllPermissions: i = !1
|
|
1961
1976
|
}) {
|
|
1962
|
-
const { hasValidSession: o, sessionManager: a, hasPermission: d, hasAnyPermission:
|
|
1977
|
+
const { hasValidSession: o, sessionManager: a, hasPermission: d, hasAnyPermission: f, hasAllPermissions: y } = he();
|
|
1963
1978
|
if (!o())
|
|
1964
1979
|
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(Ge, {}) });
|
|
1965
|
-
const
|
|
1966
|
-
if (!
|
|
1980
|
+
const c = a.getUser();
|
|
1981
|
+
if (!c)
|
|
1967
1982
|
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(Ge, {}) });
|
|
1968
|
-
if (t && !Dt(
|
|
1969
|
-
return /* @__PURE__ */ s(Ke, { userType:
|
|
1970
|
-
if (r && r.length > 0 && !(i ? y(r) :
|
|
1983
|
+
if (t && !Dt(c.userType, t))
|
|
1984
|
+
return /* @__PURE__ */ s(Ke, { userType: c.userType, minUserType: t });
|
|
1985
|
+
if (r && r.length > 0 && !(i ? y(r) : f(r))) {
|
|
1971
1986
|
const m = r.filter((T) => !d(T)).map((T) => typeof T == "string" ? T : T.name);
|
|
1972
1987
|
return /* @__PURE__ */ s(Ke, { missingPermissions: m });
|
|
1973
1988
|
}
|
|
@@ -2060,7 +2075,7 @@ const Ut = ({ redirectPath: n }) => /* @__PURE__ */ s(
|
|
|
2060
2075
|
}
|
|
2061
2076
|
)
|
|
2062
2077
|
}
|
|
2063
|
-
),
|
|
2078
|
+
), Bt = (n, e) => n === e;
|
|
2064
2079
|
function Mr({
|
|
2065
2080
|
children: n,
|
|
2066
2081
|
redirectTo: e = "/login",
|
|
@@ -2069,7 +2084,7 @@ function Mr({
|
|
|
2069
2084
|
requireAllPermissions: i = !1,
|
|
2070
2085
|
fallback: o
|
|
2071
2086
|
}) {
|
|
2072
|
-
const { hasValidSession: a, sessionManager: d, hasPermission:
|
|
2087
|
+
const { hasValidSession: a, sessionManager: d, hasPermission: f, hasAnyPermission: y, hasAllPermissions: c } = he(), L = xe();
|
|
2073
2088
|
if (ne(() => {
|
|
2074
2089
|
process.env.NODE_ENV === "development" && console.warn(
|
|
2075
2090
|
"[react-identity-access] ProtectedRoute is deprecated. Use AuthenticatedZone or AdminZone from ZoneRoute instead."
|
|
@@ -2077,12 +2092,12 @@ function Mr({
|
|
|
2077
2092
|
}, []), !a())
|
|
2078
2093
|
return o ? /* @__PURE__ */ s(_, { children: o }) : /* @__PURE__ */ h(_, { children: [
|
|
2079
2094
|
/* @__PURE__ */ s(Ut, { redirectPath: e }),
|
|
2080
|
-
/* @__PURE__ */ s(Se, { to: e, state: { from:
|
|
2095
|
+
/* @__PURE__ */ s(Se, { to: e, state: { from: L.pathname }, replace: !0 })
|
|
2081
2096
|
] });
|
|
2082
2097
|
const m = d.getUser();
|
|
2083
2098
|
if (!m)
|
|
2084
|
-
return /* @__PURE__ */ s(Se, { to: e, state: { from:
|
|
2085
|
-
if (t &&
|
|
2099
|
+
return /* @__PURE__ */ s(Se, { to: e, state: { from: L.pathname }, replace: !0 });
|
|
2100
|
+
if (t && !Bt(m.userType, t))
|
|
2086
2101
|
return /* @__PURE__ */ s(
|
|
2087
2102
|
Qe,
|
|
2088
2103
|
{
|
|
@@ -2090,13 +2105,13 @@ function Mr({
|
|
|
2090
2105
|
requiredUserType: t
|
|
2091
2106
|
}
|
|
2092
2107
|
);
|
|
2093
|
-
if (r && r.length > 0 && !(i ?
|
|
2094
|
-
const A = r.filter((
|
|
2108
|
+
if (r && r.length > 0 && !(i ? c(r) : y(r))) {
|
|
2109
|
+
const A = r.filter((N) => !f(N)).map((N) => typeof N == "string" ? N : N.name);
|
|
2095
2110
|
return /* @__PURE__ */ s(Qe, { missingPermissions: A });
|
|
2096
2111
|
}
|
|
2097
2112
|
return /* @__PURE__ */ s(_, { children: n });
|
|
2098
2113
|
}
|
|
2099
|
-
const
|
|
2114
|
+
const $t = ({ redirectPath: n }) => /* @__PURE__ */ s(
|
|
2100
2115
|
"div",
|
|
2101
2116
|
{
|
|
2102
2117
|
style: {
|
|
@@ -2134,13 +2149,13 @@ const Bt = ({ redirectPath: n }) => /* @__PURE__ */ s(
|
|
|
2134
2149
|
}
|
|
2135
2150
|
);
|
|
2136
2151
|
function Lr({ children: n, redirectTo: e = "/", fallback: t }) {
|
|
2137
|
-
const { tenant: r, isLoading: i, error: o } =
|
|
2152
|
+
const { tenant: r, isLoading: i, error: o } = Ze(), a = xe();
|
|
2138
2153
|
return ne(() => {
|
|
2139
2154
|
process.env.NODE_ENV === "development" && console.warn(
|
|
2140
2155
|
"[react-identity-access] TenantRoute is deprecated. Use TenantZone from ZoneRoute instead."
|
|
2141
2156
|
);
|
|
2142
2157
|
}, []), i || o ? null : r ? /* @__PURE__ */ s(_, { children: n }) : t ? /* @__PURE__ */ s(_, { children: t }) : /* @__PURE__ */ h(_, { children: [
|
|
2143
|
-
/* @__PURE__ */ s(
|
|
2158
|
+
/* @__PURE__ */ s($t, { redirectPath: e }),
|
|
2144
2159
|
/* @__PURE__ */ s(Se, { to: e, state: { from: a.pathname }, replace: !0 })
|
|
2145
2160
|
] });
|
|
2146
2161
|
}
|
|
@@ -2182,7 +2197,7 @@ const Ct = ({ redirectPath: n }) => /* @__PURE__ */ s(
|
|
|
2182
2197
|
}
|
|
2183
2198
|
);
|
|
2184
2199
|
function Nr({ children: n, redirectTo: e = "/dashboard", fallback: t }) {
|
|
2185
|
-
const { tenant: r, isLoading: i, error: o } =
|
|
2200
|
+
const { tenant: r, isLoading: i, error: o } = Ze(), a = xe();
|
|
2186
2201
|
return ne(() => {
|
|
2187
2202
|
process.env.NODE_ENV === "development" && console.warn(
|
|
2188
2203
|
"[react-identity-access] LandingRoute is deprecated. Use PublicZone from ZoneRoute instead."
|
|
@@ -2195,11 +2210,11 @@ function Nr({ children: n, redirectTo: e = "/dashboard", fallback: t }) {
|
|
|
2195
2210
|
function Ht(n, e) {
|
|
2196
2211
|
return e ? n ? Array.isArray(e) ? e.includes(n) : n === e : !1 : !0;
|
|
2197
2212
|
}
|
|
2198
|
-
function
|
|
2213
|
+
function Je(n, e) {
|
|
2199
2214
|
return !n || n === "optional" ? "skip" : n === "required" ? e ? "pass" : "fail" : n === "forbidden" ? e ? "fail" : "pass" : "skip";
|
|
2200
2215
|
}
|
|
2201
2216
|
function Ot(n, e) {
|
|
2202
|
-
return
|
|
2217
|
+
return Je(n.tenant, e.hasTenant) === "fail" ? e.hasTenant ? "has_tenant" : "no_tenant" : Je(n.auth, e.isAuthenticated) === "fail" ? e.isAuthenticated ? "already_authenticated" : "not_authenticated" : n.userType && e.isAuthenticated && !Ht(e.userType, n.userType) ? "wrong_user_type" : n.permissions && n.permissions.length > 0 && !(n.requireAllPermissions !== !1 ? (o) => o.every((a) => e.permissions.includes(a)) : (o) => o.some((a) => e.permissions.includes(a)))(n.permissions) ? "missing_permissions" : null;
|
|
2203
2218
|
}
|
|
2204
2219
|
function qt(n, e) {
|
|
2205
2220
|
return n.hasTenant ? n.isAuthenticated ? n.userType === ae.TENANT_ADMIN ? e.tenantAdmin : e.tenantUser : e.tenantGuest : n.isAuthenticated ? n.userType === ae.TENANT_ADMIN ? e.publicAdmin : e.publicUser : e.publicGuest;
|
|
@@ -2224,46 +2239,46 @@ const ue = ({
|
|
|
2224
2239
|
requiredPermissions: o,
|
|
2225
2240
|
requireAllPermissions: a = !0,
|
|
2226
2241
|
returnTo: d,
|
|
2227
|
-
onAccessDenied:
|
|
2242
|
+
onAccessDenied: f,
|
|
2228
2243
|
redirectTo: y,
|
|
2229
|
-
loadingFallback:
|
|
2230
|
-
accessDeniedFallback:
|
|
2244
|
+
loadingFallback: c,
|
|
2245
|
+
accessDeniedFallback: L
|
|
2231
2246
|
}) => {
|
|
2232
|
-
const m = xe(), { isAuthenticated: T, isAuthInitializing: A, currentUser:
|
|
2247
|
+
const m = xe(), { isAuthenticated: T, isAuthInitializing: A, currentUser: N, userPermissions: M } = he(), { tenant: P, isTenantLoading: u } = Te(), v = Ft(), F = J(() => {
|
|
2233
2248
|
if (e)
|
|
2234
2249
|
return v.presets[e];
|
|
2235
|
-
}, [e, v.presets]),
|
|
2250
|
+
}, [e, v.presets]), B = J(
|
|
2236
2251
|
() => ({
|
|
2237
|
-
tenant: t ?? (
|
|
2238
|
-
auth: r ?? (
|
|
2239
|
-
userType: i ?? (
|
|
2240
|
-
permissions: o ?? (
|
|
2252
|
+
tenant: t ?? (F == null ? void 0 : F.tenant),
|
|
2253
|
+
auth: r ?? (F == null ? void 0 : F.auth),
|
|
2254
|
+
userType: i ?? (F == null ? void 0 : F.userType),
|
|
2255
|
+
permissions: o ?? (F == null ? void 0 : F.requiredPermissions),
|
|
2241
2256
|
requireAllPermissions: a
|
|
2242
2257
|
}),
|
|
2243
|
-
[t, r, i, o,
|
|
2244
|
-
), w =
|
|
2258
|
+
[t, r, i, o, F, a]
|
|
2259
|
+
), w = J(
|
|
2245
2260
|
() => ({
|
|
2246
2261
|
hasTenant: !!P,
|
|
2247
2262
|
isAuthenticated: T,
|
|
2248
|
-
userType:
|
|
2263
|
+
userType: N == null ? void 0 : N.userType,
|
|
2249
2264
|
permissions: M,
|
|
2250
2265
|
isLoading: A || u
|
|
2251
2266
|
}),
|
|
2252
2267
|
[
|
|
2253
2268
|
P,
|
|
2254
2269
|
T,
|
|
2255
|
-
|
|
2270
|
+
N == null ? void 0 : N.userType,
|
|
2256
2271
|
M,
|
|
2257
2272
|
A,
|
|
2258
2273
|
u
|
|
2259
2274
|
]
|
|
2260
|
-
), R =
|
|
2275
|
+
), R = J(() => w.isLoading ? null : Ot(B, w), [B, w]), k = J(() => R ? y || qt(w, v.zoneRoots) : null, [R, y, w, v.zoneRoots]), I = J(() => !R || !k ? null : {
|
|
2261
2276
|
type: R,
|
|
2262
2277
|
required: {
|
|
2263
|
-
tenant:
|
|
2264
|
-
auth:
|
|
2265
|
-
userType:
|
|
2266
|
-
permissions:
|
|
2278
|
+
tenant: B.tenant,
|
|
2279
|
+
auth: B.auth,
|
|
2280
|
+
userType: B.userType,
|
|
2281
|
+
permissions: B.permissions
|
|
2267
2282
|
},
|
|
2268
2283
|
current: {
|
|
2269
2284
|
hasTenant: w.hasTenant,
|
|
@@ -2272,10 +2287,10 @@ const ue = ({
|
|
|
2272
2287
|
permissions: w.permissions
|
|
2273
2288
|
},
|
|
2274
2289
|
redirectTo: k
|
|
2275
|
-
}, [R, k,
|
|
2290
|
+
}, [R, k, B, w]);
|
|
2276
2291
|
if (ne(() => {
|
|
2277
|
-
I && (
|
|
2278
|
-
}, [I,
|
|
2292
|
+
I && (f ? f(I) : v.onAccessDenied && v.onAccessDenied(I));
|
|
2293
|
+
}, [I, f, v]), ne(() => {
|
|
2279
2294
|
I && d && zt(d, m.pathname + m.search, v.returnToStorage);
|
|
2280
2295
|
}, [
|
|
2281
2296
|
I,
|
|
@@ -2284,9 +2299,9 @@ const ue = ({
|
|
|
2284
2299
|
m.search,
|
|
2285
2300
|
v.returnToStorage
|
|
2286
2301
|
]), w.isLoading)
|
|
2287
|
-
return /* @__PURE__ */ s(_, { children:
|
|
2302
|
+
return /* @__PURE__ */ s(_, { children: c ?? v.loadingFallback ?? null });
|
|
2288
2303
|
if (I && k) {
|
|
2289
|
-
const l =
|
|
2304
|
+
const l = L ?? v.accessDeniedFallback;
|
|
2290
2305
|
if (l)
|
|
2291
2306
|
return /* @__PURE__ */ s(_, { children: l });
|
|
2292
2307
|
const z = _t(
|
|
@@ -2299,7 +2314,7 @@ const ue = ({
|
|
|
2299
2314
|
return /* @__PURE__ */ s(Se, { to: z, replace: !0 });
|
|
2300
2315
|
}
|
|
2301
2316
|
return /* @__PURE__ */ s(_, { children: n });
|
|
2302
|
-
}, Fr = (n) => /* @__PURE__ */ s(ue, { tenant: "required", ...n }), Dr = (n) => /* @__PURE__ */ s(ue, { tenant: "forbidden", ...n }), Ur = (n) => /* @__PURE__ */ s(ue, { auth: "required", ...n }),
|
|
2317
|
+
}, Fr = (n) => /* @__PURE__ */ s(ue, { tenant: "required", ...n }), Dr = (n) => /* @__PURE__ */ s(ue, { tenant: "forbidden", ...n }), Ur = (n) => /* @__PURE__ */ s(ue, { auth: "required", ...n }), Br = (n) => /* @__PURE__ */ s(ue, { auth: "forbidden", ...n }), $r = (n) => /* @__PURE__ */ s(ue, { auth: "required", userType: ae.TENANT_ADMIN, ...n }), Cr = (n) => /* @__PURE__ */ s(ue, { auth: "required", userType: ae.USER, ...n }), Hr = (n) => /* @__PURE__ */ s(ue, { tenant: "optional", auth: "optional", ...n }), Or = (n) => /* @__PURE__ */ s(ue, { tenant: "required", auth: "required", ...n }), qr = (n) => /* @__PURE__ */ s(ue, { tenant: "required", auth: "optional", ...n }), _r = (n) => /* @__PURE__ */ s(ue, { tenant: "required", auth: "forbidden", ...n }), Vt = () => /* @__PURE__ */ h(
|
|
2303
2318
|
"div",
|
|
2304
2319
|
{
|
|
2305
2320
|
style: {
|
|
@@ -2434,7 +2449,7 @@ const jt = () => /* @__PURE__ */ h(
|
|
|
2434
2449
|
dividerBullet: "•",
|
|
2435
2450
|
showPasswordAriaLabel: "Show password",
|
|
2436
2451
|
hidePasswordAriaLabel: "Hide password"
|
|
2437
|
-
},
|
|
2452
|
+
}, Jt = {
|
|
2438
2453
|
container: {
|
|
2439
2454
|
maxWidth: "400px",
|
|
2440
2455
|
width: "100%",
|
|
@@ -2553,17 +2568,17 @@ function Wr({
|
|
|
2553
2568
|
onForgotPassword: o,
|
|
2554
2569
|
onSignupClick: a,
|
|
2555
2570
|
onMagicLinkClick: d,
|
|
2556
|
-
showForgotPassword:
|
|
2571
|
+
showForgotPassword: f = !0,
|
|
2557
2572
|
showSignupLink: y = !0,
|
|
2558
|
-
showMagicLinkOption:
|
|
2559
|
-
className:
|
|
2573
|
+
showMagicLinkOption: c = !0,
|
|
2574
|
+
className: L
|
|
2560
2575
|
}) {
|
|
2561
|
-
const [m, T] = x(""), [A,
|
|
2576
|
+
const [m, T] = x(""), [A, N] = x(""), [M, P] = x(!1), [u, v] = x(!1), [F, B] = x(""), [w, R] = x({}), { login: k } = he(), I = { ...Qt, ...n }, l = { ...Jt, ...e }, z = { ...Kt, ...t }, D = () => {
|
|
2562
2577
|
const p = {};
|
|
2563
2578
|
return m.trim() || (p.username = !0), A.trim() || (p.password = !0), R(p), Object.keys(p).length === 0;
|
|
2564
|
-
},
|
|
2579
|
+
}, g = async (p) => {
|
|
2565
2580
|
if (p.preventDefault(), !!D()) {
|
|
2566
|
-
v(!0),
|
|
2581
|
+
v(!0), B("");
|
|
2567
2582
|
try {
|
|
2568
2583
|
const S = await k({
|
|
2569
2584
|
username: m,
|
|
@@ -2573,7 +2588,7 @@ function Wr({
|
|
|
2573
2588
|
r == null || r(S);
|
|
2574
2589
|
} catch (S) {
|
|
2575
2590
|
const E = S.message || I.errorMessage;
|
|
2576
|
-
|
|
2591
|
+
B(E), i == null || i(E);
|
|
2577
2592
|
} finally {
|
|
2578
2593
|
v(!1);
|
|
2579
2594
|
}
|
|
@@ -2586,9 +2601,9 @@ function Wr({
|
|
|
2586
2601
|
...u ? l.buttonLoading : {},
|
|
2587
2602
|
...!m || !A || u ? l.buttonDisabled : {}
|
|
2588
2603
|
});
|
|
2589
|
-
return /* @__PURE__ */ h("div", { className:
|
|
2604
|
+
return /* @__PURE__ */ h("div", { className: L, style: l.container, children: [
|
|
2590
2605
|
/* @__PURE__ */ s("h2", { style: l.title, children: I.title }),
|
|
2591
|
-
/* @__PURE__ */ h("form", { onSubmit:
|
|
2606
|
+
/* @__PURE__ */ h("form", { onSubmit: g, style: l.form, children: [
|
|
2592
2607
|
/* @__PURE__ */ h("div", { style: l.fieldGroup, children: [
|
|
2593
2608
|
/* @__PURE__ */ s("label", { style: l.label, children: I.usernameLabel }),
|
|
2594
2609
|
/* @__PURE__ */ s(
|
|
@@ -2618,7 +2633,7 @@ function Wr({
|
|
|
2618
2633
|
type: M ? "text" : "password",
|
|
2619
2634
|
value: A,
|
|
2620
2635
|
onChange: (p) => {
|
|
2621
|
-
|
|
2636
|
+
N(p.target.value), w.password && R((S) => ({ ...S, password: !1 }));
|
|
2622
2637
|
},
|
|
2623
2638
|
placeholder: I.passwordPlaceholder,
|
|
2624
2639
|
style: {
|
|
@@ -2642,19 +2657,19 @@ function Wr({
|
|
|
2642
2657
|
] })
|
|
2643
2658
|
] }),
|
|
2644
2659
|
/* @__PURE__ */ s("button", { type: "submit", disabled: !m || !A || u, style: b(), children: u ? I.loadingText : I.submitButton }),
|
|
2645
|
-
|
|
2660
|
+
F && /* @__PURE__ */ s("div", { style: l.errorText, children: F })
|
|
2646
2661
|
] }),
|
|
2647
|
-
(
|
|
2648
|
-
|
|
2662
|
+
(f || y || c) && /* @__PURE__ */ h("div", { style: l.linkContainer, children: [
|
|
2663
|
+
c && /* @__PURE__ */ h("div", { children: [
|
|
2649
2664
|
/* @__PURE__ */ h("span", { style: l.divider, children: [
|
|
2650
2665
|
I.magicLinkText,
|
|
2651
2666
|
" "
|
|
2652
2667
|
] }),
|
|
2653
2668
|
/* @__PURE__ */ s("a", { onClick: d, style: l.link, children: I.magicLinkLink })
|
|
2654
2669
|
] }),
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2670
|
+
c && (f || y) && /* @__PURE__ */ s("div", { style: l.divider, children: I.dividerBullet }),
|
|
2671
|
+
f && /* @__PURE__ */ s("a", { onClick: o, style: l.link, children: I.forgotPasswordLink }),
|
|
2672
|
+
f && y && /* @__PURE__ */ s("div", { style: l.divider, children: I.dividerBullet }),
|
|
2658
2673
|
y && /* @__PURE__ */ h("div", { children: [
|
|
2659
2674
|
/* @__PURE__ */ h("span", { style: l.divider, children: [
|
|
2660
2675
|
I.signupText,
|
|
@@ -2665,7 +2680,7 @@ function Wr({
|
|
|
2665
2680
|
] })
|
|
2666
2681
|
] });
|
|
2667
2682
|
}
|
|
2668
|
-
const
|
|
2683
|
+
const Zt = {
|
|
2669
2684
|
title: "Create Account",
|
|
2670
2685
|
nameLabel: "First Name",
|
|
2671
2686
|
namePlaceholder: "Enter your first name",
|
|
@@ -2808,17 +2823,17 @@ function jr({
|
|
|
2808
2823
|
onLoginClick: o,
|
|
2809
2824
|
onMagicLinkClick: a,
|
|
2810
2825
|
showLoginLink: d = !0,
|
|
2811
|
-
showMagicLinkOption:
|
|
2826
|
+
showMagicLinkOption: f = !0,
|
|
2812
2827
|
className: y
|
|
2813
2828
|
}) {
|
|
2814
2829
|
var V;
|
|
2815
|
-
const [
|
|
2830
|
+
const [c, L] = x(""), [m, T] = x(""), [A, N] = x(""), [M, P] = x(""), [u, v] = x(""), [F, B] = x(""), [w, R] = x(""), [k, I] = x(!1), [l, z] = x(""), [D, g] = x({}), { signup: U, signupTenantAdmin: b } = he(), p = ((V = pe()) == null ? void 0 : V.tenant) ?? null, S = { ...Zt, ...n }, E = { ...Yt, ...e }, K = () => {
|
|
2816
2831
|
const H = {};
|
|
2817
|
-
return
|
|
2832
|
+
return c.trim() || (H.name = !0), !A.trim() && !M.trim() && (H.email = !0, H.phoneNumber = !0), u.trim() || (H.password = !0), F.trim() || (H.confirmPassword = !0), t === "tenant" && !w.trim() && (H.tenantName = !0), g(H), Object.keys(H).length === 0;
|
|
2818
2833
|
}, G = async (H) => {
|
|
2819
2834
|
if (H.preventDefault(), !!K()) {
|
|
2820
|
-
if (u !==
|
|
2821
|
-
z(S.passwordMismatchError),
|
|
2835
|
+
if (u !== F) {
|
|
2836
|
+
z(S.passwordMismatchError), g({ confirmPassword: !0 });
|
|
2822
2837
|
return;
|
|
2823
2838
|
}
|
|
2824
2839
|
if (t === "user" && !(p != null && p.id)) {
|
|
@@ -2827,24 +2842,24 @@ function jr({
|
|
|
2827
2842
|
}
|
|
2828
2843
|
I(!0), z("");
|
|
2829
2844
|
try {
|
|
2830
|
-
let
|
|
2831
|
-
t === "tenant" ?
|
|
2845
|
+
let $;
|
|
2846
|
+
t === "tenant" ? $ = await b({
|
|
2832
2847
|
email: A || void 0,
|
|
2833
2848
|
phoneNumber: M || void 0,
|
|
2834
|
-
name:
|
|
2849
|
+
name: c,
|
|
2835
2850
|
password: u,
|
|
2836
2851
|
tenantName: w,
|
|
2837
2852
|
lastName: m || void 0
|
|
2838
|
-
}) :
|
|
2853
|
+
}) : $ = await U({
|
|
2839
2854
|
email: A || void 0,
|
|
2840
2855
|
phoneNumber: M || void 0,
|
|
2841
|
-
name:
|
|
2856
|
+
name: c,
|
|
2842
2857
|
password: u,
|
|
2843
2858
|
tenantId: p.id,
|
|
2844
2859
|
lastName: m || void 0
|
|
2845
|
-
}), r == null || r(
|
|
2846
|
-
} catch (
|
|
2847
|
-
const ce =
|
|
2860
|
+
}), r == null || r($);
|
|
2861
|
+
} catch ($) {
|
|
2862
|
+
const ce = $.message || S.errorMessage;
|
|
2848
2863
|
z(ce), i == null || i(ce);
|
|
2849
2864
|
} finally {
|
|
2850
2865
|
I(!1);
|
|
@@ -2856,8 +2871,8 @@ function jr({
|
|
|
2856
2871
|
}), W = () => ({
|
|
2857
2872
|
...E.button,
|
|
2858
2873
|
...k ? E.buttonLoading : {},
|
|
2859
|
-
...!
|
|
2860
|
-
}), q =
|
|
2874
|
+
...!c || !A && !M || !u || !F || k || t === "tenant" && !w ? E.buttonDisabled : {}
|
|
2875
|
+
}), q = c && (A || M) && u && F && (t === "user" || w);
|
|
2861
2876
|
return /* @__PURE__ */ h("div", { className: y, style: E.container, children: [
|
|
2862
2877
|
/* @__PURE__ */ s("h2", { style: E.title, children: S.title }),
|
|
2863
2878
|
/* @__PURE__ */ h("form", { onSubmit: G, style: E.form, children: [
|
|
@@ -2869,9 +2884,9 @@ function jr({
|
|
|
2869
2884
|
id: "name",
|
|
2870
2885
|
name: "name",
|
|
2871
2886
|
type: "text",
|
|
2872
|
-
value:
|
|
2887
|
+
value: c,
|
|
2873
2888
|
onChange: (H) => {
|
|
2874
|
-
|
|
2889
|
+
L(H.target.value), D.name && g(($) => ({ ...$, name: !1 }));
|
|
2875
2890
|
},
|
|
2876
2891
|
placeholder: S.namePlaceholder,
|
|
2877
2892
|
style: X("name"),
|
|
@@ -2905,7 +2920,7 @@ function jr({
|
|
|
2905
2920
|
type: "email",
|
|
2906
2921
|
value: A,
|
|
2907
2922
|
onChange: (H) => {
|
|
2908
|
-
|
|
2923
|
+
N(H.target.value), D.email && g(($) => ({ ...$, email: !1, phoneNumber: !1 }));
|
|
2909
2924
|
},
|
|
2910
2925
|
placeholder: S.emailPlaceholder,
|
|
2911
2926
|
style: X("email"),
|
|
@@ -2923,7 +2938,7 @@ function jr({
|
|
|
2923
2938
|
type: "tel",
|
|
2924
2939
|
value: M,
|
|
2925
2940
|
onChange: (H) => {
|
|
2926
|
-
P(H.target.value), D.phoneNumber &&
|
|
2941
|
+
P(H.target.value), D.phoneNumber && g(($) => ({ ...$, email: !1, phoneNumber: !1 }));
|
|
2927
2942
|
},
|
|
2928
2943
|
placeholder: S.phoneNumberPlaceholder,
|
|
2929
2944
|
style: X("phoneNumber"),
|
|
@@ -2942,7 +2957,7 @@ function jr({
|
|
|
2942
2957
|
type: "password",
|
|
2943
2958
|
value: u,
|
|
2944
2959
|
onChange: (H) => {
|
|
2945
|
-
v(H.target.value), D.password &&
|
|
2960
|
+
v(H.target.value), D.password && g(($) => ({ ...$, password: !1 }));
|
|
2946
2961
|
},
|
|
2947
2962
|
placeholder: S.passwordPlaceholder,
|
|
2948
2963
|
style: X("password"),
|
|
@@ -2958,9 +2973,9 @@ function jr({
|
|
|
2958
2973
|
id: "confirmPassword",
|
|
2959
2974
|
name: "confirmPassword",
|
|
2960
2975
|
type: "password",
|
|
2961
|
-
value:
|
|
2976
|
+
value: F,
|
|
2962
2977
|
onChange: (H) => {
|
|
2963
|
-
|
|
2978
|
+
B(H.target.value), D.confirmPassword && g(($) => ({ ...$, confirmPassword: !1 })), l === S.passwordMismatchError && z("");
|
|
2964
2979
|
},
|
|
2965
2980
|
placeholder: S.confirmPasswordPlaceholder,
|
|
2966
2981
|
style: X("confirmPassword"),
|
|
@@ -2978,7 +2993,7 @@ function jr({
|
|
|
2978
2993
|
type: "text",
|
|
2979
2994
|
value: w,
|
|
2980
2995
|
onChange: (H) => {
|
|
2981
|
-
R(H.target.value), D.tenantName &&
|
|
2996
|
+
R(H.target.value), D.tenantName && g(($) => ({ ...$, tenantName: !1 }));
|
|
2982
2997
|
},
|
|
2983
2998
|
placeholder: S.tenantNamePlaceholder,
|
|
2984
2999
|
style: X("tenantName"),
|
|
@@ -2989,15 +3004,15 @@ function jr({
|
|
|
2989
3004
|
/* @__PURE__ */ s("button", { type: "submit", disabled: !q || k, style: W(), children: k ? S.loadingText : S.submitButton }),
|
|
2990
3005
|
l && /* @__PURE__ */ s("div", { style: E.errorText, children: l })
|
|
2991
3006
|
] }),
|
|
2992
|
-
(d ||
|
|
2993
|
-
|
|
3007
|
+
(d || f) && /* @__PURE__ */ h("div", { style: E.linkContainer, children: [
|
|
3008
|
+
f && /* @__PURE__ */ h("div", { children: [
|
|
2994
3009
|
/* @__PURE__ */ h("span", { style: E.divider, children: [
|
|
2995
3010
|
S.magicLinkText,
|
|
2996
3011
|
" "
|
|
2997
3012
|
] }),
|
|
2998
3013
|
/* @__PURE__ */ s("a", { onClick: a, style: E.link, children: S.magicLinkLink })
|
|
2999
3014
|
] }),
|
|
3000
|
-
|
|
3015
|
+
f && d && /* @__PURE__ */ s("div", { style: E.divider, children: S.dividerBullet }),
|
|
3001
3016
|
d && /* @__PURE__ */ h("div", { children: [
|
|
3002
3017
|
/* @__PURE__ */ h("span", { style: E.divider, children: [
|
|
3003
3018
|
S.loginText,
|
|
@@ -3164,46 +3179,46 @@ function Gr({
|
|
|
3164
3179
|
onSignupClick: o,
|
|
3165
3180
|
showTraditionalLinks: a = !0,
|
|
3166
3181
|
className: d,
|
|
3167
|
-
verifyToken:
|
|
3182
|
+
verifyToken: f,
|
|
3168
3183
|
frontendUrl: y
|
|
3169
3184
|
}) {
|
|
3170
3185
|
var W;
|
|
3171
|
-
const [
|
|
3186
|
+
const [c, L] = x(""), [m, T] = x(""), [A, N] = x(""), [M, P] = x(!1), [u, v] = x(!1), [F, B] = x(""), [w, R] = x(""), [k, I] = x({}), [l, z] = x(!1), { sendMagicLink: D, verifyMagicLink: g } = he(), U = ((W = pe()) == null ? void 0 : W.tenant) ?? null, b = { ...Xt, ...n }, p = { ...er, ...e };
|
|
3172
3187
|
ne(() => {
|
|
3173
|
-
|
|
3174
|
-
}, [
|
|
3188
|
+
f && S(f);
|
|
3189
|
+
}, [f]);
|
|
3175
3190
|
const S = async (q) => {
|
|
3176
|
-
if (!U || !
|
|
3177
|
-
|
|
3191
|
+
if (!U || !c) {
|
|
3192
|
+
B(b.missingTenantOrEmailError);
|
|
3178
3193
|
return;
|
|
3179
3194
|
}
|
|
3180
|
-
v(!0),
|
|
3195
|
+
v(!0), B("");
|
|
3181
3196
|
try {
|
|
3182
|
-
const V = await
|
|
3197
|
+
const V = await g({
|
|
3183
3198
|
token: q,
|
|
3184
|
-
email:
|
|
3199
|
+
email: c
|
|
3185
3200
|
// tenantId inferred from context automatically
|
|
3186
3201
|
});
|
|
3187
3202
|
t == null || t(V);
|
|
3188
3203
|
} catch (V) {
|
|
3189
3204
|
const H = V.message || "Failed to verify magic link";
|
|
3190
|
-
|
|
3205
|
+
B(H), r == null || r(H);
|
|
3191
3206
|
} finally {
|
|
3192
3207
|
v(!1);
|
|
3193
3208
|
}
|
|
3194
3209
|
}, E = () => {
|
|
3195
3210
|
const q = {};
|
|
3196
|
-
return
|
|
3211
|
+
return c.trim() || (q.email = !0), l && !m.trim() && (q.name = !0), I(q), Object.keys(q).length === 0;
|
|
3197
3212
|
}, K = async (q) => {
|
|
3198
3213
|
if (q.preventDefault(), !!E()) {
|
|
3199
3214
|
if (!(U != null && U.id)) {
|
|
3200
|
-
|
|
3215
|
+
B(b.tenantNotFoundError);
|
|
3201
3216
|
return;
|
|
3202
3217
|
}
|
|
3203
|
-
P(!0),
|
|
3218
|
+
P(!0), B(""), R("");
|
|
3204
3219
|
try {
|
|
3205
3220
|
const V = y || (typeof window < "u" ? window.location.origin : ""), H = await D({
|
|
3206
|
-
email:
|
|
3221
|
+
email: c,
|
|
3207
3222
|
tenantId: U.id,
|
|
3208
3223
|
frontendUrl: V,
|
|
3209
3224
|
name: l ? m : void 0,
|
|
@@ -3212,7 +3227,7 @@ function Gr({
|
|
|
3212
3227
|
R(b.successMessage), t == null || t(H);
|
|
3213
3228
|
} catch (V) {
|
|
3214
3229
|
const H = V.message || b.errorMessage;
|
|
3215
|
-
|
|
3230
|
+
B(H), r == null || r(H);
|
|
3216
3231
|
} finally {
|
|
3217
3232
|
P(!1);
|
|
3218
3233
|
}
|
|
@@ -3223,7 +3238,7 @@ function Gr({
|
|
|
3223
3238
|
}), X = () => ({
|
|
3224
3239
|
...p.button,
|
|
3225
3240
|
...M || u ? p.buttonLoading : {},
|
|
3226
|
-
...!
|
|
3241
|
+
...!c || M || u ? p.buttonDisabled : {}
|
|
3227
3242
|
});
|
|
3228
3243
|
return u ? /* @__PURE__ */ h("div", { className: d, style: p.container, children: [
|
|
3229
3244
|
/* @__PURE__ */ s("h2", { style: p.title, children: b.verifyingText }),
|
|
@@ -3240,9 +3255,9 @@ function Gr({
|
|
|
3240
3255
|
id: "email",
|
|
3241
3256
|
name: "email",
|
|
3242
3257
|
type: "email",
|
|
3243
|
-
value:
|
|
3258
|
+
value: c,
|
|
3244
3259
|
onChange: (q) => {
|
|
3245
|
-
|
|
3260
|
+
L(q.target.value), k.email && I((V) => ({ ...V, email: !1 }));
|
|
3246
3261
|
},
|
|
3247
3262
|
placeholder: b.emailPlaceholder,
|
|
3248
3263
|
style: G("email"),
|
|
@@ -3287,7 +3302,7 @@ function Gr({
|
|
|
3287
3302
|
name: "lastName",
|
|
3288
3303
|
type: "text",
|
|
3289
3304
|
value: A,
|
|
3290
|
-
onChange: (q) =>
|
|
3305
|
+
onChange: (q) => N(q.target.value),
|
|
3291
3306
|
placeholder: b.lastNamePlaceholder,
|
|
3292
3307
|
style: p.input,
|
|
3293
3308
|
disabled: M || u
|
|
@@ -3299,15 +3314,15 @@ function Gr({
|
|
|
3299
3314
|
{
|
|
3300
3315
|
type: "button",
|
|
3301
3316
|
onClick: () => {
|
|
3302
|
-
z(!1), T(""),
|
|
3317
|
+
z(!1), T(""), N("");
|
|
3303
3318
|
},
|
|
3304
3319
|
style: p.toggleLink,
|
|
3305
3320
|
children: b.hideNameToggle
|
|
3306
3321
|
}
|
|
3307
3322
|
) })
|
|
3308
3323
|
] }),
|
|
3309
|
-
/* @__PURE__ */ s("button", { type: "submit", disabled: !
|
|
3310
|
-
|
|
3324
|
+
/* @__PURE__ */ s("button", { type: "submit", disabled: !c || M || u, style: X(), children: M ? b.loadingText : b.submitButton }),
|
|
3325
|
+
F && /* @__PURE__ */ s("div", { style: p.errorText, children: F }),
|
|
3311
3326
|
w && /* @__PURE__ */ s("div", { style: p.successText, children: w })
|
|
3312
3327
|
] }),
|
|
3313
3328
|
a && /* @__PURE__ */ h("div", { style: p.linkContainer, children: [
|
|
@@ -3480,25 +3495,25 @@ function Kr({
|
|
|
3480
3495
|
onRetry: o,
|
|
3481
3496
|
onBackToLogin: a,
|
|
3482
3497
|
className: d,
|
|
3483
|
-
token:
|
|
3498
|
+
token: f,
|
|
3484
3499
|
email: y,
|
|
3485
|
-
appId:
|
|
3486
|
-
tenantSlug:
|
|
3500
|
+
appId: c,
|
|
3501
|
+
tenantSlug: L,
|
|
3487
3502
|
autoRedirectDelay: m = 3e3
|
|
3488
3503
|
}) {
|
|
3489
|
-
const [T, A] = x("verifying"), [
|
|
3504
|
+
const [T, A] = x("verifying"), [N, M] = x(""), { verifyMagicLink: P } = he(), u = { ...tr, ...n }, v = { ...tt, ...e }, F = { ...ir, ...t }, B = () => {
|
|
3490
3505
|
if (typeof window > "u") return {};
|
|
3491
3506
|
const l = new URLSearchParams(window.location.search);
|
|
3492
3507
|
return {
|
|
3493
|
-
token:
|
|
3508
|
+
token: f || l.get("token") || "",
|
|
3494
3509
|
email: y || l.get("email") || "",
|
|
3495
|
-
appId:
|
|
3496
|
-
tenantSlug:
|
|
3510
|
+
appId: c || l.get("appId") || "",
|
|
3511
|
+
tenantSlug: L || l.get("tenantSlug") || void 0
|
|
3497
3512
|
};
|
|
3498
3513
|
}, w = async () => {
|
|
3499
3514
|
A("verifying"), M("");
|
|
3500
3515
|
try {
|
|
3501
|
-
const l =
|
|
3516
|
+
const l = B();
|
|
3502
3517
|
if (!l.token || !l.email)
|
|
3503
3518
|
throw new Error(u.missingParamsError);
|
|
3504
3519
|
const z = await P({
|
|
@@ -3525,23 +3540,23 @@ function Kr({
|
|
|
3525
3540
|
switch (T) {
|
|
3526
3541
|
case "verifying":
|
|
3527
3542
|
return /* @__PURE__ */ h("div", { style: v.message, children: [
|
|
3528
|
-
|
|
3543
|
+
F.loading,
|
|
3529
3544
|
u.verifyingMessage
|
|
3530
3545
|
] });
|
|
3531
3546
|
case "success":
|
|
3532
3547
|
return /* @__PURE__ */ h(_, { children: [
|
|
3533
|
-
|
|
3548
|
+
F.success,
|
|
3534
3549
|
/* @__PURE__ */ s("div", { style: v.successMessage, children: u.successMessage })
|
|
3535
3550
|
] });
|
|
3536
3551
|
case "redirecting":
|
|
3537
3552
|
return /* @__PURE__ */ h(_, { children: [
|
|
3538
|
-
|
|
3553
|
+
F.loading,
|
|
3539
3554
|
/* @__PURE__ */ s("div", { style: v.message, children: u.redirectingMessage })
|
|
3540
3555
|
] });
|
|
3541
3556
|
case "error":
|
|
3542
3557
|
return /* @__PURE__ */ h(_, { children: [
|
|
3543
|
-
|
|
3544
|
-
/* @__PURE__ */ s("div", { style: v.errorMessage, children:
|
|
3558
|
+
F.error,
|
|
3559
|
+
/* @__PURE__ */ s("div", { style: v.errorMessage, children: N || u.errorMessage }),
|
|
3545
3560
|
/* @__PURE__ */ h("div", { style: v.buttonContainer, children: [
|
|
3546
3561
|
/* @__PURE__ */ s(
|
|
3547
3562
|
"button",
|
|
@@ -3725,67 +3740,67 @@ function Qr({
|
|
|
3725
3740
|
onError: o,
|
|
3726
3741
|
onBackToLogin: a,
|
|
3727
3742
|
onModeChange: d,
|
|
3728
|
-
className:
|
|
3743
|
+
className: f
|
|
3729
3744
|
}) {
|
|
3730
3745
|
var X;
|
|
3731
|
-
const [y,
|
|
3746
|
+
const [y, c] = x(""), [L, m] = x(r), [T, A] = x(""), [N, M] = x(""), [P, u] = x(!1), [v, F] = x(""), [B, w] = x(""), [R, k] = x({}), { requestPasswordReset: I, confirmPasswordReset: l } = he(), z = ((X = pe()) == null ? void 0 : X.tenant) ?? null, D = { ...or, ...n }, g = { ...ar, ...e }, U = () => {
|
|
3732
3747
|
const W = {};
|
|
3733
3748
|
return y.trim() || (W.email = !0), k(W), Object.keys(W).length === 0;
|
|
3734
3749
|
}, b = () => {
|
|
3735
3750
|
const W = {};
|
|
3736
|
-
return
|
|
3751
|
+
return L.trim() || (W.token = !0), T.trim() || (W.newPassword = !0), N.trim() || (W.confirmPassword = !0), k(W), Object.keys(W).length === 0;
|
|
3737
3752
|
}, p = async (W) => {
|
|
3738
3753
|
if (W.preventDefault(), !!U()) {
|
|
3739
3754
|
if (!(z != null && z.id)) {
|
|
3740
|
-
|
|
3755
|
+
F(D.tenantNotFoundError);
|
|
3741
3756
|
return;
|
|
3742
3757
|
}
|
|
3743
|
-
u(!0),
|
|
3758
|
+
u(!0), F(""), w("");
|
|
3744
3759
|
try {
|
|
3745
3760
|
await I({ email: y, tenantId: z.id }), w(D.successMessage), i == null || i();
|
|
3746
3761
|
} catch (q) {
|
|
3747
3762
|
const V = q.message || D.errorMessage;
|
|
3748
|
-
|
|
3763
|
+
F(V), o == null || o(V);
|
|
3749
3764
|
} finally {
|
|
3750
3765
|
u(!1);
|
|
3751
3766
|
}
|
|
3752
3767
|
}
|
|
3753
3768
|
}, S = async (W) => {
|
|
3754
3769
|
if (W.preventDefault(), !!b()) {
|
|
3755
|
-
if (T !==
|
|
3756
|
-
|
|
3770
|
+
if (T !== N) {
|
|
3771
|
+
F(D.passwordMismatchError), k({ confirmPassword: !0 });
|
|
3757
3772
|
return;
|
|
3758
3773
|
}
|
|
3759
|
-
u(!0),
|
|
3774
|
+
u(!0), F(""), w("");
|
|
3760
3775
|
try {
|
|
3761
|
-
await l({ token:
|
|
3776
|
+
await l({ token: L, newPassword: T }), w(D.resetSuccessMessage), i == null || i();
|
|
3762
3777
|
} catch (q) {
|
|
3763
3778
|
const V = q.message || D.errorMessage;
|
|
3764
|
-
|
|
3779
|
+
F(V), o == null || o(V);
|
|
3765
3780
|
} finally {
|
|
3766
3781
|
u(!1);
|
|
3767
3782
|
}
|
|
3768
3783
|
}
|
|
3769
3784
|
}, E = (W) => ({
|
|
3770
|
-
...
|
|
3771
|
-
...R[W] ?
|
|
3785
|
+
...g.input,
|
|
3786
|
+
...R[W] ? g.inputError : {}
|
|
3772
3787
|
}), K = () => ({
|
|
3773
|
-
...
|
|
3774
|
-
...P ?
|
|
3788
|
+
...g.button,
|
|
3789
|
+
...P ? g.buttonLoading : {}
|
|
3775
3790
|
});
|
|
3776
3791
|
if (t === "reset") {
|
|
3777
|
-
const W =
|
|
3778
|
-
return /* @__PURE__ */ h("div", { className:
|
|
3779
|
-
/* @__PURE__ */ s("h2", { style:
|
|
3780
|
-
/* @__PURE__ */ s("p", { style:
|
|
3781
|
-
/* @__PURE__ */ h("form", { onSubmit: S, style:
|
|
3782
|
-
/* @__PURE__ */ h("div", { style:
|
|
3783
|
-
/* @__PURE__ */ s("label", { style:
|
|
3792
|
+
const W = L && T && N;
|
|
3793
|
+
return /* @__PURE__ */ h("div", { className: f, style: g.container, children: [
|
|
3794
|
+
/* @__PURE__ */ s("h2", { style: g.title, children: D.resetTitle }),
|
|
3795
|
+
/* @__PURE__ */ s("p", { style: g.subtitle, children: D.resetSubtitle }),
|
|
3796
|
+
/* @__PURE__ */ h("form", { onSubmit: S, style: g.form, children: [
|
|
3797
|
+
/* @__PURE__ */ h("div", { style: g.fieldGroup, children: [
|
|
3798
|
+
/* @__PURE__ */ s("label", { style: g.label, children: D.tokenLabel }),
|
|
3784
3799
|
/* @__PURE__ */ s(
|
|
3785
3800
|
"input",
|
|
3786
3801
|
{
|
|
3787
3802
|
type: "text",
|
|
3788
|
-
value:
|
|
3803
|
+
value: L,
|
|
3789
3804
|
onChange: (q) => {
|
|
3790
3805
|
m(q.target.value), R.token && k((V) => ({ ...V, token: !1 }));
|
|
3791
3806
|
},
|
|
@@ -3795,8 +3810,8 @@ function Qr({
|
|
|
3795
3810
|
}
|
|
3796
3811
|
)
|
|
3797
3812
|
] }),
|
|
3798
|
-
/* @__PURE__ */ h("div", { style:
|
|
3799
|
-
/* @__PURE__ */ s("label", { style:
|
|
3813
|
+
/* @__PURE__ */ h("div", { style: g.fieldGroup, children: [
|
|
3814
|
+
/* @__PURE__ */ s("label", { style: g.label, children: D.newPasswordLabel }),
|
|
3800
3815
|
/* @__PURE__ */ s(
|
|
3801
3816
|
"input",
|
|
3802
3817
|
{
|
|
@@ -3811,15 +3826,15 @@ function Qr({
|
|
|
3811
3826
|
}
|
|
3812
3827
|
)
|
|
3813
3828
|
] }),
|
|
3814
|
-
/* @__PURE__ */ h("div", { style:
|
|
3815
|
-
/* @__PURE__ */ s("label", { style:
|
|
3829
|
+
/* @__PURE__ */ h("div", { style: g.fieldGroup, children: [
|
|
3830
|
+
/* @__PURE__ */ s("label", { style: g.label, children: D.confirmPasswordLabel }),
|
|
3816
3831
|
/* @__PURE__ */ s(
|
|
3817
3832
|
"input",
|
|
3818
3833
|
{
|
|
3819
3834
|
type: "password",
|
|
3820
|
-
value:
|
|
3835
|
+
value: N,
|
|
3821
3836
|
onChange: (q) => {
|
|
3822
|
-
M(q.target.value), R.confirmPassword && k((V) => ({ ...V, confirmPassword: !1 })), v === D.passwordMismatchError &&
|
|
3837
|
+
M(q.target.value), R.confirmPassword && k((V) => ({ ...V, confirmPassword: !1 })), v === D.passwordMismatchError && F("");
|
|
3823
3838
|
},
|
|
3824
3839
|
placeholder: D.confirmPasswordPlaceholder,
|
|
3825
3840
|
style: E("confirmPassword"),
|
|
@@ -3834,37 +3849,37 @@ function Qr({
|
|
|
3834
3849
|
disabled: !W || P,
|
|
3835
3850
|
style: {
|
|
3836
3851
|
...K(),
|
|
3837
|
-
...!W || P ?
|
|
3852
|
+
...!W || P ? g.buttonDisabled : {}
|
|
3838
3853
|
},
|
|
3839
3854
|
children: P ? D.resetLoadingText : D.resetSubmitButton
|
|
3840
3855
|
}
|
|
3841
3856
|
),
|
|
3842
|
-
v && /* @__PURE__ */ s("div", { style:
|
|
3843
|
-
|
|
3857
|
+
v && /* @__PURE__ */ s("div", { style: g.errorText, children: v }),
|
|
3858
|
+
B && /* @__PURE__ */ s("div", { style: g.successText, children: B })
|
|
3844
3859
|
] }),
|
|
3845
|
-
/* @__PURE__ */ h("div", { style:
|
|
3846
|
-
/* @__PURE__ */ s("a", { onClick: a, style:
|
|
3860
|
+
/* @__PURE__ */ h("div", { style: g.linkContainer, children: [
|
|
3861
|
+
/* @__PURE__ */ s("a", { onClick: a, style: g.link, children: D.backToLoginLink }),
|
|
3847
3862
|
d && /* @__PURE__ */ h(_, { children: [
|
|
3848
|
-
/* @__PURE__ */ s("span", { style:
|
|
3849
|
-
/* @__PURE__ */ s("a", { onClick: () => d("request"), style:
|
|
3863
|
+
/* @__PURE__ */ s("span", { style: g.modeSwitchDivider, children: D.dividerBullet }),
|
|
3864
|
+
/* @__PURE__ */ s("a", { onClick: () => d("request"), style: g.link, children: D.requestNewLinkLink })
|
|
3850
3865
|
] })
|
|
3851
3866
|
] })
|
|
3852
3867
|
] });
|
|
3853
3868
|
}
|
|
3854
3869
|
const G = y;
|
|
3855
|
-
return /* @__PURE__ */ h("div", { className:
|
|
3856
|
-
/* @__PURE__ */ s("h2", { style:
|
|
3857
|
-
/* @__PURE__ */ s("p", { style:
|
|
3858
|
-
/* @__PURE__ */ h("form", { onSubmit: p, style:
|
|
3859
|
-
/* @__PURE__ */ h("div", { style:
|
|
3860
|
-
/* @__PURE__ */ s("label", { style:
|
|
3870
|
+
return /* @__PURE__ */ h("div", { className: f, style: g.container, children: [
|
|
3871
|
+
/* @__PURE__ */ s("h2", { style: g.title, children: D.title }),
|
|
3872
|
+
/* @__PURE__ */ s("p", { style: g.subtitle, children: D.subtitle }),
|
|
3873
|
+
/* @__PURE__ */ h("form", { onSubmit: p, style: g.form, children: [
|
|
3874
|
+
/* @__PURE__ */ h("div", { style: g.fieldGroup, children: [
|
|
3875
|
+
/* @__PURE__ */ s("label", { style: g.label, children: D.emailLabel }),
|
|
3861
3876
|
/* @__PURE__ */ s(
|
|
3862
3877
|
"input",
|
|
3863
3878
|
{
|
|
3864
3879
|
type: "email",
|
|
3865
3880
|
value: y,
|
|
3866
3881
|
onChange: (W) => {
|
|
3867
|
-
|
|
3882
|
+
c(W.target.value), R.email && k((q) => ({ ...q, email: !1 }));
|
|
3868
3883
|
},
|
|
3869
3884
|
placeholder: D.emailPlaceholder,
|
|
3870
3885
|
style: E("email"),
|
|
@@ -3879,19 +3894,19 @@ function Qr({
|
|
|
3879
3894
|
disabled: !G || P,
|
|
3880
3895
|
style: {
|
|
3881
3896
|
...K(),
|
|
3882
|
-
...!G || P ?
|
|
3897
|
+
...!G || P ? g.buttonDisabled : {}
|
|
3883
3898
|
},
|
|
3884
3899
|
children: P ? D.loadingText : D.submitButton
|
|
3885
3900
|
}
|
|
3886
3901
|
),
|
|
3887
|
-
v && /* @__PURE__ */ s("div", { style:
|
|
3888
|
-
|
|
3902
|
+
v && /* @__PURE__ */ s("div", { style: g.errorText, children: v }),
|
|
3903
|
+
B && /* @__PURE__ */ s("div", { style: g.successText, children: B })
|
|
3889
3904
|
] }),
|
|
3890
|
-
/* @__PURE__ */ h("div", { style:
|
|
3891
|
-
/* @__PURE__ */ s("a", { onClick: a, style:
|
|
3905
|
+
/* @__PURE__ */ h("div", { style: g.linkContainer, children: [
|
|
3906
|
+
/* @__PURE__ */ s("a", { onClick: a, style: g.link, children: D.backToLoginLink }),
|
|
3892
3907
|
d && /* @__PURE__ */ h(_, { children: [
|
|
3893
|
-
/* @__PURE__ */ s("span", { style:
|
|
3894
|
-
/* @__PURE__ */ s("a", { onClick: () => d("reset"), style:
|
|
3908
|
+
/* @__PURE__ */ s("span", { style: g.modeSwitchDivider, children: D.dividerBullet }),
|
|
3909
|
+
/* @__PURE__ */ s("a", { onClick: () => d("reset"), style: g.link, children: D.haveTokenLink })
|
|
3895
3910
|
] })
|
|
3896
3911
|
] })
|
|
3897
3912
|
] });
|
|
@@ -3942,14 +3957,14 @@ const lr = () => /* @__PURE__ */ s(
|
|
|
3942
3957
|
]
|
|
3943
3958
|
}
|
|
3944
3959
|
);
|
|
3945
|
-
function
|
|
3960
|
+
function Jr({
|
|
3946
3961
|
children: n,
|
|
3947
3962
|
loadingFallback: e,
|
|
3948
3963
|
errorFallback: t,
|
|
3949
3964
|
requireTenant: r = !0
|
|
3950
3965
|
}) {
|
|
3951
|
-
const { isAppLoading: i, appError: o, retryApp: a } = Ae(), d = pe(),
|
|
3952
|
-
}),
|
|
3966
|
+
const { isAppLoading: i, appError: o, retryApp: a } = Ae(), d = pe(), f = $e(), y = Ye(), c = Xe(), L = (d == null ? void 0 : d.isTenantLoading) ?? !1, m = (d == null ? void 0 : d.tenantError) ?? null, T = (d == null ? void 0 : d.tenantSlug) ?? null, A = (d == null ? void 0 : d.retryTenant) ?? (() => {
|
|
3967
|
+
}), N = (f == null ? void 0 : f.isAuthReady) ?? !0, M = (y == null ? void 0 : y.isReady) ?? !0, P = (c == null ? void 0 : c.isReady) ?? !0, u = r && d && T, w = i || u && L || f && !N || y && !M || c && !P, R = o || (u ? m : null), k = () => {
|
|
3953
3968
|
o && a(), m && d && A();
|
|
3954
3969
|
};
|
|
3955
3970
|
if (w)
|
|
@@ -3960,22 +3975,22 @@ function Zr({
|
|
|
3960
3975
|
}
|
|
3961
3976
|
return /* @__PURE__ */ s(_, { children: n });
|
|
3962
3977
|
}
|
|
3963
|
-
function
|
|
3964
|
-
const { isAppLoading: e, appError: t, retryApp: r, appInfo: i } = Ae(), o = pe(), a =
|
|
3965
|
-
}), A = (a == null ? void 0 : a.isAuthReady) ?? !0,
|
|
3978
|
+
function Zr(n = !0) {
|
|
3979
|
+
const { isAppLoading: e, appError: t, retryApp: r, appInfo: i } = Ae(), o = pe(), a = $e(), d = Ye(), f = Xe(), y = (o == null ? void 0 : o.isTenantLoading) ?? !1, c = (o == null ? void 0 : o.tenantError) ?? null, L = (o == null ? void 0 : o.tenant) ?? null, m = (o == null ? void 0 : o.tenantSlug) ?? null, T = (o == null ? void 0 : o.retryTenant) ?? (() => {
|
|
3980
|
+
}), A = (a == null ? void 0 : a.isAuthReady) ?? !0, N = (d == null ? void 0 : d.isReady) ?? !0, M = (f == null ? void 0 : f.isReady) ?? !0, P = n && o && m, B = e || P && y || a && !A || d && !N || f && !M, w = t || (P ? c : null);
|
|
3966
3981
|
return {
|
|
3967
|
-
isLoading:
|
|
3982
|
+
isLoading: B,
|
|
3968
3983
|
error: w,
|
|
3969
|
-
isReady:
|
|
3984
|
+
isReady: !B && !w && i !== null && (!P || L !== null),
|
|
3970
3985
|
retry: () => {
|
|
3971
|
-
t && r(),
|
|
3986
|
+
t && r(), c && o && T();
|
|
3972
3987
|
},
|
|
3973
3988
|
// Individual states
|
|
3974
3989
|
app: { isLoading: e, error: t, data: i },
|
|
3975
|
-
tenant: o ? { isLoading: y, error:
|
|
3990
|
+
tenant: o ? { isLoading: y, error: c, data: L } : null,
|
|
3976
3991
|
auth: a ? { isReady: A } : null,
|
|
3977
|
-
featureFlags: d ? { isReady:
|
|
3978
|
-
subscription:
|
|
3992
|
+
featureFlags: d ? { isReady: N } : null,
|
|
3993
|
+
subscription: f ? { isReady: M } : null
|
|
3979
3994
|
};
|
|
3980
3995
|
}
|
|
3981
3996
|
const dr = {
|
|
@@ -4031,34 +4046,34 @@ function Yr({
|
|
|
4031
4046
|
dropdownClassName: o = "",
|
|
4032
4047
|
itemClassName: a = "",
|
|
4033
4048
|
renderItem: d,
|
|
4034
|
-
placeholder:
|
|
4049
|
+
placeholder: f = "Select tenant",
|
|
4035
4050
|
disabled: y = !1,
|
|
4036
|
-
showCurrentTenant:
|
|
4051
|
+
showCurrentTenant: c = !0
|
|
4037
4052
|
}) {
|
|
4038
|
-
var
|
|
4039
|
-
const
|
|
4053
|
+
var B;
|
|
4054
|
+
const L = { ...dr, ...r }, m = $e(), [T, A] = x(!1), N = Ne(null), M = n ?? (m == null ? void 0 : m.userTenants) ?? [], P = e ?? ((B = m == null ? void 0 : m.currentUser) == null ? void 0 : B.tenantId) ?? null, u = async (w) => {
|
|
4040
4055
|
A(!1), t ? t(w) : m != null && m.switchToTenant && await m.switchToTenant(w);
|
|
4041
4056
|
};
|
|
4042
4057
|
ne(() => {
|
|
4043
4058
|
const w = (R) => {
|
|
4044
|
-
|
|
4059
|
+
N.current && !N.current.contains(R.target) && A(!1);
|
|
4045
4060
|
};
|
|
4046
4061
|
return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
|
|
4047
4062
|
}, []);
|
|
4048
4063
|
const v = M.find((w) => w.id === P);
|
|
4049
4064
|
if (M.length === 0)
|
|
4050
4065
|
return null;
|
|
4051
|
-
if (M.length === 1 &&
|
|
4066
|
+
if (M.length === 1 && c)
|
|
4052
4067
|
return /* @__PURE__ */ s("div", { className: i, children: /* @__PURE__ */ s("span", { children: M[0].name }) });
|
|
4053
|
-
const
|
|
4068
|
+
const F = (w, R) => /* @__PURE__ */ h("span", { style: { fontWeight: R ? "bold" : "normal" }, children: [
|
|
4054
4069
|
w.name,
|
|
4055
|
-
w.role && /* @__PURE__ */ h("span", { style:
|
|
4070
|
+
w.role && /* @__PURE__ */ h("span", { style: L.itemRole, children: [
|
|
4056
4071
|
"(",
|
|
4057
4072
|
w.role,
|
|
4058
4073
|
")"
|
|
4059
4074
|
] })
|
|
4060
4075
|
] });
|
|
4061
|
-
return /* @__PURE__ */ h("div", { ref:
|
|
4076
|
+
return /* @__PURE__ */ h("div", { ref: N, className: i, style: L.wrapper, children: [
|
|
4062
4077
|
/* @__PURE__ */ h(
|
|
4063
4078
|
"button",
|
|
4064
4079
|
{
|
|
@@ -4066,16 +4081,16 @@ function Yr({
|
|
|
4066
4081
|
onClick: () => !y && A(!T),
|
|
4067
4082
|
disabled: y,
|
|
4068
4083
|
style: {
|
|
4069
|
-
...
|
|
4070
|
-
...y ?
|
|
4084
|
+
...L.button,
|
|
4085
|
+
...y ? L.buttonDisabled : {}
|
|
4071
4086
|
},
|
|
4072
4087
|
children: [
|
|
4073
|
-
v ? v.name :
|
|
4074
|
-
/* @__PURE__ */ s("span", { style:
|
|
4088
|
+
v ? v.name : f,
|
|
4089
|
+
/* @__PURE__ */ s("span", { style: L.arrow, children: T ? "▲" : "▼" })
|
|
4075
4090
|
]
|
|
4076
4091
|
}
|
|
4077
4092
|
),
|
|
4078
|
-
T && /* @__PURE__ */ s("div", { className: o, style:
|
|
4093
|
+
T && /* @__PURE__ */ s("div", { className: o, style: L.dropdown, children: M.map((w) => {
|
|
4079
4094
|
const R = w.id === P;
|
|
4080
4095
|
return /* @__PURE__ */ s(
|
|
4081
4096
|
"div",
|
|
@@ -4083,21 +4098,21 @@ function Yr({
|
|
|
4083
4098
|
className: a,
|
|
4084
4099
|
onClick: () => u(w.id),
|
|
4085
4100
|
style: {
|
|
4086
|
-
...
|
|
4087
|
-
...R ?
|
|
4101
|
+
...L.item,
|
|
4102
|
+
...R ? L.itemSelected : {}
|
|
4088
4103
|
},
|
|
4089
4104
|
onMouseEnter: (k) => {
|
|
4090
|
-
R || Object.assign(k.currentTarget.style,
|
|
4105
|
+
R || Object.assign(k.currentTarget.style, L.itemHover);
|
|
4091
4106
|
},
|
|
4092
4107
|
onMouseLeave: (k) => {
|
|
4093
4108
|
if (!R) {
|
|
4094
|
-
const I =
|
|
4095
|
-
Object.keys(
|
|
4109
|
+
const I = L.item || {};
|
|
4110
|
+
Object.keys(L.itemHover || {}).forEach((l) => {
|
|
4096
4111
|
k.currentTarget.style[l] = I[l] ?? "";
|
|
4097
4112
|
});
|
|
4098
4113
|
}
|
|
4099
4114
|
},
|
|
4100
|
-
children: d ? d(w, R) :
|
|
4115
|
+
children: d ? d(w, R) : F(w, R)
|
|
4101
4116
|
},
|
|
4102
4117
|
w.id
|
|
4103
4118
|
);
|
|
@@ -4360,7 +4375,7 @@ function nn(n = {}) {
|
|
|
4360
4375
|
zoneRoots: e = {},
|
|
4361
4376
|
returnToParam: t = rt,
|
|
4362
4377
|
returnToStorage: r = "url"
|
|
4363
|
-
} = n, i = mt(), [o, a] = yt(), { isAuthenticated: d, currentUser:
|
|
4378
|
+
} = n, i = mt(), [o, a] = yt(), { isAuthenticated: d, currentUser: f } = he(), { tenant: y } = Te(), c = J(() => ({ ...Oe, ...e }), [e]), L = !!y, m = f == null ? void 0 : f.userType, T = J(() => {
|
|
4364
4379
|
switch (r) {
|
|
4365
4380
|
case "url":
|
|
4366
4381
|
return o.get(t);
|
|
@@ -4385,7 +4400,7 @@ function nn(n = {}) {
|
|
|
4385
4400
|
localStorage.removeItem(Le);
|
|
4386
4401
|
break;
|
|
4387
4402
|
}
|
|
4388
|
-
}, [r, o, t, a]),
|
|
4403
|
+
}, [r, o, t, a]), N = oe(
|
|
4389
4404
|
(u) => {
|
|
4390
4405
|
switch (r) {
|
|
4391
4406
|
case "url": {
|
|
@@ -4404,15 +4419,15 @@ function nn(n = {}) {
|
|
|
4404
4419
|
[r, o, t, a]
|
|
4405
4420
|
), M = oe(
|
|
4406
4421
|
(u) => {
|
|
4407
|
-
const v =
|
|
4422
|
+
const v = c[u] || c.default;
|
|
4408
4423
|
i(v);
|
|
4409
4424
|
},
|
|
4410
|
-
[i,
|
|
4411
|
-
), P = oe(() =>
|
|
4425
|
+
[i, c]
|
|
4426
|
+
), P = oe(() => L ? d ? m === ae.TENANT_ADMIN ? c.tenantAdmin : c.tenantUser : c.tenantGuest : d ? m === ae.TENANT_ADMIN ? c.publicAdmin : c.publicUser : c.publicGuest, [L, d, m, c]);
|
|
4412
4427
|
return {
|
|
4413
4428
|
returnToUrl: T,
|
|
4414
4429
|
clearReturnTo: A,
|
|
4415
|
-
setReturnTo:
|
|
4430
|
+
setReturnTo: N,
|
|
4416
4431
|
navigateToZone: M,
|
|
4417
4432
|
getSmartRedirect: P
|
|
4418
4433
|
};
|
|
@@ -4424,10 +4439,10 @@ function sn(n, e, t = rt, r = "url") {
|
|
|
4424
4439
|
return i.searchParams.set(t, e), i.pathname + i.search;
|
|
4425
4440
|
}
|
|
4426
4441
|
export {
|
|
4427
|
-
|
|
4442
|
+
$r as AdminZone,
|
|
4428
4443
|
rn as ApiMappers,
|
|
4429
4444
|
Ve as AppApiService,
|
|
4430
|
-
|
|
4445
|
+
Jr as AppLoader,
|
|
4431
4446
|
br as AppProvider,
|
|
4432
4447
|
vt as AuthApiService,
|
|
4433
4448
|
xr as AuthProvider,
|
|
@@ -4437,7 +4452,7 @@ export {
|
|
|
4437
4452
|
Vr as FeatureFlag,
|
|
4438
4453
|
It as FeatureFlagApiService,
|
|
4439
4454
|
Ar as FeatureFlagProvider,
|
|
4440
|
-
|
|
4455
|
+
Br as GuestZone,
|
|
4441
4456
|
tn as HealthApiService,
|
|
4442
4457
|
de as HttpService,
|
|
4443
4458
|
Nr as LandingRoute,
|
|
@@ -4476,7 +4491,7 @@ export {
|
|
|
4476
4491
|
sn as buildRedirectUrl,
|
|
4477
4492
|
vr as useApi,
|
|
4478
4493
|
Ae as useApp,
|
|
4479
|
-
|
|
4494
|
+
Zr as useAppLoaderState,
|
|
4480
4495
|
he as useAuth,
|
|
4481
4496
|
Mt as useFeatureFlags,
|
|
4482
4497
|
Er as useRouting,
|
|
@@ -4484,7 +4499,7 @@ export {
|
|
|
4484
4499
|
kr as useSettings,
|
|
4485
4500
|
Nt as useSubscription,
|
|
4486
4501
|
Te as useTenant,
|
|
4487
|
-
|
|
4502
|
+
Ze as useTenantInfo,
|
|
4488
4503
|
pe as useTenantOptional,
|
|
4489
4504
|
Tr as useTenantSettings,
|
|
4490
4505
|
nn as useZoneNavigation
|