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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/components/FeatureFlag.d.ts +1 -0
  2. package/dist/components/LandingRoute.d.ts +2 -1
  3. package/dist/components/LandingRoute.d.ts.map +1 -1
  4. package/dist/components/LoginForm.d.ts +1 -0
  5. package/dist/components/PasswordRecoveryForm.d.ts +1 -0
  6. package/dist/components/Protected.d.ts +1 -0
  7. package/dist/components/ProtectedRoute.d.ts +1 -0
  8. package/dist/components/SignupForm.d.ts +1 -0
  9. package/dist/components/SubscriptionGuard.d.ts +1 -0
  10. package/dist/components/TenantRoute.d.ts +2 -1
  11. package/dist/components/TenantRoute.d.ts.map +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.es.js +142 -149
  15. package/dist/index.es.js.map +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/providers/AppProvider.d.ts +1 -0
  19. package/dist/providers/AppProvider.d.ts.map +1 -1
  20. package/dist/providers/AuthProvider.d.ts +3 -2
  21. package/dist/providers/AuthProvider.d.ts.map +1 -1
  22. package/dist/providers/FeatureFlagProvider.d.ts +1 -0
  23. package/dist/providers/SubscriptionProvider.d.ts +1 -0
  24. package/dist/providers/TenantProvider.d.ts +1 -0
  25. package/dist/providers/TenantProvider.d.ts.map +1 -1
  26. package/dist/services/AppApiService.d.ts +1 -0
  27. package/dist/services/AuthApiService.d.ts +2 -0
  28. package/dist/services/AuthApiService.d.ts.map +1 -1
  29. package/dist/services/FeatureFlagApiService.d.ts +1 -0
  30. package/dist/services/HealthApiService.d.ts +1 -0
  31. package/dist/services/PermissionApiService.d.ts +1 -0
  32. package/dist/services/RoleApiService.d.ts +1 -0
  33. package/dist/services/SubscriptionApiService.d.ts +1 -0
  34. package/dist/services/SubscriptionPlanApiService.d.ts +1 -0
  35. package/dist/services/TenantApiService.d.ts +1 -0
  36. package/dist/services/UserApiService.d.ts +1 -0
  37. package/dist/types/api.d.ts +3 -0
  38. package/dist/types/api.d.ts.map +1 -1
  39. package/package.json +24 -23
  40. package/CHANGELOG.md +0 -32
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
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";
2
+ import { createContext as te, useState as b, useMemo as z, useCallback as Z, useEffect as Y, useContext as re } from "react";
3
+ import { useLocation as ae, Navigate as ie } from "react-router";
4
4
  class G {
5
5
  // SessionManager instance
6
6
  constructor(e, t = 1e4) {
@@ -65,7 +65,7 @@ class G {
65
65
  return this.request("DELETE", e, void 0, t);
66
66
  }
67
67
  }
68
- class be {
68
+ class Se {
69
69
  constructor(e, t) {
70
70
  this.httpService = e, this.sessionManager = t;
71
71
  }
@@ -124,7 +124,7 @@ class be {
124
124
  })).data;
125
125
  }
126
126
  }
127
- const pe = ee(null), Se = () => /* @__PURE__ */ s(
127
+ const pe = te(null), ve = () => /* @__PURE__ */ s(
128
128
  "div",
129
129
  {
130
130
  style: {
@@ -136,7 +136,7 @@ const pe = ee(null), Se = () => /* @__PURE__ */ s(
136
136
  },
137
137
  children: /* @__PURE__ */ s("div", { children: "Loading application..." })
138
138
  }
139
- ), ve = ({ error: i, retry: e }) => /* @__PURE__ */ c(
139
+ ), xe = ({ error: i, retry: e }) => /* @__PURE__ */ c(
140
140
  "div",
141
141
  {
142
142
  style: {
@@ -170,7 +170,7 @@ const pe = ee(null), Se = () => /* @__PURE__ */ s(
170
170
  ]
171
171
  }
172
172
  );
173
- function Ze({ config: i, children: e }) {
173
+ function et({ config: i, children: e }) {
174
174
  const [t, r] = b(null), [n, o] = b(!0), [m, T] = b(null), M = z(() => {
175
175
  const g = () => {
176
176
  P();
@@ -187,7 +187,7 @@ function Ze({ config: i, children: e }) {
187
187
  }, [i, t, n, m]), P = Z(async () => {
188
188
  try {
189
189
  o(!0), T(null);
190
- const g = new G(i.baseUrl), x = await new be(g, {}).getPublicAppInfo(i.appId);
190
+ const g = new G(i.baseUrl), x = await new Se(g, {}).getPublicAppInfo(i.appId);
191
191
  r(x);
192
192
  } catch (g) {
193
193
  const h = g instanceof Error ? g : new Error("Failed to load app information");
@@ -199,21 +199,21 @@ function Ze({ config: i, children: e }) {
199
199
  if (Y(() => {
200
200
  P();
201
201
  }, [P]), n)
202
- return /* @__PURE__ */ s(H, { children: i.loadingFallback || /* @__PURE__ */ s(Se, {}) });
202
+ return /* @__PURE__ */ s(H, { children: i.loadingFallback || /* @__PURE__ */ s(ve, {}) });
203
203
  if (m) {
204
- const g = typeof i.errorFallback == "function" ? i.errorFallback(m, () => P()) : i.errorFallback || /* @__PURE__ */ s(ve, { error: m, retry: () => P() });
204
+ const g = typeof i.errorFallback == "function" ? i.errorFallback(m, () => P()) : i.errorFallback || /* @__PURE__ */ s(xe, { error: m, retry: () => P() });
205
205
  return /* @__PURE__ */ s(H, { children: g });
206
206
  }
207
207
  return /* @__PURE__ */ s(pe.Provider, { value: M, children: e });
208
208
  }
209
- function re() {
210
- const i = te(pe);
209
+ function se() {
210
+ const i = re(pe);
211
211
  if (!i)
212
212
  throw new Error("useApp must be used within an AppProvider");
213
213
  return i;
214
214
  }
215
- const et = re;
216
- class xe {
215
+ const tt = se;
216
+ class Ae {
217
217
  constructor(e = {}) {
218
218
  this.refreshPromise = null, this.refreshQueue = [], this.storageKey = e.storageKey || "auth_tokens", this.autoRefresh = e.autoRefresh ?? !0, this.refreshThreshold = e.refreshThreshold || 3e5, this.onRefreshFailed = e.onRefreshFailed, this.baseUrl = e.baseUrl || "", this.tokenStorage = e.tokenStorage || {
219
219
  get: () => {
@@ -330,7 +330,7 @@ class xe {
330
330
  return e !== null && !this.isTokenExpired(e);
331
331
  }
332
332
  }
333
- class Ae {
333
+ class Pe {
334
334
  constructor(e) {
335
335
  this.httpService = e;
336
336
  }
@@ -440,7 +440,7 @@ class ce {
440
440
  };
441
441
  }
442
442
  }
443
- class Pe {
443
+ class ke {
444
444
  constructor(e, t) {
445
445
  this.httpService = e, this.sessionManager = t;
446
446
  }
@@ -558,7 +558,7 @@ class de {
558
558
  )).data;
559
559
  }
560
560
  }
561
- const fe = ee(null), ke = () => /* @__PURE__ */ s(
561
+ const fe = te(null), Te = () => /* @__PURE__ */ s(
562
562
  "div",
563
563
  {
564
564
  style: {
@@ -570,7 +570,7 @@ const fe = ee(null), ke = () => /* @__PURE__ */ s(
570
570
  },
571
571
  children: /* @__PURE__ */ s("div", { children: "Loading tenant..." })
572
572
  }
573
- ), Te = ({ error: i, retry: e }) => /* @__PURE__ */ c(
573
+ ), Me = ({ error: i, retry: e }) => /* @__PURE__ */ c(
574
574
  "div",
575
575
  {
576
576
  style: {
@@ -604,8 +604,8 @@ const fe = ee(null), ke = () => /* @__PURE__ */ s(
604
604
  ]
605
605
  }
606
606
  );
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(() => {
607
+ function rt({ config: i, children: e }) {
608
+ const { baseUrl: t, appInfo: r, appId: n } = se(), [o, m] = b(i.initialTenant || null), [T, M] = b(!i.initialTenant), [P, g] = b(null), [h, x] = b(null), [p, A] = b(!1), [F, f] = b(null), L = Z(() => {
609
609
  const d = i.tenantMode || "selector", w = "tenant";
610
610
  if (typeof window > "u") return null;
611
611
  if (d === "subdomain") {
@@ -721,28 +721,22 @@ function tt({ config: i, children: e }) {
721
721
  E
722
722
  ]);
723
723
  if (T)
724
- return /* @__PURE__ */ s(H, { children: i.loadingFallback || /* @__PURE__ */ s(ke, {}) });
724
+ return /* @__PURE__ */ s(H, { children: i.loadingFallback || /* @__PURE__ */ s(Te, {}) });
725
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 || "") });
726
+ const d = typeof i.errorFallback == "function" ? i.errorFallback(P, () => k(y || "")) : i.errorFallback || /* @__PURE__ */ s(Me, { error: P, retry: () => k(y || "") });
727
727
  return /* @__PURE__ */ s(H, { children: d });
728
728
  }
729
729
  return /* @__PURE__ */ s(fe.Provider, { value: B, children: e });
730
730
  }
731
731
  function le() {
732
- const i = te(fe);
732
+ const i = re(fe);
733
733
  if (!i)
734
734
  throw new Error("useTenant must be used within a TenantProvider");
735
735
  return i;
736
736
  }
737
- const rt = le;
738
- function st() {
739
- const {
740
- settings: i,
741
- settingsSchema: e,
742
- isSettingsLoading: t,
743
- settingsError: r,
744
- validateSettings: n
745
- } = le();
737
+ const st = le;
738
+ function nt() {
739
+ const { settings: i, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: n } = le();
746
740
  return {
747
741
  settings: i,
748
742
  settingsSchema: e,
@@ -761,9 +755,9 @@ function K() {
761
755
  retry: n
762
756
  };
763
757
  }
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(() => {
758
+ const ye = te(null);
759
+ function it({ config: i = {}, children: e }) {
760
+ const { appId: t, baseUrl: r } = se(), n = K(), o = (n == null ? void 0 : n.tenantSlug) || null, [m, T] = b(i.initialRoles || []), [M, P] = b(!i.initialRoles), [g, h] = b(null), [x, p] = b(!1), [A, F] = b(null), f = z(() => {
767
761
  const d = o ? `auth_tokens_${o}` : "auth_tokens", w = {
768
762
  get: () => {
769
763
  try {
@@ -786,7 +780,7 @@ function nt({ config: i = {}, children: e }) {
786
780
  }
787
781
  }
788
782
  };
789
- return new xe({
783
+ return new Ae({
790
784
  onRefreshFailed: i.onRefreshFailed,
791
785
  tokenStorage: w,
792
786
  baseUrl: r
@@ -794,7 +788,7 @@ function nt({ config: i = {}, children: e }) {
794
788
  }, [o, r, i.onRefreshFailed]), L = z(() => {
795
789
  const d = new G(r);
796
790
  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]);
791
+ }, [r, f]), y = z(() => new Pe(new G(r)), [r]), S = z(() => new ke(L, f), [L, f]), k = z(() => new ce(new G(r)), [r]), R = z(() => g || f.getUser(), [g, f]), D = z(() => R != null && R.roleId && m.find((d) => d.id === R.roleId) || null, [R, m]), E = z(() => (D == null ? void 0 : D.permissions) || [], [D]);
798
792
  Y(() => {
799
793
  console.log("AuthProvider - userPermissions changed:", E);
800
794
  }, [E]);
@@ -829,17 +823,24 @@ function nt({ config: i = {}, children: e }) {
829
823
  f.setUser(V.user), h(V.user);
830
824
  try {
831
825
  await d();
832
- } catch (oe) {
833
- console.warn("Failed to load complete user data after login:", oe);
826
+ } catch (ee) {
827
+ console.warn("Failed to load complete user data after login:", ee);
834
828
  }
835
829
  }
836
830
  return V;
837
- }, a = async (v, $, J, V) => await y.signup({ email: v, name: $, password: J, tenantId: V }), l = async (v, $, J, V) => await y.signupTenantAdmin({
831
+ }, a = async (v, $, J, V, ee) => await y.signup({
832
+ email: v,
833
+ name: $,
834
+ password: J,
835
+ tenantId: V,
836
+ lastName: ee
837
+ }), l = async (v, $, J, V, ee) => await y.signupTenantAdmin({
838
838
  email: v,
839
839
  name: $,
840
840
  password: J,
841
841
  tenantName: V,
842
- appId: t
842
+ appId: t,
843
+ lastName: ee
843
844
  }), W = async (v, $) => {
844
845
  const J = await f.getAuthHeaders();
845
846
  await y.changePassword({ currentPassword: v, newPassword: $ }, J);
@@ -878,7 +879,7 @@ function nt({ config: i = {}, children: e }) {
878
879
  }
879
880
  }, j = async () => {
880
881
  await O();
881
- }, ie = (v) => {
882
+ }, oe = (v) => {
882
883
  if (!E || E.length === 0)
883
884
  return !1;
884
885
  if (typeof v == "string")
@@ -908,9 +909,9 @@ function nt({ config: i = {}, children: e }) {
908
909
  userPermissions: E,
909
910
  availableRoles: m,
910
911
  rolesLoading: M,
911
- hasPermission: ie,
912
- hasAnyPermission: (v) => v.some(($) => ie($)),
913
- hasAllPermissions: (v) => v.every(($) => ie($)),
912
+ hasPermission: oe,
913
+ hasAnyPermission: (v) => v.some(($) => oe($)),
914
+ hasAllPermissions: (v) => v.every(($) => oe($)),
914
915
  getUserPermissionStrings: () => E || [],
915
916
  refreshRoles: j
916
917
  };
@@ -945,13 +946,13 @@ function nt({ config: i = {}, children: e }) {
945
946
  d && f.hasValidSession() && h(d);
946
947
  }, [f]), /* @__PURE__ */ s(ye.Provider, { value: B, children: e });
947
948
  }
948
- function se() {
949
- const i = te(ye);
949
+ function ne() {
950
+ const i = re(ye);
950
951
  if (!i)
951
952
  throw new Error("useAuth must be used within an AuthProvider");
952
953
  return i;
953
954
  }
954
- class Me {
955
+ class Ee {
955
956
  constructor(e, t) {
956
957
  this.httpService = e, this.sessionManager = t;
957
958
  }
@@ -1031,11 +1032,11 @@ class Me {
1031
1032
  })).data;
1032
1033
  }
1033
1034
  }
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(() => {
1035
+ const we = te(null);
1036
+ function ot({ config: i = {}, children: e }) {
1037
+ const { baseUrl: t, appId: r } = se(), { tenant: n } = K(), [o, m] = b([]), [T, M] = b(!1), [P, g] = b(null), h = z(() => {
1037
1038
  const A = new G(t);
1038
- return new Me(A);
1039
+ return new Ee(A);
1039
1040
  }, [t]), x = async () => {
1040
1041
  if (!(n != null && n.id)) {
1041
1042
  m([]);
@@ -1076,13 +1077,13 @@ function it({ config: i = {}, children: e }) {
1076
1077
  }), [o, T, P]);
1077
1078
  return /* @__PURE__ */ s(we.Provider, { value: p, children: e });
1078
1079
  }
1079
- function Ee() {
1080
- const i = te(we);
1080
+ function Re() {
1081
+ const i = re(we);
1081
1082
  if (!i)
1082
1083
  throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
1083
1084
  return i;
1084
1085
  }
1085
- class Re {
1086
+ class Fe {
1086
1087
  constructor(e, t) {
1087
1088
  this.httpService = e, this.sessionManager = t;
1088
1089
  }
@@ -1148,11 +1149,11 @@ class Re {
1148
1149
  )).data;
1149
1150
  }
1150
1151
  }
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(() => {
1152
+ const me = te(void 0);
1153
+ function at({ config: i = {}, children: e }) {
1154
+ const { baseUrl: t } = se(), { tenant: r } = K(), [n, o] = b(null), [m, T] = b(!1), [M, P] = b(null), g = z(() => {
1154
1155
  const p = new G(t);
1155
- return new Re(p);
1156
+ return new Fe(p);
1156
1157
  }, [t]), h = async () => {
1157
1158
  if (!(r != null && r.id)) {
1158
1159
  o(null);
@@ -1198,8 +1199,8 @@ function ot({ config: i = {}, children: e }) {
1198
1199
  }, [n, m, M]);
1199
1200
  return /* @__PURE__ */ s(me.Provider, { value: x, children: e });
1200
1201
  }
1201
- function Fe() {
1202
- const i = te(me);
1202
+ function Ie() {
1203
+ const i = re(me);
1203
1204
  if (i === void 0)
1204
1205
  throw new Error("useSubscription must be used within a SubscriptionProvider");
1205
1206
  return i;
@@ -1283,7 +1284,7 @@ const ue = () => /* @__PURE__ */ c(
1283
1284
  ] })
1284
1285
  ]
1285
1286
  }
1286
- ), Ie = (i, e) => {
1287
+ ), He = (i, e) => {
1287
1288
  const t = {
1288
1289
  [X.USER]: 1,
1289
1290
  [X.TENANT_ADMIN]: 2,
@@ -1291,20 +1292,20 @@ const ue = () => /* @__PURE__ */ c(
1291
1292
  };
1292
1293
  return t[i] >= t[e];
1293
1294
  };
1294
- function at({
1295
+ function lt({
1295
1296
  children: i,
1296
1297
  fallback: e,
1297
1298
  minUserType: t,
1298
1299
  requiredPermissions: r,
1299
1300
  requireAllPermissions: n = !1
1300
1301
  }) {
1301
- const { hasValidSession: o, sessionManager: m, hasPermission: T, hasAnyPermission: M, hasAllPermissions: P } = se();
1302
+ const { hasValidSession: o, sessionManager: m, hasPermission: T, hasAnyPermission: M, hasAllPermissions: P } = ne();
1302
1303
  if (!o())
1303
1304
  return /* @__PURE__ */ s(H, { children: e || /* @__PURE__ */ s(ue, {}) });
1304
1305
  const g = m.getUser();
1305
1306
  if (!g)
1306
1307
  return /* @__PURE__ */ s(H, { children: e || /* @__PURE__ */ s(ue, {}) });
1307
- if (t && !Ie(g.userType, t))
1308
+ if (t && !He(g.userType, t))
1308
1309
  return /* @__PURE__ */ s(he, { userType: g.userType, minUserType: t });
1309
1310
  if (r && r.length > 0 && !(n ? P(r) : M(r))) {
1310
1311
  const x = r.filter((p) => !T(p)).map((p) => typeof p == "string" ? p : p.name);
@@ -1312,7 +1313,7 @@ function at({
1312
1313
  }
1313
1314
  return /* @__PURE__ */ s(H, { children: i });
1314
1315
  }
1315
- const He = ({ redirectPath: i }) => /* @__PURE__ */ s(
1316
+ const Ce = ({ redirectPath: i }) => /* @__PURE__ */ s(
1316
1317
  "div",
1317
1318
  {
1318
1319
  style: {
@@ -1399,7 +1400,7 @@ const He = ({ redirectPath: i }) => /* @__PURE__ */ s(
1399
1400
  }
1400
1401
  )
1401
1402
  }
1402
- ), Ce = (i, e) => {
1403
+ ), $e = (i, e) => {
1403
1404
  const t = {
1404
1405
  [X.USER]: 1,
1405
1406
  [X.TENANT_ADMIN]: 2,
@@ -1407,7 +1408,7 @@ const He = ({ redirectPath: i }) => /* @__PURE__ */ s(
1407
1408
  };
1408
1409
  return t[i] >= t[e];
1409
1410
  };
1410
- function lt({
1411
+ function ct({
1411
1412
  children: i,
1412
1413
  redirectTo: e = "/login",
1413
1414
  minUserType: t,
@@ -1415,16 +1416,16 @@ function lt({
1415
1416
  requireAllPermissions: n = !1,
1416
1417
  fallback: o
1417
1418
  }) {
1418
- const { hasValidSession: m, sessionManager: T, hasPermission: M, hasAnyPermission: P, hasAllPermissions: g } = se(), h = ae();
1419
+ const { hasValidSession: m, sessionManager: T, hasPermission: M, hasAnyPermission: P, hasAllPermissions: g } = ne(), h = ae();
1419
1420
  if (!m())
1420
1421
  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 })
1422
+ /* @__PURE__ */ s(Ce, { redirectPath: e }),
1423
+ /* @__PURE__ */ s(ie, { to: e, state: { from: h.pathname }, replace: !0 })
1423
1424
  ] });
1424
1425
  const x = T.getUser();
1425
1426
  if (!x)
1426
- return /* @__PURE__ */ s(ne, { to: e, state: { from: h.pathname }, replace: !0 });
1427
- if (t && !Ce(x.userType, t))
1427
+ return /* @__PURE__ */ s(ie, { to: e, state: { from: h.pathname }, replace: !0 });
1428
+ if (t && !$e(x.userType, t))
1428
1429
  return /* @__PURE__ */ s(ge, { userType: x.userType, minUserType: t });
1429
1430
  if (r && r.length > 0 && !(n ? g(r) : P(r))) {
1430
1431
  const A = r.filter((F) => !M(F)).map((F) => typeof F == "string" ? F : F.name);
@@ -1432,7 +1433,7 @@ function lt({
1432
1433
  }
1433
1434
  return /* @__PURE__ */ s(H, { children: i });
1434
1435
  }
1435
- const $e = ({ redirectPath: i }) => /* @__PURE__ */ s(
1436
+ const Le = ({ redirectPath: i }) => /* @__PURE__ */ s(
1436
1437
  "div",
1437
1438
  {
1438
1439
  style: {
@@ -1469,18 +1470,14 @@ const $e = ({ redirectPath: i }) => /* @__PURE__ */ s(
1469
1470
  )
1470
1471
  }
1471
1472
  );
1472
- function ct({
1473
- children: i,
1474
- redirectTo: e = "/",
1475
- fallback: t
1476
- }) {
1473
+ function dt({ children: i, redirectTo: e = "/", fallback: t }) {
1477
1474
  const { tenant: r, isLoading: n, error: o } = K(), m = ae();
1478
1475
  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 })
1476
+ /* @__PURE__ */ s(Le, { redirectPath: e }),
1477
+ /* @__PURE__ */ s(ie, { to: e, state: { from: m.pathname }, replace: !0 })
1481
1478
  ] });
1482
1479
  }
1483
- const Le = ({ redirectPath: i }) => /* @__PURE__ */ s(
1480
+ const De = ({ redirectPath: i }) => /* @__PURE__ */ s(
1484
1481
  "div",
1485
1482
  {
1486
1483
  style: {
@@ -1517,18 +1514,14 @@ const Le = ({ redirectPath: i }) => /* @__PURE__ */ s(
1517
1514
  )
1518
1515
  }
1519
1516
  );
1520
- function dt({
1521
- children: i,
1522
- redirectTo: e = "/dashboard",
1523
- fallback: t
1524
- }) {
1517
+ function ut({ children: i, redirectTo: e = "/dashboard", fallback: t }) {
1525
1518
  const { tenant: r, isLoading: n, error: o } = K(), m = ae();
1526
1519
  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 })
1520
+ /* @__PURE__ */ s(De, { redirectPath: e }),
1521
+ /* @__PURE__ */ s(ie, { to: e, state: { from: m.pathname }, replace: !0 })
1529
1522
  ] }) : /* @__PURE__ */ s(H, { children: i });
1530
1523
  }
1531
- const De = () => /* @__PURE__ */ c(
1524
+ const Be = () => /* @__PURE__ */ c(
1532
1525
  "div",
1533
1526
  {
1534
1527
  style: {
@@ -1545,13 +1538,13 @@ const De = () => /* @__PURE__ */ c(
1545
1538
  ]
1546
1539
  }
1547
1540
  );
1548
- function ut({
1541
+ function ht({
1549
1542
  children: i,
1550
- fallback: e = /* @__PURE__ */ s(De, {}),
1543
+ fallback: e = /* @__PURE__ */ s(Be, {}),
1551
1544
  allowedPlans: t,
1552
1545
  requiredFeature: r
1553
1546
  }) {
1554
- const { subscription: n, hasAllowedPlan: o, isFeatureEnabled: m, loading: T } = Fe();
1547
+ const { subscription: n, hasAllowedPlan: o, isFeatureEnabled: m, loading: T } = Ie();
1555
1548
  return T ? /* @__PURE__ */ s(
1556
1549
  "div",
1557
1550
  {
@@ -1564,7 +1557,7 @@ function ut({
1564
1557
  }
1565
1558
  ) : n ? n.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ s(H, { children: e }) : r && !m(r) ? /* @__PURE__ */ s(H, { children: e }) : /* @__PURE__ */ s(H, { children: i }) : /* @__PURE__ */ s(H, { children: e }) : /* @__PURE__ */ s(H, { children: e });
1566
1559
  }
1567
- const Be = ({ flagName: i }) => /* @__PURE__ */ c(
1560
+ const qe = ({ flagName: i }) => /* @__PURE__ */ c(
1568
1561
  "div",
1569
1562
  {
1570
1563
  style: {
@@ -1591,8 +1584,8 @@ const Be = ({ flagName: i }) => /* @__PURE__ */ c(
1591
1584
  ]
1592
1585
  }
1593
1586
  );
1594
- function ht({ name: i, children: e, fallback: t }) {
1595
- const { isEnabled: r, loading: n } = Ee();
1587
+ function gt({ name: i, children: e, fallback: t }) {
1588
+ const { isEnabled: r, loading: n } = Re();
1596
1589
  return n ? /* @__PURE__ */ s(
1597
1590
  "div",
1598
1591
  {
@@ -1606,9 +1599,9 @@ function ht({ name: i, children: e, fallback: t }) {
1606
1599
  },
1607
1600
  children: "Loading feature flags..."
1608
1601
  }
1609
- ) : (console.log(i, r(i)), r(i) ? /* @__PURE__ */ s(H, { children: e }) : /* @__PURE__ */ s(H, { children: t || /* @__PURE__ */ s(Be, { flagName: i }) }));
1602
+ ) : (console.log(i, r(i)), r(i) ? /* @__PURE__ */ s(H, { children: e }) : /* @__PURE__ */ s(H, { children: t || /* @__PURE__ */ s(qe, { flagName: i }) }));
1610
1603
  }
1611
- const qe = () => /* @__PURE__ */ c(
1604
+ const Ue = () => /* @__PURE__ */ c(
1612
1605
  "svg",
1613
1606
  {
1614
1607
  width: "16",
@@ -1625,7 +1618,7 @@ const qe = () => /* @__PURE__ */ c(
1625
1618
  /* @__PURE__ */ s("circle", { cx: "12", cy: "12", r: "3" })
1626
1619
  ]
1627
1620
  }
1628
- ), Ue = () => /* @__PURE__ */ c(
1621
+ ), Ne = () => /* @__PURE__ */ c(
1629
1622
  "svg",
1630
1623
  {
1631
1624
  width: "16",
@@ -1642,10 +1635,10 @@ const qe = () => /* @__PURE__ */ c(
1642
1635
  /* @__PURE__ */ s("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
1643
1636
  ]
1644
1637
  }
1645
- ), Ne = {
1646
- showPassword: /* @__PURE__ */ s(qe, {}),
1647
- hidePassword: /* @__PURE__ */ s(Ue, {})
1648
- }, ze = {
1638
+ ), ze = {
1639
+ showPassword: /* @__PURE__ */ s(Ue, {}),
1640
+ hidePassword: /* @__PURE__ */ s(Ne, {})
1641
+ }, Oe = {
1649
1642
  title: "Sign In",
1650
1643
  emailLabel: "Email",
1651
1644
  emailPlaceholder: "Enter your email",
@@ -1657,7 +1650,7 @@ const qe = () => /* @__PURE__ */ c(
1657
1650
  signupText: "Don't have an account?",
1658
1651
  errorMessage: "Invalid email or password",
1659
1652
  loadingText: "Signing in..."
1660
- }, Oe = {
1653
+ }, je = {
1661
1654
  container: {
1662
1655
  maxWidth: "400px",
1663
1656
  width: "100%",
@@ -1764,7 +1757,7 @@ const qe = () => /* @__PURE__ */ c(
1764
1757
  fontSize: "0.875rem"
1765
1758
  }
1766
1759
  };
1767
- function gt({
1760
+ function pt({
1768
1761
  copy: i = {},
1769
1762
  styles: e = {},
1770
1763
  icons: t = {},
@@ -1776,7 +1769,7 @@ function gt({
1776
1769
  showSignupLink: M = !0,
1777
1770
  className: P
1778
1771
  }) {
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 = () => {
1772
+ const [g, h] = b(""), [x, p] = b(""), [A, F] = b(!1), [f, L] = b(!1), [y, S] = b(""), [k, R] = b({}), { login: D } = ne(), { tenant: E } = K(), B = { ...Oe, ...i }, d = { ...je, ...e }, w = { ...ze, ...t }, u = () => {
1780
1773
  const I = {};
1781
1774
  return g.trim() || (I.email = !0), x.trim() || (I.password = !0), R(I), Object.keys(I).length === 0;
1782
1775
  }, a = async (I) => {
@@ -1876,7 +1869,7 @@ function gt({
1876
1869
  ] })
1877
1870
  ] });
1878
1871
  }
1879
- const je = {
1872
+ const Ve = {
1880
1873
  title: "Create Account",
1881
1874
  nameLabel: "Full Name",
1882
1875
  namePlaceholder: "Enter your full name",
@@ -1896,7 +1889,7 @@ const je = {
1896
1889
  passwordMismatchError: "Passwords do not match",
1897
1890
  isAdminLabel: "Create new organization",
1898
1891
  isAdminDescription: "Check this if you want to create a new organization"
1899
- }, Ve = {
1892
+ }, We = {
1900
1893
  container: {
1901
1894
  maxWidth: "400px",
1902
1895
  width: "100%",
@@ -1995,7 +1988,7 @@ const je = {
1995
1988
  fontSize: "0.875rem"
1996
1989
  }
1997
1990
  };
1998
- function pt({
1991
+ function ft({
1999
1992
  copy: i = {},
2000
1993
  styles: e = {},
2001
1994
  signupType: t = "user",
@@ -2005,7 +1998,7 @@ function pt({
2005
1998
  showLoginLink: m = !0,
2006
1999
  className: T
2007
2000
  }) {
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 = () => {
2001
+ const [M, P] = b(""), [g, h] = b(""), [x, p] = b(""), [A, F] = b(""), [f, L] = b(""), [y, S] = b(!1), [k, R] = b(""), [D, E] = b({}), { signup: B, signupTenantAdmin: d } = ne(), { tenant: w } = K(), u = { ...Ve, ...i }, a = { ...We, ...e }, l = () => {
2009
2002
  const C = {};
2010
2003
  return M.trim() || (C.name = !0), g.trim() || (C.email = !0), x.trim() || (C.password = !0), A.trim() || (C.confirmPassword = !0), t === "tenant" && !f.trim() && (C.tenantName = !0), E(C), Object.keys(C).length === 0;
2011
2004
  }, W = async (C) => {
@@ -2142,7 +2135,7 @@ function pt({
2142
2135
  ] })
2143
2136
  ] });
2144
2137
  }
2145
- const We = {
2138
+ const Ge = {
2146
2139
  title: "Reset Password",
2147
2140
  subtitle: "Enter your email address and we'll send you a link to reset your password.",
2148
2141
  emailLabel: "Email",
@@ -2164,7 +2157,7 @@ const We = {
2164
2157
  resetLoadingText: "Resetting...",
2165
2158
  resetSuccessMessage: "Password reset successfully!",
2166
2159
  passwordMismatchError: "Passwords do not match"
2167
- }, Ge = {
2160
+ }, _e = {
2168
2161
  container: {
2169
2162
  maxWidth: "400px",
2170
2163
  margin: "0 auto",
@@ -2256,7 +2249,7 @@ const We = {
2256
2249
  cursor: "pointer"
2257
2250
  }
2258
2251
  };
2259
- function ft({
2252
+ function yt({
2260
2253
  copy: i = {},
2261
2254
  styles: e = {},
2262
2255
  mode: t = "request",
@@ -2267,7 +2260,7 @@ function ft({
2267
2260
  onModeChange: T,
2268
2261
  className: M
2269
2262
  }) {
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 = () => {
2263
+ const [P, g] = b(""), [h, x] = b(r), [p, A] = b(""), [F, f] = b(""), [L, y] = b(!1), [S, k] = b(""), [R, D] = b(""), [E, B] = b({}), { requestPasswordReset: d, confirmPasswordReset: w } = ne(), { tenant: u } = K(), a = { ...Ge, ...i }, l = { ..._e, ...e }, W = () => {
2271
2264
  const q = {};
2272
2265
  return P.trim() || (q.email = !0), B(q), Object.keys(q).length === 0;
2273
2266
  }, I = () => {
@@ -2435,7 +2428,7 @@ function ft({
2435
2428
  ] })
2436
2429
  ] });
2437
2430
  }
2438
- class yt {
2431
+ class wt {
2439
2432
  constructor(e, t) {
2440
2433
  this.httpService = e, this.sessionManager = t;
2441
2434
  }
@@ -2503,7 +2496,7 @@ class yt {
2503
2496
  };
2504
2497
  }
2505
2498
  }
2506
- class wt {
2499
+ class mt {
2507
2500
  constructor(e, t) {
2508
2501
  this.httpService = e, this.sessionManager = t;
2509
2502
  }
@@ -2554,7 +2547,7 @@ class wt {
2554
2547
  });
2555
2548
  }
2556
2549
  }
2557
- class mt {
2550
+ class bt {
2558
2551
  constructor(e) {
2559
2552
  this.httpService = e;
2560
2553
  }
@@ -2563,7 +2556,7 @@ class mt {
2563
2556
  return await this.httpService.get("/health");
2564
2557
  }
2565
2558
  }
2566
- class bt {
2559
+ class St {
2567
2560
  // Date string to Date object
2568
2561
  static toDate(e) {
2569
2562
  return new Date(e);
@@ -2589,7 +2582,7 @@ class bt {
2589
2582
  ...e,
2590
2583
  createdAt: this.toDate(e.createdAt),
2591
2584
  updatedAt: this.toDate(e.updatedAt),
2592
- displayName: e.name,
2585
+ displayName: e.lastName ? `${e.name} ${e.lastName}` : e.name,
2593
2586
  isActiveUser: e.isActive
2594
2587
  };
2595
2588
  }
@@ -2686,42 +2679,42 @@ class bt {
2686
2679
  }
2687
2680
  }
2688
2681
  export {
2689
- bt as ApiMappers,
2690
- be as AppApiService,
2691
- Ze as AppProvider,
2692
- Ae as AuthApiService,
2693
- nt as AuthProvider,
2694
- ht as FeatureFlag,
2695
- Me as FeatureFlagApiService,
2696
- it as FeatureFlagProvider,
2697
- mt as HealthApiService,
2682
+ St as ApiMappers,
2683
+ Se as AppApiService,
2684
+ et as AppProvider,
2685
+ Pe as AuthApiService,
2686
+ it as AuthProvider,
2687
+ gt as FeatureFlag,
2688
+ Ee as FeatureFlagApiService,
2689
+ ot as FeatureFlagProvider,
2690
+ bt as HealthApiService,
2698
2691
  G as HttpService,
2699
- dt as LandingRoute,
2700
- gt as LoginForm,
2701
- ft as PasswordRecoveryForm,
2702
- yt as PermissionApiService,
2703
- at as Protected,
2704
- lt as ProtectedRoute,
2692
+ ut as LandingRoute,
2693
+ pt as LoginForm,
2694
+ yt as PasswordRecoveryForm,
2695
+ wt as PermissionApiService,
2696
+ lt as Protected,
2697
+ ct as ProtectedRoute,
2705
2698
  ce as RoleApiService,
2706
- xe as SessionManager,
2707
- pt as SignupForm,
2708
- Re as SubscriptionApiService,
2709
- ut as SubscriptionGuard,
2710
- wt as SubscriptionPlanApiService,
2711
- ot as SubscriptionProvider,
2699
+ Ae as SessionManager,
2700
+ ft as SignupForm,
2701
+ Fe as SubscriptionApiService,
2702
+ ht as SubscriptionGuard,
2703
+ mt as SubscriptionPlanApiService,
2704
+ at as SubscriptionProvider,
2712
2705
  de as TenantApiService,
2713
- tt as TenantProvider,
2714
- ct as TenantRoute,
2715
- Pe as UserApiService,
2706
+ rt as TenantProvider,
2707
+ dt as TenantRoute,
2708
+ ke as UserApiService,
2716
2709
  X as UserType,
2717
- et as useApi,
2718
- re as useApp,
2719
- se as useAuth,
2720
- Ee as useFeatureFlags,
2721
- st as useSettings,
2722
- Fe as useSubscription,
2710
+ tt as useApi,
2711
+ se as useApp,
2712
+ ne as useAuth,
2713
+ Re as useFeatureFlags,
2714
+ nt as useSettings,
2715
+ Ie as useSubscription,
2723
2716
  le as useTenant,
2724
2717
  K as useTenantInfo,
2725
- rt as useTenantSettings
2718
+ st as useTenantSettings
2726
2719
  };
2727
2720
  //# sourceMappingURL=index.es.js.map