@skylabs-digital/react-identity-access 1.3.0 → 1.5.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.
Files changed (40) hide show
  1. package/dist/components/FeatureFlag.d.ts +1 -0
  2. package/dist/components/LandingRoute.d.ts +9 -0
  3. package/dist/components/LandingRoute.d.ts.map +1 -0
  4. package/dist/components/LoginForm.d.ts +1 -0
  5. package/dist/components/PasswordRecoveryForm.d.ts +1 -0
  6. package/dist/components/Protected.d.ts +1 -0
  7. package/dist/components/ProtectedRoute.d.ts +1 -0
  8. package/dist/components/SignupForm.d.ts +1 -0
  9. package/dist/components/SubscriptionGuard.d.ts +1 -0
  10. package/dist/components/TenantRoute.d.ts +9 -0
  11. package/dist/components/TenantRoute.d.ts.map +1 -0
  12. package/dist/index.d.ts +5 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.es.js +721 -630
  15. package/dist/index.es.js.map +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/providers/AppProvider.d.ts +1 -0
  19. package/dist/providers/AppProvider.d.ts.map +1 -1
  20. package/dist/providers/AuthProvider.d.ts +3 -2
  21. package/dist/providers/AuthProvider.d.ts.map +1 -1
  22. package/dist/providers/FeatureFlagProvider.d.ts +1 -0
  23. package/dist/providers/SubscriptionProvider.d.ts +1 -0
  24. package/dist/providers/TenantProvider.d.ts +1 -0
  25. package/dist/providers/TenantProvider.d.ts.map +1 -1
  26. package/dist/services/AppApiService.d.ts +1 -0
  27. package/dist/services/AuthApiService.d.ts +2 -0
  28. package/dist/services/AuthApiService.d.ts.map +1 -1
  29. package/dist/services/FeatureFlagApiService.d.ts +1 -0
  30. package/dist/services/HealthApiService.d.ts +1 -0
  31. package/dist/services/PermissionApiService.d.ts +1 -0
  32. package/dist/services/RoleApiService.d.ts +1 -0
  33. package/dist/services/SubscriptionApiService.d.ts +1 -0
  34. package/dist/services/SubscriptionPlanApiService.d.ts +1 -0
  35. package/dist/services/TenantApiService.d.ts +1 -0
  36. package/dist/services/UserApiService.d.ts +1 -0
  37. package/dist/types/api.d.ts +3 -0
  38. package/dist/types/api.d.ts.map +1 -1
  39. package/package.json +24 -23
  40. package/CHANGELOG.md +0 -32
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
- import { jsx as n, Fragment as B, jsxs as u } from "react/jsx-runtime";
2
- import { createContext as ee, useState as m, useMemo as O, useCallback as X, useEffect as K, useContext as te } from "react";
3
- import { useLocation as me, Navigate as ae } from "react-router";
1
+ import { jsx as s, Fragment as H, jsxs as c } from "react/jsx-runtime";
2
+ import { createContext as te, useState as b, useMemo as z, useCallback as Z, useEffect as Y, useContext as re } from "react";
3
+ import { useLocation as ae, Navigate as ie } from "react-router";
4
4
  class G {
5
5
  // SessionManager instance
6
6
  constructor(e, t = 1e4) {
@@ -12,16 +12,16 @@ class G {
12
12
  getBaseUrl() {
13
13
  return this.baseUrl;
14
14
  }
15
- async request(e, t, r, s) {
16
- return this.executeRequest(e, t, r, s, !1);
15
+ async request(e, t, r, n) {
16
+ return this.executeRequest(e, t, r, n, !1);
17
17
  }
18
- async executeRequest(e, t, r, s, a = !1) {
19
- const v = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, T = (s == null ? void 0 : s.timeout) || this.timeout;
18
+ async executeRequest(e, t, r, n, o = !1) {
19
+ const m = `${this.baseUrl}${t.startsWith("/") ? t : `/${t}`}`, T = (n == null ? void 0 : n.timeout) || this.timeout;
20
20
  let M = {
21
21
  "Content-Type": "application/json",
22
- ...s == null ? void 0 : s.headers
22
+ ...n == null ? void 0 : n.headers
23
23
  };
24
- if (!(s != null && s.skipAuth) && this.sessionManager)
24
+ if (!(n != null && n.skipAuth) && this.sessionManager)
25
25
  try {
26
26
  const h = await this.sessionManager.getAuthHeaders();
27
27
  M = { ...M, ...h };
@@ -30,17 +30,17 @@ class G {
30
30
  }
31
31
  const P = new AbortController(), g = setTimeout(() => P.abort(), T);
32
32
  try {
33
- const h = await fetch(v, {
33
+ const h = await fetch(m, {
34
34
  method: e,
35
35
  headers: M,
36
36
  body: r ? JSON.stringify(r) : void 0,
37
37
  signal: P.signal
38
38
  });
39
- if (clearTimeout(g), h.status === 401 && !(s != null && s.skipRetry) && !a && this.sessionManager)
39
+ if (clearTimeout(g), h.status === 401 && !(n != null && n.skipRetry) && !o && this.sessionManager)
40
40
  try {
41
41
  const p = this.sessionManager.getTokens();
42
42
  if (p != null && p.refreshToken)
43
- return await this.sessionManager.getAuthHeaders(), this.executeRequest(e, t, r, s, !0);
43
+ return await this.sessionManager.getAuthHeaders(), this.executeRequest(e, t, r, n, !0);
44
44
  } catch {
45
45
  throw new Error(`HTTP ${h.status}: ${h.statusText}`);
46
46
  }
@@ -65,7 +65,7 @@ class G {
65
65
  return this.request("DELETE", e, void 0, t);
66
66
  }
67
67
  }
68
- class be {
68
+ class Se {
69
69
  constructor(e, t) {
70
70
  this.httpService = e, this.sessionManager = t;
71
71
  }
@@ -78,12 +78,12 @@ class be {
78
78
  async getApps(e) {
79
79
  const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
80
80
  e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
81
- const s = `/apps/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
81
+ const n = `/apps/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(n, {
82
82
  headers: t
83
83
  });
84
84
  return {
85
- apps: a.data,
86
- meta: a.meta
85
+ apps: o.data,
86
+ meta: o.meta
87
87
  };
88
88
  }
89
89
  async getAppById(e) {
@@ -110,11 +110,11 @@ class be {
110
110
  )).data;
111
111
  }
112
112
  async updateSettingsSchema(e, t, r) {
113
- const s = await this.sessionManager.getAuthHeaders();
113
+ const n = await this.sessionManager.getAuthHeaders();
114
114
  return (await this.httpService.put(
115
115
  `/apps/${e}/settings-schema`,
116
116
  { schema: t, defaultSettings: r },
117
- { headers: s }
117
+ { headers: n }
118
118
  )).data;
119
119
  }
120
120
  async exportConfig(e) {
@@ -124,7 +124,7 @@ class be {
124
124
  })).data;
125
125
  }
126
126
  }
127
- const ge = ee(null), Se = () => /* @__PURE__ */ n(
127
+ const pe = te(null), ve = () => /* @__PURE__ */ s(
128
128
  "div",
129
129
  {
130
130
  style: {
@@ -134,9 +134,9 @@ const ge = ee(null), Se = () => /* @__PURE__ */ n(
134
134
  height: "100vh",
135
135
  fontFamily: "system-ui, sans-serif"
136
136
  },
137
- children: /* @__PURE__ */ n("div", { children: "Loading application..." })
137
+ children: /* @__PURE__ */ s("div", { children: "Loading application..." })
138
138
  }
139
- ), ve = ({ error: i, retry: e }) => /* @__PURE__ */ u(
139
+ ), xe = ({ error: i, retry: e }) => /* @__PURE__ */ c(
140
140
  "div",
141
141
  {
142
142
  style: {
@@ -150,9 +150,9 @@ const ge = ee(null), Se = () => /* @__PURE__ */ n(
150
150
  padding: "20px"
151
151
  },
152
152
  children: [
153
- /* @__PURE__ */ n("h2", { style: { color: "#dc3545", marginBottom: "16px" }, children: "Application Error" }),
154
- /* @__PURE__ */ n("p", { style: { color: "#6c757d", marginBottom: "24px" }, children: i.message || "Unable to load application" }),
155
- /* @__PURE__ */ n(
153
+ /* @__PURE__ */ s("h2", { style: { color: "#dc3545", marginBottom: "16px" }, children: "Application Error" }),
154
+ /* @__PURE__ */ s("p", { style: { color: "#6c757d", marginBottom: "24px" }, children: i.message || "Unable to load application" }),
155
+ /* @__PURE__ */ s(
156
156
  "button",
157
157
  {
158
158
  onClick: e,
@@ -170,8 +170,8 @@ const ge = ee(null), Se = () => /* @__PURE__ */ n(
170
170
  ]
171
171
  }
172
172
  );
173
- function Je({ config: i, children: e }) {
174
- const [t, r] = m(null), [s, a] = m(!0), [v, T] = m(null), M = O(() => {
173
+ function et({ config: i, children: e }) {
174
+ const [t, r] = b(null), [n, o] = b(!0), [m, T] = b(null), M = z(() => {
175
175
  const g = () => {
176
176
  P();
177
177
  };
@@ -180,40 +180,40 @@ function Je({ config: i, children: e }) {
180
180
  baseUrl: i.baseUrl,
181
181
  // App info
182
182
  appInfo: t,
183
- isAppLoading: s,
184
- appError: v,
183
+ isAppLoading: n,
184
+ appError: m,
185
185
  retryApp: g
186
186
  };
187
- }, [i, t, s, v]), P = X(async () => {
187
+ }, [i, t, n, m]), P = Z(async () => {
188
188
  try {
189
- a(!0), T(null);
190
- const g = new G(i.baseUrl), x = await new be(g, {}).getPublicAppInfo(i.appId);
189
+ o(!0), T(null);
190
+ const g = new G(i.baseUrl), x = await new Se(g, {}).getPublicAppInfo(i.appId);
191
191
  r(x);
192
192
  } catch (g) {
193
193
  const h = g instanceof Error ? g : new Error("Failed to load app information");
194
194
  T(h), r(null);
195
195
  } finally {
196
- a(!1);
196
+ o(!1);
197
197
  }
198
198
  }, [i.baseUrl, i.appId]);
199
- if (K(() => {
199
+ if (Y(() => {
200
200
  P();
201
- }, [P]), s)
202
- return /* @__PURE__ */ n(B, { children: i.loadingFallback || /* @__PURE__ */ n(Se, {}) });
203
- if (v) {
204
- const g = typeof i.errorFallback == "function" ? i.errorFallback(v, () => P()) : i.errorFallback || /* @__PURE__ */ n(ve, { error: v, retry: () => P() });
205
- return /* @__PURE__ */ n(B, { children: g });
201
+ }, [P]), n)
202
+ return /* @__PURE__ */ s(H, { children: i.loadingFallback || /* @__PURE__ */ s(ve, {}) });
203
+ if (m) {
204
+ const g = typeof i.errorFallback == "function" ? i.errorFallback(m, () => P()) : i.errorFallback || /* @__PURE__ */ s(xe, { error: m, retry: () => P() });
205
+ return /* @__PURE__ */ s(H, { children: g });
206
206
  }
207
- return /* @__PURE__ */ n(ge.Provider, { value: M, children: e });
207
+ return /* @__PURE__ */ s(pe.Provider, { value: M, children: e });
208
208
  }
209
- function re() {
210
- const i = te(ge);
209
+ function se() {
210
+ const i = re(pe);
211
211
  if (!i)
212
212
  throw new Error("useApp must be used within an AppProvider");
213
213
  return i;
214
214
  }
215
- const Xe = re;
216
- class xe {
215
+ const tt = se;
216
+ class Ae {
217
217
  constructor(e = {}) {
218
218
  this.refreshPromise = null, this.refreshQueue = [], 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 || {
219
219
  get: () => {
@@ -281,10 +281,10 @@ class xe {
281
281
  try {
282
282
  await this.refreshPromise;
283
283
  const t = this.getTokens(), r = t != null && t.accessToken ? { Authorization: `Bearer ${t.accessToken}` } : {};
284
- return this.refreshQueue.forEach(({ resolve: s }) => s(r)), this.refreshQueue = [], r;
284
+ return this.refreshQueue.forEach(({ resolve: n }) => n(r)), this.refreshQueue = [], r;
285
285
  } catch (t) {
286
286
  const r = t instanceof Error ? t : new Error("Token refresh failed");
287
- return this.refreshQueue.forEach(({ reject: s }) => s(r)), this.refreshQueue = [], this.clearSession(), this.onRefreshFailed && this.onRefreshFailed(), {};
287
+ return this.refreshQueue.forEach(({ reject: n }) => n(r)), this.refreshQueue = [], this.clearSession(), this.onRefreshFailed && this.onRefreshFailed(), {};
288
288
  } finally {
289
289
  this.refreshPromise = null;
290
290
  }
@@ -303,11 +303,11 @@ class xe {
303
303
  });
304
304
  if (!r.ok)
305
305
  throw new Error(`Token refresh failed: ${r.status} ${r.statusText}`);
306
- const s = await r.json();
306
+ const n = await r.json();
307
307
  this.setTokens({
308
- accessToken: s.accessToken,
309
- refreshToken: s.refreshToken || e,
310
- expiresIn: s.expiresIn
308
+ accessToken: n.accessToken,
309
+ refreshToken: n.refreshToken || e,
310
+ expiresIn: n.expiresIn
311
311
  });
312
312
  }
313
313
  setUser(e) {
@@ -330,7 +330,7 @@ class xe {
330
330
  return e !== null && !this.isTokenExpired(e);
331
331
  }
332
332
  }
333
- class Ae {
333
+ class Pe {
334
334
  constructor(e) {
335
335
  this.httpService = e;
336
336
  }
@@ -364,7 +364,7 @@ class Ae {
364
364
  });
365
365
  }
366
366
  }
367
- class le {
367
+ class ce {
368
368
  constructor(e, t) {
369
369
  this.httpService = e, this.sessionManager = t;
370
370
  }
@@ -404,10 +404,10 @@ class le {
404
404
  async getRolesByApp(e, t) {
405
405
  const r = new URLSearchParams();
406
406
  t != null && t.page && r.append("page", t.page.toString()), t != null && t.limit && r.append("limit", t.limit.toString()), t != null && t.sortBy && r.append("sortBy", t.sortBy), t != null && t.sortOrder && r.append("sortOrder", t.sortOrder);
407
- const s = `/roles/app/${e}${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s);
407
+ const n = `/roles/app/${e}${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(n);
408
408
  return {
409
- roles: a.data,
410
- meta: a.meta
409
+ roles: o.data,
410
+ meta: o.meta
411
411
  };
412
412
  }
413
413
  async assignRole(e, t) {
@@ -429,18 +429,18 @@ class le {
429
429
  async getUserRoles(e, t) {
430
430
  if (!this.sessionManager)
431
431
  throw new Error("SessionManager is required for private endpoints");
432
- const r = await this.sessionManager.getAuthHeaders(), s = new URLSearchParams();
433
- t != null && t.page && s.append("page", t.page.toString()), t != null && t.limit && s.append("limit", t.limit.toString()), t != null && t.sortBy && s.append("sortBy", t.sortBy), t != null && t.sortOrder && s.append("sortOrder", t.sortOrder);
434
- const a = `/roles/user/${e}${s.toString() ? `?${s.toString()}` : ""}`, v = await this.httpService.get(a, {
432
+ const r = await this.sessionManager.getAuthHeaders(), n = new URLSearchParams();
433
+ 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);
434
+ const o = `/roles/user/${e}${n.toString() ? `?${n.toString()}` : ""}`, m = await this.httpService.get(o, {
435
435
  headers: r
436
436
  });
437
437
  return {
438
- roles: v.data,
439
- meta: v.meta
438
+ roles: m.data,
439
+ meta: m.meta
440
440
  };
441
441
  }
442
442
  }
443
- class Pe {
443
+ class ke {
444
444
  constructor(e, t) {
445
445
  this.httpService = e, this.sessionManager = t;
446
446
  }
@@ -453,12 +453,12 @@ class Pe {
453
453
  async getUsers(e) {
454
454
  const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
455
455
  e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
456
- const s = `/users/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
456
+ const n = `/users/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(n, {
457
457
  headers: t
458
458
  });
459
459
  return {
460
- users: a.data,
461
- meta: a.meta
460
+ users: o.data,
461
+ meta: o.meta
462
462
  };
463
463
  }
464
464
  async getUserById(e) {
@@ -480,7 +480,7 @@ class Pe {
480
480
  });
481
481
  }
482
482
  }
483
- class ce {
483
+ class de {
484
484
  constructor(e, t, r) {
485
485
  this.httpService = e, this.appId = t, this.sessionManager = r;
486
486
  }
@@ -497,12 +497,12 @@ class ce {
497
497
  throw new Error("SessionManager is required for private endpoints");
498
498
  const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
499
499
  e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
500
- const s = `/tenants/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
500
+ const n = `/tenants/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(n, {
501
501
  headers: t
502
502
  });
503
503
  return {
504
- tenants: a.data,
505
- meta: a.meta
504
+ tenants: o.data,
505
+ meta: o.meta
506
506
  };
507
507
  }
508
508
  async getTenantById(e) {
@@ -558,7 +558,7 @@ class ce {
558
558
  )).data;
559
559
  }
560
560
  }
561
- const pe = ee(null), ke = () => /* @__PURE__ */ n(
561
+ const fe = te(null), Te = () => /* @__PURE__ */ s(
562
562
  "div",
563
563
  {
564
564
  style: {
@@ -568,9 +568,9 @@ const pe = ee(null), ke = () => /* @__PURE__ */ n(
568
568
  height: "100vh",
569
569
  fontFamily: "system-ui, sans-serif"
570
570
  },
571
- children: /* @__PURE__ */ n("div", { children: "Loading tenant..." })
571
+ children: /* @__PURE__ */ s("div", { children: "Loading tenant..." })
572
572
  }
573
- ), Te = ({ error: i, retry: e }) => /* @__PURE__ */ u(
573
+ ), Me = ({ error: i, retry: e }) => /* @__PURE__ */ c(
574
574
  "div",
575
575
  {
576
576
  style: {
@@ -584,9 +584,9 @@ const pe = ee(null), ke = () => /* @__PURE__ */ n(
584
584
  padding: "20px"
585
585
  },
586
586
  children: [
587
- /* @__PURE__ */ n("h2", { style: { color: "#dc3545", marginBottom: "16px" }, children: "Tenant Error" }),
588
- /* @__PURE__ */ n("p", { style: { color: "#6c757d", marginBottom: "24px" }, children: i.message || "Unable to load tenant" }),
589
- /* @__PURE__ */ n(
587
+ /* @__PURE__ */ s("h2", { style: { color: "#dc3545", marginBottom: "16px" }, children: "Tenant Error" }),
588
+ /* @__PURE__ */ s("p", { style: { color: "#6c757d", marginBottom: "24px" }, children: i.message || "Unable to load tenant" }),
589
+ /* @__PURE__ */ s(
590
590
  "button",
591
591
  {
592
592
  onClick: e,
@@ -604,73 +604,73 @@ const pe = ee(null), ke = () => /* @__PURE__ */ n(
604
604
  ]
605
605
  }
606
606
  );
607
- function Ze({ config: i, children: e }) {
608
- const { baseUrl: t, appInfo: r, appId: s } = re(), [a, v] = m(i.initialTenant || null), [T, M] = m(!i.initialTenant), [P, g] = m(null), [h, x] = m(null), [p, A] = m(!1), [F, f] = m(null), C = X(() => {
609
- const c = i.tenantMode || "selector", w = "tenant";
607
+ function rt({ config: i, children: e }) {
608
+ const { baseUrl: t, appInfo: r, appId: n } = se(), [o, m] = b(i.initialTenant || null), [T, M] = b(!i.initialTenant), [P, g] = b(null), [h, x] = b(null), [p, A] = b(!1), [F, f] = b(null), L = Z(() => {
609
+ const d = i.tenantMode || "selector", w = "tenant";
610
610
  if (typeof window > "u") return null;
611
- if (c === "subdomain") {
612
- const o = window.location.hostname.split(".");
613
- if (o.length >= 3) {
614
- const l = o[0];
611
+ if (d === "subdomain") {
612
+ const a = window.location.hostname.split(".");
613
+ if (a.length >= 3) {
614
+ const l = a[0];
615
615
  return localStorage.setItem(w, l), l;
616
616
  }
617
617
  return localStorage.getItem(w);
618
- } else if (c === "selector") {
619
- const o = new URLSearchParams(window.location.search).get(i.selectorParam || "tenant");
620
- return o ? (localStorage.setItem(w, o), o) : localStorage.getItem(w);
618
+ } else if (d === "selector") {
619
+ const a = new URLSearchParams(window.location.search).get(i.selectorParam || "tenant");
620
+ return a ? (localStorage.setItem(w, a), a) : localStorage.getItem(w);
621
621
  }
622
622
  return null;
623
- }, [i.tenantMode, i.selectorParam]), y = O(() => C(), [C]), b = (r == null ? void 0 : r.settingsSchema) || null, k = X(
624
- async (c) => {
623
+ }, [i.tenantMode, i.selectorParam]), y = z(() => L(), [L]), S = (r == null ? void 0 : r.settingsSchema) || null, k = Z(
624
+ async (d) => {
625
625
  try {
626
626
  M(!0), g(null);
627
- const w = new G(t), o = await new ce(w, s).getPublicTenantInfo(c);
628
- v(o);
627
+ const w = new G(t), a = await new de(w, n).getPublicTenantInfo(d);
628
+ m(a);
629
629
  } catch (w) {
630
- const d = w instanceof Error ? w : new Error("Failed to load tenant information");
631
- g(d), v(null);
630
+ const u = w instanceof Error ? w : new Error("Failed to load tenant information");
631
+ g(u), m(null);
632
632
  } finally {
633
633
  M(!1);
634
634
  }
635
635
  },
636
- [t, s]
637
- ), R = X(async () => {
638
- if (a != null && a.id)
636
+ [t, n]
637
+ ), R = Z(async () => {
638
+ if (o != null && o.id)
639
639
  try {
640
640
  A(!0), f(null);
641
- const c = new G(t), d = await new ce(c, a.appId).getTenantSettings(a.id);
642
- x(d);
643
- } catch (c) {
644
- const w = c instanceof Error ? c : new Error("Failed to load tenant settings");
641
+ const d = new G(t), u = await new de(d, o.appId).getTenantSettings(o.id);
642
+ x(u);
643
+ } catch (d) {
644
+ const w = d instanceof Error ? d : new Error("Failed to load tenant settings");
645
645
  f(w), x(null);
646
646
  } finally {
647
647
  A(!1);
648
648
  }
649
- }, [t, a]), L = X(() => {
649
+ }, [t, o]), D = Z(() => {
650
650
  R();
651
- }, [R]), E = X(
652
- (c) => {
653
- if (!b)
651
+ }, [R]), E = Z(
652
+ (d) => {
653
+ if (!S)
654
654
  return { isValid: !0, errors: [] };
655
655
  const w = [];
656
656
  try {
657
- return b.properties && Object.entries(b.properties).forEach(([d, o]) => {
657
+ return S.properties && Object.entries(S.properties).forEach(([u, a]) => {
658
658
  var W;
659
- const l = c[d];
660
- if ((W = b.required) != null && W.includes(d) && l == null) {
661
- w.push(`Field '${d}' is required`);
659
+ const l = d[u];
660
+ if ((W = S.required) != null && W.includes(u) && l == null) {
661
+ w.push(`Field '${u}' is required`);
662
662
  return;
663
663
  }
664
664
  if (l != null) {
665
- if (o.type) {
666
- const I = o.type, N = typeof l;
667
- I === "string" && N !== "string" ? w.push(`Field '${d}' must be a string`) : (I === "number" || I === "integer") && N !== "number" ? w.push(`Field '${d}' must be a number`) : I === "boolean" && N !== "boolean" ? w.push(`Field '${d}' must be a boolean`) : I === "array" && !Array.isArray(l) && w.push(`Field '${d}' must be an array`);
665
+ if (a.type) {
666
+ const I = a.type, N = typeof l;
667
+ I === "string" && N !== "string" ? w.push(`Field '${u}' must be a string`) : (I === "number" || I === "integer") && N !== "number" ? w.push(`Field '${u}' must be a number`) : I === "boolean" && N !== "boolean" ? w.push(`Field '${u}' must be a boolean`) : I === "array" && !Array.isArray(l) && w.push(`Field '${u}' must be an array`);
668
668
  }
669
- o.minLength !== void 0 && typeof l == "string" && l.length < o.minLength && w.push(
670
- `Field '${d}' must be at least ${o.minLength} characters long`
671
- ), o.maxLength !== void 0 && typeof l == "string" && l.length > o.maxLength && w.push(
672
- `Field '${d}' must be no more than ${o.maxLength} characters long`
673
- ), o.minimum !== void 0 && typeof l == "number" && l < o.minimum && w.push(`Field '${d}' must be at least ${o.minimum}`), o.maximum !== void 0 && typeof l == "number" && l > o.maximum && w.push(`Field '${d}' must be no more than ${o.maximum}`), o.pattern && typeof l == "string" && (new RegExp(o.pattern).test(l) || w.push(`Field '${d}' does not match the required pattern`)), o.enum && !o.enum.includes(l) && w.push(`Field '${d}' must be one of: ${o.enum.join(", ")}`);
669
+ a.minLength !== void 0 && typeof l == "string" && l.length < a.minLength && w.push(
670
+ `Field '${u}' must be at least ${a.minLength} characters long`
671
+ ), a.maxLength !== void 0 && typeof l == "string" && l.length > a.maxLength && w.push(
672
+ `Field '${u}' must be no more than ${a.maxLength} characters long`
673
+ ), a.minimum !== void 0 && typeof l == "number" && l < a.minimum && w.push(`Field '${u}' must be at least ${a.minimum}`), a.maximum !== void 0 && typeof l == "number" && l > a.maximum && w.push(`Field '${u}' must be no more than ${a.maximum}`), a.pattern && typeof l == "string" && (new RegExp(a.pattern).test(l) || w.push(`Field '${u}' does not match the required pattern`)), a.enum && !a.enum.includes(l) && w.push(`Field '${u}' must be one of: ${a.enum.join(", ")}`);
674
674
  }
675
675
  }), {
676
676
  isValid: w.length === 0,
@@ -683,16 +683,16 @@ function Ze({ config: i, children: e }) {
683
683
  };
684
684
  }
685
685
  },
686
- [b]
686
+ [S]
687
687
  );
688
- K(() => {
689
- !i.initialTenant && y ? k(y) : !i.initialTenant && !y && (v(null), g(null), M(!1));
690
- }, [i.initialTenant, y, k]), K(() => {
691
- a != null && a.id ? R() : (x(null), f(null), A(!1));
692
- }, [a == null ? void 0 : a.id, R]);
693
- const D = O(() => ({
688
+ Y(() => {
689
+ !i.initialTenant && y ? k(y) : !i.initialTenant && !y && (m(null), g(null), M(!1));
690
+ }, [i.initialTenant, y, k]), Y(() => {
691
+ o != null && o.id ? R() : (x(null), f(null), A(!1));
692
+ }, [o == null ? void 0 : o.id, R]);
693
+ const B = z(() => ({
694
694
  // Tenant info
695
- tenant: a,
695
+ tenant: o,
696
696
  tenantSlug: y,
697
697
  isTenantLoading: T,
698
698
  tenantError: P,
@@ -701,125 +701,119 @@ function Ze({ config: i, children: e }) {
701
701
  },
702
702
  // Settings
703
703
  settings: h,
704
- settingsSchema: b,
704
+ settingsSchema: S,
705
705
  isSettingsLoading: p,
706
706
  settingsError: F,
707
707
  // Actions
708
- refreshSettings: L,
708
+ refreshSettings: D,
709
709
  // Validation
710
710
  validateSettings: E
711
711
  }), [
712
- a,
712
+ o,
713
713
  y,
714
714
  T,
715
715
  P,
716
716
  h,
717
- b,
717
+ S,
718
718
  p,
719
719
  F,
720
- L,
720
+ D,
721
721
  E
722
722
  ]);
723
723
  if (T)
724
- return /* @__PURE__ */ n(B, { children: i.loadingFallback || /* @__PURE__ */ n(ke, {}) });
724
+ return /* @__PURE__ */ s(H, { children: i.loadingFallback || /* @__PURE__ */ s(Te, {}) });
725
725
  if (P) {
726
- const c = typeof i.errorFallback == "function" ? i.errorFallback(P, () => k(y || "")) : i.errorFallback || /* @__PURE__ */ n(Te, { error: P, retry: () => k(y || "") });
727
- return /* @__PURE__ */ n(B, { children: c });
726
+ const d = typeof i.errorFallback == "function" ? i.errorFallback(P, () => k(y || "")) : i.errorFallback || /* @__PURE__ */ s(Me, { error: P, retry: () => k(y || "") });
727
+ return /* @__PURE__ */ s(H, { children: d });
728
728
  }
729
- return /* @__PURE__ */ n(pe.Provider, { value: D, children: e });
729
+ return /* @__PURE__ */ s(fe.Provider, { value: B, children: e });
730
730
  }
731
- function oe() {
732
- const i = te(pe);
731
+ function le() {
732
+ const i = re(fe);
733
733
  if (!i)
734
734
  throw new Error("useTenant must be used within a TenantProvider");
735
735
  return i;
736
736
  }
737
- const et = oe;
738
- function tt() {
739
- const {
740
- settings: i,
741
- settingsSchema: e,
742
- isSettingsLoading: t,
743
- settingsError: r,
744
- validateSettings: s
745
- } = oe();
737
+ const st = le;
738
+ function nt() {
739
+ const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: n } = le();
746
740
  return {
747
741
  settings: i,
748
742
  settingsSchema: e,
749
743
  isLoading: t,
750
744
  error: r,
751
- validateSettings: s
745
+ validateSettings: n
752
746
  };
753
747
  }
754
- function Z() {
755
- const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: s } = oe();
748
+ function K() {
749
+ const { tenant: i, tenantSlug: e, isTenantLoading: t, tenantError: r, retryTenant: n } = le();
756
750
  return {
757
751
  tenant: i,
758
752
  tenantSlug: e,
759
753
  isLoading: t,
760
754
  error: r,
761
- retry: s
755
+ retry: n
762
756
  };
763
757
  }
764
- const fe = ee(null);
765
- function rt({ config: i = {}, children: e }) {
766
- const { appId: t, baseUrl: r } = re(), s = Z(), a = (s == null ? void 0 : s.tenantSlug) || null, [v, T] = m(i.initialRoles || []), [M, P] = m(!i.initialRoles), [g, h] = m(null), [x, p] = m(!1), [A, F] = m(null), f = O(() => {
767
- const c = a ? `auth_tokens_${a}` : "auth_tokens", w = {
758
+ const ye = te(null);
759
+ function it({ config: i = {}, children: e }) {
760
+ const { appId: t, baseUrl: r } = se(), n = K(), o = (n == null ? void 0 : n.tenantSlug) || null, [m, T] = b(i.initialRoles || []), [M, P] = b(!i.initialRoles), [g, h] = b(null), [x, p] = b(!1), [A, F] = b(null), f = z(() => {
761
+ const d = o ? `auth_tokens_${o}` : "auth_tokens", w = {
768
762
  get: () => {
769
763
  try {
770
- const d = localStorage.getItem(c);
771
- return d ? JSON.parse(d) : null;
764
+ const u = localStorage.getItem(d);
765
+ return u ? JSON.parse(u) : null;
772
766
  } catch {
773
767
  return null;
774
768
  }
775
769
  },
776
- set: (d) => {
770
+ set: (u) => {
777
771
  try {
778
- localStorage.setItem(c, JSON.stringify(d));
772
+ localStorage.setItem(d, JSON.stringify(u));
779
773
  } catch {
780
774
  }
781
775
  },
782
776
  clear: () => {
783
777
  try {
784
- localStorage.removeItem(c);
778
+ localStorage.removeItem(d);
785
779
  } catch {
786
780
  }
787
781
  }
788
782
  };
789
- return new xe({
783
+ return new Ae({
790
784
  onRefreshFailed: i.onRefreshFailed,
791
785
  tokenStorage: w,
792
786
  baseUrl: r
793
787
  });
794
- }, [a, r, i.onRefreshFailed]), C = O(() => {
795
- const c = new G(r);
796
- return c.setSessionManager(f), c;
797
- }, [r, f]), y = O(() => new Ae(new G(r)), [r]), b = O(() => new Pe(C, f), [C, f]), k = O(() => new le(new G(r)), [r]), R = O(() => g || f.getUser(), [g, f]), L = O(() => R != null && R.roleId && v.find((c) => c.id === R.roleId) || null, [R, v]), E = O(() => (L == null ? void 0 : L.permissions) || [], [L]);
798
- K(() => {
788
+ }, [o, r, i.onRefreshFailed]), L = z(() => {
789
+ const d = new G(r);
790
+ return d.setSessionManager(f), d;
791
+ }, [r, f]), y = z(() => new Pe(new G(r)), [r]), S = z(() => new ke(L, f), [L, f]), k = z(() => new ce(new G(r)), [r]), R = z(() => g || f.getUser(), [g, f]), D = z(() => R != null && R.roleId && m.find((d) => d.id === R.roleId) || null, [R, m]), E = z(() => (D == null ? void 0 : D.permissions) || [], [D]);
792
+ Y(() => {
799
793
  console.log("AuthProvider - userPermissions changed:", E);
800
794
  }, [E]);
801
- const D = O(() => {
802
- const c = async () => {
795
+ const B = z(() => {
796
+ const d = async () => {
803
797
  try {
804
798
  p(!0), F(null);
805
- const S = f.getUser();
806
- if (!(S != null && S.id))
799
+ const v = f.getUser();
800
+ if (!(v != null && v.id))
807
801
  throw new Error("No user ID available in session");
808
- const $ = await b.getUserById(S.id);
802
+ const $ = await S.getUserById(v.id);
809
803
  h($), f.setUser($);
810
- } catch (S) {
811
- const $ = S instanceof Error ? S : new Error("Failed to load user data");
804
+ } catch (v) {
805
+ const $ = v instanceof Error ? v : new Error("Failed to load user data");
812
806
  F($), console.error("Failed to load user data:", $);
813
807
  } finally {
814
808
  p(!1);
815
809
  }
816
810
  }, w = async () => {
817
- await c();
818
- }, d = async (S, $, Q) => {
811
+ await d();
812
+ }, u = async (v, $, J) => {
819
813
  const V = await y.login({
820
- email: S,
814
+ email: v,
821
815
  password: $,
822
- tenantId: Q
816
+ tenantId: J
823
817
  });
824
818
  if (f.setTokens({
825
819
  accessToken: V.accessToken,
@@ -828,130 +822,137 @@ function rt({ config: i = {}, children: e }) {
828
822
  }), V.user) {
829
823
  f.setUser(V.user), h(V.user);
830
824
  try {
831
- await c();
832
- } catch (ie) {
833
- console.warn("Failed to load complete user data after login:", ie);
825
+ await d();
826
+ } catch (ee) {
827
+ console.warn("Failed to load complete user data after login:", ee);
834
828
  }
835
829
  }
836
830
  return V;
837
- }, o = async (S, $, Q, V) => await y.signup({ email: S, name: $, password: Q, tenantId: V }), l = async (S, $, Q, V) => await y.signupTenantAdmin({
838
- email: S,
831
+ }, a = async (v, $, J, V, ee) => await y.signup({
832
+ email: v,
833
+ name: $,
834
+ password: J,
835
+ tenantId: V,
836
+ lastName: ee
837
+ }), l = async (v, $, J, V, ee) => await y.signupTenantAdmin({
838
+ email: v,
839
839
  name: $,
840
- password: Q,
840
+ password: J,
841
841
  tenantName: V,
842
- appId: t
843
- }), W = async (S, $) => {
844
- const Q = await f.getAuthHeaders();
845
- await y.changePassword({ currentPassword: S, newPassword: $ }, Q);
846
- }, I = async (S, $) => {
847
- await y.requestPasswordReset({ email: S, tenantId: $ });
848
- }, N = async (S, $) => {
849
- await y.confirmPasswordReset({ token: S, newPassword: $ });
842
+ appId: t,
843
+ lastName: ee
844
+ }), W = async (v, $) => {
845
+ const J = await f.getAuthHeaders();
846
+ await y.changePassword({ currentPassword: v, newPassword: $ }, J);
847
+ }, I = async (v, $) => {
848
+ await y.requestPasswordReset({ email: v, tenantId: $ });
849
+ }, N = async (v, $) => {
850
+ await y.confirmPasswordReset({ token: v, newPassword: $ });
850
851
  }, _ = async () => {
851
- const S = f.getTokens();
852
- if (!(S != null && S.refreshToken))
852
+ const v = f.getTokens();
853
+ if (!(v != null && v.refreshToken))
853
854
  throw new Error("No refresh token available");
854
855
  const $ = await y.refreshToken({
855
- refreshToken: S.refreshToken
856
+ refreshToken: v.refreshToken
856
857
  });
857
858
  f.setTokens({
858
859
  accessToken: $.accessToken,
859
- refreshToken: $.refreshToken || S.refreshToken,
860
+ refreshToken: $.refreshToken || v.refreshToken,
860
861
  expiresIn: $.expiresIn
861
862
  });
862
- }, H = () => {
863
+ }, C = () => {
863
864
  f.clearSession(), h(null), F(null);
864
- }, q = (S) => {
865
- f.setTokens(S);
866
- }, Y = () => f.hasValidSession(), U = () => {
865
+ }, U = (v) => {
866
+ f.setTokens(v);
867
+ }, Q = () => f.hasValidSession(), q = () => {
867
868
  f.clearSession(), h(null), F(null);
868
- }, z = async () => {
869
+ }, O = async () => {
869
870
  if (t)
870
871
  try {
871
872
  P(!0);
872
- const { roles: S } = await k.getRolesByApp(t);
873
- T(S);
874
- } catch (S) {
875
- console.error("Failed to fetch roles:", S);
873
+ const { roles: v } = await k.getRolesByApp(t);
874
+ T(v);
875
+ } catch (v) {
876
+ console.error("Failed to fetch roles:", v);
876
877
  } finally {
877
878
  P(!1);
878
879
  }
879
880
  }, j = async () => {
880
- await z();
881
- }, ne = (S) => {
881
+ await O();
882
+ }, oe = (v) => {
882
883
  if (!E || E.length === 0)
883
884
  return !1;
884
- if (typeof S == "string")
885
- return E.includes(S);
886
- const $ = `${S.resource}.${S.action}`;
885
+ if (typeof v == "string")
886
+ return E.includes(v);
887
+ const $ = `${v.resource}.${v.action}`;
887
888
  return E.includes($);
888
889
  };
889
890
  return {
890
891
  sessionManager: f,
891
- authenticatedHttpService: C,
892
- login: d,
893
- signup: o,
892
+ authenticatedHttpService: L,
893
+ login: u,
894
+ signup: a,
894
895
  signupTenantAdmin: l,
895
896
  changePassword: W,
896
897
  requestPasswordReset: I,
897
898
  confirmPasswordReset: N,
898
899
  refreshToken: _,
899
- logout: H,
900
- setTokens: q,
901
- hasValidSession: Y,
902
- clearSession: U,
900
+ logout: C,
901
+ setTokens: U,
902
+ hasValidSession: Q,
903
+ clearSession: q,
903
904
  currentUser: g,
904
905
  isUserLoading: x,
905
906
  userError: A,
906
907
  refreshUser: w,
907
- userRole: L,
908
+ userRole: D,
908
909
  userPermissions: E,
909
- availableRoles: v,
910
+ availableRoles: m,
910
911
  rolesLoading: M,
911
- hasPermission: ne,
912
- hasAnyPermission: (S) => S.some(($) => ne($)),
913
- hasAllPermissions: (S) => S.every(($) => ne($)),
912
+ hasPermission: oe,
913
+ hasAnyPermission: (v) => v.some(($) => oe($)),
914
+ hasAllPermissions: (v) => v.every(($) => oe($)),
914
915
  getUserPermissionStrings: () => E || [],
915
916
  refreshRoles: j
916
917
  };
917
918
  }, [
918
919
  f,
919
- C,
920
+ L,
920
921
  y,
921
- b,
922
+ S,
922
923
  k,
923
924
  t,
924
- v,
925
+ m,
925
926
  g,
926
927
  x,
927
928
  A,
928
- L,
929
+ D,
929
930
  E
930
931
  ]);
931
- return K(() => {
932
+ return Y(() => {
932
933
  !i.initialRoles && t && (async () => {
933
934
  try {
934
935
  P(!0);
935
- const w = new G(r), d = new le(w), { roles: o } = await d.getRolesByApp(t);
936
- T(o);
936
+ const w = new G(r), u = new ce(w), { roles: a } = await u.getRolesByApp(t);
937
+ T(a);
937
938
  } catch (w) {
938
939
  console.error("Failed to fetch roles:", w);
939
940
  } finally {
940
941
  P(!1);
941
942
  }
942
943
  })();
943
- }, [t, r, i.initialRoles]), K(() => {
944
- const c = f.getUser();
945
- c && f.hasValidSession() && h(c);
946
- }, [f]), /* @__PURE__ */ n(fe.Provider, { value: D, children: e });
944
+ }, [t, r, i.initialRoles]), Y(() => {
945
+ const d = f.getUser();
946
+ d && f.hasValidSession() && h(d);
947
+ }, [f]), /* @__PURE__ */ s(ye.Provider, { value: B, children: e });
947
948
  }
948
- function se() {
949
- const i = te(fe);
949
+ function ne() {
950
+ const i = re(ye);
950
951
  if (!i)
951
952
  throw new Error("useAuth must be used within an AuthProvider");
952
953
  return i;
953
954
  }
954
- class Me {
955
+ class Ee {
955
956
  constructor(e, t) {
956
957
  this.httpService = e, this.sessionManager = t;
957
958
  }
@@ -972,12 +973,12 @@ class Me {
972
973
  throw new Error("SessionManager is required for private endpoints");
973
974
  const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
974
975
  e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
975
- const s = `/feature-flags/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
976
+ const n = `/feature-flags/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(n, {
976
977
  headers: t
977
978
  });
978
979
  return {
979
- featureFlags: a.data,
980
- meta: a.meta
980
+ featureFlags: o.data,
981
+ meta: o.meta
981
982
  };
982
983
  }
983
984
  async getFeatureFlagById(e) {
@@ -1014,8 +1015,8 @@ class Me {
1014
1015
  throw new Error("Tenant ID and App ID are required");
1015
1016
  const r = new URLSearchParams();
1016
1017
  r.append("tenantId", e), r.append("appId", t);
1017
- const s = `/tenant-feature-flags${r.toString() ? `?${r.toString()}` : ""}`;
1018
- return (await this.httpService.get(s, {
1018
+ const n = `/tenant-feature-flags${r.toString() ? `?${r.toString()}` : ""}`;
1019
+ return (await this.httpService.get(n, {
1019
1020
  headers: { "X-Tenant-ID": e }
1020
1021
  })).data;
1021
1022
  }
@@ -1023,28 +1024,28 @@ class Me {
1023
1024
  async getTenantFeatureFlag(e, t, r) {
1024
1025
  if (!e || !t || !r)
1025
1026
  throw new Error("Flag Key, Tenant ID and App ID are required");
1026
- const s = new URLSearchParams();
1027
- s.append("tenantId", t), s.append("appId", r);
1028
- const a = `/tenant-feature-flags/${e}${s.toString() ? `?${s.toString()}` : ""}`;
1029
- return (await this.httpService.get(a, {
1027
+ const n = new URLSearchParams();
1028
+ n.append("tenantId", t), n.append("appId", r);
1029
+ const o = `/tenant-feature-flags/${e}${n.toString() ? `?${n.toString()}` : ""}`;
1030
+ return (await this.httpService.get(o, {
1030
1031
  headers: { "X-Tenant-ID": t }
1031
1032
  })).data;
1032
1033
  }
1033
1034
  }
1034
- const ye = ee(null);
1035
- function st({ config: i = {}, children: e }) {
1036
- const { baseUrl: t, appId: r } = re(), { tenant: s } = Z(), [a, v] = m([]), [T, M] = m(!1), [P, g] = m(null), h = O(() => {
1035
+ const we = te(null);
1036
+ function ot({ config: i = {}, children: e }) {
1037
+ const { baseUrl: t, appId: r } = se(), { tenant: n } = K(), [o, m] = b([]), [T, M] = b(!1), [P, g] = b(null), h = z(() => {
1037
1038
  const A = new G(t);
1038
- return new Me(A);
1039
+ return new Ee(A);
1039
1040
  }, [t]), x = async () => {
1040
- if (!(s != null && s.id)) {
1041
- v([]);
1041
+ if (!(n != null && n.id)) {
1042
+ m([]);
1042
1043
  return;
1043
1044
  }
1044
1045
  M(!0), g(null);
1045
1046
  try {
1046
- const A = await h.getTenantFeatureFlags(s.id, r);
1047
- v(A);
1047
+ const A = await h.getTenantFeatureFlags(n.id, r);
1048
+ m(A);
1048
1049
  } catch (A) {
1049
1050
  const F = A instanceof Error ? A.message : "Failed to fetch feature flags";
1050
1051
  g(F), i.onError && i.onError(A instanceof Error ? A : new Error(F));
@@ -1052,37 +1053,37 @@ function st({ config: i = {}, children: e }) {
1052
1053
  M(!1);
1053
1054
  }
1054
1055
  };
1055
- K(() => {
1056
+ Y(() => {
1056
1057
  x();
1057
1058
  const A = i.refreshInterval || 5 * 60 * 1e3, F = setInterval(x, A);
1058
1059
  return () => clearInterval(F);
1059
- }, [s == null ? void 0 : s.id, i.refreshInterval]);
1060
- const p = O(() => ({
1061
- featureFlags: a,
1060
+ }, [n == null ? void 0 : n.id, i.refreshInterval]);
1061
+ const p = z(() => ({
1062
+ featureFlags: o,
1062
1063
  loading: T,
1063
1064
  error: P,
1064
1065
  isEnabled: (y) => {
1065
- const b = a.find((k) => k.key === y);
1066
- return (b == null ? void 0 : b.value) === !0;
1066
+ const S = o.find((k) => k.key === y);
1067
+ return (S == null ? void 0 : S.value) === !0;
1067
1068
  },
1068
- getFlag: (y) => a.find((b) => b.key === y),
1069
+ getFlag: (y) => o.find((S) => S.key === y),
1069
1070
  getFlagState: (y) => {
1070
- const b = a.find((k) => k.key === y);
1071
- return b ? b.value ? "enabled" : "disabled" : "not_found";
1071
+ const S = o.find((k) => k.key === y);
1072
+ return S ? S.value ? "enabled" : "disabled" : "not_found";
1072
1073
  },
1073
1074
  refresh: async () => {
1074
1075
  await x();
1075
1076
  }
1076
- }), [a, T, P]);
1077
- return /* @__PURE__ */ n(ye.Provider, { value: p, children: e });
1077
+ }), [o, T, P]);
1078
+ return /* @__PURE__ */ s(we.Provider, { value: p, children: e });
1078
1079
  }
1079
- function Ee() {
1080
- const i = te(ye);
1080
+ function Re() {
1081
+ const i = re(we);
1081
1082
  if (!i)
1082
1083
  throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
1083
1084
  return i;
1084
1085
  }
1085
- class Re {
1086
+ class Fe {
1086
1087
  constructor(e, t) {
1087
1088
  this.httpService = e, this.sessionManager = t;
1088
1089
  }
@@ -1148,20 +1149,20 @@ class Re {
1148
1149
  )).data;
1149
1150
  }
1150
1151
  }
1151
- const we = ee(void 0);
1152
- function nt({ config: i = {}, children: e }) {
1153
- const { baseUrl: t } = re(), { tenant: r } = Z(), [s, a] = m(null), [v, T] = m(!1), [M, P] = m(null), g = O(() => {
1152
+ const me = te(void 0);
1153
+ function at({ config: i = {}, children: e }) {
1154
+ const { baseUrl: t } = se(), { tenant: r } = K(), [n, o] = b(null), [m, T] = b(!1), [M, P] = b(null), g = z(() => {
1154
1155
  const p = new G(t);
1155
- return new Re(p);
1156
+ return new Fe(p);
1156
1157
  }, [t]), h = async () => {
1157
1158
  if (!(r != null && r.id)) {
1158
- a(null);
1159
+ o(null);
1159
1160
  return;
1160
1161
  }
1161
1162
  T(!0), P(null);
1162
1163
  try {
1163
1164
  const p = await g.getTenantSubscriptionFeatures(r.id);
1164
- a(p);
1165
+ o(p);
1165
1166
  } catch (p) {
1166
1167
  const A = p instanceof Error ? p.message : "Failed to fetch subscription";
1167
1168
  P(A), i.onError && i.onError(p instanceof Error ? p : new Error(A));
@@ -1169,43 +1170,43 @@ function nt({ config: i = {}, children: e }) {
1169
1170
  T(!1);
1170
1171
  }
1171
1172
  };
1172
- K(() => {
1173
+ Y(() => {
1173
1174
  if (h(), !i.refreshInterval) return;
1174
1175
  const p = i.refreshInterval || 10 * 60 * 1e3, A = setInterval(h, p);
1175
1176
  return () => clearInterval(A);
1176
1177
  }, [r == null ? void 0 : r.id, i.refreshInterval]);
1177
- const x = O(() => {
1178
- const p = (s == null ? void 0 : s.features) || [];
1178
+ const x = z(() => {
1179
+ const p = (n == null ? void 0 : n.features) || [];
1179
1180
  return {
1180
- subscription: s,
1181
+ subscription: n,
1181
1182
  features: p,
1182
- loading: v,
1183
+ loading: m,
1183
1184
  error: M,
1184
- isFeatureEnabled: (b) => {
1185
- const k = p.find((R) => R.key === b);
1185
+ isFeatureEnabled: (S) => {
1186
+ const k = p.find((R) => R.key === S);
1186
1187
  return k ? k.type === "BOOLEAN" || k.type === "boolean" ? k.value === !0 : !!k.value : !1;
1187
1188
  },
1188
- getFeature: (b) => p.find((k) => k.key === b),
1189
- getFeatureValue: (b, k) => {
1190
- const R = p.find((L) => L.key === b);
1189
+ getFeature: (S) => p.find((k) => k.key === S),
1190
+ getFeatureValue: (S, k) => {
1191
+ const R = p.find((D) => D.key === S);
1191
1192
  return R ? R.value : k;
1192
1193
  },
1193
- hasAllowedPlan: (b) => !s || !s.isActive ? !1 : b.includes(s.planId),
1194
+ hasAllowedPlan: (S) => !n || !n.isActive ? !1 : S.includes(n.planId),
1194
1195
  refresh: async () => {
1195
1196
  await h();
1196
1197
  }
1197
1198
  };
1198
- }, [s, v, M]);
1199
- return /* @__PURE__ */ n(we.Provider, { value: x, children: e });
1199
+ }, [n, m, M]);
1200
+ return /* @__PURE__ */ s(me.Provider, { value: x, children: e });
1200
1201
  }
1201
- function Fe() {
1202
- const i = te(we);
1202
+ function Ie() {
1203
+ const i = re(me);
1203
1204
  if (i === void 0)
1204
1205
  throw new Error("useSubscription must be used within a SubscriptionProvider");
1205
1206
  return i;
1206
1207
  }
1207
- var J = /* @__PURE__ */ ((i) => (i.SUPERUSER = "SUPERUSER", i.TENANT_ADMIN = "TENANT_ADMIN", i.USER = "USER", i))(J || {});
1208
- const de = () => /* @__PURE__ */ u(
1208
+ var X = /* @__PURE__ */ ((i) => (i.SUPERUSER = "SUPERUSER", i.TENANT_ADMIN = "TENANT_ADMIN", i.USER = "USER", i))(X || {});
1209
+ const ue = () => /* @__PURE__ */ c(
1209
1210
  "div",
1210
1211
  {
1211
1212
  style: {
@@ -1221,10 +1222,10 @@ const de = () => /* @__PURE__ */ u(
1221
1222
  margin: "20px 0"
1222
1223
  },
1223
1224
  children: [
1224
- /* @__PURE__ */ n("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "🔒" }),
1225
- /* @__PURE__ */ n("h3", { style: { color: "#495057", marginBottom: "10px" }, children: "Access Required" }),
1226
- /* @__PURE__ */ n("p", { style: { color: "#6c757d", fontSize: "14px", marginBottom: "15px" }, children: "You need to be signed in to view this content." }),
1227
- /* @__PURE__ */ n(
1225
+ /* @__PURE__ */ s("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "🔒" }),
1226
+ /* @__PURE__ */ s("h3", { style: { color: "#495057", marginBottom: "10px" }, children: "Access Required" }),
1227
+ /* @__PURE__ */ s("p", { style: { color: "#6c757d", fontSize: "14px", marginBottom: "15px" }, children: "You need to be signed in to view this content." }),
1228
+ /* @__PURE__ */ s(
1228
1229
  "button",
1229
1230
  {
1230
1231
  style: {
@@ -1242,11 +1243,11 @@ const de = () => /* @__PURE__ */ u(
1242
1243
  )
1243
1244
  ]
1244
1245
  }
1245
- ), ue = ({
1246
+ ), he = ({
1246
1247
  userType: i,
1247
1248
  minUserType: e,
1248
1249
  missingPermissions: t
1249
- }) => /* @__PURE__ */ u(
1250
+ }) => /* @__PURE__ */ c(
1250
1251
  "div",
1251
1252
  {
1252
1253
  style: {
@@ -1262,57 +1263,57 @@ const de = () => /* @__PURE__ */ u(
1262
1263
  margin: "20px 0"
1263
1264
  },
1264
1265
  children: [
1265
- /* @__PURE__ */ n("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "⚠️" }),
1266
- /* @__PURE__ */ n("h3", { style: { color: "#856404", marginBottom: "10px" }, children: "Insufficient Permissions" }),
1267
- e && i ? /* @__PURE__ */ u(B, { children: [
1268
- /* @__PURE__ */ u("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: [
1266
+ /* @__PURE__ */ s("div", { style: { fontSize: "2rem", marginBottom: "10px" }, children: "⚠️" }),
1267
+ /* @__PURE__ */ s("h3", { style: { color: "#856404", marginBottom: "10px" }, children: "Insufficient Permissions" }),
1268
+ e && i ? /* @__PURE__ */ c(H, { children: [
1269
+ /* @__PURE__ */ c("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: [
1269
1270
  "This content requires ",
1270
- /* @__PURE__ */ n("strong", { children: e }),
1271
+ /* @__PURE__ */ s("strong", { children: e }),
1271
1272
  " access level or higher."
1272
1273
  ] }),
1273
- /* @__PURE__ */ u("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
1274
+ /* @__PURE__ */ c("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
1274
1275
  "Your current access level: ",
1275
- /* @__PURE__ */ n("strong", { children: i })
1276
+ /* @__PURE__ */ s("strong", { children: i })
1276
1277
  ] })
1277
- ] }) : /* @__PURE__ */ u(B, { children: [
1278
- /* @__PURE__ */ n("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: "You don't have the required permissions to view this content." }),
1279
- t && t.length > 0 && /* @__PURE__ */ u("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
1278
+ ] }) : /* @__PURE__ */ c(H, { children: [
1279
+ /* @__PURE__ */ s("p", { style: { color: "#856404", fontSize: "14px", marginBottom: "10px" }, children: "You don't have the required permissions to view this content." }),
1280
+ t && t.length > 0 && /* @__PURE__ */ c("p", { style: { color: "#6c757d", fontSize: "12px" }, children: [
1280
1281
  "Required permissions: ",
1281
- /* @__PURE__ */ n("strong", { children: t.join(", ") })
1282
+ /* @__PURE__ */ s("strong", { children: t.join(", ") })
1282
1283
  ] })
1283
1284
  ] })
1284
1285
  ]
1285
1286
  }
1286
- ), Ie = (i, e) => {
1287
+ ), He = (i, e) => {
1287
1288
  const t = {
1288
- [J.USER]: 1,
1289
- [J.TENANT_ADMIN]: 2,
1290
- [J.SUPERUSER]: 3
1289
+ [X.USER]: 1,
1290
+ [X.TENANT_ADMIN]: 2,
1291
+ [X.SUPERUSER]: 3
1291
1292
  };
1292
1293
  return t[i] >= t[e];
1293
1294
  };
1294
- function it({
1295
+ function lt({
1295
1296
  children: i,
1296
1297
  fallback: e,
1297
1298
  minUserType: t,
1298
1299
  requiredPermissions: r,
1299
- requireAllPermissions: s = !1
1300
+ requireAllPermissions: n = !1
1300
1301
  }) {
1301
- const { hasValidSession: a, sessionManager: v, hasPermission: T, hasAnyPermission: M, hasAllPermissions: P } = se();
1302
- if (!a())
1303
- return /* @__PURE__ */ n(B, { children: e || /* @__PURE__ */ n(de, {}) });
1304
- const g = v.getUser();
1302
+ const { hasValidSession: o, sessionManager: m, hasPermission: T, hasAnyPermission: M, hasAllPermissions: P } = ne();
1303
+ if (!o())
1304
+ return /* @__PURE__ */ s(H, { children: e || /* @__PURE__ */ s(ue, {}) });
1305
+ const g = m.getUser();
1305
1306
  if (!g)
1306
- return /* @__PURE__ */ n(B, { children: e || /* @__PURE__ */ n(de, {}) });
1307
- if (t && !Ie(g.userType, t))
1308
- return /* @__PURE__ */ n(ue, { userType: g.userType, minUserType: t });
1309
- if (r && r.length > 0 && !(s ? P(r) : M(r))) {
1307
+ return /* @__PURE__ */ s(H, { children: e || /* @__PURE__ */ s(ue, {}) });
1308
+ if (t && !He(g.userType, t))
1309
+ return /* @__PURE__ */ s(he, { userType: g.userType, minUserType: t });
1310
+ if (r && r.length > 0 && !(n ? P(r) : M(r))) {
1310
1311
  const x = r.filter((p) => !T(p)).map((p) => typeof p == "string" ? p : p.name);
1311
- return /* @__PURE__ */ n(ue, { missingPermissions: x });
1312
+ return /* @__PURE__ */ s(he, { missingPermissions: x });
1312
1313
  }
1313
- return /* @__PURE__ */ n(B, { children: i });
1314
+ return /* @__PURE__ */ s(H, { children: i });
1314
1315
  }
1315
- const He = ({ redirectPath: i }) => /* @__PURE__ */ n(
1316
+ const Ce = ({ redirectPath: i }) => /* @__PURE__ */ s(
1316
1317
  "div",
1317
1318
  {
1318
1319
  style: {
@@ -1325,7 +1326,7 @@ const He = ({ redirectPath: i }) => /* @__PURE__ */ n(
1325
1326
  backgroundColor: "#f9fafb",
1326
1327
  textAlign: "center"
1327
1328
  },
1328
- children: /* @__PURE__ */ u(
1329
+ children: /* @__PURE__ */ c(
1329
1330
  "div",
1330
1331
  {
1331
1332
  style: {
@@ -1336,10 +1337,10 @@ const He = ({ redirectPath: i }) => /* @__PURE__ */ n(
1336
1337
  maxWidth: "400px"
1337
1338
  },
1338
1339
  children: [
1339
- /* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🔒" }),
1340
- /* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Access Required" }),
1341
- /* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You need to be signed in to access this page." }),
1342
- /* @__PURE__ */ u("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
1340
+ /* @__PURE__ */ s("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🔒" }),
1341
+ /* @__PURE__ */ s("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Access Required" }),
1342
+ /* @__PURE__ */ s("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You need to be signed in to access this page." }),
1343
+ /* @__PURE__ */ c("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
1343
1344
  "Redirecting to ",
1344
1345
  i,
1345
1346
  "..."
@@ -1348,11 +1349,11 @@ const He = ({ redirectPath: i }) => /* @__PURE__ */ n(
1348
1349
  }
1349
1350
  )
1350
1351
  }
1351
- ), he = ({
1352
+ ), ge = ({
1352
1353
  userType: i,
1353
1354
  minUserType: e,
1354
1355
  missingPermissions: t
1355
- }) => /* @__PURE__ */ n(
1356
+ }) => /* @__PURE__ */ s(
1356
1357
  "div",
1357
1358
  {
1358
1359
  style: {
@@ -1365,7 +1366,7 @@ const He = ({ redirectPath: i }) => /* @__PURE__ */ n(
1365
1366
  backgroundColor: "#f9fafb",
1366
1367
  textAlign: "center"
1367
1368
  },
1368
- children: /* @__PURE__ */ u(
1369
+ children: /* @__PURE__ */ c(
1369
1370
  "div",
1370
1371
  {
1371
1372
  style: {
@@ -1376,23 +1377,23 @@ const He = ({ redirectPath: i }) => /* @__PURE__ */ n(
1376
1377
  maxWidth: "400px"
1377
1378
  },
1378
1379
  children: [
1379
- /* @__PURE__ */ n("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "⚠️" }),
1380
- /* @__PURE__ */ n("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Insufficient Permissions" }),
1381
- e && i ? /* @__PURE__ */ u(B, { children: [
1382
- /* @__PURE__ */ u("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: [
1380
+ /* @__PURE__ */ s("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "⚠️" }),
1381
+ /* @__PURE__ */ s("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Insufficient Permissions" }),
1382
+ e && i ? /* @__PURE__ */ c(H, { children: [
1383
+ /* @__PURE__ */ c("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: [
1383
1384
  "This page requires ",
1384
- /* @__PURE__ */ n("strong", { children: e }),
1385
+ /* @__PURE__ */ s("strong", { children: e }),
1385
1386
  " access level or higher."
1386
1387
  ] }),
1387
- /* @__PURE__ */ u("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
1388
+ /* @__PURE__ */ c("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
1388
1389
  "Your current access level: ",
1389
- /* @__PURE__ */ n("strong", { children: i })
1390
+ /* @__PURE__ */ s("strong", { children: i })
1390
1391
  ] })
1391
- ] }) : /* @__PURE__ */ u(B, { children: [
1392
- /* @__PURE__ */ n("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: "You don't have the required permissions to access this page." }),
1393
- t && t.length > 0 && /* @__PURE__ */ u("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
1392
+ ] }) : /* @__PURE__ */ c(H, { children: [
1393
+ /* @__PURE__ */ s("p", { style: { color: "#6b7280", marginBottom: "1rem" }, children: "You don't have the required permissions to access this page." }),
1394
+ t && t.length > 0 && /* @__PURE__ */ c("p", { style: { color: "#9ca3af", fontSize: "0.875rem" }, children: [
1394
1395
  "Required permissions: ",
1395
- /* @__PURE__ */ n("strong", { children: t.join(", ") })
1396
+ /* @__PURE__ */ s("strong", { children: t.join(", ") })
1396
1397
  ] })
1397
1398
  ] })
1398
1399
  ]
@@ -1401,38 +1402,126 @@ const He = ({ redirectPath: i }) => /* @__PURE__ */ n(
1401
1402
  }
1402
1403
  ), $e = (i, e) => {
1403
1404
  const t = {
1404
- [J.USER]: 1,
1405
- [J.TENANT_ADMIN]: 2,
1406
- [J.SUPERUSER]: 3
1405
+ [X.USER]: 1,
1406
+ [X.TENANT_ADMIN]: 2,
1407
+ [X.SUPERUSER]: 3
1407
1408
  };
1408
1409
  return t[i] >= t[e];
1409
1410
  };
1410
- function ot({
1411
+ function ct({
1411
1412
  children: i,
1412
1413
  redirectTo: e = "/login",
1413
1414
  minUserType: t,
1414
1415
  requiredPermissions: r,
1415
- requireAllPermissions: s = !1,
1416
- fallback: a
1416
+ requireAllPermissions: n = !1,
1417
+ fallback: o
1417
1418
  }) {
1418
- const { hasValidSession: v, sessionManager: T, hasPermission: M, hasAnyPermission: P, hasAllPermissions: g } = se(), h = me();
1419
- if (!v())
1420
- return a ? /* @__PURE__ */ n(B, { children: a }) : /* @__PURE__ */ u(B, { children: [
1421
- /* @__PURE__ */ n(He, { redirectPath: e }),
1422
- /* @__PURE__ */ n(ae, { to: e, state: { from: h.pathname }, replace: !0 })
1419
+ const { hasValidSession: m, sessionManager: T, hasPermission: M, hasAnyPermission: P, hasAllPermissions: g } = ne(), h = ae();
1420
+ if (!m())
1421
+ return o ? /* @__PURE__ */ s(H, { children: o }) : /* @__PURE__ */ c(H, { children: [
1422
+ /* @__PURE__ */ s(Ce, { redirectPath: e }),
1423
+ /* @__PURE__ */ s(ie, { to: e, state: { from: h.pathname }, replace: !0 })
1423
1424
  ] });
1424
1425
  const x = T.getUser();
1425
1426
  if (!x)
1426
- return /* @__PURE__ */ n(ae, { to: e, state: { from: h.pathname }, replace: !0 });
1427
+ return /* @__PURE__ */ s(ie, { to: e, state: { from: h.pathname }, replace: !0 });
1427
1428
  if (t && !$e(x.userType, t))
1428
- return /* @__PURE__ */ n(he, { userType: x.userType, minUserType: t });
1429
- if (r && r.length > 0 && !(s ? g(r) : P(r))) {
1429
+ return /* @__PURE__ */ s(ge, { userType: x.userType, minUserType: t });
1430
+ if (r && r.length > 0 && !(n ? g(r) : P(r))) {
1430
1431
  const A = r.filter((F) => !M(F)).map((F) => typeof F == "string" ? F : F.name);
1431
- return /* @__PURE__ */ n(he, { missingPermissions: A });
1432
+ return /* @__PURE__ */ s(ge, { missingPermissions: A });
1433
+ }
1434
+ return /* @__PURE__ */ s(H, { children: i });
1435
+ }
1436
+ const Le = ({ redirectPath: i }) => /* @__PURE__ */ s(
1437
+ "div",
1438
+ {
1439
+ style: {
1440
+ display: "flex",
1441
+ flexDirection: "column",
1442
+ justifyContent: "center",
1443
+ alignItems: "center",
1444
+ minHeight: "100vh",
1445
+ padding: "2rem",
1446
+ backgroundColor: "#f9fafb",
1447
+ textAlign: "center"
1448
+ },
1449
+ children: /* @__PURE__ */ c(
1450
+ "div",
1451
+ {
1452
+ style: {
1453
+ backgroundColor: "#ffffff",
1454
+ padding: "2rem",
1455
+ borderRadius: "8px",
1456
+ boxShadow: "0 2px 10px rgba(0, 0, 0, 0.1)",
1457
+ maxWidth: "400px"
1458
+ },
1459
+ children: [
1460
+ /* @__PURE__ */ s("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🏢" }),
1461
+ /* @__PURE__ */ s("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Tenant Required" }),
1462
+ /* @__PURE__ */ s("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "This page requires a tenant context to access." }),
1463
+ /* @__PURE__ */ c("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
1464
+ "Redirecting to ",
1465
+ i,
1466
+ "..."
1467
+ ] })
1468
+ ]
1469
+ }
1470
+ )
1471
+ }
1472
+ );
1473
+ function dt({ children: i, redirectTo: e = "/", fallback: t }) {
1474
+ const { tenant: r, isLoading: n, error: o } = K(), m = ae();
1475
+ return n || o ? null : r ? /* @__PURE__ */ s(H, { children: i }) : t ? /* @__PURE__ */ s(H, { children: t }) : /* @__PURE__ */ c(H, { children: [
1476
+ /* @__PURE__ */ s(Le, { redirectPath: e }),
1477
+ /* @__PURE__ */ s(ie, { to: e, state: { from: m.pathname }, replace: !0 })
1478
+ ] });
1479
+ }
1480
+ const De = ({ redirectPath: i }) => /* @__PURE__ */ s(
1481
+ "div",
1482
+ {
1483
+ style: {
1484
+ display: "flex",
1485
+ flexDirection: "column",
1486
+ justifyContent: "center",
1487
+ alignItems: "center",
1488
+ minHeight: "100vh",
1489
+ padding: "2rem",
1490
+ backgroundColor: "#f9fafb",
1491
+ textAlign: "center"
1492
+ },
1493
+ children: /* @__PURE__ */ c(
1494
+ "div",
1495
+ {
1496
+ style: {
1497
+ backgroundColor: "#ffffff",
1498
+ padding: "2rem",
1499
+ borderRadius: "8px",
1500
+ boxShadow: "0 2px 10px rgba(0, 0, 0, 0.1)",
1501
+ maxWidth: "400px"
1502
+ },
1503
+ children: [
1504
+ /* @__PURE__ */ s("div", { style: { fontSize: "3rem", marginBottom: "1rem" }, children: "🚀" }),
1505
+ /* @__PURE__ */ s("h2", { style: { color: "#374151", marginBottom: "1rem" }, children: "Tenant Detected" }),
1506
+ /* @__PURE__ */ s("p", { style: { color: "#6b7280", marginBottom: "1.5rem" }, children: "You are accessing a tenant-specific context. Redirecting to the appropriate page." }),
1507
+ /* @__PURE__ */ c("p", { style: { fontSize: "0.875rem", color: "#9ca3af" }, children: [
1508
+ "Redirecting to ",
1509
+ i,
1510
+ "..."
1511
+ ] })
1512
+ ]
1513
+ }
1514
+ )
1432
1515
  }
1433
- return /* @__PURE__ */ n(B, { children: i });
1516
+ );
1517
+ function ut({ children: i, redirectTo: e = "/dashboard", fallback: t }) {
1518
+ const { tenant: r, isLoading: n, error: o } = K(), m = ae();
1519
+ return n || o ? null : r ? t ? /* @__PURE__ */ s(H, { children: t }) : /* @__PURE__ */ c(H, { children: [
1520
+ /* @__PURE__ */ s(De, { redirectPath: e }),
1521
+ /* @__PURE__ */ s(ie, { to: e, state: { from: m.pathname }, replace: !0 })
1522
+ ] }) : /* @__PURE__ */ s(H, { children: i });
1434
1523
  }
1435
- const Ce = () => /* @__PURE__ */ u(
1524
+ const Be = () => /* @__PURE__ */ c(
1436
1525
  "div",
1437
1526
  {
1438
1527
  style: {
@@ -1444,19 +1533,19 @@ const Ce = () => /* @__PURE__ */ u(
1444
1533
  color: "#dc2626"
1445
1534
  },
1446
1535
  children: [
1447
- /* @__PURE__ */ n("h3", { style: { margin: "0 0 1rem 0" }, children: "🔒 Subscription Required" }),
1448
- /* @__PURE__ */ n("p", { style: { margin: 0 }, children: "This feature requires a higher subscription plan. Please upgrade your plan to access this content." })
1536
+ /* @__PURE__ */ s("h3", { style: { margin: "0 0 1rem 0" }, children: "🔒 Subscription Required" }),
1537
+ /* @__PURE__ */ s("p", { style: { margin: 0 }, children: "This feature requires a higher subscription plan. Please upgrade your plan to access this content." })
1449
1538
  ]
1450
1539
  }
1451
1540
  );
1452
- function at({
1541
+ function ht({
1453
1542
  children: i,
1454
- fallback: e = /* @__PURE__ */ n(Ce, {}),
1543
+ fallback: e = /* @__PURE__ */ s(Be, {}),
1455
1544
  allowedPlans: t,
1456
1545
  requiredFeature: r
1457
1546
  }) {
1458
- const { subscription: s, hasAllowedPlan: a, isFeatureEnabled: v, loading: T } = Fe();
1459
- return T ? /* @__PURE__ */ n(
1547
+ const { subscription: n, hasAllowedPlan: o, isFeatureEnabled: m, loading: T } = Ie();
1548
+ return T ? /* @__PURE__ */ s(
1460
1549
  "div",
1461
1550
  {
1462
1551
  style: {
@@ -1466,9 +1555,9 @@ function at({
1466
1555
  },
1467
1556
  children: "Loading subscription..."
1468
1557
  }
1469
- ) : s ? s.isActive ? t && t.length > 0 && !a(t) ? /* @__PURE__ */ n(B, { children: e }) : r && !v(r) ? /* @__PURE__ */ n(B, { children: e }) : /* @__PURE__ */ n(B, { children: i }) : /* @__PURE__ */ n(B, { children: e }) : /* @__PURE__ */ n(B, { children: e });
1558
+ ) : n ? n.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ s(H, { children: e }) : r && !m(r) ? /* @__PURE__ */ s(H, { children: e }) : /* @__PURE__ */ s(H, { children: i }) : /* @__PURE__ */ s(H, { children: e }) : /* @__PURE__ */ s(H, { children: e });
1470
1559
  }
1471
- const Le = ({ flagName: i }) => /* @__PURE__ */ u(
1560
+ const qe = ({ flagName: i }) => /* @__PURE__ */ c(
1472
1561
  "div",
1473
1562
  {
1474
1563
  style: {
@@ -1485,9 +1574,9 @@ const Le = ({ flagName: i }) => /* @__PURE__ */ u(
1485
1574
  color: "#6c757d"
1486
1575
  },
1487
1576
  children: [
1488
- /* @__PURE__ */ n("div", { style: { fontSize: "24px", marginBottom: "8px" }, children: "🚧" }),
1489
- /* @__PURE__ */ n("div", { style: { fontSize: "14px", fontWeight: "500", marginBottom: "4px" }, children: "Feature Not Available" }),
1490
- /* @__PURE__ */ u("div", { style: { fontSize: "12px", opacity: 0.7 }, children: [
1577
+ /* @__PURE__ */ s("div", { style: { fontSize: "24px", marginBottom: "8px" }, children: "🚧" }),
1578
+ /* @__PURE__ */ s("div", { style: { fontSize: "14px", fontWeight: "500", marginBottom: "4px" }, children: "Feature Not Available" }),
1579
+ /* @__PURE__ */ c("div", { style: { fontSize: "12px", opacity: 0.7 }, children: [
1491
1580
  'Feature flag "',
1492
1581
  i,
1493
1582
  '" is disabled'
@@ -1495,9 +1584,9 @@ const Le = ({ flagName: i }) => /* @__PURE__ */ u(
1495
1584
  ]
1496
1585
  }
1497
1586
  );
1498
- function lt({ name: i, children: e, fallback: t }) {
1499
- const { isEnabled: r, loading: s } = Ee();
1500
- return s ? /* @__PURE__ */ n(
1587
+ function gt({ name: i, children: e, fallback: t }) {
1588
+ const { isEnabled: r, loading: n } = Re();
1589
+ return n ? /* @__PURE__ */ s(
1501
1590
  "div",
1502
1591
  {
1503
1592
  style: {
@@ -1510,9 +1599,9 @@ function lt({ name: i, children: e, fallback: t }) {
1510
1599
  },
1511
1600
  children: "Loading feature flags..."
1512
1601
  }
1513
- ) : (console.log(i, r(i)), r(i) ? /* @__PURE__ */ n(B, { children: e }) : /* @__PURE__ */ n(B, { children: t || /* @__PURE__ */ n(Le, { flagName: i }) }));
1602
+ ) : (console.log(i, r(i)), r(i) ? /* @__PURE__ */ s(H, { children: e }) : /* @__PURE__ */ s(H, { children: t || /* @__PURE__ */ s(qe, { flagName: i }) }));
1514
1603
  }
1515
- const De = () => /* @__PURE__ */ u(
1604
+ const Ue = () => /* @__PURE__ */ c(
1516
1605
  "svg",
1517
1606
  {
1518
1607
  width: "16",
@@ -1525,11 +1614,11 @@ const De = () => /* @__PURE__ */ u(
1525
1614
  strokeLinejoin: "round",
1526
1615
  style: { flexShrink: 0 },
1527
1616
  children: [
1528
- /* @__PURE__ */ n("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
1529
- /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
1617
+ /* @__PURE__ */ s("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
1618
+ /* @__PURE__ */ s("circle", { cx: "12", cy: "12", r: "3" })
1530
1619
  ]
1531
1620
  }
1532
- ), Be = () => /* @__PURE__ */ u(
1621
+ ), Ne = () => /* @__PURE__ */ c(
1533
1622
  "svg",
1534
1623
  {
1535
1624
  width: "16",
@@ -1542,14 +1631,14 @@ const De = () => /* @__PURE__ */ u(
1542
1631
  strokeLinejoin: "round",
1543
1632
  style: { flexShrink: 0 },
1544
1633
  children: [
1545
- /* @__PURE__ */ n("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" }),
1546
- /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
1634
+ /* @__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" }),
1635
+ /* @__PURE__ */ s("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
1547
1636
  ]
1548
1637
  }
1549
- ), Ue = {
1550
- showPassword: /* @__PURE__ */ n(De, {}),
1551
- hidePassword: /* @__PURE__ */ n(Be, {})
1552
- }, qe = {
1638
+ ), ze = {
1639
+ showPassword: /* @__PURE__ */ s(Ue, {}),
1640
+ hidePassword: /* @__PURE__ */ s(Ne, {})
1641
+ }, Oe = {
1553
1642
  title: "Sign In",
1554
1643
  emailLabel: "Email",
1555
1644
  emailPlaceholder: "Enter your email",
@@ -1561,7 +1650,7 @@ const De = () => /* @__PURE__ */ u(
1561
1650
  signupText: "Don't have an account?",
1562
1651
  errorMessage: "Invalid email or password",
1563
1652
  loadingText: "Signing in..."
1564
- }, Ne = {
1653
+ }, je = {
1565
1654
  container: {
1566
1655
  maxWidth: "400px",
1567
1656
  width: "100%",
@@ -1668,52 +1757,52 @@ const De = () => /* @__PURE__ */ u(
1668
1757
  fontSize: "0.875rem"
1669
1758
  }
1670
1759
  };
1671
- function ct({
1760
+ function pt({
1672
1761
  copy: i = {},
1673
1762
  styles: e = {},
1674
1763
  icons: t = {},
1675
1764
  onSuccess: r,
1676
- onError: s,
1677
- onForgotPassword: a,
1678
- onSignupClick: v,
1765
+ onError: n,
1766
+ onForgotPassword: o,
1767
+ onSignupClick: m,
1679
1768
  showForgotPassword: T = !0,
1680
1769
  showSignupLink: M = !0,
1681
1770
  className: P
1682
1771
  }) {
1683
- const [g, h] = m(""), [x, p] = m(""), [A, F] = m(!1), [f, C] = m(!1), [y, b] = m(""), [k, R] = m({}), { login: L } = se(), { tenant: E } = Z(), D = { ...qe, ...i }, c = { ...Ne, ...e }, w = { ...Ue, ...t }, d = () => {
1772
+ const [g, h] = b(""), [x, p] = b(""), [A, F] = b(!1), [f, L] = b(!1), [y, S] = b(""), [k, R] = b({}), { login: D } = ne(), { tenant: E } = K(), B = { ...Oe, ...i }, d = { ...je, ...e }, w = { ...ze, ...t }, u = () => {
1684
1773
  const I = {};
1685
1774
  return g.trim() || (I.email = !0), x.trim() || (I.password = !0), R(I), Object.keys(I).length === 0;
1686
- }, o = async (I) => {
1687
- if (I.preventDefault(), !!d()) {
1775
+ }, a = async (I) => {
1776
+ if (I.preventDefault(), !!u()) {
1688
1777
  if (!(E != null && E.id)) {
1689
- b("Tenant not found");
1778
+ S("Tenant not found");
1690
1779
  return;
1691
1780
  }
1692
- C(!0), b("");
1781
+ L(!0), S("");
1693
1782
  try {
1694
- const N = await L(g, x, E.id);
1783
+ const N = await D(g, x, E.id);
1695
1784
  r == null || r(N);
1696
1785
  } catch (N) {
1697
- const _ = N.message || D.errorMessage;
1698
- b(_), s == null || s(_);
1786
+ const _ = N.message || B.errorMessage;
1787
+ S(_), n == null || n(_);
1699
1788
  } finally {
1700
- C(!1);
1789
+ L(!1);
1701
1790
  }
1702
1791
  }
1703
1792
  }, l = (I) => ({
1704
- ...c.input,
1705
- ...k[I] ? c.inputError : {}
1793
+ ...d.input,
1794
+ ...k[I] ? d.inputError : {}
1706
1795
  }), W = () => ({
1707
- ...c.button,
1708
- ...f ? c.buttonLoading : {},
1709
- ...!g || !x || f ? c.buttonDisabled : {}
1796
+ ...d.button,
1797
+ ...f ? d.buttonLoading : {},
1798
+ ...!g || !x || f ? d.buttonDisabled : {}
1710
1799
  });
1711
- return /* @__PURE__ */ u("div", { className: P, style: c.container, children: [
1712
- /* @__PURE__ */ n("h2", { style: c.title, children: D.title }),
1713
- /* @__PURE__ */ u("form", { onSubmit: o, style: c.form, children: [
1714
- /* @__PURE__ */ u("div", { style: c.fieldGroup, children: [
1715
- /* @__PURE__ */ n("label", { style: c.label, children: D.emailLabel }),
1716
- /* @__PURE__ */ n(
1800
+ return /* @__PURE__ */ c("div", { className: P, style: d.container, children: [
1801
+ /* @__PURE__ */ s("h2", { style: d.title, children: B.title }),
1802
+ /* @__PURE__ */ c("form", { onSubmit: a, style: d.form, children: [
1803
+ /* @__PURE__ */ c("div", { style: d.fieldGroup, children: [
1804
+ /* @__PURE__ */ s("label", { style: d.label, children: B.emailLabel }),
1805
+ /* @__PURE__ */ s(
1717
1806
  "input",
1718
1807
  {
1719
1808
  id: "email",
@@ -1723,16 +1812,16 @@ function ct({
1723
1812
  onChange: (I) => {
1724
1813
  h(I.target.value), k.email && R((N) => ({ ...N, email: !1 }));
1725
1814
  },
1726
- placeholder: D.emailPlaceholder,
1815
+ placeholder: B.emailPlaceholder,
1727
1816
  style: l("email"),
1728
1817
  disabled: f
1729
1818
  }
1730
1819
  )
1731
1820
  ] }),
1732
- /* @__PURE__ */ u("div", { style: c.fieldGroup, children: [
1733
- /* @__PURE__ */ n("label", { style: c.label, children: D.passwordLabel }),
1734
- /* @__PURE__ */ u("div", { style: c.inputContainer, children: [
1735
- /* @__PURE__ */ n(
1821
+ /* @__PURE__ */ c("div", { style: d.fieldGroup, children: [
1822
+ /* @__PURE__ */ s("label", { style: d.label, children: B.passwordLabel }),
1823
+ /* @__PURE__ */ c("div", { style: d.inputContainer, children: [
1824
+ /* @__PURE__ */ s(
1736
1825
  "input",
1737
1826
  {
1738
1827
  id: "password",
@@ -1742,7 +1831,7 @@ function ct({
1742
1831
  onChange: (I) => {
1743
1832
  p(I.target.value), k.password && R((N) => ({ ...N, password: !1 }));
1744
1833
  },
1745
- placeholder: D.passwordPlaceholder,
1834
+ placeholder: B.passwordPlaceholder,
1746
1835
  style: {
1747
1836
  ...l("password"),
1748
1837
  paddingRight: "2.5rem"
@@ -1751,12 +1840,12 @@ function ct({
1751
1840
  disabled: f
1752
1841
  }
1753
1842
  ),
1754
- /* @__PURE__ */ n(
1843
+ /* @__PURE__ */ s(
1755
1844
  "button",
1756
1845
  {
1757
1846
  type: "button",
1758
1847
  onClick: () => F(!A),
1759
- style: c.passwordToggle,
1848
+ style: d.passwordToggle,
1760
1849
  disabled: f,
1761
1850
  "aria-label": A ? "Hide password" : "Show password",
1762
1851
  children: A ? w.hidePassword : w.showPassword
@@ -1764,23 +1853,23 @@ function ct({
1764
1853
  )
1765
1854
  ] })
1766
1855
  ] }),
1767
- /* @__PURE__ */ n("button", { type: "submit", disabled: !g || !x || f, style: W(), children: f ? D.loadingText : D.submitButton }),
1768
- y && /* @__PURE__ */ n("div", { style: c.errorText, children: y })
1856
+ /* @__PURE__ */ s("button", { type: "submit", disabled: !g || !x || f, style: W(), children: f ? B.loadingText : B.submitButton }),
1857
+ y && /* @__PURE__ */ s("div", { style: d.errorText, children: y })
1769
1858
  ] }),
1770
- (T || M) && /* @__PURE__ */ u("div", { style: c.linkContainer, children: [
1771
- T && /* @__PURE__ */ n("a", { onClick: a, style: c.link, children: D.forgotPasswordLink }),
1772
- T && M && /* @__PURE__ */ n("div", { style: c.divider, children: "•" }),
1773
- M && /* @__PURE__ */ u("div", { children: [
1774
- /* @__PURE__ */ u("span", { style: c.divider, children: [
1775
- D.signupText,
1859
+ (T || M) && /* @__PURE__ */ c("div", { style: d.linkContainer, children: [
1860
+ T && /* @__PURE__ */ s("a", { onClick: o, style: d.link, children: B.forgotPasswordLink }),
1861
+ T && M && /* @__PURE__ */ s("div", { style: d.divider, children: "•" }),
1862
+ M && /* @__PURE__ */ c("div", { children: [
1863
+ /* @__PURE__ */ c("span", { style: d.divider, children: [
1864
+ B.signupText,
1776
1865
  " "
1777
1866
  ] }),
1778
- /* @__PURE__ */ n("a", { onClick: v, style: c.link, children: D.signupLink })
1867
+ /* @__PURE__ */ s("a", { onClick: m, style: d.link, children: B.signupLink })
1779
1868
  ] })
1780
1869
  ] })
1781
1870
  ] });
1782
1871
  }
1783
- const Oe = {
1872
+ const Ve = {
1784
1873
  title: "Create Account",
1785
1874
  nameLabel: "Full Name",
1786
1875
  namePlaceholder: "Enter your full name",
@@ -1800,7 +1889,7 @@ const Oe = {
1800
1889
  passwordMismatchError: "Passwords do not match",
1801
1890
  isAdminLabel: "Create new organization",
1802
1891
  isAdminDescription: "Check this if you want to create a new organization"
1803
- }, ze = {
1892
+ }, We = {
1804
1893
  container: {
1805
1894
  maxWidth: "400px",
1806
1895
  width: "100%",
@@ -1899,154 +1988,154 @@ const Oe = {
1899
1988
  fontSize: "0.875rem"
1900
1989
  }
1901
1990
  };
1902
- function dt({
1991
+ function ft({
1903
1992
  copy: i = {},
1904
1993
  styles: e = {},
1905
1994
  signupType: t = "user",
1906
1995
  onSuccess: r,
1907
- onError: s,
1908
- onLoginClick: a,
1909
- showLoginLink: v = !0,
1996
+ onError: n,
1997
+ onLoginClick: o,
1998
+ showLoginLink: m = !0,
1910
1999
  className: T
1911
2000
  }) {
1912
- const [M, P] = m(""), [g, h] = m(""), [x, p] = m(""), [A, F] = m(""), [f, C] = m(""), [y, b] = m(!1), [k, R] = m(""), [L, E] = m({}), { signup: D, signupTenantAdmin: c } = se(), { tenant: w } = Z(), d = { ...Oe, ...i }, o = { ...ze, ...e }, l = () => {
1913
- const H = {};
1914
- return M.trim() || (H.name = !0), g.trim() || (H.email = !0), x.trim() || (H.password = !0), A.trim() || (H.confirmPassword = !0), t === "tenant" && !f.trim() && (H.tenantName = !0), E(H), Object.keys(H).length === 0;
1915
- }, W = async (H) => {
1916
- if (H.preventDefault(), !!l()) {
2001
+ const [M, P] = b(""), [g, h] = b(""), [x, p] = b(""), [A, F] = b(""), [f, L] = b(""), [y, S] = b(!1), [k, R] = b(""), [D, E] = b({}), { signup: B, signupTenantAdmin: d } = ne(), { tenant: w } = K(), u = { ...Ve, ...i }, a = { ...We, ...e }, l = () => {
2002
+ const C = {};
2003
+ return M.trim() || (C.name = !0), g.trim() || (C.email = !0), x.trim() || (C.password = !0), A.trim() || (C.confirmPassword = !0), t === "tenant" && !f.trim() && (C.tenantName = !0), E(C), Object.keys(C).length === 0;
2004
+ }, W = async (C) => {
2005
+ if (C.preventDefault(), !!l()) {
1917
2006
  if (x !== A) {
1918
- R(d.passwordMismatchError), E({ confirmPassword: !0 });
2007
+ R(u.passwordMismatchError), E({ confirmPassword: !0 });
1919
2008
  return;
1920
2009
  }
1921
2010
  if (t === "user" && !(w != null && w.id)) {
1922
2011
  R("Tenant not found");
1923
2012
  return;
1924
2013
  }
1925
- b(!0), R("");
2014
+ S(!0), R("");
1926
2015
  try {
1927
- let q;
1928
- t === "tenant" ? q = await c(g, M, x, f) : q = await D(g, M, x, w.id), r == null || r(q);
1929
- } catch (q) {
1930
- const Y = q.message || d.errorMessage;
1931
- R(Y), s == null || s(Y);
2016
+ let U;
2017
+ t === "tenant" ? U = await d(g, M, x, f) : U = await B(g, M, x, w.id), r == null || r(U);
2018
+ } catch (U) {
2019
+ const Q = U.message || u.errorMessage;
2020
+ R(Q), n == null || n(Q);
1932
2021
  } finally {
1933
- b(!1);
2022
+ S(!1);
1934
2023
  }
1935
2024
  }
1936
- }, I = (H) => ({
1937
- ...o.input,
1938
- ...L[H] ? o.inputError : {}
2025
+ }, I = (C) => ({
2026
+ ...a.input,
2027
+ ...D[C] ? a.inputError : {}
1939
2028
  }), N = () => ({
1940
- ...o.button,
1941
- ...y ? o.buttonLoading : {},
1942
- ...!M || !g || !x || !A || y || t === "tenant" && !f ? o.buttonDisabled : {}
2029
+ ...a.button,
2030
+ ...y ? a.buttonLoading : {},
2031
+ ...!M || !g || !x || !A || y || t === "tenant" && !f ? a.buttonDisabled : {}
1943
2032
  }), _ = M && g && x && A && (t === "user" || f);
1944
- return /* @__PURE__ */ u("div", { className: T, style: o.container, children: [
1945
- /* @__PURE__ */ n("h2", { style: o.title, children: d.title }),
1946
- /* @__PURE__ */ u("form", { onSubmit: W, style: o.form, children: [
1947
- /* @__PURE__ */ u("div", { style: o.fieldGroup, children: [
1948
- /* @__PURE__ */ n("label", { style: o.label, children: d.nameLabel }),
1949
- /* @__PURE__ */ n(
2033
+ return /* @__PURE__ */ c("div", { className: T, style: a.container, children: [
2034
+ /* @__PURE__ */ s("h2", { style: a.title, children: u.title }),
2035
+ /* @__PURE__ */ c("form", { onSubmit: W, style: a.form, children: [
2036
+ /* @__PURE__ */ c("div", { style: a.fieldGroup, children: [
2037
+ /* @__PURE__ */ s("label", { style: a.label, children: u.nameLabel }),
2038
+ /* @__PURE__ */ s(
1950
2039
  "input",
1951
2040
  {
1952
2041
  id: "name",
1953
2042
  name: "name",
1954
2043
  type: "text",
1955
2044
  value: M,
1956
- onChange: (H) => {
1957
- P(H.target.value), L.name && E((q) => ({ ...q, name: !1 }));
2045
+ onChange: (C) => {
2046
+ P(C.target.value), D.name && E((U) => ({ ...U, name: !1 }));
1958
2047
  },
1959
- placeholder: d.namePlaceholder,
2048
+ placeholder: u.namePlaceholder,
1960
2049
  style: I("name"),
1961
2050
  disabled: y
1962
2051
  }
1963
2052
  )
1964
2053
  ] }),
1965
- /* @__PURE__ */ u("div", { style: o.fieldGroup, children: [
1966
- /* @__PURE__ */ n("label", { style: o.label, children: d.emailLabel }),
1967
- /* @__PURE__ */ n(
2054
+ /* @__PURE__ */ c("div", { style: a.fieldGroup, children: [
2055
+ /* @__PURE__ */ s("label", { style: a.label, children: u.emailLabel }),
2056
+ /* @__PURE__ */ s(
1968
2057
  "input",
1969
2058
  {
1970
2059
  id: "email",
1971
2060
  name: "email",
1972
2061
  type: "email",
1973
2062
  value: g,
1974
- onChange: (H) => {
1975
- h(H.target.value), L.email && E((q) => ({ ...q, email: !1 }));
2063
+ onChange: (C) => {
2064
+ h(C.target.value), D.email && E((U) => ({ ...U, email: !1 }));
1976
2065
  },
1977
- placeholder: d.emailPlaceholder,
2066
+ placeholder: u.emailPlaceholder,
1978
2067
  style: I("email"),
1979
2068
  disabled: y
1980
2069
  }
1981
2070
  )
1982
2071
  ] }),
1983
- /* @__PURE__ */ u("div", { style: o.fieldGroup, children: [
1984
- /* @__PURE__ */ n("label", { style: o.label, children: d.passwordLabel }),
1985
- /* @__PURE__ */ n(
2072
+ /* @__PURE__ */ c("div", { style: a.fieldGroup, children: [
2073
+ /* @__PURE__ */ s("label", { style: a.label, children: u.passwordLabel }),
2074
+ /* @__PURE__ */ s(
1986
2075
  "input",
1987
2076
  {
1988
2077
  id: "password",
1989
2078
  name: "password",
1990
2079
  type: "password",
1991
2080
  value: x,
1992
- onChange: (H) => {
1993
- p(H.target.value), L.password && E((q) => ({ ...q, password: !1 }));
2081
+ onChange: (C) => {
2082
+ p(C.target.value), D.password && E((U) => ({ ...U, password: !1 }));
1994
2083
  },
1995
- placeholder: d.passwordPlaceholder,
2084
+ placeholder: u.passwordPlaceholder,
1996
2085
  style: I("password"),
1997
2086
  disabled: y
1998
2087
  }
1999
2088
  )
2000
2089
  ] }),
2001
- /* @__PURE__ */ u("div", { style: o.fieldGroup, children: [
2002
- /* @__PURE__ */ n("label", { style: o.label, children: d.confirmPasswordLabel }),
2003
- /* @__PURE__ */ n(
2090
+ /* @__PURE__ */ c("div", { style: a.fieldGroup, children: [
2091
+ /* @__PURE__ */ s("label", { style: a.label, children: u.confirmPasswordLabel }),
2092
+ /* @__PURE__ */ s(
2004
2093
  "input",
2005
2094
  {
2006
2095
  id: "confirmPassword",
2007
2096
  name: "confirmPassword",
2008
2097
  type: "password",
2009
2098
  value: A,
2010
- onChange: (H) => {
2011
- F(H.target.value), L.confirmPassword && E((q) => ({ ...q, confirmPassword: !1 })), k === d.passwordMismatchError && R("");
2099
+ onChange: (C) => {
2100
+ F(C.target.value), D.confirmPassword && E((U) => ({ ...U, confirmPassword: !1 })), k === u.passwordMismatchError && R("");
2012
2101
  },
2013
- placeholder: d.confirmPasswordPlaceholder,
2102
+ placeholder: u.confirmPasswordPlaceholder,
2014
2103
  style: I("confirmPassword"),
2015
2104
  disabled: y
2016
2105
  }
2017
2106
  )
2018
2107
  ] }),
2019
- t === "tenant" && /* @__PURE__ */ u("div", { style: o.fieldGroup, children: [
2020
- /* @__PURE__ */ n("label", { style: o.label, children: d.tenantNameLabel }),
2021
- /* @__PURE__ */ n(
2108
+ t === "tenant" && /* @__PURE__ */ c("div", { style: a.fieldGroup, children: [
2109
+ /* @__PURE__ */ s("label", { style: a.label, children: u.tenantNameLabel }),
2110
+ /* @__PURE__ */ s(
2022
2111
  "input",
2023
2112
  {
2024
2113
  id: "tenantName",
2025
2114
  name: "tenantName",
2026
2115
  type: "text",
2027
2116
  value: f,
2028
- onChange: (H) => {
2029
- C(H.target.value), L.tenantName && E((q) => ({ ...q, tenantName: !1 }));
2117
+ onChange: (C) => {
2118
+ L(C.target.value), D.tenantName && E((U) => ({ ...U, tenantName: !1 }));
2030
2119
  },
2031
- placeholder: d.tenantNamePlaceholder,
2120
+ placeholder: u.tenantNamePlaceholder,
2032
2121
  style: I("tenantName"),
2033
2122
  disabled: y
2034
2123
  }
2035
2124
  )
2036
2125
  ] }),
2037
- /* @__PURE__ */ n("button", { type: "submit", disabled: !_ || y, style: N(), children: y ? d.loadingText : d.submitButton }),
2038
- k && /* @__PURE__ */ n("div", { style: o.errorText, children: k })
2126
+ /* @__PURE__ */ s("button", { type: "submit", disabled: !_ || y, style: N(), children: y ? u.loadingText : u.submitButton }),
2127
+ k && /* @__PURE__ */ s("div", { style: a.errorText, children: k })
2039
2128
  ] }),
2040
- v && /* @__PURE__ */ u("div", { style: o.linkContainer, children: [
2041
- /* @__PURE__ */ u("span", { style: o.divider, children: [
2042
- d.loginText,
2129
+ m && /* @__PURE__ */ c("div", { style: a.linkContainer, children: [
2130
+ /* @__PURE__ */ c("span", { style: a.divider, children: [
2131
+ u.loginText,
2043
2132
  " "
2044
2133
  ] }),
2045
- /* @__PURE__ */ n("a", { onClick: a, style: o.link, children: d.loginLink })
2134
+ /* @__PURE__ */ s("a", { onClick: o, style: a.link, children: u.loginLink })
2046
2135
  ] })
2047
2136
  ] });
2048
2137
  }
2049
- const je = {
2138
+ const Ge = {
2050
2139
  title: "Reset Password",
2051
2140
  subtitle: "Enter your email address and we'll send you a link to reset your password.",
2052
2141
  emailLabel: "Email",
@@ -2068,7 +2157,7 @@ const je = {
2068
2157
  resetLoadingText: "Resetting...",
2069
2158
  resetSuccessMessage: "Password reset successfully!",
2070
2159
  passwordMismatchError: "Passwords do not match"
2071
- }, Ve = {
2160
+ }, _e = {
2072
2161
  container: {
2073
2162
  maxWidth: "400px",
2074
2163
  margin: "0 auto",
@@ -2160,186 +2249,186 @@ const je = {
2160
2249
  cursor: "pointer"
2161
2250
  }
2162
2251
  };
2163
- function ut({
2252
+ function yt({
2164
2253
  copy: i = {},
2165
2254
  styles: e = {},
2166
2255
  mode: t = "request",
2167
2256
  token: r = "",
2168
- onSuccess: s,
2169
- onError: a,
2170
- onBackToLogin: v,
2257
+ onSuccess: n,
2258
+ onError: o,
2259
+ onBackToLogin: m,
2171
2260
  onModeChange: T,
2172
2261
  className: M
2173
2262
  }) {
2174
- const [P, g] = m(""), [h, x] = m(r), [p, A] = m(""), [F, f] = m(""), [C, y] = m(!1), [b, k] = m(""), [R, L] = m(""), [E, D] = m({}), { requestPasswordReset: c, confirmPasswordReset: w } = se(), { tenant: d } = Z(), o = { ...je, ...i }, l = { ...Ve, ...e }, W = () => {
2175
- const U = {};
2176
- return P.trim() || (U.email = !0), D(U), Object.keys(U).length === 0;
2263
+ const [P, g] = b(""), [h, x] = b(r), [p, A] = b(""), [F, f] = b(""), [L, y] = b(!1), [S, k] = b(""), [R, D] = b(""), [E, B] = b({}), { requestPasswordReset: d, confirmPasswordReset: w } = ne(), { tenant: u } = K(), a = { ...Ge, ...i }, l = { ..._e, ...e }, W = () => {
2264
+ const q = {};
2265
+ return P.trim() || (q.email = !0), B(q), Object.keys(q).length === 0;
2177
2266
  }, I = () => {
2178
- const U = {};
2179
- return h.trim() || (U.token = !0), p.trim() || (U.newPassword = !0), F.trim() || (U.confirmPassword = !0), D(U), Object.keys(U).length === 0;
2180
- }, N = async (U) => {
2181
- if (U.preventDefault(), !!W()) {
2182
- if (!(d != null && d.id)) {
2267
+ const q = {};
2268
+ return h.trim() || (q.token = !0), p.trim() || (q.newPassword = !0), F.trim() || (q.confirmPassword = !0), B(q), Object.keys(q).length === 0;
2269
+ }, N = async (q) => {
2270
+ if (q.preventDefault(), !!W()) {
2271
+ if (!(u != null && u.id)) {
2183
2272
  k("Tenant not found");
2184
2273
  return;
2185
2274
  }
2186
- y(!0), k(""), L("");
2275
+ y(!0), k(""), D("");
2187
2276
  try {
2188
- await c(P, d.id), L(o.successMessage), s == null || s();
2189
- } catch (z) {
2190
- const j = z.message || o.errorMessage;
2191
- k(j), a == null || a(j);
2277
+ await d(P, u.id), D(a.successMessage), n == null || n();
2278
+ } catch (O) {
2279
+ const j = O.message || a.errorMessage;
2280
+ k(j), o == null || o(j);
2192
2281
  } finally {
2193
2282
  y(!1);
2194
2283
  }
2195
2284
  }
2196
- }, _ = async (U) => {
2197
- if (U.preventDefault(), !!I()) {
2285
+ }, _ = async (q) => {
2286
+ if (q.preventDefault(), !!I()) {
2198
2287
  if (p !== F) {
2199
- k(o.passwordMismatchError), D({ confirmPassword: !0 });
2288
+ k(a.passwordMismatchError), B({ confirmPassword: !0 });
2200
2289
  return;
2201
2290
  }
2202
- y(!0), k(""), L("");
2291
+ y(!0), k(""), D("");
2203
2292
  try {
2204
- await w(h, p), L(o.resetSuccessMessage), s == null || s();
2205
- } catch (z) {
2206
- const j = z.message || o.errorMessage;
2207
- k(j), a == null || a(j);
2293
+ await w(h, p), D(a.resetSuccessMessage), n == null || n();
2294
+ } catch (O) {
2295
+ const j = O.message || a.errorMessage;
2296
+ k(j), o == null || o(j);
2208
2297
  } finally {
2209
2298
  y(!1);
2210
2299
  }
2211
2300
  }
2212
- }, H = (U) => ({
2301
+ }, C = (q) => ({
2213
2302
  ...l.input,
2214
- ...E[U] ? l.inputError : {}
2215
- }), q = () => ({
2303
+ ...E[q] ? l.inputError : {}
2304
+ }), U = () => ({
2216
2305
  ...l.button,
2217
- ...C ? l.buttonLoading : {}
2306
+ ...L ? l.buttonLoading : {}
2218
2307
  });
2219
2308
  if (t === "reset") {
2220
- const U = h && p && F;
2221
- return /* @__PURE__ */ u("div", { className: M, style: l.container, children: [
2222
- /* @__PURE__ */ n("h2", { style: l.title, children: o.resetTitle }),
2223
- /* @__PURE__ */ n("p", { style: l.subtitle, children: o.resetSubtitle }),
2224
- /* @__PURE__ */ u("form", { onSubmit: _, style: l.form, children: [
2225
- /* @__PURE__ */ u("div", { style: l.fieldGroup, children: [
2226
- /* @__PURE__ */ n("label", { style: l.label, children: o.tokenLabel }),
2227
- /* @__PURE__ */ n(
2309
+ const q = h && p && F;
2310
+ return /* @__PURE__ */ c("div", { className: M, style: l.container, children: [
2311
+ /* @__PURE__ */ s("h2", { style: l.title, children: a.resetTitle }),
2312
+ /* @__PURE__ */ s("p", { style: l.subtitle, children: a.resetSubtitle }),
2313
+ /* @__PURE__ */ c("form", { onSubmit: _, style: l.form, children: [
2314
+ /* @__PURE__ */ c("div", { style: l.fieldGroup, children: [
2315
+ /* @__PURE__ */ s("label", { style: l.label, children: a.tokenLabel }),
2316
+ /* @__PURE__ */ s(
2228
2317
  "input",
2229
2318
  {
2230
2319
  type: "text",
2231
2320
  value: h,
2232
- onChange: (z) => {
2233
- x(z.target.value), E.token && D((j) => ({ ...j, token: !1 }));
2321
+ onChange: (O) => {
2322
+ x(O.target.value), E.token && B((j) => ({ ...j, token: !1 }));
2234
2323
  },
2235
- placeholder: o.tokenPlaceholder,
2236
- style: H("token"),
2237
- disabled: C
2324
+ placeholder: a.tokenPlaceholder,
2325
+ style: C("token"),
2326
+ disabled: L
2238
2327
  }
2239
2328
  )
2240
2329
  ] }),
2241
- /* @__PURE__ */ u("div", { style: l.fieldGroup, children: [
2242
- /* @__PURE__ */ n("label", { style: l.label, children: o.newPasswordLabel }),
2243
- /* @__PURE__ */ n(
2330
+ /* @__PURE__ */ c("div", { style: l.fieldGroup, children: [
2331
+ /* @__PURE__ */ s("label", { style: l.label, children: a.newPasswordLabel }),
2332
+ /* @__PURE__ */ s(
2244
2333
  "input",
2245
2334
  {
2246
2335
  type: "password",
2247
2336
  value: p,
2248
- onChange: (z) => {
2249
- A(z.target.value), E.newPassword && D((j) => ({ ...j, newPassword: !1 }));
2337
+ onChange: (O) => {
2338
+ A(O.target.value), E.newPassword && B((j) => ({ ...j, newPassword: !1 }));
2250
2339
  },
2251
- placeholder: o.newPasswordPlaceholder,
2252
- style: H("newPassword"),
2253
- disabled: C
2340
+ placeholder: a.newPasswordPlaceholder,
2341
+ style: C("newPassword"),
2342
+ disabled: L
2254
2343
  }
2255
2344
  )
2256
2345
  ] }),
2257
- /* @__PURE__ */ u("div", { style: l.fieldGroup, children: [
2258
- /* @__PURE__ */ n("label", { style: l.label, children: o.confirmPasswordLabel }),
2259
- /* @__PURE__ */ n(
2346
+ /* @__PURE__ */ c("div", { style: l.fieldGroup, children: [
2347
+ /* @__PURE__ */ s("label", { style: l.label, children: a.confirmPasswordLabel }),
2348
+ /* @__PURE__ */ s(
2260
2349
  "input",
2261
2350
  {
2262
2351
  type: "password",
2263
2352
  value: F,
2264
- onChange: (z) => {
2265
- f(z.target.value), E.confirmPassword && D((j) => ({ ...j, confirmPassword: !1 })), b === o.passwordMismatchError && k("");
2353
+ onChange: (O) => {
2354
+ f(O.target.value), E.confirmPassword && B((j) => ({ ...j, confirmPassword: !1 })), S === a.passwordMismatchError && k("");
2266
2355
  },
2267
- placeholder: o.confirmPasswordPlaceholder,
2268
- style: H("confirmPassword"),
2269
- disabled: C
2356
+ placeholder: a.confirmPasswordPlaceholder,
2357
+ style: C("confirmPassword"),
2358
+ disabled: L
2270
2359
  }
2271
2360
  )
2272
2361
  ] }),
2273
- /* @__PURE__ */ n(
2362
+ /* @__PURE__ */ s(
2274
2363
  "button",
2275
2364
  {
2276
2365
  type: "submit",
2277
- disabled: !U || C,
2366
+ disabled: !q || L,
2278
2367
  style: {
2279
- ...q(),
2280
- ...!U || C ? l.buttonDisabled : {}
2368
+ ...U(),
2369
+ ...!q || L ? l.buttonDisabled : {}
2281
2370
  },
2282
- children: C ? o.resetLoadingText : o.resetSubmitButton
2371
+ children: L ? a.resetLoadingText : a.resetSubmitButton
2283
2372
  }
2284
2373
  ),
2285
- b && /* @__PURE__ */ n("div", { style: l.errorText, children: b }),
2286
- R && /* @__PURE__ */ n("div", { style: l.successText, children: R })
2374
+ S && /* @__PURE__ */ s("div", { style: l.errorText, children: S }),
2375
+ R && /* @__PURE__ */ s("div", { style: l.successText, children: R })
2287
2376
  ] }),
2288
- /* @__PURE__ */ u("div", { style: l.linkContainer, children: [
2289
- /* @__PURE__ */ n("a", { onClick: v, style: l.link, children: o.backToLoginLink }),
2290
- T && /* @__PURE__ */ u(B, { children: [
2291
- /* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
2292
- /* @__PURE__ */ n("a", { onClick: () => T("request"), style: l.link, children: "Request New Link" })
2377
+ /* @__PURE__ */ c("div", { style: l.linkContainer, children: [
2378
+ /* @__PURE__ */ s("a", { onClick: m, style: l.link, children: a.backToLoginLink }),
2379
+ T && /* @__PURE__ */ c(H, { children: [
2380
+ /* @__PURE__ */ s("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
2381
+ /* @__PURE__ */ s("a", { onClick: () => T("request"), style: l.link, children: "Request New Link" })
2293
2382
  ] })
2294
2383
  ] })
2295
2384
  ] });
2296
2385
  }
2297
- const Y = P;
2298
- return /* @__PURE__ */ u("div", { className: M, style: l.container, children: [
2299
- /* @__PURE__ */ n("h2", { style: l.title, children: o.title }),
2300
- /* @__PURE__ */ n("p", { style: l.subtitle, children: o.subtitle }),
2301
- /* @__PURE__ */ u("form", { onSubmit: N, style: l.form, children: [
2302
- /* @__PURE__ */ u("div", { style: l.fieldGroup, children: [
2303
- /* @__PURE__ */ n("label", { style: l.label, children: o.emailLabel }),
2304
- /* @__PURE__ */ n(
2386
+ const Q = P;
2387
+ return /* @__PURE__ */ c("div", { className: M, style: l.container, children: [
2388
+ /* @__PURE__ */ s("h2", { style: l.title, children: a.title }),
2389
+ /* @__PURE__ */ s("p", { style: l.subtitle, children: a.subtitle }),
2390
+ /* @__PURE__ */ c("form", { onSubmit: N, style: l.form, children: [
2391
+ /* @__PURE__ */ c("div", { style: l.fieldGroup, children: [
2392
+ /* @__PURE__ */ s("label", { style: l.label, children: a.emailLabel }),
2393
+ /* @__PURE__ */ s(
2305
2394
  "input",
2306
2395
  {
2307
2396
  type: "email",
2308
2397
  value: P,
2309
- onChange: (U) => {
2310
- g(U.target.value), E.email && D((z) => ({ ...z, email: !1 }));
2398
+ onChange: (q) => {
2399
+ g(q.target.value), E.email && B((O) => ({ ...O, email: !1 }));
2311
2400
  },
2312
- placeholder: o.emailPlaceholder,
2313
- style: H("email"),
2314
- disabled: C
2401
+ placeholder: a.emailPlaceholder,
2402
+ style: C("email"),
2403
+ disabled: L
2315
2404
  }
2316
2405
  )
2317
2406
  ] }),
2318
- /* @__PURE__ */ n(
2407
+ /* @__PURE__ */ s(
2319
2408
  "button",
2320
2409
  {
2321
2410
  type: "submit",
2322
- disabled: !Y || C,
2411
+ disabled: !Q || L,
2323
2412
  style: {
2324
- ...q(),
2325
- ...!Y || C ? l.buttonDisabled : {}
2413
+ ...U(),
2414
+ ...!Q || L ? l.buttonDisabled : {}
2326
2415
  },
2327
- children: C ? o.loadingText : o.submitButton
2416
+ children: L ? a.loadingText : a.submitButton
2328
2417
  }
2329
2418
  ),
2330
- b && /* @__PURE__ */ n("div", { style: l.errorText, children: b }),
2331
- R && /* @__PURE__ */ n("div", { style: l.successText, children: R })
2419
+ S && /* @__PURE__ */ s("div", { style: l.errorText, children: S }),
2420
+ R && /* @__PURE__ */ s("div", { style: l.successText, children: R })
2332
2421
  ] }),
2333
- /* @__PURE__ */ u("div", { style: l.linkContainer, children: [
2334
- /* @__PURE__ */ n("a", { onClick: v, style: l.link, children: o.backToLoginLink }),
2335
- T && /* @__PURE__ */ u(B, { children: [
2336
- /* @__PURE__ */ n("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
2337
- /* @__PURE__ */ n("a", { onClick: () => T("reset"), style: l.link, children: "I have a token" })
2422
+ /* @__PURE__ */ c("div", { style: l.linkContainer, children: [
2423
+ /* @__PURE__ */ s("a", { onClick: m, style: l.link, children: a.backToLoginLink }),
2424
+ T && /* @__PURE__ */ c(H, { children: [
2425
+ /* @__PURE__ */ s("span", { style: { margin: "0 0.5rem", color: "#6b7280" }, children: "•" }),
2426
+ /* @__PURE__ */ s("a", { onClick: () => T("reset"), style: l.link, children: "I have a token" })
2338
2427
  ] })
2339
2428
  ] })
2340
2429
  ] });
2341
2430
  }
2342
- class ht {
2431
+ class wt {
2343
2432
  constructor(e, t) {
2344
2433
  this.httpService = e, this.sessionManager = t;
2345
2434
  }
@@ -2360,12 +2449,12 @@ class ht {
2360
2449
  throw new Error("SessionManager is required for private endpoints");
2361
2450
  const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
2362
2451
  e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder);
2363
- const s = `/permissions/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
2452
+ const n = `/permissions/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(n, {
2364
2453
  headers: t
2365
2454
  });
2366
2455
  return {
2367
- permissions: a.data,
2368
- meta: a.meta
2456
+ permissions: o.data,
2457
+ meta: o.meta
2369
2458
  };
2370
2459
  }
2371
2460
  async getPermissionById(e) {
@@ -2400,14 +2489,14 @@ class ht {
2400
2489
  async getAppPermissions(e, t) {
2401
2490
  const r = new URLSearchParams();
2402
2491
  t != null && t.page && r.append("page", t.page.toString()), t != null && t.limit && r.append("limit", t.limit.toString()), t != null && t.sortBy && r.append("sortBy", t.sortBy), t != null && t.sortOrder && r.append("sortOrder", t.sortOrder);
2403
- const s = `/permissions/apps/${e}${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s);
2492
+ const n = `/permissions/apps/${e}${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(n);
2404
2493
  return {
2405
- permissions: a.data,
2406
- meta: a.meta
2494
+ permissions: o.data,
2495
+ meta: o.meta
2407
2496
  };
2408
2497
  }
2409
2498
  }
2410
- class gt {
2499
+ class mt {
2411
2500
  constructor(e, t) {
2412
2501
  this.httpService = e, this.sessionManager = t;
2413
2502
  }
@@ -2424,12 +2513,12 @@ class gt {
2424
2513
  async getSubscriptionPlans(e) {
2425
2514
  const t = await this.sessionManager.getAuthHeaders(), r = new URLSearchParams();
2426
2515
  e != null && e.page && r.append("page", e.page.toString()), e != null && e.limit && r.append("limit", e.limit.toString()), e != null && e.sortBy && r.append("sortBy", e.sortBy), e != null && e.sortOrder && r.append("sortOrder", e.sortOrder), e != null && e.appId && r.append("appId", e.appId);
2427
- const s = `/subscription-plans/${r.toString() ? `?${r.toString()}` : ""}`, a = await this.httpService.get(s, {
2516
+ const n = `/subscription-plans/${r.toString() ? `?${r.toString()}` : ""}`, o = await this.httpService.get(n, {
2428
2517
  headers: t
2429
2518
  });
2430
2519
  return {
2431
- plans: a.data,
2432
- meta: a.meta
2520
+ plans: o.data,
2521
+ meta: o.meta
2433
2522
  };
2434
2523
  }
2435
2524
  async getSubscriptionPlanById(e) {
@@ -2458,7 +2547,7 @@ class gt {
2458
2547
  });
2459
2548
  }
2460
2549
  }
2461
- class pt {
2550
+ class bt {
2462
2551
  constructor(e) {
2463
2552
  this.httpService = e;
2464
2553
  }
@@ -2467,7 +2556,7 @@ class pt {
2467
2556
  return await this.httpService.get("/health");
2468
2557
  }
2469
2558
  }
2470
- class ft {
2559
+ class St {
2471
2560
  // Date string to Date object
2472
2561
  static toDate(e) {
2473
2562
  return new Date(e);
@@ -2493,7 +2582,7 @@ class ft {
2493
2582
  ...e,
2494
2583
  createdAt: this.toDate(e.createdAt),
2495
2584
  updatedAt: this.toDate(e.updatedAt),
2496
- displayName: e.name,
2585
+ displayName: e.lastName ? `${e.name} ${e.lastName}` : e.name,
2497
2586
  isActiveUser: e.isActive
2498
2587
  };
2499
2588
  }
@@ -2584,46 +2673,48 @@ class ft {
2584
2673
  // Transform query parameters for API calls
2585
2674
  static transformQueryParams(e) {
2586
2675
  const t = new URLSearchParams();
2587
- return Object.entries(e).forEach(([r, s]) => {
2588
- s != null && s !== "" && t.append(r, String(s));
2676
+ return Object.entries(e).forEach(([r, n]) => {
2677
+ n != null && n !== "" && t.append(r, String(n));
2589
2678
  }), t;
2590
2679
  }
2591
2680
  }
2592
2681
  export {
2593
- ft as ApiMappers,
2594
- be as AppApiService,
2595
- Je as AppProvider,
2596
- Ae as AuthApiService,
2597
- rt as AuthProvider,
2598
- lt as FeatureFlag,
2599
- Me as FeatureFlagApiService,
2600
- st as FeatureFlagProvider,
2601
- pt as HealthApiService,
2682
+ St as ApiMappers,
2683
+ Se as AppApiService,
2684
+ et as AppProvider,
2685
+ Pe as AuthApiService,
2686
+ it as AuthProvider,
2687
+ gt as FeatureFlag,
2688
+ Ee as FeatureFlagApiService,
2689
+ ot as FeatureFlagProvider,
2690
+ bt as HealthApiService,
2602
2691
  G as HttpService,
2603
- ct as LoginForm,
2604
- ut as PasswordRecoveryForm,
2605
- ht as PermissionApiService,
2606
- it as Protected,
2607
- ot as ProtectedRoute,
2608
- le as RoleApiService,
2609
- xe as SessionManager,
2610
- dt as SignupForm,
2611
- Re as SubscriptionApiService,
2612
- at as SubscriptionGuard,
2613
- gt as SubscriptionPlanApiService,
2614
- nt as SubscriptionProvider,
2615
- ce as TenantApiService,
2616
- Ze as TenantProvider,
2617
- Pe as UserApiService,
2618
- J as UserType,
2619
- Xe as useApi,
2620
- re as useApp,
2621
- se as useAuth,
2622
- Ee as useFeatureFlags,
2623
- tt as useSettings,
2624
- Fe as useSubscription,
2625
- oe as useTenant,
2626
- Z as useTenantInfo,
2627
- et as useTenantSettings
2692
+ ut as LandingRoute,
2693
+ pt as LoginForm,
2694
+ yt as PasswordRecoveryForm,
2695
+ wt as PermissionApiService,
2696
+ lt as Protected,
2697
+ ct as ProtectedRoute,
2698
+ ce as RoleApiService,
2699
+ Ae as SessionManager,
2700
+ ft as SignupForm,
2701
+ Fe as SubscriptionApiService,
2702
+ ht as SubscriptionGuard,
2703
+ mt as SubscriptionPlanApiService,
2704
+ at as SubscriptionProvider,
2705
+ de as TenantApiService,
2706
+ rt as TenantProvider,
2707
+ dt as TenantRoute,
2708
+ ke as UserApiService,
2709
+ X as UserType,
2710
+ tt as useApi,
2711
+ se as useApp,
2712
+ ne as useAuth,
2713
+ Re as useFeatureFlags,
2714
+ nt as useSettings,
2715
+ Ie as useSubscription,
2716
+ le as useTenant,
2717
+ K as useTenantInfo,
2718
+ st as useTenantSettings
2628
2719
  };
2629
2720
  //# sourceMappingURL=index.es.js.map