@mesob/auth-react 0.4.7 → 0.5.2

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 (209) hide show
  1. package/dist/{chunk-5E3XN6SW.js → chunk-22WQJ3NP.js} +4 -4
  2. package/dist/{chunk-ECF6S2Y2.js → chunk-24E7XFGP.js} +2 -2
  3. package/dist/{chunk-AWSAC7RT.js → chunk-2XIZ27DU.js} +4 -1
  4. package/dist/{chunk-AWSAC7RT.js.map → chunk-2XIZ27DU.js.map} +1 -1
  5. package/dist/{chunk-DG6GRTPG.js → chunk-4CUQIZ2Q.js} +2 -2
  6. package/dist/{chunk-5BFG47VF.js → chunk-55WFD2Y2.js} +4 -4
  7. package/dist/{chunk-GVEBIL3O.js → chunk-6L4K26KM.js} +2 -2
  8. package/dist/{chunk-MWMSZVH3.js → chunk-BIP5XEDV.js} +4 -4
  9. package/dist/{chunk-YFQNNSSC.js → chunk-C34HWZA5.js} +2 -2
  10. package/dist/{chunk-T34HJRUW.js → chunk-CDX5V66G.js} +3 -3
  11. package/dist/{chunk-V6ZHX4LT.js → chunk-DJWX4ENN.js} +2 -2
  12. package/dist/chunk-G2XRGSQE.js +22 -0
  13. package/dist/chunk-G2XRGSQE.js.map +1 -0
  14. package/dist/{chunk-6THPM5LB.js → chunk-GXWBGB6G.js} +4 -4
  15. package/dist/{chunk-6IEX2RLA.js → chunk-HVAYVDIM.js} +3 -3
  16. package/dist/{chunk-5HAABEAS.js → chunk-J4Q7RYYY.js} +2 -2
  17. package/dist/{chunk-OXUOGOG3.js → chunk-JNVJWNJT.js} +87 -20
  18. package/dist/chunk-JNVJWNJT.js.map +1 -0
  19. package/dist/{chunk-RMJNENJB.js → chunk-K2523VB5.js} +2 -2
  20. package/dist/{chunk-5AEV7RAN.js → chunk-KWL6FBP7.js} +3 -3
  21. package/dist/{chunk-IQNQGPIT.js → chunk-LJIZEECR.js} +4 -4
  22. package/dist/{chunk-SGDXNT7M.js → chunk-LQX2365R.js} +3 -3
  23. package/dist/{chunk-MVVAPYUD.js → chunk-NLK2J4UG.js} +2 -2
  24. package/dist/{chunk-ZZ6D4KE4.js → chunk-NUCDZRXS.js} +2 -2
  25. package/dist/{chunk-EQWOGD4F.js → chunk-OPSVSBOB.js} +2 -2
  26. package/dist/{chunk-5SDS2E3F.js → chunk-PCBJBXEK.js} +2 -2
  27. package/dist/{chunk-VVKXFEAN.js → chunk-PFUTYTDB.js} +4 -4
  28. package/dist/{chunk-WY2JJNZW.js → chunk-QHHVGLHT.js} +2 -2
  29. package/dist/{chunk-W3D4HG5W.js → chunk-QJOBPOTR.js} +3 -3
  30. package/dist/{chunk-MQI6Q2S4.js → chunk-R6ME7P5U.js} +147 -4
  31. package/dist/chunk-R6ME7P5U.js.map +1 -0
  32. package/dist/{chunk-N4JFMKGK.js → chunk-RPKO5EQ5.js} +5 -5
  33. package/dist/{chunk-CP4TTRV4.js → chunk-RZFCA4YG.js} +2 -2
  34. package/dist/{chunk-7CLKBH5Z.js → chunk-S772WZD7.js} +3 -3
  35. package/dist/{chunk-73ZNGEWU.js → chunk-SBSAOWP5.js} +5 -5
  36. package/dist/{chunk-H7JRQFFI.js → chunk-TEARMXTQ.js} +3 -3
  37. package/dist/{chunk-UY55LEIG.js → chunk-UN6YBSRS.js} +2 -2
  38. package/dist/{chunk-TEHMLZFI.js → chunk-UOQGT574.js} +3 -3
  39. package/dist/{chunk-Y4AH5JY4.js → chunk-VVFBMIIB.js} +92 -16
  40. package/dist/chunk-VVFBMIIB.js.map +1 -0
  41. package/dist/{chunk-TLQMK2QF.js → chunk-WBRGSWKX.js} +4 -4
  42. package/dist/{chunk-Z34NJZRL.js → chunk-WFHQTVY6.js} +3 -3
  43. package/dist/{chunk-X2BHF4KC.js → chunk-WTAKMSWN.js} +2 -2
  44. package/dist/{chunk-UGQP733V.js → chunk-XGE6G3EK.js} +2 -2
  45. package/dist/{chunk-4ABXALRN.js → chunk-XL2DCDFZ.js} +2 -2
  46. package/dist/{chunk-EPEXIGKB.js → chunk-XUV6CYTY.js} +2 -2
  47. package/dist/{chunk-H5PUZDNU.js → chunk-YQLGGIE4.js} +4 -4
  48. package/dist/{chunk-4X3CJHKR.js → chunk-ZGDN6MQA.js} +3 -3
  49. package/dist/{chunk-4NUO6F3J.js → chunk-ZMJUIRZ6.js} +2 -2
  50. package/dist/components/auth/countdown.js +3 -3
  51. package/dist/components/auth/forgot-password.js +3 -3
  52. package/dist/components/auth/reset-password-form.js +3 -3
  53. package/dist/components/auth/set-password.js +3 -3
  54. package/dist/components/auth/sign-in.js +3 -3
  55. package/dist/components/auth/sign-up.js +3 -3
  56. package/dist/components/auth/verification-form.js +4 -4
  57. package/dist/components/auth/verify-email.js +5 -5
  58. package/dist/components/auth/verify-phone.js +5 -5
  59. package/dist/components/authorization/deny.js +2 -2
  60. package/dist/components/authorization/grant.js +2 -2
  61. package/dist/components/error-boundary.d.ts +1 -1
  62. package/dist/components/iam/domains-page.js +6 -6
  63. package/dist/components/iam/iam-guard.js +3 -3
  64. package/dist/components/iam/permission-selector.js +2 -2
  65. package/dist/components/iam/permissions-page.js +4 -4
  66. package/dist/components/iam/permissions.js +2 -2
  67. package/dist/components/iam/role-detail-layout.js +2 -2
  68. package/dist/components/iam/role-detail-page.js +4 -4
  69. package/dist/components/iam/role-permissions-page.js +5 -5
  70. package/dist/components/iam/roles-page.js +6 -7
  71. package/dist/components/iam/roles.js +2 -2
  72. package/dist/components/iam/sessions-page.js +6 -6
  73. package/dist/components/iam/sessions.js +2 -2
  74. package/dist/components/iam/tenants-page.js +6 -6
  75. package/dist/components/iam/tenants.js +2 -2
  76. package/dist/components/iam/users-page.js +7 -7
  77. package/dist/components/iam/users.js +2 -2
  78. package/dist/components/profile/account.js +2 -2
  79. package/dist/components/profile/change-email-form.js +8 -8
  80. package/dist/components/profile/change-password-form.js +2 -2
  81. package/dist/components/profile/change-phone-form.js +8 -8
  82. package/dist/components/profile/otp-verification-modal.js +5 -5
  83. package/dist/components/profile/profile-layout.js +3 -3
  84. package/dist/components/profile/request-change-email-form.js +2 -2
  85. package/dist/components/profile/request-change-phone-form.js +2 -2
  86. package/dist/components/profile/security.js +13 -13
  87. package/dist/components/profile/verify-change-email-form.js +6 -6
  88. package/dist/components/profile/verify-change-phone-form.js +6 -6
  89. package/dist/index.d.ts +1 -0
  90. package/dist/index.js +975 -63
  91. package/dist/index.js.map +1 -1
  92. package/dist/pages/__import_guard_probe.d.ts +4 -0
  93. package/dist/pages/auth/forgot-password.js +1 -8
  94. package/dist/pages/auth/forgot-password.js.map +1 -1
  95. package/dist/pages/auth/layout.js +6 -4
  96. package/dist/pages/auth/layout.js.map +1 -1
  97. package/dist/pages/auth/reset-password.js +1 -8
  98. package/dist/pages/auth/reset-password.js.map +1 -1
  99. package/dist/pages/auth/set-password.js +1 -9
  100. package/dist/pages/auth/set-password.js.map +1 -1
  101. package/dist/pages/auth/sign-in.js +1 -9
  102. package/dist/pages/auth/sign-in.js.map +1 -1
  103. package/dist/pages/auth/sign-up.js +1 -8
  104. package/dist/pages/auth/sign-up.js.map +1 -1
  105. package/dist/pages/auth/verify-email.js +1 -10
  106. package/dist/pages/auth/verify-email.js.map +1 -1
  107. package/dist/pages/auth/verify-phone.js +1 -10
  108. package/dist/pages/auth/verify-phone.js.map +1 -1
  109. package/dist/pages/iam/domains.d.ts +1 -1
  110. package/dist/pages/iam/permissions.d.ts +1 -1
  111. package/dist/pages/iam/permissions.js +3 -7
  112. package/dist/pages/iam/permissions.js.map +1 -1
  113. package/dist/pages/iam/role-detail-layout.js +1 -5
  114. package/dist/pages/iam/role-detail-layout.js.map +1 -1
  115. package/dist/pages/iam/role-detail.js +1 -7
  116. package/dist/pages/iam/role-detail.js.map +1 -1
  117. package/dist/pages/iam/role-permissions.js +1 -8
  118. package/dist/pages/iam/role-permissions.js.map +1 -1
  119. package/dist/pages/iam/role-users.js +1 -13
  120. package/dist/pages/iam/role-users.js.map +1 -1
  121. package/dist/pages/iam/roles.d.ts +1 -1
  122. package/dist/pages/iam/roles.js +3 -11
  123. package/dist/pages/iam/roles.js.map +1 -1
  124. package/dist/pages/iam/sessions.d.ts +1 -1
  125. package/dist/pages/iam/sessions.js +3 -9
  126. package/dist/pages/iam/sessions.js.map +1 -1
  127. package/dist/pages/iam/tenant-detail.js +1 -8
  128. package/dist/pages/iam/tenant-detail.js.map +1 -1
  129. package/dist/pages/iam/tenants/tenant-selector.js +3 -3
  130. package/dist/pages/iam/tenants.d.ts +1 -1
  131. package/dist/pages/iam/tenants.js +3 -10
  132. package/dist/pages/iam/tenants.js.map +1 -1
  133. package/dist/pages/iam/user-activity.js +1 -12
  134. package/dist/pages/iam/user-activity.js.map +1 -1
  135. package/dist/pages/iam/user-detail-layout.js +1 -7
  136. package/dist/pages/iam/user-detail-layout.js.map +1 -1
  137. package/dist/pages/iam/user-detail.js +1 -7
  138. package/dist/pages/iam/user-detail.js.map +1 -1
  139. package/dist/pages/iam/users/user-selector.js +149 -7
  140. package/dist/pages/iam/users/user-selector.js.map +1 -1
  141. package/dist/pages/iam/users.d.ts +1 -1
  142. package/dist/pages/iam/users.js +3 -11
  143. package/dist/pages/iam/users.js.map +1 -1
  144. package/dist/pages/profile/account.js +2 -5
  145. package/dist/pages/profile/account.js.map +1 -1
  146. package/dist/pages/profile/layout.d.ts +1 -1
  147. package/dist/pages/profile/layout.js +3 -5
  148. package/dist/pages/profile/layout.js.map +1 -1
  149. package/dist/pages/profile/security.js +2 -16
  150. package/dist/pages/profile/security.js.map +1 -1
  151. package/dist/types.d.ts +6 -0
  152. package/dist/utils/safe-redirect.d.ts +2 -0
  153. package/package.json +4 -4
  154. package/dist/chunk-GBDNBY6K.js +0 -153
  155. package/dist/chunk-GBDNBY6K.js.map +0 -1
  156. package/dist/chunk-MQI6Q2S4.js.map +0 -1
  157. package/dist/chunk-NFGFJPCX.js +0 -313
  158. package/dist/chunk-NFGFJPCX.js.map +0 -1
  159. package/dist/chunk-NJMNRSJH.js +0 -83
  160. package/dist/chunk-NJMNRSJH.js.map +0 -1
  161. package/dist/chunk-OXUOGOG3.js.map +0 -1
  162. package/dist/chunk-QPEUVMSP.js +0 -149
  163. package/dist/chunk-QPEUVMSP.js.map +0 -1
  164. package/dist/chunk-RCQTWNAG.js +0 -150
  165. package/dist/chunk-RCQTWNAG.js.map +0 -1
  166. package/dist/chunk-SGUROG23.js +0 -356
  167. package/dist/chunk-SGUROG23.js.map +0 -1
  168. package/dist/chunk-X6EUQZSZ.js +0 -81
  169. package/dist/chunk-X6EUQZSZ.js.map +0 -1
  170. package/dist/chunk-Y4AH5JY4.js.map +0 -1
  171. /package/dist/{chunk-5E3XN6SW.js.map → chunk-22WQJ3NP.js.map} +0 -0
  172. /package/dist/{chunk-ECF6S2Y2.js.map → chunk-24E7XFGP.js.map} +0 -0
  173. /package/dist/{chunk-DG6GRTPG.js.map → chunk-4CUQIZ2Q.js.map} +0 -0
  174. /package/dist/{chunk-5BFG47VF.js.map → chunk-55WFD2Y2.js.map} +0 -0
  175. /package/dist/{chunk-GVEBIL3O.js.map → chunk-6L4K26KM.js.map} +0 -0
  176. /package/dist/{chunk-MWMSZVH3.js.map → chunk-BIP5XEDV.js.map} +0 -0
  177. /package/dist/{chunk-YFQNNSSC.js.map → chunk-C34HWZA5.js.map} +0 -0
  178. /package/dist/{chunk-T34HJRUW.js.map → chunk-CDX5V66G.js.map} +0 -0
  179. /package/dist/{chunk-V6ZHX4LT.js.map → chunk-DJWX4ENN.js.map} +0 -0
  180. /package/dist/{chunk-6THPM5LB.js.map → chunk-GXWBGB6G.js.map} +0 -0
  181. /package/dist/{chunk-6IEX2RLA.js.map → chunk-HVAYVDIM.js.map} +0 -0
  182. /package/dist/{chunk-5HAABEAS.js.map → chunk-J4Q7RYYY.js.map} +0 -0
  183. /package/dist/{chunk-RMJNENJB.js.map → chunk-K2523VB5.js.map} +0 -0
  184. /package/dist/{chunk-5AEV7RAN.js.map → chunk-KWL6FBP7.js.map} +0 -0
  185. /package/dist/{chunk-IQNQGPIT.js.map → chunk-LJIZEECR.js.map} +0 -0
  186. /package/dist/{chunk-SGDXNT7M.js.map → chunk-LQX2365R.js.map} +0 -0
  187. /package/dist/{chunk-MVVAPYUD.js.map → chunk-NLK2J4UG.js.map} +0 -0
  188. /package/dist/{chunk-ZZ6D4KE4.js.map → chunk-NUCDZRXS.js.map} +0 -0
  189. /package/dist/{chunk-EQWOGD4F.js.map → chunk-OPSVSBOB.js.map} +0 -0
  190. /package/dist/{chunk-5SDS2E3F.js.map → chunk-PCBJBXEK.js.map} +0 -0
  191. /package/dist/{chunk-VVKXFEAN.js.map → chunk-PFUTYTDB.js.map} +0 -0
  192. /package/dist/{chunk-WY2JJNZW.js.map → chunk-QHHVGLHT.js.map} +0 -0
  193. /package/dist/{chunk-W3D4HG5W.js.map → chunk-QJOBPOTR.js.map} +0 -0
  194. /package/dist/{chunk-N4JFMKGK.js.map → chunk-RPKO5EQ5.js.map} +0 -0
  195. /package/dist/{chunk-CP4TTRV4.js.map → chunk-RZFCA4YG.js.map} +0 -0
  196. /package/dist/{chunk-7CLKBH5Z.js.map → chunk-S772WZD7.js.map} +0 -0
  197. /package/dist/{chunk-73ZNGEWU.js.map → chunk-SBSAOWP5.js.map} +0 -0
  198. /package/dist/{chunk-H7JRQFFI.js.map → chunk-TEARMXTQ.js.map} +0 -0
  199. /package/dist/{chunk-UY55LEIG.js.map → chunk-UN6YBSRS.js.map} +0 -0
  200. /package/dist/{chunk-TEHMLZFI.js.map → chunk-UOQGT574.js.map} +0 -0
  201. /package/dist/{chunk-TLQMK2QF.js.map → chunk-WBRGSWKX.js.map} +0 -0
  202. /package/dist/{chunk-Z34NJZRL.js.map → chunk-WFHQTVY6.js.map} +0 -0
  203. /package/dist/{chunk-X2BHF4KC.js.map → chunk-WTAKMSWN.js.map} +0 -0
  204. /package/dist/{chunk-UGQP733V.js.map → chunk-XGE6G3EK.js.map} +0 -0
  205. /package/dist/{chunk-4ABXALRN.js.map → chunk-XL2DCDFZ.js.map} +0 -0
  206. /package/dist/{chunk-EPEXIGKB.js.map → chunk-XUV6CYTY.js.map} +0 -0
  207. /package/dist/{chunk-H5PUZDNU.js.map → chunk-YQLGGIE4.js.map} +0 -0
  208. /package/dist/{chunk-4X3CJHKR.js.map → chunk-ZGDN6MQA.js.map} +0 -0
  209. /package/dist/{chunk-4NUO6F3J.js.map → chunk-ZMJUIRZ6.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1,74 +1,63 @@
1
1
  "use client";
2
- import {
3
- RoleUsersPage
4
- } from "./chunk-SGUROG23.js";
5
- import {
6
- TenantDetailPageContent
7
- } from "./chunk-QPEUVMSP.js";
8
- import "./chunk-GBDNBY6K.js";
9
- import {
10
- UserDetailLayoutContent
11
- } from "./chunk-X6EUQZSZ.js";
12
- import {
13
- UserDetailPageContent
14
- } from "./chunk-NJMNRSJH.js";
15
- import {
16
- UserActivityPageContent
17
- } from "./chunk-NFGFJPCX.js";
18
2
  import {
19
3
  Security
20
- } from "./chunk-73ZNGEWU.js";
4
+ } from "./chunk-SBSAOWP5.js";
21
5
  import {
22
6
  AuthFormSkeleton
23
7
  } from "./chunk-5M7I7WNH.js";
24
8
  import {
25
9
  ProfileSkeleton
26
10
  } from "./chunk-NEO72TMH.js";
27
- import "./chunk-5BFG47VF.js";
28
- import "./chunk-5AEV7RAN.js";
29
- import "./chunk-ZZ6D4KE4.js";
30
- import "./chunk-TLQMK2QF.js";
31
- import "./chunk-6IEX2RLA.js";
32
- import "./chunk-UGQP733V.js";
11
+ import {
12
+ getSafeRedirectFromSearch
13
+ } from "./chunk-G2XRGSQE.js";
14
+ import "./chunk-55WFD2Y2.js";
15
+ import "./chunk-KWL6FBP7.js";
16
+ import "./chunk-NUCDZRXS.js";
17
+ import "./chunk-WBRGSWKX.js";
18
+ import "./chunk-HVAYVDIM.js";
19
+ import "./chunk-XGE6G3EK.js";
33
20
  import {
34
21
  ProfileLayout,
35
22
  ProfileSidebar
36
- } from "./chunk-SGDXNT7M.js";
37
- import "./chunk-X2BHF4KC.js";
38
- import "./chunk-DG6GRTPG.js";
23
+ } from "./chunk-LQX2365R.js";
24
+ import "./chunk-WTAKMSWN.js";
25
+ import "./chunk-4CUQIZ2Q.js";
39
26
  import {
40
27
  Roles
41
- } from "./chunk-4NUO6F3J.js";
28
+ } from "./chunk-ZMJUIRZ6.js";
42
29
  import {
43
30
  SessionsPage
44
- } from "./chunk-H5PUZDNU.js";
31
+ } from "./chunk-YQLGGIE4.js";
45
32
  import {
46
33
  Sessions
47
- } from "./chunk-YFQNNSSC.js";
34
+ } from "./chunk-C34HWZA5.js";
48
35
  import {
49
36
  TenantsPage
50
- } from "./chunk-6THPM5LB.js";
51
- import "./chunk-EWXK56WQ.js";
37
+ } from "./chunk-GXWBGB6G.js";
38
+ import {
39
+ str as str2
40
+ } from "./chunk-EWXK56WQ.js";
52
41
  import {
53
42
  Tenants
54
- } from "./chunk-UY55LEIG.js";
43
+ } from "./chunk-UN6YBSRS.js";
55
44
  import {
56
45
  UsersPage
57
- } from "./chunk-N4JFMKGK.js";
58
- import "./chunk-ECF6S2Y2.js";
46
+ } from "./chunk-RPKO5EQ5.js";
47
+ import "./chunk-24E7XFGP.js";
59
48
  import {
60
49
  Users
61
- } from "./chunk-5HAABEAS.js";
50
+ } from "./chunk-J4Q7RYYY.js";
62
51
  import {
63
52
  Account
64
- } from "./chunk-4ABXALRN.js";
53
+ } from "./chunk-XL2DCDFZ.js";
65
54
  import "./chunk-C5ZW7FD2.js";
66
55
  import {
67
56
  PermissionsPage
68
- } from "./chunk-T34HJRUW.js";
57
+ } from "./chunk-CDX5V66G.js";
69
58
  import {
70
59
  Permissions
71
- } from "./chunk-MVVAPYUD.js";
60
+ } from "./chunk-NLK2J4UG.js";
72
61
  import {
73
62
  DataTable
74
63
  } from "./chunk-TFVBER3Y.js";
@@ -77,68 +66,75 @@ import {
77
66
  } from "./chunk-RT5C7IAE.js";
78
67
  import {
79
68
  RoleDetailLayout
80
- } from "./chunk-EQWOGD4F.js";
69
+ } from "./chunk-OPSVSBOB.js";
81
70
  import {
82
71
  RoleDetailPage
83
- } from "./chunk-7CLKBH5Z.js";
72
+ } from "./chunk-S772WZD7.js";
84
73
  import {
85
74
  RolePermissionsPage
86
- } from "./chunk-IQNQGPIT.js";
75
+ } from "./chunk-LJIZEECR.js";
87
76
  import {
88
77
  PermissionSelector
89
- } from "./chunk-GVEBIL3O.js";
78
+ } from "./chunk-6L4K26KM.js";
90
79
  import {
80
+ RoleCard,
81
+ RolesList,
91
82
  RolesPage
92
- } from "./chunk-RCQTWNAG.js";
93
- import "./chunk-MQI6Q2S4.js";
94
- import "./chunk-OW75JENQ.js";
83
+ } from "./chunk-R6ME7P5U.js";
84
+ import {
85
+ str
86
+ } from "./chunk-OW75JENQ.js";
95
87
  import {
96
88
  SignUp
97
- } from "./chunk-OXUOGOG3.js";
89
+ } from "./chunk-JNVJWNJT.js";
98
90
  import {
99
91
  VerifyEmail
100
- } from "./chunk-VVKXFEAN.js";
92
+ } from "./chunk-PFUTYTDB.js";
101
93
  import {
102
94
  VerifyPhone
103
- } from "./chunk-5E3XN6SW.js";
95
+ } from "./chunk-22WQJ3NP.js";
104
96
  import {
105
97
  VerificationForm
106
- } from "./chunk-Z34NJZRL.js";
98
+ } from "./chunk-WFHQTVY6.js";
107
99
  import {
108
100
  Deny
109
- } from "./chunk-CP4TTRV4.js";
101
+ } from "./chunk-RZFCA4YG.js";
110
102
  import {
111
103
  AuthErrorBoundary,
112
104
  ErrorBoundary
113
105
  } from "./chunk-7KXTL6NT.js";
114
106
  import {
115
107
  DomainsPage
116
- } from "./chunk-MWMSZVH3.js";
117
- import "./chunk-W3D4HG5W.js";
118
- import "./chunk-WY2JJNZW.js";
119
- import "./chunk-NPW7D2HZ.js";
108
+ } from "./chunk-BIP5XEDV.js";
109
+ import {
110
+ authApi$
111
+ } from "./chunk-QJOBPOTR.js";
112
+ import "./chunk-QHHVGLHT.js";
113
+ import {
114
+ defaultEntityQueryOptions
115
+ } from "./chunk-NPW7D2HZ.js";
120
116
  import {
121
117
  IAMGuard
122
- } from "./chunk-V6ZHX4LT.js";
118
+ } from "./chunk-DJWX4ENN.js";
123
119
  import {
124
120
  Grant
125
- } from "./chunk-5SDS2E3F.js";
121
+ } from "./chunk-PCBJBXEK.js";
126
122
  import {
127
123
  AuthCard
128
124
  } from "./chunk-G2AW2H36.js";
129
- import "./chunk-RMJNENJB.js";
125
+ import "./chunk-K2523VB5.js";
130
126
  import {
131
127
  ForgotPassword
132
- } from "./chunk-4X3CJHKR.js";
128
+ } from "./chunk-ZGDN6MQA.js";
133
129
  import {
134
130
  ResetPasswordForm
135
- } from "./chunk-H7JRQFFI.js";
131
+ } from "./chunk-TEARMXTQ.js";
136
132
  import {
137
133
  SetPassword
138
- } from "./chunk-TEHMLZFI.js";
134
+ } from "./chunk-UOQGT574.js";
139
135
  import {
140
136
  SignIn
141
- } from "./chunk-Y4AH5JY4.js";
137
+ } from "./chunk-VVFBMIIB.js";
142
138
  import {
143
139
  normalizePhone
144
140
  } from "./chunk-V2W3WPCZ.js";
@@ -148,7 +144,7 @@ import {
148
144
  import "./chunk-DPH2PHK3.js";
149
145
  import {
150
146
  useTranslator
151
- } from "./chunk-EPEXIGKB.js";
147
+ } from "./chunk-XUV6CYTY.js";
152
148
  import {
153
149
  MesobAuthProvider,
154
150
  getSessionCookieName,
@@ -157,13 +153,928 @@ import {
157
153
  useConfig,
158
154
  useHasAuthCookie,
159
155
  useSession
160
- } from "./chunk-AWSAC7RT.js";
156
+ } from "./chunk-2XIZ27DU.js";
161
157
 
162
158
  // src/hooks/use-session-cookie-name.ts
163
159
  function useSessionCookieName() {
164
160
  const { config } = useConfig();
165
161
  return getSessionCookieName(config);
166
162
  }
163
+
164
+ // src/pages/iam/roles/users/_components/role-users-page.tsx
165
+ import { IAMGuard as IAMGuard2 } from "@mesob/auth-react/components/iam/iam-guard";
166
+ import { UserSelector } from "@mesob/auth-react/pages/iam/users/user-selector";
167
+ import {
168
+ Avatar,
169
+ AvatarFallback,
170
+ AvatarImage,
171
+ Badge,
172
+ Button,
173
+ DataTablePagination,
174
+ DeleteConfirmButton,
175
+ DisplayTable,
176
+ EntityEmptyState,
177
+ EntityFilter,
178
+ EntityHeader,
179
+ EntityLoadingState,
180
+ EntitySearch,
181
+ EntitySort,
182
+ EntityViewToggle,
183
+ PageBody,
184
+ Tbody,
185
+ Td,
186
+ Th,
187
+ Thead,
188
+ Tr,
189
+ useEntityPagination,
190
+ useEntityParams
191
+ } from "@mesob/ui/components";
192
+ import { IconPlus, IconUser, IconUsers } from "@tabler/icons-react";
193
+ import { useQueryClient } from "@tanstack/react-query";
194
+ import { useMemo } from "react";
195
+ import { toast } from "sonner";
196
+ import { jsx, jsxs } from "react/jsx-runtime";
197
+ var TABLE_COLUMN_COUNT = 4;
198
+ function initials(user) {
199
+ return user.fullName.split(" ").filter(Boolean).slice(0, 2).map((part) => part[0]?.toUpperCase() ?? "").join("");
200
+ }
201
+ function UserIdentity({ user }) {
202
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
203
+ /* @__PURE__ */ jsxs(Avatar, { className: "h-9 w-9", children: [
204
+ /* @__PURE__ */ jsx(AvatarImage, { src: user.image ?? void 0 }),
205
+ /* @__PURE__ */ jsx(AvatarFallback, { children: initials(user) })
206
+ ] }),
207
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("p", { className: "font-medium", children: user.fullName }) })
208
+ ] });
209
+ }
210
+ function UserContact({ user }) {
211
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
212
+ user.email ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
213
+ /* @__PURE__ */ jsx("span", { children: user.email }),
214
+ user.emailVerified ? /* @__PURE__ */ jsx(Badge, { variant: "outline", children: "Verified" }) : null
215
+ ] }) : null,
216
+ user.phone ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
217
+ /* @__PURE__ */ jsx("span", { children: user.phone }),
218
+ user.phoneVerified ? /* @__PURE__ */ jsx(Badge, { variant: "outline", children: "Verified" }) : null
219
+ ] }) : null,
220
+ user.email || user.phone ? null : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2014" })
221
+ ] });
222
+ }
223
+ function UserRemoveButton({
224
+ roleId,
225
+ userId,
226
+ onRemove
227
+ }) {
228
+ return /* @__PURE__ */ jsx(
229
+ DeleteConfirmButton,
230
+ {
231
+ entityName: "user",
232
+ onConfirm: () => onRemove(roleId, userId),
233
+ triggerClassName: "size-8 text-destructive hover:text-destructive"
234
+ }
235
+ );
236
+ }
237
+ function RoleUsersTable({
238
+ roleId,
239
+ users,
240
+ onRemove
241
+ }) {
242
+ return /* @__PURE__ */ jsxs(DisplayTable, { withTableBorder: true, children: [
243
+ /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
244
+ /* @__PURE__ */ jsx(Th, { children: "User" }),
245
+ /* @__PURE__ */ jsx(Th, { children: "Contact" }),
246
+ /* @__PURE__ */ jsx(Th, { children: "Last sign in" }),
247
+ /* @__PURE__ */ jsx(Th, { className: "w-[60px]" })
248
+ ] }) }),
249
+ /* @__PURE__ */ jsx(Tbody, { children: users.map((user) => /* @__PURE__ */ jsxs(Tr, { children: [
250
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(UserIdentity, { user }) }),
251
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(UserContact, { user }) }),
252
+ /* @__PURE__ */ jsx(Td, { children: user.lastSignInAt ? new Date(user.lastSignInAt).toLocaleDateString() : "Never" }),
253
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
254
+ UserRemoveButton,
255
+ {
256
+ roleId,
257
+ userId: user.id,
258
+ onRemove
259
+ }
260
+ ) })
261
+ ] }, user.id)) })
262
+ ] });
263
+ }
264
+ function RoleUsersCards({
265
+ roleId,
266
+ users,
267
+ onRemove
268
+ }) {
269
+ return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3", children: users.map((user) => /* @__PURE__ */ jsx(
270
+ "div",
271
+ {
272
+ className: "rounded-xl border border-border/60 bg-card p-4 shadow-sm",
273
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
274
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
275
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
276
+ /* @__PURE__ */ jsxs(Avatar, { className: "h-10 w-10", children: [
277
+ /* @__PURE__ */ jsx(AvatarImage, { src: user.image ?? void 0 }),
278
+ /* @__PURE__ */ jsx(AvatarFallback, { children: initials(user) })
279
+ ] }),
280
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("p", { className: "font-semibold", children: user.fullName }) })
281
+ ] }),
282
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 text-sm text-muted-foreground", children: [
283
+ /* @__PURE__ */ jsx("p", { children: user.email ?? user.phone ?? "No contact info" }),
284
+ /* @__PURE__ */ jsxs("p", { children: [
285
+ "Last sign in",
286
+ " ",
287
+ user.lastSignInAt ? new Date(user.lastSignInAt).toLocaleDateString() : "never"
288
+ ] })
289
+ ] })
290
+ ] }),
291
+ /* @__PURE__ */ jsx(
292
+ UserRemoveButton,
293
+ {
294
+ roleId,
295
+ userId: user.id,
296
+ onRemove
297
+ }
298
+ )
299
+ ] })
300
+ },
301
+ user.id
302
+ )) });
303
+ }
304
+ function RoleUsersPage({ roleId }) {
305
+ return /* @__PURE__ */ jsx(IAMGuard2, { children: /* @__PURE__ */ jsx(RoleUsersPageContent, { roleId }) });
306
+ }
307
+ function RoleUsersPageContent({ roleId }) {
308
+ const qc = useQueryClient();
309
+ const { queryConfig, params, setParams } = useEntityParams({
310
+ searchKey: "search",
311
+ defaultSort: "fullName",
312
+ defaultOrder: "asc"
313
+ });
314
+ const usersQuery = useMemo(
315
+ () => ({
316
+ params: {
317
+ path: { id: roleId },
318
+ query: queryConfig.params.query
319
+ }
320
+ }),
321
+ [queryConfig, roleId]
322
+ );
323
+ const { data, isPending, isFetching } = authApi$.useQuery(
324
+ "get",
325
+ "/roles/{id}/users",
326
+ usersQuery,
327
+ { enabled: !!roleId }
328
+ );
329
+ const assignUsers = authApi$.useMutation("post", "/roles/{id}/users", {
330
+ onSuccess: (result) => {
331
+ qc.invalidateQueries({ queryKey: ["get", "/roles"] });
332
+ qc.invalidateQueries({ queryKey: ["get", "/roles/{id}"] });
333
+ qc.invalidateQueries({ queryKey: ["get", "/roles/{id}/users"] });
334
+ toast.success(
335
+ result?.created ? `${result.created} user(s) added` : "No changes"
336
+ );
337
+ },
338
+ onError: () => {
339
+ toast.error("Failed to assign users");
340
+ }
341
+ });
342
+ const revokeUser = authApi$.useMutation(
343
+ "delete",
344
+ "/roles/{id}/users/{userId}",
345
+ {
346
+ onSuccess: () => {
347
+ qc.invalidateQueries({ queryKey: ["get", "/roles"] });
348
+ qc.invalidateQueries({ queryKey: ["get", "/roles/{id}"] });
349
+ qc.invalidateQueries({ queryKey: ["get", "/roles/{id}/users"] });
350
+ toast.success("User removed");
351
+ },
352
+ onError: () => {
353
+ toast.error("Failed to remove user");
354
+ }
355
+ }
356
+ );
357
+ const users = data?.users ?? [];
358
+ const { total, pageCount } = useEntityPagination({
359
+ items: users,
360
+ total: data?.total,
361
+ pageSize: params.pageSize
362
+ });
363
+ const isLoading = isPending || isFetching;
364
+ const currentView = params.view || "table";
365
+ const handleRemoveUser = (targetRoleId, userId) => {
366
+ revokeUser.mutate({
367
+ params: {
368
+ path: { id: targetRoleId, userId }
369
+ }
370
+ });
371
+ };
372
+ if (!roleId) {
373
+ return null;
374
+ }
375
+ let content;
376
+ if (isLoading) {
377
+ content = /* @__PURE__ */ jsx(
378
+ EntityLoadingState,
379
+ {
380
+ view: currentView,
381
+ rowCount: params.pageSize,
382
+ columnCount: TABLE_COLUMN_COUNT,
383
+ cardCount: params.pageSize
384
+ }
385
+ );
386
+ } else if (total === 0) {
387
+ content = /* @__PURE__ */ jsx(
388
+ EntityEmptyState,
389
+ {
390
+ icon: IconUsers,
391
+ entityName: "user",
392
+ title: "No users assigned",
393
+ description: "Assign users from the selector to add them to this role."
394
+ }
395
+ );
396
+ } else if (currentView === "table") {
397
+ content = /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
398
+ /* @__PURE__ */ jsx(
399
+ RoleUsersTable,
400
+ {
401
+ roleId,
402
+ users,
403
+ onRemove: handleRemoveUser
404
+ }
405
+ ),
406
+ /* @__PURE__ */ jsx(
407
+ DataTablePagination,
408
+ {
409
+ pageIndex: params.page - 1,
410
+ pageSize: params.pageSize,
411
+ pageCount,
412
+ totalRows: total,
413
+ onPageChange: (page) => setParams({ page: page + 1 }),
414
+ onPageSizeChange: (pageSize) => setParams({ pageSize, page: 1 })
415
+ }
416
+ )
417
+ ] });
418
+ } else {
419
+ content = /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
420
+ /* @__PURE__ */ jsx(
421
+ RoleUsersCards,
422
+ {
423
+ roleId,
424
+ users,
425
+ onRemove: handleRemoveUser
426
+ }
427
+ ),
428
+ /* @__PURE__ */ jsx(
429
+ DataTablePagination,
430
+ {
431
+ pageIndex: params.page - 1,
432
+ pageSize: params.pageSize,
433
+ pageCount,
434
+ totalRows: total,
435
+ onPageChange: (page) => setParams({ page: page + 1 }),
436
+ onPageSizeChange: (pageSize) => setParams({ pageSize, page: 1 })
437
+ }
438
+ )
439
+ ] });
440
+ }
441
+ return /* @__PURE__ */ jsxs(PageBody, { className: "px-0 pb-6", children: [
442
+ /* @__PURE__ */ jsx(
443
+ EntityHeader,
444
+ {
445
+ icon: /* @__PURE__ */ jsx(IconUser, { className: "h-5 w-5" }),
446
+ title: "Role users",
447
+ actions: /* @__PURE__ */ jsx(
448
+ UserSelector,
449
+ {
450
+ trigger: /* @__PURE__ */ jsxs(Button, { size: "sm", loading: assignUsers.isPending, children: [
451
+ /* @__PURE__ */ jsx(IconPlus, { className: "h-4 w-4" }),
452
+ "Add users"
453
+ ] }),
454
+ multiple: true,
455
+ excludeIds: users.map((user) => user.id),
456
+ onSelect: (selectedUsers) => {
457
+ if (!selectedUsers.length) {
458
+ return;
459
+ }
460
+ assignUsers.mutate({
461
+ params: { path: { id: roleId } },
462
+ body: {
463
+ userIds: selectedUsers.map((user) => user.id)
464
+ }
465
+ });
466
+ }
467
+ }
468
+ ),
469
+ search: /* @__PURE__ */ jsx(
470
+ EntitySearch,
471
+ {
472
+ paramKey: "search",
473
+ placeholder: "Search assigned users..."
474
+ }
475
+ ),
476
+ filter: /* @__PURE__ */ jsx(
477
+ EntityFilter,
478
+ {
479
+ options: [
480
+ { label: "All", value: "" },
481
+ { label: "Name", value: "fullName" },
482
+ { label: "Email", value: "email" },
483
+ { label: "Phone", value: "phone" }
484
+ ],
485
+ placeholder: "Search field"
486
+ }
487
+ ),
488
+ sort: /* @__PURE__ */ jsx(
489
+ EntitySort,
490
+ {
491
+ defaultSort: "fullName",
492
+ defaultOrder: "asc",
493
+ options: [
494
+ { label: "Created", value: "createdAt" },
495
+ { label: "Updated", value: "updatedAt" },
496
+ { label: "Name", value: "fullName" },
497
+ { label: "Last Sign In", value: "lastSignInAt" }
498
+ ]
499
+ }
500
+ ),
501
+ view: /* @__PURE__ */ jsx(EntityViewToggle, { views: ["table", "card"] })
502
+ }
503
+ ),
504
+ content
505
+ ] });
506
+ }
507
+
508
+ // src/pages/iam/tenants/tenant-detail-page-content.tsx
509
+ import { IAMGuard as IAMGuard3 } from "@mesob/auth-react/components/iam/iam-guard";
510
+ import {
511
+ Button as Button2,
512
+ Card,
513
+ CardContent,
514
+ CardHeader,
515
+ CardTitle,
516
+ EntityDetailHeader,
517
+ PageContainer,
518
+ useBreadcrumbs
519
+ } from "@mesob/ui/components";
520
+ import { IconBuilding } from "@tabler/icons-react";
521
+ import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
522
+ import { useMemo as useMemo2 } from "react";
523
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
524
+ function TenantDetailPageContent({
525
+ tenantId
526
+ }) {
527
+ return /* @__PURE__ */ jsx2(IAMGuard3, { children: /* @__PURE__ */ jsx2(TenantDetailPageContentInner, { tenantId }) });
528
+ }
529
+ function TenantDetailPageContentInner({
530
+ tenantId
531
+ }) {
532
+ const { hooks } = useApi();
533
+ const { config } = useConfig();
534
+ const homeHref = config.navigation?.defaultRedirectUrl || "/";
535
+ const qc = useQueryClient2();
536
+ const { data, isLoading } = hooks.useQuery(
537
+ "get",
538
+ "/tenants/{id}",
539
+ { params: { path: { id: tenantId } } },
540
+ { enabled: !!tenantId }
541
+ );
542
+ const tenant = data?.tenant;
543
+ const toggleActive = hooks.useMutation("put", "/tenants/{id}", {
544
+ onSuccess: () => {
545
+ qc.invalidateQueries({ queryKey: ["get", "/tenants/{id}"] });
546
+ qc.invalidateQueries({ queryKey: ["get", "/tenants"] });
547
+ }
548
+ });
549
+ const title = tenant ? str2(tenant.name) || tenant.id : tenantId ?? "Tenant";
550
+ useBreadcrumbs({
551
+ items: [
552
+ { label: "Home", href: homeHref },
553
+ { label: "IAM", href: "/iam" },
554
+ { label: "Tenants", href: "/iam/tenants" },
555
+ { label: title }
556
+ ]
557
+ });
558
+ const tabs = useMemo2(
559
+ () => [
560
+ {
561
+ value: "detail",
562
+ name: "Detail",
563
+ content: /* @__PURE__ */ jsxs2(Card, { className: "mt-4", children: [
564
+ /* @__PURE__ */ jsx2(CardHeader, { children: /* @__PURE__ */ jsx2(CardTitle, { children: "Tenant details" }) }),
565
+ /* @__PURE__ */ jsx2(CardContent, { className: "space-y-2 text-sm", children: tenant && /* @__PURE__ */ jsxs2(Fragment, { children: [
566
+ /* @__PURE__ */ jsxs2("p", { children: [
567
+ /* @__PURE__ */ jsx2("span", { className: "text-muted-foreground", children: "Name:" }),
568
+ " ",
569
+ str2(tenant.name) || "\u2014"
570
+ ] }),
571
+ /* @__PURE__ */ jsxs2("p", { children: [
572
+ /* @__PURE__ */ jsx2("span", { className: "text-muted-foreground", children: "Description:" }),
573
+ " ",
574
+ str2(tenant.description) || "\u2014"
575
+ ] }),
576
+ /* @__PURE__ */ jsxs2("p", { children: [
577
+ /* @__PURE__ */ jsx2("span", { className: "text-muted-foreground", children: "Language:" }),
578
+ " ",
579
+ tenant.defaultLanguage ?? "\u2014"
580
+ ] }),
581
+ /* @__PURE__ */ jsxs2("p", { children: [
582
+ /* @__PURE__ */ jsx2("span", { className: "text-muted-foreground", children: "Currency:" }),
583
+ " ",
584
+ tenant.defaultCurrency ?? "\u2014"
585
+ ] }),
586
+ /* @__PURE__ */ jsxs2("p", { children: [
587
+ /* @__PURE__ */ jsx2("span", { className: "text-muted-foreground", children: "Timezone:" }),
588
+ " ",
589
+ tenant.timezone ?? "\u2014"
590
+ ] })
591
+ ] }) })
592
+ ] })
593
+ },
594
+ {
595
+ value: "theme",
596
+ name: "Theme",
597
+ content: /* @__PURE__ */ jsxs2(Card, { className: "mt-4", children: [
598
+ /* @__PURE__ */ jsx2(CardHeader, { children: /* @__PURE__ */ jsx2(CardTitle, { children: "Theme" }) }),
599
+ /* @__PURE__ */ jsx2(CardContent, { className: "text-muted-foreground text-sm", children: "Theme settings (placeholder)" })
600
+ ] })
601
+ },
602
+ {
603
+ value: "settings",
604
+ name: "Settings",
605
+ content: /* @__PURE__ */ jsxs2(Card, { className: "mt-4", children: [
606
+ /* @__PURE__ */ jsx2(CardHeader, { children: /* @__PURE__ */ jsx2(CardTitle, { children: "Settings" }) }),
607
+ /* @__PURE__ */ jsx2(CardContent, { className: "text-muted-foreground text-sm", children: "Tenant settings (placeholder)" })
608
+ ] })
609
+ }
610
+ ],
611
+ [tenant]
612
+ );
613
+ const actions = tenant && /* @__PURE__ */ jsx2(
614
+ Button2,
615
+ {
616
+ variant: tenant.isActive ? "secondary" : "default",
617
+ size: "sm",
618
+ onClick: () => toggleActive.mutate({
619
+ params: { path: { id: tenantId } },
620
+ body: { isActive: !tenant.isActive }
621
+ }),
622
+ disabled: toggleActive.isPending,
623
+ children: tenant.isActive ? "Deactivate" : "Activate"
624
+ }
625
+ );
626
+ if (!tenantId) {
627
+ return null;
628
+ }
629
+ if (isLoading || !tenant) {
630
+ return /* @__PURE__ */ jsx2("div", { className: "flex flex-1 flex-col gap-4 p-4 pt-0", children: /* @__PURE__ */ jsx2("div", { className: "h-24 animate-pulse rounded-xl bg-muted" }) });
631
+ }
632
+ return /* @__PURE__ */ jsx2(PageContainer, { className: "flex flex-1 flex-col gap-4 p-4 pt-0", children: /* @__PURE__ */ jsx2(
633
+ EntityDetailHeader,
634
+ {
635
+ title,
636
+ icon: /* @__PURE__ */ jsx2(IconBuilding, { className: "h-5 w-5 text-muted-foreground" }),
637
+ actions,
638
+ tabs
639
+ }
640
+ ) });
641
+ }
642
+
643
+ // src/pages/iam/users/_components/user-detail-layout-content.tsx
644
+ import { IAMGuard as IAMGuard4 } from "@mesob/auth-react/components/iam/iam-guard";
645
+ import { toTitleCase } from "@mesob/common";
646
+ import {
647
+ Button as Button3,
648
+ EntityDetailHeader as EntityDetailHeader2,
649
+ PageContainer as PageContainer2,
650
+ useBreadcrumbs as useBreadcrumbs2
651
+ } from "@mesob/ui/components";
652
+ import { IconUser as IconUser2 } from "@tabler/icons-react";
653
+ import { useMemo as useMemo3 } from "react";
654
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
655
+ function UserDetailLayoutContent({
656
+ userId,
657
+ children
658
+ }) {
659
+ return /* @__PURE__ */ jsx3(IAMGuard4, { children: /* @__PURE__ */ jsx3(UserDetailLayoutContentInner, { userId, children }) });
660
+ }
661
+ function UserDetailLayoutContentInner({
662
+ userId,
663
+ children
664
+ }) {
665
+ const { hooks } = useApi();
666
+ const { config } = useConfig();
667
+ const homeHref = config.navigation?.defaultRedirectUrl || "/";
668
+ const { data, isLoading } = hooks.useQuery(
669
+ "get",
670
+ "/users/{id}",
671
+ { params: { path: { id: userId } } },
672
+ { enabled: !!userId }
673
+ );
674
+ const user = data?.user;
675
+ const title = toTitleCase(user?.fullName || userId || "User");
676
+ useBreadcrumbs2({
677
+ items: [
678
+ { label: "Home", href: homeHref },
679
+ { label: "IAM", href: "/iam" },
680
+ { label: "Users", href: "/iam/users" },
681
+ { label: title }
682
+ ]
683
+ });
684
+ const tabs = useMemo3(
685
+ () => [
686
+ { value: "detail", name: "Detail", href: `/iam/users/${userId}` },
687
+ {
688
+ value: "activity",
689
+ name: "Activity",
690
+ href: `/iam/users/${userId}/activity`
691
+ }
692
+ ],
693
+ [userId]
694
+ );
695
+ if (!userId) {
696
+ return null;
697
+ }
698
+ return /* @__PURE__ */ jsxs3(PageContainer2, { children: [
699
+ /* @__PURE__ */ jsx3(
700
+ EntityDetailHeader2,
701
+ {
702
+ title,
703
+ icon: /* @__PURE__ */ jsx3(IconUser2, {}),
704
+ tabs,
705
+ loading: isLoading,
706
+ actions: /* @__PURE__ */ jsx3(Button3, { children: "Test Button" })
707
+ }
708
+ ),
709
+ children
710
+ ] });
711
+ }
712
+
713
+ // src/pages/iam/users/_components/user-detail-page-content.tsx
714
+ import { IAMGuard as IAMGuard5 } from "@mesob/auth-react/components/iam/iam-guard";
715
+ import {
716
+ Card as Card2,
717
+ CardContent as CardContent2,
718
+ CardHeader as CardHeader2,
719
+ CardTitle as CardTitle2,
720
+ Tooltip,
721
+ TooltipContent,
722
+ TooltipTrigger
723
+ } from "@mesob/ui/components";
724
+ import { IconCircleCheck } from "@tabler/icons-react";
725
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
726
+ function UserDetailPageContent({ userId }) {
727
+ return /* @__PURE__ */ jsx4(IAMGuard5, { children: /* @__PURE__ */ jsx4(UserDetailPageContentInner, { userId }) });
728
+ }
729
+ function UserDetailPageContentInner({ userId }) {
730
+ const { hooks } = useApi();
731
+ const { data, isLoading } = hooks.useQuery(
732
+ "get",
733
+ "/users/{id}",
734
+ { params: { path: { id: userId } } },
735
+ { enabled: !!userId }
736
+ );
737
+ const user = data?.user;
738
+ if (!userId) {
739
+ return null;
740
+ }
741
+ if (isLoading || !user) {
742
+ return /* @__PURE__ */ jsx4("div", { className: "h-32 animate-pulse rounded-xl bg-muted mt-4" });
743
+ }
744
+ return /* @__PURE__ */ jsxs4(Card2, { children: [
745
+ /* @__PURE__ */ jsx4(CardHeader2, { children: /* @__PURE__ */ jsx4(CardTitle2, { children: "User details" }) }),
746
+ /* @__PURE__ */ jsxs4(CardContent2, { className: "space-y-2 text-sm", children: [
747
+ /* @__PURE__ */ jsxs4("p", { children: [
748
+ /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "Name:" }),
749
+ " ",
750
+ user.fullName || "\u2014"
751
+ ] }),
752
+ /* @__PURE__ */ jsxs4("p", { children: [
753
+ /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "Email:" }),
754
+ " ",
755
+ user.email ?? "\u2014",
756
+ " ",
757
+ user.emailVerified && /* @__PURE__ */ jsxs4(Tooltip, { children: [
758
+ /* @__PURE__ */ jsx4(TooltipTrigger, { children: /* @__PURE__ */ jsx4(IconCircleCheck, { className: "inline size-4 text-muted-foreground" }) }),
759
+ /* @__PURE__ */ jsx4(TooltipContent, { children: "Email verified" })
760
+ ] })
761
+ ] }),
762
+ /* @__PURE__ */ jsxs4("p", { children: [
763
+ /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "Phone:" }),
764
+ " ",
765
+ user.phone ?? "\u2014",
766
+ " ",
767
+ user.phoneVerified && /* @__PURE__ */ jsxs4(Tooltip, { children: [
768
+ /* @__PURE__ */ jsx4(TooltipTrigger, { children: /* @__PURE__ */ jsx4(IconCircleCheck, { className: "inline size-4 text-muted-foreground" }) }),
769
+ /* @__PURE__ */ jsx4(TooltipContent, { children: "Phone verified" })
770
+ ] })
771
+ ] }),
772
+ /* @__PURE__ */ jsxs4("p", { children: [
773
+ /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "Last sign in:" }),
774
+ " ",
775
+ user.lastSignInAt ? new Date(user.lastSignInAt).toLocaleString() : "Never"
776
+ ] }),
777
+ user.roleCodes?.length ? /* @__PURE__ */ jsxs4("p", { children: [
778
+ /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "Roles:" }),
779
+ " ",
780
+ user.roleCodes.join(", ")
781
+ ] }) : null
782
+ ] })
783
+ ] });
784
+ }
785
+
786
+ // src/pages/iam/users/activity/user-activity-page-content.tsx
787
+ import { IAMGuard as IAMGuard6 } from "@mesob/auth-react/components/iam/iam-guard";
788
+ import {
789
+ Card as Card3,
790
+ CardContent as CardContent3,
791
+ CardHeader as CardHeader3,
792
+ CardTitle as CardTitle3,
793
+ Section
794
+ } from "@mesob/ui/components";
795
+ import { IconCalendar as IconCalendar2 } from "@tabler/icons-react";
796
+
797
+ // src/pages/iam/users/activity/_components/role-section.tsx
798
+ import {
799
+ Button as Button4,
800
+ EntityEmptyState as EntityEmptyState2,
801
+ EntityLoadingState as EntityLoadingState2,
802
+ EntitySection,
803
+ useEntitySectionState as useEntitySectionState2
804
+ } from "@mesob/ui/components";
805
+ import { IconPlus as IconPlus2, IconShield as IconShield2 } from "@tabler/icons-react";
806
+ import { useMemo as useMemo4, useState } from "react";
807
+
808
+ // src/pages/iam/roles/_components/role-selector.tsx
809
+ import {
810
+ EntitySelector,
811
+ useEntitySectionState
812
+ } from "@mesob/ui/components";
813
+ import { cn } from "@mesob/ui/lib/utils";
814
+ import { IconCalendar, IconShield } from "@tabler/icons-react";
815
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
816
+ function SelectableRoleCard({
817
+ role,
818
+ selected,
819
+ onToggle
820
+ }) {
821
+ return (
822
+ // biome-ignore lint/a11y/useSemanticElements: div to avoid nested buttons from RoleCard
823
+ /* @__PURE__ */ jsx5(
824
+ "div",
825
+ {
826
+ role: "button",
827
+ tabIndex: 0,
828
+ onClick: onToggle,
829
+ onKeyDown: (e) => {
830
+ if (e.key === "Enter") {
831
+ onToggle();
832
+ }
833
+ },
834
+ className: cn(
835
+ "cursor-pointer rounded-lg transition-shadow focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
836
+ selected && "ring-primary ring-2"
837
+ ),
838
+ children: /* @__PURE__ */ jsx5(RoleCard, { role, mode: "static" })
839
+ }
840
+ )
841
+ );
842
+ }
843
+ var roleColumns = [
844
+ {
845
+ key: "role",
846
+ header: "Role",
847
+ cell: (role) => /* @__PURE__ */ jsxs5(Fragment2, { children: [
848
+ /* @__PURE__ */ jsx5("p", { className: "font-medium", children: str(role.name) || role.code }),
849
+ /* @__PURE__ */ jsx5("p", { className: "text-sm text-muted-foreground", children: role.code })
850
+ ] })
851
+ },
852
+ {
853
+ key: "description",
854
+ header: "Description",
855
+ cell: (role) => /* @__PURE__ */ jsx5("span", { className: "text-muted-foreground line-clamp-1 max-w-[200px]", children: str(role.description) || "\u2014" })
856
+ },
857
+ {
858
+ key: "created",
859
+ header: "Created",
860
+ cell: (role) => /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1 text-muted-foreground", children: [
861
+ /* @__PURE__ */ jsx5(IconCalendar, { className: "h-4 w-4" }),
862
+ new Date(role.createdAt).toLocaleDateString()
863
+ ] })
864
+ }
865
+ ];
866
+ function RoleSelector({
867
+ trigger,
868
+ multiple = true,
869
+ onSelect,
870
+ modalSize = "xl",
871
+ contentClassName
872
+ }) {
873
+ const state = useEntitySectionState({
874
+ defaultSort: "createdAt",
875
+ defaultOrder: "desc",
876
+ defaultPageSize: 10,
877
+ searchParamName: "search"
878
+ });
879
+ const rolesQuery = state.queryConfig;
880
+ const { data, isPending, isFetching } = authApi$.useQuery(
881
+ "get",
882
+ "/roles",
883
+ rolesQuery,
884
+ defaultEntityQueryOptions
885
+ );
886
+ const roles = data?.roles ?? [];
887
+ const config = {
888
+ title: "Select role(s)",
889
+ modalSize,
890
+ contentClassName,
891
+ multiple,
892
+ entityName: "role",
893
+ entityIcon: IconShield,
894
+ columns: roleColumns,
895
+ columnCount: 3,
896
+ getItemLabel: (role) => str(role.name) || role.code,
897
+ searchPlaceholder: "Search roles...",
898
+ wrapHeaderInCard: false,
899
+ filterOptions: [
900
+ { label: "All", value: "" },
901
+ { label: "By Code", value: "code" }
902
+ ],
903
+ sortOptions: [
904
+ { label: "Created", value: "createdAt" },
905
+ { label: "Updated", value: "updatedAt" },
906
+ { label: "Code", value: "code" }
907
+ ],
908
+ showViewToggle: false,
909
+ renderCard: (role, selected, onToggle) => /* @__PURE__ */ jsx5(SelectableRoleCard, { role, selected, onToggle })
910
+ };
911
+ return /* @__PURE__ */ jsx5(
912
+ EntitySelector,
913
+ {
914
+ trigger,
915
+ config,
916
+ onSelect,
917
+ items: roles,
918
+ total: data?.total,
919
+ isLoading: isPending || isFetching,
920
+ state
921
+ }
922
+ );
923
+ }
924
+
925
+ // src/pages/iam/users/activity/_components/role-section.tsx
926
+ import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
927
+ var LIMIT = 100;
928
+ var TABLE_COLUMN_COUNT2 = 4;
929
+ function filterAndSort(roles, search, sort, order) {
930
+ let out = roles;
931
+ if (search.trim()) {
932
+ const q = search.trim().toLowerCase();
933
+ out = out.filter(
934
+ (r) => str(r.name).toLowerCase().includes(q) || r.code.toLowerCase().includes(q)
935
+ );
936
+ }
937
+ const mult = order === "asc" ? 1 : -1;
938
+ const by = sort === "code" ? "code" : "createdAt";
939
+ out = [...out].sort(
940
+ (a, b) => by === "code" ? mult * a.code.localeCompare(b.code) : mult * (new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime())
941
+ );
942
+ return out;
943
+ }
944
+ function RoleSection({ userId }) {
945
+ const [open, setOpen] = useState(false);
946
+ const sectionState = useEntitySectionState2({
947
+ defaultSort: "createdAt",
948
+ defaultOrder: "desc",
949
+ defaultPageSize: 10,
950
+ filterOptions: [
951
+ { label: "All", value: "" },
952
+ { label: "By Code", value: "code" }
953
+ ],
954
+ sortOptions: [
955
+ { label: "Created", value: "createdAt" },
956
+ { label: "Updated", value: "updatedAt" },
957
+ { label: "Code", value: "code" }
958
+ ],
959
+ views: ["table", "card"]
960
+ });
961
+ const { data, isPending, isFetching } = authApi$.useQuery(
962
+ "get",
963
+ "/roles",
964
+ { params: { query: { limit: LIMIT } } },
965
+ { ...defaultEntityQueryOptions, enabled: open }
966
+ );
967
+ const isLoading = isPending || isFetching;
968
+ const roles = data?.roles ?? [];
969
+ const filtered = useMemo4(
970
+ () => filterAndSort(
971
+ roles,
972
+ sectionState.search,
973
+ sectionState.sort,
974
+ sectionState.order
975
+ ),
976
+ [roles, sectionState.search, sectionState.sort, sectionState.order]
977
+ );
978
+ const pageCount = Math.ceil(filtered.length / sectionState.pageSize) || 1;
979
+ const pageIndex = Math.min(sectionState.page - 1, Math.max(0, pageCount - 1));
980
+ const paginated = useMemo4(
981
+ () => filtered.slice(
982
+ pageIndex * sectionState.pageSize,
983
+ pageIndex * sectionState.pageSize + sectionState.pageSize
984
+ ),
985
+ [filtered, pageIndex, sectionState.pageSize]
986
+ );
987
+ return /* @__PURE__ */ jsx6(
988
+ EntitySection,
989
+ {
990
+ title: "Role",
991
+ state: sectionState,
992
+ onOpenChange: setOpen,
993
+ actions: /* @__PURE__ */ jsx6(
994
+ RoleSelector,
995
+ {
996
+ trigger: /* @__PURE__ */ jsxs6(Button4, { variant: "outline", size: "sm", children: [
997
+ /* @__PURE__ */ jsx6(IconPlus2, { className: "h-4 w-4" }),
998
+ "Add role"
999
+ ] }),
1000
+ multiple: true,
1001
+ onSelect: (roles2) => {
1002
+ console.log("Selected roles:", userId, roles2);
1003
+ }
1004
+ }
1005
+ ),
1006
+ config: {
1007
+ searchPlaceholder: "Search roles...",
1008
+ filterOptions: sectionState.filterOptions,
1009
+ sortOptions: sectionState.sortOptions,
1010
+ views: sectionState.views
1011
+ },
1012
+ children: (state) => /* @__PURE__ */ jsxs6(Fragment3, { children: [
1013
+ isLoading && /* @__PURE__ */ jsx6(
1014
+ EntityLoadingState2,
1015
+ {
1016
+ view: state.view,
1017
+ rowCount: state.pageSize,
1018
+ columnCount: TABLE_COLUMN_COUNT2,
1019
+ cardCount: state.pageSize
1020
+ }
1021
+ ),
1022
+ !isLoading && filtered.length === 0 && /* @__PURE__ */ jsx6(
1023
+ EntityEmptyState2,
1024
+ {
1025
+ icon: IconShield2,
1026
+ entityName: "role",
1027
+ title: "No roles",
1028
+ description: roles.length === 0 ? "No roles in tenant." : "No matches."
1029
+ }
1030
+ ),
1031
+ !isLoading && filtered.length > 0 && /* @__PURE__ */ jsx6(
1032
+ RolesList,
1033
+ {
1034
+ data: paginated,
1035
+ view: state.view,
1036
+ pageIndex,
1037
+ pageSize: state.pageSize,
1038
+ pageCount,
1039
+ totalRows: filtered.length,
1040
+ onPageChange: (p) => state.setPage(p + 1),
1041
+ onPageSizeChange: (size) => {
1042
+ state.setPageSize(size);
1043
+ state.setPage(1);
1044
+ }
1045
+ }
1046
+ )
1047
+ ] })
1048
+ }
1049
+ );
1050
+ }
1051
+
1052
+ // src/pages/iam/users/activity/user-activity-page-content.tsx
1053
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1054
+ function UserActivityPageContent({
1055
+ userId
1056
+ }) {
1057
+ return /* @__PURE__ */ jsx7(IAMGuard6, { children: /* @__PURE__ */ jsx7(UserActivityPageContentInner, { userId }) });
1058
+ }
1059
+ function UserActivityPageContentInner({
1060
+ userId
1061
+ }) {
1062
+ if (!userId) {
1063
+ return null;
1064
+ }
1065
+ return /* @__PURE__ */ jsxs7("div", { className: "space-y-4", children: [
1066
+ /* @__PURE__ */ jsxs7(Card3, { children: [
1067
+ /* @__PURE__ */ jsx7(CardHeader3, { children: /* @__PURE__ */ jsx7(CardTitle3, { children: "Activity" }) }),
1068
+ /* @__PURE__ */ jsxs7(CardContent3, { className: "flex items-center gap-2 text-muted-foreground text-sm", children: [
1069
+ /* @__PURE__ */ jsx7(IconCalendar2, { className: "h-4 w-4" }),
1070
+ "Activity (placeholder)"
1071
+ ] })
1072
+ ] }),
1073
+ /* @__PURE__ */ jsx7(RoleSection, { userId }),
1074
+ /* @__PURE__ */ jsx7(Section, { title: "Permissions", children: "test" }),
1075
+ /* @__PURE__ */ jsx7(Section, { title: "Groups", children: "test" })
1076
+ ] });
1077
+ }
167
1078
  export {
168
1079
  Account,
169
1080
  AuthCard,
@@ -208,6 +1119,7 @@ export {
208
1119
  VerificationForm,
209
1120
  VerifyEmail,
210
1121
  VerifyPhone,
1122
+ getSafeRedirectFromSearch,
211
1123
  getSessionCookieName,
212
1124
  handleError,
213
1125
  hasAuthCookie,