@skylabs-digital/react-identity-access 1.2.0 → 1.4.0

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