@skylabs-digital/react-identity-access 2.23.0 → 2.25.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/README.md +560 -150
- package/dist/components/LoginForm.d.ts +5 -0
- package/dist/components/LoginForm.d.ts.map +1 -1
- package/dist/components/MagicLinkForm.d.ts +10 -0
- package/dist/components/MagicLinkForm.d.ts.map +1 -1
- package/dist/components/MagicLinkVerify.d.ts +3 -0
- package/dist/components/MagicLinkVerify.d.ts.map +1 -1
- package/dist/components/PasswordRecoveryForm.d.ts +5 -0
- package/dist/components/PasswordRecoveryForm.d.ts.map +1 -1
- package/dist/components/SignupForm.d.ts +4 -0
- package/dist/components/SignupForm.d.ts.map +1 -1
- package/dist/components/TenantSelector.d.ts +13 -1
- package/dist/components/TenantSelector.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1379 -1340
- 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/providers/TenantProvider.d.ts.map +1 -1
- package/dist/services/SessionManager.d.ts.map +1 -1
- package/dist/utils/crossDomainAuth.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as s, Fragment as _, jsxs as d } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useLocation as
|
|
4
|
-
class
|
|
2
|
+
import { createContext as fe, useMemo as K, useState as k, useCallback as se, useEffect as re, useContext as ae, useRef as Me } from "react";
|
|
3
|
+
import { useLocation as ke, Navigate as ve, useNavigate as pt, useSearchParams as ft } from "react-router-dom";
|
|
4
|
+
class le {
|
|
5
5
|
constructor(e, t = 1e4) {
|
|
6
6
|
this.baseUrl = e.replace(/\/$/, ""), this.timeout = t;
|
|
7
7
|
}
|
|
@@ -13,28 +13,28 @@ class ce {
|
|
|
13
13
|
}
|
|
14
14
|
async executeRequest(e, t, r, i) {
|
|
15
15
|
const o = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, a = (i == null ? void 0 : i.timeout) || this.timeout;
|
|
16
|
-
let
|
|
16
|
+
let p = {
|
|
17
17
|
"Content-Type": "application/json",
|
|
18
18
|
...i == null ? void 0 : i.headers
|
|
19
19
|
};
|
|
20
20
|
if (!(i != null && i.skipAuth) && this.sessionManager) {
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const f = await this.sessionManager.getValidAccessToken();
|
|
22
|
+
p = { ...p, Authorization: `Bearer ${f}` };
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const w = new AbortController(), y = setTimeout(() => w.abort(), a);
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
26
|
+
const f = await fetch(o, {
|
|
27
27
|
method: e,
|
|
28
|
-
headers:
|
|
28
|
+
headers: p,
|
|
29
29
|
body: r ? JSON.stringify(r) : void 0,
|
|
30
|
-
signal:
|
|
30
|
+
signal: w.signal
|
|
31
31
|
});
|
|
32
|
-
if (clearTimeout(
|
|
33
|
-
throw new Error(`HTTP ${
|
|
34
|
-
const
|
|
35
|
-
return !
|
|
36
|
-
} catch (
|
|
37
|
-
throw clearTimeout(
|
|
32
|
+
if (clearTimeout(y), !f.ok)
|
|
33
|
+
throw new Error(`HTTP ${f.status}: ${f.statusText}`);
|
|
34
|
+
const x = f.headers.get("content-type");
|
|
35
|
+
return !x || !x.includes("application/json") ? {} : await f.json();
|
|
36
|
+
} catch (f) {
|
|
37
|
+
throw clearTimeout(y), f instanceof Error && f.name === "AbortError" ? new Error(`Request timeout after ${a}ms`) : f;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
async get(e, t) {
|
|
@@ -50,7 +50,7 @@ class ce {
|
|
|
50
50
|
return this.executeRequest("DELETE", e, void 0, t);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
class
|
|
53
|
+
class qe {
|
|
54
54
|
constructor(e, t) {
|
|
55
55
|
this.httpService = e, this.sessionManager = t;
|
|
56
56
|
}
|
|
@@ -109,32 +109,32 @@ class ze {
|
|
|
109
109
|
})).data;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
const
|
|
113
|
-
function
|
|
114
|
-
const t =
|
|
112
|
+
const Le = fe(null);
|
|
113
|
+
function mr({ config: n, children: e }) {
|
|
114
|
+
const t = K(
|
|
115
115
|
() => {
|
|
116
|
-
var
|
|
116
|
+
var h, R, N;
|
|
117
117
|
return {
|
|
118
|
-
enabled: ((
|
|
119
|
-
ttl: ((
|
|
118
|
+
enabled: ((h = n.cache) == null ? void 0 : h.enabled) ?? !0,
|
|
119
|
+
ttl: ((R = n.cache) == null ? void 0 : R.ttl) ?? 3e5,
|
|
120
120
|
// 5 minutes default
|
|
121
|
-
storageKey: ((
|
|
121
|
+
storageKey: ((N = n.cache) == null ? void 0 : N.storageKey) ?? `app_cache_${n.appId}`
|
|
122
122
|
};
|
|
123
123
|
},
|
|
124
124
|
[n.cache, n.appId]
|
|
125
|
-
), [r, i] =
|
|
125
|
+
), [r, i] = k(() => {
|
|
126
126
|
if (!t.enabled) return null;
|
|
127
127
|
try {
|
|
128
|
-
const
|
|
129
|
-
if (!
|
|
130
|
-
const
|
|
131
|
-
return Date.now() -
|
|
128
|
+
const h = localStorage.getItem(t.storageKey);
|
|
129
|
+
if (!h) return null;
|
|
130
|
+
const R = JSON.parse(h);
|
|
131
|
+
return Date.now() - R.timestamp < t.ttl && R.appId === n.appId ? R.data : (localStorage.removeItem(t.storageKey), null);
|
|
132
132
|
} catch {
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
135
|
-
}), [o, a] =
|
|
136
|
-
const
|
|
137
|
-
|
|
135
|
+
}), [o, a] = k(!r), [p, w] = k(null), y = K(() => {
|
|
136
|
+
const h = () => {
|
|
137
|
+
f();
|
|
138
138
|
};
|
|
139
139
|
return {
|
|
140
140
|
appId: n.appId,
|
|
@@ -142,69 +142,69 @@ function yr({ config: n, children: e }) {
|
|
|
142
142
|
// App info
|
|
143
143
|
appInfo: r,
|
|
144
144
|
isAppLoading: o,
|
|
145
|
-
appError:
|
|
146
|
-
retryApp:
|
|
145
|
+
appError: p,
|
|
146
|
+
retryApp: h
|
|
147
147
|
};
|
|
148
|
-
}, [n, r, o,
|
|
149
|
-
async (
|
|
150
|
-
if (!(!
|
|
148
|
+
}, [n, r, o, p]), f = se(
|
|
149
|
+
async (h = !1) => {
|
|
150
|
+
if (!(!h && t.enabled && r))
|
|
151
151
|
try {
|
|
152
|
-
a(!0),
|
|
153
|
-
const
|
|
154
|
-
if (i(
|
|
152
|
+
a(!0), w(null);
|
|
153
|
+
const R = new le(n.baseUrl), D = await new qe(R, {}).getPublicAppInfo(n.appId);
|
|
154
|
+
if (i(D), t.enabled)
|
|
155
155
|
try {
|
|
156
156
|
const E = {
|
|
157
|
-
data:
|
|
157
|
+
data: D,
|
|
158
158
|
timestamp: Date.now(),
|
|
159
159
|
appId: n.appId
|
|
160
160
|
};
|
|
161
161
|
localStorage.setItem(t.storageKey, JSON.stringify(E));
|
|
162
162
|
} catch (E) {
|
|
163
|
-
console.warn("Failed to cache app info:", E);
|
|
163
|
+
process.env.NODE_ENV === "development" && console.warn("[AppProvider] Failed to cache app info:", E);
|
|
164
164
|
}
|
|
165
|
-
} catch (
|
|
166
|
-
const
|
|
167
|
-
|
|
165
|
+
} catch (R) {
|
|
166
|
+
const N = R instanceof Error ? R : new Error("Failed to load app information");
|
|
167
|
+
w(N), i(null);
|
|
168
168
|
} finally {
|
|
169
169
|
a(!1);
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
172
|
[n.baseUrl, n.appId, t, r]
|
|
173
|
-
),
|
|
173
|
+
), x = se(async () => {
|
|
174
174
|
if (!(!t.enabled || !r))
|
|
175
175
|
try {
|
|
176
|
-
const
|
|
177
|
-
if (!
|
|
178
|
-
const
|
|
179
|
-
if (Date.now() -
|
|
180
|
-
const
|
|
181
|
-
i(
|
|
176
|
+
const h = localStorage.getItem(t.storageKey);
|
|
177
|
+
if (!h) return;
|
|
178
|
+
const R = JSON.parse(h);
|
|
179
|
+
if (Date.now() - R.timestamp > t.ttl * 0.5) {
|
|
180
|
+
const D = new le(n.baseUrl), P = await new qe(D, {}).getPublicAppInfo(n.appId);
|
|
181
|
+
i(P);
|
|
182
182
|
const u = {
|
|
183
|
-
data:
|
|
183
|
+
data: P,
|
|
184
184
|
timestamp: Date.now(),
|
|
185
185
|
appId: n.appId
|
|
186
186
|
};
|
|
187
187
|
localStorage.setItem(t.storageKey, JSON.stringify(u));
|
|
188
188
|
}
|
|
189
|
-
} catch (
|
|
190
|
-
console.warn("Background app refresh failed:",
|
|
189
|
+
} catch (h) {
|
|
190
|
+
process.env.NODE_ENV === "development" && console.warn("[AppProvider] Background app refresh failed:", h);
|
|
191
191
|
}
|
|
192
192
|
}, [n, t, r]);
|
|
193
|
-
return
|
|
194
|
-
r ?
|
|
195
|
-
}, []), /* @__PURE__ */ s(
|
|
193
|
+
return re(() => {
|
|
194
|
+
r ? x() : f();
|
|
195
|
+
}, []), /* @__PURE__ */ s(Le.Provider, { value: y, children: e });
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
const n =
|
|
197
|
+
function Se() {
|
|
198
|
+
const n = ae(Le);
|
|
199
199
|
if (!n)
|
|
200
200
|
throw new Error("useApp must be used within an AppProvider");
|
|
201
201
|
return n;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
return
|
|
203
|
+
function Qe() {
|
|
204
|
+
return ae(Le);
|
|
205
205
|
}
|
|
206
|
-
const
|
|
207
|
-
class
|
|
206
|
+
const yr = Se;
|
|
207
|
+
class ne extends Error {
|
|
208
208
|
constructor(e, t) {
|
|
209
209
|
const r = {
|
|
210
210
|
token_expired: "Refresh token has expired",
|
|
@@ -214,19 +214,19 @@ class se extends Error {
|
|
|
214
214
|
super(t || r[e]), this.name = "SessionExpiredError", this.reason = e;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
class
|
|
217
|
+
class gt extends Error {
|
|
218
218
|
constructor(e) {
|
|
219
219
|
super(`Token refresh timed out after ${e}ms`), this.name = "TokenRefreshTimeoutError", this.timeoutMs = e;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
class
|
|
222
|
+
class mt extends Error {
|
|
223
223
|
constructor(e, t) {
|
|
224
224
|
super(
|
|
225
225
|
`Token refresh failed after ${e} attempts: ${(t == null ? void 0 : t.message) || "Unknown error"}`
|
|
226
226
|
), this.name = "TokenRefreshError", this.attempts = e, this.lastError = t;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
const
|
|
229
|
+
const ie = class ie {
|
|
230
230
|
constructor(e = {}) {
|
|
231
231
|
this.refreshPromise = null, this.refreshQueue = [], this.proactiveTimerId = null, this.backgroundRetryTimerId = null, this.isDestroyed = !1, this.sessionGeneration = 0, e.tenantSlug !== void 0 ? this.storageKey = e.tenantSlug ? `auth_tokens_${e.tenantSlug}` : "auth_tokens" : this.storageKey = e.storageKey || "auth_tokens", this.autoRefresh = e.autoRefresh ?? !0, this.refreshThreshold = e.refreshThreshold || 3e5, this.onRefreshFailed = e.onRefreshFailed, this.onSessionExpired = e.onSessionExpired, this.baseUrl = e.baseUrl || "", this.proactiveRefreshMargin = e.proactiveRefreshMargin ?? 6e4, this.refreshQueueTimeout = e.refreshQueueTimeout ?? 1e4, this.maxRefreshRetries = e.maxRefreshRetries ?? 3, this.retryBackoffBase = e.retryBackoffBase ?? 1e3, this.tokenStorage = e.tokenStorage || this.createTokenStorage(this.storageKey), this.scheduleProactiveRefresh();
|
|
232
232
|
}
|
|
@@ -236,17 +236,17 @@ const oe = class oe {
|
|
|
236
236
|
* Mutable config (callbacks, baseUrl) is updated on the existing instance.
|
|
237
237
|
*/
|
|
238
238
|
static getInstance(e = {}) {
|
|
239
|
-
const t =
|
|
239
|
+
const t = ie.resolveStorageKey(e), r = ie.instances.get(t);
|
|
240
240
|
if (r)
|
|
241
241
|
return r.updateConfig(e), r;
|
|
242
|
-
const i = new
|
|
243
|
-
return
|
|
242
|
+
const i = new ie(e);
|
|
243
|
+
return ie.instances.set(t, i), i;
|
|
244
244
|
}
|
|
245
245
|
/** Reset all singleton instances. For testing only. */
|
|
246
246
|
static resetAllInstances() {
|
|
247
|
-
for (const e of
|
|
247
|
+
for (const e of ie.instances.values())
|
|
248
248
|
e.destroy();
|
|
249
|
-
|
|
249
|
+
ie.instances.clear();
|
|
250
250
|
}
|
|
251
251
|
static resolveStorageKey(e) {
|
|
252
252
|
return e.storageKey ? e.storageKey : e.tenantSlug !== void 0 && e.tenantSlug ? `auth_tokens_${e.tenantSlug}` : "auth_tokens";
|
|
@@ -296,7 +296,7 @@ const oe = class oe {
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
setTokens(e) {
|
|
299
|
-
const t = e.expiresAt || (e.expiresIn ? Date.now() + e.expiresIn * 1e3 : void 0) ||
|
|
299
|
+
const t = e.expiresAt || (e.expiresIn ? Date.now() + e.expiresIn * 1e3 : void 0) || ie.extractJwtExpiry(e.accessToken), r = {
|
|
300
300
|
...e,
|
|
301
301
|
expiresAt: t
|
|
302
302
|
}, i = this.tokenStorage.get() || {};
|
|
@@ -306,7 +306,7 @@ const oe = class oe {
|
|
|
306
306
|
const { accessToken: e, refreshToken: t, expiresAt: r, expiresIn: i, tokenType: o } = this.tokenStorage.get() || {};
|
|
307
307
|
if (!e)
|
|
308
308
|
return null;
|
|
309
|
-
const a = r ||
|
|
309
|
+
const a = r || ie.extractJwtExpiry(e);
|
|
310
310
|
return {
|
|
311
311
|
accessToken: e,
|
|
312
312
|
refreshToken: t,
|
|
@@ -354,7 +354,7 @@ const oe = class oe {
|
|
|
354
354
|
const t = this.sessionGeneration;
|
|
355
355
|
this.startRefreshAndResolveQueue(e.refreshToken).then(() => {
|
|
356
356
|
}).catch((r) => {
|
|
357
|
-
r instanceof
|
|
357
|
+
r instanceof ne || this.sessionGeneration === t && (process.env.NODE_ENV === "development" && console.warn(
|
|
358
358
|
"[SessionManager] Background refresh failed, retrying in 30s:",
|
|
359
359
|
r.message
|
|
360
360
|
), this.backgroundRetryTimerId = setTimeout(() => {
|
|
@@ -386,13 +386,13 @@ const oe = class oe {
|
|
|
386
386
|
async getValidAccessToken() {
|
|
387
387
|
const e = this.getTokens();
|
|
388
388
|
if (!(e != null && e.accessToken)) {
|
|
389
|
-
const t = new
|
|
389
|
+
const t = new ne("token_invalid", "No tokens available");
|
|
390
390
|
throw this.handleSessionExpired(t), t;
|
|
391
391
|
}
|
|
392
392
|
if (!this.shouldRefreshToken(e) && !this.isTokenExpired(e))
|
|
393
393
|
return e.accessToken;
|
|
394
394
|
if (!e.refreshToken) {
|
|
395
|
-
const t = new
|
|
395
|
+
const t = new ne("token_invalid", "No refresh token available");
|
|
396
396
|
throw this.handleSessionExpired(t), t;
|
|
397
397
|
}
|
|
398
398
|
return this.refreshPromise ? this.enqueueForToken() : this.startRefreshAndResolveQueue(e.refreshToken);
|
|
@@ -404,14 +404,14 @@ const oe = class oe {
|
|
|
404
404
|
try {
|
|
405
405
|
return { Authorization: `Bearer ${await this.getValidAccessToken()}` };
|
|
406
406
|
} catch (e) {
|
|
407
|
-
return e instanceof
|
|
407
|
+
return e instanceof ne && this.onRefreshFailed && this.onRefreshFailed(), {};
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
enqueueForToken() {
|
|
411
411
|
return new Promise((e, t) => {
|
|
412
412
|
const r = setTimeout(() => {
|
|
413
413
|
const i = this.refreshQueue.findIndex((o) => o.timeoutId === r);
|
|
414
|
-
i !== -1 && this.refreshQueue.splice(i, 1), t(new
|
|
414
|
+
i !== -1 && this.refreshQueue.splice(i, 1), t(new gt(this.refreshQueueTimeout));
|
|
415
415
|
}, this.refreshQueueTimeout);
|
|
416
416
|
this.refreshQueue.push({ resolve: e, reject: t, timeoutId: r });
|
|
417
417
|
});
|
|
@@ -424,7 +424,7 @@ const oe = class oe {
|
|
|
424
424
|
return this.resolveQueue(r), r;
|
|
425
425
|
} catch (t) {
|
|
426
426
|
const r = t instanceof Error ? t : new Error("Token refresh failed");
|
|
427
|
-
throw r instanceof
|
|
427
|
+
throw r instanceof ne ? (this.rejectQueue(r), this.handleSessionExpired(r)) : this.rejectQueue(r), r;
|
|
428
428
|
} finally {
|
|
429
429
|
this.refreshPromise = null;
|
|
430
430
|
}
|
|
@@ -447,21 +447,21 @@ const oe = class oe {
|
|
|
447
447
|
const r = this.sessionGeneration;
|
|
448
448
|
for (let i = 0; i <= this.maxRefreshRetries; i++) {
|
|
449
449
|
if (this.sessionGeneration !== r)
|
|
450
|
-
throw new
|
|
450
|
+
throw new ne("token_invalid", "Session cleared during refresh");
|
|
451
451
|
try {
|
|
452
452
|
await this.performTokenRefresh(e, r);
|
|
453
453
|
return;
|
|
454
454
|
} catch (o) {
|
|
455
455
|
const a = o instanceof Error ? o : new Error(String(o));
|
|
456
|
-
if (a instanceof
|
|
456
|
+
if (a instanceof ne)
|
|
457
457
|
throw a;
|
|
458
458
|
if (t = a, i < this.maxRefreshRetries) {
|
|
459
|
-
const
|
|
460
|
-
await this.sleep(
|
|
459
|
+
const p = this.retryBackoffBase * Math.pow(2, i);
|
|
460
|
+
await this.sleep(p);
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
throw new
|
|
464
|
+
throw new mt(this.maxRefreshRetries + 1, t);
|
|
465
465
|
}
|
|
466
466
|
/**
|
|
467
467
|
* Single refresh attempt with error classification.
|
|
@@ -485,15 +485,15 @@ const oe = class oe {
|
|
|
485
485
|
if (!i.ok) {
|
|
486
486
|
let a = "";
|
|
487
487
|
try {
|
|
488
|
-
const
|
|
489
|
-
a = (
|
|
488
|
+
const p = await i.json();
|
|
489
|
+
a = (p.message || p.error || "").toLowerCase();
|
|
490
490
|
} catch {
|
|
491
491
|
a = i.statusText.toLowerCase();
|
|
492
492
|
}
|
|
493
|
-
throw i.status === 401 ? a.includes("expired") ? new
|
|
493
|
+
throw i.status === 401 ? a.includes("expired") ? new ne("token_expired") : a.includes("invalid") ? new ne("token_invalid") : new ne("token_invalid", `Unauthorized: ${a}`) : i.status === 400 ? a.includes("inactive") ? new ne("user_inactive") : a.includes("expired") || a.includes("invalid") ? new ne("token_invalid", a) : new Error(`Token refresh failed (400): ${a}`) : new Error(`Token refresh failed: ${i.status} ${a}`);
|
|
494
494
|
}
|
|
495
495
|
if (this.sessionGeneration !== t)
|
|
496
|
-
throw new
|
|
496
|
+
throw new ne("token_invalid", "Session cleared during refresh");
|
|
497
497
|
const o = await i.json();
|
|
498
498
|
this.setTokens({
|
|
499
499
|
accessToken: o.accessToken,
|
|
@@ -521,7 +521,7 @@ const oe = class oe {
|
|
|
521
521
|
// --- Session lifecycle ---
|
|
522
522
|
clearSession() {
|
|
523
523
|
this.sessionGeneration++, this.cancelProactiveTimer(), this.clearTokens();
|
|
524
|
-
const e = new
|
|
524
|
+
const e = new ne("token_invalid", "Session cleared");
|
|
525
525
|
this.rejectQueue(e);
|
|
526
526
|
}
|
|
527
527
|
/**
|
|
@@ -529,8 +529,8 @@ const oe = class oe {
|
|
|
529
529
|
* Cancels all timers and rejects pending queue entries.
|
|
530
530
|
*/
|
|
531
531
|
destroy() {
|
|
532
|
-
this.isDestroyed = !0,
|
|
533
|
-
const e = new
|
|
532
|
+
this.isDestroyed = !0, ie.instances.delete(this.storageKey), this.cancelProactiveTimer();
|
|
533
|
+
const e = new ne("token_invalid", "SessionManager destroyed");
|
|
534
534
|
this.rejectQueue(e);
|
|
535
535
|
}
|
|
536
536
|
// --- JWT helpers ---
|
|
@@ -568,9 +568,9 @@ const oe = class oe {
|
|
|
568
568
|
return new Promise((t) => setTimeout(t, e));
|
|
569
569
|
}
|
|
570
570
|
};
|
|
571
|
-
|
|
572
|
-
let
|
|
573
|
-
class
|
|
571
|
+
ie.instances = /* @__PURE__ */ new Map();
|
|
572
|
+
let we = ie;
|
|
573
|
+
class yt {
|
|
574
574
|
constructor(e) {
|
|
575
575
|
this.httpService = e;
|
|
576
576
|
}
|
|
@@ -626,7 +626,7 @@ class bt {
|
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
|
-
class
|
|
629
|
+
class ze {
|
|
630
630
|
constructor(e, t) {
|
|
631
631
|
this.httpService = e, this.sessionManager = t;
|
|
632
632
|
}
|
|
@@ -702,7 +702,7 @@ class _e {
|
|
|
702
702
|
};
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
class
|
|
705
|
+
class wt {
|
|
706
706
|
constructor(e, t) {
|
|
707
707
|
this.httpService = e, this.sessionManager = t;
|
|
708
708
|
}
|
|
@@ -742,7 +742,7 @@ class St {
|
|
|
742
742
|
});
|
|
743
743
|
}
|
|
744
744
|
}
|
|
745
|
-
class
|
|
745
|
+
class be {
|
|
746
746
|
constructor(e, t, r) {
|
|
747
747
|
this.httpService = e, this.appId = t, this.sessionManager = r;
|
|
748
748
|
}
|
|
@@ -820,7 +820,7 @@ class ve {
|
|
|
820
820
|
)).data;
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
|
-
function
|
|
823
|
+
function bt(n, e) {
|
|
824
824
|
if (n === "localhost" || n.startsWith("127.") || n.startsWith("192.168."))
|
|
825
825
|
return null;
|
|
826
826
|
if (e) {
|
|
@@ -836,26 +836,26 @@ function vt(n, e) {
|
|
|
836
836
|
const r = n.split(".");
|
|
837
837
|
return r.length >= 3 && r[0] !== "www" ? r[0] : null;
|
|
838
838
|
}
|
|
839
|
-
function
|
|
839
|
+
function vt(n, e = "tenant", t) {
|
|
840
840
|
const i = new URLSearchParams(n).get(e);
|
|
841
841
|
return i ? (t && t.setItem("tenant", i), i) : t ? t.getItem("tenant") : null;
|
|
842
842
|
}
|
|
843
|
-
function
|
|
843
|
+
function St(n, e, t) {
|
|
844
844
|
const { tenantMode: r, baseDomain: i, selectorParam: o, fixedTenantSlug: a } = n;
|
|
845
|
-
return r === "fixed" ? a || null : r === "subdomain" ?
|
|
845
|
+
return r === "fixed" ? a || null : r === "subdomain" ? bt(e.hostname, i) : r === "selector" ? vt(e.search, o, t) : null;
|
|
846
846
|
}
|
|
847
|
-
function
|
|
847
|
+
function Tt(n, e, t) {
|
|
848
848
|
if (t)
|
|
849
849
|
return `${n}.${t}`;
|
|
850
850
|
const r = e.split(".");
|
|
851
851
|
return r.length === 2 ? `${n}.${e}` : r.length >= 3 ? (r[0] = n, r.join(".")) : null;
|
|
852
852
|
}
|
|
853
|
-
const
|
|
854
|
-
function
|
|
853
|
+
const pe = "_auth";
|
|
854
|
+
function _e(n) {
|
|
855
855
|
const e = JSON.stringify(n);
|
|
856
856
|
return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function kt(n) {
|
|
859
859
|
try {
|
|
860
860
|
let e = n.replace(/-/g, "+").replace(/_/g, "/");
|
|
861
861
|
for (; e.length % 4; )
|
|
@@ -866,34 +866,20 @@ function At(n) {
|
|
|
866
866
|
return null;
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function xt() {
|
|
870
870
|
if (typeof window > "u")
|
|
871
|
-
return
|
|
872
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
873
|
-
|
|
874
|
-
hasAuthParam: !!e,
|
|
875
|
-
searchParams: window.location.search,
|
|
876
|
-
encodedLength: e == null ? void 0 : e.length
|
|
877
|
-
}), !e) return null;
|
|
878
|
-
const t = At(e);
|
|
879
|
-
return console.log("[CrossDomainAuth] Token decode result:", {
|
|
880
|
-
success: !!t,
|
|
881
|
-
hasAccessToken: !!(t != null && t.accessToken),
|
|
882
|
-
hasRefreshToken: !!(t != null && t.refreshToken),
|
|
883
|
-
expiresIn: t == null ? void 0 : t.expiresIn
|
|
884
|
-
}), t;
|
|
871
|
+
return null;
|
|
872
|
+
const e = new URLSearchParams(window.location.search).get(pe);
|
|
873
|
+
return e ? kt(e) : null;
|
|
885
874
|
}
|
|
886
|
-
function
|
|
875
|
+
function At() {
|
|
887
876
|
if (typeof window > "u") return;
|
|
888
877
|
const n = new URL(window.location.href);
|
|
889
|
-
n.searchParams.delete(
|
|
890
|
-
oldUrl: window.location.href,
|
|
891
|
-
newUrl: n.toString()
|
|
892
|
-
}), window.history.replaceState({}, "", n.toString());
|
|
878
|
+
n.searchParams.delete(pe), window.history.replaceState({}, "", n.toString());
|
|
893
879
|
}
|
|
894
|
-
const
|
|
895
|
-
function
|
|
896
|
-
const { baseUrl: t, appInfo: r, appId: i } =
|
|
880
|
+
const Ne = fe(null);
|
|
881
|
+
function wr({ config: n, children: e }) {
|
|
882
|
+
const { baseUrl: t, appInfo: r, appId: i } = Se(), o = se(() => typeof window > "u" ? null : St(
|
|
897
883
|
{
|
|
898
884
|
tenantMode: n.tenantMode || "selector",
|
|
899
885
|
baseDomain: n.baseDomain,
|
|
@@ -905,119 +891,119 @@ function br({ config: n, children: e }) {
|
|
|
905
891
|
search: window.location.search
|
|
906
892
|
},
|
|
907
893
|
window.localStorage
|
|
908
|
-
), [n.tenantMode, n.baseDomain, n.selectorParam, n.fixedTenantSlug]), [a,
|
|
894
|
+
), [n.tenantMode, n.baseDomain, n.selectorParam, n.fixedTenantSlug]), [a, p] = k(() => o()), w = K(
|
|
909
895
|
() => {
|
|
910
|
-
var
|
|
896
|
+
var c, H, I;
|
|
911
897
|
return {
|
|
912
|
-
enabled: ((
|
|
913
|
-
ttl: ((
|
|
898
|
+
enabled: ((c = n.cache) == null ? void 0 : c.enabled) ?? !0,
|
|
899
|
+
ttl: ((H = n.cache) == null ? void 0 : H.ttl) ?? 5 * 60 * 1e3,
|
|
914
900
|
// 5 minutes default
|
|
915
|
-
storageKey: ((
|
|
901
|
+
storageKey: ((I = n.cache) == null ? void 0 : I.storageKey) ?? `tenant_cache_${a || "default"}`
|
|
916
902
|
};
|
|
917
903
|
},
|
|
918
904
|
[n.cache, a]
|
|
919
|
-
), [
|
|
905
|
+
), [y, f] = k(() => {
|
|
920
906
|
if (n.initialTenant) return n.initialTenant;
|
|
921
|
-
if (!
|
|
907
|
+
if (!w.enabled || !a) return null;
|
|
922
908
|
try {
|
|
923
|
-
const
|
|
924
|
-
if (!
|
|
925
|
-
const
|
|
926
|
-
return Date.now() -
|
|
909
|
+
const c = localStorage.getItem(w.storageKey);
|
|
910
|
+
if (!c) return null;
|
|
911
|
+
const H = JSON.parse(c);
|
|
912
|
+
return Date.now() - H.timestamp < w.ttl && H.tenantSlug === a ? H.data : (localStorage.removeItem(w.storageKey), null);
|
|
927
913
|
} catch {
|
|
928
914
|
return null;
|
|
929
915
|
}
|
|
930
|
-
}), [
|
|
931
|
-
|
|
916
|
+
}), [x, h] = k(!y && !n.initialTenant), [R, N] = k(null), [D, E] = k(null), [P, u] = k(!1), [S, C] = k(null);
|
|
917
|
+
re(() => {
|
|
932
918
|
if (n.tenantMode === "fixed") return;
|
|
933
|
-
const
|
|
934
|
-
|
|
919
|
+
const c = o();
|
|
920
|
+
p(c);
|
|
935
921
|
}, [o, n.tenantMode]);
|
|
936
|
-
const M = (r == null ? void 0 : r.settingsSchema) || null,
|
|
937
|
-
async (
|
|
938
|
-
if (!(!
|
|
922
|
+
const M = (r == null ? void 0 : r.settingsSchema) || null, T = se(
|
|
923
|
+
async (c, H = !1) => {
|
|
924
|
+
if (!(!H && w.enabled && y && y.domain === c))
|
|
939
925
|
try {
|
|
940
|
-
|
|
941
|
-
const
|
|
942
|
-
if (
|
|
926
|
+
h(!0), N(null);
|
|
927
|
+
const I = new le(t), m = await new be(I, i).getPublicTenantInfo(c);
|
|
928
|
+
if (f(m), w.enabled)
|
|
943
929
|
try {
|
|
944
930
|
const v = {
|
|
945
|
-
data:
|
|
931
|
+
data: m,
|
|
946
932
|
timestamp: Date.now(),
|
|
947
|
-
tenantSlug:
|
|
933
|
+
tenantSlug: c
|
|
948
934
|
};
|
|
949
|
-
localStorage.setItem(
|
|
935
|
+
localStorage.setItem(w.storageKey, JSON.stringify(v));
|
|
950
936
|
} catch (v) {
|
|
951
|
-
console.warn("Failed to cache tenant info:", v);
|
|
937
|
+
process.env.NODE_ENV === "development" && console.warn("[TenantProvider] Failed to cache tenant info:", v);
|
|
952
938
|
}
|
|
953
|
-
} catch (
|
|
954
|
-
const
|
|
955
|
-
|
|
939
|
+
} catch (I) {
|
|
940
|
+
const g = I instanceof Error ? I : new Error("Failed to load tenant information");
|
|
941
|
+
N(g), f(null);
|
|
956
942
|
} finally {
|
|
957
|
-
|
|
943
|
+
h(!1);
|
|
958
944
|
}
|
|
959
945
|
},
|
|
960
|
-
[t, i,
|
|
961
|
-
),
|
|
962
|
-
if (!(!
|
|
946
|
+
[t, i, w, y]
|
|
947
|
+
), $ = se(async () => {
|
|
948
|
+
if (!(!w.enabled || !y || !a))
|
|
963
949
|
try {
|
|
964
|
-
const
|
|
965
|
-
if (!
|
|
966
|
-
const
|
|
967
|
-
if (Date.now() -
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
const
|
|
950
|
+
const c = localStorage.getItem(w.storageKey);
|
|
951
|
+
if (!c) return;
|
|
952
|
+
const H = JSON.parse(c);
|
|
953
|
+
if (Date.now() - H.timestamp > w.ttl * 0.5) {
|
|
954
|
+
const g = new le(t), v = await new be(g, i).getPublicTenantInfo(a);
|
|
955
|
+
f(v);
|
|
956
|
+
const Q = {
|
|
971
957
|
data: v,
|
|
972
958
|
timestamp: Date.now(),
|
|
973
959
|
tenantSlug: a
|
|
974
960
|
};
|
|
975
|
-
localStorage.setItem(
|
|
961
|
+
localStorage.setItem(w.storageKey, JSON.stringify(Q));
|
|
976
962
|
}
|
|
977
|
-
} catch (
|
|
978
|
-
console.warn("Background tenant refresh failed:",
|
|
963
|
+
} catch (c) {
|
|
964
|
+
process.env.NODE_ENV === "development" && console.warn("[TenantProvider] Background tenant refresh failed:", c);
|
|
979
965
|
}
|
|
980
|
-
}, [t, i,
|
|
981
|
-
if (
|
|
966
|
+
}, [t, i, w, y, a]), l = se(async () => {
|
|
967
|
+
if (y != null && y.id)
|
|
982
968
|
try {
|
|
983
|
-
u(!0),
|
|
984
|
-
const
|
|
985
|
-
E(
|
|
986
|
-
} catch (
|
|
987
|
-
const
|
|
988
|
-
|
|
969
|
+
u(!0), C(null);
|
|
970
|
+
const c = new le(t), I = await new be(c, y.appId).getTenantSettings(y.id);
|
|
971
|
+
E(I);
|
|
972
|
+
} catch (c) {
|
|
973
|
+
const H = c instanceof Error ? c : new Error("Failed to load tenant settings");
|
|
974
|
+
C(H), E(null);
|
|
989
975
|
} finally {
|
|
990
976
|
u(!1);
|
|
991
977
|
}
|
|
992
|
-
}, [t,
|
|
993
|
-
|
|
994
|
-
}, [
|
|
995
|
-
(
|
|
978
|
+
}, [t, y]), U = se(() => {
|
|
979
|
+
l();
|
|
980
|
+
}, [l]), b = se(
|
|
981
|
+
(c) => {
|
|
996
982
|
if (!M)
|
|
997
983
|
return { isValid: !0, errors: [] };
|
|
998
|
-
const
|
|
984
|
+
const H = [];
|
|
999
985
|
try {
|
|
1000
|
-
return M.properties && Object.entries(M.properties).forEach(([
|
|
986
|
+
return M.properties && Object.entries(M.properties).forEach(([I, g]) => {
|
|
1001
987
|
var v;
|
|
1002
|
-
const
|
|
1003
|
-
if ((v = M.required) != null && v.includes(
|
|
1004
|
-
|
|
988
|
+
const m = c[I];
|
|
989
|
+
if ((v = M.required) != null && v.includes(I) && m == null) {
|
|
990
|
+
H.push(`Field '${I}' is required`);
|
|
1005
991
|
return;
|
|
1006
992
|
}
|
|
1007
|
-
if (
|
|
1008
|
-
if (
|
|
1009
|
-
const
|
|
1010
|
-
|
|
993
|
+
if (m != null) {
|
|
994
|
+
if (g.type) {
|
|
995
|
+
const Q = g.type, J = typeof m;
|
|
996
|
+
Q === "string" && J !== "string" ? H.push(`Field '${I}' must be a string`) : (Q === "number" || Q === "integer") && J !== "number" ? H.push(`Field '${I}' must be a number`) : Q === "boolean" && J !== "boolean" ? H.push(`Field '${I}' must be a boolean`) : Q === "array" && !Array.isArray(m) && H.push(`Field '${I}' must be an array`);
|
|
1011
997
|
}
|
|
1012
|
-
|
|
1013
|
-
`Field '${
|
|
1014
|
-
),
|
|
1015
|
-
`Field '${
|
|
1016
|
-
),
|
|
998
|
+
g.minLength !== void 0 && typeof m == "string" && m.length < g.minLength && H.push(
|
|
999
|
+
`Field '${I}' must be at least ${g.minLength} characters long`
|
|
1000
|
+
), g.maxLength !== void 0 && typeof m == "string" && m.length > g.maxLength && H.push(
|
|
1001
|
+
`Field '${I}' must be no more than ${g.maxLength} characters long`
|
|
1002
|
+
), g.minimum !== void 0 && typeof m == "number" && m < g.minimum && H.push(`Field '${I}' must be at least ${g.minimum}`), g.maximum !== void 0 && typeof m == "number" && m > g.maximum && H.push(`Field '${I}' must be no more than ${g.maximum}`), g.pattern && typeof m == "string" && (new RegExp(g.pattern).test(m) || H.push(`Field '${I}' does not match the required pattern`)), g.enum && !g.enum.includes(m) && H.push(`Field '${I}' must be one of: ${g.enum.join(", ")}`);
|
|
1017
1003
|
}
|
|
1018
1004
|
}), {
|
|
1019
|
-
isValid:
|
|
1020
|
-
errors:
|
|
1005
|
+
isValid: H.length === 0,
|
|
1006
|
+
errors: H
|
|
1021
1007
|
};
|
|
1022
1008
|
} catch {
|
|
1023
1009
|
return {
|
|
@@ -1028,96 +1014,96 @@ function br({ config: n, children: e }) {
|
|
|
1028
1014
|
},
|
|
1029
1015
|
[M]
|
|
1030
1016
|
);
|
|
1031
|
-
|
|
1032
|
-
!n.initialTenant && a ?
|
|
1033
|
-
}, [n.initialTenant, a,
|
|
1034
|
-
|
|
1035
|
-
}, [
|
|
1036
|
-
const
|
|
1037
|
-
(
|
|
1038
|
-
const { mode:
|
|
1017
|
+
re(() => {
|
|
1018
|
+
!n.initialTenant && a ? y ? $() : T(a) : !n.initialTenant && !a && (f(null), N(null), h(!1));
|
|
1019
|
+
}, [n.initialTenant, a, y, T, $]), re(() => {
|
|
1020
|
+
y != null && y.id ? l() : (E(null), C(null), u(!1));
|
|
1021
|
+
}, [y == null ? void 0 : y.id, l]);
|
|
1022
|
+
const L = se(
|
|
1023
|
+
(c, H) => {
|
|
1024
|
+
const { mode: I = "reload", tokens: g, redirectPath: m } = H || {}, v = n.tenantMode || "selector";
|
|
1039
1025
|
if (v === "fixed") {
|
|
1040
|
-
console.warn(
|
|
1026
|
+
process.env.NODE_ENV === "development" && console.warn(
|
|
1041
1027
|
"[TenantProvider] switchTenant is a no-op in fixed mode. Tenant is always:",
|
|
1042
1028
|
n.fixedTenantSlug
|
|
1043
|
-
),
|
|
1029
|
+
), m && (window.location.href = m);
|
|
1044
1030
|
return;
|
|
1045
1031
|
}
|
|
1046
|
-
if (localStorage.setItem("tenant",
|
|
1047
|
-
const
|
|
1048
|
-
|
|
1049
|
-
|
|
1032
|
+
if (localStorage.setItem("tenant", c), v === "subdomain") {
|
|
1033
|
+
const Q = window.location.hostname, J = Tt(
|
|
1034
|
+
c,
|
|
1035
|
+
Q,
|
|
1050
1036
|
n.baseDomain
|
|
1051
1037
|
);
|
|
1052
|
-
if (!
|
|
1053
|
-
console.warn(
|
|
1038
|
+
if (!J) {
|
|
1039
|
+
process.env.NODE_ENV === "development" && console.warn(
|
|
1054
1040
|
"[TenantProvider] Cannot switch subdomain, invalid hostname:",
|
|
1055
|
-
|
|
1041
|
+
Q
|
|
1056
1042
|
);
|
|
1057
1043
|
return;
|
|
1058
1044
|
}
|
|
1059
|
-
const O =
|
|
1060
|
-
new URLSearchParams(window.location.search).forEach((
|
|
1061
|
-
|
|
1062
|
-
}),
|
|
1045
|
+
const O = m || window.location.pathname, q = new URL(`${window.location.protocol}//${J}${O}`);
|
|
1046
|
+
new URLSearchParams(window.location.search).forEach((A, V) => {
|
|
1047
|
+
V !== pe && q.searchParams.set(V, A);
|
|
1048
|
+
}), g && q.searchParams.set(pe, _e(g)), window.location.href = q.toString();
|
|
1063
1049
|
} else if (v === "selector") {
|
|
1064
|
-
const
|
|
1065
|
-
if (
|
|
1066
|
-
const O = `${
|
|
1050
|
+
const Q = m || window.location.pathname, J = new URLSearchParams(window.location.search);
|
|
1051
|
+
if (J.set(n.selectorParam || "tenant", c), J.delete(pe), g && J.set(pe, _e(g)), I === "reload") {
|
|
1052
|
+
const O = `${Q}?${J.toString()}${window.location.hash}`;
|
|
1067
1053
|
window.location.href = O;
|
|
1068
1054
|
} else {
|
|
1069
|
-
const O = `${
|
|
1070
|
-
window.history.pushState({}, "", O),
|
|
1055
|
+
const O = `${Q}?${J.toString()}${window.location.hash}`;
|
|
1056
|
+
window.history.pushState({}, "", O), p(c), T(c);
|
|
1071
1057
|
}
|
|
1072
1058
|
}
|
|
1073
1059
|
},
|
|
1074
|
-
[n.tenantMode, n.selectorParam, n.baseDomain,
|
|
1075
|
-
),
|
|
1060
|
+
[n.tenantMode, n.selectorParam, n.baseDomain, T]
|
|
1061
|
+
), F = K(() => ({
|
|
1076
1062
|
// Tenant info
|
|
1077
|
-
tenant:
|
|
1063
|
+
tenant: y,
|
|
1078
1064
|
tenantSlug: a,
|
|
1079
|
-
isTenantLoading:
|
|
1080
|
-
tenantError:
|
|
1065
|
+
isTenantLoading: x,
|
|
1066
|
+
tenantError: R,
|
|
1081
1067
|
retryTenant: () => {
|
|
1082
|
-
a &&
|
|
1068
|
+
a && T(a);
|
|
1083
1069
|
},
|
|
1084
1070
|
// Settings
|
|
1085
|
-
settings:
|
|
1071
|
+
settings: D,
|
|
1086
1072
|
settingsSchema: M,
|
|
1087
|
-
isSettingsLoading:
|
|
1088
|
-
settingsError:
|
|
1073
|
+
isSettingsLoading: P,
|
|
1074
|
+
settingsError: S,
|
|
1089
1075
|
// Actions
|
|
1090
1076
|
refreshSettings: U,
|
|
1091
|
-
switchTenant:
|
|
1077
|
+
switchTenant: L,
|
|
1092
1078
|
// Validation
|
|
1093
|
-
validateSettings:
|
|
1079
|
+
validateSettings: b
|
|
1094
1080
|
}), [
|
|
1095
|
-
|
|
1081
|
+
y,
|
|
1096
1082
|
a,
|
|
1097
|
-
I,
|
|
1098
1083
|
x,
|
|
1099
|
-
|
|
1084
|
+
R,
|
|
1085
|
+
D,
|
|
1100
1086
|
M,
|
|
1101
|
-
|
|
1102
|
-
|
|
1087
|
+
P,
|
|
1088
|
+
S,
|
|
1103
1089
|
U,
|
|
1104
|
-
|
|
1105
|
-
|
|
1090
|
+
L,
|
|
1091
|
+
b
|
|
1106
1092
|
]);
|
|
1107
|
-
return /* @__PURE__ */ s(
|
|
1093
|
+
return /* @__PURE__ */ s(Ne.Provider, { value: F, children: e });
|
|
1108
1094
|
}
|
|
1109
|
-
function
|
|
1110
|
-
const n =
|
|
1095
|
+
function ge() {
|
|
1096
|
+
const n = ae(Ne);
|
|
1111
1097
|
if (!n)
|
|
1112
1098
|
throw new Error("useTenant must be used within a TenantProvider");
|
|
1113
1099
|
return n;
|
|
1114
1100
|
}
|
|
1115
|
-
function
|
|
1116
|
-
return
|
|
1101
|
+
function xe() {
|
|
1102
|
+
return ae(Ne);
|
|
1117
1103
|
}
|
|
1118
|
-
const
|
|
1104
|
+
const br = ge;
|
|
1119
1105
|
function vr() {
|
|
1120
|
-
const { settings: n, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: i } =
|
|
1106
|
+
const { settings: n, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: i } = ge();
|
|
1121
1107
|
return {
|
|
1122
1108
|
settings: n,
|
|
1123
1109
|
settingsSchema: e,
|
|
@@ -1126,8 +1112,8 @@ function vr() {
|
|
|
1126
1112
|
validateSettings: i
|
|
1127
1113
|
};
|
|
1128
1114
|
}
|
|
1129
|
-
function
|
|
1130
|
-
const { tenant: n, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: i } =
|
|
1115
|
+
function me() {
|
|
1116
|
+
const { tenant: n, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: i } = ge();
|
|
1131
1117
|
return {
|
|
1132
1118
|
tenant: n,
|
|
1133
1119
|
tenantSlug: e,
|
|
@@ -1136,318 +1122,314 @@ function we() {
|
|
|
1136
1122
|
retry: i
|
|
1137
1123
|
};
|
|
1138
1124
|
}
|
|
1139
|
-
const
|
|
1140
|
-
function
|
|
1141
|
-
const { appId: t, baseUrl: r } =
|
|
1125
|
+
const De = fe(null);
|
|
1126
|
+
function Sr({ config: n = {}, children: e }) {
|
|
1127
|
+
const { appId: t, baseUrl: r } = Se(), { tenant: i, tenantSlug: o, switchTenant: a } = ge(), [p, w] = k(n.initialRoles || []), [y, f] = k(!n.initialRoles), [x, h] = k(null), [R, N] = k(!1), [D, E] = k(null), [P, u] = k(() => {
|
|
1142
1128
|
try {
|
|
1143
|
-
const
|
|
1144
|
-
return
|
|
1129
|
+
const A = localStorage.getItem("userTenants");
|
|
1130
|
+
return A ? JSON.parse(A) : [];
|
|
1145
1131
|
} catch {
|
|
1146
1132
|
return [];
|
|
1147
1133
|
}
|
|
1148
|
-
}), [
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
const [P, U] = T(() => {
|
|
1153
|
-
const V = D.current.urlTokens !== null;
|
|
1154
|
-
return console.log("[AuthProvider] SYNC: isLoadingAfterUrlTokens initial:", V), V;
|
|
1155
|
-
}), l = Z(() => {
|
|
1156
|
-
const V = Se.getInstance({
|
|
1134
|
+
}), [S, C] = k(!1), M = Me({ done: !1, urlTokens: null });
|
|
1135
|
+
M.current.done || (M.current.done = !0, M.current.urlTokens = xt());
|
|
1136
|
+
const [T, $] = k(() => M.current.urlTokens !== null), l = K(() => {
|
|
1137
|
+
const A = we.getInstance({
|
|
1157
1138
|
tenantSlug: o,
|
|
1158
1139
|
baseUrl: r,
|
|
1159
1140
|
refreshQueueTimeout: n.refreshQueueTimeout,
|
|
1160
1141
|
proactiveRefreshMargin: n.proactiveRefreshMargin,
|
|
1161
|
-
onSessionExpired: (
|
|
1162
|
-
|
|
1142
|
+
onSessionExpired: (V) => {
|
|
1143
|
+
h(null), E(null), u([]), C(!1);
|
|
1163
1144
|
try {
|
|
1164
1145
|
localStorage.removeItem("userTenants");
|
|
1165
1146
|
} catch {
|
|
1166
1147
|
}
|
|
1167
|
-
n.onSessionExpired ? n.onSessionExpired(
|
|
1148
|
+
n.onSessionExpired ? n.onSessionExpired(V) : n.onRefreshFailed && n.onRefreshFailed();
|
|
1168
1149
|
}
|
|
1169
1150
|
});
|
|
1170
|
-
return
|
|
1171
|
-
accessToken:
|
|
1172
|
-
refreshToken:
|
|
1173
|
-
expiresIn:
|
|
1174
|
-
}),
|
|
1175
|
-
}, [o, r, n.refreshQueueTimeout, n.proactiveRefreshMargin]), [
|
|
1176
|
-
if (
|
|
1177
|
-
const
|
|
1178
|
-
return
|
|
1179
|
-
}),
|
|
1180
|
-
const
|
|
1181
|
-
return
|
|
1182
|
-
}, [r, l]),
|
|
1183
|
-
|
|
1151
|
+
return M.current.urlTokens && A.setTokens({
|
|
1152
|
+
accessToken: M.current.urlTokens.accessToken,
|
|
1153
|
+
refreshToken: M.current.urlTokens.refreshToken,
|
|
1154
|
+
expiresIn: M.current.urlTokens.expiresIn
|
|
1155
|
+
}), A;
|
|
1156
|
+
}, [o, r, n.refreshQueueTimeout, n.proactiveRefreshMargin]), [U, b] = k(() => {
|
|
1157
|
+
if (M.current.urlTokens) return !1;
|
|
1158
|
+
const A = l.getTokens();
|
|
1159
|
+
return A ? l.hasValidSession() || !!A.refreshToken : !1;
|
|
1160
|
+
}), L = M.current.done && !T && !U, F = K(() => {
|
|
1161
|
+
const A = new le(r);
|
|
1162
|
+
return A.setSessionManager(l), A;
|
|
1163
|
+
}, [r, l]), c = K(() => new yt(new le(r)), [r]), H = K(() => new wt(F, l), [F, l]), I = K(() => new ze(new le(r)), [r]), g = K(() => x || l.getUser(), [x, l]), m = K(() => g != null && g.roleId && p.find((A) => A.id === g.roleId) || null, [g, p]), v = K(() => (m == null ? void 0 : m.permissions) || [], [m]), Q = K(() => l.hasValidSession() && x !== null, [l, x]), J = Me(async () => {
|
|
1164
|
+
}), O = K(() => {
|
|
1165
|
+
const A = async (B = !1) => {
|
|
1184
1166
|
try {
|
|
1185
|
-
if (!l.hasValidSession())
|
|
1167
|
+
if (!l.hasValidSession() || !B && x)
|
|
1186
1168
|
return;
|
|
1187
|
-
const z =
|
|
1188
|
-
if (
|
|
1189
|
-
|
|
1190
|
-
const j = l.getUserId();
|
|
1191
|
-
if (!j) {
|
|
1192
|
-
console.warn("[AuthProvider] No userId available in token or storage");
|
|
1169
|
+
const z = l.getUserId();
|
|
1170
|
+
if (!z) {
|
|
1171
|
+
process.env.NODE_ENV === "development" && console.warn("[AuthProvider] No userId available in token or storage");
|
|
1193
1172
|
return;
|
|
1194
1173
|
}
|
|
1195
|
-
|
|
1196
|
-
const
|
|
1197
|
-
|
|
1174
|
+
N(!0), E(null);
|
|
1175
|
+
const Z = await H.getUserById(z);
|
|
1176
|
+
h(Z), l.setUser(Z);
|
|
1198
1177
|
} catch (z) {
|
|
1199
|
-
const
|
|
1200
|
-
E(
|
|
1178
|
+
const Z = z instanceof Error ? z : new Error("Failed to load user data");
|
|
1179
|
+
E(Z), process.env.NODE_ENV === "development" && console.error("[AuthProvider] Failed to load user data:", Z);
|
|
1201
1180
|
} finally {
|
|
1202
|
-
|
|
1181
|
+
N(!1);
|
|
1203
1182
|
}
|
|
1204
|
-
},
|
|
1205
|
-
await
|
|
1206
|
-
},
|
|
1207
|
-
var
|
|
1208
|
-
const { username: z, password:
|
|
1209
|
-
let
|
|
1210
|
-
|
|
1211
|
-
const
|
|
1183
|
+
}, V = async () => {
|
|
1184
|
+
await A();
|
|
1185
|
+
}, de = async (B) => {
|
|
1186
|
+
var Be;
|
|
1187
|
+
const { username: z, password: Z, tenantSlug: W, redirectPath: Y } = B;
|
|
1188
|
+
let X = i == null ? void 0 : i.id, ee = o, te = l;
|
|
1189
|
+
W && (X = (await new be(F, t).getPublicTenantInfo(W)).id, ee = W);
|
|
1190
|
+
const G = await c.login({
|
|
1212
1191
|
username: z,
|
|
1213
|
-
password:
|
|
1192
|
+
password: Z,
|
|
1214
1193
|
appId: t,
|
|
1215
|
-
tenantId:
|
|
1216
|
-
}),
|
|
1217
|
-
if (
|
|
1218
|
-
tenantSlug:
|
|
1194
|
+
tenantId: X
|
|
1195
|
+
}), ye = W && W !== o;
|
|
1196
|
+
if (ye && (te = new we({
|
|
1197
|
+
tenantSlug: ee,
|
|
1219
1198
|
baseUrl: r
|
|
1220
|
-
})),
|
|
1221
|
-
accessToken:
|
|
1222
|
-
refreshToken:
|
|
1223
|
-
expiresIn:
|
|
1224
|
-
}),
|
|
1225
|
-
|
|
1199
|
+
})), te.setTokens({
|
|
1200
|
+
accessToken: G.accessToken,
|
|
1201
|
+
refreshToken: G.refreshToken,
|
|
1202
|
+
expiresIn: G.expiresIn
|
|
1203
|
+
}), G.user) {
|
|
1204
|
+
te.setUser(G.user), h(G.user);
|
|
1226
1205
|
try {
|
|
1227
|
-
await
|
|
1228
|
-
} catch (
|
|
1229
|
-
console.warn("Failed to load complete user data after login:",
|
|
1206
|
+
await A();
|
|
1207
|
+
} catch (Te) {
|
|
1208
|
+
process.env.NODE_ENV === "development" && console.warn("[AuthProvider] Failed to load complete user data after login:", Te);
|
|
1230
1209
|
}
|
|
1231
1210
|
}
|
|
1232
|
-
if (
|
|
1233
|
-
|
|
1211
|
+
if (G.tenants && G.tenants.length > 0) {
|
|
1212
|
+
u(G.tenants);
|
|
1234
1213
|
try {
|
|
1235
|
-
localStorage.setItem("userTenants", JSON.stringify(
|
|
1214
|
+
localStorage.setItem("userTenants", JSON.stringify(G.tenants));
|
|
1236
1215
|
} catch {
|
|
1237
1216
|
}
|
|
1238
1217
|
}
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1241
|
-
const
|
|
1242
|
-
accessToken:
|
|
1243
|
-
refreshToken:
|
|
1244
|
-
expiresIn:
|
|
1218
|
+
const Pe = ((Be = G.user) == null ? void 0 : Be.tenantId) !== null;
|
|
1219
|
+
C(Pe);
|
|
1220
|
+
const Re = {
|
|
1221
|
+
accessToken: G.accessToken,
|
|
1222
|
+
refreshToken: G.refreshToken,
|
|
1223
|
+
expiresIn: G.expiresIn
|
|
1245
1224
|
};
|
|
1246
|
-
if (
|
|
1247
|
-
return a(
|
|
1248
|
-
if (
|
|
1249
|
-
return a(
|
|
1250
|
-
if (!
|
|
1251
|
-
const
|
|
1252
|
-
if (
|
|
1253
|
-
const Oe =
|
|
1254
|
-
return a(Oe.subdomain, { tokens:
|
|
1255
|
-
} else
|
|
1225
|
+
if (ye && ee)
|
|
1226
|
+
return a(ee, { tokens: Re, redirectPath: Y }), G;
|
|
1227
|
+
if (Y && Y !== window.location.pathname)
|
|
1228
|
+
return a(ee || o || "", { tokens: Re, redirectPath: Y }), G;
|
|
1229
|
+
if (!Pe && G.tenants && G.tenants.length > 0) {
|
|
1230
|
+
const Te = B.autoSwitch !== !1 && n.autoSwitchSingleTenant !== !1;
|
|
1231
|
+
if (G.tenants.length === 1 && Te) {
|
|
1232
|
+
const Oe = G.tenants[0];
|
|
1233
|
+
return a(Oe.subdomain, { tokens: Re, redirectPath: Y }), G;
|
|
1234
|
+
} else G.tenants.length > 1 && n.onTenantSelectionRequired && n.onTenantSelectionRequired(G.tenants);
|
|
1256
1235
|
}
|
|
1257
|
-
return
|
|
1258
|
-
},
|
|
1259
|
-
const { email: z, phoneNumber:
|
|
1260
|
-
if (!z && !
|
|
1236
|
+
return G;
|
|
1237
|
+
}, he = async (B) => {
|
|
1238
|
+
const { email: z, phoneNumber: Z, name: W, password: Y, lastName: X, tenantId: ee } = B;
|
|
1239
|
+
if (!z && !Z)
|
|
1261
1240
|
throw new Error("Either email or phoneNumber is required");
|
|
1262
|
-
if (!
|
|
1241
|
+
if (!W || !Y)
|
|
1263
1242
|
throw new Error("Name and password are required");
|
|
1264
|
-
const
|
|
1265
|
-
return await
|
|
1243
|
+
const te = ee ?? (i == null ? void 0 : i.id);
|
|
1244
|
+
return await c.signup({
|
|
1266
1245
|
email: z,
|
|
1267
|
-
phoneNumber:
|
|
1268
|
-
name:
|
|
1269
|
-
password:
|
|
1270
|
-
tenantId:
|
|
1271
|
-
lastName:
|
|
1246
|
+
phoneNumber: Z,
|
|
1247
|
+
name: W,
|
|
1248
|
+
password: Y,
|
|
1249
|
+
tenantId: te,
|
|
1250
|
+
lastName: X,
|
|
1272
1251
|
appId: t
|
|
1273
1252
|
});
|
|
1274
|
-
},
|
|
1275
|
-
const { email: z, phoneNumber:
|
|
1276
|
-
if (!z && !
|
|
1253
|
+
}, et = async (B) => {
|
|
1254
|
+
const { email: z, phoneNumber: Z, name: W, password: Y, tenantName: X, lastName: ee } = B;
|
|
1255
|
+
if (!z && !Z)
|
|
1277
1256
|
throw new Error("Either email or phoneNumber is required");
|
|
1278
|
-
if (!
|
|
1257
|
+
if (!W || !Y || !X)
|
|
1279
1258
|
throw new Error("Name, password, and tenantName are required");
|
|
1280
|
-
return await
|
|
1259
|
+
return await c.signupTenantAdmin({
|
|
1281
1260
|
email: z,
|
|
1282
|
-
phoneNumber:
|
|
1283
|
-
name:
|
|
1284
|
-
password:
|
|
1285
|
-
tenantName:
|
|
1261
|
+
phoneNumber: Z,
|
|
1262
|
+
name: W,
|
|
1263
|
+
password: Y,
|
|
1264
|
+
tenantName: X,
|
|
1286
1265
|
appId: t,
|
|
1287
|
-
lastName:
|
|
1266
|
+
lastName: ee
|
|
1288
1267
|
});
|
|
1289
|
-
},
|
|
1290
|
-
const { currentPassword: z, newPassword:
|
|
1291
|
-
await
|
|
1292
|
-
},
|
|
1293
|
-
const { email: z, tenantId:
|
|
1294
|
-
if (!
|
|
1268
|
+
}, tt = async (B) => {
|
|
1269
|
+
const { currentPassword: z, newPassword: Z } = B, W = await l.getAuthHeaders();
|
|
1270
|
+
await c.changePassword({ currentPassword: z, newPassword: Z }, W);
|
|
1271
|
+
}, rt = async (B) => {
|
|
1272
|
+
const { email: z, tenantId: Z } = B, W = Z ?? (i == null ? void 0 : i.id);
|
|
1273
|
+
if (!W)
|
|
1295
1274
|
throw new Error("tenantId is required for password reset");
|
|
1296
|
-
await
|
|
1297
|
-
},
|
|
1298
|
-
const { token: z, newPassword:
|
|
1299
|
-
await
|
|
1300
|
-
},
|
|
1301
|
-
const { email: z, frontendUrl:
|
|
1302
|
-
if (!
|
|
1275
|
+
await c.requestPasswordReset({ email: z, tenantId: W });
|
|
1276
|
+
}, nt = async (B) => {
|
|
1277
|
+
const { token: z, newPassword: Z } = B;
|
|
1278
|
+
await c.confirmPasswordReset({ token: z, newPassword: Z });
|
|
1279
|
+
}, st = async (B) => {
|
|
1280
|
+
const { email: z, frontendUrl: Z, name: W, lastName: Y, tenantId: X } = B, ee = X ?? (i == null ? void 0 : i.id);
|
|
1281
|
+
if (!ee)
|
|
1303
1282
|
throw new Error("tenantId is required for magic link authentication");
|
|
1304
|
-
return await
|
|
1283
|
+
return await c.sendMagicLink({
|
|
1305
1284
|
email: z,
|
|
1306
|
-
tenantId:
|
|
1307
|
-
frontendUrl:
|
|
1308
|
-
name:
|
|
1309
|
-
lastName:
|
|
1285
|
+
tenantId: ee,
|
|
1286
|
+
frontendUrl: Z,
|
|
1287
|
+
name: W,
|
|
1288
|
+
lastName: Y,
|
|
1310
1289
|
appId: t
|
|
1311
1290
|
});
|
|
1312
|
-
},
|
|
1313
|
-
const { token: z, email:
|
|
1314
|
-
let
|
|
1315
|
-
|
|
1316
|
-
const
|
|
1291
|
+
}, it = async (B) => {
|
|
1292
|
+
const { token: z, email: Z, tenantSlug: W } = B;
|
|
1293
|
+
let Y = i == null ? void 0 : i.id, X = o, ee = l;
|
|
1294
|
+
W && (Y = (await new be(F, t).getPublicTenantInfo(W)).id, X = W);
|
|
1295
|
+
const te = await c.verifyMagicLink({
|
|
1317
1296
|
token: z,
|
|
1318
|
-
email:
|
|
1297
|
+
email: Z,
|
|
1319
1298
|
appId: t,
|
|
1320
|
-
tenantId:
|
|
1321
|
-
}),
|
|
1322
|
-
if (
|
|
1323
|
-
tenantSlug:
|
|
1299
|
+
tenantId: Y
|
|
1300
|
+
}), G = W && W !== o;
|
|
1301
|
+
if (G && (ee = new we({
|
|
1302
|
+
tenantSlug: X,
|
|
1324
1303
|
baseUrl: r
|
|
1325
|
-
})),
|
|
1326
|
-
accessToken:
|
|
1327
|
-
refreshToken:
|
|
1328
|
-
expiresIn:
|
|
1329
|
-
}),
|
|
1330
|
-
|
|
1304
|
+
})), ee.setTokens({
|
|
1305
|
+
accessToken: te.accessToken,
|
|
1306
|
+
refreshToken: te.refreshToken,
|
|
1307
|
+
expiresIn: te.expiresIn
|
|
1308
|
+
}), te.user) {
|
|
1309
|
+
ee.setUser(te.user), h(te.user);
|
|
1331
1310
|
try {
|
|
1332
|
-
await
|
|
1333
|
-
} catch (
|
|
1334
|
-
|
|
1311
|
+
await A();
|
|
1312
|
+
} catch (ye) {
|
|
1313
|
+
process.env.NODE_ENV === "development" && console.warn(
|
|
1314
|
+
"[AuthProvider] Failed to load complete user data after magic link:",
|
|
1315
|
+
ye
|
|
1316
|
+
);
|
|
1335
1317
|
}
|
|
1336
1318
|
}
|
|
1337
|
-
return
|
|
1319
|
+
return G && X && X !== o && a(X, {
|
|
1338
1320
|
tokens: {
|
|
1339
|
-
accessToken:
|
|
1340
|
-
refreshToken:
|
|
1341
|
-
expiresIn:
|
|
1321
|
+
accessToken: te.accessToken,
|
|
1322
|
+
refreshToken: te.refreshToken,
|
|
1323
|
+
expiresIn: te.expiresIn
|
|
1342
1324
|
}
|
|
1343
|
-
}),
|
|
1344
|
-
},
|
|
1345
|
-
const
|
|
1346
|
-
if (!(
|
|
1325
|
+
}), te;
|
|
1326
|
+
}, ot = async () => {
|
|
1327
|
+
const B = l.getTokens();
|
|
1328
|
+
if (!(B != null && B.refreshToken))
|
|
1347
1329
|
throw new Error("No refresh token available");
|
|
1348
|
-
const z = await
|
|
1349
|
-
refreshToken:
|
|
1330
|
+
const z = await c.refreshToken({
|
|
1331
|
+
refreshToken: B.refreshToken
|
|
1350
1332
|
});
|
|
1351
1333
|
l.setTokens({
|
|
1352
1334
|
accessToken: z.accessToken,
|
|
1353
|
-
refreshToken: z.refreshToken ||
|
|
1335
|
+
refreshToken: z.refreshToken || B.refreshToken,
|
|
1354
1336
|
expiresIn: z.expiresIn
|
|
1355
1337
|
});
|
|
1356
|
-
},
|
|
1357
|
-
l.clearSession(),
|
|
1338
|
+
}, at = () => {
|
|
1339
|
+
l.clearSession(), h(null), E(null), u([]), C(!1);
|
|
1358
1340
|
try {
|
|
1359
1341
|
localStorage.removeItem("userTenants");
|
|
1360
1342
|
} catch {
|
|
1361
1343
|
}
|
|
1362
|
-
},
|
|
1363
|
-
l.setTokens(
|
|
1364
|
-
},
|
|
1365
|
-
l.clearSession(),
|
|
1366
|
-
},
|
|
1344
|
+
}, lt = (B) => {
|
|
1345
|
+
l.setTokens(B);
|
|
1346
|
+
}, ct = () => l.hasValidSession(), dt = () => {
|
|
1347
|
+
l.clearSession(), h(null), E(null);
|
|
1348
|
+
}, ut = async () => {
|
|
1367
1349
|
if (t)
|
|
1368
1350
|
try {
|
|
1369
|
-
|
|
1370
|
-
const { roles:
|
|
1371
|
-
|
|
1372
|
-
} catch (
|
|
1373
|
-
console.error("Failed to fetch roles:",
|
|
1351
|
+
f(!0);
|
|
1352
|
+
const { roles: B } = await I.getRolesByApp(t);
|
|
1353
|
+
w(B);
|
|
1354
|
+
} catch (B) {
|
|
1355
|
+
process.env.NODE_ENV === "development" && console.error("[AuthProvider] Failed to fetch roles:", B);
|
|
1374
1356
|
} finally {
|
|
1375
|
-
|
|
1357
|
+
f(!1);
|
|
1376
1358
|
}
|
|
1377
|
-
},
|
|
1378
|
-
await
|
|
1379
|
-
},
|
|
1380
|
-
if (!
|
|
1359
|
+
}, ht = async () => {
|
|
1360
|
+
await ut();
|
|
1361
|
+
}, Ae = (B) => {
|
|
1362
|
+
if (!v || v.length === 0)
|
|
1381
1363
|
return !1;
|
|
1382
|
-
if (typeof
|
|
1383
|
-
return
|
|
1384
|
-
const z = `${
|
|
1385
|
-
return
|
|
1364
|
+
if (typeof B == "string")
|
|
1365
|
+
return v.includes(B);
|
|
1366
|
+
const z = `${B.resource}.${B.action}`;
|
|
1367
|
+
return v.includes(z);
|
|
1386
1368
|
};
|
|
1387
1369
|
return {
|
|
1388
1370
|
// RFC-003: Authentication state
|
|
1389
|
-
isAuthenticated:
|
|
1371
|
+
isAuthenticated: Q,
|
|
1390
1372
|
sessionManager: l,
|
|
1391
|
-
authenticatedHttpService:
|
|
1392
|
-
login:
|
|
1393
|
-
signup:
|
|
1394
|
-
signupTenantAdmin:
|
|
1395
|
-
sendMagicLink:
|
|
1396
|
-
verifyMagicLink:
|
|
1397
|
-
changePassword:
|
|
1398
|
-
requestPasswordReset:
|
|
1399
|
-
confirmPasswordReset:
|
|
1400
|
-
refreshToken:
|
|
1401
|
-
logout:
|
|
1402
|
-
setTokens:
|
|
1403
|
-
hasValidSession:
|
|
1404
|
-
clearSession:
|
|
1405
|
-
currentUser:
|
|
1406
|
-
isUserLoading:
|
|
1407
|
-
userError:
|
|
1408
|
-
loadUserData:
|
|
1409
|
-
refreshUser:
|
|
1410
|
-
isAuthInitializing: !
|
|
1411
|
-
isAuthReady:
|
|
1412
|
-
userRole:
|
|
1413
|
-
userPermissions:
|
|
1414
|
-
availableRoles:
|
|
1415
|
-
rolesLoading:
|
|
1416
|
-
hasPermission:
|
|
1417
|
-
hasAnyPermission: (
|
|
1418
|
-
hasAllPermissions: (
|
|
1419
|
-
getUserPermissionStrings: () =>
|
|
1420
|
-
refreshRoles:
|
|
1373
|
+
authenticatedHttpService: F,
|
|
1374
|
+
login: de,
|
|
1375
|
+
signup: he,
|
|
1376
|
+
signupTenantAdmin: et,
|
|
1377
|
+
sendMagicLink: st,
|
|
1378
|
+
verifyMagicLink: it,
|
|
1379
|
+
changePassword: tt,
|
|
1380
|
+
requestPasswordReset: rt,
|
|
1381
|
+
confirmPasswordReset: nt,
|
|
1382
|
+
refreshToken: ot,
|
|
1383
|
+
logout: at,
|
|
1384
|
+
setTokens: lt,
|
|
1385
|
+
hasValidSession: ct,
|
|
1386
|
+
clearSession: dt,
|
|
1387
|
+
currentUser: x,
|
|
1388
|
+
isUserLoading: R,
|
|
1389
|
+
userError: D,
|
|
1390
|
+
loadUserData: A,
|
|
1391
|
+
refreshUser: V,
|
|
1392
|
+
isAuthInitializing: !L,
|
|
1393
|
+
isAuthReady: L,
|
|
1394
|
+
userRole: m,
|
|
1395
|
+
userPermissions: v,
|
|
1396
|
+
availableRoles: p,
|
|
1397
|
+
rolesLoading: y,
|
|
1398
|
+
hasPermission: Ae,
|
|
1399
|
+
hasAnyPermission: (B) => B.some((z) => Ae(z)),
|
|
1400
|
+
hasAllPermissions: (B) => B.every((z) => Ae(z)),
|
|
1401
|
+
getUserPermissionStrings: () => v || [],
|
|
1402
|
+
refreshRoles: ht,
|
|
1421
1403
|
// RFC-004: Multi-tenant user membership
|
|
1422
|
-
userTenants:
|
|
1423
|
-
hasTenantContext:
|
|
1424
|
-
switchToTenant: async (
|
|
1425
|
-
const { redirectPath:
|
|
1426
|
-
if (!(
|
|
1404
|
+
userTenants: P,
|
|
1405
|
+
hasTenantContext: S,
|
|
1406
|
+
switchToTenant: async (B, z) => {
|
|
1407
|
+
const { redirectPath: Z } = z || {}, W = l.getTokens();
|
|
1408
|
+
if (!(W != null && W.refreshToken))
|
|
1427
1409
|
throw new Error("No refresh token available for tenant switch");
|
|
1428
|
-
const
|
|
1429
|
-
refreshToken:
|
|
1430
|
-
tenantId:
|
|
1410
|
+
const Y = await c.switchTenant({
|
|
1411
|
+
refreshToken: W.refreshToken,
|
|
1412
|
+
tenantId: B
|
|
1431
1413
|
});
|
|
1432
1414
|
l.setTokens({
|
|
1433
|
-
accessToken:
|
|
1434
|
-
refreshToken:
|
|
1415
|
+
accessToken: Y.accessToken,
|
|
1416
|
+
refreshToken: W.refreshToken,
|
|
1435
1417
|
// Keep the same refresh token
|
|
1436
|
-
expiresIn:
|
|
1437
|
-
}),
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1418
|
+
expiresIn: Y.expiresIn
|
|
1419
|
+
}), h(Y.user), l.setUser(Y.user), C(!0);
|
|
1420
|
+
const X = P.find((ee) => ee.id === B);
|
|
1421
|
+
X && a(X.subdomain, {
|
|
1440
1422
|
tokens: {
|
|
1441
|
-
accessToken:
|
|
1442
|
-
refreshToken:
|
|
1443
|
-
expiresIn:
|
|
1423
|
+
accessToken: Y.accessToken,
|
|
1424
|
+
refreshToken: W.refreshToken,
|
|
1425
|
+
expiresIn: Y.expiresIn
|
|
1444
1426
|
},
|
|
1445
|
-
redirectPath:
|
|
1427
|
+
redirectPath: Z
|
|
1446
1428
|
});
|
|
1447
1429
|
},
|
|
1448
1430
|
refreshUserTenants: async () => {
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1431
|
+
const B = await l.getAuthHeaders(), z = await c.getUserTenants(B);
|
|
1432
|
+
u(z);
|
|
1451
1433
|
try {
|
|
1452
1434
|
localStorage.setItem("userTenants", JSON.stringify(z));
|
|
1453
1435
|
} catch {
|
|
@@ -1456,83 +1438,73 @@ function Tr({ config: n = {}, children: e }) {
|
|
|
1456
1438
|
}
|
|
1457
1439
|
};
|
|
1458
1440
|
}, [
|
|
1459
|
-
|
|
1441
|
+
Q,
|
|
1460
1442
|
l,
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1443
|
+
F,
|
|
1444
|
+
c,
|
|
1445
|
+
H,
|
|
1446
|
+
I,
|
|
1465
1447
|
t,
|
|
1466
1448
|
i,
|
|
1467
1449
|
o,
|
|
1468
1450
|
a,
|
|
1469
|
-
|
|
1470
|
-
I,
|
|
1451
|
+
p,
|
|
1471
1452
|
x,
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
q
|
|
1453
|
+
R,
|
|
1454
|
+
D,
|
|
1455
|
+
P,
|
|
1456
|
+
S,
|
|
1457
|
+
L,
|
|
1458
|
+
m,
|
|
1459
|
+
v
|
|
1480
1460
|
]);
|
|
1481
|
-
|
|
1461
|
+
J.current = O.loadUserData, re(() => {
|
|
1482
1462
|
!n.initialRoles && t && (async () => {
|
|
1483
1463
|
try {
|
|
1484
|
-
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1487
|
-
} catch (
|
|
1488
|
-
console.error("Failed to fetch roles:",
|
|
1464
|
+
f(!0);
|
|
1465
|
+
const V = new le(r), de = new ze(V), { roles: he } = await de.getRolesByApp(t);
|
|
1466
|
+
w(he);
|
|
1467
|
+
} catch (V) {
|
|
1468
|
+
process.env.NODE_ENV === "development" && console.error("[AuthProvider] Failed to fetch roles:", V);
|
|
1489
1469
|
} finally {
|
|
1490
|
-
|
|
1470
|
+
f(!1);
|
|
1491
1471
|
}
|
|
1492
1472
|
})();
|
|
1493
1473
|
}, [t, r, n.initialRoles]);
|
|
1494
|
-
const [
|
|
1495
|
-
return
|
|
1496
|
-
|
|
1497
|
-
console.error("[AuthProvider] Failed to load user data:",
|
|
1474
|
+
const [q, j] = k(!1);
|
|
1475
|
+
return re(() => {
|
|
1476
|
+
q || (j(!0), M.current.urlTokens && (At(), $(!0), O.loadUserData().catch((A) => {
|
|
1477
|
+
process.env.NODE_ENV === "development" && console.error("[AuthProvider] Failed to load user data after URL tokens:", A);
|
|
1498
1478
|
}).finally(() => {
|
|
1499
|
-
|
|
1479
|
+
$(!1);
|
|
1500
1480
|
})));
|
|
1501
|
-
}, [
|
|
1502
|
-
let
|
|
1481
|
+
}, [O, q]), re(() => {
|
|
1482
|
+
let A = !1;
|
|
1503
1483
|
return (async () => {
|
|
1504
|
-
var
|
|
1505
|
-
if (!l.hasValidSession() && ((
|
|
1506
|
-
const
|
|
1507
|
-
|
|
1484
|
+
var he;
|
|
1485
|
+
if (!l.hasValidSession() && ((he = l.getTokens()) != null && he.refreshToken) && await l.waitForPendingRefresh(), A) return;
|
|
1486
|
+
const de = l.getUser();
|
|
1487
|
+
de && l.hasValidSession() && h(de), b(!1);
|
|
1508
1488
|
})(), () => {
|
|
1509
|
-
|
|
1489
|
+
A = !0;
|
|
1510
1490
|
};
|
|
1511
|
-
}, [l]),
|
|
1512
|
-
|
|
1491
|
+
}, [l]), re(() => {
|
|
1492
|
+
q && (M.current.urlTokens || (!x && !R && !D && l.hasValidSession() ? J.current().catch(() => {
|
|
1513
1493
|
}).finally(() => {
|
|
1514
|
-
|
|
1515
|
-
})
|
|
1516
|
-
}, [
|
|
1517
|
-
if (!l.hasValidSession() || !I)
|
|
1518
|
-
return;
|
|
1519
|
-
const V = setInterval(() => {
|
|
1520
|
-
W.loadUserData().catch(() => {
|
|
1521
|
-
});
|
|
1522
|
-
}, q);
|
|
1523
|
-
return () => clearInterval(V);
|
|
1524
|
-
}, [l, I, W, q]), /* @__PURE__ */ s(Ne.Provider, { value: W, children: e });
|
|
1494
|
+
b(!1);
|
|
1495
|
+
}) : b(!1)));
|
|
1496
|
+
}, [x, R, D, l, q]), /* @__PURE__ */ s(De.Provider, { value: O, children: e });
|
|
1525
1497
|
}
|
|
1526
1498
|
function ue() {
|
|
1527
|
-
const n =
|
|
1499
|
+
const n = ae(De);
|
|
1528
1500
|
if (!n)
|
|
1529
1501
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
1530
1502
|
return n;
|
|
1531
1503
|
}
|
|
1532
|
-
function
|
|
1533
|
-
return
|
|
1504
|
+
function Fe() {
|
|
1505
|
+
return ae(De);
|
|
1534
1506
|
}
|
|
1535
|
-
class
|
|
1507
|
+
class Pt {
|
|
1536
1508
|
constructor(e, t) {
|
|
1537
1509
|
this.httpService = e, this.sessionManager = t;
|
|
1538
1510
|
}
|
|
@@ -1612,66 +1584,66 @@ class It {
|
|
|
1612
1584
|
})).data;
|
|
1613
1585
|
}
|
|
1614
1586
|
}
|
|
1615
|
-
const
|
|
1616
|
-
function
|
|
1617
|
-
const t =
|
|
1618
|
-
const u = new
|
|
1619
|
-
return new
|
|
1587
|
+
const Ce = fe(null);
|
|
1588
|
+
function Tr({ config: n = {}, children: e }) {
|
|
1589
|
+
const t = Qe(), r = xe(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (t == null ? void 0 : t.appId) ?? "", a = (r == null ? void 0 : r.tenant) ?? null, [p, w] = k([]), [y, f] = k(!1), [x, h] = k(null), [R, N] = k(!1), D = K(() => {
|
|
1590
|
+
const u = new le(i);
|
|
1591
|
+
return new Pt(u);
|
|
1620
1592
|
}, [i]), E = async () => {
|
|
1621
1593
|
if (!(a != null && a.id)) {
|
|
1622
|
-
|
|
1594
|
+
w([]);
|
|
1623
1595
|
return;
|
|
1624
1596
|
}
|
|
1625
|
-
|
|
1597
|
+
f(!0), h(null);
|
|
1626
1598
|
try {
|
|
1627
|
-
const u = await
|
|
1628
|
-
|
|
1599
|
+
const u = await D.getTenantFeatureFlags(a.id, o);
|
|
1600
|
+
w(u);
|
|
1629
1601
|
} catch (u) {
|
|
1630
|
-
const
|
|
1631
|
-
|
|
1602
|
+
const S = u instanceof Error ? u.message : "Failed to fetch feature flags";
|
|
1603
|
+
h(S), n.onError && n.onError(u instanceof Error ? u : new Error(S));
|
|
1632
1604
|
} finally {
|
|
1633
|
-
|
|
1605
|
+
f(!1);
|
|
1634
1606
|
}
|
|
1635
1607
|
};
|
|
1636
|
-
|
|
1608
|
+
re(() => {
|
|
1637
1609
|
if (!i || !o) return;
|
|
1638
|
-
E().finally(() =>
|
|
1639
|
-
const u = n.refreshInterval || 5 * 60 * 1e3,
|
|
1640
|
-
return () => clearInterval(
|
|
1610
|
+
E().finally(() => N(!0));
|
|
1611
|
+
const u = n.refreshInterval || 5 * 60 * 1e3, S = setInterval(E, u);
|
|
1612
|
+
return () => clearInterval(S);
|
|
1641
1613
|
}, [a == null ? void 0 : a.id, i, o, n.refreshInterval]);
|
|
1642
|
-
const
|
|
1643
|
-
const u = (
|
|
1644
|
-
const
|
|
1645
|
-
return (
|
|
1646
|
-
},
|
|
1647
|
-
const
|
|
1648
|
-
return
|
|
1614
|
+
const P = K(() => {
|
|
1615
|
+
const u = ($) => {
|
|
1616
|
+
const l = p.find((U) => U.key === $);
|
|
1617
|
+
return (l == null ? void 0 : l.value) === !0;
|
|
1618
|
+
}, S = ($) => p.find((l) => l.key === $), C = ($) => {
|
|
1619
|
+
const l = p.find((U) => U.key === $);
|
|
1620
|
+
return l ? l.value ? "enabled" : "disabled" : "not_found";
|
|
1649
1621
|
}, M = async () => {
|
|
1650
1622
|
await E();
|
|
1651
|
-
},
|
|
1623
|
+
}, T = !!(i && o) && (R || !(a != null && a.id));
|
|
1652
1624
|
return {
|
|
1653
|
-
featureFlags:
|
|
1654
|
-
loading:
|
|
1655
|
-
error:
|
|
1656
|
-
isReady:
|
|
1625
|
+
featureFlags: p,
|
|
1626
|
+
loading: y,
|
|
1627
|
+
error: x,
|
|
1628
|
+
isReady: T,
|
|
1657
1629
|
isEnabled: u,
|
|
1658
|
-
getFlag:
|
|
1659
|
-
getFlagState:
|
|
1630
|
+
getFlag: S,
|
|
1631
|
+
getFlagState: C,
|
|
1660
1632
|
refresh: M
|
|
1661
1633
|
};
|
|
1662
|
-
}, [
|
|
1663
|
-
return /* @__PURE__ */ s(
|
|
1634
|
+
}, [p, y, x, i, o, a == null ? void 0 : a.id, R]);
|
|
1635
|
+
return /* @__PURE__ */ s(Ce.Provider, { value: P, children: e });
|
|
1664
1636
|
}
|
|
1665
|
-
function
|
|
1666
|
-
const n =
|
|
1637
|
+
function Rt() {
|
|
1638
|
+
const n = ae(Ce);
|
|
1667
1639
|
if (!n)
|
|
1668
1640
|
throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
|
|
1669
1641
|
return n;
|
|
1670
1642
|
}
|
|
1671
|
-
function
|
|
1672
|
-
return
|
|
1643
|
+
function Ke() {
|
|
1644
|
+
return ae(Ce);
|
|
1673
1645
|
}
|
|
1674
|
-
class
|
|
1646
|
+
class Et {
|
|
1675
1647
|
constructor(e, t) {
|
|
1676
1648
|
this.httpService = e, this.sessionManager = t;
|
|
1677
1649
|
}
|
|
@@ -1737,68 +1709,68 @@ class Mt {
|
|
|
1737
1709
|
)).data;
|
|
1738
1710
|
}
|
|
1739
1711
|
}
|
|
1740
|
-
const $e =
|
|
1741
|
-
function
|
|
1742
|
-
const t =
|
|
1743
|
-
const
|
|
1744
|
-
return new
|
|
1745
|
-
}, [i]),
|
|
1712
|
+
const $e = fe(void 0);
|
|
1713
|
+
function kr({ config: n = {}, children: e }) {
|
|
1714
|
+
const t = Qe(), r = xe(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (r == null ? void 0 : r.tenant) ?? null, [a, p] = k(null), [w, y] = k(!1), [f, x] = k(null), [h, R] = k(!1), N = K(() => {
|
|
1715
|
+
const P = new le(i);
|
|
1716
|
+
return new Et(P);
|
|
1717
|
+
}, [i]), D = async () => {
|
|
1746
1718
|
if (!(o != null && o.id)) {
|
|
1747
|
-
|
|
1719
|
+
p(null);
|
|
1748
1720
|
return;
|
|
1749
1721
|
}
|
|
1750
|
-
|
|
1722
|
+
y(!0), x(null);
|
|
1751
1723
|
try {
|
|
1752
|
-
const
|
|
1753
|
-
|
|
1754
|
-
} catch (
|
|
1755
|
-
const u =
|
|
1756
|
-
|
|
1724
|
+
const P = await N.getTenantSubscriptionFeatures(o.id);
|
|
1725
|
+
p(P);
|
|
1726
|
+
} catch (P) {
|
|
1727
|
+
const u = P instanceof Error ? P.message : "Failed to fetch subscription";
|
|
1728
|
+
x(u), n.onError && n.onError(P instanceof Error ? P : new Error(u));
|
|
1757
1729
|
} finally {
|
|
1758
|
-
|
|
1730
|
+
y(!1);
|
|
1759
1731
|
}
|
|
1760
1732
|
};
|
|
1761
|
-
|
|
1762
|
-
if (!i || (
|
|
1763
|
-
const
|
|
1733
|
+
re(() => {
|
|
1734
|
+
if (!i || (D().finally(() => R(!0)), !n.refreshInterval)) return;
|
|
1735
|
+
const P = n.refreshInterval || 10 * 60 * 1e3, u = setInterval(D, P);
|
|
1764
1736
|
return () => clearInterval(u);
|
|
1765
1737
|
}, [o == null ? void 0 : o.id, i, n.refreshInterval]);
|
|
1766
|
-
const E =
|
|
1767
|
-
const
|
|
1768
|
-
const U =
|
|
1738
|
+
const E = K(() => {
|
|
1739
|
+
const P = (a == null ? void 0 : a.features) || [], u = (l) => {
|
|
1740
|
+
const U = P.find((b) => b.key === l);
|
|
1769
1741
|
return U ? U.type === "BOOLEAN" || U.type === "boolean" ? U.value === !0 : !!U.value : !1;
|
|
1770
|
-
},
|
|
1771
|
-
const
|
|
1772
|
-
return
|
|
1773
|
-
}, M = (
|
|
1774
|
-
await
|
|
1775
|
-
},
|
|
1742
|
+
}, S = (l) => P.find((U) => U.key === l), C = (l, U) => {
|
|
1743
|
+
const b = P.find((L) => L.key === l);
|
|
1744
|
+
return b ? b.value : U;
|
|
1745
|
+
}, M = (l) => !a || !a.isActive ? !1 : l.includes(a.planId), T = async () => {
|
|
1746
|
+
await D();
|
|
1747
|
+
}, $ = !!i && (h || !(o != null && o.id));
|
|
1776
1748
|
return {
|
|
1777
1749
|
subscription: a,
|
|
1778
|
-
features:
|
|
1779
|
-
loading:
|
|
1780
|
-
error:
|
|
1781
|
-
isReady:
|
|
1750
|
+
features: P,
|
|
1751
|
+
loading: w,
|
|
1752
|
+
error: f,
|
|
1753
|
+
isReady: $,
|
|
1782
1754
|
isFeatureEnabled: u,
|
|
1783
|
-
getFeature:
|
|
1784
|
-
getFeatureValue:
|
|
1755
|
+
getFeature: S,
|
|
1756
|
+
getFeatureValue: C,
|
|
1785
1757
|
hasAllowedPlan: M,
|
|
1786
|
-
refresh:
|
|
1758
|
+
refresh: T
|
|
1787
1759
|
};
|
|
1788
|
-
}, [a,
|
|
1760
|
+
}, [a, w, f, i, o == null ? void 0 : o.id, h]);
|
|
1789
1761
|
return /* @__PURE__ */ s($e.Provider, { value: E, children: e });
|
|
1790
1762
|
}
|
|
1791
|
-
function
|
|
1792
|
-
const n =
|
|
1763
|
+
function It() {
|
|
1764
|
+
const n = ae($e);
|
|
1793
1765
|
if (n === void 0)
|
|
1794
1766
|
throw new Error("useSubscription must be used within a SubscriptionProvider");
|
|
1795
1767
|
return n;
|
|
1796
1768
|
}
|
|
1797
|
-
function
|
|
1798
|
-
return
|
|
1769
|
+
function Ze() {
|
|
1770
|
+
return ae($e) ?? null;
|
|
1799
1771
|
}
|
|
1800
|
-
var
|
|
1801
|
-
const
|
|
1772
|
+
var oe = /* @__PURE__ */ ((n) => (n.SUPERUSER = "SUPERUSER", n.TENANT_ADMIN = "TENANT_ADMIN", n.USER = "USER", n))(oe || {});
|
|
1773
|
+
const Ue = {
|
|
1802
1774
|
publicGuest: "/",
|
|
1803
1775
|
publicUser: "/account",
|
|
1804
1776
|
publicAdmin: "/admin",
|
|
@@ -1806,7 +1778,7 @@ const He = {
|
|
|
1806
1778
|
tenantUser: "/dashboard",
|
|
1807
1779
|
tenantAdmin: "/admin/dashboard",
|
|
1808
1780
|
default: "/"
|
|
1809
|
-
},
|
|
1781
|
+
}, Je = {
|
|
1810
1782
|
// Public/Landing zones
|
|
1811
1783
|
landing: { tenant: "forbidden", auth: "optional" },
|
|
1812
1784
|
publicOnly: { tenant: "forbidden", auth: "forbidden" },
|
|
@@ -1819,18 +1791,18 @@ const He = {
|
|
|
1819
1791
|
tenantOpen: { tenant: "required", auth: "optional" },
|
|
1820
1792
|
tenantAuth: { tenant: "required", auth: "required" },
|
|
1821
1793
|
// User type zones
|
|
1822
|
-
user: { tenant: "required", auth: "required", userType:
|
|
1823
|
-
admin: { tenant: "required", auth: "required", userType:
|
|
1794
|
+
user: { tenant: "required", auth: "required", userType: oe.USER },
|
|
1795
|
+
admin: { tenant: "required", auth: "required", userType: oe.TENANT_ADMIN },
|
|
1824
1796
|
// Fully open
|
|
1825
1797
|
open: { tenant: "optional", auth: "optional" }
|
|
1826
|
-
},
|
|
1827
|
-
function
|
|
1828
|
-
const t =
|
|
1798
|
+
}, He = fe(null);
|
|
1799
|
+
function xr({ config: n = {}, children: e }) {
|
|
1800
|
+
const t = K(() => {
|
|
1829
1801
|
const r = {
|
|
1830
|
-
...
|
|
1802
|
+
...Ue,
|
|
1831
1803
|
...n.zoneRoots
|
|
1832
1804
|
}, i = {
|
|
1833
|
-
...
|
|
1805
|
+
...Je,
|
|
1834
1806
|
...n.presets
|
|
1835
1807
|
};
|
|
1836
1808
|
return {
|
|
@@ -1843,19 +1815,19 @@ function Ar({ config: n = {}, children: e }) {
|
|
|
1843
1815
|
returnToStorage: n.returnToStorage ?? "url"
|
|
1844
1816
|
};
|
|
1845
1817
|
}, [n]);
|
|
1846
|
-
return /* @__PURE__ */ s(
|
|
1818
|
+
return /* @__PURE__ */ s(He.Provider, { value: t, children: e });
|
|
1847
1819
|
}
|
|
1848
|
-
function
|
|
1849
|
-
const n =
|
|
1820
|
+
function Ar() {
|
|
1821
|
+
const n = ae(He);
|
|
1850
1822
|
if (!n)
|
|
1851
1823
|
throw new Error("useRouting must be used within a RoutingProvider");
|
|
1852
1824
|
return n;
|
|
1853
1825
|
}
|
|
1854
|
-
function
|
|
1855
|
-
const n =
|
|
1826
|
+
function Mt() {
|
|
1827
|
+
const n = ae(He);
|
|
1856
1828
|
return n || {
|
|
1857
|
-
zoneRoots:
|
|
1858
|
-
presets:
|
|
1829
|
+
zoneRoots: Ue,
|
|
1830
|
+
presets: Je,
|
|
1859
1831
|
loadingFallback: null,
|
|
1860
1832
|
accessDeniedFallback: null,
|
|
1861
1833
|
onAccessDenied: void 0,
|
|
@@ -1863,7 +1835,7 @@ function Ft() {
|
|
|
1863
1835
|
returnToStorage: "url"
|
|
1864
1836
|
};
|
|
1865
1837
|
}
|
|
1866
|
-
const
|
|
1838
|
+
const We = () => /* @__PURE__ */ d(
|
|
1867
1839
|
"div",
|
|
1868
1840
|
{
|
|
1869
1841
|
style: {
|
|
@@ -1900,7 +1872,7 @@ const Ve = () => /* @__PURE__ */ d(
|
|
|
1900
1872
|
)
|
|
1901
1873
|
]
|
|
1902
1874
|
}
|
|
1903
|
-
),
|
|
1875
|
+
), Ve = ({
|
|
1904
1876
|
userType: n,
|
|
1905
1877
|
minUserType: e,
|
|
1906
1878
|
missingPermissions: t
|
|
@@ -1941,32 +1913,32 @@ const Ve = () => /* @__PURE__ */ d(
|
|
|
1941
1913
|
] })
|
|
1942
1914
|
]
|
|
1943
1915
|
}
|
|
1944
|
-
),
|
|
1916
|
+
), Lt = (n, e) => {
|
|
1945
1917
|
const t = {
|
|
1946
|
-
[
|
|
1947
|
-
[
|
|
1948
|
-
[
|
|
1918
|
+
[oe.USER]: 1,
|
|
1919
|
+
[oe.TENANT_ADMIN]: 2,
|
|
1920
|
+
[oe.SUPERUSER]: 3
|
|
1949
1921
|
};
|
|
1950
1922
|
return t[n] >= t[e];
|
|
1951
1923
|
};
|
|
1952
|
-
function
|
|
1924
|
+
function Pr({
|
|
1953
1925
|
children: n,
|
|
1954
1926
|
fallback: e,
|
|
1955
1927
|
minUserType: t,
|
|
1956
1928
|
requiredPermissions: r,
|
|
1957
1929
|
requireAllPermissions: i = !1
|
|
1958
1930
|
}) {
|
|
1959
|
-
const { hasValidSession: o, sessionManager: a, hasPermission:
|
|
1931
|
+
const { hasValidSession: o, sessionManager: a, hasPermission: p, hasAnyPermission: w, hasAllPermissions: y } = ue();
|
|
1960
1932
|
if (!o())
|
|
1961
|
-
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(
|
|
1962
|
-
const
|
|
1963
|
-
if (!
|
|
1964
|
-
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(
|
|
1965
|
-
if (t && !
|
|
1966
|
-
return /* @__PURE__ */ s(
|
|
1967
|
-
if (r && r.length > 0 && !(i ?
|
|
1968
|
-
const
|
|
1969
|
-
return /* @__PURE__ */ s(
|
|
1933
|
+
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(We, {}) });
|
|
1934
|
+
const f = a.getUser();
|
|
1935
|
+
if (!f)
|
|
1936
|
+
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(We, {}) });
|
|
1937
|
+
if (t && !Lt(f.userType, t))
|
|
1938
|
+
return /* @__PURE__ */ s(Ve, { userType: f.userType, minUserType: t });
|
|
1939
|
+
if (r && r.length > 0 && !(i ? y(r) : w(r))) {
|
|
1940
|
+
const h = r.filter((R) => !p(R)).map((R) => typeof R == "string" ? R : R.name);
|
|
1941
|
+
return /* @__PURE__ */ s(Ve, { missingPermissions: h });
|
|
1970
1942
|
}
|
|
1971
1943
|
return /* @__PURE__ */ s(_, { children: n });
|
|
1972
1944
|
}
|
|
@@ -2006,7 +1978,7 @@ const Nt = ({ redirectPath: n }) => /* @__PURE__ */ s(
|
|
|
2006
1978
|
}
|
|
2007
1979
|
)
|
|
2008
1980
|
}
|
|
2009
|
-
),
|
|
1981
|
+
), je = ({
|
|
2010
1982
|
userType: n,
|
|
2011
1983
|
requiredUserType: e,
|
|
2012
1984
|
missingPermissions: t
|
|
@@ -2057,8 +2029,8 @@ const Nt = ({ redirectPath: n }) => /* @__PURE__ */ s(
|
|
|
2057
2029
|
}
|
|
2058
2030
|
)
|
|
2059
2031
|
}
|
|
2060
|
-
),
|
|
2061
|
-
function
|
|
2032
|
+
), Dt = (n, e) => n === e;
|
|
2033
|
+
function Rr({
|
|
2062
2034
|
children: n,
|
|
2063
2035
|
redirectTo: e = "/login",
|
|
2064
2036
|
requiredUserType: t,
|
|
@@ -2066,34 +2038,34 @@ function Ir({
|
|
|
2066
2038
|
requireAllPermissions: i = !1,
|
|
2067
2039
|
fallback: o
|
|
2068
2040
|
}) {
|
|
2069
|
-
const { hasValidSession: a, sessionManager:
|
|
2070
|
-
if (
|
|
2041
|
+
const { hasValidSession: a, sessionManager: p, hasPermission: w, hasAnyPermission: y, hasAllPermissions: f } = ue(), x = ke();
|
|
2042
|
+
if (re(() => {
|
|
2071
2043
|
process.env.NODE_ENV === "development" && console.warn(
|
|
2072
2044
|
"[react-identity-access] ProtectedRoute is deprecated. Use AuthenticatedZone or AdminZone from ZoneRoute instead."
|
|
2073
2045
|
);
|
|
2074
2046
|
}, []), !a())
|
|
2075
2047
|
return o ? /* @__PURE__ */ s(_, { children: o }) : /* @__PURE__ */ d(_, { children: [
|
|
2076
2048
|
/* @__PURE__ */ s(Nt, { redirectPath: e }),
|
|
2077
|
-
/* @__PURE__ */ s(
|
|
2049
|
+
/* @__PURE__ */ s(ve, { to: e, state: { from: x.pathname }, replace: !0 })
|
|
2078
2050
|
] });
|
|
2079
|
-
const
|
|
2080
|
-
if (!
|
|
2081
|
-
return /* @__PURE__ */ s(
|
|
2082
|
-
if (t && !
|
|
2051
|
+
const h = p.getUser();
|
|
2052
|
+
if (!h)
|
|
2053
|
+
return /* @__PURE__ */ s(ve, { to: e, state: { from: x.pathname }, replace: !0 });
|
|
2054
|
+
if (t && !Dt(h.userType, t))
|
|
2083
2055
|
return /* @__PURE__ */ s(
|
|
2084
|
-
|
|
2056
|
+
je,
|
|
2085
2057
|
{
|
|
2086
|
-
userType:
|
|
2058
|
+
userType: h.userType,
|
|
2087
2059
|
requiredUserType: t
|
|
2088
2060
|
}
|
|
2089
2061
|
);
|
|
2090
|
-
if (r && r.length > 0 && !(i ?
|
|
2091
|
-
const
|
|
2092
|
-
return /* @__PURE__ */ s(
|
|
2062
|
+
if (r && r.length > 0 && !(i ? f(r) : y(r))) {
|
|
2063
|
+
const N = r.filter((D) => !w(D)).map((D) => typeof D == "string" ? D : D.name);
|
|
2064
|
+
return /* @__PURE__ */ s(je, { missingPermissions: N });
|
|
2093
2065
|
}
|
|
2094
2066
|
return /* @__PURE__ */ s(_, { children: n });
|
|
2095
2067
|
}
|
|
2096
|
-
const
|
|
2068
|
+
const Ft = ({ redirectPath: n }) => /* @__PURE__ */ s(
|
|
2097
2069
|
"div",
|
|
2098
2070
|
{
|
|
2099
2071
|
style: {
|
|
@@ -2131,17 +2103,17 @@ const Ut = ({ redirectPath: n }) => /* @__PURE__ */ s(
|
|
|
2131
2103
|
}
|
|
2132
2104
|
);
|
|
2133
2105
|
function Er({ children: n, redirectTo: e = "/", fallback: t }) {
|
|
2134
|
-
const { tenant: r, isLoading: i, error: o } =
|
|
2135
|
-
return
|
|
2106
|
+
const { tenant: r, isLoading: i, error: o } = me(), a = ke();
|
|
2107
|
+
return re(() => {
|
|
2136
2108
|
process.env.NODE_ENV === "development" && console.warn(
|
|
2137
2109
|
"[react-identity-access] TenantRoute is deprecated. Use TenantZone from ZoneRoute instead."
|
|
2138
2110
|
);
|
|
2139
2111
|
}, []), i || o ? null : r ? /* @__PURE__ */ s(_, { children: n }) : t ? /* @__PURE__ */ s(_, { children: t }) : /* @__PURE__ */ d(_, { children: [
|
|
2140
|
-
/* @__PURE__ */ s(
|
|
2141
|
-
/* @__PURE__ */ s(
|
|
2112
|
+
/* @__PURE__ */ s(Ft, { redirectPath: e }),
|
|
2113
|
+
/* @__PURE__ */ s(ve, { to: e, state: { from: a.pathname }, replace: !0 })
|
|
2142
2114
|
] });
|
|
2143
2115
|
}
|
|
2144
|
-
const
|
|
2116
|
+
const Ct = ({ redirectPath: n }) => /* @__PURE__ */ s(
|
|
2145
2117
|
"div",
|
|
2146
2118
|
{
|
|
2147
2119
|
style: {
|
|
@@ -2178,41 +2150,41 @@ const $t = ({ redirectPath: n }) => /* @__PURE__ */ s(
|
|
|
2178
2150
|
)
|
|
2179
2151
|
}
|
|
2180
2152
|
);
|
|
2181
|
-
function
|
|
2182
|
-
const { tenant: r, isLoading: i, error: o } =
|
|
2183
|
-
return
|
|
2153
|
+
function Ir({ children: n, redirectTo: e = "/dashboard", fallback: t }) {
|
|
2154
|
+
const { tenant: r, isLoading: i, error: o } = me(), a = ke();
|
|
2155
|
+
return re(() => {
|
|
2184
2156
|
process.env.NODE_ENV === "development" && console.warn(
|
|
2185
2157
|
"[react-identity-access] LandingRoute is deprecated. Use PublicZone from ZoneRoute instead."
|
|
2186
2158
|
);
|
|
2187
2159
|
}, []), i || o ? null : r ? t ? /* @__PURE__ */ s(_, { children: t }) : /* @__PURE__ */ d(_, { children: [
|
|
2188
|
-
/* @__PURE__ */ s(
|
|
2189
|
-
/* @__PURE__ */ s(
|
|
2160
|
+
/* @__PURE__ */ s(Ct, { redirectPath: e }),
|
|
2161
|
+
/* @__PURE__ */ s(ve, { to: e, state: { from: a.pathname }, replace: !0 })
|
|
2190
2162
|
] }) : /* @__PURE__ */ s(_, { children: n });
|
|
2191
2163
|
}
|
|
2192
|
-
function
|
|
2164
|
+
function $t(n, e) {
|
|
2193
2165
|
return e ? n ? Array.isArray(e) ? e.includes(n) : n === e : !1 : !0;
|
|
2194
2166
|
}
|
|
2195
|
-
function
|
|
2167
|
+
function Ge(n, e) {
|
|
2196
2168
|
return !n || n === "optional" ? "skip" : n === "required" ? e ? "pass" : "fail" : n === "forbidden" ? e ? "fail" : "pass" : "skip";
|
|
2197
2169
|
}
|
|
2198
|
-
function
|
|
2199
|
-
return
|
|
2170
|
+
function Ut(n, e) {
|
|
2171
|
+
return Ge(n.tenant, e.hasTenant) === "fail" ? e.hasTenant ? "has_tenant" : "no_tenant" : Ge(n.auth, e.isAuthenticated) === "fail" ? e.isAuthenticated ? "already_authenticated" : "not_authenticated" : n.userType && e.isAuthenticated && !$t(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;
|
|
2200
2172
|
}
|
|
2201
|
-
function
|
|
2202
|
-
return n.hasTenant ? n.isAuthenticated ? n.userType ===
|
|
2173
|
+
function Ht(n, e) {
|
|
2174
|
+
return n.hasTenant ? n.isAuthenticated ? n.userType === oe.TENANT_ADMIN ? e.tenantAdmin : e.tenantUser : e.tenantGuest : n.isAuthenticated ? n.userType === oe.TENANT_ADMIN ? e.publicAdmin : e.publicUser : e.publicGuest;
|
|
2203
2175
|
}
|
|
2204
|
-
function
|
|
2176
|
+
function Bt(n, e, t, r, i) {
|
|
2205
2177
|
if (!e || i !== "url")
|
|
2206
2178
|
return n;
|
|
2207
2179
|
const o = typeof e == "string" ? e : t, a = n.includes("?") ? "&" : "?";
|
|
2208
2180
|
return `${n}${a}${r}=${encodeURIComponent(o)}`;
|
|
2209
2181
|
}
|
|
2210
|
-
function
|
|
2182
|
+
function Ot(n, e, t) {
|
|
2211
2183
|
if (!n || t === "url") return;
|
|
2212
2184
|
const r = typeof n == "string" ? n : e, i = "zone_return_to";
|
|
2213
2185
|
t === "session" ? sessionStorage.setItem(i, r) : t === "local" && localStorage.setItem(i, r);
|
|
2214
2186
|
}
|
|
2215
|
-
const
|
|
2187
|
+
const ce = ({
|
|
2216
2188
|
children: n,
|
|
2217
2189
|
preset: e,
|
|
2218
2190
|
tenant: t,
|
|
@@ -2220,42 +2192,42 @@ const de = ({
|
|
|
2220
2192
|
userType: i,
|
|
2221
2193
|
requiredPermissions: o,
|
|
2222
2194
|
requireAllPermissions: a = !0,
|
|
2223
|
-
returnTo:
|
|
2224
|
-
onAccessDenied:
|
|
2225
|
-
redirectTo:
|
|
2226
|
-
loadingFallback:
|
|
2227
|
-
accessDeniedFallback:
|
|
2195
|
+
returnTo: p,
|
|
2196
|
+
onAccessDenied: w,
|
|
2197
|
+
redirectTo: y,
|
|
2198
|
+
loadingFallback: f,
|
|
2199
|
+
accessDeniedFallback: x
|
|
2228
2200
|
}) => {
|
|
2229
|
-
const
|
|
2201
|
+
const h = ke(), { isAuthenticated: R, isAuthInitializing: N, currentUser: D, userPermissions: E } = ue(), { tenant: P, isTenantLoading: u } = ge(), S = Mt(), C = K(() => {
|
|
2230
2202
|
if (e)
|
|
2231
|
-
return
|
|
2232
|
-
}, [e,
|
|
2203
|
+
return S.presets[e];
|
|
2204
|
+
}, [e, S.presets]), M = K(
|
|
2233
2205
|
() => ({
|
|
2234
|
-
tenant: t ?? (
|
|
2235
|
-
auth: r ?? (
|
|
2236
|
-
userType: i ?? (
|
|
2237
|
-
permissions: o ?? (
|
|
2206
|
+
tenant: t ?? (C == null ? void 0 : C.tenant),
|
|
2207
|
+
auth: r ?? (C == null ? void 0 : C.auth),
|
|
2208
|
+
userType: i ?? (C == null ? void 0 : C.userType),
|
|
2209
|
+
permissions: o ?? (C == null ? void 0 : C.requiredPermissions),
|
|
2238
2210
|
requireAllPermissions: a
|
|
2239
2211
|
}),
|
|
2240
|
-
[t, r, i, o,
|
|
2241
|
-
),
|
|
2212
|
+
[t, r, i, o, C, a]
|
|
2213
|
+
), T = K(
|
|
2242
2214
|
() => ({
|
|
2243
|
-
hasTenant: !!
|
|
2244
|
-
isAuthenticated:
|
|
2245
|
-
userType:
|
|
2215
|
+
hasTenant: !!P,
|
|
2216
|
+
isAuthenticated: R,
|
|
2217
|
+
userType: D == null ? void 0 : D.userType,
|
|
2246
2218
|
permissions: E,
|
|
2247
|
-
isLoading:
|
|
2219
|
+
isLoading: N || u
|
|
2248
2220
|
}),
|
|
2249
2221
|
[
|
|
2250
|
-
|
|
2251
|
-
x,
|
|
2252
|
-
F == null ? void 0 : F.userType,
|
|
2253
|
-
E,
|
|
2222
|
+
P,
|
|
2254
2223
|
R,
|
|
2224
|
+
D == null ? void 0 : D.userType,
|
|
2225
|
+
E,
|
|
2226
|
+
N,
|
|
2255
2227
|
u
|
|
2256
2228
|
]
|
|
2257
|
-
),
|
|
2258
|
-
type:
|
|
2229
|
+
), $ = K(() => T.isLoading ? null : Ut(M, T), [M, T]), l = K(() => $ ? y || Ht(T, S.zoneRoots) : null, [$, y, T, S.zoneRoots]), U = K(() => !$ || !l ? null : {
|
|
2230
|
+
type: $,
|
|
2259
2231
|
required: {
|
|
2260
2232
|
tenant: M.tenant,
|
|
2261
2233
|
auth: M.auth,
|
|
@@ -2263,40 +2235,40 @@ const de = ({
|
|
|
2263
2235
|
permissions: M.permissions
|
|
2264
2236
|
},
|
|
2265
2237
|
current: {
|
|
2266
|
-
hasTenant:
|
|
2267
|
-
isAuthenticated:
|
|
2268
|
-
userType:
|
|
2269
|
-
permissions:
|
|
2238
|
+
hasTenant: T.hasTenant,
|
|
2239
|
+
isAuthenticated: T.isAuthenticated,
|
|
2240
|
+
userType: T.userType,
|
|
2241
|
+
permissions: T.permissions
|
|
2270
2242
|
},
|
|
2271
|
-
redirectTo:
|
|
2272
|
-
}, [
|
|
2273
|
-
if (
|
|
2274
|
-
U && (
|
|
2275
|
-
}, [U,
|
|
2276
|
-
U &&
|
|
2243
|
+
redirectTo: l
|
|
2244
|
+
}, [$, l, M, T]);
|
|
2245
|
+
if (re(() => {
|
|
2246
|
+
U && (w ? w(U) : S.onAccessDenied && S.onAccessDenied(U));
|
|
2247
|
+
}, [U, w, S]), re(() => {
|
|
2248
|
+
U && p && Ot(p, h.pathname + h.search, S.returnToStorage);
|
|
2277
2249
|
}, [
|
|
2278
2250
|
U,
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
]),
|
|
2284
|
-
return /* @__PURE__ */ s(_, { children:
|
|
2285
|
-
if (U &&
|
|
2286
|
-
const
|
|
2287
|
-
if (
|
|
2288
|
-
return /* @__PURE__ */ s(_, { children:
|
|
2289
|
-
const
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2251
|
+
p,
|
|
2252
|
+
h.pathname,
|
|
2253
|
+
h.search,
|
|
2254
|
+
S.returnToStorage
|
|
2255
|
+
]), T.isLoading)
|
|
2256
|
+
return /* @__PURE__ */ s(_, { children: f ?? S.loadingFallback ?? null });
|
|
2257
|
+
if (U && l) {
|
|
2258
|
+
const b = x ?? S.accessDeniedFallback;
|
|
2259
|
+
if (b)
|
|
2260
|
+
return /* @__PURE__ */ s(_, { children: b });
|
|
2261
|
+
const L = Bt(
|
|
2262
|
+
l,
|
|
2263
|
+
p,
|
|
2264
|
+
h.pathname + h.search,
|
|
2265
|
+
S.returnToParam,
|
|
2266
|
+
S.returnToStorage
|
|
2295
2267
|
);
|
|
2296
|
-
return /* @__PURE__ */ s(
|
|
2268
|
+
return /* @__PURE__ */ s(ve, { to: L, replace: !0 });
|
|
2297
2269
|
}
|
|
2298
2270
|
return /* @__PURE__ */ s(_, { children: n });
|
|
2299
|
-
},
|
|
2271
|
+
}, Mr = (n) => /* @__PURE__ */ s(ce, { tenant: "required", ...n }), Lr = (n) => /* @__PURE__ */ s(ce, { tenant: "forbidden", ...n }), Nr = (n) => /* @__PURE__ */ s(ce, { auth: "required", ...n }), Dr = (n) => /* @__PURE__ */ s(ce, { auth: "forbidden", ...n }), Fr = (n) => /* @__PURE__ */ s(ce, { auth: "required", userType: oe.TENANT_ADMIN, ...n }), Cr = (n) => /* @__PURE__ */ s(ce, { auth: "required", userType: oe.USER, ...n }), $r = (n) => /* @__PURE__ */ s(ce, { tenant: "optional", auth: "optional", ...n }), Ur = (n) => /* @__PURE__ */ s(ce, { tenant: "required", auth: "required", ...n }), Hr = (n) => /* @__PURE__ */ s(ce, { tenant: "required", auth: "optional", ...n }), Br = (n) => /* @__PURE__ */ s(ce, { tenant: "required", auth: "forbidden", ...n }), qt = () => /* @__PURE__ */ d(
|
|
2300
2272
|
"div",
|
|
2301
2273
|
{
|
|
2302
2274
|
style: {
|
|
@@ -2315,12 +2287,12 @@ const de = ({
|
|
|
2315
2287
|
);
|
|
2316
2288
|
function Or({
|
|
2317
2289
|
children: n,
|
|
2318
|
-
fallback: e = /* @__PURE__ */ s(
|
|
2290
|
+
fallback: e = /* @__PURE__ */ s(qt, {}),
|
|
2319
2291
|
allowedPlans: t,
|
|
2320
2292
|
requiredFeature: r
|
|
2321
2293
|
}) {
|
|
2322
|
-
const { subscription: i, hasAllowedPlan: o, isFeatureEnabled: a, loading:
|
|
2323
|
-
return
|
|
2294
|
+
const { subscription: i, hasAllowedPlan: o, isFeatureEnabled: a, loading: p } = It();
|
|
2295
|
+
return p ? /* @__PURE__ */ s(
|
|
2324
2296
|
"div",
|
|
2325
2297
|
{
|
|
2326
2298
|
style: {
|
|
@@ -2332,7 +2304,7 @@ function Or({
|
|
|
2332
2304
|
}
|
|
2333
2305
|
) : i ? i.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ s(_, { children: e }) : r && !a(r) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: n }) : /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: e });
|
|
2334
2306
|
}
|
|
2335
|
-
const
|
|
2307
|
+
const zt = ({ flagName: n }) => /* @__PURE__ */ d(
|
|
2336
2308
|
"div",
|
|
2337
2309
|
{
|
|
2338
2310
|
style: {
|
|
@@ -2359,8 +2331,8 @@ const Wt = ({ flagName: n }) => /* @__PURE__ */ d(
|
|
|
2359
2331
|
]
|
|
2360
2332
|
}
|
|
2361
2333
|
);
|
|
2362
|
-
function
|
|
2363
|
-
const { isEnabled: r, loading: i } =
|
|
2334
|
+
function qr({ name: n, children: e, fallback: t }) {
|
|
2335
|
+
const { isEnabled: r, loading: i } = Rt();
|
|
2364
2336
|
return i ? /* @__PURE__ */ s(
|
|
2365
2337
|
"div",
|
|
2366
2338
|
{
|
|
@@ -2374,9 +2346,9 @@ function zr({ name: n, children: e, fallback: t }) {
|
|
|
2374
2346
|
},
|
|
2375
2347
|
children: "Loading feature flags..."
|
|
2376
2348
|
}
|
|
2377
|
-
) : r(n) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: t || /* @__PURE__ */ s(
|
|
2349
|
+
) : r(n) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: t || /* @__PURE__ */ s(zt, { flagName: n }) });
|
|
2378
2350
|
}
|
|
2379
|
-
const
|
|
2351
|
+
const _t = () => /* @__PURE__ */ d(
|
|
2380
2352
|
"svg",
|
|
2381
2353
|
{
|
|
2382
2354
|
width: "16",
|
|
@@ -2393,7 +2365,7 @@ const Vt = () => /* @__PURE__ */ d(
|
|
|
2393
2365
|
/* @__PURE__ */ s("circle", { cx: "12", cy: "12", r: "3" })
|
|
2394
2366
|
]
|
|
2395
2367
|
}
|
|
2396
|
-
),
|
|
2368
|
+
), Wt = () => /* @__PURE__ */ d(
|
|
2397
2369
|
"svg",
|
|
2398
2370
|
{
|
|
2399
2371
|
width: "16",
|
|
@@ -2410,10 +2382,10 @@ const Vt = () => /* @__PURE__ */ d(
|
|
|
2410
2382
|
/* @__PURE__ */ s("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2411
2383
|
]
|
|
2412
2384
|
}
|
|
2413
|
-
),
|
|
2414
|
-
showPassword: /* @__PURE__ */ s(
|
|
2415
|
-
hidePassword: /* @__PURE__ */ s(
|
|
2416
|
-
},
|
|
2385
|
+
), Vt = {
|
|
2386
|
+
showPassword: /* @__PURE__ */ s(_t, {}),
|
|
2387
|
+
hidePassword: /* @__PURE__ */ s(Wt, {})
|
|
2388
|
+
}, jt = {
|
|
2417
2389
|
title: "Sign In",
|
|
2418
2390
|
usernameLabel: "Email or Phone",
|
|
2419
2391
|
usernamePlaceholder: "Enter your email or phone number",
|
|
@@ -2426,8 +2398,12 @@ const Vt = () => /* @__PURE__ */ d(
|
|
|
2426
2398
|
magicLinkText: "Prefer passwordless?",
|
|
2427
2399
|
magicLinkLink: "Use Magic Link",
|
|
2428
2400
|
errorMessage: "Invalid credentials",
|
|
2429
|
-
loadingText: "Signing in..."
|
|
2430
|
-
|
|
2401
|
+
loadingText: "Signing in...",
|
|
2402
|
+
tenantNotFoundError: "Tenant not found",
|
|
2403
|
+
dividerBullet: "•",
|
|
2404
|
+
showPasswordAriaLabel: "Show password",
|
|
2405
|
+
hidePasswordAriaLabel: "Hide password"
|
|
2406
|
+
}, Gt = {
|
|
2431
2407
|
container: {
|
|
2432
2408
|
maxWidth: "400px",
|
|
2433
2409
|
width: "100%",
|
|
@@ -2532,9 +2508,12 @@ const Vt = () => /* @__PURE__ */ d(
|
|
|
2532
2508
|
margin: "0.5rem 0",
|
|
2533
2509
|
color: "#6b7280",
|
|
2534
2510
|
fontSize: "0.875rem"
|
|
2511
|
+
},
|
|
2512
|
+
inputWithIcon: {
|
|
2513
|
+
paddingRight: "2.5rem"
|
|
2535
2514
|
}
|
|
2536
2515
|
};
|
|
2537
|
-
function
|
|
2516
|
+
function zr({
|
|
2538
2517
|
copy: n = {},
|
|
2539
2518
|
styles: e = {},
|
|
2540
2519
|
icons: t = {},
|
|
@@ -2542,83 +2521,82 @@ function _r({
|
|
|
2542
2521
|
onError: i,
|
|
2543
2522
|
onForgotPassword: o,
|
|
2544
2523
|
onSignupClick: a,
|
|
2545
|
-
onMagicLinkClick:
|
|
2546
|
-
showForgotPassword:
|
|
2547
|
-
showSignupLink:
|
|
2548
|
-
showMagicLinkOption:
|
|
2549
|
-
className:
|
|
2524
|
+
onMagicLinkClick: p,
|
|
2525
|
+
showForgotPassword: w = !0,
|
|
2526
|
+
showSignupLink: y = !0,
|
|
2527
|
+
showMagicLinkOption: f = !0,
|
|
2528
|
+
className: x
|
|
2550
2529
|
}) {
|
|
2551
|
-
const [
|
|
2552
|
-
const
|
|
2553
|
-
return
|
|
2554
|
-
},
|
|
2555
|
-
if (
|
|
2530
|
+
const [h, R] = k(""), [N, D] = k(""), [E, P] = k(!1), [u, S] = k(!1), [C, M] = k(""), [T, $] = k({}), { login: l } = ue(), { tenant: U } = me(), b = { ...jt, ...n }, L = { ...Gt, ...e }, F = { ...Vt, ...t }, c = () => {
|
|
2531
|
+
const m = {};
|
|
2532
|
+
return h.trim() || (m.username = !0), N.trim() || (m.password = !0), $(m), Object.keys(m).length === 0;
|
|
2533
|
+
}, H = async (m) => {
|
|
2534
|
+
if (m.preventDefault(), !!c()) {
|
|
2556
2535
|
if (!(U != null && U.id)) {
|
|
2557
|
-
M(
|
|
2536
|
+
M(b.tenantNotFoundError);
|
|
2558
2537
|
return;
|
|
2559
2538
|
}
|
|
2560
|
-
|
|
2539
|
+
S(!0), M("");
|
|
2561
2540
|
try {
|
|
2562
|
-
const v = await
|
|
2563
|
-
username:
|
|
2564
|
-
password:
|
|
2541
|
+
const v = await l({
|
|
2542
|
+
username: h,
|
|
2543
|
+
password: N
|
|
2565
2544
|
// tenantId inferred from context automatically
|
|
2566
2545
|
});
|
|
2567
2546
|
r == null || r(v);
|
|
2568
2547
|
} catch (v) {
|
|
2569
|
-
const
|
|
2570
|
-
M(
|
|
2548
|
+
const Q = v.message || b.errorMessage;
|
|
2549
|
+
M(Q), i == null || i(Q);
|
|
2571
2550
|
} finally {
|
|
2572
|
-
|
|
2551
|
+
S(!1);
|
|
2573
2552
|
}
|
|
2574
2553
|
}
|
|
2575
|
-
},
|
|
2576
|
-
...
|
|
2577
|
-
...
|
|
2578
|
-
}),
|
|
2579
|
-
...
|
|
2580
|
-
...u ?
|
|
2581
|
-
...!
|
|
2554
|
+
}, I = (m) => ({
|
|
2555
|
+
...L.input,
|
|
2556
|
+
...T[m] ? L.inputError : {}
|
|
2557
|
+
}), g = () => ({
|
|
2558
|
+
...L.button,
|
|
2559
|
+
...u ? L.buttonLoading : {},
|
|
2560
|
+
...!h || !N || u ? L.buttonDisabled : {}
|
|
2582
2561
|
});
|
|
2583
|
-
return /* @__PURE__ */ d("div", { className:
|
|
2584
|
-
/* @__PURE__ */ s("h2", { style:
|
|
2585
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
2586
|
-
/* @__PURE__ */ d("div", { style:
|
|
2587
|
-
/* @__PURE__ */ s("label", { style:
|
|
2562
|
+
return /* @__PURE__ */ d("div", { className: x, style: L.container, children: [
|
|
2563
|
+
/* @__PURE__ */ s("h2", { style: L.title, children: b.title }),
|
|
2564
|
+
/* @__PURE__ */ d("form", { onSubmit: H, style: L.form, children: [
|
|
2565
|
+
/* @__PURE__ */ d("div", { style: L.fieldGroup, children: [
|
|
2566
|
+
/* @__PURE__ */ s("label", { style: L.label, children: b.usernameLabel }),
|
|
2588
2567
|
/* @__PURE__ */ s(
|
|
2589
2568
|
"input",
|
|
2590
2569
|
{
|
|
2591
2570
|
id: "username",
|
|
2592
2571
|
name: "username",
|
|
2593
2572
|
type: "text",
|
|
2594
|
-
value:
|
|
2595
|
-
onChange: (
|
|
2596
|
-
|
|
2573
|
+
value: h,
|
|
2574
|
+
onChange: (m) => {
|
|
2575
|
+
R(m.target.value), T.username && $((v) => ({ ...v, username: !1 }));
|
|
2597
2576
|
},
|
|
2598
|
-
placeholder:
|
|
2599
|
-
style:
|
|
2577
|
+
placeholder: b.usernamePlaceholder,
|
|
2578
|
+
style: I("username"),
|
|
2600
2579
|
disabled: u
|
|
2601
2580
|
}
|
|
2602
2581
|
)
|
|
2603
2582
|
] }),
|
|
2604
|
-
/* @__PURE__ */ d("div", { style:
|
|
2605
|
-
/* @__PURE__ */ s("label", { style:
|
|
2606
|
-
/* @__PURE__ */ d("div", { style:
|
|
2583
|
+
/* @__PURE__ */ d("div", { style: L.fieldGroup, children: [
|
|
2584
|
+
/* @__PURE__ */ s("label", { style: L.label, children: b.passwordLabel }),
|
|
2585
|
+
/* @__PURE__ */ d("div", { style: L.inputContainer, children: [
|
|
2607
2586
|
/* @__PURE__ */ s(
|
|
2608
2587
|
"input",
|
|
2609
2588
|
{
|
|
2610
2589
|
id: "password",
|
|
2611
2590
|
name: "password",
|
|
2612
2591
|
type: E ? "text" : "password",
|
|
2613
|
-
value:
|
|
2614
|
-
onChange: (
|
|
2615
|
-
|
|
2592
|
+
value: N,
|
|
2593
|
+
onChange: (m) => {
|
|
2594
|
+
D(m.target.value), T.password && $((v) => ({ ...v, password: !1 }));
|
|
2616
2595
|
},
|
|
2617
|
-
placeholder:
|
|
2596
|
+
placeholder: b.passwordPlaceholder,
|
|
2618
2597
|
style: {
|
|
2619
|
-
...
|
|
2620
|
-
|
|
2621
|
-
// Make room for the icon
|
|
2598
|
+
...I("password"),
|
|
2599
|
+
...L.inputWithIcon
|
|
2622
2600
|
},
|
|
2623
2601
|
disabled: u
|
|
2624
2602
|
}
|
|
@@ -2627,40 +2605,40 @@ function _r({
|
|
|
2627
2605
|
"button",
|
|
2628
2606
|
{
|
|
2629
2607
|
type: "button",
|
|
2630
|
-
onClick: () =>
|
|
2631
|
-
style:
|
|
2608
|
+
onClick: () => P(!E),
|
|
2609
|
+
style: L.passwordToggle,
|
|
2632
2610
|
disabled: u,
|
|
2633
|
-
"aria-label": E ?
|
|
2634
|
-
children: E ?
|
|
2611
|
+
"aria-label": E ? b.hidePasswordAriaLabel : b.showPasswordAriaLabel,
|
|
2612
|
+
children: E ? F.hidePassword : F.showPassword
|
|
2635
2613
|
}
|
|
2636
2614
|
)
|
|
2637
2615
|
] })
|
|
2638
2616
|
] }),
|
|
2639
|
-
/* @__PURE__ */ s("button", { type: "submit", disabled: !
|
|
2640
|
-
|
|
2617
|
+
/* @__PURE__ */ s("button", { type: "submit", disabled: !h || !N || u, style: g(), children: u ? b.loadingText : b.submitButton }),
|
|
2618
|
+
C && /* @__PURE__ */ s("div", { style: L.errorText, children: C })
|
|
2641
2619
|
] }),
|
|
2642
|
-
(
|
|
2643
|
-
|
|
2644
|
-
/* @__PURE__ */ d("span", { style:
|
|
2645
|
-
|
|
2620
|
+
(w || y || f) && /* @__PURE__ */ d("div", { style: L.linkContainer, children: [
|
|
2621
|
+
f && /* @__PURE__ */ d("div", { children: [
|
|
2622
|
+
/* @__PURE__ */ d("span", { style: L.divider, children: [
|
|
2623
|
+
b.magicLinkText,
|
|
2646
2624
|
" "
|
|
2647
2625
|
] }),
|
|
2648
|
-
/* @__PURE__ */ s("a", { onClick:
|
|
2626
|
+
/* @__PURE__ */ s("a", { onClick: p, style: L.link, children: b.magicLinkLink })
|
|
2649
2627
|
] }),
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
/* @__PURE__ */ d("span", { style:
|
|
2655
|
-
|
|
2628
|
+
f && (w || y) && /* @__PURE__ */ s("div", { style: L.divider, children: b.dividerBullet }),
|
|
2629
|
+
w && /* @__PURE__ */ s("a", { onClick: o, style: L.link, children: b.forgotPasswordLink }),
|
|
2630
|
+
w && y && /* @__PURE__ */ s("div", { style: L.divider, children: b.dividerBullet }),
|
|
2631
|
+
y && /* @__PURE__ */ d("div", { children: [
|
|
2632
|
+
/* @__PURE__ */ d("span", { style: L.divider, children: [
|
|
2633
|
+
b.signupText,
|
|
2656
2634
|
" "
|
|
2657
2635
|
] }),
|
|
2658
|
-
/* @__PURE__ */ s("a", { onClick: a, style:
|
|
2636
|
+
/* @__PURE__ */ s("a", { onClick: a, style: L.link, children: b.signupLink })
|
|
2659
2637
|
] })
|
|
2660
2638
|
] })
|
|
2661
2639
|
] });
|
|
2662
2640
|
}
|
|
2663
|
-
const
|
|
2641
|
+
const Qt = {
|
|
2664
2642
|
title: "Create Account",
|
|
2665
2643
|
nameLabel: "First Name",
|
|
2666
2644
|
namePlaceholder: "Enter your first name",
|
|
@@ -2685,8 +2663,11 @@ const Zt = {
|
|
|
2685
2663
|
loadingText: "Creating account...",
|
|
2686
2664
|
passwordMismatchError: "Passwords do not match",
|
|
2687
2665
|
isAdminLabel: "Create new organization",
|
|
2688
|
-
isAdminDescription: "Check this if you want to create a new organization"
|
|
2689
|
-
|
|
2666
|
+
isAdminDescription: "Check this if you want to create a new organization",
|
|
2667
|
+
contactMethodHint: "At least one contact method (email or phone) is required",
|
|
2668
|
+
tenantNotFoundError: "Tenant not found",
|
|
2669
|
+
dividerBullet: "•"
|
|
2670
|
+
}, Kt = {
|
|
2690
2671
|
container: {
|
|
2691
2672
|
maxWidth: "400px",
|
|
2692
2673
|
width: "100%",
|
|
@@ -2783,9 +2764,15 @@ const Zt = {
|
|
|
2783
2764
|
margin: "0.5rem 0",
|
|
2784
2765
|
color: "#6b7280",
|
|
2785
2766
|
fontSize: "0.875rem"
|
|
2767
|
+
},
|
|
2768
|
+
hintText: {
|
|
2769
|
+
fontSize: "0.875rem",
|
|
2770
|
+
color: "#6b7280",
|
|
2771
|
+
textAlign: "center",
|
|
2772
|
+
margin: "0.5rem 0"
|
|
2786
2773
|
}
|
|
2787
2774
|
};
|
|
2788
|
-
function
|
|
2775
|
+
function _r({
|
|
2789
2776
|
copy: n = {},
|
|
2790
2777
|
styles: e = {},
|
|
2791
2778
|
signupType: t = "user",
|
|
@@ -2793,113 +2780,113 @@ function Wr({
|
|
|
2793
2780
|
onError: i,
|
|
2794
2781
|
onLoginClick: o,
|
|
2795
2782
|
onMagicLinkClick: a,
|
|
2796
|
-
showLoginLink:
|
|
2797
|
-
showMagicLinkOption:
|
|
2798
|
-
className:
|
|
2783
|
+
showLoginLink: p = !0,
|
|
2784
|
+
showMagicLinkOption: w = !0,
|
|
2785
|
+
className: y
|
|
2799
2786
|
}) {
|
|
2800
|
-
const [
|
|
2801
|
-
const
|
|
2802
|
-
return
|
|
2803
|
-
},
|
|
2804
|
-
if (
|
|
2805
|
-
if (u !==
|
|
2806
|
-
|
|
2787
|
+
const [f, x] = k(""), [h, R] = k(""), [N, D] = k(""), [E, P] = k(""), [u, S] = k(""), [C, M] = k(""), [T, $] = k(""), [l, U] = k(!1), [b, L] = k(""), [F, c] = k({}), { signup: H, signupTenantAdmin: I } = ue(), { tenant: g } = me(), m = { ...Qt, ...n }, v = { ...Kt, ...e }, Q = () => {
|
|
2788
|
+
const A = {};
|
|
2789
|
+
return f.trim() || (A.name = !0), !N.trim() && !E.trim() && (A.email = !0, A.phoneNumber = !0), u.trim() || (A.password = !0), C.trim() || (A.confirmPassword = !0), t === "tenant" && !T.trim() && (A.tenantName = !0), c(A), Object.keys(A).length === 0;
|
|
2790
|
+
}, J = async (A) => {
|
|
2791
|
+
if (A.preventDefault(), !!Q()) {
|
|
2792
|
+
if (u !== C) {
|
|
2793
|
+
L(m.passwordMismatchError), c({ confirmPassword: !0 });
|
|
2807
2794
|
return;
|
|
2808
2795
|
}
|
|
2809
|
-
if (t === "user" && !(
|
|
2810
|
-
|
|
2796
|
+
if (t === "user" && !(g != null && g.id)) {
|
|
2797
|
+
L(m.tenantNotFoundError);
|
|
2811
2798
|
return;
|
|
2812
2799
|
}
|
|
2813
|
-
U(!0),
|
|
2800
|
+
U(!0), L("");
|
|
2814
2801
|
try {
|
|
2815
|
-
let
|
|
2816
|
-
t === "tenant" ?
|
|
2817
|
-
email:
|
|
2802
|
+
let V;
|
|
2803
|
+
t === "tenant" ? V = await I({
|
|
2804
|
+
email: N || void 0,
|
|
2818
2805
|
phoneNumber: E || void 0,
|
|
2819
|
-
name:
|
|
2806
|
+
name: f,
|
|
2820
2807
|
password: u,
|
|
2821
|
-
tenantName:
|
|
2822
|
-
lastName:
|
|
2823
|
-
}) :
|
|
2824
|
-
email:
|
|
2808
|
+
tenantName: T,
|
|
2809
|
+
lastName: h || void 0
|
|
2810
|
+
}) : V = await H({
|
|
2811
|
+
email: N || void 0,
|
|
2825
2812
|
phoneNumber: E || void 0,
|
|
2826
|
-
name:
|
|
2813
|
+
name: f,
|
|
2827
2814
|
password: u,
|
|
2828
|
-
tenantId:
|
|
2829
|
-
lastName:
|
|
2830
|
-
}), r == null || r(
|
|
2831
|
-
} catch (
|
|
2832
|
-
const
|
|
2833
|
-
|
|
2815
|
+
tenantId: g.id,
|
|
2816
|
+
lastName: h || void 0
|
|
2817
|
+
}), r == null || r(V);
|
|
2818
|
+
} catch (V) {
|
|
2819
|
+
const de = V.message || m.errorMessage;
|
|
2820
|
+
L(de), i == null || i(de);
|
|
2834
2821
|
} finally {
|
|
2835
2822
|
U(!1);
|
|
2836
2823
|
}
|
|
2837
2824
|
}
|
|
2838
|
-
}, O = (
|
|
2825
|
+
}, O = (A) => ({
|
|
2839
2826
|
...v.input,
|
|
2840
|
-
...
|
|
2827
|
+
...F[A] ? v.inputError : {}
|
|
2841
2828
|
}), q = () => ({
|
|
2842
2829
|
...v.button,
|
|
2843
|
-
...
|
|
2844
|
-
...!
|
|
2845
|
-
}),
|
|
2846
|
-
return /* @__PURE__ */ d("div", { className:
|
|
2847
|
-
/* @__PURE__ */ s("h2", { style: v.title, children:
|
|
2848
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
2830
|
+
...l ? v.buttonLoading : {},
|
|
2831
|
+
...!f || !N && !E || !u || !C || l || t === "tenant" && !T ? v.buttonDisabled : {}
|
|
2832
|
+
}), j = f && (N || E) && u && C && (t === "user" || T);
|
|
2833
|
+
return /* @__PURE__ */ d("div", { className: y, style: v.container, children: [
|
|
2834
|
+
/* @__PURE__ */ s("h2", { style: v.title, children: m.title }),
|
|
2835
|
+
/* @__PURE__ */ d("form", { onSubmit: J, style: v.form, children: [
|
|
2849
2836
|
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2850
|
-
/* @__PURE__ */ s("label", { style: v.label, children:
|
|
2837
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.nameLabel }),
|
|
2851
2838
|
/* @__PURE__ */ s(
|
|
2852
2839
|
"input",
|
|
2853
2840
|
{
|
|
2854
2841
|
id: "name",
|
|
2855
2842
|
name: "name",
|
|
2856
2843
|
type: "text",
|
|
2857
|
-
value:
|
|
2858
|
-
onChange: (
|
|
2859
|
-
|
|
2844
|
+
value: f,
|
|
2845
|
+
onChange: (A) => {
|
|
2846
|
+
x(A.target.value), F.name && c((V) => ({ ...V, name: !1 }));
|
|
2860
2847
|
},
|
|
2861
|
-
placeholder:
|
|
2848
|
+
placeholder: m.namePlaceholder,
|
|
2862
2849
|
style: O("name"),
|
|
2863
|
-
disabled:
|
|
2850
|
+
disabled: l
|
|
2864
2851
|
}
|
|
2865
2852
|
)
|
|
2866
2853
|
] }),
|
|
2867
2854
|
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2868
|
-
/* @__PURE__ */ s("label", { style: v.label, children:
|
|
2855
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.lastNameLabel }),
|
|
2869
2856
|
/* @__PURE__ */ s(
|
|
2870
2857
|
"input",
|
|
2871
2858
|
{
|
|
2872
2859
|
id: "lastName",
|
|
2873
2860
|
name: "lastName",
|
|
2874
2861
|
type: "text",
|
|
2875
|
-
value:
|
|
2876
|
-
onChange: (
|
|
2877
|
-
placeholder:
|
|
2862
|
+
value: h,
|
|
2863
|
+
onChange: (A) => R(A.target.value),
|
|
2864
|
+
placeholder: m.lastNamePlaceholder,
|
|
2878
2865
|
style: v.input,
|
|
2879
|
-
disabled:
|
|
2866
|
+
disabled: l
|
|
2880
2867
|
}
|
|
2881
2868
|
)
|
|
2882
2869
|
] }),
|
|
2883
2870
|
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2884
|
-
/* @__PURE__ */ s("label", { style: v.label, children:
|
|
2871
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.emailLabel }),
|
|
2885
2872
|
/* @__PURE__ */ s(
|
|
2886
2873
|
"input",
|
|
2887
2874
|
{
|
|
2888
2875
|
id: "email",
|
|
2889
2876
|
name: "email",
|
|
2890
2877
|
type: "email",
|
|
2891
|
-
value:
|
|
2892
|
-
onChange: (
|
|
2893
|
-
|
|
2878
|
+
value: N,
|
|
2879
|
+
onChange: (A) => {
|
|
2880
|
+
D(A.target.value), F.email && c((V) => ({ ...V, email: !1, phoneNumber: !1 }));
|
|
2894
2881
|
},
|
|
2895
|
-
placeholder:
|
|
2882
|
+
placeholder: m.emailPlaceholder,
|
|
2896
2883
|
style: O("email"),
|
|
2897
|
-
disabled:
|
|
2884
|
+
disabled: l
|
|
2898
2885
|
}
|
|
2899
2886
|
)
|
|
2900
2887
|
] }),
|
|
2901
2888
|
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2902
|
-
/* @__PURE__ */ s("label", { style: v.label, children:
|
|
2889
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.phoneNumberLabel }),
|
|
2903
2890
|
/* @__PURE__ */ s(
|
|
2904
2891
|
"input",
|
|
2905
2892
|
{
|
|
@@ -2907,29 +2894,18 @@ function Wr({
|
|
|
2907
2894
|
name: "phoneNumber",
|
|
2908
2895
|
type: "tel",
|
|
2909
2896
|
value: E,
|
|
2910
|
-
onChange: (
|
|
2911
|
-
A
|
|
2897
|
+
onChange: (A) => {
|
|
2898
|
+
P(A.target.value), F.phoneNumber && c((V) => ({ ...V, email: !1, phoneNumber: !1 }));
|
|
2912
2899
|
},
|
|
2913
|
-
placeholder:
|
|
2900
|
+
placeholder: m.phoneNumberPlaceholder,
|
|
2914
2901
|
style: O("phoneNumber"),
|
|
2915
|
-
disabled:
|
|
2902
|
+
disabled: l
|
|
2916
2903
|
}
|
|
2917
2904
|
)
|
|
2918
2905
|
] }),
|
|
2919
|
-
/* @__PURE__ */ s(
|
|
2920
|
-
"div",
|
|
2921
|
-
{
|
|
2922
|
-
style: {
|
|
2923
|
-
fontSize: "0.875rem",
|
|
2924
|
-
color: "#6b7280",
|
|
2925
|
-
textAlign: "center",
|
|
2926
|
-
margin: "0.5rem 0"
|
|
2927
|
-
},
|
|
2928
|
-
children: "At least one contact method (email or phone) is required"
|
|
2929
|
-
}
|
|
2930
|
-
),
|
|
2906
|
+
/* @__PURE__ */ s("div", { style: v.hintText, children: m.contactMethodHint }),
|
|
2931
2907
|
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2932
|
-
/* @__PURE__ */ s("label", { style: v.label, children:
|
|
2908
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.passwordLabel }),
|
|
2933
2909
|
/* @__PURE__ */ s(
|
|
2934
2910
|
"input",
|
|
2935
2911
|
{
|
|
@@ -2937,74 +2913,74 @@ function Wr({
|
|
|
2937
2913
|
name: "password",
|
|
2938
2914
|
type: "password",
|
|
2939
2915
|
value: u,
|
|
2940
|
-
onChange: (
|
|
2941
|
-
|
|
2916
|
+
onChange: (A) => {
|
|
2917
|
+
S(A.target.value), F.password && c((V) => ({ ...V, password: !1 }));
|
|
2942
2918
|
},
|
|
2943
|
-
placeholder:
|
|
2919
|
+
placeholder: m.passwordPlaceholder,
|
|
2944
2920
|
style: O("password"),
|
|
2945
|
-
disabled:
|
|
2921
|
+
disabled: l
|
|
2946
2922
|
}
|
|
2947
2923
|
)
|
|
2948
2924
|
] }),
|
|
2949
2925
|
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2950
|
-
/* @__PURE__ */ s("label", { style: v.label, children:
|
|
2926
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.confirmPasswordLabel }),
|
|
2951
2927
|
/* @__PURE__ */ s(
|
|
2952
2928
|
"input",
|
|
2953
2929
|
{
|
|
2954
2930
|
id: "confirmPassword",
|
|
2955
2931
|
name: "confirmPassword",
|
|
2956
2932
|
type: "password",
|
|
2957
|
-
value:
|
|
2958
|
-
onChange: (
|
|
2959
|
-
M(
|
|
2933
|
+
value: C,
|
|
2934
|
+
onChange: (A) => {
|
|
2935
|
+
M(A.target.value), F.confirmPassword && c((V) => ({ ...V, confirmPassword: !1 })), b === m.passwordMismatchError && L("");
|
|
2960
2936
|
},
|
|
2961
|
-
placeholder:
|
|
2937
|
+
placeholder: m.confirmPasswordPlaceholder,
|
|
2962
2938
|
style: O("confirmPassword"),
|
|
2963
|
-
disabled:
|
|
2939
|
+
disabled: l
|
|
2964
2940
|
}
|
|
2965
2941
|
)
|
|
2966
2942
|
] }),
|
|
2967
2943
|
t === "tenant" && /* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2968
|
-
/* @__PURE__ */ s("label", { style: v.label, children:
|
|
2944
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.tenantNameLabel }),
|
|
2969
2945
|
/* @__PURE__ */ s(
|
|
2970
2946
|
"input",
|
|
2971
2947
|
{
|
|
2972
2948
|
id: "tenantName",
|
|
2973
2949
|
name: "tenantName",
|
|
2974
2950
|
type: "text",
|
|
2975
|
-
value:
|
|
2976
|
-
onChange: (
|
|
2977
|
-
|
|
2951
|
+
value: T,
|
|
2952
|
+
onChange: (A) => {
|
|
2953
|
+
$(A.target.value), F.tenantName && c((V) => ({ ...V, tenantName: !1 }));
|
|
2978
2954
|
},
|
|
2979
|
-
placeholder:
|
|
2955
|
+
placeholder: m.tenantNamePlaceholder,
|
|
2980
2956
|
style: O("tenantName"),
|
|
2981
|
-
disabled:
|
|
2957
|
+
disabled: l
|
|
2982
2958
|
}
|
|
2983
2959
|
)
|
|
2984
2960
|
] }),
|
|
2985
|
-
/* @__PURE__ */ s("button", { type: "submit", disabled: !
|
|
2986
|
-
|
|
2961
|
+
/* @__PURE__ */ s("button", { type: "submit", disabled: !j || l, style: q(), children: l ? m.loadingText : m.submitButton }),
|
|
2962
|
+
b && /* @__PURE__ */ s("div", { style: v.errorText, children: b })
|
|
2987
2963
|
] }),
|
|
2988
|
-
(
|
|
2989
|
-
|
|
2964
|
+
(p || w) && /* @__PURE__ */ d("div", { style: v.linkContainer, children: [
|
|
2965
|
+
w && /* @__PURE__ */ d("div", { children: [
|
|
2990
2966
|
/* @__PURE__ */ d("span", { style: v.divider, children: [
|
|
2991
|
-
|
|
2967
|
+
m.magicLinkText,
|
|
2992
2968
|
" "
|
|
2993
2969
|
] }),
|
|
2994
|
-
/* @__PURE__ */ s("a", { onClick: a, style: v.link, children:
|
|
2970
|
+
/* @__PURE__ */ s("a", { onClick: a, style: v.link, children: m.magicLinkLink })
|
|
2995
2971
|
] }),
|
|
2996
|
-
|
|
2997
|
-
|
|
2972
|
+
w && p && /* @__PURE__ */ s("div", { style: v.divider, children: m.dividerBullet }),
|
|
2973
|
+
p && /* @__PURE__ */ d("div", { children: [
|
|
2998
2974
|
/* @__PURE__ */ d("span", { style: v.divider, children: [
|
|
2999
|
-
|
|
2975
|
+
m.loginText,
|
|
3000
2976
|
" "
|
|
3001
2977
|
] }),
|
|
3002
|
-
/* @__PURE__ */ s("a", { onClick: o, style: v.link, children:
|
|
2978
|
+
/* @__PURE__ */ s("a", { onClick: o, style: v.link, children: m.loginLink })
|
|
3003
2979
|
] })
|
|
3004
2980
|
] })
|
|
3005
2981
|
] });
|
|
3006
2982
|
}
|
|
3007
|
-
const
|
|
2983
|
+
const Zt = {
|
|
3008
2984
|
title: "Sign In with Magic Link",
|
|
3009
2985
|
emailLabel: "Email",
|
|
3010
2986
|
emailPlaceholder: "Enter your email",
|
|
@@ -3021,8 +2997,14 @@ const Yt = {
|
|
|
3021
2997
|
errorMessage: "Failed to send magic link. Please try again.",
|
|
3022
2998
|
loadingText: "Sending magic link...",
|
|
3023
2999
|
verifyingText: "Verifying magic link...",
|
|
3024
|
-
|
|
3025
|
-
|
|
3000
|
+
verifyingDescription: "Please wait while we verify your magic link...",
|
|
3001
|
+
description: "Enter your email to receive a magic link. If you don't have an account, we'll create one for you.",
|
|
3002
|
+
showNameToggle: "New user? Add your name",
|
|
3003
|
+
hideNameToggle: "Existing user? Hide name fields",
|
|
3004
|
+
tenantNotFoundError: "Tenant not found",
|
|
3005
|
+
missingTenantOrEmailError: "Missing tenant or email",
|
|
3006
|
+
dividerBullet: "•"
|
|
3007
|
+
}, Jt = {
|
|
3026
3008
|
container: {
|
|
3027
3009
|
maxWidth: "400px",
|
|
3028
3010
|
width: "100%",
|
|
@@ -3123,9 +3105,29 @@ const Yt = {
|
|
|
3123
3105
|
margin: "0.5rem 0",
|
|
3124
3106
|
color: "#6b7280",
|
|
3125
3107
|
fontSize: "0.875rem"
|
|
3108
|
+
},
|
|
3109
|
+
verifyingContainer: {
|
|
3110
|
+
textAlign: "center",
|
|
3111
|
+
padding: "2rem"
|
|
3112
|
+
},
|
|
3113
|
+
verifyingText: {
|
|
3114
|
+
fontSize: "1rem",
|
|
3115
|
+
color: "#6b7280"
|
|
3116
|
+
},
|
|
3117
|
+
toggleContainer: {
|
|
3118
|
+
textAlign: "center",
|
|
3119
|
+
marginTop: "0.5rem"
|
|
3120
|
+
},
|
|
3121
|
+
toggleLink: {
|
|
3122
|
+
background: "none",
|
|
3123
|
+
border: "none",
|
|
3124
|
+
color: "#3b82f6",
|
|
3125
|
+
fontSize: "0.875rem",
|
|
3126
|
+
cursor: "pointer",
|
|
3127
|
+
textDecoration: "underline"
|
|
3126
3128
|
}
|
|
3127
3129
|
};
|
|
3128
|
-
function
|
|
3130
|
+
function Wr({
|
|
3129
3131
|
copy: n = {},
|
|
3130
3132
|
styles: e = {},
|
|
3131
3133
|
onSuccess: t,
|
|
@@ -3133,194 +3135,181 @@ function Vr({
|
|
|
3133
3135
|
onLoginClick: i,
|
|
3134
3136
|
onSignupClick: o,
|
|
3135
3137
|
showTraditionalLinks: a = !0,
|
|
3136
|
-
className:
|
|
3137
|
-
verifyToken:
|
|
3138
|
-
frontendUrl:
|
|
3138
|
+
className: p,
|
|
3139
|
+
verifyToken: w,
|
|
3140
|
+
frontendUrl: y
|
|
3139
3141
|
}) {
|
|
3140
|
-
const [
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
}, [
|
|
3144
|
-
const
|
|
3145
|
-
if (!
|
|
3146
|
-
M(
|
|
3142
|
+
const [f, x] = k(""), [h, R] = k(""), [N, D] = k(""), [E, P] = k(!1), [u, S] = k(!1), [C, M] = k(""), [T, $] = k(""), [l, U] = k({}), [b, L] = k(!1), { sendMagicLink: F, verifyMagicLink: c } = ue(), { tenant: H } = me(), I = { ...Zt, ...n }, g = { ...Jt, ...e };
|
|
3143
|
+
re(() => {
|
|
3144
|
+
w && m(w);
|
|
3145
|
+
}, [w]);
|
|
3146
|
+
const m = async (q) => {
|
|
3147
|
+
if (!H || !f) {
|
|
3148
|
+
M(I.missingTenantOrEmailError);
|
|
3147
3149
|
return;
|
|
3148
3150
|
}
|
|
3149
|
-
|
|
3151
|
+
S(!0), M("");
|
|
3150
3152
|
try {
|
|
3151
|
-
const
|
|
3153
|
+
const j = await c({
|
|
3152
3154
|
token: q,
|
|
3153
|
-
email:
|
|
3155
|
+
email: f
|
|
3154
3156
|
// tenantId inferred from context automatically
|
|
3155
3157
|
});
|
|
3156
|
-
t == null || t(
|
|
3157
|
-
} catch (
|
|
3158
|
-
const
|
|
3159
|
-
M(
|
|
3158
|
+
t == null || t(j);
|
|
3159
|
+
} catch (j) {
|
|
3160
|
+
const A = j.message || "Failed to verify magic link";
|
|
3161
|
+
M(A), r == null || r(A);
|
|
3160
3162
|
} finally {
|
|
3161
|
-
|
|
3163
|
+
S(!1);
|
|
3162
3164
|
}
|
|
3163
3165
|
}, v = () => {
|
|
3164
3166
|
const q = {};
|
|
3165
|
-
return
|
|
3166
|
-
},
|
|
3167
|
+
return f.trim() || (q.email = !0), b && !h.trim() && (q.name = !0), U(q), Object.keys(q).length === 0;
|
|
3168
|
+
}, Q = async (q) => {
|
|
3167
3169
|
if (q.preventDefault(), !!v()) {
|
|
3168
|
-
if (!(
|
|
3169
|
-
M(
|
|
3170
|
+
if (!(H != null && H.id)) {
|
|
3171
|
+
M(I.tenantNotFoundError);
|
|
3170
3172
|
return;
|
|
3171
3173
|
}
|
|
3172
|
-
|
|
3174
|
+
P(!0), M(""), $("");
|
|
3173
3175
|
try {
|
|
3174
|
-
const
|
|
3175
|
-
email:
|
|
3176
|
-
tenantId:
|
|
3177
|
-
frontendUrl:
|
|
3178
|
-
name:
|
|
3179
|
-
lastName:
|
|
3176
|
+
const j = y || (typeof window < "u" ? window.location.origin : ""), A = await F({
|
|
3177
|
+
email: f,
|
|
3178
|
+
tenantId: H.id,
|
|
3179
|
+
frontendUrl: j,
|
|
3180
|
+
name: b ? h : void 0,
|
|
3181
|
+
lastName: b ? N : void 0
|
|
3180
3182
|
});
|
|
3181
|
-
|
|
3182
|
-
} catch (
|
|
3183
|
-
const
|
|
3184
|
-
M(
|
|
3183
|
+
$(I.successMessage), t == null || t(A);
|
|
3184
|
+
} catch (j) {
|
|
3185
|
+
const A = j.message || I.errorMessage;
|
|
3186
|
+
M(A), r == null || r(A);
|
|
3185
3187
|
} finally {
|
|
3186
|
-
|
|
3188
|
+
P(!1);
|
|
3187
3189
|
}
|
|
3188
3190
|
}
|
|
3189
|
-
},
|
|
3190
|
-
...
|
|
3191
|
-
...
|
|
3191
|
+
}, J = (q) => ({
|
|
3192
|
+
...g.input,
|
|
3193
|
+
...l[q] ? g.inputError : {}
|
|
3192
3194
|
}), O = () => ({
|
|
3193
|
-
...
|
|
3194
|
-
...E || u ?
|
|
3195
|
-
...!
|
|
3195
|
+
...g.button,
|
|
3196
|
+
...E || u ? g.buttonLoading : {},
|
|
3197
|
+
...!f || E || u ? g.buttonDisabled : {}
|
|
3196
3198
|
});
|
|
3197
|
-
return u ? /* @__PURE__ */ d("div", { className:
|
|
3198
|
-
/* @__PURE__ */ s("h2", { style:
|
|
3199
|
-
/* @__PURE__ */ s("div", { style:
|
|
3200
|
-
] }) : /* @__PURE__ */ d("div", { className:
|
|
3201
|
-
/* @__PURE__ */ s("h2", { style:
|
|
3202
|
-
/* @__PURE__ */ s("p", { style:
|
|
3203
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
3204
|
-
/* @__PURE__ */ d("div", { style:
|
|
3205
|
-
/* @__PURE__ */ s("label", { style:
|
|
3199
|
+
return u ? /* @__PURE__ */ d("div", { className: p, style: g.container, children: [
|
|
3200
|
+
/* @__PURE__ */ s("h2", { style: g.title, children: I.verifyingText }),
|
|
3201
|
+
/* @__PURE__ */ s("div", { style: g.verifyingContainer, children: /* @__PURE__ */ s("div", { style: g.verifyingText, children: I.verifyingDescription }) })
|
|
3202
|
+
] }) : /* @__PURE__ */ d("div", { className: p, style: g.container, children: [
|
|
3203
|
+
/* @__PURE__ */ s("h2", { style: g.title, children: I.title }),
|
|
3204
|
+
/* @__PURE__ */ s("p", { style: g.description, children: I.description }),
|
|
3205
|
+
/* @__PURE__ */ d("form", { onSubmit: Q, style: g.form, children: [
|
|
3206
|
+
/* @__PURE__ */ d("div", { style: g.fieldGroup, children: [
|
|
3207
|
+
/* @__PURE__ */ s("label", { style: g.label, children: I.emailLabel }),
|
|
3206
3208
|
/* @__PURE__ */ s(
|
|
3207
3209
|
"input",
|
|
3208
3210
|
{
|
|
3209
3211
|
id: "email",
|
|
3210
3212
|
name: "email",
|
|
3211
3213
|
type: "email",
|
|
3212
|
-
value:
|
|
3214
|
+
value: f,
|
|
3213
3215
|
onChange: (q) => {
|
|
3214
|
-
|
|
3216
|
+
x(q.target.value), l.email && U((j) => ({ ...j, email: !1 }));
|
|
3215
3217
|
},
|
|
3216
|
-
placeholder:
|
|
3217
|
-
style:
|
|
3218
|
+
placeholder: I.emailPlaceholder,
|
|
3219
|
+
style: J("email"),
|
|
3218
3220
|
disabled: E || u
|
|
3219
3221
|
}
|
|
3220
3222
|
)
|
|
3221
3223
|
] }),
|
|
3222
|
-
!
|
|
3224
|
+
!b && /* @__PURE__ */ s("div", { style: g.toggleContainer, children: /* @__PURE__ */ s(
|
|
3223
3225
|
"button",
|
|
3224
3226
|
{
|
|
3225
3227
|
type: "button",
|
|
3226
|
-
onClick: () =>
|
|
3227
|
-
style:
|
|
3228
|
-
|
|
3229
|
-
border: "none",
|
|
3230
|
-
color: "#3b82f6",
|
|
3231
|
-
fontSize: "0.875rem",
|
|
3232
|
-
cursor: "pointer",
|
|
3233
|
-
textDecoration: "underline"
|
|
3234
|
-
},
|
|
3235
|
-
children: "New user? Add your name"
|
|
3228
|
+
onClick: () => L(!0),
|
|
3229
|
+
style: g.toggleLink,
|
|
3230
|
+
children: I.showNameToggle
|
|
3236
3231
|
}
|
|
3237
3232
|
) }),
|
|
3238
|
-
|
|
3239
|
-
/* @__PURE__ */ d("div", { style:
|
|
3240
|
-
/* @__PURE__ */ s("label", { style:
|
|
3233
|
+
b && /* @__PURE__ */ d(_, { children: [
|
|
3234
|
+
/* @__PURE__ */ d("div", { style: g.fieldGroup, children: [
|
|
3235
|
+
/* @__PURE__ */ s("label", { style: g.label, children: I.nameLabel }),
|
|
3241
3236
|
/* @__PURE__ */ s(
|
|
3242
3237
|
"input",
|
|
3243
3238
|
{
|
|
3244
3239
|
id: "name",
|
|
3245
3240
|
name: "name",
|
|
3246
3241
|
type: "text",
|
|
3247
|
-
value:
|
|
3242
|
+
value: h,
|
|
3248
3243
|
onChange: (q) => {
|
|
3249
|
-
|
|
3244
|
+
R(q.target.value), l.name && U((j) => ({ ...j, name: !1 }));
|
|
3250
3245
|
},
|
|
3251
|
-
placeholder:
|
|
3252
|
-
style:
|
|
3246
|
+
placeholder: I.namePlaceholder,
|
|
3247
|
+
style: J("name"),
|
|
3253
3248
|
disabled: E || u
|
|
3254
3249
|
}
|
|
3255
3250
|
)
|
|
3256
3251
|
] }),
|
|
3257
|
-
/* @__PURE__ */ d("div", { style:
|
|
3258
|
-
/* @__PURE__ */ s("label", { style:
|
|
3252
|
+
/* @__PURE__ */ d("div", { style: g.fieldGroup, children: [
|
|
3253
|
+
/* @__PURE__ */ s("label", { style: g.label, children: I.lastNameLabel }),
|
|
3259
3254
|
/* @__PURE__ */ s(
|
|
3260
3255
|
"input",
|
|
3261
3256
|
{
|
|
3262
3257
|
id: "lastName",
|
|
3263
3258
|
name: "lastName",
|
|
3264
3259
|
type: "text",
|
|
3265
|
-
value:
|
|
3266
|
-
onChange: (q) =>
|
|
3267
|
-
placeholder:
|
|
3268
|
-
style:
|
|
3260
|
+
value: N,
|
|
3261
|
+
onChange: (q) => D(q.target.value),
|
|
3262
|
+
placeholder: I.lastNamePlaceholder,
|
|
3263
|
+
style: g.input,
|
|
3269
3264
|
disabled: E || u
|
|
3270
3265
|
}
|
|
3271
3266
|
)
|
|
3272
3267
|
] }),
|
|
3273
|
-
/* @__PURE__ */ s("div", { style:
|
|
3268
|
+
/* @__PURE__ */ s("div", { style: g.toggleContainer, children: /* @__PURE__ */ s(
|
|
3274
3269
|
"button",
|
|
3275
3270
|
{
|
|
3276
3271
|
type: "button",
|
|
3277
3272
|
onClick: () => {
|
|
3278
|
-
|
|
3279
|
-
},
|
|
3280
|
-
style: {
|
|
3281
|
-
background: "none",
|
|
3282
|
-
border: "none",
|
|
3283
|
-
color: "#6b7280",
|
|
3284
|
-
fontSize: "0.875rem",
|
|
3285
|
-
cursor: "pointer",
|
|
3286
|
-
textDecoration: "underline"
|
|
3273
|
+
L(!1), R(""), D("");
|
|
3287
3274
|
},
|
|
3288
|
-
|
|
3275
|
+
style: g.toggleLink,
|
|
3276
|
+
children: I.hideNameToggle
|
|
3289
3277
|
}
|
|
3290
3278
|
) })
|
|
3291
3279
|
] }),
|
|
3292
|
-
/* @__PURE__ */ s("button", { type: "submit", disabled: !
|
|
3293
|
-
|
|
3294
|
-
|
|
3280
|
+
/* @__PURE__ */ s("button", { type: "submit", disabled: !f || E || u, style: O(), children: E ? I.loadingText : I.submitButton }),
|
|
3281
|
+
C && /* @__PURE__ */ s("div", { style: g.errorText, children: C }),
|
|
3282
|
+
T && /* @__PURE__ */ s("div", { style: g.successText, children: T })
|
|
3295
3283
|
] }),
|
|
3296
|
-
a && /* @__PURE__ */ d("div", { style:
|
|
3284
|
+
a && /* @__PURE__ */ d("div", { style: g.linkContainer, children: [
|
|
3297
3285
|
/* @__PURE__ */ d("div", { children: [
|
|
3298
|
-
/* @__PURE__ */ d("span", { style:
|
|
3299
|
-
|
|
3286
|
+
/* @__PURE__ */ d("span", { style: g.divider, children: [
|
|
3287
|
+
I.loginText,
|
|
3300
3288
|
" "
|
|
3301
3289
|
] }),
|
|
3302
|
-
/* @__PURE__ */ s("a", { onClick: i, style:
|
|
3290
|
+
/* @__PURE__ */ s("a", { onClick: i, style: g.link, children: I.loginLink })
|
|
3303
3291
|
] }),
|
|
3304
|
-
/* @__PURE__ */ s("div", { style:
|
|
3292
|
+
/* @__PURE__ */ s("div", { style: g.divider, children: I.dividerBullet }),
|
|
3305
3293
|
/* @__PURE__ */ d("div", { children: [
|
|
3306
|
-
/* @__PURE__ */ d("span", { style:
|
|
3307
|
-
|
|
3294
|
+
/* @__PURE__ */ d("span", { style: g.divider, children: [
|
|
3295
|
+
I.signupText,
|
|
3308
3296
|
" "
|
|
3309
3297
|
] }),
|
|
3310
|
-
/* @__PURE__ */ s("a", { onClick: o, style:
|
|
3298
|
+
/* @__PURE__ */ s("a", { onClick: o, style: g.link, children: I.signupLink })
|
|
3311
3299
|
] })
|
|
3312
3300
|
] })
|
|
3313
3301
|
] });
|
|
3314
3302
|
}
|
|
3315
|
-
const
|
|
3303
|
+
const Yt = {
|
|
3316
3304
|
title: "Verifying Magic Link",
|
|
3317
3305
|
verifyingMessage: "Please wait while we verify your magic link...",
|
|
3318
3306
|
successMessage: "Magic link verified successfully! You are now logged in.",
|
|
3319
3307
|
errorMessage: "Failed to verify magic link. The link may be expired or invalid.",
|
|
3320
3308
|
redirectingMessage: "Redirecting you to the dashboard...",
|
|
3321
3309
|
retryButton: "Try Again",
|
|
3322
|
-
backToLoginButton: "Back to Login"
|
|
3323
|
-
|
|
3310
|
+
backToLoginButton: "Back to Login",
|
|
3311
|
+
missingParamsError: "Missing required parameters: token or email"
|
|
3312
|
+
}, Ye = {
|
|
3324
3313
|
container: {
|
|
3325
3314
|
maxWidth: "400px",
|
|
3326
3315
|
width: "100%",
|
|
@@ -3406,8 +3395,14 @@ const er = {
|
|
|
3406
3395
|
fontWeight: "500",
|
|
3407
3396
|
cursor: "pointer",
|
|
3408
3397
|
transition: "all 0.15s ease-in-out"
|
|
3398
|
+
},
|
|
3399
|
+
retryButtonHover: {
|
|
3400
|
+
backgroundColor: "#2563eb"
|
|
3401
|
+
},
|
|
3402
|
+
backButtonHover: {
|
|
3403
|
+
backgroundColor: "#e5e7eb"
|
|
3409
3404
|
}
|
|
3410
|
-
},
|
|
3405
|
+
}, Xt = () => /* @__PURE__ */ s("div", { style: Ye.spinner }), er = () => /* @__PURE__ */ d(
|
|
3411
3406
|
"svg",
|
|
3412
3407
|
{
|
|
3413
3408
|
width: "48",
|
|
@@ -3424,7 +3419,7 @@ const er = {
|
|
|
3424
3419
|
/* @__PURE__ */ s("polyline", { points: "22,4 12,14.01 9,11.01" })
|
|
3425
3420
|
]
|
|
3426
3421
|
}
|
|
3427
|
-
),
|
|
3422
|
+
), tr = () => /* @__PURE__ */ d(
|
|
3428
3423
|
"svg",
|
|
3429
3424
|
{
|
|
3430
3425
|
width: "48",
|
|
@@ -3442,12 +3437,12 @@ const er = {
|
|
|
3442
3437
|
/* @__PURE__ */ s("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
3443
3438
|
]
|
|
3444
3439
|
}
|
|
3445
|
-
),
|
|
3446
|
-
loading: /* @__PURE__ */ s(
|
|
3447
|
-
success: /* @__PURE__ */ s(
|
|
3448
|
-
error: /* @__PURE__ */ s(
|
|
3440
|
+
), rr = {
|
|
3441
|
+
loading: /* @__PURE__ */ s(Xt, {}),
|
|
3442
|
+
success: /* @__PURE__ */ s(er, {}),
|
|
3443
|
+
error: /* @__PURE__ */ s(tr, {})
|
|
3449
3444
|
};
|
|
3450
|
-
function
|
|
3445
|
+
function Vr({
|
|
3451
3446
|
copy: n = {},
|
|
3452
3447
|
styles: e = {},
|
|
3453
3448
|
icons: t = {},
|
|
@@ -3455,80 +3450,83 @@ function jr({
|
|
|
3455
3450
|
onError: i,
|
|
3456
3451
|
onRetry: o,
|
|
3457
3452
|
onBackToLogin: a,
|
|
3458
|
-
className:
|
|
3459
|
-
token:
|
|
3460
|
-
email:
|
|
3461
|
-
appId:
|
|
3462
|
-
tenantSlug:
|
|
3463
|
-
autoRedirectDelay:
|
|
3453
|
+
className: p,
|
|
3454
|
+
token: w,
|
|
3455
|
+
email: y,
|
|
3456
|
+
appId: f,
|
|
3457
|
+
tenantSlug: x,
|
|
3458
|
+
autoRedirectDelay: h = 3e3
|
|
3464
3459
|
}) {
|
|
3465
|
-
const [
|
|
3460
|
+
const [R, N] = k("verifying"), [D, E] = k(""), { verifyMagicLink: P } = ue(), u = { ...Yt, ...n }, S = { ...Ye, ...e }, C = { ...rr, ...t }, M = () => {
|
|
3466
3461
|
if (typeof window > "u") return {};
|
|
3467
|
-
const
|
|
3462
|
+
const b = new URLSearchParams(window.location.search);
|
|
3468
3463
|
return {
|
|
3469
|
-
token:
|
|
3470
|
-
email:
|
|
3471
|
-
appId:
|
|
3472
|
-
tenantSlug:
|
|
3464
|
+
token: w || b.get("token") || "",
|
|
3465
|
+
email: y || b.get("email") || "",
|
|
3466
|
+
appId: f || b.get("appId") || "",
|
|
3467
|
+
tenantSlug: x || b.get("tenantSlug") || void 0
|
|
3473
3468
|
};
|
|
3474
|
-
},
|
|
3475
|
-
|
|
3469
|
+
}, T = async () => {
|
|
3470
|
+
N("verifying"), E("");
|
|
3476
3471
|
try {
|
|
3477
|
-
const
|
|
3478
|
-
if (!
|
|
3479
|
-
throw new Error(
|
|
3480
|
-
const
|
|
3481
|
-
token:
|
|
3482
|
-
email:
|
|
3483
|
-
tenantSlug:
|
|
3472
|
+
const b = M();
|
|
3473
|
+
if (!b.token || !b.email)
|
|
3474
|
+
throw new Error(u.missingParamsError);
|
|
3475
|
+
const L = await P({
|
|
3476
|
+
token: b.token,
|
|
3477
|
+
email: b.email,
|
|
3478
|
+
tenantSlug: b.tenantSlug
|
|
3484
3479
|
});
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
},
|
|
3488
|
-
} catch (
|
|
3489
|
-
const
|
|
3490
|
-
E(
|
|
3480
|
+
N("success"), r == null || r(L), h > 0 && setTimeout(() => {
|
|
3481
|
+
N("redirecting");
|
|
3482
|
+
}, h);
|
|
3483
|
+
} catch (b) {
|
|
3484
|
+
const L = b.message || u.errorMessage;
|
|
3485
|
+
E(L), N("error"), i == null || i(L);
|
|
3491
3486
|
}
|
|
3492
|
-
},
|
|
3493
|
-
o == null || o(),
|
|
3494
|
-
},
|
|
3487
|
+
}, $ = () => {
|
|
3488
|
+
o == null || o(), T();
|
|
3489
|
+
}, l = () => {
|
|
3495
3490
|
a == null || a();
|
|
3496
3491
|
};
|
|
3497
|
-
|
|
3498
|
-
|
|
3492
|
+
re(() => {
|
|
3493
|
+
T();
|
|
3499
3494
|
}, []);
|
|
3500
3495
|
const U = () => {
|
|
3501
|
-
switch (
|
|
3496
|
+
switch (R) {
|
|
3502
3497
|
case "verifying":
|
|
3503
|
-
return /* @__PURE__ */ d("div", { style:
|
|
3504
|
-
|
|
3498
|
+
return /* @__PURE__ */ d("div", { style: S.message, children: [
|
|
3499
|
+
C.loading,
|
|
3505
3500
|
u.verifyingMessage
|
|
3506
3501
|
] });
|
|
3507
3502
|
case "success":
|
|
3508
3503
|
return /* @__PURE__ */ d(_, { children: [
|
|
3509
|
-
|
|
3510
|
-
/* @__PURE__ */ s("div", { style:
|
|
3504
|
+
C.success,
|
|
3505
|
+
/* @__PURE__ */ s("div", { style: S.successMessage, children: u.successMessage })
|
|
3511
3506
|
] });
|
|
3512
3507
|
case "redirecting":
|
|
3513
3508
|
return /* @__PURE__ */ d(_, { children: [
|
|
3514
|
-
|
|
3515
|
-
/* @__PURE__ */ s("div", { style:
|
|
3509
|
+
C.loading,
|
|
3510
|
+
/* @__PURE__ */ s("div", { style: S.message, children: u.redirectingMessage })
|
|
3516
3511
|
] });
|
|
3517
3512
|
case "error":
|
|
3518
3513
|
return /* @__PURE__ */ d(_, { children: [
|
|
3519
|
-
|
|
3520
|
-
/* @__PURE__ */ s("div", { style:
|
|
3521
|
-
/* @__PURE__ */ d("div", { style:
|
|
3514
|
+
C.error,
|
|
3515
|
+
/* @__PURE__ */ s("div", { style: S.errorMessage, children: D || u.errorMessage }),
|
|
3516
|
+
/* @__PURE__ */ d("div", { style: S.buttonContainer, children: [
|
|
3522
3517
|
/* @__PURE__ */ s(
|
|
3523
3518
|
"button",
|
|
3524
3519
|
{
|
|
3525
|
-
onClick:
|
|
3526
|
-
style:
|
|
3527
|
-
onMouseOver: (
|
|
3528
|
-
|
|
3520
|
+
onClick: $,
|
|
3521
|
+
style: S.retryButton,
|
|
3522
|
+
onMouseOver: (b) => {
|
|
3523
|
+
Object.assign(b.currentTarget.style, S.retryButtonHover);
|
|
3529
3524
|
},
|
|
3530
|
-
onMouseOut: (
|
|
3531
|
-
|
|
3525
|
+
onMouseOut: (b) => {
|
|
3526
|
+
const L = S.retryButton || {};
|
|
3527
|
+
Object.keys(S.retryButtonHover || {}).forEach((F) => {
|
|
3528
|
+
b.currentTarget.style[F] = L[F] ?? "";
|
|
3529
|
+
});
|
|
3532
3530
|
},
|
|
3533
3531
|
children: u.retryButton
|
|
3534
3532
|
}
|
|
@@ -3536,13 +3534,16 @@ function jr({
|
|
|
3536
3534
|
/* @__PURE__ */ s(
|
|
3537
3535
|
"button",
|
|
3538
3536
|
{
|
|
3539
|
-
onClick:
|
|
3540
|
-
style:
|
|
3541
|
-
onMouseOver: (
|
|
3542
|
-
|
|
3537
|
+
onClick: l,
|
|
3538
|
+
style: S.backButton,
|
|
3539
|
+
onMouseOver: (b) => {
|
|
3540
|
+
Object.assign(b.currentTarget.style, S.backButtonHover);
|
|
3543
3541
|
},
|
|
3544
|
-
onMouseOut: (
|
|
3545
|
-
|
|
3542
|
+
onMouseOut: (b) => {
|
|
3543
|
+
const L = S.backButton || {};
|
|
3544
|
+
Object.keys(S.backButtonHover || {}).forEach((F) => {
|
|
3545
|
+
b.currentTarget.style[F] = L[F] ?? "";
|
|
3546
|
+
});
|
|
3546
3547
|
},
|
|
3547
3548
|
children: u.backToLoginButton
|
|
3548
3549
|
}
|
|
@@ -3553,18 +3554,18 @@ function jr({
|
|
|
3553
3554
|
return null;
|
|
3554
3555
|
}
|
|
3555
3556
|
};
|
|
3556
|
-
return /* @__PURE__ */ d("div", { style:
|
|
3557
|
+
return /* @__PURE__ */ d("div", { style: S.container, className: p, children: [
|
|
3557
3558
|
/* @__PURE__ */ s("style", { children: `
|
|
3558
3559
|
@keyframes spin {
|
|
3559
3560
|
0% { transform: rotate(0deg); }
|
|
3560
3561
|
100% { transform: rotate(360deg); }
|
|
3561
3562
|
}
|
|
3562
3563
|
` }),
|
|
3563
|
-
/* @__PURE__ */ s("h1", { style:
|
|
3564
|
+
/* @__PURE__ */ s("h1", { style: S.title, children: u.title }),
|
|
3564
3565
|
U()
|
|
3565
3566
|
] });
|
|
3566
3567
|
}
|
|
3567
|
-
const
|
|
3568
|
+
const nr = {
|
|
3568
3569
|
title: "Reset Password",
|
|
3569
3570
|
subtitle: "Enter your email address and we'll send you a link to reset your password.",
|
|
3570
3571
|
emailLabel: "Email",
|
|
@@ -3585,8 +3586,12 @@ const ir = {
|
|
|
3585
3586
|
resetSubmitButton: "Reset Password",
|
|
3586
3587
|
resetLoadingText: "Resetting...",
|
|
3587
3588
|
resetSuccessMessage: "Password reset successfully!",
|
|
3588
|
-
passwordMismatchError: "Passwords do not match"
|
|
3589
|
-
|
|
3589
|
+
passwordMismatchError: "Passwords do not match",
|
|
3590
|
+
requestNewLinkLink: "Request New Link",
|
|
3591
|
+
haveTokenLink: "I have a token",
|
|
3592
|
+
tenantNotFoundError: "Tenant not found",
|
|
3593
|
+
dividerBullet: "•"
|
|
3594
|
+
}, sr = {
|
|
3590
3595
|
container: {
|
|
3591
3596
|
maxWidth: "400px",
|
|
3592
3597
|
margin: "0 auto",
|
|
@@ -3676,9 +3681,13 @@ const ir = {
|
|
|
3676
3681
|
textDecoration: "none",
|
|
3677
3682
|
fontSize: "0.875rem",
|
|
3678
3683
|
cursor: "pointer"
|
|
3684
|
+
},
|
|
3685
|
+
modeSwitchDivider: {
|
|
3686
|
+
margin: "0 0.5rem",
|
|
3687
|
+
color: "#6b7280"
|
|
3679
3688
|
}
|
|
3680
3689
|
};
|
|
3681
|
-
function
|
|
3690
|
+
function jr({
|
|
3682
3691
|
copy: n = {},
|
|
3683
3692
|
styles: e = {},
|
|
3684
3693
|
mode: t = "request",
|
|
@@ -3686,105 +3695,105 @@ function Gr({
|
|
|
3686
3695
|
onSuccess: i,
|
|
3687
3696
|
onError: o,
|
|
3688
3697
|
onBackToLogin: a,
|
|
3689
|
-
onModeChange:
|
|
3690
|
-
className:
|
|
3698
|
+
onModeChange: p,
|
|
3699
|
+
className: w
|
|
3691
3700
|
}) {
|
|
3692
|
-
const [
|
|
3701
|
+
const [y, f] = k(""), [x, h] = k(r), [R, N] = k(""), [D, E] = k(""), [P, u] = k(!1), [S, C] = k(""), [M, T] = k(""), [$, l] = k({}), { requestPasswordReset: U, confirmPasswordReset: b } = ue(), { tenant: L } = me(), F = { ...nr, ...n }, c = { ...sr, ...e }, H = () => {
|
|
3693
3702
|
const O = {};
|
|
3694
|
-
return
|
|
3695
|
-
},
|
|
3703
|
+
return y.trim() || (O.email = !0), l(O), Object.keys(O).length === 0;
|
|
3704
|
+
}, I = () => {
|
|
3696
3705
|
const O = {};
|
|
3697
|
-
return
|
|
3698
|
-
},
|
|
3699
|
-
if (O.preventDefault(), !!
|
|
3700
|
-
if (!(
|
|
3701
|
-
|
|
3706
|
+
return x.trim() || (O.token = !0), R.trim() || (O.newPassword = !0), D.trim() || (O.confirmPassword = !0), l(O), Object.keys(O).length === 0;
|
|
3707
|
+
}, g = async (O) => {
|
|
3708
|
+
if (O.preventDefault(), !!H()) {
|
|
3709
|
+
if (!(L != null && L.id)) {
|
|
3710
|
+
C(F.tenantNotFoundError);
|
|
3702
3711
|
return;
|
|
3703
3712
|
}
|
|
3704
|
-
u(!0),
|
|
3713
|
+
u(!0), C(""), T("");
|
|
3705
3714
|
try {
|
|
3706
|
-
await U({ email:
|
|
3715
|
+
await U({ email: y, tenantId: L.id }), T(F.successMessage), i == null || i();
|
|
3707
3716
|
} catch (q) {
|
|
3708
|
-
const
|
|
3709
|
-
|
|
3717
|
+
const j = q.message || F.errorMessage;
|
|
3718
|
+
C(j), o == null || o(j);
|
|
3710
3719
|
} finally {
|
|
3711
3720
|
u(!1);
|
|
3712
3721
|
}
|
|
3713
3722
|
}
|
|
3714
|
-
},
|
|
3715
|
-
if (O.preventDefault(), !!
|
|
3716
|
-
if (
|
|
3717
|
-
|
|
3723
|
+
}, m = async (O) => {
|
|
3724
|
+
if (O.preventDefault(), !!I()) {
|
|
3725
|
+
if (R !== D) {
|
|
3726
|
+
C(F.passwordMismatchError), l({ confirmPassword: !0 });
|
|
3718
3727
|
return;
|
|
3719
3728
|
}
|
|
3720
|
-
u(!0),
|
|
3729
|
+
u(!0), C(""), T("");
|
|
3721
3730
|
try {
|
|
3722
|
-
await
|
|
3731
|
+
await b({ token: x, newPassword: R }), T(F.resetSuccessMessage), i == null || i();
|
|
3723
3732
|
} catch (q) {
|
|
3724
|
-
const
|
|
3725
|
-
|
|
3733
|
+
const j = q.message || F.errorMessage;
|
|
3734
|
+
C(j), o == null || o(j);
|
|
3726
3735
|
} finally {
|
|
3727
3736
|
u(!1);
|
|
3728
3737
|
}
|
|
3729
3738
|
}
|
|
3730
3739
|
}, v = (O) => ({
|
|
3731
|
-
...
|
|
3732
|
-
|
|
3733
|
-
}),
|
|
3734
|
-
...
|
|
3735
|
-
...
|
|
3740
|
+
...c.input,
|
|
3741
|
+
...$[O] ? c.inputError : {}
|
|
3742
|
+
}), Q = () => ({
|
|
3743
|
+
...c.button,
|
|
3744
|
+
...P ? c.buttonLoading : {}
|
|
3736
3745
|
});
|
|
3737
3746
|
if (t === "reset") {
|
|
3738
|
-
const O =
|
|
3739
|
-
return /* @__PURE__ */ d("div", { className:
|
|
3740
|
-
/* @__PURE__ */ s("h2", { style:
|
|
3741
|
-
/* @__PURE__ */ s("p", { style:
|
|
3742
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
3743
|
-
/* @__PURE__ */ d("div", { style:
|
|
3744
|
-
/* @__PURE__ */ s("label", { style:
|
|
3747
|
+
const O = x && R && D;
|
|
3748
|
+
return /* @__PURE__ */ d("div", { className: w, style: c.container, children: [
|
|
3749
|
+
/* @__PURE__ */ s("h2", { style: c.title, children: F.resetTitle }),
|
|
3750
|
+
/* @__PURE__ */ s("p", { style: c.subtitle, children: F.resetSubtitle }),
|
|
3751
|
+
/* @__PURE__ */ d("form", { onSubmit: m, style: c.form, children: [
|
|
3752
|
+
/* @__PURE__ */ d("div", { style: c.fieldGroup, children: [
|
|
3753
|
+
/* @__PURE__ */ s("label", { style: c.label, children: F.tokenLabel }),
|
|
3745
3754
|
/* @__PURE__ */ s(
|
|
3746
3755
|
"input",
|
|
3747
3756
|
{
|
|
3748
3757
|
type: "text",
|
|
3749
|
-
value:
|
|
3758
|
+
value: x,
|
|
3750
3759
|
onChange: (q) => {
|
|
3751
|
-
|
|
3760
|
+
h(q.target.value), $.token && l((j) => ({ ...j, token: !1 }));
|
|
3752
3761
|
},
|
|
3753
|
-
placeholder:
|
|
3762
|
+
placeholder: F.tokenPlaceholder,
|
|
3754
3763
|
style: v("token"),
|
|
3755
|
-
disabled:
|
|
3764
|
+
disabled: P
|
|
3756
3765
|
}
|
|
3757
3766
|
)
|
|
3758
3767
|
] }),
|
|
3759
|
-
/* @__PURE__ */ d("div", { style:
|
|
3760
|
-
/* @__PURE__ */ s("label", { style:
|
|
3768
|
+
/* @__PURE__ */ d("div", { style: c.fieldGroup, children: [
|
|
3769
|
+
/* @__PURE__ */ s("label", { style: c.label, children: F.newPasswordLabel }),
|
|
3761
3770
|
/* @__PURE__ */ s(
|
|
3762
3771
|
"input",
|
|
3763
3772
|
{
|
|
3764
3773
|
type: "password",
|
|
3765
|
-
value:
|
|
3774
|
+
value: R,
|
|
3766
3775
|
onChange: (q) => {
|
|
3767
|
-
|
|
3776
|
+
N(q.target.value), $.newPassword && l((j) => ({ ...j, newPassword: !1 }));
|
|
3768
3777
|
},
|
|
3769
|
-
placeholder:
|
|
3778
|
+
placeholder: F.newPasswordPlaceholder,
|
|
3770
3779
|
style: v("newPassword"),
|
|
3771
|
-
disabled:
|
|
3780
|
+
disabled: P
|
|
3772
3781
|
}
|
|
3773
3782
|
)
|
|
3774
3783
|
] }),
|
|
3775
|
-
/* @__PURE__ */ d("div", { style:
|
|
3776
|
-
/* @__PURE__ */ s("label", { style:
|
|
3784
|
+
/* @__PURE__ */ d("div", { style: c.fieldGroup, children: [
|
|
3785
|
+
/* @__PURE__ */ s("label", { style: c.label, children: F.confirmPasswordLabel }),
|
|
3777
3786
|
/* @__PURE__ */ s(
|
|
3778
3787
|
"input",
|
|
3779
3788
|
{
|
|
3780
3789
|
type: "password",
|
|
3781
|
-
value:
|
|
3790
|
+
value: D,
|
|
3782
3791
|
onChange: (q) => {
|
|
3783
|
-
E(q.target.value),
|
|
3792
|
+
E(q.target.value), $.confirmPassword && l((j) => ({ ...j, confirmPassword: !1 })), S === F.passwordMismatchError && C("");
|
|
3784
3793
|
},
|
|
3785
|
-
placeholder:
|
|
3794
|
+
placeholder: F.confirmPasswordPlaceholder,
|
|
3786
3795
|
style: v("confirmPassword"),
|
|
3787
|
-
disabled:
|
|
3796
|
+
disabled: P
|
|
3788
3797
|
}
|
|
3789
3798
|
)
|
|
3790
3799
|
] }),
|
|
@@ -3792,44 +3801,44 @@ function Gr({
|
|
|
3792
3801
|
"button",
|
|
3793
3802
|
{
|
|
3794
3803
|
type: "submit",
|
|
3795
|
-
disabled: !O ||
|
|
3804
|
+
disabled: !O || P,
|
|
3796
3805
|
style: {
|
|
3797
|
-
...
|
|
3798
|
-
...!O ||
|
|
3806
|
+
...Q(),
|
|
3807
|
+
...!O || P ? c.buttonDisabled : {}
|
|
3799
3808
|
},
|
|
3800
|
-
children:
|
|
3809
|
+
children: P ? F.resetLoadingText : F.resetSubmitButton
|
|
3801
3810
|
}
|
|
3802
3811
|
),
|
|
3803
|
-
|
|
3804
|
-
M && /* @__PURE__ */ s("div", { style:
|
|
3812
|
+
S && /* @__PURE__ */ s("div", { style: c.errorText, children: S }),
|
|
3813
|
+
M && /* @__PURE__ */ s("div", { style: c.successText, children: M })
|
|
3805
3814
|
] }),
|
|
3806
|
-
/* @__PURE__ */ d("div", { style:
|
|
3807
|
-
/* @__PURE__ */ s("a", { onClick: a, style:
|
|
3808
|
-
|
|
3809
|
-
/* @__PURE__ */ s("span", { style:
|
|
3810
|
-
/* @__PURE__ */ s("a", { onClick: () =>
|
|
3815
|
+
/* @__PURE__ */ d("div", { style: c.linkContainer, children: [
|
|
3816
|
+
/* @__PURE__ */ s("a", { onClick: a, style: c.link, children: F.backToLoginLink }),
|
|
3817
|
+
p && /* @__PURE__ */ d(_, { children: [
|
|
3818
|
+
/* @__PURE__ */ s("span", { style: c.modeSwitchDivider, children: F.dividerBullet }),
|
|
3819
|
+
/* @__PURE__ */ s("a", { onClick: () => p("request"), style: c.link, children: F.requestNewLinkLink })
|
|
3811
3820
|
] })
|
|
3812
3821
|
] })
|
|
3813
3822
|
] });
|
|
3814
3823
|
}
|
|
3815
|
-
const
|
|
3816
|
-
return /* @__PURE__ */ d("div", { className:
|
|
3817
|
-
/* @__PURE__ */ s("h2", { style:
|
|
3818
|
-
/* @__PURE__ */ s("p", { style:
|
|
3819
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
3820
|
-
/* @__PURE__ */ d("div", { style:
|
|
3821
|
-
/* @__PURE__ */ s("label", { style:
|
|
3824
|
+
const J = y;
|
|
3825
|
+
return /* @__PURE__ */ d("div", { className: w, style: c.container, children: [
|
|
3826
|
+
/* @__PURE__ */ s("h2", { style: c.title, children: F.title }),
|
|
3827
|
+
/* @__PURE__ */ s("p", { style: c.subtitle, children: F.subtitle }),
|
|
3828
|
+
/* @__PURE__ */ d("form", { onSubmit: g, style: c.form, children: [
|
|
3829
|
+
/* @__PURE__ */ d("div", { style: c.fieldGroup, children: [
|
|
3830
|
+
/* @__PURE__ */ s("label", { style: c.label, children: F.emailLabel }),
|
|
3822
3831
|
/* @__PURE__ */ s(
|
|
3823
3832
|
"input",
|
|
3824
3833
|
{
|
|
3825
3834
|
type: "email",
|
|
3826
|
-
value:
|
|
3835
|
+
value: y,
|
|
3827
3836
|
onChange: (O) => {
|
|
3828
|
-
|
|
3837
|
+
f(O.target.value), $.email && l((q) => ({ ...q, email: !1 }));
|
|
3829
3838
|
},
|
|
3830
|
-
placeholder:
|
|
3839
|
+
placeholder: F.emailPlaceholder,
|
|
3831
3840
|
style: v("email"),
|
|
3832
|
-
disabled:
|
|
3841
|
+
disabled: P
|
|
3833
3842
|
}
|
|
3834
3843
|
)
|
|
3835
3844
|
] }),
|
|
@@ -3837,27 +3846,27 @@ function Gr({
|
|
|
3837
3846
|
"button",
|
|
3838
3847
|
{
|
|
3839
3848
|
type: "submit",
|
|
3840
|
-
disabled: !
|
|
3849
|
+
disabled: !J || P,
|
|
3841
3850
|
style: {
|
|
3842
|
-
...
|
|
3843
|
-
...!
|
|
3851
|
+
...Q(),
|
|
3852
|
+
...!J || P ? c.buttonDisabled : {}
|
|
3844
3853
|
},
|
|
3845
|
-
children:
|
|
3854
|
+
children: P ? F.loadingText : F.submitButton
|
|
3846
3855
|
}
|
|
3847
3856
|
),
|
|
3848
|
-
|
|
3849
|
-
M && /* @__PURE__ */ s("div", { style:
|
|
3857
|
+
S && /* @__PURE__ */ s("div", { style: c.errorText, children: S }),
|
|
3858
|
+
M && /* @__PURE__ */ s("div", { style: c.successText, children: M })
|
|
3850
3859
|
] }),
|
|
3851
|
-
/* @__PURE__ */ d("div", { style:
|
|
3852
|
-
/* @__PURE__ */ s("a", { onClick: a, style:
|
|
3853
|
-
|
|
3854
|
-
/* @__PURE__ */ s("span", { style:
|
|
3855
|
-
/* @__PURE__ */ s("a", { onClick: () =>
|
|
3860
|
+
/* @__PURE__ */ d("div", { style: c.linkContainer, children: [
|
|
3861
|
+
/* @__PURE__ */ s("a", { onClick: a, style: c.link, children: F.backToLoginLink }),
|
|
3862
|
+
p && /* @__PURE__ */ d(_, { children: [
|
|
3863
|
+
/* @__PURE__ */ s("span", { style: c.modeSwitchDivider, children: F.dividerBullet }),
|
|
3864
|
+
/* @__PURE__ */ s("a", { onClick: () => p("reset"), style: c.link, children: F.haveTokenLink })
|
|
3856
3865
|
] })
|
|
3857
3866
|
] })
|
|
3858
3867
|
] });
|
|
3859
3868
|
}
|
|
3860
|
-
const
|
|
3869
|
+
const ir = () => /* @__PURE__ */ s(
|
|
3861
3870
|
"div",
|
|
3862
3871
|
{
|
|
3863
3872
|
style: {
|
|
@@ -3869,7 +3878,7 @@ const ar = () => /* @__PURE__ */ s(
|
|
|
3869
3878
|
},
|
|
3870
3879
|
children: /* @__PURE__ */ s("div", { children: "Loading..." })
|
|
3871
3880
|
}
|
|
3872
|
-
),
|
|
3881
|
+
), or = ({ error: n, retry: e }) => /* @__PURE__ */ d(
|
|
3873
3882
|
"div",
|
|
3874
3883
|
{
|
|
3875
3884
|
style: {
|
|
@@ -3903,139 +3912,169 @@ const ar = () => /* @__PURE__ */ s(
|
|
|
3903
3912
|
]
|
|
3904
3913
|
}
|
|
3905
3914
|
);
|
|
3906
|
-
function
|
|
3915
|
+
function Gr({
|
|
3907
3916
|
children: n,
|
|
3908
3917
|
loadingFallback: e,
|
|
3909
3918
|
errorFallback: t,
|
|
3910
3919
|
requireTenant: r = !0
|
|
3911
3920
|
}) {
|
|
3912
|
-
const { isAppLoading: i, appError: o, retryApp: a } =
|
|
3913
|
-
}),
|
|
3914
|
-
o && a(),
|
|
3921
|
+
const { isAppLoading: i, appError: o, retryApp: a } = Se(), p = xe(), w = Fe(), y = Ke(), f = Ze(), x = (p == null ? void 0 : p.isTenantLoading) ?? !1, h = (p == null ? void 0 : p.tenantError) ?? null, R = (p == null ? void 0 : p.tenantSlug) ?? null, N = (p == null ? void 0 : p.retryTenant) ?? (() => {
|
|
3922
|
+
}), D = (w == null ? void 0 : w.isAuthReady) ?? !0, E = (y == null ? void 0 : y.isReady) ?? !0, P = (f == null ? void 0 : f.isReady) ?? !0, u = r && p && R, T = i || u && x || w && !D || y && !E || f && !P, $ = o || (u ? h : null), l = () => {
|
|
3923
|
+
o && a(), h && p && N();
|
|
3915
3924
|
};
|
|
3916
|
-
if (
|
|
3917
|
-
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(
|
|
3918
|
-
if (
|
|
3919
|
-
const U = typeof t == "function" ? t(
|
|
3925
|
+
if (T)
|
|
3926
|
+
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(ir, {}) });
|
|
3927
|
+
if ($) {
|
|
3928
|
+
const U = typeof t == "function" ? t($, l) : t || /* @__PURE__ */ s(or, { error: $, retry: l });
|
|
3920
3929
|
return /* @__PURE__ */ s(_, { children: U });
|
|
3921
3930
|
}
|
|
3922
3931
|
return /* @__PURE__ */ s(_, { children: n });
|
|
3923
3932
|
}
|
|
3924
|
-
function
|
|
3925
|
-
const { isAppLoading: e, appError: t, retryApp: r, appInfo: i } =
|
|
3926
|
-
}),
|
|
3933
|
+
function Qr(n = !0) {
|
|
3934
|
+
const { isAppLoading: e, appError: t, retryApp: r, appInfo: i } = Se(), o = xe(), a = Fe(), p = Ke(), w = Ze(), y = (o == null ? void 0 : o.isTenantLoading) ?? !1, f = (o == null ? void 0 : o.tenantError) ?? null, x = (o == null ? void 0 : o.tenant) ?? null, h = (o == null ? void 0 : o.tenantSlug) ?? null, R = (o == null ? void 0 : o.retryTenant) ?? (() => {
|
|
3935
|
+
}), N = (a == null ? void 0 : a.isAuthReady) ?? !0, D = (p == null ? void 0 : p.isReady) ?? !0, E = (w == null ? void 0 : w.isReady) ?? !0, P = n && o && h, M = e || P && y || a && !N || p && !D || w && !E, T = t || (P ? f : null);
|
|
3927
3936
|
return {
|
|
3928
3937
|
isLoading: M,
|
|
3929
|
-
error:
|
|
3930
|
-
isReady: !M && !
|
|
3938
|
+
error: T,
|
|
3939
|
+
isReady: !M && !T && i !== null && (!P || x !== null),
|
|
3931
3940
|
retry: () => {
|
|
3932
|
-
t && r(),
|
|
3941
|
+
t && r(), f && o && R();
|
|
3933
3942
|
},
|
|
3934
3943
|
// Individual states
|
|
3935
3944
|
app: { isLoading: e, error: t, data: i },
|
|
3936
|
-
tenant: o ? { isLoading:
|
|
3937
|
-
auth: a ? { isReady:
|
|
3938
|
-
featureFlags:
|
|
3939
|
-
subscription:
|
|
3945
|
+
tenant: o ? { isLoading: y, error: f, data: x } : null,
|
|
3946
|
+
auth: a ? { isReady: N } : null,
|
|
3947
|
+
featureFlags: p ? { isReady: D } : null,
|
|
3948
|
+
subscription: w ? { isReady: E } : null
|
|
3940
3949
|
};
|
|
3941
3950
|
}
|
|
3942
|
-
|
|
3951
|
+
const ar = {
|
|
3952
|
+
wrapper: {
|
|
3953
|
+
position: "relative"
|
|
3954
|
+
},
|
|
3955
|
+
button: {
|
|
3956
|
+
cursor: "pointer",
|
|
3957
|
+
opacity: 1
|
|
3958
|
+
},
|
|
3959
|
+
buttonDisabled: {
|
|
3960
|
+
cursor: "not-allowed",
|
|
3961
|
+
opacity: 0.6
|
|
3962
|
+
},
|
|
3963
|
+
dropdown: {
|
|
3964
|
+
position: "absolute",
|
|
3965
|
+
top: "100%",
|
|
3966
|
+
left: 0,
|
|
3967
|
+
right: 0,
|
|
3968
|
+
zIndex: 1e3,
|
|
3969
|
+
backgroundColor: "white",
|
|
3970
|
+
border: "1px solid #ccc",
|
|
3971
|
+
borderRadius: 4,
|
|
3972
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.15)",
|
|
3973
|
+
maxHeight: 300,
|
|
3974
|
+
overflowY: "auto"
|
|
3975
|
+
},
|
|
3976
|
+
item: {
|
|
3977
|
+
padding: "8px 12px",
|
|
3978
|
+
cursor: "pointer",
|
|
3979
|
+
backgroundColor: "transparent"
|
|
3980
|
+
},
|
|
3981
|
+
itemSelected: {
|
|
3982
|
+
backgroundColor: "#f0f0f0"
|
|
3983
|
+
},
|
|
3984
|
+
itemHover: {
|
|
3985
|
+
backgroundColor: "#f5f5f5"
|
|
3986
|
+
},
|
|
3987
|
+
itemRole: {
|
|
3988
|
+
opacity: 0.7,
|
|
3989
|
+
marginLeft: 8
|
|
3990
|
+
},
|
|
3991
|
+
arrow: {
|
|
3992
|
+
marginLeft: 8
|
|
3993
|
+
}
|
|
3994
|
+
};
|
|
3995
|
+
function Kr({
|
|
3943
3996
|
tenants: n,
|
|
3944
3997
|
currentTenantId: e,
|
|
3945
3998
|
onSelect: t,
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3999
|
+
styles: r = {},
|
|
4000
|
+
className: i = "",
|
|
4001
|
+
dropdownClassName: o = "",
|
|
4002
|
+
itemClassName: a = "",
|
|
4003
|
+
renderItem: p,
|
|
4004
|
+
placeholder: w = "Select tenant",
|
|
4005
|
+
disabled: y = !1,
|
|
4006
|
+
showCurrentTenant: f = !0
|
|
3953
4007
|
}) {
|
|
3954
|
-
var
|
|
3955
|
-
const
|
|
3956
|
-
|
|
4008
|
+
var M;
|
|
4009
|
+
const x = { ...ar, ...r }, h = Fe(), [R, N] = k(!1), D = Me(null), E = n ?? (h == null ? void 0 : h.userTenants) ?? [], P = e ?? ((M = h == null ? void 0 : h.currentUser) == null ? void 0 : M.tenantId) ?? null, u = async (T) => {
|
|
4010
|
+
N(!1), t ? t(T) : h != null && h.switchToTenant && await h.switchToTenant(T);
|
|
3957
4011
|
};
|
|
3958
|
-
|
|
3959
|
-
const
|
|
3960
|
-
|
|
4012
|
+
re(() => {
|
|
4013
|
+
const T = ($) => {
|
|
4014
|
+
D.current && !D.current.contains($.target) && N(!1);
|
|
3961
4015
|
};
|
|
3962
|
-
return document.addEventListener("mousedown",
|
|
4016
|
+
return document.addEventListener("mousedown", T), () => document.removeEventListener("mousedown", T);
|
|
3963
4017
|
}, []);
|
|
3964
|
-
const
|
|
3965
|
-
if (
|
|
4018
|
+
const S = E.find((T) => T.id === P);
|
|
4019
|
+
if (E.length === 0)
|
|
3966
4020
|
return null;
|
|
3967
|
-
if (
|
|
3968
|
-
return /* @__PURE__ */ s("div", { className:
|
|
3969
|
-
const
|
|
3970
|
-
|
|
3971
|
-
|
|
4021
|
+
if (E.length === 1 && f)
|
|
4022
|
+
return /* @__PURE__ */ s("div", { className: i, children: /* @__PURE__ */ s("span", { children: E[0].name }) });
|
|
4023
|
+
const C = (T, $) => /* @__PURE__ */ d("span", { style: { fontWeight: $ ? "bold" : "normal" }, children: [
|
|
4024
|
+
T.name,
|
|
4025
|
+
T.role && /* @__PURE__ */ d("span", { style: x.itemRole, children: [
|
|
3972
4026
|
"(",
|
|
3973
|
-
|
|
4027
|
+
T.role,
|
|
3974
4028
|
")"
|
|
3975
4029
|
] })
|
|
3976
4030
|
] });
|
|
3977
|
-
return /* @__PURE__ */ d("div", { ref:
|
|
4031
|
+
return /* @__PURE__ */ d("div", { ref: D, className: i, style: x.wrapper, children: [
|
|
3978
4032
|
/* @__PURE__ */ d(
|
|
3979
4033
|
"button",
|
|
3980
4034
|
{
|
|
3981
4035
|
type: "button",
|
|
3982
|
-
onClick: () => !
|
|
3983
|
-
disabled:
|
|
4036
|
+
onClick: () => !y && N(!R),
|
|
4037
|
+
disabled: y,
|
|
3984
4038
|
style: {
|
|
3985
|
-
|
|
3986
|
-
|
|
4039
|
+
...x.button,
|
|
4040
|
+
...y ? x.buttonDisabled : {}
|
|
3987
4041
|
},
|
|
3988
4042
|
children: [
|
|
3989
|
-
|
|
3990
|
-
/* @__PURE__ */ s("span", { style:
|
|
4043
|
+
S ? S.name : w,
|
|
4044
|
+
/* @__PURE__ */ s("span", { style: x.arrow, children: R ? "▲" : "▼" })
|
|
3991
4045
|
]
|
|
3992
4046
|
}
|
|
3993
4047
|
),
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4048
|
+
R && /* @__PURE__ */ s("div", { className: o, style: x.dropdown, children: E.map((T) => {
|
|
4049
|
+
const $ = T.id === P;
|
|
4050
|
+
return /* @__PURE__ */ s(
|
|
4051
|
+
"div",
|
|
4052
|
+
{
|
|
4053
|
+
className: a,
|
|
4054
|
+
onClick: () => u(T.id),
|
|
4055
|
+
style: {
|
|
4056
|
+
...x.item,
|
|
4057
|
+
...$ ? x.itemSelected : {}
|
|
4058
|
+
},
|
|
4059
|
+
onMouseEnter: (l) => {
|
|
4060
|
+
$ || Object.assign(l.currentTarget.style, x.itemHover);
|
|
4061
|
+
},
|
|
4062
|
+
onMouseLeave: (l) => {
|
|
4063
|
+
if (!$) {
|
|
4064
|
+
const U = x.item || {};
|
|
4065
|
+
Object.keys(x.itemHover || {}).forEach((b) => {
|
|
4066
|
+
l.currentTarget.style[b] = U[b] ?? "";
|
|
4067
|
+
});
|
|
4068
|
+
}
|
|
4069
|
+
},
|
|
4070
|
+
children: p ? p(T, $) : C(T, $)
|
|
4010
4071
|
},
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
"div",
|
|
4015
|
-
{
|
|
4016
|
-
className: o,
|
|
4017
|
-
onClick: () => E(m.id),
|
|
4018
|
-
style: {
|
|
4019
|
-
padding: "8px 12px",
|
|
4020
|
-
cursor: "pointer",
|
|
4021
|
-
backgroundColor: M ? "#f0f0f0" : "transparent"
|
|
4022
|
-
},
|
|
4023
|
-
onMouseEnter: (L) => {
|
|
4024
|
-
M || (L.target.style.backgroundColor = "#f5f5f5");
|
|
4025
|
-
},
|
|
4026
|
-
onMouseLeave: (L) => {
|
|
4027
|
-
M || (L.target.style.backgroundColor = "transparent");
|
|
4028
|
-
},
|
|
4029
|
-
children: a ? a(m, M) : u(m, M)
|
|
4030
|
-
},
|
|
4031
|
-
m.id
|
|
4032
|
-
);
|
|
4033
|
-
})
|
|
4034
|
-
}
|
|
4035
|
-
)
|
|
4072
|
+
T.id
|
|
4073
|
+
);
|
|
4074
|
+
}) })
|
|
4036
4075
|
] });
|
|
4037
4076
|
}
|
|
4038
|
-
class
|
|
4077
|
+
class Zr {
|
|
4039
4078
|
constructor(e, t) {
|
|
4040
4079
|
this.httpService = e, this.sessionManager = t;
|
|
4041
4080
|
}
|
|
@@ -4103,7 +4142,7 @@ class Jr {
|
|
|
4103
4142
|
};
|
|
4104
4143
|
}
|
|
4105
4144
|
}
|
|
4106
|
-
class
|
|
4145
|
+
class Jr {
|
|
4107
4146
|
constructor(e, t) {
|
|
4108
4147
|
this.httpService = e, this.sessionManager = t;
|
|
4109
4148
|
}
|
|
@@ -4154,7 +4193,7 @@ class Yr {
|
|
|
4154
4193
|
});
|
|
4155
4194
|
}
|
|
4156
4195
|
}
|
|
4157
|
-
class
|
|
4196
|
+
class Yr {
|
|
4158
4197
|
constructor(e) {
|
|
4159
4198
|
this.httpService = e;
|
|
4160
4199
|
}
|
|
@@ -4163,7 +4202,7 @@ class Xr {
|
|
|
4163
4202
|
return await this.httpService.get("/health");
|
|
4164
4203
|
}
|
|
4165
4204
|
}
|
|
4166
|
-
class
|
|
4205
|
+
class Xr {
|
|
4167
4206
|
// Date string to Date object
|
|
4168
4207
|
static toDate(e) {
|
|
4169
4208
|
return new Date(e);
|
|
@@ -4285,24 +4324,24 @@ class en {
|
|
|
4285
4324
|
}), t;
|
|
4286
4325
|
}
|
|
4287
4326
|
}
|
|
4288
|
-
const
|
|
4289
|
-
function
|
|
4327
|
+
const Xe = "returnTo", Ee = "zone_return_to", Ie = "zone_return_to";
|
|
4328
|
+
function en(n = {}) {
|
|
4290
4329
|
const {
|
|
4291
4330
|
zoneRoots: e = {},
|
|
4292
|
-
returnToParam: t =
|
|
4331
|
+
returnToParam: t = Xe,
|
|
4293
4332
|
returnToStorage: r = "url"
|
|
4294
|
-
} = n, i =
|
|
4333
|
+
} = n, i = pt(), [o, a] = ft(), { isAuthenticated: p, currentUser: w } = ue(), { tenant: y } = ge(), f = K(() => ({ ...Ue, ...e }), [e]), x = !!y, h = w == null ? void 0 : w.userType, R = K(() => {
|
|
4295
4334
|
switch (r) {
|
|
4296
4335
|
case "url":
|
|
4297
4336
|
return o.get(t);
|
|
4298
4337
|
case "session":
|
|
4299
|
-
return sessionStorage.getItem(
|
|
4338
|
+
return sessionStorage.getItem(Ee);
|
|
4300
4339
|
case "local":
|
|
4301
|
-
return localStorage.getItem(
|
|
4340
|
+
return localStorage.getItem(Ie);
|
|
4302
4341
|
default:
|
|
4303
4342
|
return null;
|
|
4304
4343
|
}
|
|
4305
|
-
}, [r, o, t]),
|
|
4344
|
+
}, [r, o, t]), N = se(() => {
|
|
4306
4345
|
switch (r) {
|
|
4307
4346
|
case "url": {
|
|
4308
4347
|
const u = new URLSearchParams(o);
|
|
@@ -4310,114 +4349,114 @@ function tn(n = {}) {
|
|
|
4310
4349
|
break;
|
|
4311
4350
|
}
|
|
4312
4351
|
case "session":
|
|
4313
|
-
sessionStorage.removeItem(
|
|
4352
|
+
sessionStorage.removeItem(Ee);
|
|
4314
4353
|
break;
|
|
4315
4354
|
case "local":
|
|
4316
|
-
localStorage.removeItem(
|
|
4355
|
+
localStorage.removeItem(Ie);
|
|
4317
4356
|
break;
|
|
4318
4357
|
}
|
|
4319
|
-
}, [r, o, t, a]),
|
|
4358
|
+
}, [r, o, t, a]), D = se(
|
|
4320
4359
|
(u) => {
|
|
4321
4360
|
switch (r) {
|
|
4322
4361
|
case "url": {
|
|
4323
|
-
const
|
|
4324
|
-
|
|
4362
|
+
const S = new URLSearchParams(o);
|
|
4363
|
+
S.set(t, u), a(S, { replace: !0 });
|
|
4325
4364
|
break;
|
|
4326
4365
|
}
|
|
4327
4366
|
case "session":
|
|
4328
|
-
sessionStorage.setItem(
|
|
4367
|
+
sessionStorage.setItem(Ee, u);
|
|
4329
4368
|
break;
|
|
4330
4369
|
case "local":
|
|
4331
|
-
localStorage.setItem(
|
|
4370
|
+
localStorage.setItem(Ie, u);
|
|
4332
4371
|
break;
|
|
4333
4372
|
}
|
|
4334
4373
|
},
|
|
4335
4374
|
[r, o, t, a]
|
|
4336
|
-
), E =
|
|
4375
|
+
), E = se(
|
|
4337
4376
|
(u) => {
|
|
4338
|
-
const
|
|
4339
|
-
i(
|
|
4377
|
+
const S = f[u] || f.default;
|
|
4378
|
+
i(S);
|
|
4340
4379
|
},
|
|
4341
|
-
[i,
|
|
4342
|
-
),
|
|
4380
|
+
[i, f]
|
|
4381
|
+
), P = se(() => x ? p ? h === oe.TENANT_ADMIN ? f.tenantAdmin : f.tenantUser : f.tenantGuest : p ? h === oe.TENANT_ADMIN ? f.publicAdmin : f.publicUser : f.publicGuest, [x, p, h, f]);
|
|
4343
4382
|
return {
|
|
4344
|
-
returnToUrl:
|
|
4345
|
-
clearReturnTo:
|
|
4346
|
-
setReturnTo:
|
|
4383
|
+
returnToUrl: R,
|
|
4384
|
+
clearReturnTo: N,
|
|
4385
|
+
setReturnTo: D,
|
|
4347
4386
|
navigateToZone: E,
|
|
4348
|
-
getSmartRedirect:
|
|
4387
|
+
getSmartRedirect: P
|
|
4349
4388
|
};
|
|
4350
4389
|
}
|
|
4351
|
-
function
|
|
4390
|
+
function tn(n, e, t = Xe, r = "url") {
|
|
4352
4391
|
if (!e || r !== "url")
|
|
4353
4392
|
return n;
|
|
4354
4393
|
const i = new URL(n, window.location.origin);
|
|
4355
4394
|
return i.searchParams.set(t, e), i.pathname + i.search;
|
|
4356
4395
|
}
|
|
4357
4396
|
export {
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4397
|
+
Fr as AdminZone,
|
|
4398
|
+
Xr as ApiMappers,
|
|
4399
|
+
qe as AppApiService,
|
|
4400
|
+
Gr as AppLoader,
|
|
4401
|
+
mr as AppProvider,
|
|
4402
|
+
yt as AuthApiService,
|
|
4403
|
+
Sr as AuthProvider,
|
|
4404
|
+
Nr as AuthenticatedZone,
|
|
4405
|
+
Je as DEFAULT_ZONE_PRESETS,
|
|
4406
|
+
Ue as DEFAULT_ZONE_ROOTS,
|
|
4407
|
+
qr as FeatureFlag,
|
|
4408
|
+
Pt as FeatureFlagApiService,
|
|
4409
|
+
Tr as FeatureFlagProvider,
|
|
4410
|
+
Dr as GuestZone,
|
|
4411
|
+
Yr as HealthApiService,
|
|
4412
|
+
le as HttpService,
|
|
4413
|
+
Ir as LandingRoute,
|
|
4414
|
+
zr as LoginForm,
|
|
4415
|
+
Wr as MagicLinkForm,
|
|
4416
|
+
Vr as MagicLinkVerify,
|
|
4378
4417
|
$r as OpenZone,
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4418
|
+
jr as PasswordRecoveryForm,
|
|
4419
|
+
Zr as PermissionApiService,
|
|
4420
|
+
Pr as Protected,
|
|
4421
|
+
Rr as ProtectedRoute,
|
|
4422
|
+
Lr as PublicZone,
|
|
4423
|
+
ze as RoleApiService,
|
|
4424
|
+
xr as RoutingProvider,
|
|
4425
|
+
ne as SessionExpiredError,
|
|
4426
|
+
we as SessionManager,
|
|
4427
|
+
_r as SignupForm,
|
|
4428
|
+
Et as SubscriptionApiService,
|
|
4390
4429
|
Or as SubscriptionGuard,
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4430
|
+
Jr as SubscriptionPlanApiService,
|
|
4431
|
+
kr as SubscriptionProvider,
|
|
4432
|
+
be as TenantApiService,
|
|
4433
|
+
Ur as TenantAuthenticatedZone,
|
|
4434
|
+
Br as TenantGuestZone,
|
|
4435
|
+
Hr as TenantOpenZone,
|
|
4436
|
+
wr as TenantProvider,
|
|
4398
4437
|
Er as TenantRoute,
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4438
|
+
Kr as TenantSelector,
|
|
4439
|
+
Mr as TenantZone,
|
|
4440
|
+
mt as TokenRefreshError,
|
|
4441
|
+
gt as TokenRefreshTimeoutError,
|
|
4442
|
+
wt as UserApiService,
|
|
4443
|
+
oe as UserType,
|
|
4444
|
+
Cr as UserZone,
|
|
4445
|
+
ce as ZoneRoute,
|
|
4446
|
+
tn as buildRedirectUrl,
|
|
4447
|
+
yr as useApi,
|
|
4448
|
+
Se as useApp,
|
|
4449
|
+
Qr as useAppLoaderState,
|
|
4411
4450
|
ue as useAuth,
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4451
|
+
Rt as useFeatureFlags,
|
|
4452
|
+
Ar as useRouting,
|
|
4453
|
+
Mt as useRoutingOptional,
|
|
4415
4454
|
vr as useSettings,
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4455
|
+
It as useSubscription,
|
|
4456
|
+
ge as useTenant,
|
|
4457
|
+
me as useTenantInfo,
|
|
4458
|
+
xe as useTenantOptional,
|
|
4459
|
+
br as useTenantSettings,
|
|
4460
|
+
en as useZoneNavigation
|
|
4422
4461
|
};
|
|
4423
4462
|
//# sourceMappingURL=index.es.js.map
|