@skylabs-digital/react-identity-access 3.2.0 → 3.2.2
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 +356 -344
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/providers/AppProvider.d.ts.map +1 -1
- package/dist/providers/AuthProvider.d.ts.map +1 -1
- package/dist/services/AuthApiService.d.ts +2 -1
- package/dist/services/AuthApiService.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as s, Fragment as
|
|
2
|
-
import me, { createContext as fe, useState as N, useRef as
|
|
3
|
-
import { useLocation as xe, Navigate as
|
|
1
|
+
import { jsx as s, Fragment as U, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import me, { createContext as fe, useState as N, useRef as ye, useCallback as te, useMemo as V, useEffect as re, useContext as ne } from "react";
|
|
3
|
+
import { useLocation as xe, Navigate as we, useNavigate as vt, useSearchParams as Tt } from "react-router-dom";
|
|
4
4
|
class he {
|
|
5
5
|
constructor(e, t = 1e4) {
|
|
6
6
|
this.baseUrl = e.replace(/\/$/, ""), this.timeout = t;
|
|
@@ -98,10 +98,10 @@ class Je {
|
|
|
98
98
|
return (await this.httpService.get(`/apps/${e}/export-config`)).data;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
const $e = fe(null),
|
|
102
|
-
function
|
|
101
|
+
const $e = fe(null), St = 5 * 60 * 1e3;
|
|
102
|
+
function kr({ config: r, children: e }) {
|
|
103
103
|
var k, m, g;
|
|
104
|
-
const { appId: t, baseUrl: n } = r, i = (((k = r.cache) == null ? void 0 : k.enabled) ?? !0) && !!t, a = ((m = r.cache) == null ? void 0 : m.ttl) ??
|
|
104
|
+
const { appId: t, baseUrl: n } = r, i = (((k = r.cache) == null ? void 0 : k.enabled) ?? !0) && !!t, a = ((m = r.cache) == null ? void 0 : m.ttl) ?? St, l = ((g = r.cache) == null ? void 0 : g.storageKey) ?? (t ? `app_cache_${t}` : ""), [d, T] = N(() => {
|
|
105
105
|
if (!i) return null;
|
|
106
106
|
try {
|
|
107
107
|
const b = localStorage.getItem(l);
|
|
@@ -111,15 +111,11 @@ function Sr({ config: r, children: e }) {
|
|
|
111
111
|
} catch {
|
|
112
112
|
return null;
|
|
113
113
|
}
|
|
114
|
-
}), [A, c] = N(!!t && !d), [S, h] = N(null), x =
|
|
114
|
+
}), [A, c] = N(!!t && !d), [S, h] = N(null), x = ye(d);
|
|
115
115
|
x.current = d;
|
|
116
116
|
const P = te(
|
|
117
117
|
async (b = !1) => {
|
|
118
|
-
if (!
|
|
119
|
-
c(!1), h(null);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (!(!b && i && x.current))
|
|
118
|
+
if (t && !(!b && i && x.current))
|
|
123
119
|
try {
|
|
124
120
|
c(!0), h(null);
|
|
125
121
|
const o = await new Je(new he(n)).getPublicAppInfo(t);
|
|
@@ -186,7 +182,7 @@ function Ae() {
|
|
|
186
182
|
function Ue() {
|
|
187
183
|
return ne($e);
|
|
188
184
|
}
|
|
189
|
-
const
|
|
185
|
+
const Er = Ae;
|
|
190
186
|
class ee extends Error {
|
|
191
187
|
constructor(e, t) {
|
|
192
188
|
const n = {
|
|
@@ -197,12 +193,12 @@ class ee extends Error {
|
|
|
197
193
|
super(t || n[e]), this.name = "SessionExpiredError", this.reason = e;
|
|
198
194
|
}
|
|
199
195
|
}
|
|
200
|
-
class
|
|
196
|
+
class kt extends Error {
|
|
201
197
|
constructor(e) {
|
|
202
198
|
super(`Token refresh timed out after ${e}ms`), this.name = "TokenRefreshTimeoutError", this.timeoutMs = e;
|
|
203
199
|
}
|
|
204
200
|
}
|
|
205
|
-
class
|
|
201
|
+
class Et extends Error {
|
|
206
202
|
constructor(e, t) {
|
|
207
203
|
super(
|
|
208
204
|
`Token refresh failed after ${e} attempts: ${(t == null ? void 0 : t.message) || "Unknown error"}`
|
|
@@ -211,10 +207,10 @@ class kt extends Error {
|
|
|
211
207
|
}
|
|
212
208
|
class oe extends Error {
|
|
213
209
|
constructor(e, t, n) {
|
|
214
|
-
super(`Invalid configuration "${e}": ${n} (received: ${
|
|
210
|
+
super(`Invalid configuration "${e}": ${n} (received: ${xt(t)})`), this.name = "ConfigurationError", this.field = e, this.received = t;
|
|
215
211
|
}
|
|
216
212
|
}
|
|
217
|
-
function
|
|
213
|
+
function xt(r) {
|
|
218
214
|
if (r === void 0) return "undefined";
|
|
219
215
|
try {
|
|
220
216
|
const e = JSON.stringify(r);
|
|
@@ -239,19 +235,19 @@ function Ke(r) {
|
|
|
239
235
|
const e = Re(r), t = e == null ? void 0 : e.payload.exp;
|
|
240
236
|
return typeof t == "number" ? t * 1e3 : void 0;
|
|
241
237
|
}
|
|
242
|
-
function
|
|
238
|
+
function At(r, e) {
|
|
243
239
|
var n;
|
|
244
240
|
const t = (n = Re(r)) == null ? void 0 : n.payload[e];
|
|
245
241
|
return typeof t == "string" ? t : void 0;
|
|
246
242
|
}
|
|
247
|
-
const
|
|
248
|
-
function
|
|
243
|
+
const Rt = /^(javascript|data|vbscript|file):/i, Pt = /^https?:\/\//i;
|
|
244
|
+
function It(r, e = "baseUrl") {
|
|
249
245
|
if (!(r == null || r === "")) {
|
|
250
246
|
if (typeof r != "string")
|
|
251
247
|
throw new oe(e, r, "must be a string");
|
|
252
|
-
if (
|
|
248
|
+
if (Rt.test(r))
|
|
253
249
|
throw new oe(e, r, "dangerous URL scheme is not allowed");
|
|
254
|
-
if (!
|
|
250
|
+
if (!Pt.test(r))
|
|
255
251
|
throw new oe(e, r, "must start with http:// or https://");
|
|
256
252
|
}
|
|
257
253
|
}
|
|
@@ -269,7 +265,7 @@ function Ye(r, e) {
|
|
|
269
265
|
if (e !== void 0 && typeof e != "boolean")
|
|
270
266
|
throw new oe(r, e, "must be a boolean");
|
|
271
267
|
}
|
|
272
|
-
function
|
|
268
|
+
function Lt(r, e = "accessToken") {
|
|
273
269
|
if (typeof r != "string" || r.length === 0)
|
|
274
270
|
throw new oe(e, r, "must be a non-empty string");
|
|
275
271
|
if (!r.includes(".")) return;
|
|
@@ -287,11 +283,11 @@ function It(r, e = "accessToken") {
|
|
|
287
283
|
"JWT header or payload is not valid base64url-encoded JSON"
|
|
288
284
|
);
|
|
289
285
|
}
|
|
290
|
-
function
|
|
286
|
+
function Ft(r) {
|
|
291
287
|
if (r !== void 0 && (typeof r != "number" || !Number.isFinite(r) || r <= 0))
|
|
292
288
|
throw new oe("expiresIn", r, "must be a finite positive number (seconds)");
|
|
293
289
|
}
|
|
294
|
-
function
|
|
290
|
+
function Nt(r) {
|
|
295
291
|
if (r !== void 0 && (typeof r != "number" || !Number.isFinite(r) || r <= 0))
|
|
296
292
|
throw new oe(
|
|
297
293
|
"expiresAt",
|
|
@@ -325,7 +321,7 @@ const ie = class ie {
|
|
|
325
321
|
return e.storageKey || "auth_tokens";
|
|
326
322
|
}
|
|
327
323
|
static validateConfig(e) {
|
|
328
|
-
|
|
324
|
+
It(e.baseUrl), Ye("enableCookieSession", e.enableCookieSession), Ye("autoRefresh", e.autoRefresh), ge("refreshThreshold", e.refreshThreshold, { min: 0 }), ge("proactiveRefreshMargin", e.proactiveRefreshMargin, { min: 0 }), ge("refreshQueueTimeout", e.refreshQueueTimeout, { min: 1 }), ge("maxRefreshRetries", e.maxRefreshRetries, { min: 0 }), ge("retryBackoffBase", e.retryBackoffBase, { min: 1 });
|
|
329
325
|
}
|
|
330
326
|
/** Update mutable config (callbacks, baseUrl) on an existing instance. */
|
|
331
327
|
updateConfig(e) {
|
|
@@ -394,9 +390,9 @@ const ie = class ie {
|
|
|
394
390
|
}
|
|
395
391
|
// --- Token CRUD ---
|
|
396
392
|
setTokens(e) {
|
|
397
|
-
if (
|
|
393
|
+
if (Lt(e.accessToken, "accessToken"), e.refreshToken !== void 0 && typeof e.refreshToken != "string")
|
|
398
394
|
throw new oe("refreshToken", e.refreshToken, "must be a string");
|
|
399
|
-
|
|
395
|
+
Ft(e.expiresIn), Nt(e.expiresAt);
|
|
400
396
|
const t = e.expiresAt || (e.expiresIn ? Date.now() + e.expiresIn * 1e3 : void 0) || Ke(e.accessToken), n = {
|
|
401
397
|
...e,
|
|
402
398
|
expiresAt: t
|
|
@@ -574,7 +570,7 @@ const ie = class ie {
|
|
|
574
570
|
return new Promise((e, t) => {
|
|
575
571
|
const n = setTimeout(() => {
|
|
576
572
|
const i = this.refreshQueue.findIndex((a) => a.timeoutId === n);
|
|
577
|
-
i !== -1 && this.refreshQueue.splice(i, 1), t(new
|
|
573
|
+
i !== -1 && this.refreshQueue.splice(i, 1), t(new kt(this.refreshQueueTimeout));
|
|
578
574
|
}, this.refreshQueueTimeout);
|
|
579
575
|
this.refreshQueue.push({ resolve: e, reject: t, timeoutId: n });
|
|
580
576
|
});
|
|
@@ -624,7 +620,7 @@ const ie = class ie {
|
|
|
624
620
|
}
|
|
625
621
|
}
|
|
626
622
|
}
|
|
627
|
-
throw new
|
|
623
|
+
throw new Et(this.maxRefreshRetries + 1, t);
|
|
628
624
|
}
|
|
629
625
|
/**
|
|
630
626
|
* Single refresh attempt with error classification.
|
|
@@ -643,7 +639,7 @@ const ie = class ie {
|
|
|
643
639
|
const n = this.getTokens();
|
|
644
640
|
if (n != null && n.accessToken && !this.isTokenExpired(n) && !this.shouldRefreshToken(n))
|
|
645
641
|
return;
|
|
646
|
-
const i = (n == null ? void 0 : n.refreshToken) || e, a = `${this.baseUrl}/auth/refresh`, l =
|
|
642
|
+
const i = (n == null ? void 0 : n.refreshToken) || e, a = `${this.baseUrl}/auth/refresh`, l = At(i, "deviceId"), d = { refreshToken: i };
|
|
647
643
|
l && (d.deviceId = l);
|
|
648
644
|
let T;
|
|
649
645
|
try {
|
|
@@ -733,9 +729,9 @@ const ie = class ie {
|
|
|
733
729
|
};
|
|
734
730
|
ie.instances = /* @__PURE__ */ new Map(), ie.MAX_BACKGROUND_FAILURES = 3;
|
|
735
731
|
let Me = ie;
|
|
736
|
-
class
|
|
732
|
+
class Ct {
|
|
737
733
|
constructor(e) {
|
|
738
|
-
this.httpService = e, this.
|
|
734
|
+
this.httpService = e, this.verificationCache = /* @__PURE__ */ new Map(), this.VERIFY_CACHE_TTL_MS = 6e4, this.pendingMagicLinks = /* @__PURE__ */ new Map();
|
|
739
735
|
}
|
|
740
736
|
// Public endpoints - no auth required.
|
|
741
737
|
// Must pass `{ skipAuth: true }` so HttpService does NOT call
|
|
@@ -784,12 +780,24 @@ class Nt {
|
|
|
784
780
|
return this.pendingMagicLinks.set(t, i), i;
|
|
785
781
|
}
|
|
786
782
|
async verifyMagicLink(e) {
|
|
787
|
-
const t = e.token, n = this.
|
|
788
|
-
if (n) return n;
|
|
789
|
-
const i = this.httpService.post(
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
783
|
+
const t = e.token, n = this.verificationCache.get(t);
|
|
784
|
+
if (n) return n.promise;
|
|
785
|
+
const i = this.httpService.post(
|
|
786
|
+
"/auth/magic-link/verify",
|
|
787
|
+
e,
|
|
788
|
+
{ skipAuth: !0 }
|
|
789
|
+
), a = { promise: i };
|
|
790
|
+
return this.verificationCache.set(t, a), i.then(
|
|
791
|
+
() => {
|
|
792
|
+
a.timer = setTimeout(
|
|
793
|
+
() => this.verificationCache.delete(t),
|
|
794
|
+
this.VERIFY_CACHE_TTL_MS
|
|
795
|
+
);
|
|
796
|
+
},
|
|
797
|
+
() => {
|
|
798
|
+
this.verificationCache.delete(t);
|
|
799
|
+
}
|
|
800
|
+
), i;
|
|
793
801
|
}
|
|
794
802
|
async confirmPasswordReset(e) {
|
|
795
803
|
await this.httpService.post("/auth/password-reset/confirm", e, { skipAuth: !0 });
|
|
@@ -798,7 +806,7 @@ class Nt {
|
|
|
798
806
|
await this.httpService.post("/auth/change-password", e);
|
|
799
807
|
}
|
|
800
808
|
}
|
|
801
|
-
class
|
|
809
|
+
class Dt {
|
|
802
810
|
constructor(e) {
|
|
803
811
|
this.httpService = e;
|
|
804
812
|
}
|
|
@@ -834,7 +842,7 @@ class Ct {
|
|
|
834
842
|
return { roles: n.data, meta: n.meta };
|
|
835
843
|
}
|
|
836
844
|
}
|
|
837
|
-
class
|
|
845
|
+
class Mt {
|
|
838
846
|
constructor(e) {
|
|
839
847
|
this.httpService = e;
|
|
840
848
|
}
|
|
@@ -857,7 +865,7 @@ class Dt {
|
|
|
857
865
|
await this.httpService.delete(`/users/${e}`);
|
|
858
866
|
}
|
|
859
867
|
}
|
|
860
|
-
class
|
|
868
|
+
class be {
|
|
861
869
|
constructor(e, t) {
|
|
862
870
|
this.httpService = e, this.appId = t;
|
|
863
871
|
}
|
|
@@ -901,7 +909,7 @@ class ye {
|
|
|
901
909
|
)).data;
|
|
902
910
|
}
|
|
903
911
|
}
|
|
904
|
-
function
|
|
912
|
+
function $t(r, e) {
|
|
905
913
|
if (r === "localhost" || r.startsWith("127.") || r.startsWith("192.168."))
|
|
906
914
|
return null;
|
|
907
915
|
if (e) {
|
|
@@ -917,24 +925,24 @@ function Mt(r, e) {
|
|
|
917
925
|
const n = r.split(".");
|
|
918
926
|
return n.length >= 3 && n[0] !== "www" ? n[0] : null;
|
|
919
927
|
}
|
|
920
|
-
function
|
|
928
|
+
function Ut(r, e = "tenant", t) {
|
|
921
929
|
const i = new URLSearchParams(r).get(e);
|
|
922
930
|
return i ? (t && t.setItem("tenant", i), i) : t ? t.getItem("tenant") : null;
|
|
923
931
|
}
|
|
924
|
-
function
|
|
932
|
+
function Bt(r, e, t) {
|
|
925
933
|
const { tenantMode: n, baseDomain: i, selectorParam: a, fixedTenantSlug: l } = r;
|
|
926
|
-
return n === "fixed" ? l || null : n === "subdomain" ?
|
|
934
|
+
return n === "fixed" ? l || null : n === "subdomain" ? $t(e.hostname, i) : n === "selector" ? Ut(e.search, a, t) : null;
|
|
927
935
|
}
|
|
928
|
-
function
|
|
936
|
+
function _t(r, e, t) {
|
|
929
937
|
if (t)
|
|
930
938
|
return `${r}.${t}`;
|
|
931
939
|
const n = e.split(".");
|
|
932
940
|
return n.length === 2 ? `${r}.${e}` : n.length >= 3 ? (n[0] = r, n.join(".")) : null;
|
|
933
941
|
}
|
|
934
942
|
const Be = fe(null);
|
|
935
|
-
function
|
|
943
|
+
function xr({ config: r, children: e }) {
|
|
936
944
|
var j, Z, $;
|
|
937
|
-
const { baseUrl: t, appInfo: n, appId: i } = Ae(), a = te(() => typeof window > "u" ? null :
|
|
945
|
+
const { baseUrl: t, appInfo: n, appId: i } = Ae(), a = te(() => typeof window > "u" ? null : Bt(
|
|
938
946
|
{
|
|
939
947
|
tenantMode: r.tenantMode || "selector",
|
|
940
948
|
baseDomain: r.baseDomain,
|
|
@@ -953,9 +961,9 @@ function Er({ config: r, children: e }) {
|
|
|
953
961
|
if (r.initialTenant) return r.initialTenant;
|
|
954
962
|
if (!S.enabled || !l) return null;
|
|
955
963
|
try {
|
|
956
|
-
const
|
|
957
|
-
if (!
|
|
958
|
-
const L = JSON.parse(
|
|
964
|
+
const B = localStorage.getItem(S.storageKey);
|
|
965
|
+
if (!B) return null;
|
|
966
|
+
const L = JSON.parse(B);
|
|
959
967
|
return Date.now() - L.timestamp < S.ttl && L.tenantSlug === l ? L.data : (localStorage.removeItem(S.storageKey), null);
|
|
960
968
|
} catch {
|
|
961
969
|
return null;
|
|
@@ -963,21 +971,21 @@ function Er({ config: r, children: e }) {
|
|
|
963
971
|
}), [P, I] = N(!h && !r.initialTenant), [R, k] = N(null), [m, g] = N(null), [b, C] = N(!1), [o, p] = N(null);
|
|
964
972
|
re(() => {
|
|
965
973
|
if (r.tenantMode === "fixed") return;
|
|
966
|
-
const
|
|
967
|
-
d(
|
|
974
|
+
const B = a();
|
|
975
|
+
d(B);
|
|
968
976
|
}, [a, r.tenantMode]);
|
|
969
977
|
const E = (n == null ? void 0 : n.settingsSchema) || null, y = te(
|
|
970
|
-
async (
|
|
971
|
-
if (!(!L && S.enabled && h && h.subdomain ===
|
|
978
|
+
async (B, L = !1) => {
|
|
979
|
+
if (!(!L && S.enabled && h && h.subdomain === B))
|
|
972
980
|
try {
|
|
973
981
|
I(!0), k(null);
|
|
974
|
-
const q = new he(t), W = await new
|
|
982
|
+
const q = new he(t), W = await new be(q, i).getPublicTenantInfo(B);
|
|
975
983
|
if (x(W), S.enabled)
|
|
976
984
|
try {
|
|
977
985
|
const K = {
|
|
978
986
|
data: W,
|
|
979
987
|
timestamp: Date.now(),
|
|
980
|
-
tenantSlug:
|
|
988
|
+
tenantSlug: B
|
|
981
989
|
};
|
|
982
990
|
localStorage.setItem(S.storageKey, JSON.stringify(K));
|
|
983
991
|
} catch (K) {
|
|
@@ -994,11 +1002,11 @@ function Er({ config: r, children: e }) {
|
|
|
994
1002
|
), u = te(async () => {
|
|
995
1003
|
if (!(!S.enabled || !h || !l))
|
|
996
1004
|
try {
|
|
997
|
-
const
|
|
998
|
-
if (!
|
|
999
|
-
const L = JSON.parse(
|
|
1005
|
+
const B = localStorage.getItem(S.storageKey);
|
|
1006
|
+
if (!B) return;
|
|
1007
|
+
const L = JSON.parse(B);
|
|
1000
1008
|
if (Date.now() - L.timestamp > S.ttl * 0.5) {
|
|
1001
|
-
const _ = new he(t), K = await new
|
|
1009
|
+
const _ = new he(t), K = await new be(_, i).getPublicTenantInfo(l);
|
|
1002
1010
|
x(K);
|
|
1003
1011
|
const Y = {
|
|
1004
1012
|
data: K,
|
|
@@ -1007,17 +1015,17 @@ function Er({ config: r, children: e }) {
|
|
|
1007
1015
|
};
|
|
1008
1016
|
localStorage.setItem(S.storageKey, JSON.stringify(Y));
|
|
1009
1017
|
}
|
|
1010
|
-
} catch (
|
|
1011
|
-
process.env.NODE_ENV === "development" && console.warn("[TenantProvider] Background tenant refresh failed:",
|
|
1018
|
+
} catch (B) {
|
|
1019
|
+
process.env.NODE_ENV === "development" && console.warn("[TenantProvider] Background tenant refresh failed:", B);
|
|
1012
1020
|
}
|
|
1013
1021
|
}, [t, i, S, h, l]), v = te(async () => {
|
|
1014
1022
|
if (h != null && h.id)
|
|
1015
1023
|
try {
|
|
1016
1024
|
C(!0), p(null);
|
|
1017
|
-
const
|
|
1025
|
+
const B = new he(t), q = await new be(B, h.appId).getTenantSettings(h.id);
|
|
1018
1026
|
g(q);
|
|
1019
|
-
} catch (
|
|
1020
|
-
const L =
|
|
1027
|
+
} catch (B) {
|
|
1028
|
+
const L = B instanceof Error ? B : new Error("Failed to load tenant settings");
|
|
1021
1029
|
p(L), g(null);
|
|
1022
1030
|
} finally {
|
|
1023
1031
|
C(!1);
|
|
@@ -1025,14 +1033,14 @@ function Er({ config: r, children: e }) {
|
|
|
1025
1033
|
}, [t, h]), D = te(() => {
|
|
1026
1034
|
v();
|
|
1027
1035
|
}, [v]), se = te(
|
|
1028
|
-
(
|
|
1036
|
+
(B) => {
|
|
1029
1037
|
if (!E)
|
|
1030
1038
|
return { isValid: !0, errors: [] };
|
|
1031
1039
|
const L = [];
|
|
1032
1040
|
try {
|
|
1033
1041
|
return E.properties && Object.entries(E.properties).forEach(([q, _]) => {
|
|
1034
1042
|
var K;
|
|
1035
|
-
const W =
|
|
1043
|
+
const W = B[q];
|
|
1036
1044
|
if ((K = E.required) != null && K.includes(q) && W == null) {
|
|
1037
1045
|
L.push(`Field '${q}' is required`);
|
|
1038
1046
|
return;
|
|
@@ -1067,7 +1075,7 @@ function Er({ config: r, children: e }) {
|
|
|
1067
1075
|
h != null && h.id ? v() : (g(null), p(null), C(!1));
|
|
1068
1076
|
}, [h == null ? void 0 : h.id, v]);
|
|
1069
1077
|
const F = te(
|
|
1070
|
-
(
|
|
1078
|
+
(B, L) => {
|
|
1071
1079
|
const { mode: q = "reload", redirectPath: _ } = L || {}, W = r.tenantMode || "selector";
|
|
1072
1080
|
if (W === "fixed") {
|
|
1073
1081
|
process.env.NODE_ENV === "development" && console.warn(
|
|
@@ -1076,9 +1084,9 @@ function Er({ config: r, children: e }) {
|
|
|
1076
1084
|
), _ && (window.location.href = _);
|
|
1077
1085
|
return;
|
|
1078
1086
|
}
|
|
1079
|
-
if (localStorage.setItem("tenant",
|
|
1080
|
-
const K = window.location.hostname, Y =
|
|
1081
|
-
|
|
1087
|
+
if (localStorage.setItem("tenant", B), W === "subdomain") {
|
|
1088
|
+
const K = window.location.hostname, Y = _t(
|
|
1089
|
+
B,
|
|
1082
1090
|
K,
|
|
1083
1091
|
r.baseDomain
|
|
1084
1092
|
);
|
|
@@ -1089,18 +1097,18 @@ function Er({ config: r, children: e }) {
|
|
|
1089
1097
|
);
|
|
1090
1098
|
return;
|
|
1091
1099
|
}
|
|
1092
|
-
const le = _ || window.location.pathname,
|
|
1100
|
+
const le = _ || window.location.pathname, Se = new URL(`${window.location.protocol}//${Y}${le}`);
|
|
1093
1101
|
new URLSearchParams(window.location.search).forEach((Fe, Ne) => {
|
|
1094
|
-
|
|
1095
|
-
}), window.location.href =
|
|
1102
|
+
Se.searchParams.set(Ne, Fe);
|
|
1103
|
+
}), window.location.href = Se.toString();
|
|
1096
1104
|
} else if (W === "selector") {
|
|
1097
1105
|
const K = _ || window.location.pathname, Y = new URLSearchParams(window.location.search);
|
|
1098
|
-
if (Y.set(r.selectorParam || "tenant",
|
|
1106
|
+
if (Y.set(r.selectorParam || "tenant", B), q === "reload") {
|
|
1099
1107
|
const le = `${K}?${Y.toString()}${window.location.hash}`;
|
|
1100
1108
|
window.location.href = le;
|
|
1101
1109
|
} else {
|
|
1102
1110
|
const le = `${K}?${Y.toString()}${window.location.hash}`;
|
|
1103
|
-
window.history.pushState({}, "", le), d(
|
|
1111
|
+
window.history.pushState({}, "", le), d(B), y(B);
|
|
1104
1112
|
}
|
|
1105
1113
|
}
|
|
1106
1114
|
},
|
|
@@ -1139,7 +1147,7 @@ function Er({ config: r, children: e }) {
|
|
|
1139
1147
|
]);
|
|
1140
1148
|
return /* @__PURE__ */ s(Be.Provider, { value: H, children: e });
|
|
1141
1149
|
}
|
|
1142
|
-
function
|
|
1150
|
+
function Te() {
|
|
1143
1151
|
const r = ne(Be);
|
|
1144
1152
|
if (!r)
|
|
1145
1153
|
throw new Error("useTenant must be used within a TenantProvider");
|
|
@@ -1148,9 +1156,9 @@ function ve() {
|
|
|
1148
1156
|
function pe() {
|
|
1149
1157
|
return ne(Be);
|
|
1150
1158
|
}
|
|
1151
|
-
const
|
|
1152
|
-
function
|
|
1153
|
-
const { settings: r, settingsSchema: e, isSettingsLoading: t, settingsError: n, validateSettings: i } =
|
|
1159
|
+
const Ar = Te;
|
|
1160
|
+
function Rr() {
|
|
1161
|
+
const { settings: r, settingsSchema: e, isSettingsLoading: t, settingsError: n, validateSettings: i } = Te();
|
|
1154
1162
|
return {
|
|
1155
1163
|
settings: r,
|
|
1156
1164
|
settingsSchema: e,
|
|
@@ -1160,7 +1168,7 @@ function Ar() {
|
|
|
1160
1168
|
};
|
|
1161
1169
|
}
|
|
1162
1170
|
function ot() {
|
|
1163
|
-
const { tenant: r, tenantSlug: e, isTenantLoading: t, tenantError: n, retryTenant: i } =
|
|
1171
|
+
const { tenant: r, tenantSlug: e, isTenantLoading: t, tenantError: n, retryTenant: i } = Te();
|
|
1164
1172
|
return {
|
|
1165
1173
|
tenant: r,
|
|
1166
1174
|
tenantSlug: e,
|
|
@@ -1170,7 +1178,7 @@ function ot() {
|
|
|
1170
1178
|
};
|
|
1171
1179
|
}
|
|
1172
1180
|
const _e = "userTenants";
|
|
1173
|
-
function
|
|
1181
|
+
function Ot() {
|
|
1174
1182
|
try {
|
|
1175
1183
|
const r = localStorage.getItem(_e);
|
|
1176
1184
|
return r ? JSON.parse(r) : [];
|
|
@@ -1191,14 +1199,14 @@ function et() {
|
|
|
1191
1199
|
}
|
|
1192
1200
|
}
|
|
1193
1201
|
const Pe = fe(null), Ie = fe(null);
|
|
1194
|
-
function
|
|
1202
|
+
function Pr({ config: r = {}, children: e }) {
|
|
1195
1203
|
const t = Ue(), n = pe(), i = (t == null ? void 0 : t.baseUrl) ?? r.baseUrl ?? "", a = (t == null ? void 0 : t.appId) ?? r.appId, l = (n == null ? void 0 : n.tenant) ?? null, d = (n == null ? void 0 : n.tenantSlug) ?? null, T = (n == null ? void 0 : n.switchTenant) ?? (() => {
|
|
1196
1204
|
});
|
|
1197
1205
|
if (!i)
|
|
1198
1206
|
throw new Error(
|
|
1199
1207
|
"[AuthProvider] baseUrl is required. Provide it via AppProvider or AuthConfig.baseUrl."
|
|
1200
1208
|
);
|
|
1201
|
-
const [A, c] = N(r.initialRoles || []), [S, h] = N(!r.initialRoles), [x, P] = N(null), [I, R] = N(!1), [k, m] = N(null), [g, b] = N(() =>
|
|
1209
|
+
const [A, c] = N(r.initialRoles || []), [S, h] = N(!r.initialRoles), [x, P] = N(null), [I, R] = N(!1), [k, m] = N(null), [g, b] = N(() => Ot()), C = ye({ done: !1 });
|
|
1202
1210
|
C.current.done || (C.current.done = !0);
|
|
1203
1211
|
const o = V(() => Me.getInstance({
|
|
1204
1212
|
baseUrl: i,
|
|
@@ -1220,18 +1228,18 @@ function Rr({ config: r = {}, children: e }) {
|
|
|
1220
1228
|
const w = new he(i);
|
|
1221
1229
|
return w.setSessionManager(o), w;
|
|
1222
1230
|
}, [i, o]), v = V(
|
|
1223
|
-
() => new
|
|
1231
|
+
() => new Ct(u),
|
|
1224
1232
|
[u]
|
|
1225
1233
|
), D = V(
|
|
1226
|
-
() => new
|
|
1234
|
+
() => new Mt(u),
|
|
1227
1235
|
[u]
|
|
1228
1236
|
), se = V(
|
|
1229
|
-
() => new
|
|
1237
|
+
() => new Dt(u),
|
|
1230
1238
|
[u]
|
|
1231
1239
|
), F = V(() => x != null && x.roleId && A.find((w) => w.id === x.roleId) || null, [x, A]), H = V(() => (F == null ? void 0 : F.permissions) || [], [F]), j = V(
|
|
1232
1240
|
() => o.hasValidSession() && x !== null,
|
|
1233
1241
|
[o, x]
|
|
1234
|
-
), Z = V(() => (x == null ? void 0 : x.tenantId) != null, [x]), $ =
|
|
1242
|
+
), Z = V(() => (x == null ? void 0 : x.tenantId) != null, [x]), $ = ye(null), B = ye(/* @__PURE__ */ new Set()), L = async (w = !1) => {
|
|
1235
1243
|
try {
|
|
1236
1244
|
if (!o.hasValidSession() || !w && x) return;
|
|
1237
1245
|
const M = o.getUserId();
|
|
@@ -1248,17 +1256,17 @@ function Rr({ config: r = {}, children: e }) {
|
|
|
1248
1256
|
} finally {
|
|
1249
1257
|
R(!1);
|
|
1250
1258
|
}
|
|
1251
|
-
},
|
|
1259
|
+
}, q = async (w) => {
|
|
1252
1260
|
var He;
|
|
1253
|
-
const { username: M, password: z, tenantSlug: O, redirectPath:
|
|
1254
|
-
let X = l == null ? void 0 : l.id,
|
|
1255
|
-
O && (X = (await new
|
|
1261
|
+
const { username: M, password: z, tenantSlug: O, redirectPath: J } = w;
|
|
1262
|
+
let X = l == null ? void 0 : l.id, Q = d;
|
|
1263
|
+
O && (X = (await new be(u, a).getPublicTenantInfo(O)).id, Q = O);
|
|
1256
1264
|
const G = await v.login({
|
|
1257
1265
|
username: M,
|
|
1258
1266
|
password: z,
|
|
1259
1267
|
appId: a,
|
|
1260
1268
|
tenantId: X
|
|
1261
|
-
}),
|
|
1269
|
+
}), ke = O && O !== d;
|
|
1262
1270
|
if (o.setTokens({
|
|
1263
1271
|
accessToken: G.accessToken,
|
|
1264
1272
|
refreshToken: G.refreshToken,
|
|
@@ -1266,100 +1274,104 @@ function Rr({ config: r = {}, children: e }) {
|
|
|
1266
1274
|
}), G.user) {
|
|
1267
1275
|
o.setUser(G.user), P(G.user);
|
|
1268
1276
|
try {
|
|
1269
|
-
await
|
|
1270
|
-
} catch (
|
|
1271
|
-
process.env.NODE_ENV === "development" && console.warn("[AuthProvider] Failed to load complete user data after login:",
|
|
1277
|
+
await L();
|
|
1278
|
+
} catch (Ee) {
|
|
1279
|
+
process.env.NODE_ENV === "development" && console.warn("[AuthProvider] Failed to load complete user data after login:", Ee);
|
|
1272
1280
|
}
|
|
1273
1281
|
}
|
|
1274
1282
|
G.tenants && G.tenants.length > 0 && (b(G.tenants), Xe(G.tenants));
|
|
1275
1283
|
const Ge = ((He = G.user) == null ? void 0 : He.tenantId) !== null;
|
|
1276
|
-
if (
|
|
1277
|
-
return T(
|
|
1278
|
-
if (
|
|
1279
|
-
return T(
|
|
1284
|
+
if (ke && Q)
|
|
1285
|
+
return T(Q, { redirectPath: J }), G;
|
|
1286
|
+
if (J && J !== window.location.pathname)
|
|
1287
|
+
return T(Q || d || "", { redirectPath: J }), G;
|
|
1280
1288
|
if (!Ge && G.tenants && G.tenants.length > 0) {
|
|
1281
|
-
const
|
|
1282
|
-
if (G.tenants.length === 1 &&
|
|
1289
|
+
const Ee = w.autoSwitch !== !1 && r.autoSwitchSingleTenant !== !1;
|
|
1290
|
+
if (G.tenants.length === 1 && Ee) {
|
|
1283
1291
|
const Qe = G.tenants[0];
|
|
1284
|
-
return T(Qe.subdomain, { redirectPath:
|
|
1292
|
+
return T(Qe.subdomain, { redirectPath: J }), G;
|
|
1285
1293
|
} else G.tenants.length > 1 && r.onTenantSelectionRequired && r.onTenantSelectionRequired(G.tenants);
|
|
1286
1294
|
}
|
|
1287
1295
|
return G;
|
|
1288
|
-
},
|
|
1289
|
-
const { email: M, phoneNumber: z, name: O, password:
|
|
1296
|
+
}, _ = async (w) => {
|
|
1297
|
+
const { email: M, phoneNumber: z, name: O, password: J, lastName: X, tenantId: Q } = w;
|
|
1290
1298
|
if (!M && !z)
|
|
1291
1299
|
throw new Error("Either email or phoneNumber is required");
|
|
1292
|
-
if (!O || !
|
|
1300
|
+
if (!O || !J)
|
|
1293
1301
|
throw new Error("Name and password are required");
|
|
1294
1302
|
return v.signup({
|
|
1295
1303
|
email: M,
|
|
1296
1304
|
phoneNumber: z,
|
|
1297
1305
|
name: O,
|
|
1298
|
-
password:
|
|
1299
|
-
tenantId:
|
|
1306
|
+
password: J,
|
|
1307
|
+
tenantId: Q ?? (l == null ? void 0 : l.id),
|
|
1300
1308
|
lastName: X,
|
|
1301
1309
|
appId: a
|
|
1302
1310
|
});
|
|
1303
|
-
},
|
|
1304
|
-
const { email: M, phoneNumber: z, name: O, password:
|
|
1311
|
+
}, W = async (w) => {
|
|
1312
|
+
const { email: M, phoneNumber: z, name: O, password: J, tenantName: X, lastName: Q } = w;
|
|
1305
1313
|
if (!M && !z)
|
|
1306
1314
|
throw new Error("Either email or phoneNumber is required");
|
|
1307
|
-
if (!O || !
|
|
1315
|
+
if (!O || !J || !X)
|
|
1308
1316
|
throw new Error("Name, password, and tenantName are required");
|
|
1309
1317
|
return v.signupTenantAdmin({
|
|
1310
1318
|
email: M,
|
|
1311
1319
|
phoneNumber: z,
|
|
1312
1320
|
name: O,
|
|
1313
|
-
password:
|
|
1321
|
+
password: J,
|
|
1314
1322
|
tenantName: X,
|
|
1315
1323
|
appId: a,
|
|
1316
|
-
lastName:
|
|
1324
|
+
lastName: Q
|
|
1317
1325
|
});
|
|
1318
|
-
}, W = async (w) => {
|
|
1319
|
-
await v.changePassword(w);
|
|
1320
1326
|
}, K = async (w) => {
|
|
1327
|
+
await v.changePassword(w);
|
|
1328
|
+
}, Y = async (w) => {
|
|
1321
1329
|
const { email: M, tenantId: z } = w, O = z ?? (l == null ? void 0 : l.id);
|
|
1322
1330
|
if (!O)
|
|
1323
1331
|
throw new Error("tenantId is required for password reset");
|
|
1324
1332
|
await v.requestPasswordReset({ email: M, tenantId: O });
|
|
1325
|
-
}, Y = async (w) => {
|
|
1326
|
-
await v.confirmPasswordReset(w);
|
|
1327
1333
|
}, le = async (w) => {
|
|
1328
|
-
|
|
1329
|
-
|
|
1334
|
+
await v.confirmPasswordReset(w);
|
|
1335
|
+
}, Se = async (w) => {
|
|
1336
|
+
const { email: M, frontendUrl: z, name: O, lastName: J, tenantId: X } = w, Q = X ?? (l == null ? void 0 : l.id);
|
|
1337
|
+
if (!Q)
|
|
1330
1338
|
throw new Error("tenantId is required for magic link authentication");
|
|
1331
1339
|
return v.sendMagicLink({
|
|
1332
1340
|
email: M,
|
|
1333
|
-
tenantId:
|
|
1341
|
+
tenantId: Q,
|
|
1334
1342
|
frontendUrl: z,
|
|
1335
1343
|
name: O,
|
|
1336
|
-
lastName:
|
|
1344
|
+
lastName: J,
|
|
1337
1345
|
appId: a
|
|
1338
1346
|
});
|
|
1339
|
-
},
|
|
1347
|
+
}, We = async (w) => {
|
|
1340
1348
|
const { token: M, email: z, tenantSlug: O } = w;
|
|
1341
|
-
let
|
|
1342
|
-
O && (
|
|
1343
|
-
const
|
|
1349
|
+
let J = l == null ? void 0 : l.id, X = d;
|
|
1350
|
+
O && (J = (await new be(u, a).getPublicTenantInfo(O)).id, X = O);
|
|
1351
|
+
const Q = await v.verifyMagicLink({
|
|
1344
1352
|
token: M,
|
|
1345
1353
|
email: z,
|
|
1346
1354
|
appId: a,
|
|
1347
|
-
tenantId:
|
|
1348
|
-
})
|
|
1355
|
+
tenantId: J
|
|
1356
|
+
});
|
|
1357
|
+
if (B.current.has(M))
|
|
1358
|
+
return Q;
|
|
1359
|
+
B.current.add(M);
|
|
1360
|
+
const G = O && O !== d;
|
|
1349
1361
|
if (o.setTokens({
|
|
1350
|
-
accessToken:
|
|
1351
|
-
refreshToken:
|
|
1352
|
-
expiresIn:
|
|
1353
|
-
}),
|
|
1354
|
-
o.setUser(
|
|
1362
|
+
accessToken: Q.accessToken,
|
|
1363
|
+
refreshToken: Q.refreshToken,
|
|
1364
|
+
expiresIn: Q.expiresIn
|
|
1365
|
+
}), Q.user) {
|
|
1366
|
+
o.setUser(Q.user), P(Q.user);
|
|
1355
1367
|
try {
|
|
1356
|
-
await
|
|
1357
|
-
} catch (
|
|
1358
|
-
process.env.NODE_ENV === "development" && console.warn("[AuthProvider] Failed to load complete user data after magic link:",
|
|
1368
|
+
await L();
|
|
1369
|
+
} catch (ke) {
|
|
1370
|
+
process.env.NODE_ENV === "development" && console.warn("[AuthProvider] Failed to load complete user data after magic link:", ke);
|
|
1359
1371
|
}
|
|
1360
1372
|
}
|
|
1361
|
-
return G && X && X !== d && T(X),
|
|
1362
|
-
},
|
|
1373
|
+
return G && X && X !== d && T(X), Q;
|
|
1374
|
+
}, Fe = async () => {
|
|
1363
1375
|
const w = o.getTokens();
|
|
1364
1376
|
if (!(w != null && w.refreshToken))
|
|
1365
1377
|
throw new Error("No refresh token available");
|
|
@@ -1371,13 +1383,13 @@ function Rr({ config: r = {}, children: e }) {
|
|
|
1371
1383
|
refreshToken: M.refreshToken || w.refreshToken,
|
|
1372
1384
|
expiresIn: M.expiresIn
|
|
1373
1385
|
});
|
|
1374
|
-
},
|
|
1386
|
+
}, Ne = () => {
|
|
1375
1387
|
o.clearSession(), P(null), m(null), b([]), et();
|
|
1376
|
-
},
|
|
1388
|
+
}, ht = (w) => {
|
|
1377
1389
|
o.setTokens(w);
|
|
1378
|
-
},
|
|
1390
|
+
}, pt = () => o.hasValidSession(), ft = () => {
|
|
1379
1391
|
o.clearSession(), P(null), m(null);
|
|
1380
|
-
},
|
|
1392
|
+
}, mt = async () => {
|
|
1381
1393
|
if (a)
|
|
1382
1394
|
try {
|
|
1383
1395
|
h(!0);
|
|
@@ -1388,46 +1400,46 @@ function Rr({ config: r = {}, children: e }) {
|
|
|
1388
1400
|
} finally {
|
|
1389
1401
|
h(!1);
|
|
1390
1402
|
}
|
|
1391
|
-
},
|
|
1403
|
+
}, gt = async (w, M) => {
|
|
1392
1404
|
const { redirectPath: z } = M || {}, O = o.getTokens();
|
|
1393
1405
|
if (!(O != null && O.refreshToken))
|
|
1394
1406
|
throw new Error("No refresh token available for tenant switch");
|
|
1395
|
-
const
|
|
1407
|
+
const J = await v.switchTenant({
|
|
1396
1408
|
refreshToken: O.refreshToken,
|
|
1397
1409
|
tenantId: w
|
|
1398
1410
|
});
|
|
1399
1411
|
o.setTokens({
|
|
1400
|
-
accessToken:
|
|
1412
|
+
accessToken: J.accessToken,
|
|
1401
1413
|
refreshToken: O.refreshToken,
|
|
1402
|
-
expiresIn:
|
|
1403
|
-
}), P(
|
|
1404
|
-
const X = g.find((
|
|
1414
|
+
expiresIn: J.expiresIn
|
|
1415
|
+
}), P(J.user), o.setUser(J.user);
|
|
1416
|
+
const X = g.find((Q) => Q.id === w);
|
|
1405
1417
|
X && T(X.subdomain, { redirectPath: z });
|
|
1406
|
-
},
|
|
1418
|
+
}, yt = async () => {
|
|
1407
1419
|
const w = await v.getUserTenants();
|
|
1408
1420
|
return b(w), Xe(w), w;
|
|
1409
1421
|
};
|
|
1410
1422
|
$.current = {
|
|
1411
|
-
login:
|
|
1412
|
-
signup:
|
|
1413
|
-
signupTenantAdmin:
|
|
1414
|
-
sendMagicLink:
|
|
1415
|
-
verifyMagicLink:
|
|
1416
|
-
changePassword:
|
|
1417
|
-
requestPasswordReset:
|
|
1418
|
-
confirmPasswordReset:
|
|
1419
|
-
refreshToken:
|
|
1420
|
-
logout:
|
|
1421
|
-
setTokens:
|
|
1422
|
-
hasValidSession:
|
|
1423
|
-
clearSession:
|
|
1424
|
-
loadUserData:
|
|
1425
|
-
refreshUser: () =>
|
|
1426
|
-
refreshRoles:
|
|
1427
|
-
switchToTenant:
|
|
1428
|
-
refreshUserTenants:
|
|
1423
|
+
login: q,
|
|
1424
|
+
signup: _,
|
|
1425
|
+
signupTenantAdmin: W,
|
|
1426
|
+
sendMagicLink: Se,
|
|
1427
|
+
verifyMagicLink: We,
|
|
1428
|
+
changePassword: K,
|
|
1429
|
+
requestPasswordReset: Y,
|
|
1430
|
+
confirmPasswordReset: le,
|
|
1431
|
+
refreshToken: Fe,
|
|
1432
|
+
logout: Ne,
|
|
1433
|
+
setTokens: ht,
|
|
1434
|
+
hasValidSession: pt,
|
|
1435
|
+
clearSession: ft,
|
|
1436
|
+
loadUserData: L,
|
|
1437
|
+
refreshUser: () => L(),
|
|
1438
|
+
refreshRoles: mt,
|
|
1439
|
+
switchToTenant: gt,
|
|
1440
|
+
refreshUserTenants: yt
|
|
1429
1441
|
};
|
|
1430
|
-
const
|
|
1442
|
+
const bt = V(
|
|
1431
1443
|
() => ({
|
|
1432
1444
|
login: (w) => $.current.login(w),
|
|
1433
1445
|
signup: (w) => $.current.signup(w),
|
|
@@ -1449,7 +1461,7 @@ function Rr({ config: r = {}, children: e }) {
|
|
|
1449
1461
|
refreshUserTenants: () => $.current.refreshUserTenants()
|
|
1450
1462
|
}),
|
|
1451
1463
|
[]
|
|
1452
|
-
),
|
|
1464
|
+
), wt = V(() => {
|
|
1453
1465
|
const w = (M) => !H || H.length === 0 ? !1 : typeof M == "string" ? H.includes(M) : H.includes(`${M.resource}.${M.action}`);
|
|
1454
1466
|
return {
|
|
1455
1467
|
isAuthenticated: j,
|
|
@@ -1514,15 +1526,15 @@ function Rr({ config: r = {}, children: e }) {
|
|
|
1514
1526
|
}).finally(() => {
|
|
1515
1527
|
E(!1);
|
|
1516
1528
|
}) : E(!1);
|
|
1517
|
-
}, [x, I, k, o]), /* @__PURE__ */ s(Ie.Provider, { value:
|
|
1529
|
+
}, [x, I, k, o]), /* @__PURE__ */ s(Ie.Provider, { value: bt, children: /* @__PURE__ */ s(Pe.Provider, { value: wt, children: e }) });
|
|
1518
1530
|
}
|
|
1519
|
-
function
|
|
1531
|
+
function Ir() {
|
|
1520
1532
|
const r = ne(Pe);
|
|
1521
1533
|
if (!r)
|
|
1522
1534
|
throw new Error("useAuthState must be used within an AuthProvider");
|
|
1523
1535
|
return r;
|
|
1524
1536
|
}
|
|
1525
|
-
function
|
|
1537
|
+
function Lr() {
|
|
1526
1538
|
const r = ne(Ie);
|
|
1527
1539
|
if (!r)
|
|
1528
1540
|
throw new Error("useAuthActions must be used within an AuthProvider");
|
|
@@ -1538,7 +1550,7 @@ function Oe() {
|
|
|
1538
1550
|
const r = ne(Pe), e = ne(Ie);
|
|
1539
1551
|
return V(() => !r || !e ? null : { ...r, ...e }, [r, e]);
|
|
1540
1552
|
}
|
|
1541
|
-
class
|
|
1553
|
+
class Vt {
|
|
1542
1554
|
constructor(e) {
|
|
1543
1555
|
this.httpService = e;
|
|
1544
1556
|
}
|
|
@@ -1586,10 +1598,10 @@ class Ot {
|
|
|
1586
1598
|
}
|
|
1587
1599
|
}
|
|
1588
1600
|
const Ve = fe(null);
|
|
1589
|
-
function
|
|
1601
|
+
function Fr({ config: r = {}, children: e }) {
|
|
1590
1602
|
const t = Ue(), n = pe(), i = (t == null ? void 0 : t.baseUrl) ?? "", a = (t == null ? void 0 : t.appId) ?? "", l = (n == null ? void 0 : n.tenant) ?? null, [d, T] = N([]), [A, c] = N(!1), [S, h] = N(null), [x, P] = N(!1), I = V(() => {
|
|
1591
1603
|
const m = new he(i);
|
|
1592
|
-
return new
|
|
1604
|
+
return new Vt(m);
|
|
1593
1605
|
}, [i]), R = async () => {
|
|
1594
1606
|
if (!(l != null && l.id)) {
|
|
1595
1607
|
T([]);
|
|
@@ -1635,7 +1647,7 @@ function Lr({ config: r = {}, children: e }) {
|
|
|
1635
1647
|
}, [d, A, S, i, a, l == null ? void 0 : l.id, x]);
|
|
1636
1648
|
return /* @__PURE__ */ s(Ve.Provider, { value: k, children: e });
|
|
1637
1649
|
}
|
|
1638
|
-
function
|
|
1650
|
+
function qt() {
|
|
1639
1651
|
const r = ne(Ve);
|
|
1640
1652
|
if (!r)
|
|
1641
1653
|
throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
|
|
@@ -1644,7 +1656,7 @@ function Vt() {
|
|
|
1644
1656
|
function at() {
|
|
1645
1657
|
return ne(Ve);
|
|
1646
1658
|
}
|
|
1647
|
-
class
|
|
1659
|
+
class zt {
|
|
1648
1660
|
constructor(e) {
|
|
1649
1661
|
this.httpService = e;
|
|
1650
1662
|
}
|
|
@@ -1685,10 +1697,10 @@ class qt {
|
|
|
1685
1697
|
}
|
|
1686
1698
|
}
|
|
1687
1699
|
const qe = fe(void 0);
|
|
1688
|
-
function
|
|
1700
|
+
function Nr({ config: r = {}, children: e }) {
|
|
1689
1701
|
const t = Ue(), n = pe(), i = (t == null ? void 0 : t.baseUrl) ?? "", a = (n == null ? void 0 : n.tenant) ?? null, [l, d] = N(null), [T, A] = N(!1), [c, S] = N(null), [h, x] = N(!1), P = V(() => {
|
|
1690
1702
|
const k = new he(i);
|
|
1691
|
-
return new
|
|
1703
|
+
return new zt(k);
|
|
1692
1704
|
}, [i]), I = async () => {
|
|
1693
1705
|
if (!(a != null && a.id)) {
|
|
1694
1706
|
d(null);
|
|
@@ -1735,7 +1747,7 @@ function Fr({ config: r = {}, children: e }) {
|
|
|
1735
1747
|
}, [l, T, c, i, a == null ? void 0 : a.id, h]);
|
|
1736
1748
|
return /* @__PURE__ */ s(qe.Provider, { value: R, children: e });
|
|
1737
1749
|
}
|
|
1738
|
-
function
|
|
1750
|
+
function jt() {
|
|
1739
1751
|
const r = ne(qe);
|
|
1740
1752
|
if (r === void 0)
|
|
1741
1753
|
throw new Error("useSubscription must be used within a SubscriptionProvider");
|
|
@@ -1770,7 +1782,7 @@ const ze = {
|
|
|
1770
1782
|
admin: { tenant: "required", auth: "required", userType: ae.TENANT_ADMIN },
|
|
1771
1783
|
// Fully open
|
|
1772
1784
|
open: { tenant: "optional", auth: "optional" }
|
|
1773
|
-
}, je = fe(null),
|
|
1785
|
+
}, je = fe(null), Wt = {
|
|
1774
1786
|
zoneRoots: ze,
|
|
1775
1787
|
presets: ct,
|
|
1776
1788
|
loadingFallback: null,
|
|
@@ -1779,7 +1791,7 @@ const ze = {
|
|
|
1779
1791
|
returnToParam: "returnTo",
|
|
1780
1792
|
returnToStorage: "url"
|
|
1781
1793
|
};
|
|
1782
|
-
function
|
|
1794
|
+
function Cr({ config: r = {}, children: e }) {
|
|
1783
1795
|
const t = V(() => {
|
|
1784
1796
|
const n = {
|
|
1785
1797
|
...ze,
|
|
@@ -1800,14 +1812,14 @@ function Nr({ config: r = {}, children: e }) {
|
|
|
1800
1812
|
}, [r]);
|
|
1801
1813
|
return /* @__PURE__ */ s(je.Provider, { value: t, children: e });
|
|
1802
1814
|
}
|
|
1803
|
-
function
|
|
1815
|
+
function Dr() {
|
|
1804
1816
|
const r = ne(je);
|
|
1805
1817
|
if (!r)
|
|
1806
1818
|
throw new Error("useRouting must be used within a RoutingProvider");
|
|
1807
1819
|
return r;
|
|
1808
1820
|
}
|
|
1809
|
-
function
|
|
1810
|
-
return ne(je) ??
|
|
1821
|
+
function Gt() {
|
|
1822
|
+
return ne(je) ?? Wt;
|
|
1811
1823
|
}
|
|
1812
1824
|
const tt = () => /* @__PURE__ */ f(
|
|
1813
1825
|
"div",
|
|
@@ -1868,7 +1880,7 @@ const tt = () => /* @__PURE__ */ f(
|
|
|
1868
1880
|
children: [
|
|
1869
1881
|
/* @__PURE__ */ s("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "⚠️" }),
|
|
1870
1882
|
/* @__PURE__ */ s("h3", { style: { color: "#856404", marginBottom: "10px" }, children: "Insufficient Permissions" }),
|
|
1871
|
-
e && r ? /* @__PURE__ */ f(
|
|
1883
|
+
e && r ? /* @__PURE__ */ f(U, { children: [
|
|
1872
1884
|
/* @__PURE__ */ f("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: [
|
|
1873
1885
|
"This content requires ",
|
|
1874
1886
|
/* @__PURE__ */ s("strong", { children: e }),
|
|
@@ -1878,7 +1890,7 @@ const tt = () => /* @__PURE__ */ f(
|
|
|
1878
1890
|
"Your current access level: ",
|
|
1879
1891
|
/* @__PURE__ */ s("strong", { children: r })
|
|
1880
1892
|
] })
|
|
1881
|
-
] }) : /* @__PURE__ */ f(
|
|
1893
|
+
] }) : /* @__PURE__ */ f(U, { children: [
|
|
1882
1894
|
/* @__PURE__ */ s("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: "You don't have the required permissions to view this content." }),
|
|
1883
1895
|
t && t.length > 0 && /* @__PURE__ */ f("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1884
1896
|
"Required permissions: ",
|
|
@@ -1887,7 +1899,7 @@ const tt = () => /* @__PURE__ */ f(
|
|
|
1887
1899
|
] })
|
|
1888
1900
|
]
|
|
1889
1901
|
}
|
|
1890
|
-
),
|
|
1902
|
+
), Ht = (r, e) => {
|
|
1891
1903
|
const t = {
|
|
1892
1904
|
[ae.USER]: 1,
|
|
1893
1905
|
[ae.TENANT_ADMIN]: 2,
|
|
@@ -1895,7 +1907,7 @@ const tt = () => /* @__PURE__ */ f(
|
|
|
1895
1907
|
};
|
|
1896
1908
|
return t[r] >= t[e];
|
|
1897
1909
|
};
|
|
1898
|
-
function
|
|
1910
|
+
function Mr({
|
|
1899
1911
|
children: r,
|
|
1900
1912
|
fallback: e,
|
|
1901
1913
|
minUserType: t,
|
|
@@ -1904,19 +1916,19 @@ function Dr({
|
|
|
1904
1916
|
}) {
|
|
1905
1917
|
const { hasValidSession: a, sessionManager: l, hasPermission: d, hasAnyPermission: T, hasAllPermissions: A } = de();
|
|
1906
1918
|
if (!a())
|
|
1907
|
-
return /* @__PURE__ */ s(
|
|
1919
|
+
return /* @__PURE__ */ s(U, { children: e || /* @__PURE__ */ s(tt, {}) });
|
|
1908
1920
|
const c = l.getUser();
|
|
1909
1921
|
if (!c)
|
|
1910
|
-
return /* @__PURE__ */ s(
|
|
1911
|
-
if (t && !
|
|
1922
|
+
return /* @__PURE__ */ s(U, { children: e || /* @__PURE__ */ s(tt, {}) });
|
|
1923
|
+
if (t && !Ht(c.userType, t))
|
|
1912
1924
|
return /* @__PURE__ */ s(rt, { userType: c.userType, minUserType: t });
|
|
1913
1925
|
if (n && n.length > 0 && !(i ? A(n) : T(n))) {
|
|
1914
1926
|
const h = n.filter((x) => !d(x)).map((x) => typeof x == "string" ? x : x.name);
|
|
1915
1927
|
return /* @__PURE__ */ s(rt, { missingPermissions: h });
|
|
1916
1928
|
}
|
|
1917
|
-
return /* @__PURE__ */ s(
|
|
1929
|
+
return /* @__PURE__ */ s(U, { children: r });
|
|
1918
1930
|
}
|
|
1919
|
-
const
|
|
1931
|
+
const Qt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
1920
1932
|
"div",
|
|
1921
1933
|
{
|
|
1922
1934
|
style: {
|
|
@@ -1982,7 +1994,7 @@ const Ht = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
|
1982
1994
|
children: [
|
|
1983
1995
|
/* @__PURE__ */ s("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "⚠️" }),
|
|
1984
1996
|
/* @__PURE__ */ s("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Insufficient Permissions" }),
|
|
1985
|
-
e && r ? /* @__PURE__ */ f(
|
|
1997
|
+
e && r ? /* @__PURE__ */ f(U, { children: [
|
|
1986
1998
|
/* @__PURE__ */ f("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: [
|
|
1987
1999
|
"This page requires ",
|
|
1988
2000
|
/* @__PURE__ */ s("strong", { children: e }),
|
|
@@ -1992,7 +2004,7 @@ const Ht = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
|
1992
2004
|
"Your current user type: ",
|
|
1993
2005
|
/* @__PURE__ */ s("strong", { children: r })
|
|
1994
2006
|
] })
|
|
1995
|
-
] }) : /* @__PURE__ */ f(
|
|
2007
|
+
] }) : /* @__PURE__ */ f(U, { children: [
|
|
1996
2008
|
/* @__PURE__ */ s("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: "You don't have the required permissions to access this page." }),
|
|
1997
2009
|
t && t.length > 0 && /* @__PURE__ */ f("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1998
2010
|
"Required permissions: ",
|
|
@@ -2003,8 +2015,8 @@ const Ht = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
|
2003
2015
|
}
|
|
2004
2016
|
)
|
|
2005
2017
|
}
|
|
2006
|
-
),
|
|
2007
|
-
function
|
|
2018
|
+
), Jt = (r, e) => r === e;
|
|
2019
|
+
function $r({
|
|
2008
2020
|
children: r,
|
|
2009
2021
|
redirectTo: e = "/login",
|
|
2010
2022
|
requiredUserType: t,
|
|
@@ -2018,14 +2030,14 @@ function Mr({
|
|
|
2018
2030
|
"[react-identity-access] ProtectedRoute is deprecated. Use AuthenticatedZone or AdminZone from ZoneRoute instead."
|
|
2019
2031
|
);
|
|
2020
2032
|
}, []), !l())
|
|
2021
|
-
return a ? /* @__PURE__ */ s(
|
|
2022
|
-
/* @__PURE__ */ s(
|
|
2023
|
-
/* @__PURE__ */ s(
|
|
2033
|
+
return a ? /* @__PURE__ */ s(U, { children: a }) : /* @__PURE__ */ f(U, { children: [
|
|
2034
|
+
/* @__PURE__ */ s(Qt, { redirectPath: e }),
|
|
2035
|
+
/* @__PURE__ */ s(we, { to: e, state: { from: S.pathname }, replace: !0 })
|
|
2024
2036
|
] });
|
|
2025
2037
|
const h = d.getUser();
|
|
2026
2038
|
if (!h)
|
|
2027
|
-
return /* @__PURE__ */ s(
|
|
2028
|
-
if (t && !
|
|
2039
|
+
return /* @__PURE__ */ s(we, { to: e, state: { from: S.pathname }, replace: !0 });
|
|
2040
|
+
if (t && !Jt(h.userType, t))
|
|
2029
2041
|
return /* @__PURE__ */ s(
|
|
2030
2042
|
nt,
|
|
2031
2043
|
{
|
|
@@ -2037,9 +2049,9 @@ function Mr({
|
|
|
2037
2049
|
const P = n.filter((I) => !T(I)).map((I) => typeof I == "string" ? I : I.name);
|
|
2038
2050
|
return /* @__PURE__ */ s(nt, { missingPermissions: P });
|
|
2039
2051
|
}
|
|
2040
|
-
return /* @__PURE__ */ s(
|
|
2052
|
+
return /* @__PURE__ */ s(U, { children: r });
|
|
2041
2053
|
}
|
|
2042
|
-
const
|
|
2054
|
+
const Zt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
2043
2055
|
"div",
|
|
2044
2056
|
{
|
|
2045
2057
|
style: {
|
|
@@ -2076,18 +2088,18 @@ const Jt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
|
2076
2088
|
)
|
|
2077
2089
|
}
|
|
2078
2090
|
);
|
|
2079
|
-
function
|
|
2091
|
+
function Ur({ children: r, redirectTo: e = "/", fallback: t }) {
|
|
2080
2092
|
const { tenant: n, isLoading: i, error: a } = ot(), l = xe();
|
|
2081
2093
|
return re(() => {
|
|
2082
2094
|
process.env.NODE_ENV === "development" && console.warn(
|
|
2083
2095
|
"[react-identity-access] TenantRoute is deprecated. Use TenantZone from ZoneRoute instead."
|
|
2084
2096
|
);
|
|
2085
|
-
}, []), i || a ? null : n ? /* @__PURE__ */ s(
|
|
2086
|
-
/* @__PURE__ */ s(
|
|
2087
|
-
/* @__PURE__ */ s(
|
|
2097
|
+
}, []), i || a ? null : n ? /* @__PURE__ */ s(U, { children: r }) : t ? /* @__PURE__ */ s(U, { children: t }) : /* @__PURE__ */ f(U, { children: [
|
|
2098
|
+
/* @__PURE__ */ s(Zt, { redirectPath: e }),
|
|
2099
|
+
/* @__PURE__ */ s(we, { to: e, state: { from: l.pathname }, replace: !0 })
|
|
2088
2100
|
] });
|
|
2089
2101
|
}
|
|
2090
|
-
const
|
|
2102
|
+
const Kt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
2091
2103
|
"div",
|
|
2092
2104
|
{
|
|
2093
2105
|
style: {
|
|
@@ -2124,36 +2136,36 @@ const Zt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
|
2124
2136
|
)
|
|
2125
2137
|
}
|
|
2126
2138
|
);
|
|
2127
|
-
function
|
|
2139
|
+
function Br({ children: r, redirectTo: e = "/dashboard", fallback: t }) {
|
|
2128
2140
|
const { tenant: n, isLoading: i, error: a } = ot(), l = xe();
|
|
2129
2141
|
return re(() => {
|
|
2130
2142
|
process.env.NODE_ENV === "development" && console.warn(
|
|
2131
2143
|
"[react-identity-access] LandingRoute is deprecated. Use PublicZone from ZoneRoute instead."
|
|
2132
2144
|
);
|
|
2133
|
-
}, []), i || a ? null : n ? t ? /* @__PURE__ */ s(
|
|
2134
|
-
/* @__PURE__ */ s(
|
|
2135
|
-
/* @__PURE__ */ s(
|
|
2136
|
-
] }) : /* @__PURE__ */ s(
|
|
2145
|
+
}, []), i || a ? null : n ? t ? /* @__PURE__ */ s(U, { children: t }) : /* @__PURE__ */ f(U, { children: [
|
|
2146
|
+
/* @__PURE__ */ s(Kt, { redirectPath: e }),
|
|
2147
|
+
/* @__PURE__ */ s(we, { to: e, state: { from: l.pathname }, replace: !0 })
|
|
2148
|
+
] }) : /* @__PURE__ */ s(U, { children: r });
|
|
2137
2149
|
}
|
|
2138
|
-
function
|
|
2150
|
+
function Yt(r, e) {
|
|
2139
2151
|
return e ? r ? Array.isArray(e) ? e.includes(r) : r === e : !1 : !0;
|
|
2140
2152
|
}
|
|
2141
2153
|
function st(r, e) {
|
|
2142
2154
|
return !r || r === "optional" ? "skip" : r === "required" ? e ? "pass" : "fail" : r === "forbidden" ? e ? "fail" : "pass" : "skip";
|
|
2143
2155
|
}
|
|
2144
|
-
function Yt(r, e) {
|
|
2145
|
-
return st(r.tenant, e.hasTenant) === "fail" ? e.hasTenant ? "has_tenant" : "no_tenant" : st(r.auth, e.isAuthenticated) === "fail" ? e.isAuthenticated ? "already_authenticated" : "not_authenticated" : r.userType && e.isAuthenticated && !Kt(e.userType, r.userType) ? "wrong_user_type" : r.permissions && r.permissions.length > 0 && !(r.requireAllPermissions !== !1 ? (a) => a.every((l) => e.permissions.includes(l)) : (a) => a.some((l) => e.permissions.includes(l)))(r.permissions) ? "missing_permissions" : null;
|
|
2146
|
-
}
|
|
2147
2156
|
function Xt(r, e) {
|
|
2157
|
+
return st(r.tenant, e.hasTenant) === "fail" ? e.hasTenant ? "has_tenant" : "no_tenant" : st(r.auth, e.isAuthenticated) === "fail" ? e.isAuthenticated ? "already_authenticated" : "not_authenticated" : r.userType && e.isAuthenticated && !Yt(e.userType, r.userType) ? "wrong_user_type" : r.permissions && r.permissions.length > 0 && !(r.requireAllPermissions !== !1 ? (a) => a.every((l) => e.permissions.includes(l)) : (a) => a.some((l) => e.permissions.includes(l)))(r.permissions) ? "missing_permissions" : null;
|
|
2158
|
+
}
|
|
2159
|
+
function er(r, e) {
|
|
2148
2160
|
return r.hasTenant ? r.isAuthenticated ? r.userType === ae.TENANT_ADMIN ? e.tenantAdmin : e.tenantUser : e.tenantGuest : r.isAuthenticated ? r.userType === ae.TENANT_ADMIN ? e.publicAdmin : e.publicUser : e.publicGuest;
|
|
2149
2161
|
}
|
|
2150
|
-
function
|
|
2162
|
+
function tr(r, e, t, n, i) {
|
|
2151
2163
|
if (!e || i !== "url")
|
|
2152
2164
|
return r;
|
|
2153
2165
|
const a = typeof e == "string" ? e : t, l = r.includes("?") ? "&" : "?";
|
|
2154
2166
|
return `${r}${l}${n}=${encodeURIComponent(a)}`;
|
|
2155
2167
|
}
|
|
2156
|
-
function
|
|
2168
|
+
function rr(r, e, t) {
|
|
2157
2169
|
if (!r || t === "url") return;
|
|
2158
2170
|
const n = typeof r == "string" ? r : e, i = "zone_return_to";
|
|
2159
2171
|
t === "session" ? sessionStorage.setItem(i, n) : t === "local" && localStorage.setItem(i, n);
|
|
@@ -2172,7 +2184,7 @@ const ue = ({
|
|
|
2172
2184
|
loadingFallback: c,
|
|
2173
2185
|
accessDeniedFallback: S
|
|
2174
2186
|
}) => {
|
|
2175
|
-
const h = xe(), { isAuthenticated: x, isAuthInitializing: P, currentUser: I, userPermissions: R } = de(), { tenant: k, isTenantLoading: m } =
|
|
2187
|
+
const h = xe(), { isAuthenticated: x, isAuthInitializing: P, currentUser: I, userPermissions: R } = de(), { tenant: k, isTenantLoading: m } = Te(), g = Gt(), b = V(() => {
|
|
2176
2188
|
if (e)
|
|
2177
2189
|
return g.presets[e];
|
|
2178
2190
|
}, [e, g.presets]), C = V(
|
|
@@ -2200,7 +2212,7 @@ const ue = ({
|
|
|
2200
2212
|
P,
|
|
2201
2213
|
m
|
|
2202
2214
|
]
|
|
2203
|
-
), p = V(() => o.isLoading ? null :
|
|
2215
|
+
), p = V(() => o.isLoading ? null : Xt(C, o), [C, o]), E = V(() => p ? A || er(o, g.zoneRoots) : null, [p, A, o, g.zoneRoots]), y = V(() => !p || !E ? null : {
|
|
2204
2216
|
type: p,
|
|
2205
2217
|
required: {
|
|
2206
2218
|
tenant: C.tenant,
|
|
@@ -2219,7 +2231,7 @@ const ue = ({
|
|
|
2219
2231
|
if (re(() => {
|
|
2220
2232
|
y && (T ? T(y) : g.onAccessDenied && g.onAccessDenied(y));
|
|
2221
2233
|
}, [y, T, g]), re(() => {
|
|
2222
|
-
y && d &&
|
|
2234
|
+
y && d && rr(d, h.pathname + h.search, g.returnToStorage);
|
|
2223
2235
|
}, [
|
|
2224
2236
|
y,
|
|
2225
2237
|
d,
|
|
@@ -2227,22 +2239,22 @@ const ue = ({
|
|
|
2227
2239
|
h.search,
|
|
2228
2240
|
g.returnToStorage
|
|
2229
2241
|
]), o.isLoading)
|
|
2230
|
-
return /* @__PURE__ */ s(
|
|
2242
|
+
return /* @__PURE__ */ s(U, { children: c ?? g.loadingFallback ?? null });
|
|
2231
2243
|
if (y && E) {
|
|
2232
2244
|
const u = S ?? g.accessDeniedFallback;
|
|
2233
2245
|
if (u)
|
|
2234
|
-
return /* @__PURE__ */ s(
|
|
2235
|
-
const v =
|
|
2246
|
+
return /* @__PURE__ */ s(U, { children: u });
|
|
2247
|
+
const v = tr(
|
|
2236
2248
|
E,
|
|
2237
2249
|
d,
|
|
2238
2250
|
h.pathname + h.search,
|
|
2239
2251
|
g.returnToParam,
|
|
2240
2252
|
g.returnToStorage
|
|
2241
2253
|
);
|
|
2242
|
-
return /* @__PURE__ */ s(
|
|
2254
|
+
return /* @__PURE__ */ s(we, { to: v, replace: !0 });
|
|
2243
2255
|
}
|
|
2244
|
-
return /* @__PURE__ */ s(
|
|
2245
|
-
},
|
|
2256
|
+
return /* @__PURE__ */ s(U, { children: r });
|
|
2257
|
+
}, _r = (r) => /* @__PURE__ */ s(ue, { tenant: "required", ...r }), Or = (r) => /* @__PURE__ */ s(ue, { tenant: "forbidden", ...r }), Vr = (r) => /* @__PURE__ */ s(ue, { auth: "required", ...r }), qr = (r) => /* @__PURE__ */ s(ue, { auth: "forbidden", ...r }), zr = (r) => /* @__PURE__ */ s(ue, { auth: "required", userType: ae.TENANT_ADMIN, ...r }), jr = (r) => /* @__PURE__ */ s(ue, { auth: "required", userType: ae.USER, ...r }), Wr = (r) => /* @__PURE__ */ s(ue, { tenant: "optional", auth: "optional", ...r }), Gr = (r) => /* @__PURE__ */ s(ue, { tenant: "required", auth: "required", ...r }), Hr = (r) => /* @__PURE__ */ s(ue, { tenant: "required", auth: "optional", ...r }), Qr = (r) => /* @__PURE__ */ s(ue, { tenant: "required", auth: "forbidden", ...r }), nr = () => /* @__PURE__ */ f(
|
|
2246
2258
|
"div",
|
|
2247
2259
|
{
|
|
2248
2260
|
style: {
|
|
@@ -2259,13 +2271,13 @@ const ue = ({
|
|
|
2259
2271
|
]
|
|
2260
2272
|
}
|
|
2261
2273
|
);
|
|
2262
|
-
function
|
|
2274
|
+
function Jr({
|
|
2263
2275
|
children: r,
|
|
2264
|
-
fallback: e = /* @__PURE__ */ s(
|
|
2276
|
+
fallback: e = /* @__PURE__ */ s(nr, {}),
|
|
2265
2277
|
allowedPlans: t,
|
|
2266
2278
|
requiredFeature: n
|
|
2267
2279
|
}) {
|
|
2268
|
-
const { subscription: i, hasAllowedPlan: a, isFeatureEnabled: l, loading: d } =
|
|
2280
|
+
const { subscription: i, hasAllowedPlan: a, isFeatureEnabled: l, loading: d } = jt();
|
|
2269
2281
|
return d ? /* @__PURE__ */ s(
|
|
2270
2282
|
"div",
|
|
2271
2283
|
{
|
|
@@ -2276,9 +2288,9 @@ function Qr({
|
|
|
2276
2288
|
},
|
|
2277
2289
|
children: "Loading subscription..."
|
|
2278
2290
|
}
|
|
2279
|
-
) : i ? i.isActive ? t && t.length > 0 && !a(t) ? /* @__PURE__ */ s(
|
|
2291
|
+
) : i ? i.isActive ? t && t.length > 0 && !a(t) ? /* @__PURE__ */ s(U, { children: e }) : n && !l(n) ? /* @__PURE__ */ s(U, { children: e }) : /* @__PURE__ */ s(U, { children: r }) : /* @__PURE__ */ s(U, { children: e }) : /* @__PURE__ */ s(U, { children: e });
|
|
2280
2292
|
}
|
|
2281
|
-
const
|
|
2293
|
+
const sr = ({ flagName: r }) => /* @__PURE__ */ f(
|
|
2282
2294
|
"div",
|
|
2283
2295
|
{
|
|
2284
2296
|
style: {
|
|
@@ -2305,8 +2317,8 @@ const nr = ({ flagName: r }) => /* @__PURE__ */ f(
|
|
|
2305
2317
|
]
|
|
2306
2318
|
}
|
|
2307
2319
|
);
|
|
2308
|
-
function
|
|
2309
|
-
const { isEnabled: n, loading: i } =
|
|
2320
|
+
function Zr({ name: r, children: e, fallback: t }) {
|
|
2321
|
+
const { isEnabled: n, loading: i } = qt();
|
|
2310
2322
|
return i ? /* @__PURE__ */ s(
|
|
2311
2323
|
"div",
|
|
2312
2324
|
{
|
|
@@ -2320,9 +2332,9 @@ function Jr({ name: r, children: e, fallback: t }) {
|
|
|
2320
2332
|
},
|
|
2321
2333
|
children: "Loading feature flags..."
|
|
2322
2334
|
}
|
|
2323
|
-
) : n(r) ? /* @__PURE__ */ s(
|
|
2335
|
+
) : n(r) ? /* @__PURE__ */ s(U, { children: e }) : /* @__PURE__ */ s(U, { children: t || /* @__PURE__ */ s(sr, { flagName: r }) });
|
|
2324
2336
|
}
|
|
2325
|
-
function
|
|
2337
|
+
function ve(r) {
|
|
2326
2338
|
const { submit: e, defaultErrorMessage: t, validate: n, onSuccess: i, onError: a } = r, [l, d] = N(!1), [T, A] = N(""), [c, S] = N({}), h = te((R, k) => {
|
|
2327
2339
|
S((m) => ({ ...m, [R]: k }));
|
|
2328
2340
|
}, []), x = te((R) => {
|
|
@@ -2537,7 +2549,7 @@ function Le(r, e) {
|
|
|
2537
2549
|
}
|
|
2538
2550
|
};
|
|
2539
2551
|
}
|
|
2540
|
-
const
|
|
2552
|
+
const ir = () => me.createElement(
|
|
2541
2553
|
"svg",
|
|
2542
2554
|
{
|
|
2543
2555
|
width: "16",
|
|
@@ -2552,7 +2564,7 @@ const sr = () => me.createElement(
|
|
|
2552
2564
|
},
|
|
2553
2565
|
me.createElement("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
2554
2566
|
me.createElement("circle", { cx: "12", cy: "12", r: "3" })
|
|
2555
|
-
),
|
|
2567
|
+
), or = () => me.createElement(
|
|
2556
2568
|
"svg",
|
|
2557
2569
|
{
|
|
2558
2570
|
width: "16",
|
|
@@ -2569,10 +2581,10 @@ const sr = () => me.createElement(
|
|
|
2569
2581
|
d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"
|
|
2570
2582
|
}),
|
|
2571
2583
|
me.createElement("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2572
|
-
),
|
|
2573
|
-
showPassword: /* @__PURE__ */ s(
|
|
2574
|
-
hidePassword: /* @__PURE__ */ s(
|
|
2575
|
-
},
|
|
2584
|
+
), ar = {
|
|
2585
|
+
showPassword: /* @__PURE__ */ s(ir, {}),
|
|
2586
|
+
hidePassword: /* @__PURE__ */ s(or, {})
|
|
2587
|
+
}, lr = {
|
|
2576
2588
|
title: "Sign In",
|
|
2577
2589
|
usernameLabel: "Email or Phone",
|
|
2578
2590
|
usernamePlaceholder: "Enter your email or phone number",
|
|
@@ -2591,7 +2603,7 @@ const sr = () => me.createElement(
|
|
|
2591
2603
|
showPasswordAriaLabel: "Show password",
|
|
2592
2604
|
hidePasswordAriaLabel: "Hide password"
|
|
2593
2605
|
};
|
|
2594
|
-
function
|
|
2606
|
+
function Kr({
|
|
2595
2607
|
copy: r = {},
|
|
2596
2608
|
styles: e = {},
|
|
2597
2609
|
icons: t = {},
|
|
@@ -2605,7 +2617,7 @@ function Zr({
|
|
|
2605
2617
|
showMagicLinkOption: c = !0,
|
|
2606
2618
|
className: S
|
|
2607
2619
|
}) {
|
|
2608
|
-
const [h, x] = N(""), [P, I] = N(""), [R, k] = N(!1), { login: m } = de(), g = { ...
|
|
2620
|
+
const [h, x] = N(""), [P, I] = N(""), [R, k] = N(!1), { login: m } = de(), g = { ...lr, ...r }, b = Le("#3b82f6", e), C = { ...ar, ...t }, o = ve({
|
|
2609
2621
|
defaultErrorMessage: g.errorMessage,
|
|
2610
2622
|
validate: () => {
|
|
2611
2623
|
const u = [];
|
|
@@ -2698,7 +2710,7 @@ function Zr({
|
|
|
2698
2710
|
] })
|
|
2699
2711
|
] });
|
|
2700
2712
|
}
|
|
2701
|
-
const
|
|
2713
|
+
const cr = {
|
|
2702
2714
|
title: "Create Account",
|
|
2703
2715
|
nameLabel: "First Name",
|
|
2704
2716
|
namePlaceholder: "Enter your first name",
|
|
@@ -2728,7 +2740,7 @@ const lr = {
|
|
|
2728
2740
|
tenantNotFoundError: "Tenant not found",
|
|
2729
2741
|
dividerBullet: "•"
|
|
2730
2742
|
};
|
|
2731
|
-
function
|
|
2743
|
+
function Yr({
|
|
2732
2744
|
copy: r = {},
|
|
2733
2745
|
styles: e = {},
|
|
2734
2746
|
signupType: t = "user",
|
|
@@ -2740,8 +2752,8 @@ function Kr({
|
|
|
2740
2752
|
showMagicLinkOption: T = !0,
|
|
2741
2753
|
className: A
|
|
2742
2754
|
}) {
|
|
2743
|
-
var
|
|
2744
|
-
const [c, S] = N(""), [h, x] = N(""), [P, I] = N(""), [R, k] = N(""), [m, g] = N(""), [b, C] = N(""), [o, p] = N(""), { signup: E, signupTenantAdmin: y } = de(), u = ((
|
|
2755
|
+
var B;
|
|
2756
|
+
const [c, S] = N(""), [h, x] = N(""), [P, I] = N(""), [R, k] = N(""), [m, g] = N(""), [b, C] = N(""), [o, p] = N(""), { signup: E, signupTenantAdmin: y } = de(), u = ((B = pe()) == null ? void 0 : B.tenant) ?? null, v = { ...cr, ...r }, D = Le("#10b981", e), se = !!c && (!!P || !!R) && !!m && !!b && (t === "user" || !!o), F = ve({
|
|
2745
2757
|
defaultErrorMessage: v.errorMessage,
|
|
2746
2758
|
validate: () => {
|
|
2747
2759
|
const L = [];
|
|
@@ -2924,7 +2936,7 @@ function Kr({
|
|
|
2924
2936
|
] })
|
|
2925
2937
|
] });
|
|
2926
2938
|
}
|
|
2927
|
-
const
|
|
2939
|
+
const ur = {
|
|
2928
2940
|
title: "Sign In with Magic Link",
|
|
2929
2941
|
emailLabel: "Email",
|
|
2930
2942
|
emailPlaceholder: "Enter your email",
|
|
@@ -2949,7 +2961,7 @@ const cr = {
|
|
|
2949
2961
|
missingTenantOrEmailError: "Missing tenant or email",
|
|
2950
2962
|
dividerBullet: "•"
|
|
2951
2963
|
};
|
|
2952
|
-
function
|
|
2964
|
+
function Xr({
|
|
2953
2965
|
copy: r = {},
|
|
2954
2966
|
styles: e = {},
|
|
2955
2967
|
onSuccess: t,
|
|
@@ -2962,7 +2974,7 @@ function Yr({
|
|
|
2962
2974
|
frontendUrl: A
|
|
2963
2975
|
}) {
|
|
2964
2976
|
var H;
|
|
2965
|
-
const [c, S] = N(""), [h, x] = N(""), [P, I] = N(""), [R, k] = N(!1), [m, g] = N(""), [b, C] = N(!1), { sendMagicLink: o, verifyMagicLink: p } = de(), E = ((H = pe()) == null ? void 0 : H.tenant) ?? null, y = { ...
|
|
2977
|
+
const [c, S] = N(""), [h, x] = N(""), [P, I] = N(""), [R, k] = N(!1), [m, g] = N(""), [b, C] = N(!1), { sendMagicLink: o, verifyMagicLink: p } = de(), E = ((H = pe()) == null ? void 0 : H.tenant) ?? null, y = { ...ur, ...r }, u = Le("#3b82f6", e), v = ve({
|
|
2966
2978
|
defaultErrorMessage: y.errorMessage,
|
|
2967
2979
|
validate: () => {
|
|
2968
2980
|
const j = [];
|
|
@@ -3043,7 +3055,7 @@ function Yr({
|
|
|
3043
3055
|
children: y.showNameToggle
|
|
3044
3056
|
}
|
|
3045
3057
|
) }),
|
|
3046
|
-
b && /* @__PURE__ */ f(
|
|
3058
|
+
b && /* @__PURE__ */ f(U, { children: [
|
|
3047
3059
|
/* @__PURE__ */ f("div", { style: u.fieldGroup, children: [
|
|
3048
3060
|
/* @__PURE__ */ s("label", { style: u.label, children: y.nameLabel }),
|
|
3049
3061
|
/* @__PURE__ */ s(
|
|
@@ -3113,7 +3125,7 @@ function Yr({
|
|
|
3113
3125
|
] })
|
|
3114
3126
|
] });
|
|
3115
3127
|
}
|
|
3116
|
-
const
|
|
3128
|
+
const dr = {
|
|
3117
3129
|
title: "Verifying Magic Link",
|
|
3118
3130
|
verifyingMessage: "Please wait while we verify your magic link...",
|
|
3119
3131
|
successMessage: "Magic link verified successfully! You are now logged in.",
|
|
@@ -3215,7 +3227,7 @@ const ur = {
|
|
|
3215
3227
|
backButtonHover: {
|
|
3216
3228
|
backgroundColor: "#e5e7eb"
|
|
3217
3229
|
}
|
|
3218
|
-
},
|
|
3230
|
+
}, hr = () => /* @__PURE__ */ s("div", { style: ut.spinner }), pr = () => /* @__PURE__ */ f(
|
|
3219
3231
|
"svg",
|
|
3220
3232
|
{
|
|
3221
3233
|
width: "48",
|
|
@@ -3232,7 +3244,7 @@ const ur = {
|
|
|
3232
3244
|
/* @__PURE__ */ s("polyline", { points: "22,4 12,14.01 9,11.01" })
|
|
3233
3245
|
]
|
|
3234
3246
|
}
|
|
3235
|
-
),
|
|
3247
|
+
), fr = () => /* @__PURE__ */ f(
|
|
3236
3248
|
"svg",
|
|
3237
3249
|
{
|
|
3238
3250
|
width: "48",
|
|
@@ -3250,12 +3262,12 @@ const ur = {
|
|
|
3250
3262
|
/* @__PURE__ */ s("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
3251
3263
|
]
|
|
3252
3264
|
}
|
|
3253
|
-
),
|
|
3254
|
-
loading: /* @__PURE__ */ s(
|
|
3255
|
-
success: /* @__PURE__ */ s(
|
|
3256
|
-
error: /* @__PURE__ */ s(
|
|
3265
|
+
), mr = {
|
|
3266
|
+
loading: /* @__PURE__ */ s(hr, {}),
|
|
3267
|
+
success: /* @__PURE__ */ s(pr, {}),
|
|
3268
|
+
error: /* @__PURE__ */ s(fr, {})
|
|
3257
3269
|
};
|
|
3258
|
-
function
|
|
3270
|
+
function en({
|
|
3259
3271
|
copy: r = {},
|
|
3260
3272
|
styles: e = {},
|
|
3261
3273
|
icons: t = {},
|
|
@@ -3270,7 +3282,7 @@ function Xr({
|
|
|
3270
3282
|
tenantSlug: S,
|
|
3271
3283
|
autoRedirectDelay: h = 3e3
|
|
3272
3284
|
}) {
|
|
3273
|
-
const [x, P] = N("verifying"), [I, R] = N(""), { verifyMagicLink: k } = de(), m = { ...
|
|
3285
|
+
const [x, P] = N("verifying"), [I, R] = N(""), { verifyMagicLink: k } = de(), m = { ...dr, ...r }, g = { ...ut, ...e }, b = { ...mr, ...t }, C = () => {
|
|
3274
3286
|
if (typeof window > "u") return {};
|
|
3275
3287
|
const u = new URLSearchParams(window.location.search);
|
|
3276
3288
|
return {
|
|
@@ -3313,17 +3325,17 @@ function Xr({
|
|
|
3313
3325
|
m.verifyingMessage
|
|
3314
3326
|
] });
|
|
3315
3327
|
case "success":
|
|
3316
|
-
return /* @__PURE__ */ f(
|
|
3328
|
+
return /* @__PURE__ */ f(U, { children: [
|
|
3317
3329
|
b.success,
|
|
3318
3330
|
/* @__PURE__ */ s("div", { style: g.successMessage, children: m.successMessage })
|
|
3319
3331
|
] });
|
|
3320
3332
|
case "redirecting":
|
|
3321
|
-
return /* @__PURE__ */ f(
|
|
3333
|
+
return /* @__PURE__ */ f(U, { children: [
|
|
3322
3334
|
b.loading,
|
|
3323
3335
|
/* @__PURE__ */ s("div", { style: g.message, children: m.redirectingMessage })
|
|
3324
3336
|
] });
|
|
3325
3337
|
case "error":
|
|
3326
|
-
return /* @__PURE__ */ f(
|
|
3338
|
+
return /* @__PURE__ */ f(U, { children: [
|
|
3327
3339
|
b.error,
|
|
3328
3340
|
/* @__PURE__ */ s("div", { style: g.errorMessage, children: I || m.errorMessage }),
|
|
3329
3341
|
/* @__PURE__ */ f("div", { style: g.buttonContainer, children: [
|
|
@@ -3378,7 +3390,7 @@ function Xr({
|
|
|
3378
3390
|
y()
|
|
3379
3391
|
] });
|
|
3380
3392
|
}
|
|
3381
|
-
const
|
|
3393
|
+
const gr = {
|
|
3382
3394
|
title: "Reset Password",
|
|
3383
3395
|
subtitle: "Enter your email address and we'll send you a link to reset your password.",
|
|
3384
3396
|
emailLabel: "Email",
|
|
@@ -3405,7 +3417,7 @@ const mr = {
|
|
|
3405
3417
|
tenantNotFoundError: "Tenant not found",
|
|
3406
3418
|
dividerBullet: "•"
|
|
3407
3419
|
};
|
|
3408
|
-
function
|
|
3420
|
+
function tn({
|
|
3409
3421
|
copy: r = {},
|
|
3410
3422
|
styles: e = {},
|
|
3411
3423
|
mode: t = "request",
|
|
@@ -3417,7 +3429,7 @@ function en({
|
|
|
3417
3429
|
className: T
|
|
3418
3430
|
}) {
|
|
3419
3431
|
var se;
|
|
3420
|
-
const [A, c] = N(""), [S, h] = N(n), [x, P] = N(""), [I, R] = N(""), [k, m] = N(""), { requestPasswordReset: g, confirmPasswordReset: b } = de(), C = ((se = pe()) == null ? void 0 : se.tenant) ?? null, o = { ...
|
|
3432
|
+
const [A, c] = N(""), [S, h] = N(n), [x, P] = N(""), [I, R] = N(""), [k, m] = N(""), { requestPasswordReset: g, confirmPasswordReset: b } = de(), C = ((se = pe()) == null ? void 0 : se.tenant) ?? null, o = { ...gr, ...r }, p = Le("#f59e0b", e), E = ve({
|
|
3421
3433
|
defaultErrorMessage: o.errorMessage,
|
|
3422
3434
|
validate: () => A.trim() ? C != null && C.id ? !0 : (E.setError(o.tenantNotFoundError), !1) : (E.setFieldError("email", !0), !1),
|
|
3423
3435
|
submit: async () => {
|
|
@@ -3425,7 +3437,7 @@ function en({
|
|
|
3425
3437
|
},
|
|
3426
3438
|
onSuccess: () => i == null ? void 0 : i(),
|
|
3427
3439
|
onError: a
|
|
3428
|
-
}), y =
|
|
3440
|
+
}), y = ve({
|
|
3429
3441
|
defaultErrorMessage: o.errorMessage,
|
|
3430
3442
|
validate: () => {
|
|
3431
3443
|
const F = [];
|
|
@@ -3504,7 +3516,7 @@ function en({
|
|
|
3504
3516
|
] }),
|
|
3505
3517
|
/* @__PURE__ */ f("div", { style: p.linkContainer, children: [
|
|
3506
3518
|
/* @__PURE__ */ s("a", { onClick: l, style: p.link, children: o.backToLoginLink }),
|
|
3507
|
-
d && /* @__PURE__ */ f(
|
|
3519
|
+
d && /* @__PURE__ */ f(U, { children: [
|
|
3508
3520
|
/* @__PURE__ */ s("span", { style: p.modeSwitchDivider, children: o.dividerBullet }),
|
|
3509
3521
|
/* @__PURE__ */ s("a", { onClick: () => d("request"), style: p.link, children: o.requestNewLinkLink })
|
|
3510
3522
|
] })
|
|
@@ -3545,14 +3557,14 @@ function en({
|
|
|
3545
3557
|
] }),
|
|
3546
3558
|
/* @__PURE__ */ f("div", { style: p.linkContainer, children: [
|
|
3547
3559
|
/* @__PURE__ */ s("a", { onClick: l, style: p.link, children: o.backToLoginLink }),
|
|
3548
|
-
d && /* @__PURE__ */ f(
|
|
3560
|
+
d && /* @__PURE__ */ f(U, { children: [
|
|
3549
3561
|
/* @__PURE__ */ s("span", { style: p.modeSwitchDivider, children: o.dividerBullet }),
|
|
3550
3562
|
/* @__PURE__ */ s("a", { onClick: () => d("reset"), style: p.link, children: o.haveTokenLink })
|
|
3551
3563
|
] })
|
|
3552
3564
|
] })
|
|
3553
3565
|
] });
|
|
3554
3566
|
}
|
|
3555
|
-
const
|
|
3567
|
+
const yr = () => /* @__PURE__ */ s(
|
|
3556
3568
|
"div",
|
|
3557
3569
|
{
|
|
3558
3570
|
style: {
|
|
@@ -3564,7 +3576,7 @@ const gr = () => /* @__PURE__ */ s(
|
|
|
3564
3576
|
},
|
|
3565
3577
|
children: /* @__PURE__ */ s("div", { children: "Loading..." })
|
|
3566
3578
|
}
|
|
3567
|
-
),
|
|
3579
|
+
), br = ({ error: r, retry: e }) => /* @__PURE__ */ f(
|
|
3568
3580
|
"div",
|
|
3569
3581
|
{
|
|
3570
3582
|
style: {
|
|
@@ -3598,7 +3610,7 @@ const gr = () => /* @__PURE__ */ s(
|
|
|
3598
3610
|
]
|
|
3599
3611
|
}
|
|
3600
3612
|
);
|
|
3601
|
-
function
|
|
3613
|
+
function rn({
|
|
3602
3614
|
children: r,
|
|
3603
3615
|
loadingFallback: e,
|
|
3604
3616
|
errorFallback: t,
|
|
@@ -3609,14 +3621,14 @@ function tn({
|
|
|
3609
3621
|
a && l(), h && d && P();
|
|
3610
3622
|
};
|
|
3611
3623
|
if (o)
|
|
3612
|
-
return /* @__PURE__ */ s(
|
|
3624
|
+
return /* @__PURE__ */ s(U, { children: e || /* @__PURE__ */ s(yr, {}) });
|
|
3613
3625
|
if (p) {
|
|
3614
|
-
const y = typeof t == "function" ? t(p, E) : t || /* @__PURE__ */ s(
|
|
3615
|
-
return /* @__PURE__ */ s(
|
|
3626
|
+
const y = typeof t == "function" ? t(p, E) : t || /* @__PURE__ */ s(br, { error: p, retry: E });
|
|
3627
|
+
return /* @__PURE__ */ s(U, { children: y });
|
|
3616
3628
|
}
|
|
3617
|
-
return /* @__PURE__ */ s(
|
|
3629
|
+
return /* @__PURE__ */ s(U, { children: r });
|
|
3618
3630
|
}
|
|
3619
|
-
function
|
|
3631
|
+
function nn(r = !0) {
|
|
3620
3632
|
const { isAppLoading: e, appError: t, retryApp: n, appInfo: i } = Ae(), a = pe(), l = Oe(), d = at(), T = lt(), A = (a == null ? void 0 : a.isTenantLoading) ?? !1, c = (a == null ? void 0 : a.tenantError) ?? null, S = (a == null ? void 0 : a.tenant) ?? null, h = (a == null ? void 0 : a.tenantSlug) ?? null, x = (a == null ? void 0 : a.retryTenant) ?? (() => {
|
|
3621
3633
|
}), P = (l == null ? void 0 : l.isAuthReady) ?? !0, I = (d == null ? void 0 : d.isReady) ?? !0, R = (T == null ? void 0 : T.isReady) ?? !0, k = r && a && h, C = e || k && A || l && !P || d && !I || T && !R, o = t || (k ? c : null);
|
|
3622
3634
|
return {
|
|
@@ -3634,7 +3646,7 @@ function rn(r = !0) {
|
|
|
3634
3646
|
subscription: T ? { isReady: R } : null
|
|
3635
3647
|
};
|
|
3636
3648
|
}
|
|
3637
|
-
const
|
|
3649
|
+
const wr = {
|
|
3638
3650
|
wrapper: {
|
|
3639
3651
|
position: "relative"
|
|
3640
3652
|
},
|
|
@@ -3678,7 +3690,7 @@ const br = {
|
|
|
3678
3690
|
marginLeft: 8
|
|
3679
3691
|
}
|
|
3680
3692
|
};
|
|
3681
|
-
function
|
|
3693
|
+
function sn({
|
|
3682
3694
|
tenants: r,
|
|
3683
3695
|
currentTenantId: e,
|
|
3684
3696
|
onSelect: t,
|
|
@@ -3692,7 +3704,7 @@ function nn({
|
|
|
3692
3704
|
showCurrentTenant: c = !0
|
|
3693
3705
|
}) {
|
|
3694
3706
|
var C;
|
|
3695
|
-
const S = { ...
|
|
3707
|
+
const S = { ...wr, ...n }, h = Oe(), [x, P] = N(!1), I = ye(null), R = r ?? (h == null ? void 0 : h.userTenants) ?? [], k = e ?? ((C = h == null ? void 0 : h.currentUser) == null ? void 0 : C.tenantId) ?? null, m = async (o) => {
|
|
3696
3708
|
P(!1), t ? t(o) : h != null && h.switchToTenant && await h.switchToTenant(o);
|
|
3697
3709
|
};
|
|
3698
3710
|
re(() => {
|
|
@@ -3760,7 +3772,7 @@ function nn({
|
|
|
3760
3772
|
}) })
|
|
3761
3773
|
] });
|
|
3762
3774
|
}
|
|
3763
|
-
class
|
|
3775
|
+
class on {
|
|
3764
3776
|
constructor(e) {
|
|
3765
3777
|
this.httpService = e;
|
|
3766
3778
|
}
|
|
@@ -3793,7 +3805,7 @@ class sn {
|
|
|
3793
3805
|
return { permissions: n.data, meta: n.meta };
|
|
3794
3806
|
}
|
|
3795
3807
|
}
|
|
3796
|
-
class
|
|
3808
|
+
class an {
|
|
3797
3809
|
constructor(e) {
|
|
3798
3810
|
this.httpService = e;
|
|
3799
3811
|
}
|
|
@@ -3824,7 +3836,7 @@ class on {
|
|
|
3824
3836
|
await this.httpService.delete(`/subscription-plans/${e}`);
|
|
3825
3837
|
}
|
|
3826
3838
|
}
|
|
3827
|
-
class
|
|
3839
|
+
class ln {
|
|
3828
3840
|
constructor(e) {
|
|
3829
3841
|
this.httpService = e;
|
|
3830
3842
|
}
|
|
@@ -3834,12 +3846,12 @@ class an {
|
|
|
3834
3846
|
}
|
|
3835
3847
|
}
|
|
3836
3848
|
const dt = "returnTo", Ce = "zone_return_to", De = "zone_return_to";
|
|
3837
|
-
function
|
|
3849
|
+
function cn(r = {}) {
|
|
3838
3850
|
const {
|
|
3839
3851
|
zoneRoots: e = {},
|
|
3840
3852
|
returnToParam: t = dt,
|
|
3841
3853
|
returnToStorage: n = "url"
|
|
3842
|
-
} = r, i =
|
|
3854
|
+
} = r, i = vt(), [a, l] = Tt(), { isAuthenticated: d, currentUser: T } = de(), { tenant: A } = Te(), c = V(() => ({ ...ze, ...e }), [e]), S = !!A, h = T == null ? void 0 : T.userType, x = V(() => {
|
|
3843
3855
|
switch (n) {
|
|
3844
3856
|
case "url":
|
|
3845
3857
|
return a.get(t);
|
|
@@ -3896,79 +3908,79 @@ function ln(r = {}) {
|
|
|
3896
3908
|
getSmartRedirect: k
|
|
3897
3909
|
};
|
|
3898
3910
|
}
|
|
3899
|
-
function
|
|
3911
|
+
function un(r, e, t = dt, n = "url") {
|
|
3900
3912
|
if (!e || n !== "url")
|
|
3901
3913
|
return r;
|
|
3902
3914
|
const i = new URL(r, window.location.origin);
|
|
3903
3915
|
return i.searchParams.set(t, e), i.pathname + i.search;
|
|
3904
3916
|
}
|
|
3905
3917
|
export {
|
|
3906
|
-
|
|
3918
|
+
zr as AdminZone,
|
|
3907
3919
|
Je as AppApiService,
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3920
|
+
rn as AppLoader,
|
|
3921
|
+
kr as AppProvider,
|
|
3922
|
+
Ct as AuthApiService,
|
|
3923
|
+
Pr as AuthProvider,
|
|
3924
|
+
Vr as AuthenticatedZone,
|
|
3913
3925
|
oe as ConfigurationError,
|
|
3914
3926
|
ct as DEFAULT_ZONE_PRESETS,
|
|
3915
3927
|
ze as DEFAULT_ZONE_ROOTS,
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3928
|
+
Zr as FeatureFlag,
|
|
3929
|
+
Vt as FeatureFlagApiService,
|
|
3930
|
+
Fr as FeatureFlagProvider,
|
|
3931
|
+
qr as GuestZone,
|
|
3932
|
+
ln as HealthApiService,
|
|
3921
3933
|
he as HttpService,
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
+
Br as LandingRoute,
|
|
3935
|
+
Kr as LoginForm,
|
|
3936
|
+
Xr as MagicLinkForm,
|
|
3937
|
+
en as MagicLinkVerify,
|
|
3938
|
+
Wr as OpenZone,
|
|
3939
|
+
tn as PasswordRecoveryForm,
|
|
3940
|
+
on as PermissionApiService,
|
|
3941
|
+
Mr as Protected,
|
|
3942
|
+
$r as ProtectedRoute,
|
|
3943
|
+
Or as PublicZone,
|
|
3944
|
+
Dt as RoleApiService,
|
|
3945
|
+
Cr as RoutingProvider,
|
|
3934
3946
|
ee as SessionExpiredError,
|
|
3935
3947
|
Me as SessionManager,
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3948
|
+
Yr as SignupForm,
|
|
3949
|
+
zt as SubscriptionApiService,
|
|
3950
|
+
Jr as SubscriptionGuard,
|
|
3951
|
+
an as SubscriptionPlanApiService,
|
|
3952
|
+
Nr as SubscriptionProvider,
|
|
3953
|
+
be as TenantApiService,
|
|
3954
|
+
Gr as TenantAuthenticatedZone,
|
|
3955
|
+
Qr as TenantGuestZone,
|
|
3956
|
+
Hr as TenantOpenZone,
|
|
3957
|
+
xr as TenantProvider,
|
|
3958
|
+
Ur as TenantRoute,
|
|
3959
|
+
sn as TenantSelector,
|
|
3960
|
+
_r as TenantZone,
|
|
3961
|
+
Et as TokenRefreshError,
|
|
3962
|
+
kt as TokenRefreshTimeoutError,
|
|
3963
|
+
Mt as UserApiService,
|
|
3952
3964
|
ae as UserType,
|
|
3953
|
-
|
|
3965
|
+
jr as UserZone,
|
|
3954
3966
|
ue as ZoneRoute,
|
|
3955
|
-
|
|
3956
|
-
|
|
3967
|
+
un as buildRedirectUrl,
|
|
3968
|
+
Er as useApi,
|
|
3957
3969
|
Ae as useApp,
|
|
3958
|
-
|
|
3970
|
+
nn as useAppLoaderState,
|
|
3959
3971
|
de as useAuth,
|
|
3960
|
-
|
|
3972
|
+
Lr as useAuthActions,
|
|
3961
3973
|
Oe as useAuthOptional,
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3974
|
+
Ir as useAuthState,
|
|
3975
|
+
qt as useFeatureFlags,
|
|
3976
|
+
Dr as useRouting,
|
|
3977
|
+
Gt as useRoutingOptional,
|
|
3978
|
+
Rr as useSettings,
|
|
3979
|
+
jt as useSubscription,
|
|
3980
|
+
Te as useTenant,
|
|
3969
3981
|
ot as useTenantInfo,
|
|
3970
3982
|
pe as useTenantOptional,
|
|
3971
|
-
|
|
3972
|
-
|
|
3983
|
+
Ar as useTenantSettings,
|
|
3984
|
+
cn as useZoneNavigation
|
|
3973
3985
|
};
|
|
3974
3986
|
//# sourceMappingURL=index.es.js.map
|