@skylabs-digital/react-identity-access 2.12.0 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/LandingRoute.d.ts +13 -0
- package/dist/components/LandingRoute.d.ts.map +1 -1
- package/dist/components/ProtectedRoute.d.ts +20 -0
- package/dist/components/ProtectedRoute.d.ts.map +1 -1
- package/dist/components/TenantRoute.d.ts +13 -0
- package/dist/components/TenantRoute.d.ts.map +1 -1
- package/dist/components/ZoneRoute.d.ts +28 -0
- package/dist/components/ZoneRoute.d.ts.map +1 -0
- package/dist/hooks/useZoneNavigation.d.ts +17 -0
- package/dist/hooks/useZoneNavigation.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1720 -1449
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/providers/RoutingProvider.d.ts +56 -0
- package/dist/providers/RoutingProvider.d.ts.map +1 -0
- package/dist/types/zoneRouting.d.ts +122 -0
- package/dist/types/zoneRouting.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useLocation as
|
|
4
|
-
class
|
|
1
|
+
import { jsx as s, Fragment as _, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ue, useMemo as Z, useState as A, useCallback as re, useEffect as X, useContext as oe, useRef as We } from "react";
|
|
3
|
+
import { useLocation as be, Navigate as me, useNavigate as dt, useSearchParams as ut } from "react-router-dom";
|
|
4
|
+
class ie {
|
|
5
5
|
// SessionManager instance
|
|
6
6
|
constructor(e, t = 1e4) {
|
|
7
7
|
this.baseUrl = e.replace(/\/$/, ""), this.timeout = t;
|
|
@@ -12,60 +12,60 @@ class ne {
|
|
|
12
12
|
getBaseUrl() {
|
|
13
13
|
return this.baseUrl;
|
|
14
14
|
}
|
|
15
|
-
async request(e, t,
|
|
16
|
-
return this.executeRequest(e, t,
|
|
15
|
+
async request(e, t, n, o) {
|
|
16
|
+
return this.executeRequest(e, t, n, o, !1);
|
|
17
17
|
}
|
|
18
|
-
async executeRequest(e, t,
|
|
19
|
-
const a = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`,
|
|
20
|
-
let
|
|
18
|
+
async executeRequest(e, t, n, o, i = !1) {
|
|
19
|
+
const a = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, p = (o == null ? void 0 : o.timeout) || this.timeout;
|
|
20
|
+
let f = {
|
|
21
21
|
"Content-Type": "application/json",
|
|
22
|
-
...
|
|
22
|
+
...o == null ? void 0 : o.headers
|
|
23
23
|
};
|
|
24
|
-
if (!(
|
|
24
|
+
if (!(o != null && o.skipAuth) && this.sessionManager)
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
} catch (
|
|
29
|
-
console.warn("Failed to inject auth headers:",
|
|
26
|
+
const b = await this.sessionManager.getAuthHeaders();
|
|
27
|
+
f = { ...f, ...b };
|
|
28
|
+
} catch (b) {
|
|
29
|
+
console.warn("Failed to inject auth headers:", b);
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const w = new AbortController(), u = setTimeout(() => w.abort(), p);
|
|
32
32
|
try {
|
|
33
|
-
const
|
|
33
|
+
const b = await fetch(a, {
|
|
34
34
|
method: e,
|
|
35
|
-
headers:
|
|
36
|
-
body:
|
|
37
|
-
signal:
|
|
35
|
+
headers: f,
|
|
36
|
+
body: n ? JSON.stringify(n) : void 0,
|
|
37
|
+
signal: w.signal
|
|
38
38
|
});
|
|
39
|
-
if (clearTimeout(
|
|
39
|
+
if (clearTimeout(u), b.status === 401 && !(o != null && o.skipRetry) && !i && this.sessionManager)
|
|
40
40
|
try {
|
|
41
41
|
const T = this.sessionManager.getTokens();
|
|
42
42
|
if (T != null && T.refreshToken)
|
|
43
|
-
return await this.sessionManager.getAuthHeaders(), this.executeRequest(e, t,
|
|
43
|
+
return await this.sessionManager.getAuthHeaders(), this.executeRequest(e, t, n, o, !0);
|
|
44
44
|
} catch {
|
|
45
|
-
throw new Error(`HTTP ${
|
|
45
|
+
throw new Error(`HTTP ${b.status}: ${b.statusText}`);
|
|
46
46
|
}
|
|
47
|
-
if (!
|
|
48
|
-
throw new Error(`HTTP ${
|
|
49
|
-
const
|
|
50
|
-
return !
|
|
51
|
-
} catch (
|
|
52
|
-
throw clearTimeout(
|
|
47
|
+
if (!b.ok)
|
|
48
|
+
throw new Error(`HTTP ${b.status}: ${b.statusText}`);
|
|
49
|
+
const g = b.headers.get("content-type");
|
|
50
|
+
return !g || !g.includes("application/json") ? {} : await b.json();
|
|
51
|
+
} catch (b) {
|
|
52
|
+
throw clearTimeout(u), b instanceof Error && b.name === "AbortError" ? new Error(`Request timeout after ${p}ms`) : b;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
async get(e, t) {
|
|
56
56
|
return this.request("GET", e, void 0, t);
|
|
57
57
|
}
|
|
58
|
-
async post(e, t,
|
|
59
|
-
return this.request("POST", e, t,
|
|
58
|
+
async post(e, t, n) {
|
|
59
|
+
return this.request("POST", e, t, n);
|
|
60
60
|
}
|
|
61
|
-
async put(e, t,
|
|
62
|
-
return this.request("PUT", e, t,
|
|
61
|
+
async put(e, t, n) {
|
|
62
|
+
return this.request("PUT", e, t, n);
|
|
63
63
|
}
|
|
64
64
|
async delete(e, t) {
|
|
65
65
|
return this.request("DELETE", e, void 0, t);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
class
|
|
68
|
+
class $e {
|
|
69
69
|
constructor(e, t) {
|
|
70
70
|
this.httpService = e, this.sessionManager = t;
|
|
71
71
|
}
|
|
@@ -76,14 +76,14 @@ class Fe {
|
|
|
76
76
|
})).data;
|
|
77
77
|
}
|
|
78
78
|
async getApps(e) {
|
|
79
|
-
const t = await this.sessionManager.getAuthHeaders(),
|
|
80
|
-
e != null && e.page &&
|
|
81
|
-
const
|
|
79
|
+
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
80
|
+
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder);
|
|
81
|
+
const o = `/apps/${n.toString() ? `?${n.toString()}` : ""}`, i = await this.httpService.get(o, {
|
|
82
82
|
headers: t
|
|
83
83
|
});
|
|
84
84
|
return {
|
|
85
|
-
apps:
|
|
86
|
-
meta:
|
|
85
|
+
apps: i.data,
|
|
86
|
+
meta: i.meta
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
async getAppById(e) {
|
|
@@ -93,28 +93,28 @@ class Fe {
|
|
|
93
93
|
})).data;
|
|
94
94
|
}
|
|
95
95
|
async updateApp(e, t) {
|
|
96
|
-
const
|
|
96
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
97
97
|
return (await this.httpService.put(`/apps/${e}`, t, {
|
|
98
|
-
headers:
|
|
98
|
+
headers: n
|
|
99
99
|
})).data;
|
|
100
100
|
}
|
|
101
101
|
async getPublicAppInfo(e) {
|
|
102
102
|
return (await this.httpService.get(`/apps/${e}/public`)).data;
|
|
103
103
|
}
|
|
104
104
|
async setDefaultSubscriptionPlan(e, t) {
|
|
105
|
-
const
|
|
105
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
106
106
|
return (await this.httpService.put(
|
|
107
107
|
`/apps/${e}/default-subscription-plan`,
|
|
108
108
|
{ planId: t },
|
|
109
|
-
{ headers:
|
|
109
|
+
{ headers: n }
|
|
110
110
|
)).data;
|
|
111
111
|
}
|
|
112
|
-
async updateSettingsSchema(e, t,
|
|
113
|
-
const
|
|
112
|
+
async updateSettingsSchema(e, t, n) {
|
|
113
|
+
const o = await this.sessionManager.getAuthHeaders();
|
|
114
114
|
return (await this.httpService.put(
|
|
115
115
|
`/apps/${e}/settings-schema`,
|
|
116
|
-
{ schema: t, defaultSettings:
|
|
117
|
-
{ headers:
|
|
116
|
+
{ schema: t, defaultSettings: n },
|
|
117
|
+
{ headers: o }
|
|
118
118
|
)).data;
|
|
119
119
|
}
|
|
120
120
|
async exportConfig(e) {
|
|
@@ -124,102 +124,102 @@ class Fe {
|
|
|
124
124
|
})).data;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
const
|
|
128
|
-
function
|
|
129
|
-
const t =
|
|
127
|
+
const Re = ue(null);
|
|
128
|
+
function un({ config: r, children: e }) {
|
|
129
|
+
const t = Z(
|
|
130
130
|
() => {
|
|
131
|
-
var
|
|
131
|
+
var g, T, I;
|
|
132
132
|
return {
|
|
133
|
-
enabled: ((
|
|
134
|
-
ttl: ((T =
|
|
133
|
+
enabled: ((g = r.cache) == null ? void 0 : g.enabled) ?? !0,
|
|
134
|
+
ttl: ((T = r.cache) == null ? void 0 : T.ttl) ?? 3e5,
|
|
135
135
|
// 5 minutes default
|
|
136
|
-
storageKey: ((I =
|
|
136
|
+
storageKey: ((I = r.cache) == null ? void 0 : I.storageKey) ?? `app_cache_${r.appId}`
|
|
137
137
|
};
|
|
138
138
|
},
|
|
139
|
-
[
|
|
140
|
-
), [
|
|
139
|
+
[r.cache, r.appId]
|
|
140
|
+
), [n, o] = A(() => {
|
|
141
141
|
if (!t.enabled) return null;
|
|
142
142
|
try {
|
|
143
|
-
const
|
|
144
|
-
if (!
|
|
145
|
-
const T = JSON.parse(
|
|
146
|
-
return Date.now() - T.timestamp < t.ttl && T.appId ===
|
|
143
|
+
const g = localStorage.getItem(t.storageKey);
|
|
144
|
+
if (!g) return null;
|
|
145
|
+
const T = JSON.parse(g);
|
|
146
|
+
return Date.now() - T.timestamp < t.ttl && T.appId === r.appId ? T.data : (localStorage.removeItem(t.storageKey), null);
|
|
147
147
|
} catch {
|
|
148
148
|
return null;
|
|
149
149
|
}
|
|
150
|
-
}), [
|
|
151
|
-
const
|
|
152
|
-
|
|
150
|
+
}), [i, a] = A(!n), [p, f] = A(null), w = Z(() => {
|
|
151
|
+
const g = () => {
|
|
152
|
+
u();
|
|
153
153
|
};
|
|
154
154
|
return {
|
|
155
|
-
appId:
|
|
156
|
-
baseUrl:
|
|
155
|
+
appId: r.appId,
|
|
156
|
+
baseUrl: r.baseUrl,
|
|
157
157
|
// App info
|
|
158
|
-
appInfo:
|
|
159
|
-
isAppLoading:
|
|
160
|
-
appError:
|
|
161
|
-
retryApp:
|
|
158
|
+
appInfo: n,
|
|
159
|
+
isAppLoading: i,
|
|
160
|
+
appError: p,
|
|
161
|
+
retryApp: g
|
|
162
162
|
};
|
|
163
|
-
}, [
|
|
164
|
-
async (
|
|
165
|
-
if (!(!
|
|
163
|
+
}, [r, n, i, p]), u = re(
|
|
164
|
+
async (g = !1) => {
|
|
165
|
+
if (!(!g && t.enabled && n))
|
|
166
166
|
try {
|
|
167
|
-
a(!0),
|
|
168
|
-
const T = new
|
|
169
|
-
if (
|
|
167
|
+
a(!0), f(null);
|
|
168
|
+
const T = new ie(r.baseUrl), N = await new $e(T, {}).getPublicAppInfo(r.appId);
|
|
169
|
+
if (o(N), t.enabled)
|
|
170
170
|
try {
|
|
171
|
-
const
|
|
172
|
-
data:
|
|
171
|
+
const M = {
|
|
172
|
+
data: N,
|
|
173
173
|
timestamp: Date.now(),
|
|
174
|
-
appId:
|
|
174
|
+
appId: r.appId
|
|
175
175
|
};
|
|
176
|
-
localStorage.setItem(t.storageKey, JSON.stringify(
|
|
177
|
-
} catch (
|
|
178
|
-
console.warn("Failed to cache app info:",
|
|
176
|
+
localStorage.setItem(t.storageKey, JSON.stringify(M));
|
|
177
|
+
} catch (M) {
|
|
178
|
+
console.warn("Failed to cache app info:", M);
|
|
179
179
|
}
|
|
180
180
|
} catch (T) {
|
|
181
181
|
const I = T instanceof Error ? T : new Error("Failed to load app information");
|
|
182
|
-
|
|
182
|
+
f(I), o(null);
|
|
183
183
|
} finally {
|
|
184
184
|
a(!1);
|
|
185
185
|
}
|
|
186
186
|
},
|
|
187
|
-
[
|
|
188
|
-
),
|
|
189
|
-
if (!(!t.enabled || !
|
|
187
|
+
[r.baseUrl, r.appId, t, n]
|
|
188
|
+
), b = re(async () => {
|
|
189
|
+
if (!(!t.enabled || !n))
|
|
190
190
|
try {
|
|
191
|
-
const
|
|
192
|
-
if (!
|
|
193
|
-
const T = JSON.parse(
|
|
191
|
+
const g = localStorage.getItem(t.storageKey);
|
|
192
|
+
if (!g) return;
|
|
193
|
+
const T = JSON.parse(g);
|
|
194
194
|
if (Date.now() - T.timestamp > t.ttl * 0.5) {
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
data:
|
|
195
|
+
const N = new ie(r.baseUrl), P = await new $e(N, {}).getPublicAppInfo(r.appId);
|
|
196
|
+
o(P);
|
|
197
|
+
const h = {
|
|
198
|
+
data: P,
|
|
199
199
|
timestamp: Date.now(),
|
|
200
|
-
appId:
|
|
200
|
+
appId: r.appId
|
|
201
201
|
};
|
|
202
|
-
localStorage.setItem(t.storageKey, JSON.stringify(
|
|
202
|
+
localStorage.setItem(t.storageKey, JSON.stringify(h));
|
|
203
203
|
}
|
|
204
|
-
} catch (
|
|
205
|
-
console.warn("Background app refresh failed:",
|
|
204
|
+
} catch (g) {
|
|
205
|
+
console.warn("Background app refresh failed:", g);
|
|
206
206
|
}
|
|
207
|
-
}, [
|
|
208
|
-
return
|
|
209
|
-
|
|
210
|
-
}, []), /* @__PURE__ */
|
|
207
|
+
}, [r, t, n]);
|
|
208
|
+
return X(() => {
|
|
209
|
+
n ? b() : u();
|
|
210
|
+
}, []), /* @__PURE__ */ s(Re.Provider, { value: w, children: e });
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
const
|
|
214
|
-
if (!
|
|
212
|
+
function ye() {
|
|
213
|
+
const r = oe(Re);
|
|
214
|
+
if (!r)
|
|
215
215
|
throw new Error("useApp must be used within an AppProvider");
|
|
216
|
-
return
|
|
216
|
+
return r;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
return
|
|
218
|
+
function Ve() {
|
|
219
|
+
return oe(Re);
|
|
220
220
|
}
|
|
221
|
-
const
|
|
222
|
-
class
|
|
221
|
+
const hn = ye;
|
|
222
|
+
class Ae {
|
|
223
223
|
constructor(e = {}) {
|
|
224
224
|
this.refreshPromise = null, this.refreshQueue = [], e.tenantSlug !== void 0 ? this.storageKey = e.tenantSlug ? `auth_tokens_${e.tenantSlug}` : "auth_tokens" : this.storageKey = e.storageKey || "auth_tokens", this.autoRefresh = e.autoRefresh ?? !0, this.refreshThreshold = e.refreshThreshold || 3e5, this.onRefreshFailed = e.onRefreshFailed, this.baseUrl = e.baseUrl || "", this.tokenStorage = e.tokenStorage || this.createTokenStorage(this.storageKey);
|
|
225
225
|
}
|
|
@@ -256,13 +256,13 @@ class ke {
|
|
|
256
256
|
this.tokenStorage.set(t);
|
|
257
257
|
}
|
|
258
258
|
getTokens() {
|
|
259
|
-
const { accessToken: e, refreshToken: t, expiresAt:
|
|
259
|
+
const { accessToken: e, refreshToken: t, expiresAt: n, expiresIn: o, tokenType: i } = this.tokenStorage.get() || {};
|
|
260
260
|
return e ? {
|
|
261
261
|
accessToken: e,
|
|
262
262
|
refreshToken: t,
|
|
263
|
-
expiresAt:
|
|
264
|
-
expiresIn:
|
|
265
|
-
tokenType:
|
|
263
|
+
expiresAt: n,
|
|
264
|
+
expiresIn: o,
|
|
265
|
+
tokenType: i
|
|
266
266
|
} : null;
|
|
267
267
|
}
|
|
268
268
|
clearTokens() {
|
|
@@ -291,17 +291,17 @@ class ke {
|
|
|
291
291
|
if (!e.refreshToken)
|
|
292
292
|
return this.clearSession(), this.onRefreshFailed && this.onRefreshFailed(), {};
|
|
293
293
|
if (this.refreshPromise)
|
|
294
|
-
return new Promise((t,
|
|
295
|
-
this.refreshQueue.push({ resolve: t, reject:
|
|
294
|
+
return new Promise((t, n) => {
|
|
295
|
+
this.refreshQueue.push({ resolve: t, reject: n });
|
|
296
296
|
});
|
|
297
297
|
this.refreshPromise = this.performTokenRefresh(e.refreshToken);
|
|
298
298
|
try {
|
|
299
299
|
await this.refreshPromise;
|
|
300
|
-
const t = this.getTokens(),
|
|
301
|
-
return this.refreshQueue.forEach(({ resolve:
|
|
300
|
+
const t = this.getTokens(), n = t != null && t.accessToken ? { Authorization: `Bearer ${t.accessToken}` } : {};
|
|
301
|
+
return this.refreshQueue.forEach(({ resolve: o }) => o(n)), this.refreshQueue = [], n;
|
|
302
302
|
} catch (t) {
|
|
303
|
-
const
|
|
304
|
-
return this.refreshQueue.forEach(({ reject:
|
|
303
|
+
const n = t instanceof Error ? t : new Error("Token refresh failed");
|
|
304
|
+
return this.refreshQueue.forEach(({ reject: o }) => o(n)), this.refreshQueue = [], this.clearSession(), this.onRefreshFailed && this.onRefreshFailed(), {};
|
|
305
305
|
} finally {
|
|
306
306
|
this.refreshPromise = null;
|
|
307
307
|
}
|
|
@@ -309,7 +309,7 @@ class ke {
|
|
|
309
309
|
async performTokenRefresh(e) {
|
|
310
310
|
if (!this.baseUrl)
|
|
311
311
|
throw new Error("Base URL not configured for token refresh");
|
|
312
|
-
const t = `${this.baseUrl}/auth/refresh`,
|
|
312
|
+
const t = `${this.baseUrl}/auth/refresh`, n = await fetch(t, {
|
|
313
313
|
method: "POST",
|
|
314
314
|
headers: {
|
|
315
315
|
"Content-Type": "application/json"
|
|
@@ -318,13 +318,13 @@ class ke {
|
|
|
318
318
|
refreshToken: e
|
|
319
319
|
})
|
|
320
320
|
});
|
|
321
|
-
if (!
|
|
322
|
-
throw new Error(`Token refresh failed: ${
|
|
323
|
-
const
|
|
321
|
+
if (!n.ok)
|
|
322
|
+
throw new Error(`Token refresh failed: ${n.status} ${n.statusText}`);
|
|
323
|
+
const o = await n.json();
|
|
324
324
|
this.setTokens({
|
|
325
|
-
accessToken:
|
|
326
|
-
refreshToken:
|
|
327
|
-
expiresIn:
|
|
325
|
+
accessToken: o.accessToken,
|
|
326
|
+
refreshToken: o.refreshToken || e,
|
|
327
|
+
expiresIn: o.expiresIn
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
setUser(e) {
|
|
@@ -352,8 +352,8 @@ class ke {
|
|
|
352
352
|
if (!(e != null && e.accessToken)) return null;
|
|
353
353
|
const t = e.accessToken.split(".");
|
|
354
354
|
if (t.length !== 3) return null;
|
|
355
|
-
const
|
|
356
|
-
return JSON.parse(
|
|
355
|
+
const n = t[1], o = atob(n.replace(/-/g, "+").replace(/_/g, "/"));
|
|
356
|
+
return JSON.parse(o);
|
|
357
357
|
} catch {
|
|
358
358
|
return null;
|
|
359
359
|
}
|
|
@@ -372,7 +372,7 @@ class ke {
|
|
|
372
372
|
return e !== null && !this.isTokenExpired(e);
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
class
|
|
375
|
+
class ht {
|
|
376
376
|
constructor(e) {
|
|
377
377
|
this.httpService = e;
|
|
378
378
|
}
|
|
@@ -428,7 +428,7 @@ class rt {
|
|
|
428
428
|
});
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
class
|
|
431
|
+
class He {
|
|
432
432
|
constructor(e, t) {
|
|
433
433
|
this.httpService = e, this.sessionManager = t;
|
|
434
434
|
}
|
|
@@ -451,9 +451,9 @@ class Ce {
|
|
|
451
451
|
async updateRole(e, t) {
|
|
452
452
|
if (!this.sessionManager)
|
|
453
453
|
throw new Error("SessionManager is required for private endpoints");
|
|
454
|
-
const
|
|
454
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
455
455
|
return (await this.httpService.put(`/roles/${e}`, t, {
|
|
456
|
-
headers:
|
|
456
|
+
headers: n
|
|
457
457
|
})).data;
|
|
458
458
|
}
|
|
459
459
|
async deleteRole(e) {
|
|
@@ -466,37 +466,37 @@ class Ce {
|
|
|
466
466
|
}
|
|
467
467
|
// Public endpoint - no auth required
|
|
468
468
|
async getRolesByApp(e, t) {
|
|
469
|
-
const
|
|
470
|
-
t != null && t.page &&
|
|
471
|
-
const
|
|
469
|
+
const n = new URLSearchParams();
|
|
470
|
+
t != null && t.page && n.append("page", t.page.toString()), t != null && t.limit && n.append("limit", t.limit.toString()), t != null && t.sortBy && n.append("sortBy", t.sortBy), t != null && t.sortOrder && n.append("sortOrder", t.sortOrder);
|
|
471
|
+
const o = `/roles/app/${e}${n.toString() ? `?${n.toString()}` : ""}`, i = await this.httpService.get(o);
|
|
472
472
|
return {
|
|
473
|
-
roles:
|
|
474
|
-
meta:
|
|
473
|
+
roles: i.data,
|
|
474
|
+
meta: i.meta
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
477
|
async assignRole(e, t) {
|
|
478
478
|
if (!this.sessionManager)
|
|
479
479
|
throw new Error("SessionManager is required for private endpoints");
|
|
480
|
-
const
|
|
480
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
481
481
|
await this.httpService.post(`/roles/${e}/assign`, t, {
|
|
482
|
-
headers:
|
|
482
|
+
headers: n
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
485
|
async revokeRole(e, t) {
|
|
486
486
|
if (!this.sessionManager)
|
|
487
487
|
throw new Error("SessionManager is required for private endpoints");
|
|
488
|
-
const
|
|
488
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
489
489
|
await this.httpService.post(`/roles/${e}/revoke`, t, {
|
|
490
|
-
headers:
|
|
490
|
+
headers: n
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
493
|
async getUserRoles(e, t) {
|
|
494
494
|
if (!this.sessionManager)
|
|
495
495
|
throw new Error("SessionManager is required for private endpoints");
|
|
496
|
-
const
|
|
497
|
-
t != null && t.page &&
|
|
498
|
-
const
|
|
499
|
-
headers:
|
|
496
|
+
const n = await this.sessionManager.getAuthHeaders(), o = new URLSearchParams();
|
|
497
|
+
t != null && t.page && o.append("page", t.page.toString()), t != null && t.limit && o.append("limit", t.limit.toString()), t != null && t.sortBy && o.append("sortBy", t.sortBy), t != null && t.sortOrder && o.append("sortOrder", t.sortOrder);
|
|
498
|
+
const i = `/roles/user/${e}${o.toString() ? `?${o.toString()}` : ""}`, a = await this.httpService.get(i, {
|
|
499
|
+
headers: n
|
|
500
500
|
});
|
|
501
501
|
return {
|
|
502
502
|
roles: a.data,
|
|
@@ -504,7 +504,7 @@ class Ce {
|
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
class
|
|
507
|
+
class gt {
|
|
508
508
|
constructor(e, t) {
|
|
509
509
|
this.httpService = e, this.sessionManager = t;
|
|
510
510
|
}
|
|
@@ -515,14 +515,14 @@ class nt {
|
|
|
515
515
|
})).data;
|
|
516
516
|
}
|
|
517
517
|
async getUsers(e) {
|
|
518
|
-
const t = await this.sessionManager.getAuthHeaders(),
|
|
519
|
-
e != null && e.page &&
|
|
520
|
-
const
|
|
518
|
+
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
519
|
+
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder);
|
|
520
|
+
const o = `/users/${n.toString() ? `?${n.toString()}` : ""}`, i = await this.httpService.get(o, {
|
|
521
521
|
headers: t
|
|
522
522
|
});
|
|
523
523
|
return {
|
|
524
|
-
users:
|
|
525
|
-
meta:
|
|
524
|
+
users: i.data,
|
|
525
|
+
meta: i.meta
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
528
|
async getUserById(e) {
|
|
@@ -532,9 +532,9 @@ class nt {
|
|
|
532
532
|
})).data;
|
|
533
533
|
}
|
|
534
534
|
async updateUser(e, t) {
|
|
535
|
-
const
|
|
535
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
536
536
|
return (await this.httpService.put(`/users/${e}`, t, {
|
|
537
|
-
headers:
|
|
537
|
+
headers: n
|
|
538
538
|
})).data;
|
|
539
539
|
}
|
|
540
540
|
async deleteUser(e) {
|
|
@@ -544,9 +544,9 @@ class nt {
|
|
|
544
544
|
});
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
class
|
|
548
|
-
constructor(e, t,
|
|
549
|
-
this.httpService = e, this.appId = t, this.sessionManager =
|
|
547
|
+
class fe {
|
|
548
|
+
constructor(e, t, n) {
|
|
549
|
+
this.httpService = e, this.appId = t, this.sessionManager = n;
|
|
550
550
|
}
|
|
551
551
|
async createTenant(e) {
|
|
552
552
|
if (!this.sessionManager)
|
|
@@ -559,14 +559,14 @@ class ue {
|
|
|
559
559
|
async getTenants(e) {
|
|
560
560
|
if (!this.sessionManager)
|
|
561
561
|
throw new Error("SessionManager is required for private endpoints");
|
|
562
|
-
const t = await this.sessionManager.getAuthHeaders(),
|
|
563
|
-
e != null && e.page &&
|
|
564
|
-
const
|
|
562
|
+
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
563
|
+
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder);
|
|
564
|
+
const o = `/tenants/${n.toString() ? `?${n.toString()}` : ""}`, i = await this.httpService.get(o, {
|
|
565
565
|
headers: t
|
|
566
566
|
});
|
|
567
567
|
return {
|
|
568
|
-
tenants:
|
|
569
|
-
meta:
|
|
568
|
+
tenants: i.data,
|
|
569
|
+
meta: i.meta
|
|
570
570
|
};
|
|
571
571
|
}
|
|
572
572
|
async getTenantById(e) {
|
|
@@ -580,20 +580,20 @@ class ue {
|
|
|
580
580
|
async updateTenant(e, t) {
|
|
581
581
|
if (!this.sessionManager)
|
|
582
582
|
throw new Error("SessionManager is required for private endpoints");
|
|
583
|
-
const
|
|
583
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
584
584
|
return (await this.httpService.put(`/tenants/${e}`, t, {
|
|
585
|
-
headers:
|
|
585
|
+
headers: n
|
|
586
586
|
})).data;
|
|
587
587
|
}
|
|
588
588
|
async adminUpdateTenant(e, t) {
|
|
589
589
|
if (!this.sessionManager)
|
|
590
590
|
throw new Error("SessionManager is required for private endpoints");
|
|
591
|
-
const
|
|
591
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
592
592
|
return (await this.httpService.put(
|
|
593
593
|
`/tenants/${e}/admin-update`,
|
|
594
594
|
t,
|
|
595
595
|
{
|
|
596
|
-
headers:
|
|
596
|
+
headers: n
|
|
597
597
|
}
|
|
598
598
|
)).data;
|
|
599
599
|
}
|
|
@@ -612,72 +612,72 @@ class ue {
|
|
|
612
612
|
async updateTenantSettings(e, t) {
|
|
613
613
|
if (!this.sessionManager)
|
|
614
614
|
throw new Error("SessionManager is required for private endpoints");
|
|
615
|
-
const
|
|
615
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
616
616
|
return (await this.httpService.put(
|
|
617
617
|
`/tenants/${e}/settings`,
|
|
618
618
|
t,
|
|
619
619
|
{
|
|
620
|
-
headers:
|
|
620
|
+
headers: n
|
|
621
621
|
}
|
|
622
622
|
)).data;
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
if (
|
|
625
|
+
function pt(r, e) {
|
|
626
|
+
if (r === "localhost" || r.startsWith("127.") || r.startsWith("192.168."))
|
|
627
627
|
return null;
|
|
628
628
|
if (e) {
|
|
629
|
-
const
|
|
630
|
-
if (
|
|
629
|
+
const o = e.toLowerCase(), i = r.toLowerCase();
|
|
630
|
+
if (i === o || i === `www.${o}`)
|
|
631
631
|
return null;
|
|
632
|
-
if (
|
|
633
|
-
const a =
|
|
632
|
+
if (i.endsWith(`.${o}`)) {
|
|
633
|
+
const a = i.slice(0, -(o.length + 1));
|
|
634
634
|
return a === "www" ? null : a;
|
|
635
635
|
}
|
|
636
636
|
return null;
|
|
637
637
|
}
|
|
638
|
-
const
|
|
639
|
-
return
|
|
638
|
+
const n = r.split(".");
|
|
639
|
+
return n.length >= 3 && n[0] !== "www" ? n[0] : null;
|
|
640
640
|
}
|
|
641
|
-
function
|
|
642
|
-
const
|
|
643
|
-
return
|
|
641
|
+
function ft(r, e = "tenant", t) {
|
|
642
|
+
const o = new URLSearchParams(r).get(e);
|
|
643
|
+
return o ? (t && t.setItem("tenant", o), o) : t ? t.getItem("tenant") : null;
|
|
644
644
|
}
|
|
645
|
-
function
|
|
646
|
-
const { tenantMode:
|
|
647
|
-
return
|
|
645
|
+
function mt(r, e, t) {
|
|
646
|
+
const { tenantMode: n, baseDomain: o, selectorParam: i } = r;
|
|
647
|
+
return n === "subdomain" ? pt(e.hostname, o) : n === "selector" ? ft(e.search, i, t) : null;
|
|
648
648
|
}
|
|
649
|
-
function
|
|
649
|
+
function yt(r, e, t) {
|
|
650
650
|
if (t)
|
|
651
|
-
return `${
|
|
652
|
-
const
|
|
653
|
-
return
|
|
651
|
+
return `${r}.${t}`;
|
|
652
|
+
const n = e.split(".");
|
|
653
|
+
return n.length === 2 ? `${r}.${e}` : n.length >= 3 ? (n[0] = r, n.join(".")) : null;
|
|
654
654
|
}
|
|
655
|
-
const
|
|
656
|
-
function
|
|
657
|
-
const e = JSON.stringify(
|
|
655
|
+
const de = "_auth";
|
|
656
|
+
function Be(r) {
|
|
657
|
+
const e = JSON.stringify(r);
|
|
658
658
|
return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
659
659
|
}
|
|
660
|
-
function
|
|
660
|
+
function wt(r) {
|
|
661
661
|
try {
|
|
662
|
-
let e =
|
|
662
|
+
let e = r.replace(/-/g, "+").replace(/_/g, "/");
|
|
663
663
|
for (; e.length % 4; )
|
|
664
664
|
e += "=";
|
|
665
|
-
const t = atob(e),
|
|
666
|
-
return typeof
|
|
665
|
+
const t = atob(e), n = JSON.parse(t);
|
|
666
|
+
return typeof n.accessToken == "string" && typeof n.refreshToken == "string" && typeof n.expiresIn == "number" ? n : null;
|
|
667
667
|
} catch {
|
|
668
668
|
return null;
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function bt() {
|
|
672
672
|
if (typeof window > "u")
|
|
673
673
|
return console.log("[CrossDomainAuth] SSR environment, skipping URL token extraction"), null;
|
|
674
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
674
|
+
const e = new URLSearchParams(window.location.search).get(de);
|
|
675
675
|
if (console.log("[CrossDomainAuth] extractAuthTokensFromUrl called", {
|
|
676
676
|
hasAuthParam: !!e,
|
|
677
677
|
searchParams: window.location.search,
|
|
678
678
|
encodedLength: e == null ? void 0 : e.length
|
|
679
679
|
}), !e) return null;
|
|
680
|
-
const t =
|
|
680
|
+
const t = wt(e);
|
|
681
681
|
return console.log("[CrossDomainAuth] Token decode result:", {
|
|
682
682
|
success: !!t,
|
|
683
683
|
hasAccessToken: !!(t != null && t.accessToken),
|
|
@@ -685,135 +685,135 @@ function ct() {
|
|
|
685
685
|
expiresIn: t == null ? void 0 : t.expiresIn
|
|
686
686
|
}), t;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function St() {
|
|
689
689
|
if (typeof window > "u") return;
|
|
690
|
-
const
|
|
691
|
-
|
|
690
|
+
const r = new URL(window.location.href);
|
|
691
|
+
r.searchParams.delete(de), console.log("[CrossDomainAuth] Clearing auth tokens from URL", {
|
|
692
692
|
oldUrl: window.location.href,
|
|
693
|
-
newUrl:
|
|
694
|
-
}), window.history.replaceState({}, "",
|
|
693
|
+
newUrl: r.toString()
|
|
694
|
+
}), window.history.replaceState({}, "", r.toString());
|
|
695
695
|
}
|
|
696
|
-
const
|
|
697
|
-
function
|
|
698
|
-
const { baseUrl: t, appInfo:
|
|
696
|
+
const Ie = ue(null);
|
|
697
|
+
function gn({ config: r, children: e }) {
|
|
698
|
+
const { baseUrl: t, appInfo: n, appId: o } = ye(), i = re(() => typeof window > "u" ? null : mt(
|
|
699
699
|
{
|
|
700
|
-
tenantMode:
|
|
701
|
-
baseDomain:
|
|
702
|
-
selectorParam:
|
|
700
|
+
tenantMode: r.tenantMode || "selector",
|
|
701
|
+
baseDomain: r.baseDomain,
|
|
702
|
+
selectorParam: r.selectorParam
|
|
703
703
|
},
|
|
704
704
|
{
|
|
705
705
|
hostname: window.location.hostname,
|
|
706
706
|
search: window.location.search
|
|
707
707
|
},
|
|
708
708
|
window.localStorage
|
|
709
|
-
), [
|
|
709
|
+
), [r.tenantMode, r.baseDomain, r.selectorParam]), [a, p] = A(() => i()), f = Z(
|
|
710
710
|
() => {
|
|
711
|
-
var
|
|
711
|
+
var c, H, F;
|
|
712
712
|
return {
|
|
713
|
-
enabled: ((
|
|
714
|
-
ttl: ((H =
|
|
713
|
+
enabled: ((c = r.cache) == null ? void 0 : c.enabled) ?? !0,
|
|
714
|
+
ttl: ((H = r.cache) == null ? void 0 : H.ttl) ?? 5 * 60 * 1e3,
|
|
715
715
|
// 5 minutes default
|
|
716
|
-
storageKey: ((
|
|
716
|
+
storageKey: ((F = r.cache) == null ? void 0 : F.storageKey) ?? `tenant_cache_${a || "default"}`
|
|
717
717
|
};
|
|
718
718
|
},
|
|
719
|
-
[
|
|
720
|
-
), [
|
|
721
|
-
if (
|
|
722
|
-
if (!
|
|
719
|
+
[r.cache, a]
|
|
720
|
+
), [w, u] = A(() => {
|
|
721
|
+
if (r.initialTenant) return r.initialTenant;
|
|
722
|
+
if (!f.enabled || !a) return null;
|
|
723
723
|
try {
|
|
724
|
-
const
|
|
725
|
-
if (!
|
|
726
|
-
const H = JSON.parse(
|
|
727
|
-
return Date.now() - H.timestamp <
|
|
724
|
+
const c = localStorage.getItem(f.storageKey);
|
|
725
|
+
if (!c) return null;
|
|
726
|
+
const H = JSON.parse(c);
|
|
727
|
+
return Date.now() - H.timestamp < f.ttl && H.tenantSlug === a ? H.data : (localStorage.removeItem(f.storageKey), null);
|
|
728
728
|
} catch {
|
|
729
729
|
return null;
|
|
730
730
|
}
|
|
731
|
-
}), [
|
|
732
|
-
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
}, [
|
|
736
|
-
const
|
|
737
|
-
async (
|
|
738
|
-
if (!(!H &&
|
|
731
|
+
}), [b, g] = A(!w && !r.initialTenant), [T, I] = A(null), [N, M] = A(null), [P, h] = A(!1), [x, S] = A(null);
|
|
732
|
+
X(() => {
|
|
733
|
+
const c = i();
|
|
734
|
+
p(c);
|
|
735
|
+
}, [i]);
|
|
736
|
+
const L = (n == null ? void 0 : n.settingsSchema) || null, E = re(
|
|
737
|
+
async (c, H = !1) => {
|
|
738
|
+
if (!(!H && f.enabled && w && w.domain === c))
|
|
739
739
|
try {
|
|
740
|
-
|
|
741
|
-
const
|
|
742
|
-
if (
|
|
740
|
+
g(!0), I(null);
|
|
741
|
+
const F = new ie(t), m = await new fe(F, o).getPublicTenantInfo(c);
|
|
742
|
+
if (u(m), f.enabled)
|
|
743
743
|
try {
|
|
744
|
-
const
|
|
745
|
-
data:
|
|
744
|
+
const v = {
|
|
745
|
+
data: m,
|
|
746
746
|
timestamp: Date.now(),
|
|
747
|
-
tenantSlug:
|
|
747
|
+
tenantSlug: c
|
|
748
748
|
};
|
|
749
|
-
localStorage.setItem(
|
|
750
|
-
} catch (
|
|
751
|
-
console.warn("Failed to cache tenant info:",
|
|
749
|
+
localStorage.setItem(f.storageKey, JSON.stringify(v));
|
|
750
|
+
} catch (v) {
|
|
751
|
+
console.warn("Failed to cache tenant info:", v);
|
|
752
752
|
}
|
|
753
|
-
} catch (
|
|
754
|
-
const
|
|
755
|
-
I(
|
|
753
|
+
} catch (F) {
|
|
754
|
+
const y = F instanceof Error ? F : new Error("Failed to load tenant information");
|
|
755
|
+
I(y), u(null);
|
|
756
756
|
} finally {
|
|
757
|
-
|
|
757
|
+
g(!1);
|
|
758
758
|
}
|
|
759
759
|
},
|
|
760
|
-
[t,
|
|
761
|
-
),
|
|
762
|
-
if (!(!
|
|
760
|
+
[t, o, f, w]
|
|
761
|
+
), C = re(async () => {
|
|
762
|
+
if (!(!f.enabled || !w || !a))
|
|
763
763
|
try {
|
|
764
|
-
const
|
|
765
|
-
if (!
|
|
766
|
-
const H = JSON.parse(
|
|
767
|
-
if (Date.now() - H.timestamp >
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
const
|
|
771
|
-
data:
|
|
764
|
+
const c = localStorage.getItem(f.storageKey);
|
|
765
|
+
if (!c) return;
|
|
766
|
+
const H = JSON.parse(c);
|
|
767
|
+
if (Date.now() - H.timestamp > f.ttl * 0.5) {
|
|
768
|
+
const y = new ie(t), v = await new fe(y, o).getPublicTenantInfo(a);
|
|
769
|
+
u(v);
|
|
770
|
+
const G = {
|
|
771
|
+
data: v,
|
|
772
772
|
timestamp: Date.now(),
|
|
773
773
|
tenantSlug: a
|
|
774
774
|
};
|
|
775
|
-
localStorage.setItem(
|
|
775
|
+
localStorage.setItem(f.storageKey, JSON.stringify(G));
|
|
776
776
|
}
|
|
777
|
-
} catch (
|
|
778
|
-
console.warn("Background tenant refresh failed:",
|
|
777
|
+
} catch (c) {
|
|
778
|
+
console.warn("Background tenant refresh failed:", c);
|
|
779
779
|
}
|
|
780
|
-
}, [t,
|
|
781
|
-
if (
|
|
780
|
+
}, [t, o, f, w, a]), R = re(async () => {
|
|
781
|
+
if (w != null && w.id)
|
|
782
782
|
try {
|
|
783
|
-
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
} catch (
|
|
787
|
-
const H =
|
|
788
|
-
|
|
783
|
+
h(!0), S(null);
|
|
784
|
+
const c = new ie(t), F = await new fe(c, w.appId).getTenantSettings(w.id);
|
|
785
|
+
M(F);
|
|
786
|
+
} catch (c) {
|
|
787
|
+
const H = c instanceof Error ? c : new Error("Failed to load tenant settings");
|
|
788
|
+
S(H), M(null);
|
|
789
789
|
} finally {
|
|
790
|
-
|
|
790
|
+
h(!1);
|
|
791
791
|
}
|
|
792
|
-
}, [t,
|
|
793
|
-
|
|
794
|
-
}, [
|
|
795
|
-
(
|
|
796
|
-
if (!
|
|
792
|
+
}, [t, w]), $ = re(() => {
|
|
793
|
+
R();
|
|
794
|
+
}, [R]), l = re(
|
|
795
|
+
(c) => {
|
|
796
|
+
if (!L)
|
|
797
797
|
return { isValid: !0, errors: [] };
|
|
798
798
|
const H = [];
|
|
799
799
|
try {
|
|
800
|
-
return
|
|
801
|
-
var
|
|
802
|
-
const
|
|
803
|
-
if ((
|
|
804
|
-
H.push(`Field '${
|
|
800
|
+
return L.properties && Object.entries(L.properties).forEach(([F, y]) => {
|
|
801
|
+
var v;
|
|
802
|
+
const m = c[F];
|
|
803
|
+
if ((v = L.required) != null && v.includes(F) && m == null) {
|
|
804
|
+
H.push(`Field '${F}' is required`);
|
|
805
805
|
return;
|
|
806
806
|
}
|
|
807
|
-
if (
|
|
808
|
-
if (
|
|
809
|
-
const
|
|
810
|
-
|
|
807
|
+
if (m != null) {
|
|
808
|
+
if (y.type) {
|
|
809
|
+
const G = y.type, J = typeof m;
|
|
810
|
+
G === "string" && J !== "string" ? H.push(`Field '${F}' must be a string`) : (G === "number" || G === "integer") && J !== "number" ? H.push(`Field '${F}' must be a number`) : G === "boolean" && J !== "boolean" ? H.push(`Field '${F}' must be a boolean`) : G === "array" && !Array.isArray(m) && H.push(`Field '${F}' must be an array`);
|
|
811
811
|
}
|
|
812
|
-
|
|
813
|
-
`Field '${
|
|
814
|
-
),
|
|
815
|
-
`Field '${
|
|
816
|
-
),
|
|
812
|
+
y.minLength !== void 0 && typeof m == "string" && m.length < y.minLength && H.push(
|
|
813
|
+
`Field '${F}' must be at least ${y.minLength} characters long`
|
|
814
|
+
), y.maxLength !== void 0 && typeof m == "string" && m.length > y.maxLength && H.push(
|
|
815
|
+
`Field '${F}' must be no more than ${y.maxLength} characters long`
|
|
816
|
+
), y.minimum !== void 0 && typeof m == "number" && m < y.minimum && H.push(`Field '${F}' must be at least ${y.minimum}`), y.maximum !== void 0 && typeof m == "number" && m > y.maximum && H.push(`Field '${F}' must be no more than ${y.maximum}`), y.pattern && typeof m == "string" && (new RegExp(y.pattern).test(m) || H.push(`Field '${F}' does not match the required pattern`)), y.enum && !y.enum.includes(m) && H.push(`Field '${F}' must be one of: ${y.enum.join(", ")}`);
|
|
817
817
|
}
|
|
818
818
|
}), {
|
|
819
819
|
isValid: H.length === 0,
|
|
@@ -826,401 +826,401 @@ function Yt({ config: i, children: e }) {
|
|
|
826
826
|
};
|
|
827
827
|
}
|
|
828
828
|
},
|
|
829
|
-
[
|
|
829
|
+
[L]
|
|
830
830
|
);
|
|
831
|
-
|
|
832
|
-
!
|
|
833
|
-
}, [
|
|
834
|
-
|
|
835
|
-
}, [
|
|
836
|
-
const
|
|
837
|
-
(
|
|
838
|
-
const { mode:
|
|
839
|
-
if (localStorage.setItem("tenant",
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
831
|
+
X(() => {
|
|
832
|
+
!r.initialTenant && a ? w ? C() : E(a) : !r.initialTenant && !a && (u(null), I(null), g(!1));
|
|
833
|
+
}, [r.initialTenant, a, w, E, C]), X(() => {
|
|
834
|
+
w != null && w.id ? R() : (M(null), S(null), h(!1));
|
|
835
|
+
}, [w == null ? void 0 : w.id, R]);
|
|
836
|
+
const D = re(
|
|
837
|
+
(c, H) => {
|
|
838
|
+
const { mode: F = "reload", tokens: y, redirectPath: m } = H || {}, v = r.tenantMode || "selector";
|
|
839
|
+
if (localStorage.setItem("tenant", c), v === "subdomain") {
|
|
840
|
+
const G = window.location.hostname, J = yt(
|
|
841
|
+
c,
|
|
842
|
+
G,
|
|
843
|
+
r.baseDomain
|
|
844
844
|
);
|
|
845
|
-
if (!
|
|
845
|
+
if (!J) {
|
|
846
846
|
console.warn(
|
|
847
847
|
"[TenantProvider] Cannot switch subdomain, invalid hostname:",
|
|
848
|
-
|
|
848
|
+
G
|
|
849
849
|
);
|
|
850
850
|
return;
|
|
851
851
|
}
|
|
852
|
-
const
|
|
853
|
-
new URLSearchParams(window.location.search).forEach((
|
|
854
|
-
|
|
855
|
-
}),
|
|
856
|
-
} else if (
|
|
857
|
-
const
|
|
858
|
-
if (
|
|
859
|
-
const
|
|
860
|
-
window.location.href =
|
|
852
|
+
const q = m || window.location.pathname, O = new URL(`${window.location.protocol}//${J}${q}`);
|
|
853
|
+
new URLSearchParams(window.location.search).forEach((k, K) => {
|
|
854
|
+
K !== de && O.searchParams.set(K, k);
|
|
855
|
+
}), y && O.searchParams.set(de, Be(y)), window.location.href = O.toString();
|
|
856
|
+
} else if (v === "selector") {
|
|
857
|
+
const G = m || window.location.pathname, J = new URLSearchParams(window.location.search);
|
|
858
|
+
if (J.set(r.selectorParam || "tenant", c), J.delete(de), y && J.set(de, Be(y)), F === "reload") {
|
|
859
|
+
const q = `${G}?${J.toString()}${window.location.hash}`;
|
|
860
|
+
window.location.href = q;
|
|
861
861
|
} else {
|
|
862
|
-
const
|
|
863
|
-
window.history.pushState({}, "",
|
|
862
|
+
const q = `${G}?${J.toString()}${window.location.hash}`;
|
|
863
|
+
window.history.pushState({}, "", q), p(c), E(c);
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
866
|
},
|
|
867
|
-
[
|
|
868
|
-
),
|
|
867
|
+
[r.tenantMode, r.selectorParam, r.baseDomain, E]
|
|
868
|
+
), U = Z(() => ({
|
|
869
869
|
// Tenant info
|
|
870
|
-
tenant:
|
|
870
|
+
tenant: w,
|
|
871
871
|
tenantSlug: a,
|
|
872
|
-
isTenantLoading:
|
|
872
|
+
isTenantLoading: b,
|
|
873
873
|
tenantError: T,
|
|
874
874
|
retryTenant: () => {
|
|
875
|
-
a &&
|
|
875
|
+
a && E(a);
|
|
876
876
|
},
|
|
877
877
|
// Settings
|
|
878
|
-
settings:
|
|
879
|
-
settingsSchema:
|
|
880
|
-
isSettingsLoading:
|
|
881
|
-
settingsError:
|
|
878
|
+
settings: N,
|
|
879
|
+
settingsSchema: L,
|
|
880
|
+
isSettingsLoading: P,
|
|
881
|
+
settingsError: x,
|
|
882
882
|
// Actions
|
|
883
|
-
refreshSettings:
|
|
884
|
-
switchTenant:
|
|
883
|
+
refreshSettings: $,
|
|
884
|
+
switchTenant: D,
|
|
885
885
|
// Validation
|
|
886
|
-
validateSettings:
|
|
886
|
+
validateSettings: l
|
|
887
887
|
}), [
|
|
888
|
-
|
|
888
|
+
w,
|
|
889
889
|
a,
|
|
890
|
-
|
|
890
|
+
b,
|
|
891
891
|
T,
|
|
892
|
-
|
|
893
|
-
|
|
892
|
+
N,
|
|
893
|
+
L,
|
|
894
|
+
P,
|
|
894
895
|
x,
|
|
895
896
|
$,
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
c
|
|
897
|
+
D,
|
|
898
|
+
l
|
|
899
899
|
]);
|
|
900
|
-
return /* @__PURE__ */
|
|
900
|
+
return /* @__PURE__ */ s(Ie.Provider, { value: U, children: e });
|
|
901
901
|
}
|
|
902
|
-
function
|
|
903
|
-
const
|
|
904
|
-
if (!
|
|
902
|
+
function he() {
|
|
903
|
+
const r = oe(Ie);
|
|
904
|
+
if (!r)
|
|
905
905
|
throw new Error("useTenant must be used within a TenantProvider");
|
|
906
|
-
return
|
|
906
|
+
return r;
|
|
907
907
|
}
|
|
908
|
-
function
|
|
909
|
-
return
|
|
908
|
+
function Se() {
|
|
909
|
+
return oe(Ie);
|
|
910
910
|
}
|
|
911
|
-
const
|
|
912
|
-
function
|
|
913
|
-
const { settings:
|
|
911
|
+
const pn = he;
|
|
912
|
+
function fn() {
|
|
913
|
+
const { settings: r, settingsSchema: e, isSettingsLoading: t, settingsError: n, validateSettings: o } = he();
|
|
914
914
|
return {
|
|
915
|
-
settings:
|
|
915
|
+
settings: r,
|
|
916
916
|
settingsSchema: e,
|
|
917
917
|
isLoading: t,
|
|
918
|
-
error:
|
|
919
|
-
validateSettings:
|
|
918
|
+
error: n,
|
|
919
|
+
validateSettings: o
|
|
920
920
|
};
|
|
921
921
|
}
|
|
922
|
-
function
|
|
923
|
-
const { tenant:
|
|
922
|
+
function ge() {
|
|
923
|
+
const { tenant: r, tenantSlug: e, isTenantLoading: t, tenantError: n, retryTenant: o } = he();
|
|
924
924
|
return {
|
|
925
|
-
tenant:
|
|
925
|
+
tenant: r,
|
|
926
926
|
tenantSlug: e,
|
|
927
927
|
isLoading: t,
|
|
928
|
-
error:
|
|
929
|
-
retry:
|
|
928
|
+
error: n,
|
|
929
|
+
retry: o
|
|
930
930
|
};
|
|
931
931
|
}
|
|
932
|
-
const
|
|
933
|
-
function
|
|
934
|
-
const { appId: t, baseUrl:
|
|
932
|
+
const Me = ue(null);
|
|
933
|
+
function mn({ config: r = {}, children: e }) {
|
|
934
|
+
const { appId: t, baseUrl: n } = ye(), { tenant: o, tenantSlug: i, switchTenant: a } = he(), [p, f] = A(r.initialRoles || []), [w, u] = A(!r.initialRoles), [b, g] = A(null), [T, I] = A(!1), [N, M] = A(null), [P, h] = A(0), [x, S] = A(() => {
|
|
935
935
|
try {
|
|
936
|
-
const
|
|
937
|
-
return
|
|
936
|
+
const k = localStorage.getItem("userTenants");
|
|
937
|
+
return k ? JSON.parse(k) : [];
|
|
938
938
|
} catch {
|
|
939
939
|
return [];
|
|
940
940
|
}
|
|
941
|
-
}), [
|
|
942
|
-
|
|
941
|
+
}), [L, E] = A(!1), C = We({ done: !1, urlTokens: null });
|
|
942
|
+
C.current.done || (C.current.done = !0, C.current.urlTokens = bt(), C.current.urlTokens && console.log(
|
|
943
943
|
"[AuthProvider] SYNC: URL tokens found, will block isAuthReady until user loaded"
|
|
944
944
|
));
|
|
945
|
-
const [
|
|
946
|
-
const
|
|
947
|
-
return console.log("[AuthProvider] SYNC: isLoadingAfterUrlTokens initial:",
|
|
948
|
-
}),
|
|
949
|
-
const
|
|
950
|
-
tenantSlug:
|
|
951
|
-
onRefreshFailed:
|
|
952
|
-
baseUrl:
|
|
945
|
+
const [R, $] = A(() => {
|
|
946
|
+
const k = C.current.urlTokens !== null;
|
|
947
|
+
return console.log("[AuthProvider] SYNC: isLoadingAfterUrlTokens initial:", k), k;
|
|
948
|
+
}), l = Z(() => {
|
|
949
|
+
const k = new Ae({
|
|
950
|
+
tenantSlug: i,
|
|
951
|
+
onRefreshFailed: r.onRefreshFailed,
|
|
952
|
+
baseUrl: n
|
|
953
953
|
});
|
|
954
|
-
return
|
|
955
|
-
accessToken:
|
|
956
|
-
refreshToken:
|
|
957
|
-
expiresIn:
|
|
958
|
-
}), console.log("[AuthProvider] SYNC: Session valid:",
|
|
959
|
-
}, [
|
|
960
|
-
const
|
|
961
|
-
return
|
|
962
|
-
}, [
|
|
963
|
-
const
|
|
954
|
+
return C.current.urlTokens && (console.log("[AuthProvider] SYNC: Saving URL tokens to session manager"), k.setTokens({
|
|
955
|
+
accessToken: C.current.urlTokens.accessToken,
|
|
956
|
+
refreshToken: C.current.urlTokens.refreshToken,
|
|
957
|
+
expiresIn: C.current.urlTokens.expiresIn
|
|
958
|
+
}), console.log("[AuthProvider] SYNC: Session valid:", k.hasValidSession())), k;
|
|
959
|
+
}, [i, n, r.onRefreshFailed]), D = C.current.done && !R, U = Z(() => {
|
|
960
|
+
const k = new ie(n);
|
|
961
|
+
return k.setSessionManager(l), k;
|
|
962
|
+
}, [n, l]), c = Z(() => new ht(new ie(n)), [n]), H = Z(() => new gt(U, l), [U, l]), F = Z(() => new He(new ie(n)), [n]), y = Z(() => b || l.getUser(), [b, l]), m = Z(() => y != null && y.roleId && p.find((k) => k.id === y.roleId) || null, [y, p]), v = Z(() => (m == null ? void 0 : m.permissions) || [], [m]), G = Z(() => l.hasValidSession() && b !== null, [l, b]), J = 5 * 60 * 1e3, q = Z(() => {
|
|
963
|
+
const k = async (B = !1) => {
|
|
964
964
|
try {
|
|
965
|
-
if (!
|
|
965
|
+
if (!l.hasValidSession())
|
|
966
966
|
return;
|
|
967
967
|
const z = Date.now();
|
|
968
|
-
if (!
|
|
968
|
+
if (!B && z - P < J && b)
|
|
969
969
|
return;
|
|
970
|
-
const W =
|
|
970
|
+
const W = l.getUserId();
|
|
971
971
|
if (!W) {
|
|
972
972
|
console.warn("[AuthProvider] No userId available in token or storage");
|
|
973
973
|
return;
|
|
974
974
|
}
|
|
975
|
-
I(!0),
|
|
975
|
+
I(!0), M(null);
|
|
976
976
|
const Q = await H.getUserById(W);
|
|
977
|
-
|
|
977
|
+
g(Q), l.setUser(Q), h(Date.now());
|
|
978
978
|
} catch (z) {
|
|
979
979
|
const Y = z instanceof Error ? z : new Error("Failed to load user data");
|
|
980
|
-
|
|
980
|
+
M(Y), console.error("[AuthProvider] Failed to load user data:", Y);
|
|
981
981
|
} finally {
|
|
982
982
|
I(!1);
|
|
983
983
|
}
|
|
984
|
-
},
|
|
985
|
-
await
|
|
986
|
-
},
|
|
987
|
-
var
|
|
988
|
-
const { username: z, password: Y, tenantSlug: W, redirectPath: Q } =
|
|
989
|
-
let
|
|
990
|
-
W && (
|
|
991
|
-
const
|
|
984
|
+
}, K = async () => {
|
|
985
|
+
await k();
|
|
986
|
+
}, ce = async (B) => {
|
|
987
|
+
var Ce;
|
|
988
|
+
const { username: z, password: Y, tenantSlug: W, redirectPath: Q } = B;
|
|
989
|
+
let ee = o == null ? void 0 : o.id, te = i, ne = l;
|
|
990
|
+
W && (ee = (await new fe(U, t).getPublicTenantInfo(W)).id, te = W);
|
|
991
|
+
const j = await c.login({
|
|
992
992
|
username: z,
|
|
993
993
|
password: Y,
|
|
994
994
|
appId: t,
|
|
995
|
-
tenantId:
|
|
996
|
-
}),
|
|
997
|
-
if (
|
|
998
|
-
tenantSlug:
|
|
999
|
-
baseUrl:
|
|
1000
|
-
})),
|
|
1001
|
-
accessToken:
|
|
1002
|
-
refreshToken:
|
|
1003
|
-
expiresIn:
|
|
1004
|
-
}),
|
|
1005
|
-
|
|
995
|
+
tenantId: ee
|
|
996
|
+
}), pe = W && W !== i;
|
|
997
|
+
if (pe && (ne = new Ae({
|
|
998
|
+
tenantSlug: te,
|
|
999
|
+
baseUrl: n
|
|
1000
|
+
})), ne.setTokens({
|
|
1001
|
+
accessToken: j.accessToken,
|
|
1002
|
+
refreshToken: j.refreshToken,
|
|
1003
|
+
expiresIn: j.expiresIn
|
|
1004
|
+
}), j.user) {
|
|
1005
|
+
ne.setUser(j.user), g(j.user);
|
|
1006
1006
|
try {
|
|
1007
|
-
await
|
|
1008
|
-
} catch (
|
|
1009
|
-
console.warn("Failed to load complete user data after login:",
|
|
1007
|
+
await k();
|
|
1008
|
+
} catch (we) {
|
|
1009
|
+
console.warn("Failed to load complete user data after login:", we);
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
|
-
if (
|
|
1013
|
-
|
|
1012
|
+
if (j.tenants && j.tenants.length > 0) {
|
|
1013
|
+
S(j.tenants);
|
|
1014
1014
|
try {
|
|
1015
|
-
localStorage.setItem("userTenants", JSON.stringify(
|
|
1015
|
+
localStorage.setItem("userTenants", JSON.stringify(j.tenants));
|
|
1016
1016
|
} catch {
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
|
-
const
|
|
1020
|
-
if (
|
|
1019
|
+
const ke = ((Ce = j.user) == null ? void 0 : Ce.tenantId) !== null;
|
|
1020
|
+
if (E(ke), pe && te && te !== i && a(te, {
|
|
1021
1021
|
tokens: {
|
|
1022
|
-
accessToken:
|
|
1023
|
-
refreshToken:
|
|
1024
|
-
expiresIn:
|
|
1022
|
+
accessToken: j.accessToken,
|
|
1023
|
+
refreshToken: j.refreshToken,
|
|
1024
|
+
expiresIn: j.expiresIn
|
|
1025
1025
|
},
|
|
1026
1026
|
redirectPath: Q
|
|
1027
|
-
}), !
|
|
1028
|
-
const
|
|
1029
|
-
if (
|
|
1030
|
-
const
|
|
1031
|
-
a(
|
|
1027
|
+
}), !ke && j.tenants && j.tenants.length > 0) {
|
|
1028
|
+
const we = B.autoSwitch !== !1 && r.autoSwitchSingleTenant !== !1;
|
|
1029
|
+
if (j.tenants.length === 1 && we) {
|
|
1030
|
+
const Ue = j.tenants[0];
|
|
1031
|
+
a(Ue.subdomain, {
|
|
1032
1032
|
tokens: {
|
|
1033
|
-
accessToken:
|
|
1034
|
-
refreshToken:
|
|
1035
|
-
expiresIn:
|
|
1033
|
+
accessToken: j.accessToken,
|
|
1034
|
+
refreshToken: j.refreshToken,
|
|
1035
|
+
expiresIn: j.expiresIn
|
|
1036
1036
|
},
|
|
1037
1037
|
redirectPath: Q
|
|
1038
1038
|
});
|
|
1039
|
-
} else
|
|
1039
|
+
} else j.tenants.length > 1 && r.onTenantSelectionRequired && r.onTenantSelectionRequired(j.tenants);
|
|
1040
1040
|
}
|
|
1041
|
-
return
|
|
1042
|
-
},
|
|
1043
|
-
const { email: z, phoneNumber: Y, name: W, password: Q, lastName:
|
|
1041
|
+
return j;
|
|
1042
|
+
}, ve = async (B) => {
|
|
1043
|
+
const { email: z, phoneNumber: Y, name: W, password: Q, lastName: ee, tenantId: te } = B;
|
|
1044
1044
|
if (!z && !Y)
|
|
1045
1045
|
throw new Error("Either email or phoneNumber is required");
|
|
1046
1046
|
if (!W || !Q)
|
|
1047
1047
|
throw new Error("Name and password are required");
|
|
1048
|
-
const
|
|
1049
|
-
return await
|
|
1048
|
+
const ne = te ?? (o == null ? void 0 : o.id);
|
|
1049
|
+
return await c.signup({
|
|
1050
1050
|
email: z,
|
|
1051
1051
|
phoneNumber: Y,
|
|
1052
1052
|
name: W,
|
|
1053
1053
|
password: Q,
|
|
1054
|
-
tenantId:
|
|
1055
|
-
lastName:
|
|
1054
|
+
tenantId: ne,
|
|
1055
|
+
lastName: ee,
|
|
1056
1056
|
appId: t
|
|
1057
1057
|
});
|
|
1058
|
-
},
|
|
1059
|
-
const { email: z, phoneNumber: Y, name: W, password: Q, tenantName:
|
|
1058
|
+
}, Ye = async (B) => {
|
|
1059
|
+
const { email: z, phoneNumber: Y, name: W, password: Q, tenantName: ee, lastName: te } = B;
|
|
1060
1060
|
if (!z && !Y)
|
|
1061
1061
|
throw new Error("Either email or phoneNumber is required");
|
|
1062
|
-
if (!W || !Q || !
|
|
1062
|
+
if (!W || !Q || !ee)
|
|
1063
1063
|
throw new Error("Name, password, and tenantName are required");
|
|
1064
|
-
return await
|
|
1064
|
+
return await c.signupTenantAdmin({
|
|
1065
1065
|
email: z,
|
|
1066
1066
|
phoneNumber: Y,
|
|
1067
1067
|
name: W,
|
|
1068
1068
|
password: Q,
|
|
1069
|
-
tenantName:
|
|
1069
|
+
tenantName: ee,
|
|
1070
1070
|
appId: t,
|
|
1071
|
-
lastName:
|
|
1071
|
+
lastName: te
|
|
1072
1072
|
});
|
|
1073
|
-
},
|
|
1074
|
-
const { currentPassword: z, newPassword: Y } =
|
|
1075
|
-
await
|
|
1076
|
-
},
|
|
1077
|
-
const { email: z, tenantId: Y } =
|
|
1073
|
+
}, Qe = async (B) => {
|
|
1074
|
+
const { currentPassword: z, newPassword: Y } = B, W = await l.getAuthHeaders();
|
|
1075
|
+
await c.changePassword({ currentPassword: z, newPassword: Y }, W);
|
|
1076
|
+
}, Xe = async (B) => {
|
|
1077
|
+
const { email: z, tenantId: Y } = B, W = Y ?? (o == null ? void 0 : o.id);
|
|
1078
1078
|
if (!W)
|
|
1079
1079
|
throw new Error("tenantId is required for password reset");
|
|
1080
|
-
await
|
|
1081
|
-
},
|
|
1082
|
-
const { token: z, newPassword: Y } =
|
|
1083
|
-
await
|
|
1084
|
-
},
|
|
1085
|
-
const { email: z, frontendUrl: Y, name: W, lastName: Q, tenantId:
|
|
1086
|
-
if (!
|
|
1080
|
+
await c.requestPasswordReset({ email: z, tenantId: W });
|
|
1081
|
+
}, et = async (B) => {
|
|
1082
|
+
const { token: z, newPassword: Y } = B;
|
|
1083
|
+
await c.confirmPasswordReset({ token: z, newPassword: Y });
|
|
1084
|
+
}, tt = async (B) => {
|
|
1085
|
+
const { email: z, frontendUrl: Y, name: W, lastName: Q, tenantId: ee } = B, te = ee ?? (o == null ? void 0 : o.id);
|
|
1086
|
+
if (!te)
|
|
1087
1087
|
throw new Error("tenantId is required for magic link authentication");
|
|
1088
|
-
return await
|
|
1088
|
+
return await c.sendMagicLink({
|
|
1089
1089
|
email: z,
|
|
1090
|
-
tenantId:
|
|
1090
|
+
tenantId: te,
|
|
1091
1091
|
frontendUrl: Y,
|
|
1092
1092
|
name: W,
|
|
1093
1093
|
lastName: Q,
|
|
1094
1094
|
appId: t
|
|
1095
1095
|
});
|
|
1096
|
-
},
|
|
1097
|
-
const { token: z, email: Y, tenantSlug: W } =
|
|
1098
|
-
let Q =
|
|
1099
|
-
W && (Q = (await new
|
|
1100
|
-
const
|
|
1096
|
+
}, nt = async (B) => {
|
|
1097
|
+
const { token: z, email: Y, tenantSlug: W } = B;
|
|
1098
|
+
let Q = o == null ? void 0 : o.id, ee = i, te = l;
|
|
1099
|
+
W && (Q = (await new fe(U, t).getPublicTenantInfo(W)).id, ee = W);
|
|
1100
|
+
const ne = await c.verifyMagicLink({
|
|
1101
1101
|
token: z,
|
|
1102
1102
|
email: Y,
|
|
1103
1103
|
appId: t,
|
|
1104
1104
|
tenantId: Q
|
|
1105
|
-
}),
|
|
1106
|
-
if (
|
|
1107
|
-
tenantSlug:
|
|
1108
|
-
baseUrl:
|
|
1109
|
-
})),
|
|
1110
|
-
accessToken:
|
|
1111
|
-
refreshToken:
|
|
1112
|
-
expiresIn:
|
|
1113
|
-
}),
|
|
1114
|
-
|
|
1105
|
+
}), j = W && W !== i;
|
|
1106
|
+
if (j && (te = new Ae({
|
|
1107
|
+
tenantSlug: ee,
|
|
1108
|
+
baseUrl: n
|
|
1109
|
+
})), te.setTokens({
|
|
1110
|
+
accessToken: ne.accessToken,
|
|
1111
|
+
refreshToken: ne.refreshToken,
|
|
1112
|
+
expiresIn: ne.expiresIn
|
|
1113
|
+
}), ne.user) {
|
|
1114
|
+
te.setUser(ne.user), g(ne.user);
|
|
1115
1115
|
try {
|
|
1116
|
-
await
|
|
1117
|
-
} catch (
|
|
1118
|
-
console.warn("Failed to load complete user data after magic link login:",
|
|
1116
|
+
await k();
|
|
1117
|
+
} catch (pe) {
|
|
1118
|
+
console.warn("Failed to load complete user data after magic link login:", pe);
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
1121
|
-
return
|
|
1121
|
+
return j && ee && ee !== i && a(ee, {
|
|
1122
1122
|
tokens: {
|
|
1123
|
-
accessToken:
|
|
1124
|
-
refreshToken:
|
|
1125
|
-
expiresIn:
|
|
1123
|
+
accessToken: ne.accessToken,
|
|
1124
|
+
refreshToken: ne.refreshToken,
|
|
1125
|
+
expiresIn: ne.expiresIn
|
|
1126
1126
|
}
|
|
1127
|
-
}),
|
|
1128
|
-
},
|
|
1129
|
-
const
|
|
1130
|
-
if (!(
|
|
1127
|
+
}), ne;
|
|
1128
|
+
}, rt = async () => {
|
|
1129
|
+
const B = l.getTokens();
|
|
1130
|
+
if (!(B != null && B.refreshToken))
|
|
1131
1131
|
throw new Error("No refresh token available");
|
|
1132
|
-
const z = await
|
|
1133
|
-
refreshToken:
|
|
1132
|
+
const z = await c.refreshToken({
|
|
1133
|
+
refreshToken: B.refreshToken
|
|
1134
1134
|
});
|
|
1135
|
-
|
|
1135
|
+
l.setTokens({
|
|
1136
1136
|
accessToken: z.accessToken,
|
|
1137
|
-
refreshToken: z.refreshToken ||
|
|
1137
|
+
refreshToken: z.refreshToken || B.refreshToken,
|
|
1138
1138
|
expiresIn: z.expiresIn
|
|
1139
1139
|
});
|
|
1140
|
-
},
|
|
1141
|
-
|
|
1140
|
+
}, st = () => {
|
|
1141
|
+
l.clearSession(), g(null), M(null), S([]), E(!1);
|
|
1142
1142
|
try {
|
|
1143
1143
|
localStorage.removeItem("userTenants");
|
|
1144
1144
|
} catch {
|
|
1145
1145
|
}
|
|
1146
|
-
},
|
|
1147
|
-
|
|
1148
|
-
},
|
|
1149
|
-
|
|
1150
|
-
},
|
|
1146
|
+
}, ot = (B) => {
|
|
1147
|
+
l.setTokens(B);
|
|
1148
|
+
}, it = () => l.hasValidSession(), at = () => {
|
|
1149
|
+
l.clearSession(), g(null), M(null);
|
|
1150
|
+
}, lt = async () => {
|
|
1151
1151
|
if (t)
|
|
1152
1152
|
try {
|
|
1153
|
-
|
|
1154
|
-
const { roles:
|
|
1155
|
-
|
|
1156
|
-
} catch (
|
|
1157
|
-
console.error("Failed to fetch roles:",
|
|
1153
|
+
u(!0);
|
|
1154
|
+
const { roles: B } = await F.getRolesByApp(t);
|
|
1155
|
+
f(B);
|
|
1156
|
+
} catch (B) {
|
|
1157
|
+
console.error("Failed to fetch roles:", B);
|
|
1158
1158
|
} finally {
|
|
1159
|
-
|
|
1159
|
+
u(!1);
|
|
1160
1160
|
}
|
|
1161
|
-
},
|
|
1162
|
-
await
|
|
1163
|
-
},
|
|
1164
|
-
if (!
|
|
1161
|
+
}, ct = async () => {
|
|
1162
|
+
await lt();
|
|
1163
|
+
}, Te = (B) => {
|
|
1164
|
+
if (!v || v.length === 0)
|
|
1165
1165
|
return !1;
|
|
1166
|
-
if (typeof
|
|
1167
|
-
return
|
|
1168
|
-
const z = `${
|
|
1169
|
-
return
|
|
1166
|
+
if (typeof B == "string")
|
|
1167
|
+
return v.includes(B);
|
|
1168
|
+
const z = `${B.resource}.${B.action}`;
|
|
1169
|
+
return v.includes(z);
|
|
1170
1170
|
};
|
|
1171
1171
|
return {
|
|
1172
1172
|
// RFC-003: Authentication state
|
|
1173
|
-
isAuthenticated:
|
|
1174
|
-
sessionManager:
|
|
1175
|
-
authenticatedHttpService:
|
|
1176
|
-
login:
|
|
1177
|
-
signup:
|
|
1178
|
-
signupTenantAdmin:
|
|
1179
|
-
sendMagicLink:
|
|
1180
|
-
verifyMagicLink:
|
|
1181
|
-
changePassword:
|
|
1182
|
-
requestPasswordReset:
|
|
1183
|
-
confirmPasswordReset:
|
|
1184
|
-
refreshToken:
|
|
1185
|
-
logout:
|
|
1186
|
-
setTokens:
|
|
1187
|
-
hasValidSession:
|
|
1188
|
-
clearSession:
|
|
1189
|
-
currentUser:
|
|
1173
|
+
isAuthenticated: G,
|
|
1174
|
+
sessionManager: l,
|
|
1175
|
+
authenticatedHttpService: U,
|
|
1176
|
+
login: ce,
|
|
1177
|
+
signup: ve,
|
|
1178
|
+
signupTenantAdmin: Ye,
|
|
1179
|
+
sendMagicLink: tt,
|
|
1180
|
+
verifyMagicLink: nt,
|
|
1181
|
+
changePassword: Qe,
|
|
1182
|
+
requestPasswordReset: Xe,
|
|
1183
|
+
confirmPasswordReset: et,
|
|
1184
|
+
refreshToken: rt,
|
|
1185
|
+
logout: st,
|
|
1186
|
+
setTokens: ot,
|
|
1187
|
+
hasValidSession: it,
|
|
1188
|
+
clearSession: at,
|
|
1189
|
+
currentUser: b,
|
|
1190
1190
|
isUserLoading: T,
|
|
1191
|
-
userError:
|
|
1192
|
-
loadUserData:
|
|
1193
|
-
refreshUser:
|
|
1194
|
-
isAuthInitializing: !
|
|
1195
|
-
isAuthReady:
|
|
1196
|
-
userRole:
|
|
1197
|
-
userPermissions:
|
|
1198
|
-
availableRoles:
|
|
1199
|
-
rolesLoading:
|
|
1200
|
-
hasPermission:
|
|
1201
|
-
hasAnyPermission: (
|
|
1202
|
-
hasAllPermissions: (
|
|
1203
|
-
getUserPermissionStrings: () =>
|
|
1204
|
-
refreshRoles:
|
|
1191
|
+
userError: N,
|
|
1192
|
+
loadUserData: k,
|
|
1193
|
+
refreshUser: K,
|
|
1194
|
+
isAuthInitializing: !D,
|
|
1195
|
+
isAuthReady: D,
|
|
1196
|
+
userRole: m,
|
|
1197
|
+
userPermissions: v,
|
|
1198
|
+
availableRoles: p,
|
|
1199
|
+
rolesLoading: w,
|
|
1200
|
+
hasPermission: Te,
|
|
1201
|
+
hasAnyPermission: (B) => B.some((z) => Te(z)),
|
|
1202
|
+
hasAllPermissions: (B) => B.every((z) => Te(z)),
|
|
1203
|
+
getUserPermissionStrings: () => v || [],
|
|
1204
|
+
refreshRoles: ct,
|
|
1205
1205
|
// RFC-004: Multi-tenant user membership
|
|
1206
|
-
userTenants:
|
|
1207
|
-
hasTenantContext:
|
|
1208
|
-
switchToTenant: async (
|
|
1209
|
-
const { redirectPath: Y } = z || {}, W =
|
|
1206
|
+
userTenants: x,
|
|
1207
|
+
hasTenantContext: L,
|
|
1208
|
+
switchToTenant: async (B, z) => {
|
|
1209
|
+
const { redirectPath: Y } = z || {}, W = l.getTokens();
|
|
1210
1210
|
if (!(W != null && W.refreshToken))
|
|
1211
1211
|
throw new Error("No refresh token available for tenant switch");
|
|
1212
|
-
const Q = await
|
|
1212
|
+
const Q = await c.switchTenant({
|
|
1213
1213
|
refreshToken: W.refreshToken,
|
|
1214
|
-
tenantId:
|
|
1214
|
+
tenantId: B
|
|
1215
1215
|
});
|
|
1216
|
-
|
|
1216
|
+
l.setTokens({
|
|
1217
1217
|
accessToken: Q.accessToken,
|
|
1218
1218
|
refreshToken: W.refreshToken,
|
|
1219
1219
|
// Keep the same refresh token
|
|
1220
1220
|
expiresIn: Q.expiresIn
|
|
1221
|
-
}),
|
|
1222
|
-
const
|
|
1223
|
-
|
|
1221
|
+
}), g(Q.user), l.setUser(Q.user), E(!0);
|
|
1222
|
+
const ee = x.find((te) => te.id === B);
|
|
1223
|
+
ee && a(ee.subdomain, {
|
|
1224
1224
|
tokens: {
|
|
1225
1225
|
accessToken: Q.accessToken,
|
|
1226
1226
|
refreshToken: W.refreshToken,
|
|
@@ -1230,8 +1230,8 @@ function Zt({ config: i = {}, children: e }) {
|
|
|
1230
1230
|
});
|
|
1231
1231
|
},
|
|
1232
1232
|
refreshUserTenants: async () => {
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1233
|
+
const B = await l.getAuthHeaders(), z = await c.getUserTenants(B);
|
|
1234
|
+
S(z);
|
|
1235
1235
|
try {
|
|
1236
1236
|
localStorage.setItem("userTenants", JSON.stringify(z));
|
|
1237
1237
|
} catch {
|
|
@@ -1240,74 +1240,74 @@ function Zt({ config: i = {}, children: e }) {
|
|
|
1240
1240
|
}
|
|
1241
1241
|
};
|
|
1242
1242
|
}, [
|
|
1243
|
-
|
|
1244
|
-
c,
|
|
1245
|
-
F,
|
|
1243
|
+
G,
|
|
1246
1244
|
l,
|
|
1245
|
+
U,
|
|
1246
|
+
c,
|
|
1247
1247
|
H,
|
|
1248
|
-
|
|
1248
|
+
F,
|
|
1249
1249
|
t,
|
|
1250
|
-
s,
|
|
1251
1250
|
o,
|
|
1251
|
+
i,
|
|
1252
1252
|
a,
|
|
1253
|
-
|
|
1254
|
-
|
|
1253
|
+
p,
|
|
1254
|
+
b,
|
|
1255
1255
|
T,
|
|
1256
|
-
|
|
1257
|
-
$,
|
|
1258
|
-
E,
|
|
1259
|
-
L,
|
|
1260
|
-
u,
|
|
1261
|
-
w,
|
|
1256
|
+
N,
|
|
1262
1257
|
x,
|
|
1263
|
-
|
|
1258
|
+
L,
|
|
1259
|
+
D,
|
|
1260
|
+
m,
|
|
1261
|
+
v,
|
|
1262
|
+
P,
|
|
1263
|
+
J
|
|
1264
1264
|
]);
|
|
1265
|
-
|
|
1266
|
-
!
|
|
1265
|
+
X(() => {
|
|
1266
|
+
!r.initialRoles && t && (async () => {
|
|
1267
1267
|
try {
|
|
1268
|
-
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1271
|
-
} catch (
|
|
1272
|
-
console.error("Failed to fetch roles:",
|
|
1268
|
+
u(!0);
|
|
1269
|
+
const K = new ie(n), ce = new He(K), { roles: ve } = await ce.getRolesByApp(t);
|
|
1270
|
+
f(ve);
|
|
1271
|
+
} catch (K) {
|
|
1272
|
+
console.error("Failed to fetch roles:", K);
|
|
1273
1273
|
} finally {
|
|
1274
|
-
|
|
1274
|
+
u(!1);
|
|
1275
1275
|
}
|
|
1276
1276
|
})();
|
|
1277
|
-
}, [t,
|
|
1278
|
-
const [
|
|
1279
|
-
return
|
|
1280
|
-
|
|
1281
|
-
console.error("[AuthProvider] Failed to load user data:",
|
|
1277
|
+
}, [t, n, r.initialRoles]);
|
|
1278
|
+
const [O, V] = A(!1);
|
|
1279
|
+
return X(() => {
|
|
1280
|
+
O || (V(!0), C.current.urlTokens && (console.log("[AuthProvider] EFFECT: Cleaning up URL after sync token processing"), St(), $(!0), console.log("[AuthProvider] EFFECT: Loading user data (blocking isAuthReady)..."), q.loadUserData().catch((k) => {
|
|
1281
|
+
console.error("[AuthProvider] Failed to load user data:", k);
|
|
1282
1282
|
}).finally(() => {
|
|
1283
|
-
console.log("[AuthProvider] EFFECT: User data loaded, releasing isAuthReady"),
|
|
1283
|
+
console.log("[AuthProvider] EFFECT: User data loaded, releasing isAuthReady"), $(!1);
|
|
1284
1284
|
})));
|
|
1285
|
-
}, [
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1288
|
-
}, [
|
|
1289
|
-
|
|
1285
|
+
}, [q, O]), X(() => {
|
|
1286
|
+
const k = l.getUser();
|
|
1287
|
+
k && l.hasValidSession() && g(k);
|
|
1288
|
+
}, [l]), X(() => {
|
|
1289
|
+
O && (C.current.urlTokens || !b && !T && l.hasValidSession() && (console.log("[AuthProvider] Auto-loading user data..."), q.loadUserData().catch(() => {
|
|
1290
1290
|
})));
|
|
1291
|
-
}, [
|
|
1292
|
-
if (!
|
|
1291
|
+
}, [b, T, q, l, O]), X(() => {
|
|
1292
|
+
if (!l.hasValidSession() || !b)
|
|
1293
1293
|
return;
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1294
|
+
const k = setInterval(() => {
|
|
1295
|
+
q.loadUserData().catch(() => {
|
|
1296
1296
|
});
|
|
1297
|
-
},
|
|
1298
|
-
return () => clearInterval(
|
|
1299
|
-
}, [
|
|
1297
|
+
}, J);
|
|
1298
|
+
return () => clearInterval(k);
|
|
1299
|
+
}, [l, b, q, J]), /* @__PURE__ */ s(Me.Provider, { value: q, children: e });
|
|
1300
1300
|
}
|
|
1301
|
-
function
|
|
1302
|
-
const
|
|
1303
|
-
if (!
|
|
1301
|
+
function le() {
|
|
1302
|
+
const r = oe(Me);
|
|
1303
|
+
if (!r)
|
|
1304
1304
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
1305
|
-
return
|
|
1305
|
+
return r;
|
|
1306
1306
|
}
|
|
1307
|
-
function
|
|
1308
|
-
return
|
|
1307
|
+
function Le() {
|
|
1308
|
+
return oe(Me);
|
|
1309
1309
|
}
|
|
1310
|
-
class
|
|
1310
|
+
class vt {
|
|
1311
1311
|
constructor(e, t) {
|
|
1312
1312
|
this.httpService = e, this.sessionManager = t;
|
|
1313
1313
|
}
|
|
@@ -1326,14 +1326,14 @@ class ut {
|
|
|
1326
1326
|
async getFeatureFlags(e) {
|
|
1327
1327
|
if (!this.sessionManager)
|
|
1328
1328
|
throw new Error("SessionManager is required for private endpoints");
|
|
1329
|
-
const t = await this.sessionManager.getAuthHeaders(),
|
|
1330
|
-
e != null && e.page &&
|
|
1331
|
-
const
|
|
1329
|
+
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
1330
|
+
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder);
|
|
1331
|
+
const o = `/feature-flags/${n.toString() ? `?${n.toString()}` : ""}`, i = await this.httpService.get(o, {
|
|
1332
1332
|
headers: t
|
|
1333
1333
|
});
|
|
1334
1334
|
return {
|
|
1335
|
-
featureFlags:
|
|
1336
|
-
meta:
|
|
1335
|
+
featureFlags: i.data,
|
|
1336
|
+
meta: i.meta
|
|
1337
1337
|
};
|
|
1338
1338
|
}
|
|
1339
1339
|
async getFeatureFlagById(e) {
|
|
@@ -1347,12 +1347,12 @@ class ut {
|
|
|
1347
1347
|
async updateFeatureFlag(e, t) {
|
|
1348
1348
|
if (!this.sessionManager)
|
|
1349
1349
|
throw new Error("SessionManager is required for private endpoints");
|
|
1350
|
-
const
|
|
1350
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
1351
1351
|
return (await this.httpService.put(
|
|
1352
1352
|
`/feature-flags/${e}`,
|
|
1353
1353
|
t,
|
|
1354
1354
|
{
|
|
1355
|
-
headers:
|
|
1355
|
+
headers: n
|
|
1356
1356
|
}
|
|
1357
1357
|
)).data;
|
|
1358
1358
|
}
|
|
@@ -1368,85 +1368,85 @@ class ut {
|
|
|
1368
1368
|
async getTenantFeatureFlags(e, t) {
|
|
1369
1369
|
if (!e || !t)
|
|
1370
1370
|
throw new Error("Tenant ID and App ID are required");
|
|
1371
|
-
const
|
|
1372
|
-
|
|
1373
|
-
const
|
|
1374
|
-
return (await this.httpService.get(
|
|
1371
|
+
const n = new URLSearchParams();
|
|
1372
|
+
n.append("tenantId", e), n.append("appId", t);
|
|
1373
|
+
const o = `/tenant-feature-flags${n.toString() ? `?${n.toString()}` : ""}`;
|
|
1374
|
+
return (await this.httpService.get(o, {
|
|
1375
1375
|
headers: { "X-Tenant-ID": e }
|
|
1376
1376
|
})).data;
|
|
1377
1377
|
}
|
|
1378
1378
|
// Public endpoint - no auth required
|
|
1379
|
-
async getTenantFeatureFlag(e, t,
|
|
1380
|
-
if (!e || !t || !
|
|
1379
|
+
async getTenantFeatureFlag(e, t, n) {
|
|
1380
|
+
if (!e || !t || !n)
|
|
1381
1381
|
throw new Error("Flag Key, Tenant ID and App ID are required");
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1384
|
-
const
|
|
1385
|
-
return (await this.httpService.get(
|
|
1382
|
+
const o = new URLSearchParams();
|
|
1383
|
+
o.append("tenantId", t), o.append("appId", n);
|
|
1384
|
+
const i = `/tenant-feature-flags/${e}${o.toString() ? `?${o.toString()}` : ""}`;
|
|
1385
|
+
return (await this.httpService.get(i, {
|
|
1386
1386
|
headers: { "X-Tenant-ID": t }
|
|
1387
1387
|
})).data;
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
|
-
const
|
|
1391
|
-
function
|
|
1392
|
-
const t =
|
|
1393
|
-
const
|
|
1394
|
-
return new
|
|
1395
|
-
}, [
|
|
1390
|
+
const Ee = ue(null);
|
|
1391
|
+
function yn({ config: r = {}, children: e }) {
|
|
1392
|
+
const t = Ve(), n = Se(), o = (t == null ? void 0 : t.baseUrl) ?? "", i = (t == null ? void 0 : t.appId) ?? "", a = (n == null ? void 0 : n.tenant) ?? null, [p, f] = A([]), [w, u] = A(!1), [b, g] = A(null), [T, I] = A(!1), N = Z(() => {
|
|
1393
|
+
const h = new ie(o);
|
|
1394
|
+
return new vt(h);
|
|
1395
|
+
}, [o]), M = async () => {
|
|
1396
1396
|
if (!(a != null && a.id)) {
|
|
1397
|
-
|
|
1397
|
+
f([]);
|
|
1398
1398
|
return;
|
|
1399
1399
|
}
|
|
1400
|
-
|
|
1400
|
+
u(!0), g(null);
|
|
1401
1401
|
try {
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1404
|
-
} catch (
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1402
|
+
const h = await N.getTenantFeatureFlags(a.id, i);
|
|
1403
|
+
f(h);
|
|
1404
|
+
} catch (h) {
|
|
1405
|
+
const x = h instanceof Error ? h.message : "Failed to fetch feature flags";
|
|
1406
|
+
g(x), r.onError && r.onError(h instanceof Error ? h : new Error(x));
|
|
1407
1407
|
} finally {
|
|
1408
|
-
|
|
1408
|
+
u(!1);
|
|
1409
1409
|
}
|
|
1410
1410
|
};
|
|
1411
|
-
|
|
1412
|
-
if (!
|
|
1413
|
-
|
|
1414
|
-
const
|
|
1415
|
-
return () => clearInterval(
|
|
1416
|
-
}, [a == null ? void 0 : a.id,
|
|
1417
|
-
const
|
|
1418
|
-
const
|
|
1419
|
-
const
|
|
1420
|
-
return (
|
|
1421
|
-
},
|
|
1422
|
-
const
|
|
1423
|
-
return
|
|
1424
|
-
},
|
|
1425
|
-
await
|
|
1426
|
-
},
|
|
1411
|
+
X(() => {
|
|
1412
|
+
if (!o || !i) return;
|
|
1413
|
+
M().finally(() => I(!0));
|
|
1414
|
+
const h = r.refreshInterval || 5 * 60 * 1e3, x = setInterval(M, h);
|
|
1415
|
+
return () => clearInterval(x);
|
|
1416
|
+
}, [a == null ? void 0 : a.id, o, i, r.refreshInterval]);
|
|
1417
|
+
const P = Z(() => {
|
|
1418
|
+
const h = (C) => {
|
|
1419
|
+
const R = p.find(($) => $.key === C);
|
|
1420
|
+
return (R == null ? void 0 : R.value) === !0;
|
|
1421
|
+
}, x = (C) => p.find((R) => R.key === C), S = (C) => {
|
|
1422
|
+
const R = p.find(($) => $.key === C);
|
|
1423
|
+
return R ? R.value ? "enabled" : "disabled" : "not_found";
|
|
1424
|
+
}, L = async () => {
|
|
1425
|
+
await M();
|
|
1426
|
+
}, E = !!(o && i) && (T || !(a != null && a.id));
|
|
1427
1427
|
return {
|
|
1428
|
-
featureFlags:
|
|
1429
|
-
loading:
|
|
1430
|
-
error:
|
|
1431
|
-
isReady:
|
|
1432
|
-
isEnabled:
|
|
1433
|
-
getFlag:
|
|
1434
|
-
getFlagState:
|
|
1435
|
-
refresh:
|
|
1428
|
+
featureFlags: p,
|
|
1429
|
+
loading: w,
|
|
1430
|
+
error: b,
|
|
1431
|
+
isReady: E,
|
|
1432
|
+
isEnabled: h,
|
|
1433
|
+
getFlag: x,
|
|
1434
|
+
getFlagState: S,
|
|
1435
|
+
refresh: L
|
|
1436
1436
|
};
|
|
1437
|
-
}, [
|
|
1438
|
-
return /* @__PURE__ */
|
|
1437
|
+
}, [p, w, b, o, i, a == null ? void 0 : a.id, T]);
|
|
1438
|
+
return /* @__PURE__ */ s(Ee.Provider, { value: P, children: e });
|
|
1439
1439
|
}
|
|
1440
|
-
function
|
|
1441
|
-
const
|
|
1442
|
-
if (!
|
|
1440
|
+
function Tt() {
|
|
1441
|
+
const r = oe(Ee);
|
|
1442
|
+
if (!r)
|
|
1443
1443
|
throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
|
|
1444
|
-
return
|
|
1444
|
+
return r;
|
|
1445
1445
|
}
|
|
1446
|
-
function
|
|
1447
|
-
return
|
|
1446
|
+
function je() {
|
|
1447
|
+
return oe(Ee);
|
|
1448
1448
|
}
|
|
1449
|
-
class
|
|
1449
|
+
class kt {
|
|
1450
1450
|
constructor(e, t) {
|
|
1451
1451
|
this.httpService = e, this.sessionManager = t;
|
|
1452
1452
|
}
|
|
@@ -1476,23 +1476,23 @@ class gt {
|
|
|
1476
1476
|
async updateSubscription(e, t) {
|
|
1477
1477
|
if (!this.sessionManager)
|
|
1478
1478
|
throw new Error("SessionManager is required for private endpoints");
|
|
1479
|
-
const
|
|
1479
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
1480
1480
|
return (await this.httpService.put(
|
|
1481
1481
|
`/subscriptions/${e}`,
|
|
1482
1482
|
t,
|
|
1483
1483
|
{
|
|
1484
|
-
headers:
|
|
1484
|
+
headers: n
|
|
1485
1485
|
}
|
|
1486
1486
|
)).data;
|
|
1487
1487
|
}
|
|
1488
1488
|
async changeSubscriptionPlan(e, t) {
|
|
1489
1489
|
if (!this.sessionManager)
|
|
1490
1490
|
throw new Error("SessionManager is required for private endpoints");
|
|
1491
|
-
const
|
|
1491
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
1492
1492
|
return (await this.httpService.put(
|
|
1493
1493
|
`/subscriptions/${e}/plan`,
|
|
1494
1494
|
{ planId: t },
|
|
1495
|
-
{ headers:
|
|
1495
|
+
{ headers: n }
|
|
1496
1496
|
)).data;
|
|
1497
1497
|
}
|
|
1498
1498
|
// Public endpoint - no auth required
|
|
@@ -1504,76 +1504,141 @@ class gt {
|
|
|
1504
1504
|
async processPayment(e, t) {
|
|
1505
1505
|
if (!this.sessionManager)
|
|
1506
1506
|
throw new Error("SessionManager is required for private endpoints");
|
|
1507
|
-
const
|
|
1507
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
1508
1508
|
return (await this.httpService.post(
|
|
1509
1509
|
`/subscriptions/${e}/process-payment`,
|
|
1510
1510
|
t,
|
|
1511
|
-
{ headers:
|
|
1511
|
+
{ headers: n }
|
|
1512
1512
|
)).data;
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
|
-
const
|
|
1516
|
-
function
|
|
1517
|
-
const t =
|
|
1518
|
-
const
|
|
1519
|
-
return new
|
|
1520
|
-
}, [
|
|
1521
|
-
if (!(
|
|
1522
|
-
|
|
1515
|
+
const Fe = ue(void 0);
|
|
1516
|
+
function wn({ config: r = {}, children: e }) {
|
|
1517
|
+
const t = Ve(), n = Se(), o = (t == null ? void 0 : t.baseUrl) ?? "", i = (n == null ? void 0 : n.tenant) ?? null, [a, p] = A(null), [f, w] = A(!1), [u, b] = A(null), [g, T] = A(!1), I = Z(() => {
|
|
1518
|
+
const P = new ie(o);
|
|
1519
|
+
return new kt(P);
|
|
1520
|
+
}, [o]), N = async () => {
|
|
1521
|
+
if (!(i != null && i.id)) {
|
|
1522
|
+
p(null);
|
|
1523
1523
|
return;
|
|
1524
1524
|
}
|
|
1525
|
-
|
|
1525
|
+
w(!0), b(null);
|
|
1526
1526
|
try {
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1529
|
-
} catch (
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1527
|
+
const P = await I.getTenantSubscriptionFeatures(i.id);
|
|
1528
|
+
p(P);
|
|
1529
|
+
} catch (P) {
|
|
1530
|
+
const h = P instanceof Error ? P.message : "Failed to fetch subscription";
|
|
1531
|
+
b(h), r.onError && r.onError(P instanceof Error ? P : new Error(h));
|
|
1532
1532
|
} finally {
|
|
1533
|
-
|
|
1533
|
+
w(!1);
|
|
1534
1534
|
}
|
|
1535
1535
|
};
|
|
1536
|
-
|
|
1537
|
-
if (!
|
|
1538
|
-
const
|
|
1539
|
-
return () => clearInterval(
|
|
1540
|
-
}, [
|
|
1541
|
-
const
|
|
1542
|
-
const
|
|
1543
|
-
const
|
|
1544
|
-
return
|
|
1545
|
-
},
|
|
1546
|
-
const
|
|
1547
|
-
return
|
|
1548
|
-
},
|
|
1549
|
-
await
|
|
1550
|
-
},
|
|
1536
|
+
X(() => {
|
|
1537
|
+
if (!o || (N().finally(() => T(!0)), !r.refreshInterval)) return;
|
|
1538
|
+
const P = r.refreshInterval || 10 * 60 * 1e3, h = setInterval(N, P);
|
|
1539
|
+
return () => clearInterval(h);
|
|
1540
|
+
}, [i == null ? void 0 : i.id, o, r.refreshInterval]);
|
|
1541
|
+
const M = Z(() => {
|
|
1542
|
+
const P = (a == null ? void 0 : a.features) || [], h = (R) => {
|
|
1543
|
+
const $ = P.find((l) => l.key === R);
|
|
1544
|
+
return $ ? $.type === "BOOLEAN" || $.type === "boolean" ? $.value === !0 : !!$.value : !1;
|
|
1545
|
+
}, x = (R) => P.find(($) => $.key === R), S = (R, $) => {
|
|
1546
|
+
const l = P.find((D) => D.key === R);
|
|
1547
|
+
return l ? l.value : $;
|
|
1548
|
+
}, L = (R) => !a || !a.isActive ? !1 : R.includes(a.planId), E = async () => {
|
|
1549
|
+
await N();
|
|
1550
|
+
}, C = !!o && (g || !(i != null && i.id));
|
|
1551
1551
|
return {
|
|
1552
1552
|
subscription: a,
|
|
1553
|
-
features:
|
|
1554
|
-
loading:
|
|
1555
|
-
error:
|
|
1556
|
-
isReady:
|
|
1557
|
-
isFeatureEnabled:
|
|
1558
|
-
getFeature:
|
|
1559
|
-
getFeatureValue:
|
|
1560
|
-
hasAllowedPlan:
|
|
1561
|
-
refresh:
|
|
1553
|
+
features: P,
|
|
1554
|
+
loading: f,
|
|
1555
|
+
error: u,
|
|
1556
|
+
isReady: C,
|
|
1557
|
+
isFeatureEnabled: h,
|
|
1558
|
+
getFeature: x,
|
|
1559
|
+
getFeatureValue: S,
|
|
1560
|
+
hasAllowedPlan: L,
|
|
1561
|
+
refresh: E
|
|
1562
1562
|
};
|
|
1563
|
-
}, [a,
|
|
1564
|
-
return /* @__PURE__ */
|
|
1563
|
+
}, [a, f, u, o, i == null ? void 0 : i.id, g]);
|
|
1564
|
+
return /* @__PURE__ */ s(Fe.Provider, { value: M, children: e });
|
|
1565
1565
|
}
|
|
1566
|
-
function
|
|
1567
|
-
const
|
|
1568
|
-
if (
|
|
1566
|
+
function At() {
|
|
1567
|
+
const r = oe(Fe);
|
|
1568
|
+
if (r === void 0)
|
|
1569
1569
|
throw new Error("useSubscription must be used within a SubscriptionProvider");
|
|
1570
|
-
return
|
|
1570
|
+
return r;
|
|
1571
|
+
}
|
|
1572
|
+
function Ge() {
|
|
1573
|
+
return oe(Fe) ?? null;
|
|
1574
|
+
}
|
|
1575
|
+
var se = /* @__PURE__ */ ((r) => (r.SUPERUSER = "SUPERUSER", r.TENANT_ADMIN = "TENANT_ADMIN", r.USER = "USER", r))(se || {});
|
|
1576
|
+
const Ne = {
|
|
1577
|
+
publicGuest: "/",
|
|
1578
|
+
publicUser: "/account",
|
|
1579
|
+
publicAdmin: "/admin",
|
|
1580
|
+
tenantGuest: "/login",
|
|
1581
|
+
tenantUser: "/dashboard",
|
|
1582
|
+
tenantAdmin: "/admin/dashboard",
|
|
1583
|
+
default: "/"
|
|
1584
|
+
}, Ze = {
|
|
1585
|
+
// Public/Landing zones
|
|
1586
|
+
landing: { tenant: "forbidden", auth: "optional" },
|
|
1587
|
+
publicOnly: { tenant: "forbidden", auth: "forbidden" },
|
|
1588
|
+
// Auth zones
|
|
1589
|
+
login: { tenant: "required", auth: "forbidden" },
|
|
1590
|
+
guest: { auth: "forbidden" },
|
|
1591
|
+
authenticated: { auth: "required" },
|
|
1592
|
+
// Tenant zones
|
|
1593
|
+
tenant: { tenant: "required" },
|
|
1594
|
+
tenantOpen: { tenant: "required", auth: "optional" },
|
|
1595
|
+
tenantAuth: { tenant: "required", auth: "required" },
|
|
1596
|
+
// User type zones
|
|
1597
|
+
user: { tenant: "required", auth: "required", userType: se.USER },
|
|
1598
|
+
admin: { tenant: "required", auth: "required", userType: se.TENANT_ADMIN },
|
|
1599
|
+
// Fully open
|
|
1600
|
+
open: { tenant: "optional", auth: "optional" }
|
|
1601
|
+
}, De = ue(null);
|
|
1602
|
+
function bn({ config: r = {}, children: e }) {
|
|
1603
|
+
const t = Z(() => {
|
|
1604
|
+
const n = {
|
|
1605
|
+
...Ne,
|
|
1606
|
+
...r.zoneRoots
|
|
1607
|
+
}, o = {
|
|
1608
|
+
...Ze,
|
|
1609
|
+
...r.presets
|
|
1610
|
+
};
|
|
1611
|
+
return {
|
|
1612
|
+
zoneRoots: n,
|
|
1613
|
+
presets: o,
|
|
1614
|
+
loadingFallback: r.loadingFallback ?? null,
|
|
1615
|
+
accessDeniedFallback: r.accessDeniedFallback ?? null,
|
|
1616
|
+
onAccessDenied: r.onAccessDenied,
|
|
1617
|
+
returnToParam: r.returnToParam ?? "returnTo",
|
|
1618
|
+
returnToStorage: r.returnToStorage ?? "url"
|
|
1619
|
+
};
|
|
1620
|
+
}, [r]);
|
|
1621
|
+
return /* @__PURE__ */ s(De.Provider, { value: t, children: e });
|
|
1571
1622
|
}
|
|
1572
|
-
function
|
|
1573
|
-
|
|
1623
|
+
function Sn() {
|
|
1624
|
+
const r = oe(De);
|
|
1625
|
+
if (!r)
|
|
1626
|
+
throw new Error("useRouting must be used within a RoutingProvider");
|
|
1627
|
+
return r;
|
|
1574
1628
|
}
|
|
1575
|
-
|
|
1576
|
-
const
|
|
1629
|
+
function xt() {
|
|
1630
|
+
const r = oe(De);
|
|
1631
|
+
return r || {
|
|
1632
|
+
zoneRoots: Ne,
|
|
1633
|
+
presets: Ze,
|
|
1634
|
+
loadingFallback: null,
|
|
1635
|
+
accessDeniedFallback: null,
|
|
1636
|
+
onAccessDenied: void 0,
|
|
1637
|
+
returnToParam: "returnTo",
|
|
1638
|
+
returnToStorage: "url"
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
const qe = () => /* @__PURE__ */ d(
|
|
1577
1642
|
"div",
|
|
1578
1643
|
{
|
|
1579
1644
|
style: {
|
|
@@ -1589,10 +1654,10 @@ const $e = () => /* @__PURE__ */ d(
|
|
|
1589
1654
|
margin: "20px 0"
|
|
1590
1655
|
},
|
|
1591
1656
|
children: [
|
|
1592
|
-
/* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ s("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "🔒" }),
|
|
1658
|
+
/* @__PURE__ */ s("h3", { style: { color: "#495057", marginBottom: "10px" }, children: "Access Required" }),
|
|
1659
|
+
/* @__PURE__ */ s("p", { style: { color: "#6c757d", fontSize: "14px", marginBottom: "15px" }, children: "You need to be signed in to view this content." }),
|
|
1660
|
+
/* @__PURE__ */ s(
|
|
1596
1661
|
"button",
|
|
1597
1662
|
{
|
|
1598
1663
|
style: {
|
|
@@ -1610,8 +1675,8 @@ const $e = () => /* @__PURE__ */ d(
|
|
|
1610
1675
|
)
|
|
1611
1676
|
]
|
|
1612
1677
|
}
|
|
1613
|
-
),
|
|
1614
|
-
userType:
|
|
1678
|
+
), Oe = ({
|
|
1679
|
+
userType: r,
|
|
1615
1680
|
minUserType: e,
|
|
1616
1681
|
missingPermissions: t
|
|
1617
1682
|
}) => /* @__PURE__ */ d(
|
|
@@ -1630,57 +1695,57 @@ const $e = () => /* @__PURE__ */ d(
|
|
|
1630
1695
|
margin: "20px 0"
|
|
1631
1696
|
},
|
|
1632
1697
|
children: [
|
|
1633
|
-
/* @__PURE__ */
|
|
1634
|
-
/* @__PURE__ */
|
|
1635
|
-
e &&
|
|
1698
|
+
/* @__PURE__ */ s("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "⚠️" }),
|
|
1699
|
+
/* @__PURE__ */ s("h3", { style: { color: "#856404", marginBottom: "10px" }, children: "Insufficient Permissions" }),
|
|
1700
|
+
e && r ? /* @__PURE__ */ d(_, { children: [
|
|
1636
1701
|
/* @__PURE__ */ d("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: [
|
|
1637
1702
|
"This content requires ",
|
|
1638
|
-
/* @__PURE__ */
|
|
1703
|
+
/* @__PURE__ */ s("strong", { children: e }),
|
|
1639
1704
|
" access level or higher."
|
|
1640
1705
|
] }),
|
|
1641
1706
|
/* @__PURE__ */ d("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1642
1707
|
"Your current access level: ",
|
|
1643
|
-
/* @__PURE__ */
|
|
1708
|
+
/* @__PURE__ */ s("strong", { children: r })
|
|
1644
1709
|
] })
|
|
1645
|
-
] }) : /* @__PURE__ */ d(
|
|
1646
|
-
/* @__PURE__ */
|
|
1710
|
+
] }) : /* @__PURE__ */ d(_, { children: [
|
|
1711
|
+
/* @__PURE__ */ s("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: "You don't have the required permissions to view this content." }),
|
|
1647
1712
|
t && t.length > 0 && /* @__PURE__ */ d("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
|
|
1648
1713
|
"Required permissions: ",
|
|
1649
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ s("strong", { children: t.join(", ") })
|
|
1650
1715
|
] })
|
|
1651
1716
|
] })
|
|
1652
1717
|
]
|
|
1653
1718
|
}
|
|
1654
|
-
),
|
|
1719
|
+
), Pt = (r, e) => {
|
|
1655
1720
|
const t = {
|
|
1656
|
-
[
|
|
1657
|
-
[
|
|
1658
|
-
[
|
|
1721
|
+
[se.USER]: 1,
|
|
1722
|
+
[se.TENANT_ADMIN]: 2,
|
|
1723
|
+
[se.SUPERUSER]: 3
|
|
1659
1724
|
};
|
|
1660
|
-
return t[
|
|
1725
|
+
return t[r] >= t[e];
|
|
1661
1726
|
};
|
|
1662
|
-
function
|
|
1663
|
-
children:
|
|
1727
|
+
function vn({
|
|
1728
|
+
children: r,
|
|
1664
1729
|
fallback: e,
|
|
1665
1730
|
minUserType: t,
|
|
1666
|
-
requiredPermissions:
|
|
1667
|
-
requireAllPermissions:
|
|
1731
|
+
requiredPermissions: n,
|
|
1732
|
+
requireAllPermissions: o = !1
|
|
1668
1733
|
}) {
|
|
1669
|
-
const { hasValidSession:
|
|
1670
|
-
if (!
|
|
1671
|
-
return /* @__PURE__ */
|
|
1672
|
-
const
|
|
1673
|
-
if (!
|
|
1674
|
-
return /* @__PURE__ */
|
|
1675
|
-
if (t && !
|
|
1676
|
-
return /* @__PURE__ */
|
|
1677
|
-
if (
|
|
1678
|
-
const
|
|
1679
|
-
return /* @__PURE__ */
|
|
1680
|
-
}
|
|
1681
|
-
return /* @__PURE__ */
|
|
1734
|
+
const { hasValidSession: i, sessionManager: a, hasPermission: p, hasAnyPermission: f, hasAllPermissions: w } = le();
|
|
1735
|
+
if (!i())
|
|
1736
|
+
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(qe, {}) });
|
|
1737
|
+
const u = a.getUser();
|
|
1738
|
+
if (!u)
|
|
1739
|
+
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(qe, {}) });
|
|
1740
|
+
if (t && !Pt(u.userType, t))
|
|
1741
|
+
return /* @__PURE__ */ s(Oe, { userType: u.userType, minUserType: t });
|
|
1742
|
+
if (n && n.length > 0 && !(o ? w(n) : f(n))) {
|
|
1743
|
+
const g = n.filter((T) => !p(T)).map((T) => typeof T == "string" ? T : T.name);
|
|
1744
|
+
return /* @__PURE__ */ s(Oe, { missingPermissions: g });
|
|
1745
|
+
}
|
|
1746
|
+
return /* @__PURE__ */ s(_, { children: r });
|
|
1682
1747
|
}
|
|
1683
|
-
const
|
|
1748
|
+
const Rt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
1684
1749
|
"div",
|
|
1685
1750
|
{
|
|
1686
1751
|
style: {
|
|
@@ -1704,23 +1769,23 @@ const mt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1704
1769
|
maxWidth: "400px"
|
|
1705
1770
|
},
|
|
1706
1771
|
children: [
|
|
1707
|
-
/* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
/* @__PURE__ */
|
|
1772
|
+
/* @__PURE__ */ s("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🔒" }),
|
|
1773
|
+
/* @__PURE__ */ s("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Access Required" }),
|
|
1774
|
+
/* @__PURE__ */ s("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You need to be signed in to access this page." }),
|
|
1710
1775
|
/* @__PURE__ */ d("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1711
1776
|
"Redirecting to ",
|
|
1712
|
-
|
|
1777
|
+
r,
|
|
1713
1778
|
"..."
|
|
1714
1779
|
] })
|
|
1715
1780
|
]
|
|
1716
1781
|
}
|
|
1717
1782
|
)
|
|
1718
1783
|
}
|
|
1719
|
-
),
|
|
1720
|
-
userType:
|
|
1784
|
+
), ze = ({
|
|
1785
|
+
userType: r,
|
|
1721
1786
|
requiredUserType: e,
|
|
1722
1787
|
missingPermissions: t
|
|
1723
|
-
}) => /* @__PURE__ */
|
|
1788
|
+
}) => /* @__PURE__ */ s(
|
|
1724
1789
|
"div",
|
|
1725
1790
|
{
|
|
1726
1791
|
style: {
|
|
@@ -1744,62 +1809,66 @@ const mt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1744
1809
|
maxWidth: "400px"
|
|
1745
1810
|
},
|
|
1746
1811
|
children: [
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1749
|
-
e &&
|
|
1812
|
+
/* @__PURE__ */ s("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "⚠️" }),
|
|
1813
|
+
/* @__PURE__ */ s("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Insufficient Permissions" }),
|
|
1814
|
+
e && r ? /* @__PURE__ */ d(_, { children: [
|
|
1750
1815
|
/* @__PURE__ */ d("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: [
|
|
1751
1816
|
"This page requires ",
|
|
1752
|
-
/* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ s("strong", { children: e }),
|
|
1753
1818
|
" access."
|
|
1754
1819
|
] }),
|
|
1755
1820
|
/* @__PURE__ */ d("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1756
1821
|
"Your current user type: ",
|
|
1757
|
-
/* @__PURE__ */
|
|
1822
|
+
/* @__PURE__ */ s("strong", { children: r })
|
|
1758
1823
|
] })
|
|
1759
|
-
] }) : /* @__PURE__ */ d(
|
|
1760
|
-
/* @__PURE__ */
|
|
1824
|
+
] }) : /* @__PURE__ */ d(_, { children: [
|
|
1825
|
+
/* @__PURE__ */ s("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: "You don't have the required permissions to access this page." }),
|
|
1761
1826
|
t && t.length > 0 && /* @__PURE__ */ d("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
|
|
1762
1827
|
"Required permissions: ",
|
|
1763
|
-
/* @__PURE__ */
|
|
1828
|
+
/* @__PURE__ */ s("strong", { children: t.join(", ") })
|
|
1764
1829
|
] })
|
|
1765
1830
|
] })
|
|
1766
1831
|
]
|
|
1767
1832
|
}
|
|
1768
1833
|
)
|
|
1769
1834
|
}
|
|
1770
|
-
),
|
|
1771
|
-
function
|
|
1772
|
-
children:
|
|
1835
|
+
), It = (r, e) => r === e;
|
|
1836
|
+
function Tn({
|
|
1837
|
+
children: r,
|
|
1773
1838
|
redirectTo: e = "/login",
|
|
1774
1839
|
requiredUserType: t,
|
|
1775
|
-
requiredPermissions:
|
|
1776
|
-
requireAllPermissions:
|
|
1777
|
-
fallback:
|
|
1840
|
+
requiredPermissions: n,
|
|
1841
|
+
requireAllPermissions: o = !1,
|
|
1842
|
+
fallback: i
|
|
1778
1843
|
}) {
|
|
1779
|
-
const { hasValidSession: a, sessionManager:
|
|
1780
|
-
if (
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1844
|
+
const { hasValidSession: a, sessionManager: p, hasPermission: f, hasAnyPermission: w, hasAllPermissions: u } = le(), b = be();
|
|
1845
|
+
if (X(() => {
|
|
1846
|
+
process.env.NODE_ENV === "development" && console.warn(
|
|
1847
|
+
"[react-identity-access] ProtectedRoute is deprecated. Use AuthenticatedZone or AdminZone from ZoneRoute instead."
|
|
1848
|
+
);
|
|
1849
|
+
}, []), !a())
|
|
1850
|
+
return i ? /* @__PURE__ */ s(_, { children: i }) : /* @__PURE__ */ d(_, { children: [
|
|
1851
|
+
/* @__PURE__ */ s(Rt, { redirectPath: e }),
|
|
1852
|
+
/* @__PURE__ */ s(me, { to: e, state: { from: b.pathname }, replace: !0 })
|
|
1784
1853
|
] });
|
|
1785
|
-
const
|
|
1786
|
-
if (!
|
|
1787
|
-
return /* @__PURE__ */
|
|
1788
|
-
if (t && !
|
|
1789
|
-
return /* @__PURE__ */
|
|
1790
|
-
|
|
1854
|
+
const g = p.getUser();
|
|
1855
|
+
if (!g)
|
|
1856
|
+
return /* @__PURE__ */ s(me, { to: e, state: { from: b.pathname }, replace: !0 });
|
|
1857
|
+
if (t && !It(g.userType, t))
|
|
1858
|
+
return /* @__PURE__ */ s(
|
|
1859
|
+
ze,
|
|
1791
1860
|
{
|
|
1792
|
-
userType:
|
|
1861
|
+
userType: g.userType,
|
|
1793
1862
|
requiredUserType: t
|
|
1794
1863
|
}
|
|
1795
1864
|
);
|
|
1796
|
-
if (
|
|
1797
|
-
const I =
|
|
1798
|
-
return /* @__PURE__ */
|
|
1865
|
+
if (n && n.length > 0 && !(o ? u(n) : w(n))) {
|
|
1866
|
+
const I = n.filter((N) => !f(N)).map((N) => typeof N == "string" ? N : N.name);
|
|
1867
|
+
return /* @__PURE__ */ s(ze, { missingPermissions: I });
|
|
1799
1868
|
}
|
|
1800
|
-
return /* @__PURE__ */
|
|
1869
|
+
return /* @__PURE__ */ s(_, { children: r });
|
|
1801
1870
|
}
|
|
1802
|
-
const
|
|
1871
|
+
const Mt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
1803
1872
|
"div",
|
|
1804
1873
|
{
|
|
1805
1874
|
style: {
|
|
@@ -1823,12 +1892,12 @@ const wt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1823
1892
|
maxWidth: "400px"
|
|
1824
1893
|
},
|
|
1825
1894
|
children: [
|
|
1826
|
-
/* @__PURE__ */
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
1895
|
+
/* @__PURE__ */ s("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🏢" }),
|
|
1896
|
+
/* @__PURE__ */ s("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Tenant Required" }),
|
|
1897
|
+
/* @__PURE__ */ s("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "This page requires a tenant context to access." }),
|
|
1829
1898
|
/* @__PURE__ */ d("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1830
1899
|
"Redirecting to ",
|
|
1831
|
-
|
|
1900
|
+
r,
|
|
1832
1901
|
"..."
|
|
1833
1902
|
] })
|
|
1834
1903
|
]
|
|
@@ -1836,14 +1905,18 @@ const wt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1836
1905
|
)
|
|
1837
1906
|
}
|
|
1838
1907
|
);
|
|
1839
|
-
function
|
|
1840
|
-
const { tenant:
|
|
1841
|
-
return
|
|
1842
|
-
|
|
1843
|
-
|
|
1908
|
+
function kn({ children: r, redirectTo: e = "/", fallback: t }) {
|
|
1909
|
+
const { tenant: n, isLoading: o, error: i } = ge(), a = be();
|
|
1910
|
+
return X(() => {
|
|
1911
|
+
process.env.NODE_ENV === "development" && console.warn(
|
|
1912
|
+
"[react-identity-access] TenantRoute is deprecated. Use TenantZone from ZoneRoute instead."
|
|
1913
|
+
);
|
|
1914
|
+
}, []), o || i ? null : n ? /* @__PURE__ */ s(_, { children: r }) : t ? /* @__PURE__ */ s(_, { children: t }) : /* @__PURE__ */ d(_, { children: [
|
|
1915
|
+
/* @__PURE__ */ s(Mt, { redirectPath: e }),
|
|
1916
|
+
/* @__PURE__ */ s(me, { to: e, state: { from: a.pathname }, replace: !0 })
|
|
1844
1917
|
] });
|
|
1845
1918
|
}
|
|
1846
|
-
const
|
|
1919
|
+
const Lt = ({ redirectPath: r }) => /* @__PURE__ */ s(
|
|
1847
1920
|
"div",
|
|
1848
1921
|
{
|
|
1849
1922
|
style: {
|
|
@@ -1867,12 +1940,12 @@ const bt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1867
1940
|
maxWidth: "400px"
|
|
1868
1941
|
},
|
|
1869
1942
|
children: [
|
|
1870
|
-
/* @__PURE__ */
|
|
1871
|
-
/* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
1943
|
+
/* @__PURE__ */ s("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🚀" }),
|
|
1944
|
+
/* @__PURE__ */ s("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Tenant Detected" }),
|
|
1945
|
+
/* @__PURE__ */ s("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You are accessing a tenant-specific context. Redirecting to the appropriate page." }),
|
|
1873
1946
|
/* @__PURE__ */ d("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
|
|
1874
1947
|
"Redirecting to ",
|
|
1875
|
-
|
|
1948
|
+
r,
|
|
1876
1949
|
"..."
|
|
1877
1950
|
] })
|
|
1878
1951
|
]
|
|
@@ -1880,14 +1953,125 @@ const bt = ({ redirectPath: i }) => /* @__PURE__ */ n(
|
|
|
1880
1953
|
)
|
|
1881
1954
|
}
|
|
1882
1955
|
);
|
|
1883
|
-
function
|
|
1884
|
-
const { tenant:
|
|
1885
|
-
return
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1956
|
+
function An({ children: r, redirectTo: e = "/dashboard", fallback: t }) {
|
|
1957
|
+
const { tenant: n, isLoading: o, error: i } = ge(), a = be();
|
|
1958
|
+
return X(() => {
|
|
1959
|
+
process.env.NODE_ENV === "development" && console.warn(
|
|
1960
|
+
"[react-identity-access] LandingRoute is deprecated. Use PublicZone from ZoneRoute instead."
|
|
1961
|
+
);
|
|
1962
|
+
}, []), o || i ? null : n ? t ? /* @__PURE__ */ s(_, { children: t }) : /* @__PURE__ */ d(_, { children: [
|
|
1963
|
+
/* @__PURE__ */ s(Lt, { redirectPath: e }),
|
|
1964
|
+
/* @__PURE__ */ s(me, { to: e, state: { from: a.pathname }, replace: !0 })
|
|
1965
|
+
] }) : /* @__PURE__ */ s(_, { children: r });
|
|
1966
|
+
}
|
|
1967
|
+
function Et(r, e) {
|
|
1968
|
+
return e ? r ? Array.isArray(e) ? e.includes(r) : r === e : !1 : !0;
|
|
1889
1969
|
}
|
|
1890
|
-
|
|
1970
|
+
function _e(r, e) {
|
|
1971
|
+
return !r || r === "optional" ? "skip" : r === "required" ? e ? "pass" : "fail" : r === "forbidden" ? e ? "fail" : "pass" : "skip";
|
|
1972
|
+
}
|
|
1973
|
+
function Ft(r, e) {
|
|
1974
|
+
return _e(r.tenant, e.hasTenant) === "fail" ? e.hasTenant ? "has_tenant" : "no_tenant" : _e(r.auth, e.isAuthenticated) === "fail" ? e.isAuthenticated ? "already_authenticated" : "not_authenticated" : r.userType && e.isAuthenticated && !Et(e.userType, r.userType) ? "wrong_user_type" : r.permissions && r.permissions.length > 0 && !(r.requireAllPermissions !== !1 ? (i) => i.every((a) => e.permissions.includes(a)) : (i) => i.some((a) => e.permissions.includes(a)))(r.permissions) ? "missing_permissions" : null;
|
|
1975
|
+
}
|
|
1976
|
+
function Nt(r, e) {
|
|
1977
|
+
return r.hasTenant ? r.isAuthenticated ? r.userType === se.TENANT_ADMIN ? e.tenantAdmin : e.tenantUser : e.tenantGuest : r.isAuthenticated ? r.userType === se.TENANT_ADMIN ? e.publicAdmin : e.publicUser : e.publicGuest;
|
|
1978
|
+
}
|
|
1979
|
+
function Dt(r, e, t, n, o) {
|
|
1980
|
+
if (!e || o !== "url")
|
|
1981
|
+
return r;
|
|
1982
|
+
const i = typeof e == "string" ? e : t, a = r.includes("?") ? "&" : "?";
|
|
1983
|
+
return `${r}${a}${n}=${encodeURIComponent(i)}`;
|
|
1984
|
+
}
|
|
1985
|
+
function Ct(r, e, t) {
|
|
1986
|
+
if (!r || t === "url") return;
|
|
1987
|
+
const n = typeof r == "string" ? r : e, o = "zone_return_to";
|
|
1988
|
+
t === "session" ? sessionStorage.setItem(o, n) : t === "local" && localStorage.setItem(o, n);
|
|
1989
|
+
}
|
|
1990
|
+
const ae = ({
|
|
1991
|
+
children: r,
|
|
1992
|
+
preset: e,
|
|
1993
|
+
tenant: t,
|
|
1994
|
+
auth: n,
|
|
1995
|
+
userType: o,
|
|
1996
|
+
requiredPermissions: i,
|
|
1997
|
+
requireAllPermissions: a = !0,
|
|
1998
|
+
returnTo: p,
|
|
1999
|
+
onAccessDenied: f,
|
|
2000
|
+
redirectTo: w,
|
|
2001
|
+
loadingFallback: u,
|
|
2002
|
+
accessDeniedFallback: b
|
|
2003
|
+
}) => {
|
|
2004
|
+
const g = be(), { isAuthenticated: T, isAuthInitializing: I, currentUser: N, userPermissions: M } = le(), { tenant: P, isTenantLoading: h } = he(), x = xt(), S = Z(() => {
|
|
2005
|
+
if (e)
|
|
2006
|
+
return x.presets[e];
|
|
2007
|
+
}, [e, x.presets]), L = Z(
|
|
2008
|
+
() => ({
|
|
2009
|
+
tenant: t ?? (S == null ? void 0 : S.tenant),
|
|
2010
|
+
auth: n ?? (S == null ? void 0 : S.auth),
|
|
2011
|
+
userType: o ?? (S == null ? void 0 : S.userType),
|
|
2012
|
+
permissions: i ?? (S == null ? void 0 : S.requiredPermissions),
|
|
2013
|
+
requireAllPermissions: a
|
|
2014
|
+
}),
|
|
2015
|
+
[t, n, o, i, S, a]
|
|
2016
|
+
), E = Z(
|
|
2017
|
+
() => ({
|
|
2018
|
+
hasTenant: !!P,
|
|
2019
|
+
isAuthenticated: T,
|
|
2020
|
+
userType: N == null ? void 0 : N.userType,
|
|
2021
|
+
permissions: M,
|
|
2022
|
+
isLoading: I || h
|
|
2023
|
+
}),
|
|
2024
|
+
[
|
|
2025
|
+
P,
|
|
2026
|
+
T,
|
|
2027
|
+
N == null ? void 0 : N.userType,
|
|
2028
|
+
M,
|
|
2029
|
+
I,
|
|
2030
|
+
h
|
|
2031
|
+
]
|
|
2032
|
+
), C = Z(() => E.isLoading ? null : Ft(L, E), [L, E]), R = Z(() => C ? w || Nt(E, x.zoneRoots) : null, [C, w, E, x.zoneRoots]), $ = Z(() => !C || !R ? null : {
|
|
2033
|
+
type: C,
|
|
2034
|
+
required: {
|
|
2035
|
+
tenant: L.tenant,
|
|
2036
|
+
auth: L.auth,
|
|
2037
|
+
userType: L.userType,
|
|
2038
|
+
permissions: L.permissions
|
|
2039
|
+
},
|
|
2040
|
+
current: {
|
|
2041
|
+
hasTenant: E.hasTenant,
|
|
2042
|
+
isAuthenticated: E.isAuthenticated,
|
|
2043
|
+
userType: E.userType,
|
|
2044
|
+
permissions: E.permissions
|
|
2045
|
+
},
|
|
2046
|
+
redirectTo: R
|
|
2047
|
+
}, [C, R, L, E]);
|
|
2048
|
+
if (X(() => {
|
|
2049
|
+
$ && (f ? f($) : x.onAccessDenied && x.onAccessDenied($));
|
|
2050
|
+
}, [$, f, x]), X(() => {
|
|
2051
|
+
$ && p && Ct(p, g.pathname + g.search, x.returnToStorage);
|
|
2052
|
+
}, [
|
|
2053
|
+
$,
|
|
2054
|
+
p,
|
|
2055
|
+
g.pathname,
|
|
2056
|
+
g.search,
|
|
2057
|
+
x.returnToStorage
|
|
2058
|
+
]), E.isLoading)
|
|
2059
|
+
return /* @__PURE__ */ s(_, { children: u ?? x.loadingFallback ?? null });
|
|
2060
|
+
if ($ && R) {
|
|
2061
|
+
const l = b ?? x.accessDeniedFallback;
|
|
2062
|
+
if (l)
|
|
2063
|
+
return /* @__PURE__ */ s(_, { children: l });
|
|
2064
|
+
const D = Dt(
|
|
2065
|
+
R,
|
|
2066
|
+
p,
|
|
2067
|
+
g.pathname + g.search,
|
|
2068
|
+
x.returnToParam,
|
|
2069
|
+
x.returnToStorage
|
|
2070
|
+
);
|
|
2071
|
+
return /* @__PURE__ */ s(me, { to: D, replace: !0 });
|
|
2072
|
+
}
|
|
2073
|
+
return /* @__PURE__ */ s(_, { children: r });
|
|
2074
|
+
}, xn = (r) => /* @__PURE__ */ s(ae, { tenant: "required", ...r }), Pn = (r) => /* @__PURE__ */ s(ae, { tenant: "forbidden", ...r }), Rn = (r) => /* @__PURE__ */ s(ae, { auth: "required", ...r }), In = (r) => /* @__PURE__ */ s(ae, { auth: "forbidden", ...r }), Mn = (r) => /* @__PURE__ */ s(ae, { auth: "required", userType: se.TENANT_ADMIN, ...r }), Ln = (r) => /* @__PURE__ */ s(ae, { auth: "required", userType: se.USER, ...r }), En = (r) => /* @__PURE__ */ s(ae, { tenant: "optional", auth: "optional", ...r }), Fn = (r) => /* @__PURE__ */ s(ae, { tenant: "required", auth: "required", ...r }), Nn = (r) => /* @__PURE__ */ s(ae, { tenant: "required", auth: "optional", ...r }), Dn = (r) => /* @__PURE__ */ s(ae, { tenant: "required", auth: "forbidden", ...r }), Ut = () => /* @__PURE__ */ d(
|
|
1891
2075
|
"div",
|
|
1892
2076
|
{
|
|
1893
2077
|
style: {
|
|
@@ -1899,19 +2083,19 @@ const St = () => /* @__PURE__ */ d(
|
|
|
1899
2083
|
color: "#dc2626"
|
|
1900
2084
|
},
|
|
1901
2085
|
children: [
|
|
1902
|
-
/* @__PURE__ */
|
|
1903
|
-
/* @__PURE__ */
|
|
2086
|
+
/* @__PURE__ */ s("h3", { style: { margin: "0 0 1rem 0" }, children: "🔒 Subscription Required" }),
|
|
2087
|
+
/* @__PURE__ */ s("p", { style: { margin: 0 }, children: "This feature requires a higher subscription plan. Please upgrade your plan to access this content." })
|
|
1904
2088
|
]
|
|
1905
2089
|
}
|
|
1906
2090
|
);
|
|
1907
|
-
function
|
|
1908
|
-
children:
|
|
1909
|
-
fallback: e = /* @__PURE__ */
|
|
2091
|
+
function Cn({
|
|
2092
|
+
children: r,
|
|
2093
|
+
fallback: e = /* @__PURE__ */ s(Ut, {}),
|
|
1910
2094
|
allowedPlans: t,
|
|
1911
|
-
requiredFeature:
|
|
2095
|
+
requiredFeature: n
|
|
1912
2096
|
}) {
|
|
1913
|
-
const { subscription:
|
|
1914
|
-
return
|
|
2097
|
+
const { subscription: o, hasAllowedPlan: i, isFeatureEnabled: a, loading: p } = At();
|
|
2098
|
+
return p ? /* @__PURE__ */ s(
|
|
1915
2099
|
"div",
|
|
1916
2100
|
{
|
|
1917
2101
|
style: {
|
|
@@ -1921,9 +2105,9 @@ function or({
|
|
|
1921
2105
|
},
|
|
1922
2106
|
children: "Loading subscription..."
|
|
1923
2107
|
}
|
|
1924
|
-
) :
|
|
2108
|
+
) : o ? o.isActive ? t && t.length > 0 && !i(t) ? /* @__PURE__ */ s(_, { children: e }) : n && !a(n) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: r }) : /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: e });
|
|
1925
2109
|
}
|
|
1926
|
-
const
|
|
2110
|
+
const $t = ({ flagName: r }) => /* @__PURE__ */ d(
|
|
1927
2111
|
"div",
|
|
1928
2112
|
{
|
|
1929
2113
|
style: {
|
|
@@ -1940,19 +2124,19 @@ const vt = ({ flagName: i }) => /* @__PURE__ */ d(
|
|
|
1940
2124
|
color: "#6c757d"
|
|
1941
2125
|
},
|
|
1942
2126
|
children: [
|
|
1943
|
-
/* @__PURE__ */
|
|
1944
|
-
/* @__PURE__ */
|
|
2127
|
+
/* @__PURE__ */ s("div", { style: { fontSize: "24px", marginBottom: "8px" }, children: "🚧" }),
|
|
2128
|
+
/* @__PURE__ */ s("div", { style: { fontSize: "14px", fontWeight: "500", marginBottom: "4px" }, children: "Feature Not Available" }),
|
|
1945
2129
|
/* @__PURE__ */ d("div", { style: { fontSize: "12px", opacity: 0.7 }, children: [
|
|
1946
2130
|
'Feature flag "',
|
|
1947
|
-
|
|
2131
|
+
r,
|
|
1948
2132
|
'" is disabled'
|
|
1949
2133
|
] })
|
|
1950
2134
|
]
|
|
1951
2135
|
}
|
|
1952
2136
|
);
|
|
1953
|
-
function
|
|
1954
|
-
const { isEnabled:
|
|
1955
|
-
return
|
|
2137
|
+
function Un({ name: r, children: e, fallback: t }) {
|
|
2138
|
+
const { isEnabled: n, loading: o } = Tt();
|
|
2139
|
+
return o ? /* @__PURE__ */ s(
|
|
1956
2140
|
"div",
|
|
1957
2141
|
{
|
|
1958
2142
|
style: {
|
|
@@ -1965,9 +2149,9 @@ function ar({ name: i, children: e, fallback: t }) {
|
|
|
1965
2149
|
},
|
|
1966
2150
|
children: "Loading feature flags..."
|
|
1967
2151
|
}
|
|
1968
|
-
) : r
|
|
2152
|
+
) : n(r) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: t || /* @__PURE__ */ s($t, { flagName: r }) });
|
|
1969
2153
|
}
|
|
1970
|
-
const
|
|
2154
|
+
const Ht = () => /* @__PURE__ */ d(
|
|
1971
2155
|
"svg",
|
|
1972
2156
|
{
|
|
1973
2157
|
width: "16",
|
|
@@ -1980,11 +2164,11 @@ const kt = () => /* @__PURE__ */ d(
|
|
|
1980
2164
|
strokeLinejoin: "round",
|
|
1981
2165
|
style: { flexShrink: 0 },
|
|
1982
2166
|
children: [
|
|
1983
|
-
/* @__PURE__ */
|
|
1984
|
-
/* @__PURE__ */
|
|
2167
|
+
/* @__PURE__ */ s("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
2168
|
+
/* @__PURE__ */ s("circle", { cx: "12", cy: "12", r: "3" })
|
|
1985
2169
|
]
|
|
1986
2170
|
}
|
|
1987
|
-
),
|
|
2171
|
+
), Bt = () => /* @__PURE__ */ d(
|
|
1988
2172
|
"svg",
|
|
1989
2173
|
{
|
|
1990
2174
|
width: "16",
|
|
@@ -1997,14 +2181,14 @@ const kt = () => /* @__PURE__ */ d(
|
|
|
1997
2181
|
strokeLinejoin: "round",
|
|
1998
2182
|
style: { flexShrink: 0 },
|
|
1999
2183
|
children: [
|
|
2000
|
-
/* @__PURE__ */
|
|
2001
|
-
/* @__PURE__ */
|
|
2184
|
+
/* @__PURE__ */ s("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
2185
|
+
/* @__PURE__ */ s("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2002
2186
|
]
|
|
2003
2187
|
}
|
|
2004
|
-
),
|
|
2005
|
-
showPassword: /* @__PURE__ */
|
|
2006
|
-
hidePassword: /* @__PURE__ */
|
|
2007
|
-
},
|
|
2188
|
+
), qt = {
|
|
2189
|
+
showPassword: /* @__PURE__ */ s(Ht, {}),
|
|
2190
|
+
hidePassword: /* @__PURE__ */ s(Bt, {})
|
|
2191
|
+
}, Ot = {
|
|
2008
2192
|
title: "Sign In",
|
|
2009
2193
|
usernameLabel: "Email or Phone",
|
|
2010
2194
|
usernamePlaceholder: "Enter your email or phone number",
|
|
@@ -2018,7 +2202,7 @@ const kt = () => /* @__PURE__ */ d(
|
|
|
2018
2202
|
magicLinkLink: "Use Magic Link",
|
|
2019
2203
|
errorMessage: "Invalid credentials",
|
|
2020
2204
|
loadingText: "Signing in..."
|
|
2021
|
-
},
|
|
2205
|
+
}, zt = {
|
|
2022
2206
|
container: {
|
|
2023
2207
|
maxWidth: "400px",
|
|
2024
2208
|
width: "100%",
|
|
@@ -2125,133 +2309,133 @@ const kt = () => /* @__PURE__ */ d(
|
|
|
2125
2309
|
fontSize: "0.875rem"
|
|
2126
2310
|
}
|
|
2127
2311
|
};
|
|
2128
|
-
function
|
|
2129
|
-
copy:
|
|
2312
|
+
function $n({
|
|
2313
|
+
copy: r = {},
|
|
2130
2314
|
styles: e = {},
|
|
2131
2315
|
icons: t = {},
|
|
2132
|
-
onSuccess:
|
|
2133
|
-
onError:
|
|
2134
|
-
onForgotPassword:
|
|
2316
|
+
onSuccess: n,
|
|
2317
|
+
onError: o,
|
|
2318
|
+
onForgotPassword: i,
|
|
2135
2319
|
onSignupClick: a,
|
|
2136
|
-
onMagicLinkClick:
|
|
2137
|
-
showForgotPassword:
|
|
2138
|
-
showSignupLink:
|
|
2139
|
-
showMagicLinkOption:
|
|
2140
|
-
className:
|
|
2320
|
+
onMagicLinkClick: p,
|
|
2321
|
+
showForgotPassword: f = !0,
|
|
2322
|
+
showSignupLink: w = !0,
|
|
2323
|
+
showMagicLinkOption: u = !0,
|
|
2324
|
+
className: b
|
|
2141
2325
|
}) {
|
|
2142
|
-
const [
|
|
2143
|
-
const
|
|
2144
|
-
return
|
|
2145
|
-
}, H = async (
|
|
2146
|
-
if (
|
|
2147
|
-
if (!(
|
|
2148
|
-
|
|
2326
|
+
const [g, T] = A(""), [I, N] = A(""), [M, P] = A(!1), [h, x] = A(!1), [S, L] = A(""), [E, C] = A({}), { login: R } = le(), { tenant: $ } = ge(), l = { ...Ot, ...r }, D = { ...zt, ...e }, U = { ...qt, ...t }, c = () => {
|
|
2327
|
+
const m = {};
|
|
2328
|
+
return g.trim() || (m.username = !0), I.trim() || (m.password = !0), C(m), Object.keys(m).length === 0;
|
|
2329
|
+
}, H = async (m) => {
|
|
2330
|
+
if (m.preventDefault(), !!c()) {
|
|
2331
|
+
if (!($ != null && $.id)) {
|
|
2332
|
+
L("Tenant not found");
|
|
2149
2333
|
return;
|
|
2150
2334
|
}
|
|
2151
|
-
|
|
2335
|
+
x(!0), L("");
|
|
2152
2336
|
try {
|
|
2153
|
-
const
|
|
2154
|
-
username:
|
|
2337
|
+
const v = await R({
|
|
2338
|
+
username: g,
|
|
2155
2339
|
password: I
|
|
2156
2340
|
// tenantId inferred from context automatically
|
|
2157
2341
|
});
|
|
2158
|
-
|
|
2159
|
-
} catch (
|
|
2160
|
-
const
|
|
2161
|
-
|
|
2342
|
+
n == null || n(v);
|
|
2343
|
+
} catch (v) {
|
|
2344
|
+
const G = v.message || l.errorMessage;
|
|
2345
|
+
L(G), o == null || o(G);
|
|
2162
2346
|
} finally {
|
|
2163
|
-
|
|
2347
|
+
x(!1);
|
|
2164
2348
|
}
|
|
2165
2349
|
}
|
|
2166
|
-
},
|
|
2167
|
-
...
|
|
2168
|
-
...
|
|
2169
|
-
}),
|
|
2170
|
-
...
|
|
2171
|
-
...
|
|
2172
|
-
...!
|
|
2350
|
+
}, F = (m) => ({
|
|
2351
|
+
...D.input,
|
|
2352
|
+
...E[m] ? D.inputError : {}
|
|
2353
|
+
}), y = () => ({
|
|
2354
|
+
...D.button,
|
|
2355
|
+
...h ? D.buttonLoading : {},
|
|
2356
|
+
...!g || !I || h ? D.buttonDisabled : {}
|
|
2173
2357
|
});
|
|
2174
|
-
return /* @__PURE__ */ d("div", { className:
|
|
2175
|
-
/* @__PURE__ */
|
|
2176
|
-
/* @__PURE__ */ d("form", { onSubmit: H, style:
|
|
2177
|
-
/* @__PURE__ */ d("div", { style:
|
|
2178
|
-
/* @__PURE__ */
|
|
2179
|
-
/* @__PURE__ */
|
|
2358
|
+
return /* @__PURE__ */ d("div", { className: b, style: D.container, children: [
|
|
2359
|
+
/* @__PURE__ */ s("h2", { style: D.title, children: l.title }),
|
|
2360
|
+
/* @__PURE__ */ d("form", { onSubmit: H, style: D.form, children: [
|
|
2361
|
+
/* @__PURE__ */ d("div", { style: D.fieldGroup, children: [
|
|
2362
|
+
/* @__PURE__ */ s("label", { style: D.label, children: l.usernameLabel }),
|
|
2363
|
+
/* @__PURE__ */ s(
|
|
2180
2364
|
"input",
|
|
2181
2365
|
{
|
|
2182
2366
|
id: "username",
|
|
2183
2367
|
name: "username",
|
|
2184
2368
|
type: "text",
|
|
2185
|
-
value:
|
|
2186
|
-
onChange: (
|
|
2187
|
-
T(
|
|
2369
|
+
value: g,
|
|
2370
|
+
onChange: (m) => {
|
|
2371
|
+
T(m.target.value), E.username && C((v) => ({ ...v, username: !1 }));
|
|
2188
2372
|
},
|
|
2189
|
-
placeholder:
|
|
2190
|
-
style:
|
|
2191
|
-
disabled:
|
|
2373
|
+
placeholder: l.usernamePlaceholder,
|
|
2374
|
+
style: F("username"),
|
|
2375
|
+
disabled: h
|
|
2192
2376
|
}
|
|
2193
2377
|
)
|
|
2194
2378
|
] }),
|
|
2195
|
-
/* @__PURE__ */ d("div", { style:
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */ d("div", { style:
|
|
2198
|
-
/* @__PURE__ */
|
|
2379
|
+
/* @__PURE__ */ d("div", { style: D.fieldGroup, children: [
|
|
2380
|
+
/* @__PURE__ */ s("label", { style: D.label, children: l.passwordLabel }),
|
|
2381
|
+
/* @__PURE__ */ d("div", { style: D.inputContainer, children: [
|
|
2382
|
+
/* @__PURE__ */ s(
|
|
2199
2383
|
"input",
|
|
2200
2384
|
{
|
|
2201
2385
|
id: "password",
|
|
2202
2386
|
name: "password",
|
|
2203
|
-
type:
|
|
2387
|
+
type: M ? "text" : "password",
|
|
2204
2388
|
value: I,
|
|
2205
|
-
onChange: (
|
|
2206
|
-
|
|
2389
|
+
onChange: (m) => {
|
|
2390
|
+
N(m.target.value), E.password && C((v) => ({ ...v, password: !1 }));
|
|
2207
2391
|
},
|
|
2208
|
-
placeholder:
|
|
2392
|
+
placeholder: l.passwordPlaceholder,
|
|
2209
2393
|
style: {
|
|
2210
|
-
...
|
|
2394
|
+
...F("password"),
|
|
2211
2395
|
paddingRight: "2.5rem"
|
|
2212
2396
|
// Make room for the icon
|
|
2213
2397
|
},
|
|
2214
|
-
disabled:
|
|
2398
|
+
disabled: h
|
|
2215
2399
|
}
|
|
2216
2400
|
),
|
|
2217
|
-
/* @__PURE__ */
|
|
2401
|
+
/* @__PURE__ */ s(
|
|
2218
2402
|
"button",
|
|
2219
2403
|
{
|
|
2220
2404
|
type: "button",
|
|
2221
|
-
onClick: () =>
|
|
2222
|
-
style:
|
|
2223
|
-
disabled:
|
|
2224
|
-
"aria-label":
|
|
2225
|
-
children:
|
|
2405
|
+
onClick: () => P(!M),
|
|
2406
|
+
style: D.passwordToggle,
|
|
2407
|
+
disabled: h,
|
|
2408
|
+
"aria-label": M ? "Hide password" : "Show password",
|
|
2409
|
+
children: M ? U.hidePassword : U.showPassword
|
|
2226
2410
|
}
|
|
2227
2411
|
)
|
|
2228
2412
|
] })
|
|
2229
2413
|
] }),
|
|
2230
|
-
/* @__PURE__ */
|
|
2231
|
-
|
|
2414
|
+
/* @__PURE__ */ s("button", { type: "submit", disabled: !g || !I || h, style: y(), children: h ? l.loadingText : l.submitButton }),
|
|
2415
|
+
S && /* @__PURE__ */ s("div", { style: D.errorText, children: S })
|
|
2232
2416
|
] }),
|
|
2233
|
-
(
|
|
2234
|
-
|
|
2235
|
-
/* @__PURE__ */ d("span", { style:
|
|
2236
|
-
|
|
2417
|
+
(f || w || u) && /* @__PURE__ */ d("div", { style: D.linkContainer, children: [
|
|
2418
|
+
u && /* @__PURE__ */ d("div", { children: [
|
|
2419
|
+
/* @__PURE__ */ d("span", { style: D.divider, children: [
|
|
2420
|
+
l.magicLinkText,
|
|
2237
2421
|
" "
|
|
2238
2422
|
] }),
|
|
2239
|
-
/* @__PURE__ */
|
|
2423
|
+
/* @__PURE__ */ s("a", { onClick: p, style: D.link, children: l.magicLinkLink })
|
|
2240
2424
|
] }),
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
/* @__PURE__ */ d("span", { style:
|
|
2246
|
-
|
|
2425
|
+
u && (f || w) && /* @__PURE__ */ s("div", { style: D.divider, children: "•" }),
|
|
2426
|
+
f && /* @__PURE__ */ s("a", { onClick: i, style: D.link, children: l.forgotPasswordLink }),
|
|
2427
|
+
f && w && /* @__PURE__ */ s("div", { style: D.divider, children: "•" }),
|
|
2428
|
+
w && /* @__PURE__ */ d("div", { children: [
|
|
2429
|
+
/* @__PURE__ */ d("span", { style: D.divider, children: [
|
|
2430
|
+
l.signupText,
|
|
2247
2431
|
" "
|
|
2248
2432
|
] }),
|
|
2249
|
-
/* @__PURE__ */
|
|
2433
|
+
/* @__PURE__ */ s("a", { onClick: a, style: D.link, children: l.signupLink })
|
|
2250
2434
|
] })
|
|
2251
2435
|
] })
|
|
2252
2436
|
] });
|
|
2253
2437
|
}
|
|
2254
|
-
const
|
|
2438
|
+
const _t = {
|
|
2255
2439
|
title: "Create Account",
|
|
2256
2440
|
nameLabel: "First Name",
|
|
2257
2441
|
namePlaceholder: "Enter your first name",
|
|
@@ -2277,7 +2461,7 @@ const Mt = {
|
|
|
2277
2461
|
passwordMismatchError: "Passwords do not match",
|
|
2278
2462
|
isAdminLabel: "Create new organization",
|
|
2279
2463
|
isAdminDescription: "Check this if you want to create a new organization"
|
|
2280
|
-
},
|
|
2464
|
+
}, Wt = {
|
|
2281
2465
|
container: {
|
|
2282
2466
|
maxWidth: "400px",
|
|
2283
2467
|
width: "100%",
|
|
@@ -2376,138 +2560,138 @@ const Mt = {
|
|
|
2376
2560
|
fontSize: "0.875rem"
|
|
2377
2561
|
}
|
|
2378
2562
|
};
|
|
2379
|
-
function
|
|
2380
|
-
copy:
|
|
2563
|
+
function Hn({
|
|
2564
|
+
copy: r = {},
|
|
2381
2565
|
styles: e = {},
|
|
2382
2566
|
signupType: t = "user",
|
|
2383
|
-
onSuccess:
|
|
2384
|
-
onError:
|
|
2385
|
-
onLoginClick:
|
|
2567
|
+
onSuccess: n,
|
|
2568
|
+
onError: o,
|
|
2569
|
+
onLoginClick: i,
|
|
2386
2570
|
onMagicLinkClick: a,
|
|
2387
|
-
showLoginLink:
|
|
2388
|
-
showMagicLinkOption:
|
|
2389
|
-
className:
|
|
2571
|
+
showLoginLink: p = !0,
|
|
2572
|
+
showMagicLinkOption: f = !0,
|
|
2573
|
+
className: w
|
|
2390
2574
|
}) {
|
|
2391
|
-
const [
|
|
2392
|
-
const
|
|
2393
|
-
return
|
|
2394
|
-
},
|
|
2395
|
-
if (
|
|
2396
|
-
if (
|
|
2397
|
-
|
|
2575
|
+
const [u, b] = A(""), [g, T] = A(""), [I, N] = A(""), [M, P] = A(""), [h, x] = A(""), [S, L] = A(""), [E, C] = A(""), [R, $] = A(!1), [l, D] = A(""), [U, c] = A({}), { signup: H, signupTenantAdmin: F } = le(), { tenant: y } = ge(), m = { ..._t, ...r }, v = { ...Wt, ...e }, G = () => {
|
|
2576
|
+
const k = {};
|
|
2577
|
+
return u.trim() || (k.name = !0), !I.trim() && !M.trim() && (k.email = !0, k.phoneNumber = !0), h.trim() || (k.password = !0), S.trim() || (k.confirmPassword = !0), t === "tenant" && !E.trim() && (k.tenantName = !0), c(k), Object.keys(k).length === 0;
|
|
2578
|
+
}, J = async (k) => {
|
|
2579
|
+
if (k.preventDefault(), !!G()) {
|
|
2580
|
+
if (h !== S) {
|
|
2581
|
+
D(m.passwordMismatchError), c({ confirmPassword: !0 });
|
|
2398
2582
|
return;
|
|
2399
2583
|
}
|
|
2400
|
-
if (t === "user" && !(
|
|
2401
|
-
|
|
2584
|
+
if (t === "user" && !(y != null && y.id)) {
|
|
2585
|
+
D("Tenant not found");
|
|
2402
2586
|
return;
|
|
2403
2587
|
}
|
|
2404
|
-
|
|
2588
|
+
$(!0), D("");
|
|
2405
2589
|
try {
|
|
2406
|
-
let
|
|
2407
|
-
t === "tenant" ?
|
|
2590
|
+
let K;
|
|
2591
|
+
t === "tenant" ? K = await F({
|
|
2408
2592
|
email: I || void 0,
|
|
2409
|
-
phoneNumber:
|
|
2410
|
-
name:
|
|
2411
|
-
password:
|
|
2412
|
-
tenantName:
|
|
2413
|
-
lastName:
|
|
2414
|
-
}) :
|
|
2593
|
+
phoneNumber: M || void 0,
|
|
2594
|
+
name: u,
|
|
2595
|
+
password: h,
|
|
2596
|
+
tenantName: E,
|
|
2597
|
+
lastName: g || void 0
|
|
2598
|
+
}) : K = await H({
|
|
2415
2599
|
email: I || void 0,
|
|
2416
|
-
phoneNumber:
|
|
2417
|
-
name:
|
|
2418
|
-
password:
|
|
2419
|
-
tenantId:
|
|
2420
|
-
lastName:
|
|
2421
|
-
}),
|
|
2422
|
-
} catch (
|
|
2423
|
-
const
|
|
2424
|
-
|
|
2600
|
+
phoneNumber: M || void 0,
|
|
2601
|
+
name: u,
|
|
2602
|
+
password: h,
|
|
2603
|
+
tenantId: y.id,
|
|
2604
|
+
lastName: g || void 0
|
|
2605
|
+
}), n == null || n(K);
|
|
2606
|
+
} catch (K) {
|
|
2607
|
+
const ce = K.message || m.errorMessage;
|
|
2608
|
+
D(ce), o == null || o(ce);
|
|
2425
2609
|
} finally {
|
|
2426
|
-
|
|
2610
|
+
$(!1);
|
|
2427
2611
|
}
|
|
2428
2612
|
}
|
|
2429
|
-
},
|
|
2430
|
-
...
|
|
2431
|
-
...
|
|
2432
|
-
}),
|
|
2433
|
-
...
|
|
2434
|
-
...
|
|
2435
|
-
...!
|
|
2436
|
-
}), V =
|
|
2437
|
-
return /* @__PURE__ */ d("div", { className:
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
2440
|
-
/* @__PURE__ */ d("div", { style:
|
|
2441
|
-
/* @__PURE__ */
|
|
2442
|
-
/* @__PURE__ */
|
|
2613
|
+
}, q = (k) => ({
|
|
2614
|
+
...v.input,
|
|
2615
|
+
...U[k] ? v.inputError : {}
|
|
2616
|
+
}), O = () => ({
|
|
2617
|
+
...v.button,
|
|
2618
|
+
...R ? v.buttonLoading : {},
|
|
2619
|
+
...!u || !I && !M || !h || !S || R || t === "tenant" && !E ? v.buttonDisabled : {}
|
|
2620
|
+
}), V = u && (I || M) && h && S && (t === "user" || E);
|
|
2621
|
+
return /* @__PURE__ */ d("div", { className: w, style: v.container, children: [
|
|
2622
|
+
/* @__PURE__ */ s("h2", { style: v.title, children: m.title }),
|
|
2623
|
+
/* @__PURE__ */ d("form", { onSubmit: J, style: v.form, children: [
|
|
2624
|
+
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2625
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.nameLabel }),
|
|
2626
|
+
/* @__PURE__ */ s(
|
|
2443
2627
|
"input",
|
|
2444
2628
|
{
|
|
2445
2629
|
id: "name",
|
|
2446
2630
|
name: "name",
|
|
2447
2631
|
type: "text",
|
|
2448
|
-
value:
|
|
2449
|
-
onChange: (
|
|
2450
|
-
|
|
2632
|
+
value: u,
|
|
2633
|
+
onChange: (k) => {
|
|
2634
|
+
b(k.target.value), U.name && c((K) => ({ ...K, name: !1 }));
|
|
2451
2635
|
},
|
|
2452
|
-
placeholder:
|
|
2453
|
-
style:
|
|
2454
|
-
disabled:
|
|
2636
|
+
placeholder: m.namePlaceholder,
|
|
2637
|
+
style: q("name"),
|
|
2638
|
+
disabled: R
|
|
2455
2639
|
}
|
|
2456
2640
|
)
|
|
2457
2641
|
] }),
|
|
2458
|
-
/* @__PURE__ */ d("div", { style:
|
|
2459
|
-
/* @__PURE__ */
|
|
2460
|
-
/* @__PURE__ */
|
|
2642
|
+
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2643
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.lastNameLabel }),
|
|
2644
|
+
/* @__PURE__ */ s(
|
|
2461
2645
|
"input",
|
|
2462
2646
|
{
|
|
2463
2647
|
id: "lastName",
|
|
2464
2648
|
name: "lastName",
|
|
2465
2649
|
type: "text",
|
|
2466
|
-
value:
|
|
2467
|
-
onChange: (
|
|
2468
|
-
placeholder:
|
|
2469
|
-
style:
|
|
2470
|
-
disabled:
|
|
2650
|
+
value: g,
|
|
2651
|
+
onChange: (k) => T(k.target.value),
|
|
2652
|
+
placeholder: m.lastNamePlaceholder,
|
|
2653
|
+
style: v.input,
|
|
2654
|
+
disabled: R
|
|
2471
2655
|
}
|
|
2472
2656
|
)
|
|
2473
2657
|
] }),
|
|
2474
|
-
/* @__PURE__ */ d("div", { style:
|
|
2475
|
-
/* @__PURE__ */
|
|
2476
|
-
/* @__PURE__ */
|
|
2658
|
+
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2659
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.emailLabel }),
|
|
2660
|
+
/* @__PURE__ */ s(
|
|
2477
2661
|
"input",
|
|
2478
2662
|
{
|
|
2479
2663
|
id: "email",
|
|
2480
2664
|
name: "email",
|
|
2481
2665
|
type: "email",
|
|
2482
2666
|
value: I,
|
|
2483
|
-
onChange: (
|
|
2484
|
-
|
|
2667
|
+
onChange: (k) => {
|
|
2668
|
+
N(k.target.value), U.email && c((K) => ({ ...K, email: !1, phoneNumber: !1 }));
|
|
2485
2669
|
},
|
|
2486
|
-
placeholder:
|
|
2487
|
-
style:
|
|
2488
|
-
disabled:
|
|
2670
|
+
placeholder: m.emailPlaceholder,
|
|
2671
|
+
style: q("email"),
|
|
2672
|
+
disabled: R
|
|
2489
2673
|
}
|
|
2490
2674
|
)
|
|
2491
2675
|
] }),
|
|
2492
|
-
/* @__PURE__ */ d("div", { style:
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
/* @__PURE__ */
|
|
2676
|
+
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2677
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.phoneNumberLabel }),
|
|
2678
|
+
/* @__PURE__ */ s(
|
|
2495
2679
|
"input",
|
|
2496
2680
|
{
|
|
2497
2681
|
id: "phoneNumber",
|
|
2498
2682
|
name: "phoneNumber",
|
|
2499
2683
|
type: "tel",
|
|
2500
|
-
value:
|
|
2501
|
-
onChange: (
|
|
2502
|
-
|
|
2684
|
+
value: M,
|
|
2685
|
+
onChange: (k) => {
|
|
2686
|
+
P(k.target.value), U.phoneNumber && c((K) => ({ ...K, email: !1, phoneNumber: !1 }));
|
|
2503
2687
|
},
|
|
2504
|
-
placeholder:
|
|
2505
|
-
style:
|
|
2506
|
-
disabled:
|
|
2688
|
+
placeholder: m.phoneNumberPlaceholder,
|
|
2689
|
+
style: q("phoneNumber"),
|
|
2690
|
+
disabled: R
|
|
2507
2691
|
}
|
|
2508
2692
|
)
|
|
2509
2693
|
] }),
|
|
2510
|
-
/* @__PURE__ */
|
|
2694
|
+
/* @__PURE__ */ s(
|
|
2511
2695
|
"div",
|
|
2512
2696
|
{
|
|
2513
2697
|
style: {
|
|
@@ -2519,83 +2703,83 @@ function cr({
|
|
|
2519
2703
|
children: "At least one contact method (email or phone) is required"
|
|
2520
2704
|
}
|
|
2521
2705
|
),
|
|
2522
|
-
/* @__PURE__ */ d("div", { style:
|
|
2523
|
-
/* @__PURE__ */
|
|
2524
|
-
/* @__PURE__ */
|
|
2706
|
+
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2707
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.passwordLabel }),
|
|
2708
|
+
/* @__PURE__ */ s(
|
|
2525
2709
|
"input",
|
|
2526
2710
|
{
|
|
2527
2711
|
id: "password",
|
|
2528
2712
|
name: "password",
|
|
2529
2713
|
type: "password",
|
|
2530
|
-
value:
|
|
2531
|
-
onChange: (
|
|
2532
|
-
|
|
2714
|
+
value: h,
|
|
2715
|
+
onChange: (k) => {
|
|
2716
|
+
x(k.target.value), U.password && c((K) => ({ ...K, password: !1 }));
|
|
2533
2717
|
},
|
|
2534
|
-
placeholder:
|
|
2535
|
-
style:
|
|
2536
|
-
disabled:
|
|
2718
|
+
placeholder: m.passwordPlaceholder,
|
|
2719
|
+
style: q("password"),
|
|
2720
|
+
disabled: R
|
|
2537
2721
|
}
|
|
2538
2722
|
)
|
|
2539
2723
|
] }),
|
|
2540
|
-
/* @__PURE__ */ d("div", { style:
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2724
|
+
/* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2725
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.confirmPasswordLabel }),
|
|
2726
|
+
/* @__PURE__ */ s(
|
|
2543
2727
|
"input",
|
|
2544
2728
|
{
|
|
2545
2729
|
id: "confirmPassword",
|
|
2546
2730
|
name: "confirmPassword",
|
|
2547
2731
|
type: "password",
|
|
2548
|
-
value:
|
|
2549
|
-
onChange: (
|
|
2550
|
-
|
|
2732
|
+
value: S,
|
|
2733
|
+
onChange: (k) => {
|
|
2734
|
+
L(k.target.value), U.confirmPassword && c((K) => ({ ...K, confirmPassword: !1 })), l === m.passwordMismatchError && D("");
|
|
2551
2735
|
},
|
|
2552
|
-
placeholder:
|
|
2553
|
-
style:
|
|
2554
|
-
disabled:
|
|
2736
|
+
placeholder: m.confirmPasswordPlaceholder,
|
|
2737
|
+
style: q("confirmPassword"),
|
|
2738
|
+
disabled: R
|
|
2555
2739
|
}
|
|
2556
2740
|
)
|
|
2557
2741
|
] }),
|
|
2558
|
-
t === "tenant" && /* @__PURE__ */ d("div", { style:
|
|
2559
|
-
/* @__PURE__ */
|
|
2560
|
-
/* @__PURE__ */
|
|
2742
|
+
t === "tenant" && /* @__PURE__ */ d("div", { style: v.fieldGroup, children: [
|
|
2743
|
+
/* @__PURE__ */ s("label", { style: v.label, children: m.tenantNameLabel }),
|
|
2744
|
+
/* @__PURE__ */ s(
|
|
2561
2745
|
"input",
|
|
2562
2746
|
{
|
|
2563
2747
|
id: "tenantName",
|
|
2564
2748
|
name: "tenantName",
|
|
2565
2749
|
type: "text",
|
|
2566
|
-
value:
|
|
2567
|
-
onChange: (
|
|
2568
|
-
|
|
2750
|
+
value: E,
|
|
2751
|
+
onChange: (k) => {
|
|
2752
|
+
C(k.target.value), U.tenantName && c((K) => ({ ...K, tenantName: !1 }));
|
|
2569
2753
|
},
|
|
2570
|
-
placeholder:
|
|
2571
|
-
style:
|
|
2572
|
-
disabled:
|
|
2754
|
+
placeholder: m.tenantNamePlaceholder,
|
|
2755
|
+
style: q("tenantName"),
|
|
2756
|
+
disabled: R
|
|
2573
2757
|
}
|
|
2574
2758
|
)
|
|
2575
2759
|
] }),
|
|
2576
|
-
/* @__PURE__ */
|
|
2577
|
-
|
|
2760
|
+
/* @__PURE__ */ s("button", { type: "submit", disabled: !V || R, style: O(), children: R ? m.loadingText : m.submitButton }),
|
|
2761
|
+
l && /* @__PURE__ */ s("div", { style: v.errorText, children: l })
|
|
2578
2762
|
] }),
|
|
2579
|
-
(
|
|
2580
|
-
|
|
2581
|
-
/* @__PURE__ */ d("span", { style:
|
|
2582
|
-
|
|
2763
|
+
(p || f) && /* @__PURE__ */ d("div", { style: v.linkContainer, children: [
|
|
2764
|
+
f && /* @__PURE__ */ d("div", { children: [
|
|
2765
|
+
/* @__PURE__ */ d("span", { style: v.divider, children: [
|
|
2766
|
+
m.magicLinkText,
|
|
2583
2767
|
" "
|
|
2584
2768
|
] }),
|
|
2585
|
-
/* @__PURE__ */
|
|
2769
|
+
/* @__PURE__ */ s("a", { onClick: a, style: v.link, children: m.magicLinkLink })
|
|
2586
2770
|
] }),
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
/* @__PURE__ */ d("span", { style:
|
|
2590
|
-
|
|
2771
|
+
f && p && /* @__PURE__ */ s("div", { style: v.divider, children: "•" }),
|
|
2772
|
+
p && /* @__PURE__ */ d("div", { children: [
|
|
2773
|
+
/* @__PURE__ */ d("span", { style: v.divider, children: [
|
|
2774
|
+
m.loginText,
|
|
2591
2775
|
" "
|
|
2592
2776
|
] }),
|
|
2593
|
-
/* @__PURE__ */
|
|
2777
|
+
/* @__PURE__ */ s("a", { onClick: i, style: v.link, children: m.loginLink })
|
|
2594
2778
|
] })
|
|
2595
2779
|
] })
|
|
2596
2780
|
] });
|
|
2597
2781
|
}
|
|
2598
|
-
const
|
|
2782
|
+
const Vt = {
|
|
2599
2783
|
title: "Sign In with Magic Link",
|
|
2600
2784
|
emailLabel: "Email",
|
|
2601
2785
|
emailPlaceholder: "Enter your email",
|
|
@@ -2613,7 +2797,7 @@ const Rt = {
|
|
|
2613
2797
|
loadingText: "Sending magic link...",
|
|
2614
2798
|
verifyingText: "Verifying magic link...",
|
|
2615
2799
|
description: "Enter your email to receive a magic link. If you don't have an account, we'll create one for you."
|
|
2616
|
-
},
|
|
2800
|
+
}, jt = {
|
|
2617
2801
|
container: {
|
|
2618
2802
|
maxWidth: "400px",
|
|
2619
2803
|
width: "100%",
|
|
@@ -2716,105 +2900,105 @@ const Rt = {
|
|
|
2716
2900
|
fontSize: "0.875rem"
|
|
2717
2901
|
}
|
|
2718
2902
|
};
|
|
2719
|
-
function
|
|
2720
|
-
copy:
|
|
2903
|
+
function Bn({
|
|
2904
|
+
copy: r = {},
|
|
2721
2905
|
styles: e = {},
|
|
2722
2906
|
onSuccess: t,
|
|
2723
|
-
onError:
|
|
2724
|
-
onLoginClick:
|
|
2725
|
-
onSignupClick:
|
|
2907
|
+
onError: n,
|
|
2908
|
+
onLoginClick: o,
|
|
2909
|
+
onSignupClick: i,
|
|
2726
2910
|
showTraditionalLinks: a = !0,
|
|
2727
|
-
className:
|
|
2728
|
-
verifyToken:
|
|
2729
|
-
frontendUrl:
|
|
2911
|
+
className: p,
|
|
2912
|
+
verifyToken: f,
|
|
2913
|
+
frontendUrl: w
|
|
2730
2914
|
}) {
|
|
2731
|
-
const [
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
}, [
|
|
2735
|
-
const
|
|
2736
|
-
if (!H || !
|
|
2737
|
-
|
|
2915
|
+
const [u, b] = A(""), [g, T] = A(""), [I, N] = A(""), [M, P] = A(!1), [h, x] = A(!1), [S, L] = A(""), [E, C] = A(""), [R, $] = A({}), [l, D] = A(!1), { sendMagicLink: U, verifyMagicLink: c } = le(), { tenant: H } = ge(), F = { ...Vt, ...r }, y = { ...jt, ...e };
|
|
2916
|
+
X(() => {
|
|
2917
|
+
f && m(f);
|
|
2918
|
+
}, [f]);
|
|
2919
|
+
const m = async (O) => {
|
|
2920
|
+
if (!H || !u) {
|
|
2921
|
+
L("Missing tenant or email");
|
|
2738
2922
|
return;
|
|
2739
2923
|
}
|
|
2740
|
-
|
|
2924
|
+
x(!0), L("");
|
|
2741
2925
|
try {
|
|
2742
|
-
const V = await
|
|
2743
|
-
token:
|
|
2744
|
-
email:
|
|
2926
|
+
const V = await c({
|
|
2927
|
+
token: O,
|
|
2928
|
+
email: u
|
|
2745
2929
|
// tenantId inferred from context automatically
|
|
2746
2930
|
});
|
|
2747
2931
|
t == null || t(V);
|
|
2748
2932
|
} catch (V) {
|
|
2749
|
-
const
|
|
2750
|
-
|
|
2933
|
+
const k = V.message || "Failed to verify magic link";
|
|
2934
|
+
L(k), n == null || n(k);
|
|
2751
2935
|
} finally {
|
|
2752
|
-
|
|
2936
|
+
x(!1);
|
|
2753
2937
|
}
|
|
2754
|
-
},
|
|
2755
|
-
const
|
|
2756
|
-
return
|
|
2757
|
-
},
|
|
2758
|
-
if (
|
|
2938
|
+
}, v = () => {
|
|
2939
|
+
const O = {};
|
|
2940
|
+
return u.trim() || (O.email = !0), l && !g.trim() && (O.name = !0), $(O), Object.keys(O).length === 0;
|
|
2941
|
+
}, G = async (O) => {
|
|
2942
|
+
if (O.preventDefault(), !!v()) {
|
|
2759
2943
|
if (!(H != null && H.id)) {
|
|
2760
|
-
|
|
2944
|
+
L("Tenant not found");
|
|
2761
2945
|
return;
|
|
2762
2946
|
}
|
|
2763
|
-
|
|
2947
|
+
P(!0), L(""), C("");
|
|
2764
2948
|
try {
|
|
2765
|
-
const V =
|
|
2766
|
-
email:
|
|
2949
|
+
const V = w || (typeof window < "u" ? window.location.origin : ""), k = await U({
|
|
2950
|
+
email: u,
|
|
2767
2951
|
tenantId: H.id,
|
|
2768
2952
|
frontendUrl: V,
|
|
2769
|
-
name:
|
|
2770
|
-
lastName:
|
|
2953
|
+
name: l ? g : void 0,
|
|
2954
|
+
lastName: l ? I : void 0
|
|
2771
2955
|
});
|
|
2772
|
-
|
|
2956
|
+
C(F.successMessage), t == null || t(k);
|
|
2773
2957
|
} catch (V) {
|
|
2774
|
-
const
|
|
2775
|
-
|
|
2958
|
+
const k = V.message || F.errorMessage;
|
|
2959
|
+
L(k), n == null || n(k);
|
|
2776
2960
|
} finally {
|
|
2777
|
-
|
|
2961
|
+
P(!1);
|
|
2778
2962
|
}
|
|
2779
2963
|
}
|
|
2780
|
-
},
|
|
2781
|
-
...
|
|
2782
|
-
...
|
|
2783
|
-
}),
|
|
2784
|
-
...
|
|
2785
|
-
...
|
|
2786
|
-
...!
|
|
2964
|
+
}, J = (O) => ({
|
|
2965
|
+
...y.input,
|
|
2966
|
+
...R[O] ? y.inputError : {}
|
|
2967
|
+
}), q = () => ({
|
|
2968
|
+
...y.button,
|
|
2969
|
+
...M || h ? y.buttonLoading : {},
|
|
2970
|
+
...!u || M || h ? y.buttonDisabled : {}
|
|
2787
2971
|
});
|
|
2788
|
-
return
|
|
2789
|
-
/* @__PURE__ */
|
|
2790
|
-
/* @__PURE__ */
|
|
2791
|
-
] }) : /* @__PURE__ */ d("div", { className:
|
|
2792
|
-
/* @__PURE__ */
|
|
2793
|
-
/* @__PURE__ */
|
|
2794
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
2795
|
-
/* @__PURE__ */ d("div", { style:
|
|
2796
|
-
/* @__PURE__ */
|
|
2797
|
-
/* @__PURE__ */
|
|
2972
|
+
return h ? /* @__PURE__ */ d("div", { className: p, style: y.container, children: [
|
|
2973
|
+
/* @__PURE__ */ s("h2", { style: y.title, children: F.verifyingText }),
|
|
2974
|
+
/* @__PURE__ */ s("div", { style: { textAlign: "center", padding: "2rem" }, children: /* @__PURE__ */ s("div", { style: { fontSize: "1rem", color: "#6b7280" }, children: "Please wait while we verify your magic link..." }) })
|
|
2975
|
+
] }) : /* @__PURE__ */ d("div", { className: p, style: y.container, children: [
|
|
2976
|
+
/* @__PURE__ */ s("h2", { style: y.title, children: F.title }),
|
|
2977
|
+
/* @__PURE__ */ s("p", { style: y.description, children: F.description }),
|
|
2978
|
+
/* @__PURE__ */ d("form", { onSubmit: G, style: y.form, children: [
|
|
2979
|
+
/* @__PURE__ */ d("div", { style: y.fieldGroup, children: [
|
|
2980
|
+
/* @__PURE__ */ s("label", { style: y.label, children: F.emailLabel }),
|
|
2981
|
+
/* @__PURE__ */ s(
|
|
2798
2982
|
"input",
|
|
2799
2983
|
{
|
|
2800
2984
|
id: "email",
|
|
2801
2985
|
name: "email",
|
|
2802
2986
|
type: "email",
|
|
2803
|
-
value:
|
|
2804
|
-
onChange: (
|
|
2805
|
-
|
|
2987
|
+
value: u,
|
|
2988
|
+
onChange: (O) => {
|
|
2989
|
+
b(O.target.value), R.email && $((V) => ({ ...V, email: !1 }));
|
|
2806
2990
|
},
|
|
2807
|
-
placeholder:
|
|
2808
|
-
style:
|
|
2809
|
-
disabled:
|
|
2991
|
+
placeholder: F.emailPlaceholder,
|
|
2992
|
+
style: J("email"),
|
|
2993
|
+
disabled: M || h
|
|
2810
2994
|
}
|
|
2811
2995
|
)
|
|
2812
2996
|
] }),
|
|
2813
|
-
!
|
|
2997
|
+
!l && /* @__PURE__ */ s("div", { style: { textAlign: "center", marginTop: "0.5rem" }, children: /* @__PURE__ */ s(
|
|
2814
2998
|
"button",
|
|
2815
2999
|
{
|
|
2816
3000
|
type: "button",
|
|
2817
|
-
onClick: () =>
|
|
3001
|
+
onClick: () => D(!0),
|
|
2818
3002
|
style: {
|
|
2819
3003
|
background: "none",
|
|
2820
3004
|
border: "none",
|
|
@@ -2826,47 +3010,47 @@ function dr({
|
|
|
2826
3010
|
children: "New user? Add your name"
|
|
2827
3011
|
}
|
|
2828
3012
|
) }),
|
|
2829
|
-
|
|
2830
|
-
/* @__PURE__ */ d("div", { style:
|
|
2831
|
-
/* @__PURE__ */
|
|
2832
|
-
/* @__PURE__ */
|
|
3013
|
+
l && /* @__PURE__ */ d(_, { children: [
|
|
3014
|
+
/* @__PURE__ */ d("div", { style: y.fieldGroup, children: [
|
|
3015
|
+
/* @__PURE__ */ s("label", { style: y.label, children: F.nameLabel }),
|
|
3016
|
+
/* @__PURE__ */ s(
|
|
2833
3017
|
"input",
|
|
2834
3018
|
{
|
|
2835
3019
|
id: "name",
|
|
2836
3020
|
name: "name",
|
|
2837
3021
|
type: "text",
|
|
2838
|
-
value:
|
|
2839
|
-
onChange: (
|
|
2840
|
-
T(
|
|
3022
|
+
value: g,
|
|
3023
|
+
onChange: (O) => {
|
|
3024
|
+
T(O.target.value), R.name && $((V) => ({ ...V, name: !1 }));
|
|
2841
3025
|
},
|
|
2842
|
-
placeholder:
|
|
2843
|
-
style:
|
|
2844
|
-
disabled:
|
|
3026
|
+
placeholder: F.namePlaceholder,
|
|
3027
|
+
style: J("name"),
|
|
3028
|
+
disabled: M || h
|
|
2845
3029
|
}
|
|
2846
3030
|
)
|
|
2847
3031
|
] }),
|
|
2848
|
-
/* @__PURE__ */ d("div", { style:
|
|
2849
|
-
/* @__PURE__ */
|
|
2850
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ d("div", { style: y.fieldGroup, children: [
|
|
3033
|
+
/* @__PURE__ */ s("label", { style: y.label, children: F.lastNameLabel }),
|
|
3034
|
+
/* @__PURE__ */ s(
|
|
2851
3035
|
"input",
|
|
2852
3036
|
{
|
|
2853
3037
|
id: "lastName",
|
|
2854
3038
|
name: "lastName",
|
|
2855
3039
|
type: "text",
|
|
2856
3040
|
value: I,
|
|
2857
|
-
onChange: (
|
|
2858
|
-
placeholder:
|
|
2859
|
-
style:
|
|
2860
|
-
disabled:
|
|
3041
|
+
onChange: (O) => N(O.target.value),
|
|
3042
|
+
placeholder: F.lastNamePlaceholder,
|
|
3043
|
+
style: y.input,
|
|
3044
|
+
disabled: M || h
|
|
2861
3045
|
}
|
|
2862
3046
|
)
|
|
2863
3047
|
] }),
|
|
2864
|
-
/* @__PURE__ */
|
|
3048
|
+
/* @__PURE__ */ s("div", { style: { textAlign: "center", marginTop: "0.5rem" }, children: /* @__PURE__ */ s(
|
|
2865
3049
|
"button",
|
|
2866
3050
|
{
|
|
2867
3051
|
type: "button",
|
|
2868
3052
|
onClick: () => {
|
|
2869
|
-
|
|
3053
|
+
D(!1), T(""), N("");
|
|
2870
3054
|
},
|
|
2871
3055
|
style: {
|
|
2872
3056
|
background: "none",
|
|
@@ -2880,30 +3064,30 @@ function dr({
|
|
|
2880
3064
|
}
|
|
2881
3065
|
) })
|
|
2882
3066
|
] }),
|
|
2883
|
-
/* @__PURE__ */
|
|
2884
|
-
|
|
2885
|
-
|
|
3067
|
+
/* @__PURE__ */ s("button", { type: "submit", disabled: !u || M || h, style: q(), children: M ? F.loadingText : F.submitButton }),
|
|
3068
|
+
S && /* @__PURE__ */ s("div", { style: y.errorText, children: S }),
|
|
3069
|
+
E && /* @__PURE__ */ s("div", { style: y.successText, children: E })
|
|
2886
3070
|
] }),
|
|
2887
|
-
a && /* @__PURE__ */ d("div", { style:
|
|
3071
|
+
a && /* @__PURE__ */ d("div", { style: y.linkContainer, children: [
|
|
2888
3072
|
/* @__PURE__ */ d("div", { children: [
|
|
2889
|
-
/* @__PURE__ */ d("span", { style:
|
|
2890
|
-
|
|
3073
|
+
/* @__PURE__ */ d("span", { style: y.divider, children: [
|
|
3074
|
+
F.loginText,
|
|
2891
3075
|
" "
|
|
2892
3076
|
] }),
|
|
2893
|
-
/* @__PURE__ */
|
|
3077
|
+
/* @__PURE__ */ s("a", { onClick: o, style: y.link, children: F.loginLink })
|
|
2894
3078
|
] }),
|
|
2895
|
-
/* @__PURE__ */
|
|
3079
|
+
/* @__PURE__ */ s("div", { style: y.divider, children: "•" }),
|
|
2896
3080
|
/* @__PURE__ */ d("div", { children: [
|
|
2897
|
-
/* @__PURE__ */ d("span", { style:
|
|
2898
|
-
|
|
3081
|
+
/* @__PURE__ */ d("span", { style: y.divider, children: [
|
|
3082
|
+
F.signupText,
|
|
2899
3083
|
" "
|
|
2900
3084
|
] }),
|
|
2901
|
-
/* @__PURE__ */
|
|
3085
|
+
/* @__PURE__ */ s("a", { onClick: i, style: y.link, children: F.signupLink })
|
|
2902
3086
|
] })
|
|
2903
3087
|
] })
|
|
2904
3088
|
] });
|
|
2905
3089
|
}
|
|
2906
|
-
const
|
|
3090
|
+
const Gt = {
|
|
2907
3091
|
title: "Verifying Magic Link",
|
|
2908
3092
|
verifyingMessage: "Please wait while we verify your magic link...",
|
|
2909
3093
|
successMessage: "Magic link verified successfully! You are now logged in.",
|
|
@@ -2911,7 +3095,7 @@ const Et = {
|
|
|
2911
3095
|
redirectingMessage: "Redirecting you to the dashboard...",
|
|
2912
3096
|
retryButton: "Try Again",
|
|
2913
3097
|
backToLoginButton: "Back to Login"
|
|
2914
|
-
},
|
|
3098
|
+
}, Ke = {
|
|
2915
3099
|
container: {
|
|
2916
3100
|
maxWidth: "400px",
|
|
2917
3101
|
width: "100%",
|
|
@@ -2998,7 +3182,7 @@ const Et = {
|
|
|
2998
3182
|
cursor: "pointer",
|
|
2999
3183
|
transition: "all 0.15s ease-in-out"
|
|
3000
3184
|
}
|
|
3001
|
-
},
|
|
3185
|
+
}, Zt = () => /* @__PURE__ */ s("div", { style: Ke.spinner }), Kt = () => /* @__PURE__ */ d(
|
|
3002
3186
|
"svg",
|
|
3003
3187
|
{
|
|
3004
3188
|
width: "48",
|
|
@@ -3011,11 +3195,11 @@ const Et = {
|
|
|
3011
3195
|
strokeLinejoin: "round",
|
|
3012
3196
|
style: { margin: "0 auto 1rem auto", display: "block" },
|
|
3013
3197
|
children: [
|
|
3014
|
-
/* @__PURE__ */
|
|
3015
|
-
/* @__PURE__ */
|
|
3198
|
+
/* @__PURE__ */ s("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
3199
|
+
/* @__PURE__ */ s("polyline", { points: "22,4 12,14.01 9,11.01" })
|
|
3016
3200
|
]
|
|
3017
3201
|
}
|
|
3018
|
-
),
|
|
3202
|
+
), Jt = () => /* @__PURE__ */ d(
|
|
3019
3203
|
"svg",
|
|
3020
3204
|
{
|
|
3021
3205
|
width: "48",
|
|
@@ -3028,114 +3212,114 @@ const Et = {
|
|
|
3028
3212
|
strokeLinejoin: "round",
|
|
3029
3213
|
style: { margin: "0 auto 1rem auto", display: "block" },
|
|
3030
3214
|
children: [
|
|
3031
|
-
/* @__PURE__ */
|
|
3032
|
-
/* @__PURE__ */
|
|
3033
|
-
/* @__PURE__ */
|
|
3215
|
+
/* @__PURE__ */ s("circle", { cx: "12", cy: "12", r: "10" }),
|
|
3216
|
+
/* @__PURE__ */ s("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
|
|
3217
|
+
/* @__PURE__ */ s("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
3034
3218
|
]
|
|
3035
3219
|
}
|
|
3036
|
-
),
|
|
3037
|
-
loading: /* @__PURE__ */
|
|
3038
|
-
success: /* @__PURE__ */
|
|
3039
|
-
error: /* @__PURE__ */
|
|
3220
|
+
), Yt = {
|
|
3221
|
+
loading: /* @__PURE__ */ s(Zt, {}),
|
|
3222
|
+
success: /* @__PURE__ */ s(Kt, {}),
|
|
3223
|
+
error: /* @__PURE__ */ s(Jt, {})
|
|
3040
3224
|
};
|
|
3041
|
-
function
|
|
3042
|
-
copy:
|
|
3225
|
+
function qn({
|
|
3226
|
+
copy: r = {},
|
|
3043
3227
|
styles: e = {},
|
|
3044
3228
|
icons: t = {},
|
|
3045
|
-
onSuccess:
|
|
3046
|
-
onError:
|
|
3047
|
-
onRetry:
|
|
3229
|
+
onSuccess: n,
|
|
3230
|
+
onError: o,
|
|
3231
|
+
onRetry: i,
|
|
3048
3232
|
onBackToLogin: a,
|
|
3049
|
-
className:
|
|
3050
|
-
token:
|
|
3051
|
-
email:
|
|
3052
|
-
appId:
|
|
3053
|
-
tenantSlug:
|
|
3054
|
-
autoRedirectDelay:
|
|
3233
|
+
className: p,
|
|
3234
|
+
token: f,
|
|
3235
|
+
email: w,
|
|
3236
|
+
appId: u,
|
|
3237
|
+
tenantSlug: b,
|
|
3238
|
+
autoRedirectDelay: g = 3e3
|
|
3055
3239
|
}) {
|
|
3056
|
-
const [T, I] =
|
|
3240
|
+
const [T, I] = A("verifying"), [N, M] = A(""), { verifyMagicLink: P } = le(), h = { ...Gt, ...r }, x = { ...Ke, ...e }, S = { ...Yt, ...t }, L = () => {
|
|
3057
3241
|
if (typeof window > "u") return {};
|
|
3058
|
-
const
|
|
3242
|
+
const l = new URLSearchParams(window.location.search);
|
|
3059
3243
|
return {
|
|
3060
|
-
token:
|
|
3061
|
-
email:
|
|
3062
|
-
appId:
|
|
3063
|
-
tenantSlug:
|
|
3244
|
+
token: f || l.get("token") || "",
|
|
3245
|
+
email: w || l.get("email") || "",
|
|
3246
|
+
appId: u || l.get("appId") || "",
|
|
3247
|
+
tenantSlug: b || l.get("tenantSlug") || void 0
|
|
3064
3248
|
};
|
|
3065
|
-
},
|
|
3066
|
-
I("verifying"),
|
|
3249
|
+
}, E = async () => {
|
|
3250
|
+
I("verifying"), M("");
|
|
3067
3251
|
try {
|
|
3068
|
-
const
|
|
3069
|
-
if (!
|
|
3252
|
+
const l = L();
|
|
3253
|
+
if (!l.token || !l.email)
|
|
3070
3254
|
throw new Error("Missing required parameters: token or email");
|
|
3071
|
-
const
|
|
3072
|
-
token:
|
|
3073
|
-
email:
|
|
3074
|
-
tenantSlug:
|
|
3255
|
+
const D = await P({
|
|
3256
|
+
token: l.token,
|
|
3257
|
+
email: l.email,
|
|
3258
|
+
tenantSlug: l.tenantSlug
|
|
3075
3259
|
});
|
|
3076
|
-
I("success"),
|
|
3260
|
+
I("success"), n == null || n(D), g > 0 && setTimeout(() => {
|
|
3077
3261
|
I("redirecting");
|
|
3078
|
-
},
|
|
3079
|
-
} catch (
|
|
3080
|
-
const
|
|
3081
|
-
|
|
3262
|
+
}, g);
|
|
3263
|
+
} catch (l) {
|
|
3264
|
+
const D = l.message || h.errorMessage;
|
|
3265
|
+
M(D), I("error"), o == null || o(D);
|
|
3082
3266
|
}
|
|
3083
|
-
},
|
|
3084
|
-
|
|
3085
|
-
},
|
|
3267
|
+
}, C = () => {
|
|
3268
|
+
i == null || i(), E();
|
|
3269
|
+
}, R = () => {
|
|
3086
3270
|
a == null || a();
|
|
3087
3271
|
};
|
|
3088
|
-
|
|
3089
|
-
|
|
3272
|
+
X(() => {
|
|
3273
|
+
E();
|
|
3090
3274
|
}, []);
|
|
3091
|
-
const
|
|
3275
|
+
const $ = () => {
|
|
3092
3276
|
switch (T) {
|
|
3093
3277
|
case "verifying":
|
|
3094
|
-
return /* @__PURE__ */ d("div", { style:
|
|
3095
|
-
|
|
3096
|
-
|
|
3278
|
+
return /* @__PURE__ */ d("div", { style: x.message, children: [
|
|
3279
|
+
S.loading,
|
|
3280
|
+
h.verifyingMessage
|
|
3097
3281
|
] });
|
|
3098
3282
|
case "success":
|
|
3099
|
-
return /* @__PURE__ */ d(
|
|
3100
|
-
|
|
3101
|
-
/* @__PURE__ */
|
|
3283
|
+
return /* @__PURE__ */ d(_, { children: [
|
|
3284
|
+
S.success,
|
|
3285
|
+
/* @__PURE__ */ s("div", { style: x.successMessage, children: h.successMessage })
|
|
3102
3286
|
] });
|
|
3103
3287
|
case "redirecting":
|
|
3104
|
-
return /* @__PURE__ */ d(
|
|
3105
|
-
|
|
3106
|
-
/* @__PURE__ */
|
|
3288
|
+
return /* @__PURE__ */ d(_, { children: [
|
|
3289
|
+
S.loading,
|
|
3290
|
+
/* @__PURE__ */ s("div", { style: x.message, children: h.redirectingMessage })
|
|
3107
3291
|
] });
|
|
3108
3292
|
case "error":
|
|
3109
|
-
return /* @__PURE__ */ d(
|
|
3110
|
-
|
|
3111
|
-
/* @__PURE__ */
|
|
3112
|
-
/* @__PURE__ */ d("div", { style:
|
|
3113
|
-
/* @__PURE__ */
|
|
3293
|
+
return /* @__PURE__ */ d(_, { children: [
|
|
3294
|
+
S.error,
|
|
3295
|
+
/* @__PURE__ */ s("div", { style: x.errorMessage, children: N || h.errorMessage }),
|
|
3296
|
+
/* @__PURE__ */ d("div", { style: x.buttonContainer, children: [
|
|
3297
|
+
/* @__PURE__ */ s(
|
|
3114
3298
|
"button",
|
|
3115
3299
|
{
|
|
3116
|
-
onClick:
|
|
3117
|
-
style:
|
|
3118
|
-
onMouseOver: (
|
|
3119
|
-
|
|
3300
|
+
onClick: C,
|
|
3301
|
+
style: x.retryButton,
|
|
3302
|
+
onMouseOver: (l) => {
|
|
3303
|
+
l.currentTarget.style.backgroundColor = "#2563eb";
|
|
3120
3304
|
},
|
|
3121
|
-
onMouseOut: (
|
|
3122
|
-
|
|
3305
|
+
onMouseOut: (l) => {
|
|
3306
|
+
l.currentTarget.style.backgroundColor = "#3b82f6";
|
|
3123
3307
|
},
|
|
3124
|
-
children:
|
|
3308
|
+
children: h.retryButton
|
|
3125
3309
|
}
|
|
3126
3310
|
),
|
|
3127
|
-
/* @__PURE__ */
|
|
3311
|
+
/* @__PURE__ */ s(
|
|
3128
3312
|
"button",
|
|
3129
3313
|
{
|
|
3130
|
-
onClick:
|
|
3131
|
-
style:
|
|
3132
|
-
onMouseOver: (
|
|
3133
|
-
|
|
3314
|
+
onClick: R,
|
|
3315
|
+
style: x.backButton,
|
|
3316
|
+
onMouseOver: (l) => {
|
|
3317
|
+
l.currentTarget.style.backgroundColor = "#e5e7eb";
|
|
3134
3318
|
},
|
|
3135
|
-
onMouseOut: (
|
|
3136
|
-
|
|
3319
|
+
onMouseOut: (l) => {
|
|
3320
|
+
l.currentTarget.style.backgroundColor = "#f3f4f6";
|
|
3137
3321
|
},
|
|
3138
|
-
children:
|
|
3322
|
+
children: h.backToLoginButton
|
|
3139
3323
|
}
|
|
3140
3324
|
)
|
|
3141
3325
|
] })
|
|
@@ -3144,18 +3328,18 @@ function ur({
|
|
|
3144
3328
|
return null;
|
|
3145
3329
|
}
|
|
3146
3330
|
};
|
|
3147
|
-
return /* @__PURE__ */ d("div", { style:
|
|
3148
|
-
/* @__PURE__ */
|
|
3331
|
+
return /* @__PURE__ */ d("div", { style: x.container, className: p, children: [
|
|
3332
|
+
/* @__PURE__ */ s("style", { children: `
|
|
3149
3333
|
@keyframes spin {
|
|
3150
3334
|
0% { transform: rotate(0deg); }
|
|
3151
3335
|
100% { transform: rotate(360deg); }
|
|
3152
3336
|
}
|
|
3153
3337
|
` }),
|
|
3154
|
-
/* @__PURE__ */
|
|
3155
|
-
|
|
3338
|
+
/* @__PURE__ */ s("h1", { style: x.title, children: h.title }),
|
|
3339
|
+
$()
|
|
3156
3340
|
] });
|
|
3157
3341
|
}
|
|
3158
|
-
const
|
|
3342
|
+
const Qt = {
|
|
3159
3343
|
title: "Reset Password",
|
|
3160
3344
|
subtitle: "Enter your email address and we'll send you a link to reset your password.",
|
|
3161
3345
|
emailLabel: "Email",
|
|
@@ -3177,7 +3361,7 @@ const Ht = {
|
|
|
3177
3361
|
resetLoadingText: "Resetting...",
|
|
3178
3362
|
resetSuccessMessage: "Password reset successfully!",
|
|
3179
3363
|
passwordMismatchError: "Passwords do not match"
|
|
3180
|
-
},
|
|
3364
|
+
}, Xt = {
|
|
3181
3365
|
container: {
|
|
3182
3366
|
maxWidth: "400px",
|
|
3183
3367
|
margin: "0 auto",
|
|
@@ -3269,186 +3453,186 @@ const Ht = {
|
|
|
3269
3453
|
cursor: "pointer"
|
|
3270
3454
|
}
|
|
3271
3455
|
};
|
|
3272
|
-
function
|
|
3273
|
-
copy:
|
|
3456
|
+
function On({
|
|
3457
|
+
copy: r = {},
|
|
3274
3458
|
styles: e = {},
|
|
3275
3459
|
mode: t = "request",
|
|
3276
|
-
token:
|
|
3277
|
-
onSuccess:
|
|
3278
|
-
onError:
|
|
3460
|
+
token: n = "",
|
|
3461
|
+
onSuccess: o,
|
|
3462
|
+
onError: i,
|
|
3279
3463
|
onBackToLogin: a,
|
|
3280
|
-
onModeChange:
|
|
3281
|
-
className:
|
|
3464
|
+
onModeChange: p,
|
|
3465
|
+
className: f
|
|
3282
3466
|
}) {
|
|
3283
|
-
const [
|
|
3284
|
-
const
|
|
3285
|
-
return
|
|
3286
|
-
},
|
|
3287
|
-
const
|
|
3288
|
-
return
|
|
3289
|
-
},
|
|
3290
|
-
if (
|
|
3291
|
-
if (!(
|
|
3292
|
-
|
|
3467
|
+
const [w, u] = A(""), [b, g] = A(n), [T, I] = A(""), [N, M] = A(""), [P, h] = A(!1), [x, S] = A(""), [L, E] = A(""), [C, R] = A({}), { requestPasswordReset: $, confirmPasswordReset: l } = le(), { tenant: D } = ge(), U = { ...Qt, ...r }, c = { ...Xt, ...e }, H = () => {
|
|
3468
|
+
const q = {};
|
|
3469
|
+
return w.trim() || (q.email = !0), R(q), Object.keys(q).length === 0;
|
|
3470
|
+
}, F = () => {
|
|
3471
|
+
const q = {};
|
|
3472
|
+
return b.trim() || (q.token = !0), T.trim() || (q.newPassword = !0), N.trim() || (q.confirmPassword = !0), R(q), Object.keys(q).length === 0;
|
|
3473
|
+
}, y = async (q) => {
|
|
3474
|
+
if (q.preventDefault(), !!H()) {
|
|
3475
|
+
if (!(D != null && D.id)) {
|
|
3476
|
+
S("Tenant not found");
|
|
3293
3477
|
return;
|
|
3294
3478
|
}
|
|
3295
|
-
|
|
3479
|
+
h(!0), S(""), E("");
|
|
3296
3480
|
try {
|
|
3297
|
-
await
|
|
3298
|
-
} catch (
|
|
3299
|
-
const V =
|
|
3300
|
-
|
|
3481
|
+
await $({ email: w, tenantId: D.id }), E(U.successMessage), o == null || o();
|
|
3482
|
+
} catch (O) {
|
|
3483
|
+
const V = O.message || U.errorMessage;
|
|
3484
|
+
S(V), i == null || i(V);
|
|
3301
3485
|
} finally {
|
|
3302
|
-
|
|
3486
|
+
h(!1);
|
|
3303
3487
|
}
|
|
3304
3488
|
}
|
|
3305
|
-
},
|
|
3306
|
-
if (
|
|
3307
|
-
if (T !==
|
|
3308
|
-
|
|
3489
|
+
}, m = async (q) => {
|
|
3490
|
+
if (q.preventDefault(), !!F()) {
|
|
3491
|
+
if (T !== N) {
|
|
3492
|
+
S(U.passwordMismatchError), R({ confirmPassword: !0 });
|
|
3309
3493
|
return;
|
|
3310
3494
|
}
|
|
3311
|
-
|
|
3495
|
+
h(!0), S(""), E("");
|
|
3312
3496
|
try {
|
|
3313
|
-
await
|
|
3314
|
-
} catch (
|
|
3315
|
-
const V =
|
|
3316
|
-
|
|
3497
|
+
await l({ token: b, newPassword: T }), E(U.resetSuccessMessage), o == null || o();
|
|
3498
|
+
} catch (O) {
|
|
3499
|
+
const V = O.message || U.errorMessage;
|
|
3500
|
+
S(V), i == null || i(V);
|
|
3317
3501
|
} finally {
|
|
3318
|
-
|
|
3502
|
+
h(!1);
|
|
3319
3503
|
}
|
|
3320
3504
|
}
|
|
3321
|
-
},
|
|
3322
|
-
...
|
|
3323
|
-
...
|
|
3324
|
-
}),
|
|
3325
|
-
...
|
|
3326
|
-
...
|
|
3505
|
+
}, v = (q) => ({
|
|
3506
|
+
...c.input,
|
|
3507
|
+
...C[q] ? c.inputError : {}
|
|
3508
|
+
}), G = () => ({
|
|
3509
|
+
...c.button,
|
|
3510
|
+
...P ? c.buttonLoading : {}
|
|
3327
3511
|
});
|
|
3328
3512
|
if (t === "reset") {
|
|
3329
|
-
const
|
|
3330
|
-
return /* @__PURE__ */ d("div", { className:
|
|
3331
|
-
/* @__PURE__ */
|
|
3332
|
-
/* @__PURE__ */
|
|
3333
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
3334
|
-
/* @__PURE__ */ d("div", { style:
|
|
3335
|
-
/* @__PURE__ */
|
|
3336
|
-
/* @__PURE__ */
|
|
3513
|
+
const q = b && T && N;
|
|
3514
|
+
return /* @__PURE__ */ d("div", { className: f, style: c.container, children: [
|
|
3515
|
+
/* @__PURE__ */ s("h2", { style: c.title, children: U.resetTitle }),
|
|
3516
|
+
/* @__PURE__ */ s("p", { style: c.subtitle, children: U.resetSubtitle }),
|
|
3517
|
+
/* @__PURE__ */ d("form", { onSubmit: m, style: c.form, children: [
|
|
3518
|
+
/* @__PURE__ */ d("div", { style: c.fieldGroup, children: [
|
|
3519
|
+
/* @__PURE__ */ s("label", { style: c.label, children: U.tokenLabel }),
|
|
3520
|
+
/* @__PURE__ */ s(
|
|
3337
3521
|
"input",
|
|
3338
3522
|
{
|
|
3339
3523
|
type: "text",
|
|
3340
|
-
value:
|
|
3341
|
-
onChange: (
|
|
3342
|
-
|
|
3524
|
+
value: b,
|
|
3525
|
+
onChange: (O) => {
|
|
3526
|
+
g(O.target.value), C.token && R((V) => ({ ...V, token: !1 }));
|
|
3343
3527
|
},
|
|
3344
|
-
placeholder:
|
|
3345
|
-
style:
|
|
3346
|
-
disabled:
|
|
3528
|
+
placeholder: U.tokenPlaceholder,
|
|
3529
|
+
style: v("token"),
|
|
3530
|
+
disabled: P
|
|
3347
3531
|
}
|
|
3348
3532
|
)
|
|
3349
3533
|
] }),
|
|
3350
|
-
/* @__PURE__ */ d("div", { style:
|
|
3351
|
-
/* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ d("div", { style: c.fieldGroup, children: [
|
|
3535
|
+
/* @__PURE__ */ s("label", { style: c.label, children: U.newPasswordLabel }),
|
|
3536
|
+
/* @__PURE__ */ s(
|
|
3353
3537
|
"input",
|
|
3354
3538
|
{
|
|
3355
3539
|
type: "password",
|
|
3356
3540
|
value: T,
|
|
3357
|
-
onChange: (
|
|
3358
|
-
I(
|
|
3541
|
+
onChange: (O) => {
|
|
3542
|
+
I(O.target.value), C.newPassword && R((V) => ({ ...V, newPassword: !1 }));
|
|
3359
3543
|
},
|
|
3360
|
-
placeholder:
|
|
3361
|
-
style:
|
|
3362
|
-
disabled:
|
|
3544
|
+
placeholder: U.newPasswordPlaceholder,
|
|
3545
|
+
style: v("newPassword"),
|
|
3546
|
+
disabled: P
|
|
3363
3547
|
}
|
|
3364
3548
|
)
|
|
3365
3549
|
] }),
|
|
3366
|
-
/* @__PURE__ */ d("div", { style:
|
|
3367
|
-
/* @__PURE__ */
|
|
3368
|
-
/* @__PURE__ */
|
|
3550
|
+
/* @__PURE__ */ d("div", { style: c.fieldGroup, children: [
|
|
3551
|
+
/* @__PURE__ */ s("label", { style: c.label, children: U.confirmPasswordLabel }),
|
|
3552
|
+
/* @__PURE__ */ s(
|
|
3369
3553
|
"input",
|
|
3370
3554
|
{
|
|
3371
3555
|
type: "password",
|
|
3372
|
-
value:
|
|
3373
|
-
onChange: (
|
|
3374
|
-
|
|
3556
|
+
value: N,
|
|
3557
|
+
onChange: (O) => {
|
|
3558
|
+
M(O.target.value), C.confirmPassword && R((V) => ({ ...V, confirmPassword: !1 })), x === U.passwordMismatchError && S("");
|
|
3375
3559
|
},
|
|
3376
|
-
placeholder:
|
|
3377
|
-
style:
|
|
3378
|
-
disabled:
|
|
3560
|
+
placeholder: U.confirmPasswordPlaceholder,
|
|
3561
|
+
style: v("confirmPassword"),
|
|
3562
|
+
disabled: P
|
|
3379
3563
|
}
|
|
3380
3564
|
)
|
|
3381
3565
|
] }),
|
|
3382
|
-
/* @__PURE__ */
|
|
3566
|
+
/* @__PURE__ */ s(
|
|
3383
3567
|
"button",
|
|
3384
3568
|
{
|
|
3385
3569
|
type: "submit",
|
|
3386
|
-
disabled: !
|
|
3570
|
+
disabled: !q || P,
|
|
3387
3571
|
style: {
|
|
3388
|
-
...
|
|
3389
|
-
...!
|
|
3572
|
+
...G(),
|
|
3573
|
+
...!q || P ? c.buttonDisabled : {}
|
|
3390
3574
|
},
|
|
3391
|
-
children:
|
|
3575
|
+
children: P ? U.resetLoadingText : U.resetSubmitButton
|
|
3392
3576
|
}
|
|
3393
3577
|
),
|
|
3394
|
-
|
|
3395
|
-
|
|
3578
|
+
x && /* @__PURE__ */ s("div", { style: c.errorText, children: x }),
|
|
3579
|
+
L && /* @__PURE__ */ s("div", { style: c.successText, children: L })
|
|
3396
3580
|
] }),
|
|
3397
|
-
/* @__PURE__ */ d("div", { style:
|
|
3398
|
-
/* @__PURE__ */
|
|
3399
|
-
|
|
3400
|
-
/* @__PURE__ */
|
|
3401
|
-
/* @__PURE__ */
|
|
3581
|
+
/* @__PURE__ */ d("div", { style: c.linkContainer, children: [
|
|
3582
|
+
/* @__PURE__ */ s("a", { onClick: a, style: c.link, children: U.backToLoginLink }),
|
|
3583
|
+
p && /* @__PURE__ */ d(_, { children: [
|
|
3584
|
+
/* @__PURE__ */ s("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3585
|
+
/* @__PURE__ */ s("a", { onClick: () => p("request"), style: c.link, children: "Request New Link" })
|
|
3402
3586
|
] })
|
|
3403
3587
|
] })
|
|
3404
3588
|
] });
|
|
3405
3589
|
}
|
|
3406
|
-
const
|
|
3407
|
-
return /* @__PURE__ */ d("div", { className:
|
|
3408
|
-
/* @__PURE__ */
|
|
3409
|
-
/* @__PURE__ */
|
|
3410
|
-
/* @__PURE__ */ d("form", { onSubmit:
|
|
3411
|
-
/* @__PURE__ */ d("div", { style:
|
|
3412
|
-
/* @__PURE__ */
|
|
3413
|
-
/* @__PURE__ */
|
|
3590
|
+
const J = w;
|
|
3591
|
+
return /* @__PURE__ */ d("div", { className: f, style: c.container, children: [
|
|
3592
|
+
/* @__PURE__ */ s("h2", { style: c.title, children: U.title }),
|
|
3593
|
+
/* @__PURE__ */ s("p", { style: c.subtitle, children: U.subtitle }),
|
|
3594
|
+
/* @__PURE__ */ d("form", { onSubmit: y, style: c.form, children: [
|
|
3595
|
+
/* @__PURE__ */ d("div", { style: c.fieldGroup, children: [
|
|
3596
|
+
/* @__PURE__ */ s("label", { style: c.label, children: U.emailLabel }),
|
|
3597
|
+
/* @__PURE__ */ s(
|
|
3414
3598
|
"input",
|
|
3415
3599
|
{
|
|
3416
3600
|
type: "email",
|
|
3417
|
-
value:
|
|
3418
|
-
onChange: (
|
|
3419
|
-
|
|
3601
|
+
value: w,
|
|
3602
|
+
onChange: (q) => {
|
|
3603
|
+
u(q.target.value), C.email && R((O) => ({ ...O, email: !1 }));
|
|
3420
3604
|
},
|
|
3421
|
-
placeholder:
|
|
3422
|
-
style:
|
|
3423
|
-
disabled:
|
|
3605
|
+
placeholder: U.emailPlaceholder,
|
|
3606
|
+
style: v("email"),
|
|
3607
|
+
disabled: P
|
|
3424
3608
|
}
|
|
3425
3609
|
)
|
|
3426
3610
|
] }),
|
|
3427
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ s(
|
|
3428
3612
|
"button",
|
|
3429
3613
|
{
|
|
3430
3614
|
type: "submit",
|
|
3431
|
-
disabled: !
|
|
3615
|
+
disabled: !J || P,
|
|
3432
3616
|
style: {
|
|
3433
|
-
...
|
|
3434
|
-
...!
|
|
3617
|
+
...G(),
|
|
3618
|
+
...!J || P ? c.buttonDisabled : {}
|
|
3435
3619
|
},
|
|
3436
|
-
children:
|
|
3620
|
+
children: P ? U.loadingText : U.submitButton
|
|
3437
3621
|
}
|
|
3438
3622
|
),
|
|
3439
|
-
|
|
3440
|
-
|
|
3623
|
+
x && /* @__PURE__ */ s("div", { style: c.errorText, children: x }),
|
|
3624
|
+
L && /* @__PURE__ */ s("div", { style: c.successText, children: L })
|
|
3441
3625
|
] }),
|
|
3442
|
-
/* @__PURE__ */ d("div", { style:
|
|
3443
|
-
/* @__PURE__ */
|
|
3444
|
-
|
|
3445
|
-
/* @__PURE__ */
|
|
3446
|
-
/* @__PURE__ */
|
|
3626
|
+
/* @__PURE__ */ d("div", { style: c.linkContainer, children: [
|
|
3627
|
+
/* @__PURE__ */ s("a", { onClick: a, style: c.link, children: U.backToLoginLink }),
|
|
3628
|
+
p && /* @__PURE__ */ d(_, { children: [
|
|
3629
|
+
/* @__PURE__ */ s("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
|
|
3630
|
+
/* @__PURE__ */ s("a", { onClick: () => p("reset"), style: c.link, children: "I have a token" })
|
|
3447
3631
|
] })
|
|
3448
3632
|
] })
|
|
3449
3633
|
] });
|
|
3450
3634
|
}
|
|
3451
|
-
const
|
|
3635
|
+
const en = () => /* @__PURE__ */ s(
|
|
3452
3636
|
"div",
|
|
3453
3637
|
{
|
|
3454
3638
|
style: {
|
|
@@ -3458,9 +3642,9 @@ const Ut = () => /* @__PURE__ */ n(
|
|
|
3458
3642
|
height: "100vh",
|
|
3459
3643
|
fontFamily: "system-ui, sans-serif"
|
|
3460
3644
|
},
|
|
3461
|
-
children: /* @__PURE__ */
|
|
3645
|
+
children: /* @__PURE__ */ s("div", { children: "Loading..." })
|
|
3462
3646
|
}
|
|
3463
|
-
),
|
|
3647
|
+
), tn = ({ error: r, retry: e }) => /* @__PURE__ */ d(
|
|
3464
3648
|
"div",
|
|
3465
3649
|
{
|
|
3466
3650
|
style: {
|
|
@@ -3474,9 +3658,9 @@ const Ut = () => /* @__PURE__ */ n(
|
|
|
3474
3658
|
padding: "20px"
|
|
3475
3659
|
},
|
|
3476
3660
|
children: [
|
|
3477
|
-
/* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */
|
|
3479
|
-
/* @__PURE__ */
|
|
3661
|
+
/* @__PURE__ */ s("h2", { style: { color: "#dc3545", marginBottom: "16px" }, children: "Error" }),
|
|
3662
|
+
/* @__PURE__ */ s("p", { style: { color: "#6c757d", marginBottom: "24px" }, children: r.message || "Unable to load application" }),
|
|
3663
|
+
/* @__PURE__ */ s(
|
|
3480
3664
|
"button",
|
|
3481
3665
|
{
|
|
3482
3666
|
onClick: e,
|
|
@@ -3494,98 +3678,98 @@ const Ut = () => /* @__PURE__ */ n(
|
|
|
3494
3678
|
]
|
|
3495
3679
|
}
|
|
3496
3680
|
);
|
|
3497
|
-
function
|
|
3498
|
-
children:
|
|
3681
|
+
function zn({
|
|
3682
|
+
children: r,
|
|
3499
3683
|
loadingFallback: e,
|
|
3500
3684
|
errorFallback: t,
|
|
3501
|
-
requireTenant:
|
|
3685
|
+
requireTenant: n = !0
|
|
3502
3686
|
}) {
|
|
3503
|
-
const { isAppLoading:
|
|
3504
|
-
}),
|
|
3505
|
-
|
|
3687
|
+
const { isAppLoading: o, appError: i, retryApp: a } = ye(), p = Se(), f = Le(), w = je(), u = Ge(), b = (p == null ? void 0 : p.isTenantLoading) ?? !1, g = (p == null ? void 0 : p.tenantError) ?? null, T = (p == null ? void 0 : p.tenantSlug) ?? null, I = (p == null ? void 0 : p.retryTenant) ?? (() => {
|
|
3688
|
+
}), N = (f == null ? void 0 : f.isAuthReady) ?? !0, M = (w == null ? void 0 : w.isReady) ?? !0, P = (u == null ? void 0 : u.isReady) ?? !0, h = n && p && T, E = o || h && b || f && !N || w && !M || u && !P, C = i || (h ? g : null), R = () => {
|
|
3689
|
+
i && a(), g && p && I();
|
|
3506
3690
|
};
|
|
3507
|
-
if (
|
|
3508
|
-
return /* @__PURE__ */
|
|
3509
|
-
if (
|
|
3510
|
-
const
|
|
3511
|
-
return /* @__PURE__ */
|
|
3691
|
+
if (E)
|
|
3692
|
+
return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(en, {}) });
|
|
3693
|
+
if (C) {
|
|
3694
|
+
const $ = typeof t == "function" ? t(C, R) : t || /* @__PURE__ */ s(tn, { error: C, retry: R });
|
|
3695
|
+
return /* @__PURE__ */ s(_, { children: $ });
|
|
3512
3696
|
}
|
|
3513
|
-
return /* @__PURE__ */
|
|
3697
|
+
return /* @__PURE__ */ s(_, { children: r });
|
|
3514
3698
|
}
|
|
3515
|
-
function
|
|
3516
|
-
const { isAppLoading: e, appError: t, retryApp:
|
|
3517
|
-
}), I = (a == null ? void 0 : a.isAuthReady) ?? !0,
|
|
3699
|
+
function _n(r = !0) {
|
|
3700
|
+
const { isAppLoading: e, appError: t, retryApp: n, appInfo: o } = ye(), i = Se(), a = Le(), p = je(), f = Ge(), w = (i == null ? void 0 : i.isTenantLoading) ?? !1, u = (i == null ? void 0 : i.tenantError) ?? null, b = (i == null ? void 0 : i.tenant) ?? null, g = (i == null ? void 0 : i.tenantSlug) ?? null, T = (i == null ? void 0 : i.retryTenant) ?? (() => {
|
|
3701
|
+
}), I = (a == null ? void 0 : a.isAuthReady) ?? !0, N = (p == null ? void 0 : p.isReady) ?? !0, M = (f == null ? void 0 : f.isReady) ?? !0, P = r && i && g, L = e || P && w || a && !I || p && !N || f && !M, E = t || (P ? u : null);
|
|
3518
3702
|
return {
|
|
3519
|
-
isLoading:
|
|
3520
|
-
error:
|
|
3521
|
-
isReady: !
|
|
3703
|
+
isLoading: L,
|
|
3704
|
+
error: E,
|
|
3705
|
+
isReady: !L && !E && o !== null && (!P || b !== null),
|
|
3522
3706
|
retry: () => {
|
|
3523
|
-
t &&
|
|
3707
|
+
t && n(), u && i && T();
|
|
3524
3708
|
},
|
|
3525
3709
|
// Individual states
|
|
3526
|
-
app: { isLoading: e, error: t, data:
|
|
3527
|
-
tenant:
|
|
3710
|
+
app: { isLoading: e, error: t, data: o },
|
|
3711
|
+
tenant: i ? { isLoading: w, error: u, data: b } : null,
|
|
3528
3712
|
auth: a ? { isReady: I } : null,
|
|
3529
|
-
featureFlags:
|
|
3530
|
-
subscription:
|
|
3713
|
+
featureFlags: p ? { isReady: N } : null,
|
|
3714
|
+
subscription: f ? { isReady: M } : null
|
|
3531
3715
|
};
|
|
3532
3716
|
}
|
|
3533
|
-
function
|
|
3534
|
-
tenants:
|
|
3717
|
+
function Wn({
|
|
3718
|
+
tenants: r,
|
|
3535
3719
|
currentTenantId: e,
|
|
3536
3720
|
onSelect: t,
|
|
3537
|
-
className:
|
|
3538
|
-
dropdownClassName:
|
|
3539
|
-
itemClassName:
|
|
3721
|
+
className: n = "",
|
|
3722
|
+
dropdownClassName: o = "",
|
|
3723
|
+
itemClassName: i = "",
|
|
3540
3724
|
renderItem: a,
|
|
3541
|
-
placeholder:
|
|
3542
|
-
disabled:
|
|
3543
|
-
showCurrentTenant:
|
|
3725
|
+
placeholder: p = "Select tenant",
|
|
3726
|
+
disabled: f = !1,
|
|
3727
|
+
showCurrentTenant: w = !0
|
|
3544
3728
|
}) {
|
|
3545
|
-
var
|
|
3546
|
-
const
|
|
3547
|
-
|
|
3729
|
+
var x;
|
|
3730
|
+
const u = Le(), [b, g] = A(!1), T = We(null), I = r ?? (u == null ? void 0 : u.userTenants) ?? [], N = e ?? ((x = u == null ? void 0 : u.currentUser) == null ? void 0 : x.tenantId) ?? null, M = async (S) => {
|
|
3731
|
+
g(!1), t ? t(S) : u != null && u.switchToTenant && await u.switchToTenant(S);
|
|
3548
3732
|
};
|
|
3549
|
-
|
|
3550
|
-
const
|
|
3551
|
-
T.current && !T.current.contains(
|
|
3733
|
+
X(() => {
|
|
3734
|
+
const S = (L) => {
|
|
3735
|
+
T.current && !T.current.contains(L.target) && g(!1);
|
|
3552
3736
|
};
|
|
3553
|
-
return document.addEventListener("mousedown",
|
|
3737
|
+
return document.addEventListener("mousedown", S), () => document.removeEventListener("mousedown", S);
|
|
3554
3738
|
}, []);
|
|
3555
|
-
const
|
|
3739
|
+
const P = I.find((S) => S.id === N);
|
|
3556
3740
|
if (I.length === 0)
|
|
3557
3741
|
return null;
|
|
3558
|
-
if (I.length === 1 &&
|
|
3559
|
-
return /* @__PURE__ */
|
|
3560
|
-
const
|
|
3561
|
-
|
|
3562
|
-
|
|
3742
|
+
if (I.length === 1 && w)
|
|
3743
|
+
return /* @__PURE__ */ s("div", { className: n, children: /* @__PURE__ */ s("span", { children: I[0].name }) });
|
|
3744
|
+
const h = (S, L) => /* @__PURE__ */ d("span", { style: { fontWeight: L ? "bold" : "normal" }, children: [
|
|
3745
|
+
S.name,
|
|
3746
|
+
S.role && /* @__PURE__ */ d("span", { style: { opacity: 0.7, marginLeft: 8 }, children: [
|
|
3563
3747
|
"(",
|
|
3564
|
-
|
|
3748
|
+
S.role,
|
|
3565
3749
|
")"
|
|
3566
3750
|
] })
|
|
3567
3751
|
] });
|
|
3568
|
-
return /* @__PURE__ */ d("div", { ref: T, className:
|
|
3752
|
+
return /* @__PURE__ */ d("div", { ref: T, className: n, style: { position: "relative" }, children: [
|
|
3569
3753
|
/* @__PURE__ */ d(
|
|
3570
3754
|
"button",
|
|
3571
3755
|
{
|
|
3572
3756
|
type: "button",
|
|
3573
|
-
onClick: () => !
|
|
3574
|
-
disabled:
|
|
3757
|
+
onClick: () => !f && g(!b),
|
|
3758
|
+
disabled: f,
|
|
3575
3759
|
style: {
|
|
3576
|
-
cursor:
|
|
3577
|
-
opacity:
|
|
3760
|
+
cursor: f ? "not-allowed" : "pointer",
|
|
3761
|
+
opacity: f ? 0.6 : 1
|
|
3578
3762
|
},
|
|
3579
3763
|
children: [
|
|
3580
|
-
|
|
3581
|
-
/* @__PURE__ */
|
|
3764
|
+
P ? P.name : p,
|
|
3765
|
+
/* @__PURE__ */ s("span", { style: { marginLeft: 8 }, children: b ? "▲" : "▼" })
|
|
3582
3766
|
]
|
|
3583
3767
|
}
|
|
3584
3768
|
),
|
|
3585
|
-
|
|
3769
|
+
b && /* @__PURE__ */ s(
|
|
3586
3770
|
"div",
|
|
3587
3771
|
{
|
|
3588
|
-
className:
|
|
3772
|
+
className: o,
|
|
3589
3773
|
style: {
|
|
3590
3774
|
position: "absolute",
|
|
3591
3775
|
top: "100%",
|
|
@@ -3599,34 +3783,34 @@ function fr({
|
|
|
3599
3783
|
maxHeight: 300,
|
|
3600
3784
|
overflowY: "auto"
|
|
3601
3785
|
},
|
|
3602
|
-
children: I.map((
|
|
3603
|
-
const
|
|
3604
|
-
return /* @__PURE__ */
|
|
3786
|
+
children: I.map((S) => {
|
|
3787
|
+
const L = S.id === N;
|
|
3788
|
+
return /* @__PURE__ */ s(
|
|
3605
3789
|
"div",
|
|
3606
3790
|
{
|
|
3607
|
-
className:
|
|
3608
|
-
onClick: () =>
|
|
3791
|
+
className: i,
|
|
3792
|
+
onClick: () => M(S.id),
|
|
3609
3793
|
style: {
|
|
3610
3794
|
padding: "8px 12px",
|
|
3611
3795
|
cursor: "pointer",
|
|
3612
|
-
backgroundColor:
|
|
3796
|
+
backgroundColor: L ? "#f0f0f0" : "transparent"
|
|
3613
3797
|
},
|
|
3614
|
-
onMouseEnter: (
|
|
3615
|
-
|
|
3798
|
+
onMouseEnter: (E) => {
|
|
3799
|
+
L || (E.target.style.backgroundColor = "#f5f5f5");
|
|
3616
3800
|
},
|
|
3617
|
-
onMouseLeave: (
|
|
3618
|
-
|
|
3801
|
+
onMouseLeave: (E) => {
|
|
3802
|
+
L || (E.target.style.backgroundColor = "transparent");
|
|
3619
3803
|
},
|
|
3620
|
-
children: a ? a(
|
|
3804
|
+
children: a ? a(S, L) : h(S, L)
|
|
3621
3805
|
},
|
|
3622
|
-
|
|
3806
|
+
S.id
|
|
3623
3807
|
);
|
|
3624
3808
|
})
|
|
3625
3809
|
}
|
|
3626
3810
|
)
|
|
3627
3811
|
] });
|
|
3628
3812
|
}
|
|
3629
|
-
class
|
|
3813
|
+
class Vn {
|
|
3630
3814
|
constructor(e, t) {
|
|
3631
3815
|
this.httpService = e, this.sessionManager = t;
|
|
3632
3816
|
}
|
|
@@ -3645,14 +3829,14 @@ class mr {
|
|
|
3645
3829
|
async getPermissions(e) {
|
|
3646
3830
|
if (!this.sessionManager)
|
|
3647
3831
|
throw new Error("SessionManager is required for private endpoints");
|
|
3648
|
-
const t = await this.sessionManager.getAuthHeaders(),
|
|
3649
|
-
e != null && e.page &&
|
|
3650
|
-
const
|
|
3832
|
+
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
3833
|
+
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder);
|
|
3834
|
+
const o = `/permissions/${n.toString() ? `?${n.toString()}` : ""}`, i = await this.httpService.get(o, {
|
|
3651
3835
|
headers: t
|
|
3652
3836
|
});
|
|
3653
3837
|
return {
|
|
3654
|
-
permissions:
|
|
3655
|
-
meta:
|
|
3838
|
+
permissions: i.data,
|
|
3839
|
+
meta: i.meta
|
|
3656
3840
|
};
|
|
3657
3841
|
}
|
|
3658
3842
|
async getPermissionById(e) {
|
|
@@ -3666,12 +3850,12 @@ class mr {
|
|
|
3666
3850
|
async updatePermission(e, t) {
|
|
3667
3851
|
if (!this.sessionManager)
|
|
3668
3852
|
throw new Error("SessionManager is required for private endpoints");
|
|
3669
|
-
const
|
|
3853
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
3670
3854
|
return (await this.httpService.put(
|
|
3671
3855
|
`/permissions/${e}`,
|
|
3672
3856
|
t,
|
|
3673
3857
|
{
|
|
3674
|
-
headers:
|
|
3858
|
+
headers: n
|
|
3675
3859
|
}
|
|
3676
3860
|
)).data;
|
|
3677
3861
|
}
|
|
@@ -3685,16 +3869,16 @@ class mr {
|
|
|
3685
3869
|
}
|
|
3686
3870
|
// Public endpoint - no auth required
|
|
3687
3871
|
async getAppPermissions(e, t) {
|
|
3688
|
-
const
|
|
3689
|
-
t != null && t.page &&
|
|
3690
|
-
const
|
|
3872
|
+
const n = new URLSearchParams();
|
|
3873
|
+
t != null && t.page && n.append("page", t.page.toString()), t != null && t.limit && n.append("limit", t.limit.toString()), t != null && t.sortBy && n.append("sortBy", t.sortBy), t != null && t.sortOrder && n.append("sortOrder", t.sortOrder);
|
|
3874
|
+
const o = `/permissions/apps/${e}${n.toString() ? `?${n.toString()}` : ""}`, i = await this.httpService.get(o);
|
|
3691
3875
|
return {
|
|
3692
|
-
permissions:
|
|
3693
|
-
meta:
|
|
3876
|
+
permissions: i.data,
|
|
3877
|
+
meta: i.meta
|
|
3694
3878
|
};
|
|
3695
3879
|
}
|
|
3696
3880
|
}
|
|
3697
|
-
class
|
|
3881
|
+
class jn {
|
|
3698
3882
|
constructor(e, t) {
|
|
3699
3883
|
this.httpService = e, this.sessionManager = t;
|
|
3700
3884
|
}
|
|
@@ -3709,14 +3893,14 @@ class yr {
|
|
|
3709
3893
|
)).data;
|
|
3710
3894
|
}
|
|
3711
3895
|
async getSubscriptionPlans(e) {
|
|
3712
|
-
const t = await this.sessionManager.getAuthHeaders(),
|
|
3713
|
-
e != null && e.page &&
|
|
3714
|
-
const
|
|
3896
|
+
const t = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
|
|
3897
|
+
e != null && e.page && n.append("page", e.page.toString()), e != null && e.limit && n.append("limit", e.limit.toString()), e != null && e.sortBy && n.append("sortBy", e.sortBy), e != null && e.sortOrder && n.append("sortOrder", e.sortOrder), e != null && e.appId && n.append("appId", e.appId);
|
|
3898
|
+
const o = `/subscription-plans/${n.toString() ? `?${n.toString()}` : ""}`, i = await this.httpService.get(o, {
|
|
3715
3899
|
headers: t
|
|
3716
3900
|
});
|
|
3717
3901
|
return {
|
|
3718
|
-
plans:
|
|
3719
|
-
meta:
|
|
3902
|
+
plans: i.data,
|
|
3903
|
+
meta: i.meta
|
|
3720
3904
|
};
|
|
3721
3905
|
}
|
|
3722
3906
|
async getSubscriptionPlanById(e) {
|
|
@@ -3729,12 +3913,12 @@ class yr {
|
|
|
3729
3913
|
)).data;
|
|
3730
3914
|
}
|
|
3731
3915
|
async updateSubscriptionPlan(e, t) {
|
|
3732
|
-
const
|
|
3916
|
+
const n = await this.sessionManager.getAuthHeaders();
|
|
3733
3917
|
return (await this.httpService.put(
|
|
3734
3918
|
`/subscription-plans/${e}`,
|
|
3735
3919
|
t,
|
|
3736
3920
|
{
|
|
3737
|
-
headers:
|
|
3921
|
+
headers: n
|
|
3738
3922
|
}
|
|
3739
3923
|
)).data;
|
|
3740
3924
|
}
|
|
@@ -3745,7 +3929,7 @@ class yr {
|
|
|
3745
3929
|
});
|
|
3746
3930
|
}
|
|
3747
3931
|
}
|
|
3748
|
-
class
|
|
3932
|
+
class Gn {
|
|
3749
3933
|
constructor(e) {
|
|
3750
3934
|
this.httpService = e;
|
|
3751
3935
|
}
|
|
@@ -3754,7 +3938,7 @@ class wr {
|
|
|
3754
3938
|
return await this.httpService.get("/health");
|
|
3755
3939
|
}
|
|
3756
3940
|
}
|
|
3757
|
-
class
|
|
3941
|
+
class Zn {
|
|
3758
3942
|
// Date string to Date object
|
|
3759
3943
|
static toDate(e) {
|
|
3760
3944
|
return new Date(e);
|
|
@@ -3871,54 +4055,141 @@ class br {
|
|
|
3871
4055
|
// Transform query parameters for API calls
|
|
3872
4056
|
static transformQueryParams(e) {
|
|
3873
4057
|
const t = new URLSearchParams();
|
|
3874
|
-
return Object.entries(e).forEach(([
|
|
3875
|
-
|
|
4058
|
+
return Object.entries(e).forEach(([n, o]) => {
|
|
4059
|
+
o != null && o !== "" && t.append(n, String(o));
|
|
3876
4060
|
}), t;
|
|
3877
4061
|
}
|
|
3878
4062
|
}
|
|
4063
|
+
const Je = "returnTo", xe = "zone_return_to", Pe = "zone_return_to";
|
|
4064
|
+
function Kn(r = {}) {
|
|
4065
|
+
const {
|
|
4066
|
+
zoneRoots: e = {},
|
|
4067
|
+
returnToParam: t = Je,
|
|
4068
|
+
returnToStorage: n = "url"
|
|
4069
|
+
} = r, o = dt(), [i, a] = ut(), { isAuthenticated: p, currentUser: f } = le(), { tenant: w } = he(), u = Z(() => ({ ...Ne, ...e }), [e]), b = !!w, g = f == null ? void 0 : f.userType, T = Z(() => {
|
|
4070
|
+
switch (n) {
|
|
4071
|
+
case "url":
|
|
4072
|
+
return i.get(t);
|
|
4073
|
+
case "session":
|
|
4074
|
+
return sessionStorage.getItem(xe);
|
|
4075
|
+
case "local":
|
|
4076
|
+
return localStorage.getItem(Pe);
|
|
4077
|
+
default:
|
|
4078
|
+
return null;
|
|
4079
|
+
}
|
|
4080
|
+
}, [n, i, t]), I = re(() => {
|
|
4081
|
+
switch (n) {
|
|
4082
|
+
case "url": {
|
|
4083
|
+
const h = new URLSearchParams(i);
|
|
4084
|
+
h.delete(t), a(h, { replace: !0 });
|
|
4085
|
+
break;
|
|
4086
|
+
}
|
|
4087
|
+
case "session":
|
|
4088
|
+
sessionStorage.removeItem(xe);
|
|
4089
|
+
break;
|
|
4090
|
+
case "local":
|
|
4091
|
+
localStorage.removeItem(Pe);
|
|
4092
|
+
break;
|
|
4093
|
+
}
|
|
4094
|
+
}, [n, i, t, a]), N = re(
|
|
4095
|
+
(h) => {
|
|
4096
|
+
switch (n) {
|
|
4097
|
+
case "url": {
|
|
4098
|
+
const x = new URLSearchParams(i);
|
|
4099
|
+
x.set(t, h), a(x, { replace: !0 });
|
|
4100
|
+
break;
|
|
4101
|
+
}
|
|
4102
|
+
case "session":
|
|
4103
|
+
sessionStorage.setItem(xe, h);
|
|
4104
|
+
break;
|
|
4105
|
+
case "local":
|
|
4106
|
+
localStorage.setItem(Pe, h);
|
|
4107
|
+
break;
|
|
4108
|
+
}
|
|
4109
|
+
},
|
|
4110
|
+
[n, i, t, a]
|
|
4111
|
+
), M = re(
|
|
4112
|
+
(h) => {
|
|
4113
|
+
const x = u[h] || u.default;
|
|
4114
|
+
o(x);
|
|
4115
|
+
},
|
|
4116
|
+
[o, u]
|
|
4117
|
+
), P = re(() => b ? p ? g === se.TENANT_ADMIN ? u.tenantAdmin : u.tenantUser : u.tenantGuest : p ? g === se.TENANT_ADMIN ? u.publicAdmin : u.publicUser : u.publicGuest, [b, p, g, u]);
|
|
4118
|
+
return {
|
|
4119
|
+
returnToUrl: T,
|
|
4120
|
+
clearReturnTo: I,
|
|
4121
|
+
setReturnTo: N,
|
|
4122
|
+
navigateToZone: M,
|
|
4123
|
+
getSmartRedirect: P
|
|
4124
|
+
};
|
|
4125
|
+
}
|
|
4126
|
+
function Jn(r, e, t = Je, n = "url") {
|
|
4127
|
+
if (!e || n !== "url")
|
|
4128
|
+
return r;
|
|
4129
|
+
const o = new URL(r, window.location.origin);
|
|
4130
|
+
return o.searchParams.set(t, e), o.pathname + o.search;
|
|
4131
|
+
}
|
|
3879
4132
|
export {
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
4133
|
+
Mn as AdminZone,
|
|
4134
|
+
Zn as ApiMappers,
|
|
4135
|
+
$e as AppApiService,
|
|
4136
|
+
zn as AppLoader,
|
|
4137
|
+
un as AppProvider,
|
|
4138
|
+
ht as AuthApiService,
|
|
4139
|
+
mn as AuthProvider,
|
|
4140
|
+
Rn as AuthenticatedZone,
|
|
4141
|
+
Ze as DEFAULT_ZONE_PRESETS,
|
|
4142
|
+
Ne as DEFAULT_ZONE_ROOTS,
|
|
4143
|
+
Un as FeatureFlag,
|
|
4144
|
+
vt as FeatureFlagApiService,
|
|
4145
|
+
yn as FeatureFlagProvider,
|
|
4146
|
+
In as GuestZone,
|
|
4147
|
+
Gn as HealthApiService,
|
|
4148
|
+
ie as HttpService,
|
|
4149
|
+
An as LandingRoute,
|
|
4150
|
+
$n as LoginForm,
|
|
4151
|
+
Bn as MagicLinkForm,
|
|
4152
|
+
qn as MagicLinkVerify,
|
|
4153
|
+
En as OpenZone,
|
|
4154
|
+
On as PasswordRecoveryForm,
|
|
4155
|
+
Vn as PermissionApiService,
|
|
4156
|
+
vn as Protected,
|
|
4157
|
+
Tn as ProtectedRoute,
|
|
4158
|
+
Pn as PublicZone,
|
|
4159
|
+
He as RoleApiService,
|
|
4160
|
+
bn as RoutingProvider,
|
|
4161
|
+
Ae as SessionManager,
|
|
4162
|
+
Hn as SignupForm,
|
|
4163
|
+
kt as SubscriptionApiService,
|
|
4164
|
+
Cn as SubscriptionGuard,
|
|
4165
|
+
jn as SubscriptionPlanApiService,
|
|
4166
|
+
wn as SubscriptionProvider,
|
|
4167
|
+
fe as TenantApiService,
|
|
4168
|
+
Fn as TenantAuthenticatedZone,
|
|
4169
|
+
Dn as TenantGuestZone,
|
|
4170
|
+
Nn as TenantOpenZone,
|
|
4171
|
+
gn as TenantProvider,
|
|
4172
|
+
kn as TenantRoute,
|
|
4173
|
+
Wn as TenantSelector,
|
|
4174
|
+
xn as TenantZone,
|
|
4175
|
+
gt as UserApiService,
|
|
4176
|
+
se as UserType,
|
|
4177
|
+
Ln as UserZone,
|
|
4178
|
+
ae as ZoneRoute,
|
|
4179
|
+
Jn as buildRedirectUrl,
|
|
4180
|
+
hn as useApi,
|
|
4181
|
+
ye as useApp,
|
|
4182
|
+
_n as useAppLoaderState,
|
|
4183
|
+
le as useAuth,
|
|
4184
|
+
Tt as useFeatureFlags,
|
|
4185
|
+
Sn as useRouting,
|
|
4186
|
+
xt as useRoutingOptional,
|
|
4187
|
+
fn as useSettings,
|
|
4188
|
+
At as useSubscription,
|
|
4189
|
+
he as useTenant,
|
|
4190
|
+
ge as useTenantInfo,
|
|
4191
|
+
Se as useTenantOptional,
|
|
4192
|
+
pn as useTenantSettings,
|
|
4193
|
+
Kn as useZoneNavigation
|
|
3923
4194
|
};
|
|
3924
4195
|
//# sourceMappingURL=index.es.js.map
|