@m5kdev/web-ui 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (377) hide show
  1. package/dist/src/animations/card.motion.d.ts +7 -2
  2. package/dist/src/animations/card.motion.js +25 -6
  3. package/dist/src/animations/card.motion.js.map +1 -0
  4. package/dist/src/components/AvatarUpload.d.ts +14 -5
  5. package/dist/src/components/AvatarUpload.js +105 -63
  6. package/dist/src/components/AvatarUpload.js.map +1 -0
  7. package/dist/src/components/Button.d.ts +14 -4
  8. package/dist/src/components/Button.js +13 -4
  9. package/dist/src/components/Button.js.map +1 -0
  10. package/dist/src/components/Calendar.d.ts +33 -31
  11. package/dist/src/components/Calendar.js +14 -6
  12. package/dist/src/components/Calendar.js.map +1 -0
  13. package/dist/src/components/{Calendar.css → Calendar2.css} +757 -684
  14. package/dist/src/components/CardsSelect.d.ts +25 -21
  15. package/dist/src/components/CardsSelect.js +75 -42
  16. package/dist/src/components/CardsSelect.js.map +1 -0
  17. package/dist/src/components/CollapsibleSidebarMenuItem.d.ts +22 -9
  18. package/dist/src/components/CollapsibleSidebarMenuItem.js +31 -8
  19. package/dist/src/components/CollapsibleSidebarMenuItem.js.map +1 -0
  20. package/dist/src/components/ColorPicker.d.ts +15 -4
  21. package/dist/src/components/ColorPicker.js +46 -16
  22. package/dist/src/components/ColorPicker.js.map +1 -0
  23. package/dist/src/components/CopyButton.d.ts +18 -6
  24. package/dist/src/components/CopyButton.js +28 -19
  25. package/dist/src/components/CopyButton.js.map +1 -0
  26. package/dist/src/components/CropDialog.d.ts +20 -8
  27. package/dist/src/components/CropDialog.js +108 -62
  28. package/dist/src/components/CropDialog.js.map +1 -0
  29. package/dist/src/components/DialogProvider.d.ts +22 -14
  30. package/dist/src/components/DialogProvider.js +67 -45
  31. package/dist/src/components/DialogProvider.js.map +1 -0
  32. package/dist/src/components/ErrorFallback.d.ts +13 -4
  33. package/dist/src/components/ErrorFallback.js +29 -4
  34. package/dist/src/components/ErrorFallback.js.map +1 -0
  35. package/dist/src/components/FileDropzone.d.ts +12 -4
  36. package/dist/src/components/FileDropzone.js +98 -60
  37. package/dist/src/components/FileDropzone.js.map +1 -0
  38. package/dist/src/components/MultiSelectDropdown.d.ts +25 -22
  39. package/dist/src/components/MultiSelectDropdown.js +99 -49
  40. package/dist/src/components/MultiSelectDropdown.js.map +1 -0
  41. package/dist/src/components/Orb.d.ts +17 -6
  42. package/dist/src/components/Orb.js +263 -255
  43. package/dist/src/components/Orb.js.map +1 -0
  44. package/dist/src/components/PageAlert.d.ts +20 -15
  45. package/dist/src/components/PageAlert.js +67 -39
  46. package/dist/src/components/PageAlert.js.map +1 -0
  47. package/dist/src/components/SelectChips.d.ts +21 -10
  48. package/dist/src/components/SelectChips.js +21 -9
  49. package/dist/src/components/SelectChips.js.map +1 -0
  50. package/dist/src/components/SidebarItem.d.ts +18 -7
  51. package/dist/src/components/SidebarItem.js +16 -4
  52. package/dist/src/components/SidebarItem.js.map +1 -0
  53. package/dist/src/components/Steps.d.ts +21 -16
  54. package/dist/src/components/Steps.js +193 -27
  55. package/dist/src/components/Steps.js.map +1 -0
  56. package/dist/src/components/TablerIconPicker.d.ts +13 -2
  57. package/dist/src/components/TablerIconPicker.js +4254 -4234
  58. package/dist/src/components/TablerIconPicker.js.map +1 -0
  59. package/dist/src/components/app-header.d.ts +14 -6
  60. package/dist/src/components/app-header.js +27 -6
  61. package/dist/src/components/app-header.js.map +1 -0
  62. package/dist/src/components/blur-card.d.ts +25 -11
  63. package/dist/src/components/blur-card.js +134 -31
  64. package/dist/src/components/blur-card.js.map +1 -0
  65. package/dist/src/components/features-section-demo-1.d.ts +22 -6
  66. package/dist/src/components/features-section-demo-1.js +119 -47
  67. package/dist/src/components/features-section-demo-1.js.map +1 -0
  68. package/dist/src/components/features-section-demo-2.d.ts +7 -1
  69. package/dist/src/components/features-section-demo-2.js +80 -49
  70. package/dist/src/components/features-section-demo-2.js.map +1 -0
  71. package/dist/src/components/features-section-demo-3.d.ts +16 -8
  72. package/dist/src/components/features-section-demo-3.js +239 -103
  73. package/dist/src/components/features-section-demo-3.js.map +1 -0
  74. package/dist/src/components/mode-toggle.d.ts +7 -1
  75. package/dist/src/components/mode-toggle.js +42 -7
  76. package/dist/src/components/mode-toggle.js.map +1 -0
  77. package/dist/src/components/nav-main.d.ts +20 -12
  78. package/dist/src/components/nav-main.js +31 -5
  79. package/dist/src/components/nav-main.js.map +1 -0
  80. package/dist/src/components/pricing-cards.d.ts +7 -1
  81. package/dist/src/components/pricing-cards.js +125 -24
  82. package/dist/src/components/pricing-cards.js.map +1 -0
  83. package/dist/src/components/shared/ButtonCopy.d.ts +17 -6
  84. package/dist/src/components/shared/ButtonCopy.js +31 -20
  85. package/dist/src/components/shared/ButtonCopy.js.map +1 -0
  86. package/dist/src/components/team-switcher.d.ts +16 -8
  87. package/dist/src/components/team-switcher.js +70 -8
  88. package/dist/src/components/team-switcher.js.map +1 -0
  89. package/dist/src/components/theme-provider.d.ts +18 -8
  90. package/dist/src/components/theme-provider.js +42 -38
  91. package/dist/src/components/theme-provider.js.map +1 -0
  92. package/dist/src/components/typewriter.d.ts +35 -14
  93. package/dist/src/components/typewriter.js +45 -36
  94. package/dist/src/components/typewriter.js.map +1 -0
  95. package/dist/src/components/ui/alert-dialog.d.ts +48 -13
  96. package/dist/src/components/ui/alert-dialog.js +58 -15
  97. package/dist/src/components/ui/alert-dialog.js.map +1 -0
  98. package/dist/src/components/ui/alert.d.ts +24 -8
  99. package/dist/src/components/ui/alert.js +28 -15
  100. package/dist/src/components/ui/alert.js.map +1 -0
  101. package/dist/src/components/ui/avatar.d.ts +9 -5
  102. package/dist/src/components/ui/avatar.js +23 -7
  103. package/dist/src/components/ui/avatar.js.map +1 -0
  104. package/dist/src/components/ui/badge.d.ts +17 -8
  105. package/dist/src/components/ui/badge.js +17 -14
  106. package/dist/src/components/ui/badge.js.map +1 -0
  107. package/dist/src/components/ui/bento-grid.d.ts +26 -11
  108. package/dist/src/components/ui/bento-grid.js +30 -6
  109. package/dist/src/components/ui/bento-grid.js.map +1 -0
  110. package/dist/src/components/ui/bento-grid2.d.ts +30 -14
  111. package/dist/src/components/ui/bento-grid2.js +45 -9
  112. package/dist/src/components/ui/bento-grid2.js.map +1 -0
  113. package/dist/src/components/ui/breadcrumb.d.ts +27 -15
  114. package/dist/src/components/ui/breadcrumb.js +54 -14
  115. package/dist/src/components/ui/breadcrumb.js.map +1 -0
  116. package/dist/src/components/ui/button.d.ts +14 -9
  117. package/dist/src/components/ui/button.js +37 -26
  118. package/dist/src/components/ui/button.js.map +1 -0
  119. package/dist/src/components/ui/card.d.ts +12 -8
  120. package/dist/src/components/ui/card.js +38 -10
  121. package/dist/src/components/ui/card.js.map +1 -0
  122. package/dist/src/components/ui/checkbox.d.ts +6 -2
  123. package/dist/src/components/ui/checkbox.js +17 -5
  124. package/dist/src/components/ui/checkbox.js.map +1 -0
  125. package/dist/src/components/ui/collapsible.d.ts +9 -4
  126. package/dist/src/components/ui/collapsible.js +5 -1
  127. package/dist/src/components/ui/collapsible.js.map +1 -0
  128. package/dist/src/components/ui/dialog.d.ts +44 -12
  129. package/dist/src/components/ui/dialog.js +64 -14
  130. package/dist/src/components/ui/dialog.js.map +1 -0
  131. package/dist/src/components/ui/dropdown-menu.d.ts +32 -24
  132. package/dist/src/components/ui/dropdown-menu.js +64 -14
  133. package/dist/src/components/ui/dropdown-menu.js.map +1 -0
  134. package/dist/src/components/ui/floating-navbar.d.ts +18 -9
  135. package/dist/src/components/ui/floating-navbar.js +49 -35
  136. package/dist/src/components/ui/floating-navbar.js.map +1 -0
  137. package/dist/src/components/ui/form.d.ts +30 -21
  138. package/dist/src/components/ui/form.js +76 -44
  139. package/dist/src/components/ui/form.js.map +1 -0
  140. package/dist/src/components/ui/image.d.ts +6 -2
  141. package/dist/src/components/ui/image.js +51 -11
  142. package/dist/src/components/ui/image.js.map +1 -0
  143. package/dist/src/components/ui/input.d.ts +6 -2
  144. package/dist/src/components/ui/input.js +14 -5
  145. package/dist/src/components/ui/input.js.map +1 -0
  146. package/dist/src/components/ui/label.d.ts +8 -3
  147. package/dist/src/components/ui/label.js +13 -5
  148. package/dist/src/components/ui/label.js.map +1 -0
  149. package/dist/src/components/ui/pagination.d.ts +39 -12
  150. package/dist/src/components/ui/pagination.js +64 -14
  151. package/dist/src/components/ui/pagination.js.map +1 -0
  152. package/dist/src/components/ui/progress.d.ts +6 -2
  153. package/dist/src/components/ui/progress.js +16 -4
  154. package/dist/src/components/ui/progress.js.map +1 -0
  155. package/dist/src/components/ui/resizable-navbar.d.ts +84 -43
  156. package/dist/src/components/ui/resizable-navbar.js +126 -74
  157. package/dist/src/components/ui/resizable-navbar.js.map +1 -0
  158. package/dist/src/components/ui/segment-control.d.ts +10 -7
  159. package/dist/src/components/ui/segment-control.js +83 -38
  160. package/dist/src/components/ui/segment-control.js.map +1 -0
  161. package/dist/src/components/ui/select.d.ts +16 -12
  162. package/dist/src/components/ui/select.js +63 -14
  163. package/dist/src/components/ui/select.js.map +1 -0
  164. package/dist/src/components/ui/separator.d.ts +6 -2
  165. package/dist/src/components/ui/separator.js +14 -4
  166. package/dist/src/components/ui/separator.js.map +1 -0
  167. package/dist/src/components/ui/sheet.d.ts +30 -19
  168. package/dist/src/components/ui/sheet.js +52 -23
  169. package/dist/src/components/ui/sheet.js.map +1 -0
  170. package/dist/src/components/ui/sidebar.d.ts +69 -62
  171. package/dist/src/components/ui/sidebar.js +326 -171
  172. package/dist/src/components/ui/sidebar.js.map +1 -0
  173. package/dist/src/components/ui/skeleton.d.ts +9 -1
  174. package/dist/src/components/ui/skeleton.js +10 -3
  175. package/dist/src/components/ui/skeleton.js.map +1 -0
  176. package/dist/src/components/ui/slider.d.ts +6 -2
  177. package/dist/src/components/ui/slider.js +16 -4
  178. package/dist/src/components/ui/slider.js.map +1 -0
  179. package/dist/src/components/ui/sonner.d.ts +10 -3
  180. package/dist/src/components/ui/sonner.js +18 -11
  181. package/dist/src/components/ui/sonner.js.map +1 -0
  182. package/dist/src/components/ui/spinner.d.ts +21 -10
  183. package/dist/src/components/ui/spinner.js +24 -24
  184. package/dist/src/components/ui/spinner.js.map +1 -0
  185. package/dist/src/components/ui/switch.d.ts +6 -2
  186. package/dist/src/components/ui/switch.js +13 -4
  187. package/dist/src/components/ui/switch.js.map +1 -0
  188. package/dist/src/components/ui/table.d.ts +39 -10
  189. package/dist/src/components/ui/table.js +51 -11
  190. package/dist/src/components/ui/table.js.map +1 -0
  191. package/dist/src/components/ui/tabs.d.ts +23 -6
  192. package/dist/src/components/ui/tabs.js +27 -7
  193. package/dist/src/components/ui/tabs.js.map +1 -0
  194. package/dist/src/components/ui/textarea.d.ts +10 -2
  195. package/dist/src/components/ui/textarea.js +11 -3
  196. package/dist/src/components/ui/textarea.js.map +1 -0
  197. package/dist/src/components/ui/timeline.d.ts +16 -9
  198. package/dist/src/components/ui/timeline.js +87 -24
  199. package/dist/src/components/ui/timeline.js.map +1 -0
  200. package/dist/src/components/ui/toast.d.ts +19 -14
  201. package/dist/src/components/ui/toast.js +48 -22
  202. package/dist/src/components/ui/toast.js.map +1 -0
  203. package/dist/src/components/ui/tooltip.d.ts +23 -6
  204. package/dist/src/components/ui/tooltip.js +27 -7
  205. package/dist/src/components/ui/tooltip.js.map +1 -0
  206. package/dist/src/components/ui/typewriter-effect.d.ts +28 -14
  207. package/dist/src/components/ui/typewriter-effect.js +102 -72
  208. package/dist/src/components/ui/typewriter-effect.js.map +1 -0
  209. package/dist/src/hooks/use-mobile.d.ts +5 -1
  210. package/dist/src/hooks/use-mobile.js +18 -13
  211. package/dist/src/hooks/use-mobile.js.map +1 -0
  212. package/dist/src/hooks/useDialog.d.ts +8 -4
  213. package/dist/src/hooks/useDialog.js +24 -20
  214. package/dist/src/hooks/useDialog.js.map +1 -0
  215. package/dist/src/icons/GoogleIcon.d.ts +9 -5
  216. package/dist/src/icons/GoogleIcon.js +32 -3
  217. package/dist/src/icons/GoogleIcon.js.map +1 -0
  218. package/dist/src/icons/LinkedInIcon.d.ts +9 -5
  219. package/dist/src/icons/LinkedInIcon.js +27 -3
  220. package/dist/src/icons/LinkedInIcon.js.map +1 -0
  221. package/dist/src/icons/MicrosoftIcon.d.ts +9 -5
  222. package/dist/src/icons/MicrosoftIcon.js +31 -3
  223. package/dist/src/icons/MicrosoftIcon.js.map +1 -0
  224. package/dist/src/lib/chatwoot.d.ts +19 -10
  225. package/dist/src/lib/chatwoot.js +25 -27
  226. package/dist/src/lib/chatwoot.js.map +1 -0
  227. package/dist/src/lib/utils.d.ts +7 -2
  228. package/dist/src/lib/utils.js +7 -2
  229. package/dist/src/lib/utils.js.map +1 -0
  230. package/dist/src/modules/app/components/AppLoader.d.ts +8 -2
  231. package/dist/src/modules/app/components/AppLoader.js +14 -3
  232. package/dist/src/modules/app/components/AppLoader.js.map +1 -0
  233. package/dist/src/modules/app/components/AppShell.d.ts +15 -6
  234. package/dist/src/modules/app/components/AppShell.js +14 -5
  235. package/dist/src/modules/app/components/AppShell.js.map +1 -0
  236. package/dist/src/modules/app/components/AppSidebar.d.ts +16 -6
  237. package/dist/src/modules/app/components/AppSidebar.js +17 -4
  238. package/dist/src/modules/app/components/AppSidebar.js.map +1 -0
  239. package/dist/src/modules/app/components/AppSidebarContent.d.ts +22 -13
  240. package/dist/src/modules/app/components/AppSidebarContent.js +34 -5
  241. package/dist/src/modules/app/components/AppSidebarContent.js.map +1 -0
  242. package/dist/src/modules/app/components/AppSidebarHeader.d.ts +18 -8
  243. package/dist/src/modules/app/components/AppSidebarHeader.js +37 -6
  244. package/dist/src/modules/app/components/AppSidebarHeader.js.map +1 -0
  245. package/dist/src/modules/app/components/AppSidebarInvites.d.ts +11 -3
  246. package/dist/src/modules/app/components/AppSidebarInvites.js +39 -8
  247. package/dist/src/modules/app/components/AppSidebarInvites.js.map +1 -0
  248. package/dist/src/modules/app/components/AppSidebarUser.d.ts +20 -10
  249. package/dist/src/modules/app/components/AppSidebarUser.js +121 -12
  250. package/dist/src/modules/app/components/AppSidebarUser.js.map +1 -0
  251. package/dist/src/modules/auth/components/AdminUserManagement.d.ts +11 -4
  252. package/dist/src/modules/auth/components/AdminUserManagement.js +970 -418
  253. package/dist/src/modules/auth/components/AdminUserManagement.js.map +1 -0
  254. package/dist/src/modules/auth/components/AdminWaitlist.d.ts +11 -4
  255. package/dist/src/modules/auth/components/AdminWaitlist.js +284 -115
  256. package/dist/src/modules/auth/components/AdminWaitlist.js.map +1 -0
  257. package/dist/src/modules/auth/components/AuthLayout.d.ts +12 -4
  258. package/dist/src/modules/auth/components/AuthLayout.js +17 -3
  259. package/dist/src/modules/auth/components/AuthLayout.js.map +1 -0
  260. package/dist/src/modules/auth/components/AuthProviders.d.ts +17 -6
  261. package/dist/src/modules/auth/components/AuthProviders.js +80 -41
  262. package/dist/src/modules/auth/components/AuthProviders.js.map +1 -0
  263. package/dist/src/modules/auth/components/AuthRouter.d.ts +16 -7
  264. package/dist/src/modules/auth/components/AuthRouter.js +46 -10
  265. package/dist/src/modules/auth/components/AuthRouter.js.map +1 -0
  266. package/dist/src/modules/auth/components/ClaimAccountRoute.d.ts +12 -4
  267. package/dist/src/modules/auth/components/ClaimAccountRoute.js +202 -139
  268. package/dist/src/modules/auth/components/ClaimAccountRoute.js.map +1 -0
  269. package/dist/src/modules/auth/components/ErrorAuthRoute.d.ts +7 -1
  270. package/dist/src/modules/auth/components/ErrorAuthRoute.js +125 -89
  271. package/dist/src/modules/auth/components/ErrorAuthRoute.js.map +1 -0
  272. package/dist/src/modules/auth/components/ForgotPasswordForm.d.ts +7 -1
  273. package/dist/src/modules/auth/components/ForgotPasswordForm.js +49 -23
  274. package/dist/src/modules/auth/components/ForgotPasswordForm.js.map +1 -0
  275. package/dist/src/modules/auth/components/ForgotPasswordRoute.d.ts +7 -1
  276. package/dist/src/modules/auth/components/ForgotPasswordRoute.js +34 -6
  277. package/dist/src/modules/auth/components/ForgotPasswordRoute.js.map +1 -0
  278. package/dist/src/modules/auth/components/InviteFriends.d.ts +12 -4
  279. package/dist/src/modules/auth/components/InviteFriends.js +275 -69
  280. package/dist/src/modules/auth/components/InviteFriends.js.map +1 -0
  281. package/dist/src/modules/auth/components/LastUsedBadge.d.ts +17 -5
  282. package/dist/src/modules/auth/components/LastUsedBadge.js +16 -6
  283. package/dist/src/modules/auth/components/LastUsedBadge.js.map +1 -0
  284. package/dist/src/modules/auth/components/LoginForm.d.ts +11 -3
  285. package/dist/src/modules/auth/components/LoginForm.js +107 -40
  286. package/dist/src/modules/auth/components/LoginForm.js.map +1 -0
  287. package/dist/src/modules/auth/components/LoginRoute.d.ts +11 -3
  288. package/dist/src/modules/auth/components/LoginRoute.js +41 -8
  289. package/dist/src/modules/auth/components/LoginRoute.js.map +1 -0
  290. package/dist/src/modules/auth/components/LogoutRoute.d.ts +7 -1
  291. package/dist/src/modules/auth/components/LogoutRoute.js +18 -12
  292. package/dist/src/modules/auth/components/LogoutRoute.js.map +1 -0
  293. package/dist/src/modules/auth/components/OrganizationAcceptInvitationRoute.d.ts +21 -8
  294. package/dist/src/modules/auth/components/OrganizationAcceptInvitationRoute.js +107 -97
  295. package/dist/src/modules/auth/components/OrganizationAcceptInvitationRoute.js.map +1 -0
  296. package/dist/src/modules/auth/components/OrganizationMembersRoute.d.ts +58 -48
  297. package/dist/src/modules/auth/components/OrganizationMembersRoute.js +448 -349
  298. package/dist/src/modules/auth/components/OrganizationMembersRoute.js.map +1 -0
  299. package/dist/src/modules/auth/components/OrganizationPreferences.d.ts +27 -16
  300. package/dist/src/modules/auth/components/OrganizationPreferences.js +129 -124
  301. package/dist/src/modules/auth/components/OrganizationPreferences.js.map +1 -0
  302. package/dist/src/modules/auth/components/OrganizationSettingsRoute.d.ts +27 -18
  303. package/dist/src/modules/auth/components/OrganizationSettingsRoute.js +184 -144
  304. package/dist/src/modules/auth/components/OrganizationSettingsRoute.js.map +1 -0
  305. package/dist/src/modules/auth/components/OrganizationSwitcher.d.ts +17 -6
  306. package/dist/src/modules/auth/components/OrganizationSwitcher.js +91 -69
  307. package/dist/src/modules/auth/components/OrganizationSwitcher.js.map +1 -0
  308. package/dist/src/modules/auth/components/PreferencesEditor.d.ts +44 -33
  309. package/dist/src/modules/auth/components/PreferencesEditor.js +82 -58
  310. package/dist/src/modules/auth/components/PreferencesEditor.js.map +1 -0
  311. package/dist/src/modules/auth/components/ProfileRoute.d.ts +7 -1
  312. package/dist/src/modules/auth/components/ProfileRoute.js +79 -36
  313. package/dist/src/modules/auth/components/ProfileRoute.js.map +1 -0
  314. package/dist/src/modules/auth/components/RangeNuqsDatePicker.d.ts +44 -30
  315. package/dist/src/modules/auth/components/RangeNuqsDatePicker.js +234 -242
  316. package/dist/src/modules/auth/components/RangeNuqsDatePicker.js.map +1 -0
  317. package/dist/src/modules/auth/components/ResetPasswordForm.d.ts +7 -1
  318. package/dist/src/modules/auth/components/ResetPasswordForm.js +97 -35
  319. package/dist/src/modules/auth/components/ResetPasswordForm.js.map +1 -0
  320. package/dist/src/modules/auth/components/ResetPasswordRoute.d.ts +7 -1
  321. package/dist/src/modules/auth/components/ResetPasswordRoute.js +34 -6
  322. package/dist/src/modules/auth/components/ResetPasswordRoute.js.map +1 -0
  323. package/dist/src/modules/auth/components/SignupFormRoute.d.ts +15 -5
  324. package/dist/src/modules/auth/components/SignupFormRoute.js +142 -99
  325. package/dist/src/modules/auth/components/SignupFormRoute.js.map +1 -0
  326. package/dist/src/modules/auth/components/SignupRoute.d.ts +13 -5
  327. package/dist/src/modules/auth/components/SignupRoute.js +59 -13
  328. package/dist/src/modules/auth/components/SignupRoute.js.map +1 -0
  329. package/dist/src/modules/auth/components/UserPreferences.d.ts +22 -11
  330. package/dist/src/modules/auth/components/UserPreferences.js +24 -12
  331. package/dist/src/modules/auth/components/UserPreferences.js.map +1 -0
  332. package/dist/src/modules/auth/components/WaitlistCard.d.ts +11 -4
  333. package/dist/src/modules/auth/components/WaitlistCard.js +63 -28
  334. package/dist/src/modules/auth/components/WaitlistCard.js.map +1 -0
  335. package/dist/src/modules/auth/components/WaitlistCodeValidation.d.ts +13 -5
  336. package/dist/src/modules/auth/components/WaitlistCodeValidation.js +42 -40
  337. package/dist/src/modules/auth/components/WaitlistCodeValidation.js.map +1 -0
  338. package/dist/src/modules/billing/components/BillingBetaPage.d.ts +15 -6
  339. package/dist/src/modules/billing/components/BillingBetaPage.js +155 -8
  340. package/dist/src/modules/billing/components/BillingBetaPage.js.map +1 -0
  341. package/dist/src/modules/billing/components/BillingInvoicePage.d.ts +13 -5
  342. package/dist/src/modules/billing/components/BillingInvoicePage.js +160 -30
  343. package/dist/src/modules/billing/components/BillingInvoicePage.js.map +1 -0
  344. package/dist/src/modules/billing/components/BillingPlanSelect.d.ts +11 -4
  345. package/dist/src/modules/billing/components/BillingPlanSelect.js +10 -7
  346. package/dist/src/modules/billing/components/BillingPlanSelect.js.map +1 -0
  347. package/dist/src/modules/billing/components/BillingRouter.d.ts +15 -7
  348. package/dist/src/modules/billing/components/BillingRouter.js +19 -6
  349. package/dist/src/modules/billing/components/BillingRouter.js.map +1 -0
  350. package/dist/src/modules/billing/components/BillingSinglePlanSelect.d.ts +17 -7
  351. package/dist/src/modules/billing/components/BillingSinglePlanSelect.js +163 -42
  352. package/dist/src/modules/billing/components/BillingSinglePlanSelect.js.map +1 -0
  353. package/dist/src/modules/table/components/ColumnOrderAndVisibility.d.ts +18 -8
  354. package/dist/src/modules/table/components/ColumnOrderAndVisibility.js +81 -38
  355. package/dist/src/modules/table/components/ColumnOrderAndVisibility.js.map +1 -0
  356. package/dist/src/modules/table/components/NuqsTable.d.ts +33 -21
  357. package/dist/src/modules/table/components/NuqsTable.js +295 -221
  358. package/dist/src/modules/table/components/NuqsTable.js.map +1 -0
  359. package/dist/src/modules/table/components/TableFiltering.d.ts +33 -21
  360. package/dist/src/modules/table/components/TableFiltering.js +408 -226
  361. package/dist/src/modules/table/components/TableFiltering.js.map +1 -0
  362. package/dist/src/modules/table/components/TableGroupBy.d.ts +18 -8
  363. package/dist/src/modules/table/components/TableGroupBy.js +56 -16
  364. package/dist/src/modules/table/components/TableGroupBy.js.map +1 -0
  365. package/dist/src/modules/table/components/TablePagination.d.ts +17 -7
  366. package/dist/src/modules/table/components/TablePagination.js +64 -32
  367. package/dist/src/modules/table/components/TablePagination.js.map +1 -0
  368. package/dist/src/modules/table/components/table.types.d.ts +15 -10
  369. package/dist/src/modules/table/components/table.types.js +0 -1
  370. package/dist/src/modules/table/filterTransformers.d.ts +35 -30
  371. package/dist/src/modules/table/filterTransformers.js +198 -261
  372. package/dist/src/modules/table/filterTransformers.js.map +1 -0
  373. package/dist/src/types.d.ts +8 -3
  374. package/dist/src/types.js +0 -1
  375. package/package.json +8 -6
  376. package/dist/translations/en/web-ui.json +0 -209
  377. package/dist/tsconfig.lib.tsbuildinfo +0 -1
@@ -1,359 +1,458 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, Card, CardBody, CardHeader, Chip, Input, Select, SelectItem, Spinner, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow, } from "@heroui/react";
3
- import { authClient } from "@m5kdev/frontend/modules/auth/auth.lib";
4
- import { useSession } from "@m5kdev/frontend/modules/auth/hooks/useSession";
5
- import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
6
- import { Copy, Trash2, UserPlus, Users } from "lucide-react";
7
1
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ import { Button, Card, CardBody, CardHeader, Chip, Input, Select, SelectItem, Spinner, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow } from "@heroui/react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Copy, Trash2, UserPlus, Users } from "lucide-react";
8
5
  import { useTranslation } from "react-i18next";
9
6
  import { toast } from "sonner";
10
- const ORGANIZATION_ROLES = ["member", "admin", "owner"];
7
+ import { authClient } from "@m5kdev/frontend/modules/auth/auth.lib";
8
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
9
+ import { useSession } from "@m5kdev/frontend/modules/auth/hooks/useSession";
10
+ //#region src/modules/auth/components/OrganizationMembersRoute.tsx
11
+ const ORGANIZATION_ROLES = [
12
+ "member",
13
+ "admin",
14
+ "owner"
15
+ ];
11
16
  function isOrganizationRole(role) {
12
- return ORGANIZATION_ROLES.includes(role);
17
+ return ORGANIZATION_ROLES.includes(role);
13
18
  }
14
19
  function OrganizationStateCard({ title, message }) {
15
- return (_jsx("div", { className: "p-6", children: _jsxs(Card, { children: [_jsx(CardHeader, { className: "text-lg font-semibold", children: title }), _jsx(CardBody, { children: message })] }) }));
20
+ return /* @__PURE__ */ jsx("div", {
21
+ className: "p-6",
22
+ children: /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, {
23
+ className: "text-lg font-semibold",
24
+ children: title
25
+ }), /* @__PURE__ */ jsx(CardBody, { children: message })] })
26
+ });
16
27
  }
17
- function useOrganizationAccess({ managerRoles, onInvalidateScopedQueries, }) {
18
- const { data: session, registerSession } = useSession();
19
- const queryClient = useQueryClient();
20
- const activeOrganizationId = session?.session.activeOrganizationId ?? "";
21
- const activeOrganizationRole = session?.session?.activeOrganizationRole ??
22
- "";
23
- const managerRoleSet = useMemo(() => new Set(managerRoles ?? ["admin", "owner"]), [managerRoles]);
24
- const canManageOrganization = managerRoleSet.has(activeOrganizationRole);
25
- const refreshOrganizationQueries = useCallback(async () => {
26
- await Promise.allSettled([
27
- queryClient.invalidateQueries({ queryKey: ["auth-organization-list"] }),
28
- queryClient.invalidateQueries({
29
- queryKey: ["auth-organization-details", activeOrganizationId],
30
- }),
31
- queryClient.invalidateQueries({
32
- queryKey: ["auth-organization-members", activeOrganizationId],
33
- }),
34
- queryClient.invalidateQueries({
35
- queryKey: ["auth-organization-invitations", activeOrganizationId],
36
- }),
37
- ]);
38
- registerSession(() => {
39
- void onInvalidateScopedQueries?.();
40
- });
41
- }, [activeOrganizationId, onInvalidateScopedQueries, queryClient, registerSession]);
42
- return {
43
- activeOrganizationId,
44
- activeOrganizationRole,
45
- canManageOrganization,
46
- refreshOrganizationQueries,
47
- };
28
+ function useOrganizationAccess({ managerRoles, onInvalidateScopedQueries }) {
29
+ const { data: session, registerSession } = useSession();
30
+ const queryClient = useQueryClient();
31
+ const activeOrganizationId = session?.session.activeOrganizationId ?? "";
32
+ const activeOrganizationRole = (session?.session)?.activeOrganizationRole ?? "";
33
+ return {
34
+ activeOrganizationId,
35
+ activeOrganizationRole,
36
+ canManageOrganization: useMemo(() => new Set(managerRoles ?? ["admin", "owner"]), [managerRoles]).has(activeOrganizationRole),
37
+ refreshOrganizationQueries: useCallback(async () => {
38
+ await Promise.allSettled([
39
+ queryClient.invalidateQueries({ queryKey: ["auth-organization-list"] }),
40
+ queryClient.invalidateQueries({ queryKey: ["auth-organization-details", activeOrganizationId] }),
41
+ queryClient.invalidateQueries({ queryKey: ["auth-organization-members", activeOrganizationId] }),
42
+ queryClient.invalidateQueries({ queryKey: ["auth-organization-invitations", activeOrganizationId] })
43
+ ]);
44
+ registerSession(() => {
45
+ onInvalidateScopedQueries?.();
46
+ });
47
+ }, [
48
+ activeOrganizationId,
49
+ onInvalidateScopedQueries,
50
+ queryClient,
51
+ registerSession
52
+ ])
53
+ };
48
54
  }
49
- function useOrganizationConfig({ assignableRoles, }) {
50
- const { t } = useTranslation();
51
- const translatedLabels = useMemo(() => ({
52
- loadError: t("web-ui:organization.members.loadError"),
53
- membersTitle: t("web-ui:organization.members.title"),
54
- membersNoActive: t("web-ui:organization.members.noActive"),
55
- membersManageOnly: t("web-ui:organization.members.manageOnly"),
56
- membersDescription: (organizationName) => t("web-ui:organization.members.description", { name: organizationName }),
57
- defaultOrganizationName: t("web-ui:organization.members.defaultName"),
58
- loadMembersError: t("web-ui:organization.members.loadMembersError"),
59
- loadInvitationsError: t("web-ui:organization.members.loadInvitationsError"),
60
- roleUpdateSuccess: t("web-ui:organization.members.roleUpdateSuccess"),
61
- roleUpdateError: t("web-ui:organization.members.roleUpdateError"),
62
- removeMemberSuccess: t("web-ui:organization.members.removeMemberSuccess"),
63
- removeMemberError: t("web-ui:organization.members.removeMemberError"),
64
- emailRequired: t("web-ui:organization.members.emailRequired"),
65
- inviteSuccess: t("web-ui:organization.members.inviteSuccess"),
66
- inviteError: t("web-ui:organization.members.inviteError"),
67
- cancelInvitationSuccess: t("web-ui:organization.members.cancelInvitationSuccess"),
68
- cancelInvitationError: t("web-ui:organization.members.cancelInvitationError"),
69
- inviteLinkCopied: t("web-ui:organization.members.inviteLinkCopied"),
70
- copyInviteLinkError: t("web-ui:organization.members.copyInviteLinkError"),
71
- unknownName: t("web-ui:organization.members.unknownName"),
72
- invitedUser: t("web-ui:organization.members.invitedUser"),
73
- emailLabel: t("web-ui:organization.members.emailLabel"),
74
- emailPlaceholder: t("web-ui:organization.members.emailPlaceholder"),
75
- roleLabel: t("web-ui:organization.members.roleLabel"),
76
- inviteButton: t("web-ui:organization.members.inviteButton"),
77
- tableTitle: t("web-ui:organization.members.tableTitle"),
78
- columnName: t("web-ui:organization.members.columnName"),
79
- columnEmail: t("web-ui:organization.members.columnEmail"),
80
- columnRole: t("web-ui:organization.members.columnRole"),
81
- columnStatus: t("web-ui:organization.members.columnStatus"),
82
- columnActions: t("web-ui:organization.members.columnActions"),
83
- tableEmpty: t("web-ui:organization.members.tableEmpty"),
84
- roleFor: (name) => t("web-ui:organization.members.roleFor", { name }),
85
- statusActive: t("web-ui:organization.members.statusActive"),
86
- statusInvited: t("web-ui:organization.members.statusInvited"),
87
- removeMember: t("web-ui:organization.members.removeMember"),
88
- copyInviteLink: t("web-ui:organization.members.copyInviteLink"),
89
- cancelInvitation: t("web-ui:organization.members.cancelInvitation"),
90
- roleUnknown: t("web-ui:organization.members.roleUnknown"),
91
- }), [t]);
92
- const translatedRoleLabels = useMemo(() => ({
93
- member: t("web-ui:organization.roles.member"),
94
- admin: t("web-ui:organization.roles.admin"),
95
- owner: t("web-ui:organization.roles.owner"),
96
- }), [t]);
97
- const resolvedAssignableRoles = useMemo(() => assignableRoles && assignableRoles.length > 0 ? assignableRoles : [...ORGANIZATION_ROLES], [assignableRoles]);
98
- return {
99
- resolvedLabels: translatedLabels,
100
- resolvedRoleLabels: translatedRoleLabels,
101
- resolvedAssignableRoles,
102
- };
55
+ function useOrganizationConfig({ assignableRoles }) {
56
+ const { t } = useTranslation();
57
+ return {
58
+ resolvedLabels: useMemo(() => ({
59
+ loadError: t("web-ui:organization.members.loadError"),
60
+ membersTitle: t("web-ui:organization.members.title"),
61
+ membersNoActive: t("web-ui:organization.members.noActive"),
62
+ membersManageOnly: t("web-ui:organization.members.manageOnly"),
63
+ membersDescription: (organizationName) => t("web-ui:organization.members.description", { name: organizationName }),
64
+ defaultOrganizationName: t("web-ui:organization.members.defaultName"),
65
+ loadMembersError: t("web-ui:organization.members.loadMembersError"),
66
+ loadInvitationsError: t("web-ui:organization.members.loadInvitationsError"),
67
+ roleUpdateSuccess: t("web-ui:organization.members.roleUpdateSuccess"),
68
+ roleUpdateError: t("web-ui:organization.members.roleUpdateError"),
69
+ removeMemberSuccess: t("web-ui:organization.members.removeMemberSuccess"),
70
+ removeMemberError: t("web-ui:organization.members.removeMemberError"),
71
+ emailRequired: t("web-ui:organization.members.emailRequired"),
72
+ inviteSuccess: t("web-ui:organization.members.inviteSuccess"),
73
+ inviteError: t("web-ui:organization.members.inviteError"),
74
+ cancelInvitationSuccess: t("web-ui:organization.members.cancelInvitationSuccess"),
75
+ cancelInvitationError: t("web-ui:organization.members.cancelInvitationError"),
76
+ inviteLinkCopied: t("web-ui:organization.members.inviteLinkCopied"),
77
+ copyInviteLinkError: t("web-ui:organization.members.copyInviteLinkError"),
78
+ unknownName: t("web-ui:organization.members.unknownName"),
79
+ invitedUser: t("web-ui:organization.members.invitedUser"),
80
+ emailLabel: t("web-ui:organization.members.emailLabel"),
81
+ emailPlaceholder: t("web-ui:organization.members.emailPlaceholder"),
82
+ roleLabel: t("web-ui:organization.members.roleLabel"),
83
+ inviteButton: t("web-ui:organization.members.inviteButton"),
84
+ tableTitle: t("web-ui:organization.members.tableTitle"),
85
+ columnName: t("web-ui:organization.members.columnName"),
86
+ columnEmail: t("web-ui:organization.members.columnEmail"),
87
+ columnRole: t("web-ui:organization.members.columnRole"),
88
+ columnStatus: t("web-ui:organization.members.columnStatus"),
89
+ columnActions: t("web-ui:organization.members.columnActions"),
90
+ tableEmpty: t("web-ui:organization.members.tableEmpty"),
91
+ roleFor: (name) => t("web-ui:organization.members.roleFor", { name }),
92
+ statusActive: t("web-ui:organization.members.statusActive"),
93
+ statusInvited: t("web-ui:organization.members.statusInvited"),
94
+ removeMember: t("web-ui:organization.members.removeMember"),
95
+ copyInviteLink: t("web-ui:organization.members.copyInviteLink"),
96
+ cancelInvitation: t("web-ui:organization.members.cancelInvitation"),
97
+ roleUnknown: t("web-ui:organization.members.roleUnknown")
98
+ }), [t]),
99
+ resolvedRoleLabels: useMemo(() => ({
100
+ member: t("web-ui:organization.roles.member"),
101
+ admin: t("web-ui:organization.roles.admin"),
102
+ owner: t("web-ui:organization.roles.owner")
103
+ }), [t]),
104
+ resolvedAssignableRoles: useMemo(() => assignableRoles && assignableRoles.length > 0 ? assignableRoles : [...ORGANIZATION_ROLES], [assignableRoles])
105
+ };
103
106
  }
104
- export function OrganizationMembersRoute({ managerRoles, assignableRoles, invitationAcceptPath, onInvalidateScopedQueries, }) {
105
- const { resolvedLabels, resolvedRoleLabels, resolvedAssignableRoles } = useOrganizationConfig({
106
- assignableRoles,
107
- });
108
- const { activeOrganizationId, activeOrganizationRole, canManageOrganization, refreshOrganizationQueries, } = useOrganizationAccess({ managerRoles, onInvalidateScopedQueries });
109
- const [inviteEmail, setInviteEmail] = useState("");
110
- const [inviteRole, setInviteRole] = useState(resolvedAssignableRoles[0] ?? "member");
111
- const isMountedRef = useRef(true);
112
- useEffect(() => {
113
- return () => {
114
- isMountedRef.current = false;
115
- };
116
- }, []);
117
- const refreshOrganizationQueriesStable = useCallback(() => refreshOrganizationQueries(), [refreshOrganizationQueries]);
118
- const updateRoleMutation = useMutation({
119
- mutationFn: async ({ memberId, role, organizationId, }) => {
120
- const { error } = await authClient.organization.updateMemberRole({
121
- memberId,
122
- role,
123
- organizationId,
124
- });
125
- if (error)
126
- throw new Error(error.message ?? resolvedLabels.roleUpdateError);
127
- },
128
- onSuccess: async () => {
129
- await refreshOrganizationQueriesStable();
130
- toast.success(resolvedLabels.roleUpdateSuccess);
131
- },
132
- onError: (error) => {
133
- toast.error(error instanceof Error ? error.message : resolvedLabels.roleUpdateError);
134
- },
135
- });
136
- const removeMemberMutation = useMutation({
137
- mutationFn: async ({ memberId, organizationId, }) => {
138
- const { error } = await authClient.organization.removeMember({
139
- memberIdOrEmail: memberId,
140
- organizationId,
141
- });
142
- if (error)
143
- throw new Error(error.message ?? resolvedLabels.removeMemberError);
144
- },
145
- onSuccess: async () => {
146
- await refreshOrganizationQueriesStable();
147
- toast.success(resolvedLabels.removeMemberSuccess);
148
- },
149
- onError: (error) => {
150
- toast.error(error instanceof Error ? error.message : resolvedLabels.removeMemberError);
151
- },
152
- });
153
- const createInvitationMutation = useMutation({
154
- mutationFn: async ({ email, role, organizationId, }) => {
155
- const { error } = await authClient.organization.inviteMember({
156
- organizationId,
157
- email: email.trim(),
158
- role,
159
- });
160
- if (error)
161
- throw new Error(error.message ?? resolvedLabels.inviteError);
162
- },
163
- onSuccess: async () => {
164
- await refreshOrganizationQueriesStable();
165
- toast.success(resolvedLabels.inviteSuccess);
166
- if (isMountedRef.current) {
167
- setInviteEmail("");
168
- setInviteRole(resolvedAssignableRoles[0] ?? "member");
169
- }
170
- },
171
- onError: (error) => {
172
- toast.error(error instanceof Error ? error.message : resolvedLabels.inviteError);
173
- },
174
- });
175
- const cancelInvitationMutation = useMutation({
176
- mutationFn: async ({ invitationId }) => {
177
- const { error } = await authClient.organization.cancelInvitation({ invitationId });
178
- if (error)
179
- throw new Error(error.message ?? resolvedLabels.cancelInvitationError);
180
- },
181
- onSuccess: async () => {
182
- await refreshOrganizationQueriesStable();
183
- toast.success(resolvedLabels.cancelInvitationSuccess);
184
- },
185
- onError: (error) => {
186
- toast.error(error instanceof Error ? error.message : resolvedLabels.cancelInvitationError);
187
- },
188
- });
189
- const updatingMemberId = updateRoleMutation.isPending && updateRoleMutation.variables
190
- ? updateRoleMutation.variables.memberId
191
- : null;
192
- const removingMemberId = removeMemberMutation.isPending && removeMemberMutation.variables
193
- ? removeMemberMutation.variables.memberId
194
- : null;
195
- const cancelingInvitationId = cancelInvitationMutation.isPending && cancelInvitationMutation.variables
196
- ? cancelInvitationMutation.variables.invitationId
197
- : null;
198
- useEffect(() => {
199
- if (!resolvedAssignableRoles.includes(inviteRole)) {
200
- setInviteRole(resolvedAssignableRoles[0] ?? "member");
201
- }
202
- }, [inviteRole, resolvedAssignableRoles]);
203
- const organizationQuery = useQuery({
204
- queryKey: ["auth-organization-details", activeOrganizationId],
205
- enabled: Boolean(activeOrganizationId && canManageOrganization),
206
- queryFn: async () => {
207
- const { data, error } = await authClient.organization.getFullOrganization({
208
- query: {
209
- organizationId: activeOrganizationId,
210
- membersLimit: 200,
211
- },
212
- });
213
- if (error) {
214
- throw new Error(error.message ?? resolvedLabels.loadError);
215
- }
216
- return data;
217
- },
218
- });
219
- const membersQuery = useQuery({
220
- queryKey: ["auth-organization-members", activeOrganizationId],
221
- enabled: Boolean(activeOrganizationId && canManageOrganization),
222
- queryFn: async () => {
223
- const { data, error } = await authClient.organization.listMembers({
224
- query: {
225
- organizationId: activeOrganizationId,
226
- limit: 200,
227
- offset: 0,
228
- },
229
- });
230
- if (error) {
231
- throw new Error(error.message ?? resolvedLabels.loadMembersError);
232
- }
233
- return (data?.members ??
234
- []);
235
- },
236
- });
237
- const invitationsQuery = useQuery({
238
- queryKey: ["auth-organization-invitations", activeOrganizationId],
239
- enabled: Boolean(activeOrganizationId && canManageOrganization),
240
- queryFn: async () => {
241
- const { data, error } = await authClient.organization.listInvitations({
242
- query: {
243
- organizationId: activeOrganizationId,
244
- },
245
- });
246
- if (error) {
247
- throw new Error(error.message ?? resolvedLabels.loadInvitationsError);
248
- }
249
- return (data ?? []);
250
- },
251
- });
252
- const members = membersQuery.data ?? [];
253
- const invitations = invitationsQuery.data ?? [];
254
- const rows = useMemo(() => {
255
- const memberRows = members.map((member) => ({
256
- kind: "member",
257
- id: `member-${member.id}`,
258
- displayName: member.user?.name || resolvedLabels.unknownName,
259
- email: member.user?.email || "-",
260
- role: member.role,
261
- status: "active",
262
- memberId: member.id,
263
- }));
264
- const invitationRows = invitations.map((invitation) => ({
265
- kind: "invitation",
266
- id: `invitation-${invitation.id}`,
267
- displayName: resolvedLabels.invitedUser,
268
- email: invitation.email,
269
- role: invitation.role,
270
- status: "invited",
271
- invitationId: invitation.id,
272
- }));
273
- return [...memberRows, ...invitationRows].sort((left, right) => {
274
- if (left.status === right.status) {
275
- return left.email.localeCompare(right.email);
276
- }
277
- return left.status === "active" ? -1 : 1;
278
- });
279
- }, [invitations, members, resolvedLabels.invitedUser, resolvedLabels.unknownName]);
280
- const onUpdateMemberRole = useCallback((memberId, role) => {
281
- if (!canManageOrganization || !activeOrganizationId)
282
- return;
283
- updateRoleMutation.mutate({ memberId, role, organizationId: activeOrganizationId });
284
- }, [canManageOrganization, activeOrganizationId, updateRoleMutation]);
285
- const onRemoveMember = useCallback((memberId) => {
286
- if (!canManageOrganization || !activeOrganizationId)
287
- return;
288
- removeMemberMutation.mutate({ memberId, organizationId: activeOrganizationId });
289
- }, [canManageOrganization, activeOrganizationId, removeMemberMutation]);
290
- const onCreateInvitation = useCallback(() => {
291
- if (!canManageOrganization || !activeOrganizationId)
292
- return;
293
- if (!inviteEmail.trim()) {
294
- toast.error(resolvedLabels.emailRequired);
295
- return;
296
- }
297
- createInvitationMutation.mutate({
298
- email: inviteEmail,
299
- role: inviteRole,
300
- organizationId: activeOrganizationId,
301
- });
302
- }, [
303
- canManageOrganization,
304
- activeOrganizationId,
305
- inviteEmail,
306
- inviteRole,
307
- resolvedLabels.emailRequired,
308
- createInvitationMutation,
309
- ]);
310
- const onCancelInvitation = useCallback((invitationId) => {
311
- if (!canManageOrganization)
312
- return;
313
- cancelInvitationMutation.mutate({ invitationId });
314
- }, [canManageOrganization, cancelInvitationMutation]);
315
- const invitationLinkBase = useMemo(() => {
316
- const invitationPath = invitationAcceptPath ?? "/organization/accept-invitation";
317
- if (/^https?:\/\//i.test(invitationPath)) {
318
- return `${invitationPath}?id=`;
319
- }
320
- return typeof window === "undefined"
321
- ? `${invitationPath}?id=`
322
- : `${window.location.origin}${invitationPath}?id=`;
323
- }, [invitationAcceptPath]);
324
- const onCopyInvitationLink = async (invitationId) => {
325
- try {
326
- await navigator.clipboard.writeText(`${invitationLinkBase}${invitationId}`);
327
- toast.success(resolvedLabels.inviteLinkCopied);
328
- }
329
- catch {
330
- toast.error(resolvedLabels.copyInviteLinkError);
331
- }
332
- };
333
- const getRoleLabel = (role) => resolvedRoleLabels[role] ?? resolvedLabels.roleUnknown;
334
- if (!activeOrganizationId) {
335
- return (_jsx(OrganizationStateCard, { title: resolvedLabels.membersTitle, message: resolvedLabels.membersNoActive }));
336
- }
337
- if (!canManageOrganization) {
338
- return (_jsx(OrganizationStateCard, { title: resolvedLabels.membersTitle, message: resolvedLabels.membersManageOnly }));
339
- }
340
- if (organizationQuery.isLoading || membersQuery.isLoading || invitationsQuery.isLoading) {
341
- return (_jsx("div", { className: "p-6 flex justify-center", children: _jsx(Spinner, {}) }));
342
- }
343
- return (_jsx("div", { className: "p-6 space-y-6", children: _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "h-4 w-4" }), _jsxs("div", { className: "flex flex-col", children: [_jsx("h2", { className: "text-lg font-semibold", children: resolvedLabels.membersTitle }), _jsx("p", { className: "text-sm text-default-500", children: resolvedLabels.membersDescription(organizationQuery.data?.name ?? resolvedLabels.defaultOrganizationName) })] })] }), _jsx(Chip, { variant: "flat", color: "primary", children: getRoleLabel(activeOrganizationRole || "member") })] }), _jsxs(CardBody, { className: "space-y-4", children: [_jsxs("div", { className: "grid gap-3 md:grid-cols-[1fr_160px_auto]", children: [_jsx(Input, { type: "email", label: resolvedLabels.emailLabel, value: inviteEmail, onValueChange: setInviteEmail, placeholder: resolvedLabels.emailPlaceholder }), _jsx(Select, { label: resolvedLabels.roleLabel, selectedKeys: [inviteRole], disallowEmptySelection: true, onSelectionChange: (keys) => {
344
- const role = Array.from(keys)[0];
345
- if (role && isOrganizationRole(role) && resolvedAssignableRoles.includes(role)) {
346
- setInviteRole(role);
347
- }
348
- }, children: resolvedAssignableRoles.map((role) => (_jsx(SelectItem, { children: getRoleLabel(role) }, role))) }), _jsx(Button, { color: "primary", startContent: _jsx(UserPlus, { className: "h-4 w-4" }), onPress: onCreateInvitation, isLoading: createInvitationMutation.isPending, children: resolvedLabels.inviteButton })] }), _jsxs(Table, { "aria-label": resolvedLabels.tableTitle, children: [_jsxs(TableHeader, { children: [_jsx(TableColumn, { children: resolvedLabels.columnName }), _jsx(TableColumn, { children: resolvedLabels.columnEmail }), _jsx(TableColumn, { children: resolvedLabels.columnRole }), _jsx(TableColumn, { children: resolvedLabels.columnStatus }), _jsx(TableColumn, { className: "text-right", children: resolvedLabels.columnActions })] }), _jsx(TableBody, { emptyContent: resolvedLabels.tableEmpty, children: rows.map((row) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: row.displayName }), _jsx(TableCell, { children: row.email }), _jsx(TableCell, { children: row.kind === "member" ? (_jsx(Select, { size: "sm", selectedKeys: [row.role], disallowEmptySelection: true, isDisabled: updatingMemberId === row.memberId, "aria-label": resolvedLabels.roleFor(row.displayName), onSelectionChange: (keys) => {
349
- const role = Array.from(keys)[0];
350
- if (role &&
351
- role !== row.role &&
352
- isOrganizationRole(role) &&
353
- resolvedAssignableRoles.includes(role)) {
354
- void onUpdateMemberRole(row.memberId, role);
355
- }
356
- }, children: resolvedAssignableRoles.map((role) => (_jsx(SelectItem, { children: getRoleLabel(role) }, role))) })) : (getRoleLabel(row.role)) }), _jsx(TableCell, { children: _jsx(Chip, { size: "sm", variant: "flat", color: row.status === "active" ? "success" : "warning", children: row.status === "active"
357
- ? resolvedLabels.statusActive
358
- : resolvedLabels.statusInvited }) }), _jsx(TableCell, { className: "text-right", children: row.kind === "member" ? (_jsx(Button, { size: "sm", color: "danger", variant: "light", isIconOnly: true, onPress: () => void onRemoveMember(row.memberId), isDisabled: removingMemberId === row.memberId, "aria-label": resolvedLabels.removeMember, children: _jsx(Trash2, { className: "h-4 w-4" }) })) : (_jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { size: "sm", variant: "light", isIconOnly: true, onPress: () => void onCopyInvitationLink(row.invitationId), "aria-label": resolvedLabels.copyInviteLink, children: _jsx(Copy, { className: "h-4 w-4" }) }), _jsx(Button, { size: "sm", color: "danger", variant: "light", isIconOnly: true, onPress: () => void onCancelInvitation(row.invitationId), isDisabled: cancelingInvitationId === row.invitationId, "aria-label": resolvedLabels.cancelInvitation, children: _jsx(Trash2, { className: "h-4 w-4" }) })] })) })] }, row.id))) })] })] })] }) }));
107
+ function OrganizationMembersRoute({ managerRoles, assignableRoles, invitationAcceptPath, onInvalidateScopedQueries }) {
108
+ const { resolvedLabels, resolvedRoleLabels, resolvedAssignableRoles } = useOrganizationConfig({ assignableRoles });
109
+ const { activeOrganizationId, activeOrganizationRole, canManageOrganization, refreshOrganizationQueries } = useOrganizationAccess({
110
+ managerRoles,
111
+ onInvalidateScopedQueries
112
+ });
113
+ const [inviteEmail, setInviteEmail] = useState("");
114
+ const [inviteRole, setInviteRole] = useState(resolvedAssignableRoles[0] ?? "member");
115
+ const isMountedRef = useRef(true);
116
+ useEffect(() => {
117
+ return () => {
118
+ isMountedRef.current = false;
119
+ };
120
+ }, []);
121
+ const refreshOrganizationQueriesStable = useCallback(() => refreshOrganizationQueries(), [refreshOrganizationQueries]);
122
+ const updateRoleMutation = useMutation({
123
+ mutationFn: async ({ memberId, role, organizationId }) => {
124
+ const { error } = await authClient.organization.updateMemberRole({
125
+ memberId,
126
+ role,
127
+ organizationId
128
+ });
129
+ if (error) throw new Error(error.message ?? resolvedLabels.roleUpdateError);
130
+ },
131
+ onSuccess: async () => {
132
+ await refreshOrganizationQueriesStable();
133
+ toast.success(resolvedLabels.roleUpdateSuccess);
134
+ },
135
+ onError: (error) => {
136
+ toast.error(error instanceof Error ? error.message : resolvedLabels.roleUpdateError);
137
+ }
138
+ });
139
+ const removeMemberMutation = useMutation({
140
+ mutationFn: async ({ memberId, organizationId }) => {
141
+ const { error } = await authClient.organization.removeMember({
142
+ memberIdOrEmail: memberId,
143
+ organizationId
144
+ });
145
+ if (error) throw new Error(error.message ?? resolvedLabels.removeMemberError);
146
+ },
147
+ onSuccess: async () => {
148
+ await refreshOrganizationQueriesStable();
149
+ toast.success(resolvedLabels.removeMemberSuccess);
150
+ },
151
+ onError: (error) => {
152
+ toast.error(error instanceof Error ? error.message : resolvedLabels.removeMemberError);
153
+ }
154
+ });
155
+ const createInvitationMutation = useMutation({
156
+ mutationFn: async ({ email, role, organizationId }) => {
157
+ const { error } = await authClient.organization.inviteMember({
158
+ organizationId,
159
+ email: email.trim(),
160
+ role
161
+ });
162
+ if (error) throw new Error(error.message ?? resolvedLabels.inviteError);
163
+ },
164
+ onSuccess: async () => {
165
+ await refreshOrganizationQueriesStable();
166
+ toast.success(resolvedLabels.inviteSuccess);
167
+ if (isMountedRef.current) {
168
+ setInviteEmail("");
169
+ setInviteRole(resolvedAssignableRoles[0] ?? "member");
170
+ }
171
+ },
172
+ onError: (error) => {
173
+ toast.error(error instanceof Error ? error.message : resolvedLabels.inviteError);
174
+ }
175
+ });
176
+ const cancelInvitationMutation = useMutation({
177
+ mutationFn: async ({ invitationId }) => {
178
+ const { error } = await authClient.organization.cancelInvitation({ invitationId });
179
+ if (error) throw new Error(error.message ?? resolvedLabels.cancelInvitationError);
180
+ },
181
+ onSuccess: async () => {
182
+ await refreshOrganizationQueriesStable();
183
+ toast.success(resolvedLabels.cancelInvitationSuccess);
184
+ },
185
+ onError: (error) => {
186
+ toast.error(error instanceof Error ? error.message : resolvedLabels.cancelInvitationError);
187
+ }
188
+ });
189
+ const updatingMemberId = updateRoleMutation.isPending && updateRoleMutation.variables ? updateRoleMutation.variables.memberId : null;
190
+ const removingMemberId = removeMemberMutation.isPending && removeMemberMutation.variables ? removeMemberMutation.variables.memberId : null;
191
+ const cancelingInvitationId = cancelInvitationMutation.isPending && cancelInvitationMutation.variables ? cancelInvitationMutation.variables.invitationId : null;
192
+ useEffect(() => {
193
+ if (!resolvedAssignableRoles.includes(inviteRole)) setInviteRole(resolvedAssignableRoles[0] ?? "member");
194
+ }, [inviteRole, resolvedAssignableRoles]);
195
+ const organizationQuery = useQuery({
196
+ queryKey: ["auth-organization-details", activeOrganizationId],
197
+ enabled: Boolean(activeOrganizationId && canManageOrganization),
198
+ queryFn: async () => {
199
+ const { data, error } = await authClient.organization.getFullOrganization({ query: {
200
+ organizationId: activeOrganizationId,
201
+ membersLimit: 200
202
+ } });
203
+ if (error) throw new Error(error.message ?? resolvedLabels.loadError);
204
+ return data;
205
+ }
206
+ });
207
+ const membersQuery = useQuery({
208
+ queryKey: ["auth-organization-members", activeOrganizationId],
209
+ enabled: Boolean(activeOrganizationId && canManageOrganization),
210
+ queryFn: async () => {
211
+ const { data, error } = await authClient.organization.listMembers({ query: {
212
+ organizationId: activeOrganizationId,
213
+ limit: 200,
214
+ offset: 0
215
+ } });
216
+ if (error) throw new Error(error.message ?? resolvedLabels.loadMembersError);
217
+ return data?.members ?? [];
218
+ }
219
+ });
220
+ const invitationsQuery = useQuery({
221
+ queryKey: ["auth-organization-invitations", activeOrganizationId],
222
+ enabled: Boolean(activeOrganizationId && canManageOrganization),
223
+ queryFn: async () => {
224
+ const { data, error } = await authClient.organization.listInvitations({ query: { organizationId: activeOrganizationId } });
225
+ if (error) throw new Error(error.message ?? resolvedLabels.loadInvitationsError);
226
+ return data ?? [];
227
+ }
228
+ });
229
+ const members = membersQuery.data ?? [];
230
+ const invitations = invitationsQuery.data ?? [];
231
+ const rows = useMemo(() => {
232
+ const memberRows = members.map((member) => ({
233
+ kind: "member",
234
+ id: `member-${member.id}`,
235
+ displayName: member.user?.name || resolvedLabels.unknownName,
236
+ email: member.user?.email || "-",
237
+ role: member.role,
238
+ status: "active",
239
+ memberId: member.id
240
+ }));
241
+ const invitationRows = invitations.map((invitation) => ({
242
+ kind: "invitation",
243
+ id: `invitation-${invitation.id}`,
244
+ displayName: resolvedLabels.invitedUser,
245
+ email: invitation.email,
246
+ role: invitation.role,
247
+ status: "invited",
248
+ invitationId: invitation.id
249
+ }));
250
+ return [...memberRows, ...invitationRows].sort((left, right) => {
251
+ if (left.status === right.status) return left.email.localeCompare(right.email);
252
+ return left.status === "active" ? -1 : 1;
253
+ });
254
+ }, [
255
+ invitations,
256
+ members,
257
+ resolvedLabels.invitedUser,
258
+ resolvedLabels.unknownName
259
+ ]);
260
+ const onUpdateMemberRole = useCallback((memberId, role) => {
261
+ if (!canManageOrganization || !activeOrganizationId) return;
262
+ updateRoleMutation.mutate({
263
+ memberId,
264
+ role,
265
+ organizationId: activeOrganizationId
266
+ });
267
+ }, [
268
+ canManageOrganization,
269
+ activeOrganizationId,
270
+ updateRoleMutation
271
+ ]);
272
+ const onRemoveMember = useCallback((memberId) => {
273
+ if (!canManageOrganization || !activeOrganizationId) return;
274
+ removeMemberMutation.mutate({
275
+ memberId,
276
+ organizationId: activeOrganizationId
277
+ });
278
+ }, [
279
+ canManageOrganization,
280
+ activeOrganizationId,
281
+ removeMemberMutation
282
+ ]);
283
+ const onCreateInvitation = useCallback(() => {
284
+ if (!canManageOrganization || !activeOrganizationId) return;
285
+ if (!inviteEmail.trim()) {
286
+ toast.error(resolvedLabels.emailRequired);
287
+ return;
288
+ }
289
+ createInvitationMutation.mutate({
290
+ email: inviteEmail,
291
+ role: inviteRole,
292
+ organizationId: activeOrganizationId
293
+ });
294
+ }, [
295
+ canManageOrganization,
296
+ activeOrganizationId,
297
+ inviteEmail,
298
+ inviteRole,
299
+ resolvedLabels.emailRequired,
300
+ createInvitationMutation
301
+ ]);
302
+ const onCancelInvitation = useCallback((invitationId) => {
303
+ if (!canManageOrganization) return;
304
+ cancelInvitationMutation.mutate({ invitationId });
305
+ }, [canManageOrganization, cancelInvitationMutation]);
306
+ const invitationLinkBase = useMemo(() => {
307
+ const invitationPath = invitationAcceptPath ?? "/organization/accept-invitation";
308
+ if (/^https?:\/\//i.test(invitationPath)) return `${invitationPath}?id=`;
309
+ return typeof window === "undefined" ? `${invitationPath}?id=` : `${window.location.origin}${invitationPath}?id=`;
310
+ }, [invitationAcceptPath]);
311
+ const onCopyInvitationLink = async (invitationId) => {
312
+ try {
313
+ await navigator.clipboard.writeText(`${invitationLinkBase}${invitationId}`);
314
+ toast.success(resolvedLabels.inviteLinkCopied);
315
+ } catch {
316
+ toast.error(resolvedLabels.copyInviteLinkError);
317
+ }
318
+ };
319
+ const getRoleLabel = (role) => resolvedRoleLabels[role] ?? resolvedLabels.roleUnknown;
320
+ if (!activeOrganizationId) return /* @__PURE__ */ jsx(OrganizationStateCard, {
321
+ title: resolvedLabels.membersTitle,
322
+ message: resolvedLabels.membersNoActive
323
+ });
324
+ if (!canManageOrganization) return /* @__PURE__ */ jsx(OrganizationStateCard, {
325
+ title: resolvedLabels.membersTitle,
326
+ message: resolvedLabels.membersManageOnly
327
+ });
328
+ if (organizationQuery.isLoading || membersQuery.isLoading || invitationsQuery.isLoading) return /* @__PURE__ */ jsx("div", {
329
+ className: "p-6 flex justify-center",
330
+ children: /* @__PURE__ */ jsx(Spinner, {})
331
+ });
332
+ return /* @__PURE__ */ jsx("div", {
333
+ className: "p-6 space-y-6",
334
+ children: /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, {
335
+ className: "flex items-center justify-between",
336
+ children: [/* @__PURE__ */ jsxs("div", {
337
+ className: "flex items-center gap-2",
338
+ children: [/* @__PURE__ */ jsx(Users, { className: "h-4 w-4" }), /* @__PURE__ */ jsxs("div", {
339
+ className: "flex flex-col",
340
+ children: [/* @__PURE__ */ jsx("h2", {
341
+ className: "text-lg font-semibold",
342
+ children: resolvedLabels.membersTitle
343
+ }), /* @__PURE__ */ jsx("p", {
344
+ className: "text-sm text-default-500",
345
+ children: resolvedLabels.membersDescription(organizationQuery.data?.name ?? resolvedLabels.defaultOrganizationName)
346
+ })]
347
+ })]
348
+ }), /* @__PURE__ */ jsx(Chip, {
349
+ variant: "flat",
350
+ color: "primary",
351
+ children: getRoleLabel(activeOrganizationRole || "member")
352
+ })]
353
+ }), /* @__PURE__ */ jsxs(CardBody, {
354
+ className: "space-y-4",
355
+ children: [/* @__PURE__ */ jsxs("div", {
356
+ className: "grid gap-3 md:grid-cols-[1fr_160px_auto]",
357
+ children: [
358
+ /* @__PURE__ */ jsx(Input, {
359
+ type: "email",
360
+ label: resolvedLabels.emailLabel,
361
+ value: inviteEmail,
362
+ onValueChange: setInviteEmail,
363
+ placeholder: resolvedLabels.emailPlaceholder
364
+ }),
365
+ /* @__PURE__ */ jsx(Select, {
366
+ label: resolvedLabels.roleLabel,
367
+ selectedKeys: [inviteRole],
368
+ disallowEmptySelection: true,
369
+ onSelectionChange: (keys) => {
370
+ const role = Array.from(keys)[0];
371
+ if (role && isOrganizationRole(role) && resolvedAssignableRoles.includes(role)) setInviteRole(role);
372
+ },
373
+ children: resolvedAssignableRoles.map((role) => /* @__PURE__ */ jsx(SelectItem, { children: getRoleLabel(role) }, role))
374
+ }),
375
+ /* @__PURE__ */ jsx(Button, {
376
+ color: "primary",
377
+ startContent: /* @__PURE__ */ jsx(UserPlus, { className: "h-4 w-4" }),
378
+ onPress: onCreateInvitation,
379
+ isLoading: createInvitationMutation.isPending,
380
+ children: resolvedLabels.inviteButton
381
+ })
382
+ ]
383
+ }), /* @__PURE__ */ jsxs(Table, {
384
+ "aria-label": resolvedLabels.tableTitle,
385
+ children: [/* @__PURE__ */ jsxs(TableHeader, { children: [
386
+ /* @__PURE__ */ jsx(TableColumn, { children: resolvedLabels.columnName }),
387
+ /* @__PURE__ */ jsx(TableColumn, { children: resolvedLabels.columnEmail }),
388
+ /* @__PURE__ */ jsx(TableColumn, { children: resolvedLabels.columnRole }),
389
+ /* @__PURE__ */ jsx(TableColumn, { children: resolvedLabels.columnStatus }),
390
+ /* @__PURE__ */ jsx(TableColumn, {
391
+ className: "text-right",
392
+ children: resolvedLabels.columnActions
393
+ })
394
+ ] }), /* @__PURE__ */ jsx(TableBody, {
395
+ emptyContent: resolvedLabels.tableEmpty,
396
+ children: rows.map((row) => /* @__PURE__ */ jsxs(TableRow, { children: [
397
+ /* @__PURE__ */ jsx(TableCell, { children: row.displayName }),
398
+ /* @__PURE__ */ jsx(TableCell, { children: row.email }),
399
+ /* @__PURE__ */ jsx(TableCell, { children: row.kind === "member" ? /* @__PURE__ */ jsx(Select, {
400
+ size: "sm",
401
+ selectedKeys: [row.role],
402
+ disallowEmptySelection: true,
403
+ isDisabled: updatingMemberId === row.memberId,
404
+ "aria-label": resolvedLabels.roleFor(row.displayName),
405
+ onSelectionChange: (keys) => {
406
+ const role = Array.from(keys)[0];
407
+ if (role && role !== row.role && isOrganizationRole(role) && resolvedAssignableRoles.includes(role)) onUpdateMemberRole(row.memberId, role);
408
+ },
409
+ children: resolvedAssignableRoles.map((role) => /* @__PURE__ */ jsx(SelectItem, { children: getRoleLabel(role) }, role))
410
+ }) : getRoleLabel(row.role) }),
411
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Chip, {
412
+ size: "sm",
413
+ variant: "flat",
414
+ color: row.status === "active" ? "success" : "warning",
415
+ children: row.status === "active" ? resolvedLabels.statusActive : resolvedLabels.statusInvited
416
+ }) }),
417
+ /* @__PURE__ */ jsx(TableCell, {
418
+ className: "text-right",
419
+ children: row.kind === "member" ? /* @__PURE__ */ jsx(Button, {
420
+ size: "sm",
421
+ color: "danger",
422
+ variant: "light",
423
+ isIconOnly: true,
424
+ onPress: () => void onRemoveMember(row.memberId),
425
+ isDisabled: removingMemberId === row.memberId,
426
+ "aria-label": resolvedLabels.removeMember,
427
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
428
+ }) : /* @__PURE__ */ jsxs("div", {
429
+ className: "flex justify-end gap-2",
430
+ children: [/* @__PURE__ */ jsx(Button, {
431
+ size: "sm",
432
+ variant: "light",
433
+ isIconOnly: true,
434
+ onPress: () => void onCopyInvitationLink(row.invitationId),
435
+ "aria-label": resolvedLabels.copyInviteLink,
436
+ children: /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" })
437
+ }), /* @__PURE__ */ jsx(Button, {
438
+ size: "sm",
439
+ color: "danger",
440
+ variant: "light",
441
+ isIconOnly: true,
442
+ onPress: () => void onCancelInvitation(row.invitationId),
443
+ isDisabled: cancelingInvitationId === row.invitationId,
444
+ "aria-label": resolvedLabels.cancelInvitation,
445
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
446
+ })]
447
+ })
448
+ })
449
+ ] }, row.id))
450
+ })]
451
+ })]
452
+ })] })
453
+ });
359
454
  }
455
+ //#endregion
456
+ export { OrganizationMembersRoute };
457
+
458
+ //# sourceMappingURL=OrganizationMembersRoute.js.map