@mesob/auth-react 0.4.0 → 0.4.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 (371) hide show
  1. package/dist/chunk-35TCGAW3.js +98 -0
  2. package/dist/chunk-35TCGAW3.js.map +1 -0
  3. package/dist/chunk-3BZC4VVD.js +36 -0
  4. package/dist/chunk-3BZC4VVD.js.map +1 -0
  5. package/dist/chunk-45UCLKH2.js +188 -0
  6. package/dist/chunk-45UCLKH2.js.map +1 -0
  7. package/dist/chunk-55BMNC4S.js +115 -0
  8. package/dist/chunk-55BMNC4S.js.map +1 -0
  9. package/dist/chunk-5F5FZMHE.js +94 -0
  10. package/dist/chunk-5F5FZMHE.js.map +1 -0
  11. package/dist/chunk-5M7I7WNH.js +31 -0
  12. package/dist/chunk-5M7I7WNH.js.map +1 -0
  13. package/dist/chunk-72YRO3A7.js +288 -0
  14. package/dist/chunk-72YRO3A7.js.map +1 -0
  15. package/dist/chunk-7KXTL6NT.js +48 -0
  16. package/dist/chunk-7KXTL6NT.js.map +1 -0
  17. package/dist/chunk-AIMD6R6U.js +466 -0
  18. package/dist/chunk-AIMD6R6U.js.map +1 -0
  19. package/dist/chunk-BGSHXIHI.js +953 -0
  20. package/dist/chunk-BGSHXIHI.js.map +1 -0
  21. package/dist/chunk-BZ42QPXE.js +271 -0
  22. package/dist/chunk-BZ42QPXE.js.map +1 -0
  23. package/dist/chunk-C26NPUPI.js +272 -0
  24. package/dist/chunk-C26NPUPI.js.map +1 -0
  25. package/dist/chunk-C2KFZ57H.js +194 -0
  26. package/dist/chunk-C2KFZ57H.js.map +1 -0
  27. package/dist/chunk-C5ZW7FD2.js +46 -0
  28. package/dist/chunk-C5ZW7FD2.js.map +1 -0
  29. package/dist/chunk-DPH2PHK3.js +32 -0
  30. package/dist/chunk-DPH2PHK3.js.map +1 -0
  31. package/dist/chunk-EQ4346FE.js +139 -0
  32. package/dist/chunk-EQ4346FE.js.map +1 -0
  33. package/dist/chunk-FAHN63DA.js +535 -0
  34. package/dist/chunk-FAHN63DA.js.map +1 -0
  35. package/dist/chunk-FFR5UHTS.js +99 -0
  36. package/dist/chunk-FFR5UHTS.js.map +1 -0
  37. package/dist/chunk-FHOLUOOZ.js +164 -0
  38. package/dist/chunk-FHOLUOOZ.js.map +1 -0
  39. package/dist/chunk-G2AW2H36.js +11 -0
  40. package/dist/chunk-G2AW2H36.js.map +1 -0
  41. package/dist/chunk-G7SCXCCM.js +89 -0
  42. package/dist/chunk-G7SCXCCM.js.map +1 -0
  43. package/dist/chunk-GP7GIUI3.js +64 -0
  44. package/dist/chunk-GP7GIUI3.js.map +1 -0
  45. package/dist/chunk-GRT6EBR6.js +93 -0
  46. package/dist/chunk-GRT6EBR6.js.map +1 -0
  47. package/dist/chunk-GXKBVCVS.js +102 -0
  48. package/dist/chunk-GXKBVCVS.js.map +1 -0
  49. package/dist/chunk-HB2RZTHS.js +338 -0
  50. package/dist/chunk-HB2RZTHS.js.map +1 -0
  51. package/dist/chunk-HOO2VLNM.js +305 -0
  52. package/dist/chunk-HOO2VLNM.js.map +1 -0
  53. package/dist/chunk-II5MLBSB.js +183 -0
  54. package/dist/chunk-II5MLBSB.js.map +1 -0
  55. package/dist/chunk-ISNNPMF7.js +95 -0
  56. package/dist/chunk-ISNNPMF7.js.map +1 -0
  57. package/dist/chunk-JB6XVST4.js +141 -0
  58. package/dist/chunk-JB6XVST4.js.map +1 -0
  59. package/dist/chunk-JUHBVG5Q.js +303 -0
  60. package/dist/chunk-JUHBVG5Q.js.map +1 -0
  61. package/dist/chunk-JZZJCBAE.js +118 -0
  62. package/dist/chunk-JZZJCBAE.js.map +1 -0
  63. package/dist/chunk-KWG4DSB5.js +55 -0
  64. package/dist/chunk-KWG4DSB5.js.map +1 -0
  65. package/dist/chunk-L4CGIO2I.js +265 -0
  66. package/dist/chunk-L4CGIO2I.js.map +1 -0
  67. package/dist/chunk-LNG736CV.js +19 -0
  68. package/dist/chunk-LNG736CV.js.map +1 -0
  69. package/dist/chunk-LSYKVFJA.js +98 -0
  70. package/dist/chunk-LSYKVFJA.js.map +1 -0
  71. package/dist/chunk-LZR4YUDV.js +107 -0
  72. package/dist/chunk-LZR4YUDV.js.map +1 -0
  73. package/dist/chunk-MELNS4QH.js +255 -0
  74. package/dist/chunk-MELNS4QH.js.map +1 -0
  75. package/dist/chunk-MS2JUZ3N.js +94 -0
  76. package/dist/chunk-MS2JUZ3N.js.map +1 -0
  77. package/dist/chunk-NEO72TMH.js +32 -0
  78. package/dist/chunk-NEO72TMH.js.map +1 -0
  79. package/dist/chunk-NJPNTAAT.js +68 -0
  80. package/dist/chunk-NJPNTAAT.js.map +1 -0
  81. package/dist/chunk-NPW7D2HZ.js +16 -0
  82. package/dist/chunk-NPW7D2HZ.js.map +1 -0
  83. package/dist/chunk-OAN4EXU4.js +310 -0
  84. package/dist/chunk-OAN4EXU4.js.map +1 -0
  85. package/dist/chunk-OFLSINVU.js +138 -0
  86. package/dist/chunk-OFLSINVU.js.map +1 -0
  87. package/dist/chunk-OHIIMUQC.js +286 -0
  88. package/dist/chunk-OHIIMUQC.js.map +1 -0
  89. package/dist/chunk-OQGJX37L.js +239 -0
  90. package/dist/chunk-OQGJX37L.js.map +1 -0
  91. package/dist/chunk-OYHH7HQG.js +65 -0
  92. package/dist/chunk-OYHH7HQG.js.map +1 -0
  93. package/dist/chunk-PSRIZMWJ.js +486 -0
  94. package/dist/chunk-PSRIZMWJ.js.map +1 -0
  95. package/dist/chunk-QNCE2B5O.js +23 -0
  96. package/dist/chunk-QNCE2B5O.js.map +1 -0
  97. package/dist/chunk-RLPZFLAS.js +23 -0
  98. package/dist/chunk-RLPZFLAS.js.map +1 -0
  99. package/dist/chunk-RT5C7IAE.js +38 -0
  100. package/dist/chunk-RT5C7IAE.js.map +1 -0
  101. package/dist/chunk-S3CXCCKL.js +272 -0
  102. package/dist/chunk-S3CXCCKL.js.map +1 -0
  103. package/dist/chunk-SOCZK4CV.js +69 -0
  104. package/dist/chunk-SOCZK4CV.js.map +1 -0
  105. package/dist/chunk-T6P7UHVP.js +34 -0
  106. package/dist/chunk-T6P7UHVP.js.map +1 -0
  107. package/dist/chunk-TFVBER3Y.js +52 -0
  108. package/dist/chunk-TFVBER3Y.js.map +1 -0
  109. package/dist/chunk-UXOZ2TME.js +104 -0
  110. package/dist/chunk-UXOZ2TME.js.map +1 -0
  111. package/dist/chunk-V2W3WPCZ.js +22 -0
  112. package/dist/chunk-V2W3WPCZ.js.map +1 -0
  113. package/dist/chunk-YZ264S2L.js +286 -0
  114. package/dist/chunk-YZ264S2L.js.map +1 -0
  115. package/dist/chunk-ZESFGO3K.js +28 -0
  116. package/dist/chunk-ZESFGO3K.js.map +1 -0
  117. package/dist/chunk-ZG6WFZHX.js +143 -0
  118. package/dist/chunk-ZG6WFZHX.js.map +1 -0
  119. package/dist/components/auth/auth-card.d.ts +3 -6
  120. package/dist/components/auth/auth-card.js +3 -7
  121. package/dist/components/auth/auth-card.js.map +1 -1
  122. package/dist/components/auth/auth-layout.d.ts +3 -6
  123. package/dist/components/auth/auth-layout.js +3 -28
  124. package/dist/components/auth/auth-layout.js.map +1 -1
  125. package/dist/components/auth/countdown.d.ts +2 -5
  126. package/dist/components/auth/countdown.js +5 -130
  127. package/dist/components/auth/countdown.js.map +1 -1
  128. package/dist/components/auth/forgot-password.d.ts +1 -5
  129. package/dist/components/auth/forgot-password.js +6 -365
  130. package/dist/components/auth/forgot-password.js.map +1 -1
  131. package/dist/components/auth/reset-password-form.d.ts +2 -5
  132. package/dist/components/auth/reset-password-form.js +6 -487
  133. package/dist/components/auth/reset-password-form.js.map +1 -1
  134. package/dist/components/auth/set-password.d.ts +2 -5
  135. package/dist/components/auth/set-password.js +7 -521
  136. package/dist/components/auth/set-password.js.map +1 -1
  137. package/dist/components/auth/sign-in.d.ts +2 -5
  138. package/dist/components/auth/sign-in.js +7 -561
  139. package/dist/components/auth/sign-in.js.map +1 -1
  140. package/dist/components/auth/sign-up.d.ts +2 -5
  141. package/dist/components/auth/sign-up.js +6 -511
  142. package/dist/components/auth/sign-up.js.map +1 -1
  143. package/dist/components/auth/verification-form.d.ts +13 -2
  144. package/dist/components/auth/verification-form.js +5 -217
  145. package/dist/components/auth/verification-form.js.map +1 -1
  146. package/dist/components/auth/verify-email.d.ts +2 -5
  147. package/dist/components/auth/verify-email.js +8 -527
  148. package/dist/components/auth/verify-email.js.map +1 -1
  149. package/dist/components/auth/verify-phone.d.ts +2 -5
  150. package/dist/components/auth/verify-phone.js +8 -532
  151. package/dist/components/auth/verify-phone.js.map +1 -1
  152. package/dist/components/authorization/deny.d.ts +3 -6
  153. package/dist/components/authorization/deny.js +4 -47
  154. package/dist/components/authorization/deny.js.map +1 -1
  155. package/dist/components/authorization/grant.d.ts +3 -6
  156. package/dist/components/authorization/grant.js +4 -52
  157. package/dist/components/authorization/grant.js.map +1 -1
  158. package/dist/components/error-boundary.d.ts +6 -10
  159. package/dist/components/error-boundary.js +4 -43
  160. package/dist/components/error-boundary.js.map +1 -1
  161. package/dist/components/iam/permission-selector.d.ts +3 -6
  162. package/dist/components/iam/permission-selector.js +3 -116
  163. package/dist/components/iam/permission-selector.js.map +1 -1
  164. package/dist/components/iam/permissions-page.d.ts +1 -0
  165. package/dist/components/iam/permissions-page.js +10 -0
  166. package/dist/components/iam/permissions-page.js.map +1 -0
  167. package/dist/components/iam/permissions.d.ts +1 -5
  168. package/dist/components/iam/permissions.js +5 -198
  169. package/dist/components/iam/permissions.js.map +1 -1
  170. package/dist/components/iam/role-detail-layout.d.ts +3 -6
  171. package/dist/components/iam/role-detail-layout.js +3 -131
  172. package/dist/components/iam/role-detail-layout.js.map +1 -1
  173. package/dist/components/iam/role-detail-page.d.ts +2 -5
  174. package/dist/components/iam/role-detail-page.js +3 -223
  175. package/dist/components/iam/role-detail-page.js.map +1 -1
  176. package/dist/components/iam/role-permissions-page.d.ts +2 -5
  177. package/dist/components/iam/role-permissions-page.js +4 -391
  178. package/dist/components/iam/role-permissions-page.js.map +1 -1
  179. package/dist/components/iam/roles-page.d.ts +1 -0
  180. package/dist/components/iam/roles-page.js +13 -0
  181. package/dist/components/iam/roles-page.js.map +1 -0
  182. package/dist/components/iam/roles.d.ts +1 -5
  183. package/dist/components/iam/roles.js +5 -218
  184. package/dist/components/iam/roles.js.map +1 -1
  185. package/dist/components/iam/sessions-page.d.ts +1 -0
  186. package/dist/components/iam/sessions-page.js +12 -0
  187. package/dist/components/iam/sessions-page.js.map +1 -0
  188. package/dist/components/iam/sessions.d.ts +1 -5
  189. package/dist/components/iam/sessions.js +5 -198
  190. package/dist/components/iam/sessions.js.map +1 -1
  191. package/dist/components/iam/tenants-page.d.ts +1 -0
  192. package/dist/components/iam/tenants-page.js +13 -0
  193. package/dist/components/iam/tenants-page.js.map +1 -0
  194. package/dist/components/iam/tenants.d.ts +1 -5
  195. package/dist/components/iam/tenants.js +5 -204
  196. package/dist/components/iam/tenants.js.map +1 -1
  197. package/dist/components/iam/users-page.d.ts +1 -0
  198. package/dist/components/iam/users-page.js +13 -0
  199. package/dist/components/iam/users-page.js.map +1 -0
  200. package/dist/components/iam/users.d.ts +1 -5
  201. package/dist/components/iam/users.js +5 -207
  202. package/dist/components/iam/users.js.map +1 -1
  203. package/dist/components/profile/account.d.ts +1 -5
  204. package/dist/components/profile/account.js +4 -151
  205. package/dist/components/profile/account.js.map +1 -1
  206. package/dist/components/profile/change-email-form.d.ts +1 -5
  207. package/dist/components/profile/change-email-form.js +9 -735
  208. package/dist/components/profile/change-email-form.js.map +1 -1
  209. package/dist/components/profile/change-password-form.d.ts +1 -5
  210. package/dist/components/profile/change-password-form.js +3 -262
  211. package/dist/components/profile/change-password-form.js.map +1 -1
  212. package/dist/components/profile/change-phone-form.d.ts +1 -5
  213. package/dist/components/profile/change-phone-form.js +10 -772
  214. package/dist/components/profile/change-phone-form.js.map +1 -1
  215. package/dist/components/profile/change-profile.d.ts +3 -7
  216. package/dist/components/profile/change-profile.js +2 -40
  217. package/dist/components/profile/change-profile.js.map +1 -1
  218. package/dist/components/profile/otp-verification-modal.d.ts +2 -5
  219. package/dist/components/profile/otp-verification-modal.js +6 -266
  220. package/dist/components/profile/otp-verification-modal.js.map +1 -1
  221. package/dist/components/profile/profile-layout.d.ts +4 -0
  222. package/dist/components/profile/profile-layout.js +10 -0
  223. package/dist/components/profile/profile-layout.js.map +1 -0
  224. package/dist/components/profile/request-change-email-form.d.ts +2 -5
  225. package/dist/components/profile/request-change-email-form.js +4 -285
  226. package/dist/components/profile/request-change-email-form.js.map +1 -1
  227. package/dist/components/profile/request-change-phone-form.d.ts +2 -5
  228. package/dist/components/profile/request-change-phone-form.js +5 -323
  229. package/dist/components/profile/request-change-phone-form.js.map +1 -1
  230. package/dist/components/profile/security.d.ts +1 -5
  231. package/dist/components/profile/security.js +15 -1508
  232. package/dist/components/profile/security.js.map +1 -1
  233. package/dist/components/profile/verify-change-email-form.d.ts +2 -5
  234. package/dist/components/profile/verify-change-email-form.js +7 -407
  235. package/dist/components/profile/verify-change-email-form.js.map +1 -1
  236. package/dist/components/profile/verify-change-phone-form.d.ts +2 -5
  237. package/dist/components/profile/verify-change-phone-form.js +7 -411
  238. package/dist/components/profile/verify-change-phone-form.js.map +1 -1
  239. package/dist/components/shared/data-table.d.ts +5 -8
  240. package/dist/components/shared/data-table.js +3 -79
  241. package/dist/components/shared/data-table.js.map +1 -1
  242. package/dist/components/skeletons/auth-form-skeleton.d.ts +1 -5
  243. package/dist/components/skeletons/auth-form-skeleton.js +3 -27
  244. package/dist/components/skeletons/auth-form-skeleton.js.map +1 -1
  245. package/dist/components/skeletons/profile-skeleton.d.ts +1 -5
  246. package/dist/components/skeletons/profile-skeleton.js +3 -28
  247. package/dist/components/skeletons/profile-skeleton.js.map +1 -1
  248. package/dist/components/skeletons/table-skeleton.d.ts +2 -5
  249. package/dist/components/skeletons/table-skeleton.js +3 -34
  250. package/dist/components/skeletons/table-skeleton.js.map +1 -1
  251. package/dist/constants/auth.error.codes.d.ts +5 -0
  252. package/dist/hooks/use-session-cookie-name.d.ts +1 -0
  253. package/dist/hooks/use-translator.d.ts +1 -0
  254. package/dist/index.d.ts +50 -92
  255. package/dist/index.js +147 -4936
  256. package/dist/index.js.map +1 -1
  257. package/dist/lib/query-options.d.ts +10 -0
  258. package/dist/lib/translations.d.ts +3 -0
  259. package/dist/pages/auth/forgot-password.d.ts +3 -7
  260. package/dist/pages/auth/forgot-password.js +8 -770
  261. package/dist/pages/auth/forgot-password.js.map +1 -1
  262. package/dist/pages/auth/layout.d.ts +3 -7
  263. package/dist/pages/auth/layout.js +13 -536
  264. package/dist/pages/auth/layout.js.map +1 -1
  265. package/dist/pages/auth/reset-password.d.ts +4 -7
  266. package/dist/pages/auth/reset-password.js +8 -888
  267. package/dist/pages/auth/reset-password.js.map +1 -1
  268. package/dist/pages/auth/set-password.d.ts +4 -7
  269. package/dist/pages/auth/set-password.js +9 -927
  270. package/dist/pages/auth/set-password.js.map +1 -1
  271. package/dist/pages/auth/sign-in.d.ts +4 -7
  272. package/dist/pages/auth/sign-in.js +9 -967
  273. package/dist/pages/auth/sign-in.js.map +1 -1
  274. package/dist/pages/auth/sign-up.d.ts +4 -7
  275. package/dist/pages/auth/sign-up.js +8 -915
  276. package/dist/pages/auth/sign-up.js.map +1 -1
  277. package/dist/pages/auth/verify-email.d.ts +4 -7
  278. package/dist/pages/auth/verify-email.js +10 -922
  279. package/dist/pages/auth/verify-email.js.map +1 -1
  280. package/dist/pages/auth/verify-phone.d.ts +4 -7
  281. package/dist/pages/auth/verify-phone.js +10 -927
  282. package/dist/pages/auth/verify-phone.js.map +1 -1
  283. package/dist/pages/iam/permissions/_components/permission-card.d.ts +6 -0
  284. package/dist/pages/iam/permissions/_components/permissions-data.d.ts +7 -0
  285. package/dist/pages/iam/permissions/_components/permissions-list.d.ts +14 -0
  286. package/dist/pages/iam/permissions.d.ts +1 -5
  287. package/dist/pages/iam/permissions.js +4 -302
  288. package/dist/pages/iam/permissions.js.map +1 -1
  289. package/dist/pages/iam/role-detail-layout.d.ts +3 -6
  290. package/dist/pages/iam/role-detail-layout.js +5 -132
  291. package/dist/pages/iam/role-detail-layout.js.map +1 -1
  292. package/dist/pages/iam/role-detail.d.ts +4 -7
  293. package/dist/pages/iam/role-detail.js +5 -224
  294. package/dist/pages/iam/role-detail.js.map +1 -1
  295. package/dist/pages/iam/role-permissions.d.ts +4 -7
  296. package/dist/pages/iam/role-permissions.js +6 -392
  297. package/dist/pages/iam/role-permissions.js.map +1 -1
  298. package/dist/pages/iam/role-users.d.ts +4 -7
  299. package/dist/pages/iam/role-users.js +9 -808
  300. package/dist/pages/iam/role-users.js.map +1 -1
  301. package/dist/pages/iam/roles/_components/role-card.d.ts +7 -0
  302. package/dist/pages/iam/roles/_components/role-form.d.ts +9 -0
  303. package/dist/pages/iam/roles/_components/role-selector.d.ts +11 -0
  304. package/dist/pages/iam/roles/_components/roles-data.d.ts +16 -0
  305. package/dist/pages/iam/roles/_components/roles-list.d.ts +15 -0
  306. package/dist/pages/iam/roles/users/_components/role-users-page.d.ts +5 -0
  307. package/dist/pages/iam/roles.d.ts +1 -5
  308. package/dist/pages/iam/roles.js +7 -678
  309. package/dist/pages/iam/roles.js.map +1 -1
  310. package/dist/pages/iam/sessions/_components/session-card.d.ts +6 -0
  311. package/dist/pages/iam/sessions/_components/sessions-data.d.ts +7 -0
  312. package/dist/pages/iam/sessions/_components/sessions-list.d.ts +14 -0
  313. package/dist/pages/iam/sessions.d.ts +1 -5
  314. package/dist/pages/iam/sessions.js +6 -309
  315. package/dist/pages/iam/sessions.js.map +1 -1
  316. package/dist/pages/iam/shared/navigation.d.ts +8 -0
  317. package/dist/pages/iam/shared/page-helpers.d.ts +12 -0
  318. package/dist/pages/iam/tenant-detail.d.ts +2 -5
  319. package/dist/pages/iam/tenant-detail.js +6 -174
  320. package/dist/pages/iam/tenant-detail.js.map +1 -1
  321. package/dist/pages/iam/tenants/_components/tenant-card.d.ts +6 -0
  322. package/dist/pages/iam/tenants/_components/tenant-form.d.ts +9 -0
  323. package/dist/pages/iam/tenants/_components/tenant-selector.d.ts +13 -0
  324. package/dist/pages/iam/tenants/_components/tenants-data.d.ts +12 -0
  325. package/dist/pages/iam/tenants/_components/tenants-list.d.ts +15 -0
  326. package/dist/pages/iam/tenants/tenant-detail-page-content.d.ts +5 -0
  327. package/dist/pages/iam/tenants.d.ts +1 -5
  328. package/dist/pages/iam/tenants.js +7 -604
  329. package/dist/pages/iam/tenants.js.map +1 -1
  330. package/dist/pages/iam/user-activity.d.ts +2 -5
  331. package/dist/pages/iam/user-activity.js +9 -838
  332. package/dist/pages/iam/user-activity.js.map +1 -1
  333. package/dist/pages/iam/user-detail-layout.d.ts +3 -6
  334. package/dist/pages/iam/user-detail-layout.js +5 -93
  335. package/dist/pages/iam/user-detail-layout.js.map +1 -1
  336. package/dist/pages/iam/user-detail.d.ts +2 -5
  337. package/dist/pages/iam/user-detail.js +5 -92
  338. package/dist/pages/iam/user-detail.js.map +1 -1
  339. package/dist/pages/iam/users/_components/bulk-invite-user-form.d.ts +6 -0
  340. package/dist/pages/iam/users/_components/invite-user-form.d.ts +6 -0
  341. package/dist/pages/iam/users/_components/invite-user-shared.d.ts +25 -0
  342. package/dist/pages/iam/users/_components/user-card.d.ts +6 -0
  343. package/dist/pages/iam/users/_components/user-detail-layout-content.d.ts +6 -0
  344. package/dist/pages/iam/users/_components/user-detail-page-content.d.ts +5 -0
  345. package/dist/pages/iam/users/_components/user-form.d.ts +9 -0
  346. package/dist/pages/iam/users/_components/user-selector.d.ts +12 -0
  347. package/dist/pages/iam/users/_components/users-data.d.ts +22 -0
  348. package/dist/pages/iam/users/_components/users-list.d.ts +15 -0
  349. package/dist/pages/iam/users/activity/_components/role-section.d.ts +3 -0
  350. package/dist/pages/iam/users/activity/user-activity-page-content.d.ts +5 -0
  351. package/dist/pages/iam/users.d.ts +1 -5
  352. package/dist/pages/iam/users.js +7 -1269
  353. package/dist/pages/iam/users.js.map +1 -1
  354. package/dist/pages/profile/_components/profile-sidebar.d.ts +1 -0
  355. package/dist/pages/profile/account.d.ts +1 -5
  356. package/dist/pages/profile/account.js +9 -158
  357. package/dist/pages/profile/account.js.map +1 -1
  358. package/dist/pages/profile/layout.d.ts +1 -8
  359. package/dist/pages/profile/layout.js +5 -128
  360. package/dist/pages/profile/layout.js.map +1 -1
  361. package/dist/pages/profile/security.d.ts +1 -5
  362. package/dist/pages/profile/security.js +20 -1515
  363. package/dist/pages/profile/security.js.map +1 -1
  364. package/dist/provider.d.ts +53 -0
  365. package/dist/{types-g9QcNRxT.d.ts → types.d.ts} +33 -12
  366. package/dist/utils/cookie.d.ts +2 -0
  367. package/dist/utils/custom-fetch.d.ts +2 -0
  368. package/dist/utils/handle-error.d.ts +7 -0
  369. package/dist/utils/normalize-phone.d.ts +1 -0
  370. package/package.json +4 -4
  371. package/dist/verification-form-ipSRTtQB.d.ts +0 -22
@@ -1,813 +1,14 @@
1
- // src/pages/iam/roles/users/_components/role-users-page.tsx
2
1
  import {
3
- Avatar,
4
- AvatarFallback,
5
- AvatarImage,
6
- Badge as Badge3,
7
- Button as Button2,
8
- DataTablePagination,
9
- DeleteConfirmButton,
10
- DisplayTable,
11
- EntityEmptyState,
12
- EntityFilter,
13
- EntityHeader,
14
- EntityLoadingState,
15
- EntitySearch,
16
- EntitySort,
17
- EntityViewToggle,
18
- PageBody,
19
- Tbody,
20
- Td,
21
- Th,
22
- Thead,
23
- Tr,
24
- useEntityPagination,
25
- useEntityParams
26
- } from "@mesob/ui/components";
27
- import { IconPlus, IconUser, IconUsers as IconUsers2 } from "@tabler/icons-react";
28
- import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
29
- import { useMemo as useMemo2 } from "react";
30
- import { toast } from "sonner";
31
-
32
- // src/provider.tsx
33
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
34
- import { deepmerge } from "deepmerge-ts";
35
- import createFetchClient from "openapi-fetch";
36
- import createClient from "openapi-react-query";
37
- import { createContext, useContext, useMemo, useState } from "react";
38
-
39
- // src/utils/cookie.ts
40
- var isProduction = typeof process !== "undefined" && process.env.NODE_ENV === "production";
41
-
42
- // src/provider.tsx
43
- import { jsx } from "react/jsx-runtime";
44
- var SessionContext = createContext(null);
45
- var ApiContext = createContext(null);
46
- var ConfigContext = createContext(null);
47
- var queryClient = new QueryClient({
48
- defaultOptions: {
49
- queries: {
50
- refetchOnWindowFocus: false
51
- }
52
- }
53
- });
54
- function useApi() {
55
- const context = useContext(ApiContext);
56
- if (!context) {
57
- throw new Error("useApi must be used within MesobAuthProvider");
58
- }
59
- return context;
60
- }
61
-
62
- // src/pages/iam/shared/navigation.tsx
63
- import { useMesob } from "@mesob/ui/providers";
64
- import { jsx as jsx2 } from "react/jsx-runtime";
65
- function AppLink({ href, children, ...props }) {
66
- const mesob = useMesob();
67
- const Link2 = mesob?.linkComponent ?? mesob?.navigation?.Link;
68
- const locale = mesob?.locale;
69
- if (Link2) {
70
- return /* @__PURE__ */ jsx2(Link2, { href, ...locale ? { locale } : {}, ...props, children });
71
- }
72
- return /* @__PURE__ */ jsx2("a", { href, ...props, children });
73
- }
74
-
75
- // src/lib/query-options.ts
76
- import { keepPreviousData } from "@tanstack/react-query";
77
- var defaultEntityQueryOptions = {
78
- refetchOnMount: false,
79
- refetchOnWindowFocus: false,
80
- refetchOnReconnect: false,
81
- staleTime: 60 * 1e3,
82
- gcTime: 5 * 60 * 1e3,
83
- placeholderData: keepPreviousData,
84
- retry: 1
85
- };
86
-
87
- // src/pages/iam/shared/page-helpers.tsx
88
- import { jsx as jsx3 } from "react/jsx-runtime";
89
- var authApi$ = {
90
- useQuery(...args) {
91
- const { hooks } = useApi();
92
- return hooks.useQuery(...args);
93
- },
94
- useMutation(...args) {
95
- const { hooks } = useApi();
96
- return hooks.useMutation(...args);
97
- }
98
- };
99
- function Link(props) {
100
- return /* @__PURE__ */ jsx3(AppLink, { ...props });
101
- }
102
-
103
- // src/pages/iam/users/_components/user-selector.tsx
104
- import {
105
- Badge as Badge2,
106
- EntitySelector,
107
- useEntitySectionState
108
- } from "@mesob/ui/components";
109
- import { cn } from "@mesob/ui/lib/utils";
110
- import { IconCalendar, IconUsers } from "@tabler/icons-react";
111
-
112
- // src/pages/iam/users/_components/user-card.tsx
113
- import {
114
- Badge,
115
- Button,
116
- Card,
117
- CardContent,
118
- CardHeader,
119
- DropdownMenu,
120
- DropdownMenuContent,
121
- DropdownMenuItem,
122
- DropdownMenuPortal,
123
- DropdownMenuTrigger
124
- } from "@mesob/ui/components";
125
- import { IconDots, IconPencil } from "@tabler/icons-react";
126
- import { useState as useState2 } from "react";
127
-
128
- // src/pages/iam/users/_components/user-form.tsx
129
- import { zodResolver } from "@hookform/resolvers/zod";
130
- import {
131
- EntityDrawer,
132
- EntityFormActions,
133
- Input,
134
- Label,
135
- Skeleton
136
- } from "@mesob/ui/components";
137
- import { useQueryClient } from "@tanstack/react-query";
138
- import { useEffect } from "react";
139
- import { useForm } from "react-hook-form";
140
- import { z } from "zod";
141
- import { jsx as jsx4, jsxs } from "react/jsx-runtime";
142
- var schema = z.object({
143
- fullName: z.string().min(1, "Name is required"),
144
- email: z.string().email().optional().or(z.literal("")),
145
- phone: z.string().optional()
146
- });
147
- var defaults = {
148
- fullName: "",
149
- email: "",
150
- phone: ""
151
- };
152
- function UserForm({
153
- mode,
154
- userId,
155
- open,
156
- onClose,
157
- onSuccess
158
- }) {
159
- const qc = useQueryClient();
160
- const { data, isLoading } = authApi$.useQuery(
161
- "get",
162
- "/users/{id}",
163
- { params: { path: { id: userId ?? "" } } },
164
- { enabled: mode === "edit" && !!userId }
165
- );
166
- const create = authApi$.useMutation("post", "/users", {
167
- onSuccess: () => {
168
- qc.invalidateQueries({ queryKey: ["get", "/users"] });
169
- }
170
- });
171
- const update = authApi$.useMutation("put", "/users/{id}", {
172
- onSuccess: () => {
173
- qc.invalidateQueries({ queryKey: ["get", "/users"] });
174
- if (userId) {
175
- qc.invalidateQueries({ queryKey: ["get", "/users/{id}"] });
176
- }
177
- }
178
- });
179
- const del = authApi$.useMutation("delete", "/users/{id}", {
180
- onSuccess: () => {
181
- qc.invalidateQueries({ queryKey: ["get", "/users"] });
182
- }
183
- });
184
- const form = useForm({
185
- resolver: zodResolver(schema),
186
- defaultValues: defaults
187
- });
188
- const { reset, formState } = form;
189
- useEffect(() => {
190
- if (!open) {
191
- return;
192
- }
193
- if (mode === "edit" && data?.user && !isLoading) {
194
- const u = data.user;
195
- reset({
196
- fullName: u.fullName,
197
- email: u.email ?? "",
198
- phone: u.phone ?? ""
199
- });
200
- } else {
201
- reset(defaults);
202
- }
203
- }, [mode, data, open, isLoading, reset]);
204
- const onSubmit = form.handleSubmit(async (d) => {
205
- const payload = {
206
- fullName: d.fullName,
207
- email: d.email || void 0,
208
- phone: d.phone || void 0
209
- };
210
- if (mode === "new") {
211
- await create.mutateAsync({ body: payload });
212
- } else if (userId) {
213
- await update.mutateAsync({
214
- params: { path: { id: userId } },
215
- body: payload
216
- });
217
- }
218
- onSuccess?.();
219
- onClose();
220
- });
221
- const onDelete = async () => {
222
- if (!userId) {
223
- return;
224
- }
225
- await del.mutateAsync({ params: { path: { id: userId } } });
226
- onSuccess?.();
227
- onClose();
228
- };
229
- const isSubmitting = create.isPending || update.isPending;
230
- return /* @__PURE__ */ jsx4(
231
- EntityDrawer,
232
- {
233
- title: mode === "new" ? "New user" : "Edit user",
234
- open,
235
- onClose,
236
- isDirty: formState.isDirty,
237
- form: isLoading ? /* @__PURE__ */ jsx4(FormSkeleton, {}) : /* @__PURE__ */ jsxs("form", { onSubmit, className: "space-y-4", children: [
238
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
239
- /* @__PURE__ */ jsxs(Label, { htmlFor: "fullName", children: [
240
- "Full name ",
241
- /* @__PURE__ */ jsx4("span", { className: "text-destructive", children: "*" })
242
- ] }),
243
- /* @__PURE__ */ jsx4(
244
- Input,
245
- {
246
- id: "fullName",
247
- placeholder: "Full name",
248
- ...form.register("fullName")
249
- }
250
- ),
251
- formState.errors.fullName && /* @__PURE__ */ jsx4("p", { className: "text-sm text-destructive", children: formState.errors.fullName.message })
252
- ] }),
253
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
254
- /* @__PURE__ */ jsx4(Label, { htmlFor: "email", children: "Email" }),
255
- /* @__PURE__ */ jsx4(
256
- Input,
257
- {
258
- id: "email",
259
- type: "email",
260
- placeholder: "Email",
261
- ...form.register("email")
262
- }
263
- ),
264
- formState.errors.email && /* @__PURE__ */ jsx4("p", { className: "text-sm text-destructive", children: formState.errors.email.message })
265
- ] }),
266
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
267
- /* @__PURE__ */ jsx4(Label, { htmlFor: "phone", children: "Phone" }),
268
- /* @__PURE__ */ jsx4(
269
- Input,
270
- {
271
- id: "phone",
272
- placeholder: "Phone",
273
- ...form.register("phone")
274
- }
275
- )
276
- ] })
277
- ] }),
278
- actions: /* @__PURE__ */ jsx4(
279
- EntityFormActions,
280
- {
281
- mode,
282
- onSubmit,
283
- onReset: mode === "new" ? () => reset(defaults) : void 0,
284
- onDelete: mode === "edit" ? onDelete : void 0,
285
- isSubmitting,
286
- isDeleting: del.isPending,
287
- disabled: isLoading,
288
- itemName: "user"
289
- }
290
- )
291
- }
292
- );
293
- }
294
- function FormSkeleton() {
295
- return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
296
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
297
- /* @__PURE__ */ jsx4(Skeleton, { className: "h-4 w-20" }),
298
- /* @__PURE__ */ jsx4(Skeleton, { className: "h-10 w-full" })
299
- ] }),
300
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
301
- /* @__PURE__ */ jsx4(Skeleton, { className: "h-4 w-16" }),
302
- /* @__PURE__ */ jsx4(Skeleton, { className: "h-10 w-full" })
303
- ] }),
304
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
305
- /* @__PURE__ */ jsx4(Skeleton, { className: "h-4 w-14" }),
306
- /* @__PURE__ */ jsx4(Skeleton, { className: "h-10 w-full" })
307
- ] }),
308
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
309
- /* @__PURE__ */ jsx4(Skeleton, { className: "h-4 w-16" }),
310
- /* @__PURE__ */ jsx4(Skeleton, { className: "h-10 w-full" })
311
- ] })
312
- ] });
313
- }
314
-
315
- // src/pages/iam/users/_components/user-card.tsx
316
- import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
317
- function UserCard({ user }) {
318
- const [editOpen, setEditOpen] = useState2(false);
319
- return /* @__PURE__ */ jsxs2(Fragment, { children: [
320
- /* @__PURE__ */ jsxs2(Card, { className: "group hover:shadow-md transition-shadow", children: [
321
- /* @__PURE__ */ jsx5(CardHeader, { className: "pb-2", children: /* @__PURE__ */ jsxs2("div", { className: "flex items-start justify-between", children: [
322
- /* @__PURE__ */ jsx5(
323
- Link,
324
- {
325
- href: `/iam/users/${user.id}`,
326
- className: "text-left font-semibold hover:text-primary hover:underline",
327
- children: user.fullName
328
- }
329
- ),
330
- /* @__PURE__ */ jsxs2(DropdownMenu, { children: [
331
- /* @__PURE__ */ jsx5(
332
- DropdownMenuTrigger,
333
- {
334
- render: /* @__PURE__ */ jsx5(
335
- Button,
336
- {
337
- variant: "ghost",
338
- size: "icon",
339
- className: "h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity"
340
- }
341
- ),
342
- children: /* @__PURE__ */ jsx5(IconDots, { className: "h-4 w-4" })
343
- }
344
- ),
345
- /* @__PURE__ */ jsx5(DropdownMenuPortal, { children: /* @__PURE__ */ jsx5(DropdownMenuContent, { children: /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: () => setEditOpen(true), children: [
346
- /* @__PURE__ */ jsx5(IconPencil, { className: "mr-2 h-4 w-4" }),
347
- "Edit"
348
- ] }) }) })
349
- ] })
350
- ] }) }),
351
- /* @__PURE__ */ jsxs2(CardContent, { className: "space-y-2", children: [
352
- user.email && /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
353
- /* @__PURE__ */ jsx5("span", { className: "text-sm", children: user.email }),
354
- user.emailVerified && /* @__PURE__ */ jsx5(Badge, { variant: "outline", className: "text-xs", children: "Verified" })
355
- ] }),
356
- /* @__PURE__ */ jsxs2("p", { className: "text-xs text-muted-foreground", children: [
357
- "Last sign in",
358
- " ",
359
- user.lastSignInAt ? new Date(user.lastSignInAt).toLocaleDateString() : "never"
360
- ] })
361
- ] })
362
- ] }),
363
- editOpen && /* @__PURE__ */ jsx5(
364
- UserForm,
365
- {
366
- mode: "edit",
367
- userId: user.id,
368
- open: editOpen,
369
- onClose: () => setEditOpen(false)
370
- }
371
- )
372
- ] });
373
- }
374
-
375
- // src/pages/iam/users/_components/user-selector.tsx
376
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
377
- function SelectableUserCard({
378
- user,
379
- selected,
380
- onToggle
381
- }) {
382
- return (
383
- // biome-ignore lint/a11y/useSemanticElements: div needed to avoid nested buttons from UserCard
384
- /* @__PURE__ */ jsx6(
385
- "div",
386
- {
387
- role: "button",
388
- tabIndex: 0,
389
- onClick: onToggle,
390
- onKeyDown: (e) => {
391
- if (e.key === "Enter") {
392
- onToggle();
393
- }
394
- },
395
- className: cn(
396
- "cursor-pointer rounded-lg transition-shadow focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
397
- selected && "ring-primary ring-2"
398
- ),
399
- children: /* @__PURE__ */ jsx6(UserCard, { user })
400
- }
401
- )
402
- );
403
- }
404
- var userColumns = [
405
- {
406
- key: "name",
407
- header: "Name",
408
- cell: (user) => /* @__PURE__ */ jsx6("p", { className: "font-medium", children: user.fullName })
409
- },
410
- {
411
- key: "contact",
412
- header: "Contact",
413
- cell: (user) => /* @__PURE__ */ jsxs3("div", { className: "space-y-1", children: [
414
- user.email && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
415
- /* @__PURE__ */ jsx6("span", { className: "text-sm", children: user.email }),
416
- user.emailVerified && /* @__PURE__ */ jsx6(Badge2, { variant: "outline", className: "text-xs", children: "Verified" })
417
- ] }),
418
- user.phone && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
419
- /* @__PURE__ */ jsx6("span", { className: "text-sm", children: user.phone }),
420
- user.phoneVerified && /* @__PURE__ */ jsx6(Badge2, { variant: "outline", className: "text-xs", children: "Verified" })
421
- ] }),
422
- !(user.email || user.phone) && /* @__PURE__ */ jsx6("span", { className: "text-muted-foreground", children: "\u2014" })
423
- ] })
424
- },
425
- {
426
- key: "lastSignIn",
427
- header: "Last sign in",
428
- cell: (user) => /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1 text-muted-foreground", children: [
429
- /* @__PURE__ */ jsx6(IconCalendar, { className: "h-4 w-4" }),
430
- user.lastSignInAt ? new Date(user.lastSignInAt).toLocaleDateString() : "Never"
431
- ] })
432
- }
433
- ];
434
- var EMPTY_EXCLUDE_IDS = [];
435
- function UserSelector({
436
- trigger,
437
- multiple = false,
438
- onSelect,
439
- excludeIds = EMPTY_EXCLUDE_IDS,
440
- modalSize = "xl",
441
- contentClassName
442
- }) {
443
- const state = useEntitySectionState({
444
- defaultSort: "createdAt",
445
- defaultOrder: "desc",
446
- defaultPageSize: 10,
447
- searchParamName: "handle"
448
- });
449
- const usersQuery = state.queryConfig;
450
- const { data, isPending, isFetching } = authApi$.useQuery(
451
- "get",
452
- "/users",
453
- usersQuery,
454
- defaultEntityQueryOptions
455
- );
456
- const users = (data?.users ?? []).filter((user) => {
457
- return !excludeIds.includes(user.id);
458
- });
459
- const config = {
460
- title: "Select user(s)",
461
- modalSize,
462
- contentClassName,
463
- multiple,
464
- entityName: "user",
465
- entityIcon: IconUsers,
466
- columns: userColumns,
467
- columnCount: 4,
468
- getItemLabel: (user) => user.fullName,
469
- searchPlaceholder: "Search users...",
470
- filterOptions: [
471
- { label: "All", value: "" },
472
- { label: "Email Verified", value: "emailVerified" },
473
- { label: "Phone Verified", value: "phoneVerified" },
474
- { label: "Not Verified", value: "notVerified" }
475
- ],
476
- sortOptions: [
477
- { label: "Created", value: "createdAt" },
478
- { label: "Updated", value: "updatedAt" },
479
- { label: "Name", value: "fullName" },
480
- { label: "Last Sign In", value: "lastSignInAt" }
481
- ],
482
- showViewToggle: false,
483
- renderCard: (user, selected, onToggle) => /* @__PURE__ */ jsx6(SelectableUserCard, { user, selected, onToggle })
484
- };
485
- return /* @__PURE__ */ jsx6(
486
- EntitySelector,
487
- {
488
- trigger,
489
- config,
490
- onSelect,
491
- items: users,
492
- total: data?.total,
493
- isLoading: isPending || isFetching,
494
- state
495
- }
496
- );
497
- }
498
-
499
- // src/pages/iam/roles/users/_components/role-users-page.tsx
500
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
501
- var TABLE_COLUMN_COUNT = 4;
502
- function initials(user) {
503
- return user.fullName.split(" ").filter(Boolean).slice(0, 2).map((part) => part[0]?.toUpperCase() ?? "").join("");
504
- }
505
- function UserIdentity({ user }) {
506
- return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
507
- /* @__PURE__ */ jsxs4(Avatar, { className: "h-9 w-9", children: [
508
- /* @__PURE__ */ jsx7(AvatarImage, { src: user.image ?? void 0 }),
509
- /* @__PURE__ */ jsx7(AvatarFallback, { children: initials(user) })
510
- ] }),
511
- /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7("p", { className: "font-medium", children: user.fullName }) })
512
- ] });
513
- }
514
- function UserContact({ user }) {
515
- return /* @__PURE__ */ jsxs4("div", { className: "space-y-1", children: [
516
- user.email ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
517
- /* @__PURE__ */ jsx7("span", { children: user.email }),
518
- user.emailVerified ? /* @__PURE__ */ jsx7(Badge3, { variant: "outline", children: "Verified" }) : null
519
- ] }) : null,
520
- user.phone ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
521
- /* @__PURE__ */ jsx7("span", { children: user.phone }),
522
- user.phoneVerified ? /* @__PURE__ */ jsx7(Badge3, { variant: "outline", children: "Verified" }) : null
523
- ] }) : null,
524
- user.email || user.phone ? null : /* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "\u2014" })
525
- ] });
526
- }
527
- function UserRemoveButton({
528
- roleId,
529
- userId,
530
- onRemove
531
- }) {
532
- return /* @__PURE__ */ jsx7(
533
- DeleteConfirmButton,
534
- {
535
- entityName: "user",
536
- onConfirm: () => onRemove(roleId, userId),
537
- triggerClassName: "size-8 text-destructive hover:text-destructive"
538
- }
539
- );
540
- }
541
- function RoleUsersTable({
542
- roleId,
543
- users,
544
- onRemove
545
- }) {
546
- return /* @__PURE__ */ jsxs4(DisplayTable, { withTableBorder: true, children: [
547
- /* @__PURE__ */ jsx7(Thead, { children: /* @__PURE__ */ jsxs4(Tr, { children: [
548
- /* @__PURE__ */ jsx7(Th, { children: "User" }),
549
- /* @__PURE__ */ jsx7(Th, { children: "Contact" }),
550
- /* @__PURE__ */ jsx7(Th, { children: "Last sign in" }),
551
- /* @__PURE__ */ jsx7(Th, { className: "w-[60px]" })
552
- ] }) }),
553
- /* @__PURE__ */ jsx7(Tbody, { children: users.map((user) => /* @__PURE__ */ jsxs4(Tr, { children: [
554
- /* @__PURE__ */ jsx7(Td, { children: /* @__PURE__ */ jsx7(UserIdentity, { user }) }),
555
- /* @__PURE__ */ jsx7(Td, { children: /* @__PURE__ */ jsx7(UserContact, { user }) }),
556
- /* @__PURE__ */ jsx7(Td, { children: user.lastSignInAt ? new Date(user.lastSignInAt).toLocaleDateString() : "Never" }),
557
- /* @__PURE__ */ jsx7(Td, { children: /* @__PURE__ */ jsx7(
558
- UserRemoveButton,
559
- {
560
- roleId,
561
- userId: user.id,
562
- onRemove
563
- }
564
- ) })
565
- ] }, user.id)) })
566
- ] });
567
- }
568
- function RoleUsersCards({
569
- roleId,
570
- users,
571
- onRemove
572
- }) {
573
- return /* @__PURE__ */ jsx7("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3", children: users.map((user) => /* @__PURE__ */ jsx7(
574
- "div",
575
- {
576
- className: "rounded-xl border border-border/60 bg-card p-4 shadow-sm",
577
- children: /* @__PURE__ */ jsxs4("div", { className: "flex items-start justify-between gap-3", children: [
578
- /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
579
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
580
- /* @__PURE__ */ jsxs4(Avatar, { className: "h-10 w-10", children: [
581
- /* @__PURE__ */ jsx7(AvatarImage, { src: user.image ?? void 0 }),
582
- /* @__PURE__ */ jsx7(AvatarFallback, { children: initials(user) })
583
- ] }),
584
- /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7("p", { className: "font-semibold", children: user.fullName }) })
585
- ] }),
586
- /* @__PURE__ */ jsxs4("div", { className: "space-y-1 text-sm text-muted-foreground", children: [
587
- /* @__PURE__ */ jsx7("p", { children: user.email ?? user.phone ?? "No contact info" }),
588
- /* @__PURE__ */ jsxs4("p", { children: [
589
- "Last sign in",
590
- " ",
591
- user.lastSignInAt ? new Date(user.lastSignInAt).toLocaleDateString() : "never"
592
- ] })
593
- ] })
594
- ] }),
595
- /* @__PURE__ */ jsx7(
596
- UserRemoveButton,
597
- {
598
- roleId,
599
- userId: user.id,
600
- onRemove
601
- }
602
- )
603
- ] })
604
- },
605
- user.id
606
- )) });
607
- }
608
- function RoleUsersPage({ roleId }) {
609
- const qc = useQueryClient2();
610
- const { queryConfig, params, setParams } = useEntityParams({
611
- searchKey: "search",
612
- defaultSort: "fullName",
613
- defaultOrder: "asc"
614
- });
615
- const usersQuery = useMemo2(
616
- () => ({
617
- params: {
618
- path: { id: roleId },
619
- query: queryConfig.params.query
620
- }
621
- }),
622
- [queryConfig, roleId]
623
- );
624
- const { data, isPending, isFetching } = authApi$.useQuery(
625
- "get",
626
- "/roles/{id}/users",
627
- usersQuery,
628
- { enabled: !!roleId }
629
- );
630
- const assignUsers = authApi$.useMutation("post", "/roles/{id}/users", {
631
- onSuccess: (result) => {
632
- qc.invalidateQueries({ queryKey: ["get", "/roles"] });
633
- qc.invalidateQueries({ queryKey: ["get", "/roles/{id}"] });
634
- qc.invalidateQueries({ queryKey: ["get", "/roles/{id}/users"] });
635
- toast.success(
636
- result?.created ? `${result.created} user(s) added` : "No changes"
637
- );
638
- },
639
- onError: () => {
640
- toast.error("Failed to assign users");
641
- }
642
- });
643
- const revokeUser = authApi$.useMutation(
644
- "delete",
645
- "/roles/{id}/users/{userId}",
646
- {
647
- onSuccess: () => {
648
- qc.invalidateQueries({ queryKey: ["get", "/roles"] });
649
- qc.invalidateQueries({ queryKey: ["get", "/roles/{id}"] });
650
- qc.invalidateQueries({ queryKey: ["get", "/roles/{id}/users"] });
651
- toast.success("User removed");
652
- },
653
- onError: () => {
654
- toast.error("Failed to remove user");
655
- }
656
- }
657
- );
658
- const users = data?.users ?? [];
659
- const { total, pageCount } = useEntityPagination({
660
- items: users,
661
- total: data?.total,
662
- pageSize: params.pageSize
663
- });
664
- const isLoading = isPending || isFetching;
665
- const currentView = params.view || "table";
666
- const handleRemoveUser = (targetRoleId, userId) => {
667
- revokeUser.mutate({
668
- params: {
669
- path: { id: targetRoleId, userId }
670
- }
671
- });
672
- };
673
- if (!roleId) {
674
- return null;
675
- }
676
- let content;
677
- if (isLoading) {
678
- content = /* @__PURE__ */ jsx7(
679
- EntityLoadingState,
680
- {
681
- view: currentView,
682
- rowCount: params.pageSize,
683
- columnCount: TABLE_COLUMN_COUNT,
684
- cardCount: params.pageSize
685
- }
686
- );
687
- } else if (total === 0) {
688
- content = /* @__PURE__ */ jsx7(
689
- EntityEmptyState,
690
- {
691
- icon: IconUsers2,
692
- entityName: "user",
693
- title: "No users assigned",
694
- description: "Assign users from the selector to add them to this role."
695
- }
696
- );
697
- } else if (currentView === "table") {
698
- content = /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
699
- /* @__PURE__ */ jsx7(
700
- RoleUsersTable,
701
- {
702
- roleId,
703
- users,
704
- onRemove: handleRemoveUser
705
- }
706
- ),
707
- /* @__PURE__ */ jsx7(
708
- DataTablePagination,
709
- {
710
- pageIndex: params.page - 1,
711
- pageSize: params.pageSize,
712
- pageCount,
713
- totalRows: total,
714
- onPageChange: (page) => setParams({ page: page + 1 }),
715
- onPageSizeChange: (pageSize) => setParams({ pageSize, page: 1 })
716
- }
717
- )
718
- ] });
719
- } else {
720
- content = /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
721
- /* @__PURE__ */ jsx7(
722
- RoleUsersCards,
723
- {
724
- roleId,
725
- users,
726
- onRemove: handleRemoveUser
727
- }
728
- ),
729
- /* @__PURE__ */ jsx7(
730
- DataTablePagination,
731
- {
732
- pageIndex: params.page - 1,
733
- pageSize: params.pageSize,
734
- pageCount,
735
- totalRows: total,
736
- onPageChange: (page) => setParams({ page: page + 1 }),
737
- onPageSizeChange: (pageSize) => setParams({ pageSize, page: 1 })
738
- }
739
- )
740
- ] });
741
- }
742
- return /* @__PURE__ */ jsxs4(PageBody, { className: "px-0 pb-6", children: [
743
- /* @__PURE__ */ jsx7(
744
- EntityHeader,
745
- {
746
- icon: /* @__PURE__ */ jsx7(IconUser, { className: "h-5 w-5" }),
747
- title: "Role users",
748
- actions: /* @__PURE__ */ jsx7(
749
- UserSelector,
750
- {
751
- trigger: /* @__PURE__ */ jsxs4(Button2, { size: "sm", loading: assignUsers.isPending, children: [
752
- /* @__PURE__ */ jsx7(IconPlus, { className: "h-4 w-4" }),
753
- "Add users"
754
- ] }),
755
- multiple: true,
756
- excludeIds: users.map((user) => user.id),
757
- onSelect: (selectedUsers) => {
758
- if (!selectedUsers.length) {
759
- return;
760
- }
761
- assignUsers.mutate({
762
- params: { path: { id: roleId } },
763
- body: {
764
- userIds: selectedUsers.map((user) => user.id)
765
- }
766
- });
767
- }
768
- }
769
- ),
770
- search: /* @__PURE__ */ jsx7(
771
- EntitySearch,
772
- {
773
- paramKey: "search",
774
- placeholder: "Search assigned users..."
775
- }
776
- ),
777
- filter: /* @__PURE__ */ jsx7(
778
- EntityFilter,
779
- {
780
- options: [
781
- { label: "All", value: "" },
782
- { label: "Name", value: "fullName" },
783
- { label: "Email", value: "email" },
784
- { label: "Phone", value: "phone" }
785
- ],
786
- placeholder: "Search field"
787
- }
788
- ),
789
- sort: /* @__PURE__ */ jsx7(
790
- EntitySort,
791
- {
792
- defaultSort: "fullName",
793
- defaultOrder: "asc",
794
- options: [
795
- { label: "Created", value: "createdAt" },
796
- { label: "Updated", value: "updatedAt" },
797
- { label: "Name", value: "fullName" },
798
- { label: "Last Sign In", value: "lastSignInAt" }
799
- ]
800
- }
801
- ),
802
- view: /* @__PURE__ */ jsx7(EntityViewToggle, { views: ["table", "card"] })
803
- }
804
- ),
805
- content
806
- ] });
807
- }
2
+ RoleUsersPage
3
+ } from "../../chunk-PSRIZMWJ.js";
4
+ import "../../chunk-BZ42QPXE.js";
5
+ import "../../chunk-3BZC4VVD.js";
6
+ import "../../chunk-T6P7UHVP.js";
7
+ import "../../chunk-NPW7D2HZ.js";
8
+ import "../../chunk-72YRO3A7.js";
808
9
 
809
10
  // src/pages/iam/role-users.tsx
810
- import { jsx as jsx8 } from "react/jsx-runtime";
11
+ import { jsx } from "react/jsx-runtime";
811
12
  var metadata = {
812
13
  title: "Role Users",
813
14
  description: "Manage users assigned to a role."
@@ -816,7 +17,7 @@ async function RoleUsersRoutePage({
816
17
  params
817
18
  }) {
818
19
  const { id } = await params;
819
- return /* @__PURE__ */ jsx8(RoleUsersPage, { roleId: id });
20
+ return /* @__PURE__ */ jsx(RoleUsersPage, { roleId: id });
820
21
  }
821
22
  export {
822
23
  RoleUsersRoutePage as default,