@greatapps/common 1.1.173 → 1.1.174

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 (375) hide show
  1. package/dist/components/account/AccountModals.mjs +18 -0
  2. package/dist/components/account/AccountModals.mjs.map +1 -0
  3. package/dist/components/account/ConfigurationsMyAccountModal.mjs +132 -0
  4. package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -0
  5. package/dist/components/account/ConfirmDeleteAccountModal.mjs +45 -0
  6. package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -0
  7. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +45 -0
  8. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -0
  9. package/dist/components/account/DeleteAccountModal.mjs +123 -0
  10. package/dist/components/account/DeleteAccountModal.mjs.map +1 -0
  11. package/dist/components/account/DisableTwoFactorAuthModal.mjs +67 -0
  12. package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -0
  13. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +42 -0
  14. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -0
  15. package/dist/components/account/TwoFactorAuthModal.mjs +190 -0
  16. package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -0
  17. package/dist/components/account/constants.mjs +29 -0
  18. package/dist/components/account/constants.mjs.map +1 -0
  19. package/dist/components/account/hooks/useChangeEmailForm.mjs +53 -0
  20. package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -0
  21. package/dist/components/account/hooks/useChangePasswordForm.mjs +47 -0
  22. package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -0
  23. package/dist/components/account/hooks/useChangePhoneForm.mjs +72 -0
  24. package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -0
  25. package/dist/components/account/hooks/useConfigurationsModal.mjs +33 -0
  26. package/dist/components/account/hooks/useConfigurationsModal.mjs.map +1 -0
  27. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +54 -0
  28. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -0
  29. package/dist/components/account/hooks/useOtpVerification.mjs +94 -0
  30. package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -0
  31. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +80 -0
  32. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -0
  33. package/dist/components/account/sections/ChangeEmailModal.mjs +181 -0
  34. package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -0
  35. package/dist/components/account/sections/ChangePasswordSection.mjs +64 -0
  36. package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -0
  37. package/dist/components/account/sections/ChangePhoneModal.mjs +187 -0
  38. package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -0
  39. package/dist/components/account/sections/MyProfileSection.mjs +303 -0
  40. package/dist/components/account/sections/MyProfileSection.mjs.map +1 -0
  41. package/dist/components/account/sections/PreferencesSection.mjs +250 -0
  42. package/dist/components/account/sections/PreferencesSection.mjs.map +1 -0
  43. package/dist/components/account/sections/SecuritySection.mjs +147 -0
  44. package/dist/components/account/sections/SecuritySection.mjs.map +1 -0
  45. package/dist/components/handlers/SearchParamsHandler.mjs +24 -0
  46. package/dist/components/handlers/SearchParamsHandler.mjs.map +1 -0
  47. package/dist/components/layouts/AppMobileNavBar.mjs +115 -0
  48. package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -0
  49. package/dist/components/layouts/AppNavBar.mjs +49 -0
  50. package/dist/components/layouts/AppNavBar.mjs.map +1 -0
  51. package/dist/components/layouts/MainLayout.mjs +60 -0
  52. package/dist/components/layouts/MainLayout.mjs.map +1 -0
  53. package/dist/components/layouts/MdSideBarNavigation.mjs +54 -0
  54. package/dist/components/layouts/MdSideBarNavigation.mjs.map +1 -0
  55. package/dist/components/layouts/NavBar.mjs +132 -0
  56. package/dist/components/layouts/NavBar.mjs.map +1 -0
  57. package/dist/components/layouts/NavBarItem.mjs +23 -0
  58. package/dist/components/layouts/NavBarItem.mjs.map +1 -0
  59. package/dist/components/layouts/NotificationsPopover.mjs +97 -0
  60. package/dist/components/layouts/NotificationsPopover.mjs.map +1 -0
  61. package/dist/components/layouts/ProfilePopover.mjs +149 -0
  62. package/dist/components/layouts/ProfilePopover.mjs.map +1 -0
  63. package/dist/components/layouts/SideBarNavigation.mjs +22 -0
  64. package/dist/components/layouts/SideBarNavigation.mjs.map +1 -0
  65. package/dist/components/layouts/UsersSelectorPopover.mjs +230 -0
  66. package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -0
  67. package/dist/components/modals/ModalManager.mjs +19 -0
  68. package/dist/components/modals/ModalManager.mjs.map +1 -0
  69. package/dist/components/modals/Modals.mjs +20 -0
  70. package/dist/components/modals/Modals.mjs.map +1 -0
  71. package/dist/components/navigation/AppNavigation.mjs +30 -0
  72. package/dist/components/navigation/AppNavigation.mjs.map +1 -0
  73. package/dist/components/navigation/AppNavigationContext.mjs +13 -0
  74. package/dist/components/navigation/AppNavigationContext.mjs.map +1 -0
  75. package/dist/components/navigation/CancelledSubscriptionBanner.mjs +59 -0
  76. package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -0
  77. package/dist/components/navigation/NavItem.mjs +35 -0
  78. package/dist/components/navigation/NavItem.mjs.map +1 -0
  79. package/dist/components/navigation/NavItemsContext.mjs +16 -0
  80. package/dist/components/navigation/NavItemsContext.mjs.map +1 -0
  81. package/dist/components/navigation/ProjectSelectorPopover.mjs +128 -0
  82. package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -0
  83. package/dist/components/navigation/shells/DesktopShell.mjs +11 -0
  84. package/dist/components/navigation/shells/DesktopShell.mjs.map +1 -0
  85. package/dist/components/navigation/shells/MdShell.mjs +11 -0
  86. package/dist/components/navigation/shells/MdShell.mjs.map +1 -0
  87. package/dist/components/navigation/shells/MobileShell.mjs +27 -0
  88. package/dist/components/navigation/shells/MobileShell.mjs.map +1 -0
  89. package/dist/components/navigation/shells/TabsMobileShell.mjs +59 -0
  90. package/dist/components/navigation/shells/TabsMobileShell.mjs.map +1 -0
  91. package/dist/components/navigation/subcomponents/CreditsCard.mjs +30 -0
  92. package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -0
  93. package/dist/components/navigation/subcomponents/NavItems.mjs +25 -0
  94. package/dist/components/navigation/subcomponents/NavItems.mjs.map +1 -0
  95. package/dist/components/navigation/subcomponents/PlanCard.mjs +25 -0
  96. package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -0
  97. package/dist/components/navigation/subcomponents/ProjectSelector.mjs +130 -0
  98. package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -0
  99. package/dist/components/navigation/types.mjs +1 -0
  100. package/dist/components/navigation/types.mjs.map +1 -0
  101. package/dist/components/pages/notifications/Notifications.mjs +156 -0
  102. package/dist/components/pages/notifications/Notifications.mjs.map +1 -0
  103. package/dist/components/ui/buttons/Button.mjs +52 -0
  104. package/dist/components/ui/buttons/Button.mjs.map +1 -0
  105. package/dist/components/ui/buttons/CancelButton.mjs +17 -0
  106. package/dist/components/ui/buttons/CancelButton.mjs.map +1 -0
  107. package/dist/components/ui/buttons/CopyButton.mjs +42 -0
  108. package/dist/components/ui/buttons/CopyButton.mjs.map +1 -0
  109. package/dist/components/ui/data-display/Accordion.mjs +76 -0
  110. package/dist/components/ui/data-display/Accordion.mjs.map +1 -0
  111. package/dist/components/ui/data-display/Badge.mjs +42 -0
  112. package/dist/components/ui/data-display/Badge.mjs.map +1 -0
  113. package/dist/components/ui/data-display/Card.mjs +92 -0
  114. package/dist/components/ui/data-display/Card.mjs.map +1 -0
  115. package/dist/components/ui/data-display/Pagination.mjs +118 -0
  116. package/dist/components/ui/data-display/Pagination.mjs.map +1 -0
  117. package/dist/components/ui/data-display/ScrollArea.mjs +62 -0
  118. package/dist/components/ui/data-display/ScrollArea.mjs.map +1 -0
  119. package/dist/components/ui/data-display/Separator.mjs +28 -0
  120. package/dist/components/ui/data-display/Separator.mjs.map +1 -0
  121. package/dist/components/ui/data-display/Table.mjs +116 -0
  122. package/dist/components/ui/data-display/Table.mjs.map +1 -0
  123. package/dist/components/ui/data-display/Tabs.mjs +69 -0
  124. package/dist/components/ui/data-display/Tabs.mjs.map +1 -0
  125. package/dist/components/ui/data-display/UserAvatar.mjs +49 -0
  126. package/dist/components/ui/data-display/UserAvatar.mjs.map +1 -0
  127. package/dist/components/ui/feedback/CircularProgress.mjs +71 -0
  128. package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -0
  129. package/dist/components/ui/feedback/DefaultCircularProgress.mjs +50 -0
  130. package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -0
  131. package/dist/components/ui/feedback/LoadingOverlay.mjs +19 -0
  132. package/dist/components/ui/feedback/LoadingOverlay.mjs.map +1 -0
  133. package/dist/components/ui/feedback/Progress.mjs +37 -0
  134. package/dist/components/ui/feedback/Progress.mjs.map +1 -0
  135. package/dist/components/ui/feedback/Toast.mjs +77 -0
  136. package/dist/components/ui/feedback/Toast.mjs.map +1 -0
  137. package/dist/components/ui/form/Calendar.mjs +204 -0
  138. package/dist/components/ui/form/Calendar.mjs.map +1 -0
  139. package/dist/components/ui/form/Checkbox.mjs +33 -0
  140. package/dist/components/ui/form/Checkbox.mjs.map +1 -0
  141. package/dist/components/ui/form/ComboboxField.mjs +130 -0
  142. package/dist/components/ui/form/ComboboxField.mjs.map +1 -0
  143. package/dist/components/ui/form/DatePicker.mjs +82 -0
  144. package/dist/components/ui/form/DatePicker.mjs.map +1 -0
  145. package/dist/components/ui/form/DateRangePicker.mjs +92 -0
  146. package/dist/components/ui/form/DateRangePicker.mjs.map +1 -0
  147. package/dist/components/ui/form/FormField.mjs +103 -0
  148. package/dist/components/ui/form/FormField.mjs.map +1 -0
  149. package/dist/components/ui/form/Input.mjs +21 -0
  150. package/dist/components/ui/form/Input.mjs.map +1 -0
  151. package/dist/components/ui/form/InputOtp.mjs +70 -0
  152. package/dist/components/ui/form/InputOtp.mjs.map +1 -0
  153. package/dist/components/ui/form/PhoneInput.mjs +119 -0
  154. package/dist/components/ui/form/PhoneInput.mjs.map +1 -0
  155. package/dist/components/ui/form/RadioGroup.mjs +37 -0
  156. package/dist/components/ui/form/RadioGroup.mjs.map +1 -0
  157. package/dist/components/ui/form/Select.mjs +179 -0
  158. package/dist/components/ui/form/Select.mjs.map +1 -0
  159. package/dist/components/ui/form/SelectField.mjs +80 -0
  160. package/dist/components/ui/form/SelectField.mjs.map +1 -0
  161. package/dist/components/ui/form/Switch.mjs +33 -0
  162. package/dist/components/ui/form/Switch.mjs.map +1 -0
  163. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs +40 -0
  164. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs.map +1 -0
  165. package/dist/components/ui/form/TextAreaField.mjs +56 -0
  166. package/dist/components/ui/form/TextAreaField.mjs.map +1 -0
  167. package/dist/components/ui/form/Textarea.mjs +20 -0
  168. package/dist/components/ui/form/Textarea.mjs.map +1 -0
  169. package/dist/components/ui/overlay/Command.mjs +178 -0
  170. package/dist/components/ui/overlay/Command.mjs.map +1 -0
  171. package/dist/components/ui/overlay/Dialog.mjs +142 -0
  172. package/dist/components/ui/overlay/Dialog.mjs.map +1 -0
  173. package/dist/components/ui/overlay/Popover.mjs +46 -0
  174. package/dist/components/ui/overlay/Popover.mjs.map +1 -0
  175. package/dist/components/ui/overlay/Sheet.mjs +142 -0
  176. package/dist/components/ui/overlay/Sheet.mjs.map +1 -0
  177. package/dist/components/ui/overlay/Tooltip.mjs +57 -0
  178. package/dist/components/ui/overlay/Tooltip.mjs.map +1 -0
  179. package/dist/components/widgets/notifications/NotificationCard.mjs +54 -0
  180. package/dist/components/widgets/notifications/NotificationCard.mjs.map +1 -0
  181. package/dist/enums/AccountSectionType.mjs +11 -0
  182. package/dist/enums/AccountSectionType.mjs.map +1 -0
  183. package/dist/hooks/copy-to-clipboard.hook.mjs +52 -0
  184. package/dist/hooks/copy-to-clipboard.hook.mjs.map +1 -0
  185. package/dist/hooks/useCountdownTimer.mjs +29 -0
  186. package/dist/hooks/useCountdownTimer.mjs.map +1 -0
  187. package/dist/hooks/useDebounce.mjs +19 -0
  188. package/dist/hooks/useDebounce.mjs.map +1 -0
  189. package/dist/hooks/useDebounceState.mjs +12 -0
  190. package/dist/hooks/useDebounceState.mjs.map +1 -0
  191. package/dist/hooks/useDebouncedEffect.mjs +44 -0
  192. package/dist/hooks/useDebouncedEffect.mjs.map +1 -0
  193. package/dist/hooks/useIsMobile.mjs +18 -0
  194. package/dist/hooks/useIsMobile.mjs.map +1 -0
  195. package/dist/hooks/usePasswordVisibility.mjs +13 -0
  196. package/dist/hooks/usePasswordVisibility.mjs.map +1 -0
  197. package/dist/index.mjs +457 -0
  198. package/dist/index.mjs.map +1 -0
  199. package/dist/infra/api/client.mjs +136 -0
  200. package/dist/infra/api/client.mjs.map +1 -0
  201. package/dist/infra/api/types.mjs +31 -0
  202. package/dist/infra/api/types.mjs.map +1 -0
  203. package/dist/infra/utils/client-info.mjs +27 -0
  204. package/dist/infra/utils/client-info.mjs.map +1 -0
  205. package/dist/infra/utils/clsx.mjs +9 -0
  206. package/dist/infra/utils/clsx.mjs.map +1 -0
  207. package/dist/infra/utils/params.mjs +21 -0
  208. package/dist/infra/utils/params.mjs.map +1 -0
  209. package/dist/infra/utils/parser.mjs +24 -0
  210. package/dist/infra/utils/parser.mjs.map +1 -0
  211. package/dist/infra/utils/percentage.mjs +20 -0
  212. package/dist/infra/utils/percentage.mjs.map +1 -0
  213. package/dist/middleware.mjs +10 -0
  214. package/dist/middleware.mjs.map +1 -0
  215. package/dist/middlewares/chain.mjs +37 -0
  216. package/dist/middlewares/chain.mjs.map +1 -0
  217. package/dist/middlewares/create-auth-middleware.mjs +28 -0
  218. package/dist/middlewares/create-auth-middleware.mjs.map +1 -0
  219. package/dist/middlewares/types.mjs +11 -0
  220. package/dist/middlewares/types.mjs.map +1 -0
  221. package/dist/modules/accounts/actions/account-management.action.mjs +82 -0
  222. package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -0
  223. package/dist/modules/accounts/actions/find-current-account.action.mjs +10 -0
  224. package/dist/modules/accounts/actions/find-current-account.action.mjs.map +1 -0
  225. package/dist/modules/accounts/actions/list-currencies.action.mjs +10 -0
  226. package/dist/modules/accounts/actions/list-currencies.action.mjs.map +1 -0
  227. package/dist/modules/accounts/actions/list-timezones.action.mjs +10 -0
  228. package/dist/modules/accounts/actions/list-timezones.action.mjs.map +1 -0
  229. package/dist/modules/accounts/hooks/current-account.hook.mjs +24 -0
  230. package/dist/modules/accounts/hooks/current-account.hook.mjs.map +1 -0
  231. package/dist/modules/accounts/hooks/useAccountManagement.mjs +71 -0
  232. package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -0
  233. package/dist/modules/accounts/hooks/useCurrencies.mjs +17 -0
  234. package/dist/modules/accounts/hooks/useCurrencies.mjs.map +1 -0
  235. package/dist/modules/accounts/hooks/useTimezones.mjs +17 -0
  236. package/dist/modules/accounts/hooks/useTimezones.mjs.map +1 -0
  237. package/dist/modules/accounts/services/account.service.mjs +180 -0
  238. package/dist/modules/accounts/services/account.service.mjs.map +1 -0
  239. package/dist/modules/accounts/services/currency.service.mjs +24 -0
  240. package/dist/modules/accounts/services/currency.service.mjs.map +1 -0
  241. package/dist/modules/accounts/services/timezone.service.mjs +65 -0
  242. package/dist/modules/accounts/services/timezone.service.mjs.map +1 -0
  243. package/dist/modules/accounts/services/two-factor.service.mjs +77 -0
  244. package/dist/modules/accounts/services/two-factor.service.mjs.map +1 -0
  245. package/dist/modules/accounts/types.mjs +1 -0
  246. package/dist/modules/accounts/types.mjs.map +1 -0
  247. package/dist/modules/auth/actions/login.action.mjs +14 -0
  248. package/dist/modules/auth/actions/login.action.mjs.map +1 -0
  249. package/dist/modules/auth/actions/logout.action.mjs +14 -0
  250. package/dist/modules/auth/actions/logout.action.mjs.map +1 -0
  251. package/dist/modules/auth/actions/register.action.mjs +14 -0
  252. package/dist/modules/auth/actions/register.action.mjs.map +1 -0
  253. package/dist/modules/auth/actions/validate-session.action.mjs +60 -0
  254. package/dist/modules/auth/actions/validate-session.action.mjs.map +1 -0
  255. package/dist/modules/auth/actions/verify-two-factor.action.mjs +17 -0
  256. package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +1 -0
  257. package/dist/modules/auth/hooks/login.hook.mjs +13 -0
  258. package/dist/modules/auth/hooks/login.hook.mjs.map +1 -0
  259. package/dist/modules/auth/hooks/logout.hook.mjs +13 -0
  260. package/dist/modules/auth/hooks/logout.hook.mjs.map +1 -0
  261. package/dist/modules/auth/hooks/register.hook.mjs +13 -0
  262. package/dist/modules/auth/hooks/register.hook.mjs.map +1 -0
  263. package/dist/modules/auth/hooks/useUserQuery.mjs +63 -0
  264. package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -0
  265. package/dist/modules/auth/schema.mjs +1 -0
  266. package/dist/modules/auth/schema.mjs.map +1 -0
  267. package/dist/modules/auth/services/auth.service.mjs +294 -0
  268. package/dist/modules/auth/services/auth.service.mjs.map +1 -0
  269. package/dist/modules/auth/utils/get-user-context.mjs +24 -0
  270. package/dist/modules/auth/utils/get-user-context.mjs.map +1 -0
  271. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs +10 -0
  272. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs.map +1 -0
  273. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +76 -0
  274. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +1 -0
  275. package/dist/modules/ia-credits/services/ia-credits.service.mjs +31 -0
  276. package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +1 -0
  277. package/dist/modules/ia-credits/types.mjs +25 -0
  278. package/dist/modules/ia-credits/types.mjs.map +1 -0
  279. package/dist/modules/projects/actions/add-project-user.action.mjs +10 -0
  280. package/dist/modules/projects/actions/add-project-user.action.mjs.map +1 -0
  281. package/dist/modules/projects/actions/list-available-users.action.mjs +10 -0
  282. package/dist/modules/projects/actions/list-available-users.action.mjs.map +1 -0
  283. package/dist/modules/projects/actions/list-project-users.action.mjs +10 -0
  284. package/dist/modules/projects/actions/list-project-users.action.mjs.map +1 -0
  285. package/dist/modules/projects/actions/remove-project-user.action.mjs +10 -0
  286. package/dist/modules/projects/actions/remove-project-user.action.mjs.map +1 -0
  287. package/dist/modules/projects/hooks/list-available-users.hook.mjs +34 -0
  288. package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -0
  289. package/dist/modules/projects/hooks/list-project-users.hook.mjs +34 -0
  290. package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -0
  291. package/dist/modules/projects/services/project-users.service.mjs +78 -0
  292. package/dist/modules/projects/services/project-users.service.mjs.map +1 -0
  293. package/dist/modules/projects/types.mjs +22 -0
  294. package/dist/modules/projects/types.mjs.map +1 -0
  295. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs +10 -0
  296. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs.map +1 -0
  297. package/dist/modules/subscriptions/constants/addons.constants.mjs +12 -0
  298. package/dist/modules/subscriptions/constants/addons.constants.mjs.map +1 -0
  299. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +20 -0
  300. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +1 -0
  301. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +18 -0
  302. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +1 -0
  303. package/dist/modules/subscriptions/services/subscriptions.service.mjs +32 -0
  304. package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +1 -0
  305. package/dist/modules/subscriptions/types.mjs +57 -0
  306. package/dist/modules/subscriptions/types.mjs.map +1 -0
  307. package/dist/modules/users/action/find-user-by-id.action.mjs +10 -0
  308. package/dist/modules/users/action/find-user-by-id.action.mjs.map +1 -0
  309. package/dist/modules/users/action/list-messages.action.mjs +13 -0
  310. package/dist/modules/users/action/list-messages.action.mjs.map +1 -0
  311. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs +10 -0
  312. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs.map +1 -0
  313. package/dist/modules/users/action/mark-message-as-read.action.mjs +10 -0
  314. package/dist/modules/users/action/mark-message-as-read.action.mjs.map +1 -0
  315. package/dist/modules/users/hooks/messages.hook.mjs +57 -0
  316. package/dist/modules/users/hooks/messages.hook.mjs.map +1 -0
  317. package/dist/modules/users/schema/messages.schema.mjs +21 -0
  318. package/dist/modules/users/schema/messages.schema.mjs.map +1 -0
  319. package/dist/modules/users/schema.mjs +11 -0
  320. package/dist/modules/users/schema.mjs.map +1 -0
  321. package/dist/modules/users/services/messages.service.mjs +35 -0
  322. package/dist/modules/users/services/messages.service.mjs.map +1 -0
  323. package/dist/modules/users/services/user.service.mjs +50 -0
  324. package/dist/modules/users/services/user.service.mjs.map +1 -0
  325. package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs +15 -0
  326. package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs.map +1 -0
  327. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +21 -0
  328. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +1 -0
  329. package/dist/modules/whitelabel/schema.mjs +1 -0
  330. package/dist/modules/whitelabel/schema.mjs.map +1 -0
  331. package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs +81 -0
  332. package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs.map +1 -0
  333. package/dist/modules/whitelabel/services/whitelabel.service.mjs +61 -0
  334. package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +1 -0
  335. package/dist/modules/whitelabel/styles-schema.mjs +1 -0
  336. package/dist/modules/whitelabel/styles-schema.mjs.map +1 -0
  337. package/dist/providers/auth.provider.mjs +100 -0
  338. package/dist/providers/auth.provider.mjs.map +1 -0
  339. package/dist/providers/query.provider.mjs +99 -0
  340. package/dist/providers/query.provider.mjs.map +1 -0
  341. package/dist/providers/whitelabel.provider.mjs +31 -0
  342. package/dist/providers/whitelabel.provider.mjs.map +1 -0
  343. package/dist/server.mjs +84 -0
  344. package/dist/server.mjs.map +1 -0
  345. package/dist/store/useAccountModals.mjs +18 -0
  346. package/dist/store/useAccountModals.mjs.map +1 -0
  347. package/dist/store/useMdSidebarStore.mjs +11 -0
  348. package/dist/store/useMdSidebarStore.mjs.map +1 -0
  349. package/dist/store/useMobileNavbarSheet.mjs +14 -0
  350. package/dist/store/useMobileNavbarSheet.mjs.map +1 -0
  351. package/dist/store/useModalManager.mjs +75 -0
  352. package/dist/store/useModalManager.mjs.map +1 -0
  353. package/dist/utils/browser/clipboard.mjs +36 -0
  354. package/dist/utils/browser/clipboard.mjs.map +1 -0
  355. package/dist/utils/file/index.mjs +9 -0
  356. package/dist/utils/file/index.mjs.map +1 -0
  357. package/dist/utils/format/masks.mjs +56 -0
  358. package/dist/utils/format/masks.mjs.map +1 -0
  359. package/dist/utils/intl/locales.mjs +12 -0
  360. package/dist/utils/intl/locales.mjs.map +1 -0
  361. package/dist/utils/safeServerAction.mjs +16 -0
  362. package/dist/utils/safeServerAction.mjs.map +1 -0
  363. package/dist/utils/validators/account.mjs +26 -0
  364. package/dist/utils/validators/account.mjs.map +1 -0
  365. package/dist/utils/validators/common.mjs +47 -0
  366. package/dist/utils/validators/common.mjs.map +1 -0
  367. package/dist/utils/withAction.mjs +13 -0
  368. package/dist/utils/withAction.mjs.map +1 -0
  369. package/package.json +1 -1
  370. package/src/components/account/hooks/useChangePhoneForm.tsx +78 -69
  371. package/src/components/account/sections/ChangeEmailModal.tsx +2 -1
  372. package/src/components/account/sections/ChangePhoneModal.tsx +234 -229
  373. package/src/components/ui/form/PhoneInput.tsx +148 -98
  374. package/src/modules/accounts/actions/account-management.action.ts +4 -4
  375. package/src/modules/accounts/services/account.service.ts +4 -4
@@ -0,0 +1,76 @@
1
+ "use client";
2
+ import { useMemo } from "react";
3
+ import { useQuery } from "@tanstack/react-query";
4
+ import { listIaCreditsAction } from "../actions/list-ia-credits.action";
5
+ import { useActiveSubscription } from "../../subscriptions/hooks/find-active-subscription.hook";
6
+ import { withAction } from "../../../utils/withAction";
7
+ function calculateSummary(operations) {
8
+ const today = /* @__PURE__ */ new Date();
9
+ const todayDate = new Date(today.getFullYear(), today.getMonth(), today.getDate());
10
+ const adds = operations.filter((op) => op.operation === "add");
11
+ const subtracts = operations.filter((op) => op.operation === "subtract");
12
+ let totalCredits = 0;
13
+ let usedCredits = 0;
14
+ let nextExpirationInDays = null;
15
+ let nextExpiringCredits = null;
16
+ for (const add of adds) {
17
+ const expirationRaw = add.expiration_time;
18
+ if (!expirationRaw) continue;
19
+ const expiration = new Date(expirationRaw);
20
+ const expirationDate = new Date(
21
+ expiration.getFullYear(),
22
+ expiration.getMonth(),
23
+ expiration.getDate()
24
+ );
25
+ const expiredByDate = expirationDate.getTime() < todayDate.getTime();
26
+ const hasExpired = add.has_expired || expiredByDate;
27
+ if (hasExpired) continue;
28
+ const addedCredits = add.operation_value;
29
+ const consumedForAdd = subtracts.filter((sub) => String(sub.consumed_from_add_id) === String(add.id)).reduce((sum, sub) => sum + sub.operation_value, 0);
30
+ const remainingForAdd = Math.max(0, addedCredits - consumedForAdd);
31
+ totalCredits += addedCredits;
32
+ usedCredits += consumedForAdd;
33
+ const diffMs = expirationDate.getTime() - todayDate.getTime();
34
+ const days = Math.max(0, Math.ceil(diffMs / (1e3 * 60 * 60 * 24)));
35
+ if (remainingForAdd > 0) {
36
+ if (nextExpirationInDays === null || days < nextExpirationInDays) {
37
+ nextExpirationInDays = days;
38
+ nextExpiringCredits = remainingForAdd;
39
+ }
40
+ }
41
+ }
42
+ const availableCredits = Math.max(0, totalCredits - usedCredits);
43
+ return {
44
+ totalCredits,
45
+ usedCredits,
46
+ availableCredits,
47
+ nextExpiringCredits,
48
+ nextExpirationInDays
49
+ };
50
+ }
51
+ function useIaCredits() {
52
+ const { data: subscriptionData, isPending: isSubscriptionLoading } = useActiveSubscription();
53
+ const subscription = subscriptionData?.data?.[0] ?? null;
54
+ const subscriptionId = subscription?.id;
55
+ const query = useQuery({
56
+ queryKey: ["ia-credits", subscriptionId],
57
+ queryFn: withAction(() => listIaCreditsAction(subscriptionId)),
58
+ enabled: subscriptionId != null
59
+ });
60
+ const operations = query.data?.data ?? [];
61
+ const summary = useMemo(() => calculateSummary(operations), [operations]);
62
+ return {
63
+ subscription,
64
+ operations,
65
+ summary,
66
+ isLoading: isSubscriptionLoading || query.isPending,
67
+ isSubscriptionLoading,
68
+ isCreditsLoading: query.isPending,
69
+ isError: query.isError,
70
+ error: query.error
71
+ };
72
+ }
73
+ export {
74
+ useIaCredits
75
+ };
76
+ //# sourceMappingURL=ia-credits.hook.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/ia-credits/hooks/ia-credits.hook.ts"],"sourcesContent":["'use client';\r\n\r\nimport { useMemo } from 'react';\r\nimport { useQuery } from '@tanstack/react-query';\r\nimport { listIaCreditsAction } from '../actions/list-ia-credits.action';\r\nimport type { IaCreditOperation, IaCreditsSummary } from '../types';\r\nimport { useActiveSubscription } from '../../subscriptions/hooks/find-active-subscription.hook';\r\nimport { withAction } from '../../../utils/withAction';\r\n\r\nfunction calculateSummary(operations: IaCreditOperation[]): IaCreditsSummary {\r\n const today = new Date();\r\n const todayDate = new Date(today.getFullYear(), today.getMonth(), today.getDate());\r\n\r\n const adds = operations.filter((op) => op.operation === 'add');\r\n const subtracts = operations.filter((op) => op.operation === 'subtract');\r\n\r\n let totalCredits = 0;\r\n let usedCredits = 0;\r\n let nextExpirationInDays: number | null = null;\r\n let nextExpiringCredits: number | null = null;\r\n\r\n for (const add of adds) {\r\n const expirationRaw = add.expiration_time;\r\n if (!expirationRaw) continue;\r\n\r\n const expiration = new Date(expirationRaw);\r\n const expirationDate = new Date(\r\n expiration.getFullYear(),\r\n expiration.getMonth(),\r\n expiration.getDate()\r\n );\r\n\r\n const expiredByDate = expirationDate.getTime() < todayDate.getTime();\r\n const hasExpired = add.has_expired || expiredByDate;\r\n\r\n if (hasExpired) continue;\r\n\r\n const addedCredits = add.operation_value;\r\n\r\n const consumedForAdd = subtracts\r\n .filter((sub) => String(sub.consumed_from_add_id) === String(add.id))\r\n .reduce((sum, sub) => sum + sub.operation_value, 0);\r\n\r\n const remainingForAdd = Math.max(0, addedCredits - consumedForAdd);\r\n\r\n totalCredits += addedCredits;\r\n usedCredits += consumedForAdd;\r\n\r\n const diffMs = expirationDate.getTime() - todayDate.getTime();\r\n const days = Math.max(0, Math.ceil(diffMs / (1000 * 60 * 60 * 24)));\r\n\r\n if (remainingForAdd > 0) {\r\n if (nextExpirationInDays === null || days < nextExpirationInDays) {\r\n nextExpirationInDays = days;\r\n nextExpiringCredits = remainingForAdd;\r\n }\r\n }\r\n }\r\n\r\n const availableCredits = Math.max(0, totalCredits - usedCredits);\r\n\r\n return {\r\n totalCredits,\r\n usedCredits,\r\n availableCredits,\r\n nextExpiringCredits,\r\n nextExpirationInDays,\r\n };\r\n}\r\n\r\nexport function useIaCredits() {\r\n const { data: subscriptionData, isPending: isSubscriptionLoading } = useActiveSubscription();\r\n const subscription = subscriptionData?.data?.[0] ?? null;\r\n const subscriptionId = subscription?.id;\r\n\r\n const query = useQuery({\r\n queryKey: ['ia-credits', subscriptionId],\r\n queryFn: withAction(() => listIaCreditsAction(subscriptionId!)),\r\n enabled: subscriptionId != null,\r\n });\r\n\r\n const operations = query.data?.data ?? [];\r\n\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n const summary = useMemo(() => calculateSummary(operations), [operations]);\r\n\r\n return {\r\n subscription,\r\n operations,\r\n summary,\r\n isLoading: isSubscriptionLoading || query.isPending,\r\n isSubscriptionLoading,\r\n isCreditsLoading: query.isPending,\r\n isError: query.isError,\r\n error: query.error,\r\n };\r\n}\r\n"],"mappings":";AAEA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AAEpC,SAAS,6BAA6B;AACtC,SAAS,kBAAkB;AAE3B,SAAS,iBAAiB,YAAmD;AAC3E,QAAM,QAAQ,oBAAI,KAAK;AACvB,QAAM,YAAY,IAAI,KAAK,MAAM,YAAY,GAAG,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC;AAEjF,QAAM,OAAO,WAAW,OAAO,CAAC,OAAO,GAAG,cAAc,KAAK;AAC7D,QAAM,YAAY,WAAW,OAAO,CAAC,OAAO,GAAG,cAAc,UAAU;AAEvE,MAAI,eAAe;AACnB,MAAI,cAAc;AAClB,MAAI,uBAAsC;AAC1C,MAAI,sBAAqC;AAEzC,aAAW,OAAO,MAAM;AACtB,UAAM,gBAAgB,IAAI;AAC1B,QAAI,CAAC,cAAe;AAEpB,UAAM,aAAa,IAAI,KAAK,aAAa;AACzC,UAAM,iBAAiB,IAAI;AAAA,MACzB,WAAW,YAAY;AAAA,MACvB,WAAW,SAAS;AAAA,MACpB,WAAW,QAAQ;AAAA,IACrB;AAEA,UAAM,gBAAgB,eAAe,QAAQ,IAAI,UAAU,QAAQ;AACnE,UAAM,aAAa,IAAI,eAAe;AAEtC,QAAI,WAAY;AAEhB,UAAM,eAAe,IAAI;AAEzB,UAAM,iBAAiB,UACpB,OAAO,CAAC,QAAQ,OAAO,IAAI,oBAAoB,MAAM,OAAO,IAAI,EAAE,CAAC,EACnE,OAAO,CAAC,KAAK,QAAQ,MAAM,IAAI,iBAAiB,CAAC;AAEpD,UAAM,kBAAkB,KAAK,IAAI,GAAG,eAAe,cAAc;AAEjE,oBAAgB;AAChB,mBAAe;AAEf,UAAM,SAAS,eAAe,QAAQ,IAAI,UAAU,QAAQ;AAC5D,UAAM,OAAO,KAAK,IAAI,GAAG,KAAK,KAAK,UAAU,MAAO,KAAK,KAAK,GAAG,CAAC;AAElE,QAAI,kBAAkB,GAAG;AACvB,UAAI,yBAAyB,QAAQ,OAAO,sBAAsB;AAChE,+BAAuB;AACvB,8BAAsB;AAAA,MACxB;AAAA,IACF;AAAA,EACF;AAEA,QAAM,mBAAmB,KAAK,IAAI,GAAG,eAAe,WAAW;AAE/D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,eAAe;AAC7B,QAAM,EAAE,MAAM,kBAAkB,WAAW,sBAAsB,IAAI,sBAAsB;AAC3F,QAAM,eAAe,kBAAkB,OAAO,CAAC,KAAK;AACpD,QAAM,iBAAiB,cAAc;AAErC,QAAM,QAAQ,SAAS;AAAA,IACrB,UAAU,CAAC,cAAc,cAAc;AAAA,IACvC,SAAS,WAAW,MAAM,oBAAoB,cAAe,CAAC;AAAA,IAC9D,SAAS,kBAAkB;AAAA,EAC7B,CAAC;AAED,QAAM,aAAa,MAAM,MAAM,QAAQ,CAAC;AAGxC,QAAM,UAAU,QAAQ,MAAM,iBAAiB,UAAU,GAAG,CAAC,UAAU,CAAC;AAExE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,yBAAyB,MAAM;AAAA,IAC1C;AAAA,IACA,kBAAkB,MAAM;AAAA,IACxB,SAAS,MAAM;AAAA,IACf,OAAO,MAAM;AAAA,EACf;AACF;","names":[]}
@@ -0,0 +1,31 @@
1
+ import "server-only";
2
+ import { api } from "../../../infra/api/client";
3
+ import { ApiError } from "../../../infra/api/types";
4
+ import { getUserContext } from "../../auth/utils/get-user-context";
5
+ import { IaCreditOperationSchema } from "../types";
6
+ class IaCreditsService {
7
+ async listOperations(subscriptionId) {
8
+ const { id_account } = await getUserContext();
9
+ const endpoint = `/accounts/${id_account}/subscriptions/${subscriptionId}/items/balance/list?page=1&limit=20&sort=id:DESC`;
10
+ const response = await api.apps.get(endpoint);
11
+ if (response.status === 0) {
12
+ throw new ApiError(
13
+ response.message || "Erro ao listar cr\xE9ditos de IA",
14
+ "LIST_IA_CREDITS_FAILED",
15
+ 400
16
+ );
17
+ }
18
+ const raw = response.data ?? [];
19
+ const data = raw.map((item) => IaCreditOperationSchema.parse(item));
20
+ return {
21
+ data,
22
+ total: response.total ?? data.length,
23
+ success: true
24
+ };
25
+ }
26
+ }
27
+ const iaCreditsService = new IaCreditsService();
28
+ export {
29
+ iaCreditsService
30
+ };
31
+ //# sourceMappingURL=ia-credits.service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/ia-credits/services/ia-credits.service.ts"],"sourcesContent":["import 'server-only';\r\n\r\nimport { api } from '../../../infra/api/client';\r\nimport { ApiError, ApiPaginatedActionResult, PaginatedSuccessResult } from '../../../infra/api/types';\r\nimport { getUserContext } from '../../auth/utils/get-user-context';\r\nimport { IaCreditOperation, IaCreditOperationSchema } from '../types';\r\n\r\nclass IaCreditsService {\r\n async listOperations(\r\n subscriptionId: number | string\r\n ): Promise<PaginatedSuccessResult<IaCreditOperation>> {\r\n const { id_account } = await getUserContext();\r\n\r\n const endpoint = `/accounts/${id_account}/subscriptions/${subscriptionId}/items/balance/list?page=1&limit=20&sort=id:DESC`;\r\n\r\n const response = await api.apps.get<ApiPaginatedActionResult<IaCreditOperation>>(endpoint);\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(\r\n response.message || 'Erro ao listar créditos de IA',\r\n 'LIST_IA_CREDITS_FAILED',\r\n 400\r\n );\r\n }\r\n\r\n const raw = response.data ?? [];\r\n const data = raw.map((item) => IaCreditOperationSchema.parse(item));\r\n\r\n return {\r\n data,\r\n total: response.total ?? data.length,\r\n success: true,\r\n };\r\n }\r\n}\r\n\r\nexport const iaCreditsService = new IaCreditsService();\r\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,WAAW;AACpB,SAAS,gBAAkE;AAC3E,SAAS,sBAAsB;AAC/B,SAA4B,+BAA+B;AAE3D,MAAM,iBAAiB;AAAA,EACrB,MAAM,eACJ,gBACoD;AACpD,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAE5C,UAAM,WAAW,aAAa,UAAU,kBAAkB,cAAc;AAExE,UAAM,WAAW,MAAM,IAAI,KAAK,IAAiD,QAAQ;AAEzF,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,UAAM,MAAM,SAAS,QAAQ,CAAC;AAC9B,UAAM,OAAO,IAAI,IAAI,CAAC,SAAS,wBAAwB,MAAM,IAAI,CAAC;AAElE,WAAO;AAAA,MACL;AAAA,MACA,OAAO,SAAS,SAAS,KAAK;AAAA,MAC9B,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAEO,MAAM,mBAAmB,IAAI,iBAAiB;","names":[]}
@@ -0,0 +1,25 @@
1
+ import z from "zod";
2
+ const IaCreditOperationSchema = z.object({
3
+ id: z.union([z.number(), z.string()]),
4
+ deleted: z.number(),
5
+ datetime_add: z.coerce.date().nullable(),
6
+ id_wl: z.number(),
7
+ id_subscription: z.union([z.number(), z.string()]),
8
+ id_addon: z.number(),
9
+ operation: z.string(),
10
+ // 'add' | 'subtract'
11
+ operation_value: z.union([z.number(), z.string()]).transform((v) => Number(v)),
12
+ balance_after_operation: z.union([z.number(), z.string()]).optional(),
13
+ balance_before_operation: z.union([z.number(), z.string()]).optional(),
14
+ operation_ref: z.string().nullable().optional(),
15
+ operation_origin: z.string().nullable().optional(),
16
+ expiration_time: z.string().nullable(),
17
+ has_expired: z.boolean(),
18
+ consumed_from_add_id: z.union([z.number(), z.string()]).nullable(),
19
+ id_user_add: z.union([z.number(), z.string()]).nullable(),
20
+ user_name: z.string().nullable().optional()
21
+ }).passthrough();
22
+ export {
23
+ IaCreditOperationSchema
24
+ };
25
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/modules/ia-credits/types.ts"],"sourcesContent":["import z from 'zod';\r\n\r\nexport const IaCreditOperationSchema = z\r\n .object({\r\n id: z.union([z.number(), z.string()]),\r\n deleted: z.number(),\r\n datetime_add: z.coerce.date().nullable(),\r\n id_wl: z.number(),\r\n id_subscription: z.union([z.number(), z.string()]),\r\n id_addon: z.number(),\r\n operation: z.string(), // 'add' | 'subtract'\r\n operation_value: z.union([z.number(), z.string()]).transform((v) => Number(v)),\r\n balance_after_operation: z.union([z.number(), z.string()]).optional(),\r\n balance_before_operation: z.union([z.number(), z.string()]).optional(),\r\n operation_ref: z.string().nullable().optional(),\r\n operation_origin: z.string().nullable().optional(),\r\n expiration_time: z.string().nullable(),\r\n has_expired: z.boolean(),\r\n consumed_from_add_id: z.union([z.number(), z.string()]).nullable(),\r\n id_user_add: z.union([z.number(), z.string()]).nullable(),\r\n user_name: z.string().nullable().optional(),\r\n })\r\n .passthrough();\r\n\r\nexport type IaCreditOperation = z.infer<typeof IaCreditOperationSchema>;\r\n\r\nexport type IaCreditsSummary = {\r\n totalCredits: number;\r\n usedCredits: number;\r\n availableCredits: number;\r\n nextExpiringCredits: number | null;\r\n nextExpirationInDays: number | null;\r\n};\r\n"],"mappings":"AAAA,OAAO,OAAO;AAEP,MAAM,0BAA0B,EACpC,OAAO;AAAA,EACN,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;AAAA,EACpC,SAAS,EAAE,OAAO;AAAA,EAClB,cAAc,EAAE,OAAO,KAAK,EAAE,SAAS;AAAA,EACvC,OAAO,EAAE,OAAO;AAAA,EAChB,iBAAiB,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;AAAA,EACjD,UAAU,EAAE,OAAO;AAAA,EACnB,WAAW,EAAE,OAAO;AAAA;AAAA,EACpB,iBAAiB,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,OAAO,CAAC,CAAC;AAAA,EAC7E,yBAAyB,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS;AAAA,EACpE,0BAA0B,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS;AAAA,EACrE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,kBAAkB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACjD,iBAAiB,EAAE,OAAO,EAAE,SAAS;AAAA,EACrC,aAAa,EAAE,QAAQ;AAAA,EACvB,sBAAsB,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS;AAAA,EACjE,aAAa,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS;AAAA,EACxD,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAC5C,CAAC,EACA,YAAY;","names":[]}
@@ -0,0 +1,10 @@
1
+ "use server";
2
+ import { safeServerAction } from "../../../utils/safeServerAction";
3
+ import { projectUsersService } from "../services/project-users.service";
4
+ async function addProjectUserAction(params) {
5
+ return safeServerAction(() => projectUsersService.addToProject(params));
6
+ }
7
+ export {
8
+ addProjectUserAction
9
+ };
10
+ //# sourceMappingURL=add-project-user.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/projects/actions/add-project-user.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { projectUsersService } from '../services/project-users.service';\nimport type { AddRemoveProjectUsersParams } from '../types';\n\nexport async function addProjectUserAction(params: AddRemoveProjectUsersParams) {\n return safeServerAction(() => projectUsersService.addToProject(params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AAGpC,eAAsB,qBAAqB,QAAqC;AAC9E,SAAO,iBAAiB,MAAM,oBAAoB,aAAa,MAAM,CAAC;AACxE;","names":[]}
@@ -0,0 +1,10 @@
1
+ "use server";
2
+ import { safeServerAction } from "../../../utils/safeServerAction";
3
+ import { projectUsersService } from "../services/project-users.service";
4
+ async function listAvailableUsersAction(projectId, params = {}) {
5
+ return safeServerAction(() => projectUsersService.listNotInProject(projectId, params));
6
+ }
7
+ export {
8
+ listAvailableUsersAction
9
+ };
10
+ //# sourceMappingURL=list-available-users.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/projects/actions/list-available-users.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { projectUsersService } from '../services/project-users.service';\nimport type { ListUsersParams } from '../types';\n\nexport async function listAvailableUsersAction(projectId: number, params: ListUsersParams = {}) {\n return safeServerAction(() => projectUsersService.listNotInProject(projectId, params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AAGpC,eAAsB,yBAAyB,WAAmB,SAA0B,CAAC,GAAG;AAC9F,SAAO,iBAAiB,MAAM,oBAAoB,iBAAiB,WAAW,MAAM,CAAC;AACvF;","names":[]}
@@ -0,0 +1,10 @@
1
+ "use server";
2
+ import { safeServerAction } from "../../../utils/safeServerAction";
3
+ import { projectUsersService } from "../services/project-users.service";
4
+ async function listProjectUsersAction(projectId, params = {}) {
5
+ return safeServerAction(() => projectUsersService.listInProject(projectId, params));
6
+ }
7
+ export {
8
+ listProjectUsersAction
9
+ };
10
+ //# sourceMappingURL=list-project-users.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/projects/actions/list-project-users.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { projectUsersService } from '../services/project-users.service';\nimport type { ListUsersParams } from '../types';\n\nexport async function listProjectUsersAction(projectId: number, params: ListUsersParams = {}) {\n return safeServerAction(() => projectUsersService.listInProject(projectId, params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AAGpC,eAAsB,uBAAuB,WAAmB,SAA0B,CAAC,GAAG;AAC5F,SAAO,iBAAiB,MAAM,oBAAoB,cAAc,WAAW,MAAM,CAAC;AACpF;","names":[]}
@@ -0,0 +1,10 @@
1
+ "use server";
2
+ import { safeServerAction } from "../../../utils/safeServerAction";
3
+ import { projectUsersService } from "../services/project-users.service";
4
+ async function removeProjectUserAction(params) {
5
+ return safeServerAction(() => projectUsersService.removeFromProject(params));
6
+ }
7
+ export {
8
+ removeProjectUserAction
9
+ };
10
+ //# sourceMappingURL=remove-project-user.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/projects/actions/remove-project-user.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { projectUsersService } from '../services/project-users.service';\nimport type { AddRemoveProjectUsersParams } from '../types';\n\nexport async function removeProjectUserAction(params: AddRemoveProjectUsersParams) {\n return safeServerAction(() => projectUsersService.removeFromProject(params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AAGpC,eAAsB,wBAAwB,QAAqC;AACjF,SAAO,iBAAiB,MAAM,oBAAoB,kBAAkB,MAAM,CAAC;AAC7E;","names":[]}
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { useInfiniteQuery } from "@tanstack/react-query";
3
+ import { listAvailableUsersAction } from "../actions/list-available-users.action";
4
+ import { withAction } from "../../../utils/withAction";
5
+ const PAGE_SIZE = 20;
6
+ const LIST_AVAILABLE_USERS_BASE_KEY = (projectId) => ["project-users", projectId, "out"];
7
+ const LIST_AVAILABLE_USERS_QUERY_KEY = (projectId, search = "") => [
8
+ ...LIST_AVAILABLE_USERS_BASE_KEY(projectId),
9
+ search
10
+ ];
11
+ function useListAvailableUsers(projectId, search = "") {
12
+ return useInfiniteQuery({
13
+ queryKey: LIST_AVAILABLE_USERS_QUERY_KEY(projectId, search),
14
+ queryFn: ({ pageParam }) => withAction(
15
+ () => listAvailableUsersAction(projectId, {
16
+ search: search || void 0,
17
+ page: pageParam,
18
+ limit: PAGE_SIZE
19
+ })
20
+ )(),
21
+ getNextPageParam: (lastPage, allPages) => {
22
+ const loaded = allPages.reduce((sum, p) => sum + p.data.length, 0);
23
+ return loaded < lastPage.total ? allPages.length + 1 : void 0;
24
+ },
25
+ initialPageParam: 1,
26
+ enabled: !!projectId
27
+ });
28
+ }
29
+ export {
30
+ LIST_AVAILABLE_USERS_BASE_KEY,
31
+ LIST_AVAILABLE_USERS_QUERY_KEY,
32
+ useListAvailableUsers
33
+ };
34
+ //# sourceMappingURL=list-available-users.hook.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/projects/hooks/list-available-users.hook.ts"],"sourcesContent":["'use client';\n\nimport { useInfiniteQuery } from '@tanstack/react-query';\nimport { listAvailableUsersAction } from '../actions/list-available-users.action';\nimport { withAction } from '../../../utils/withAction';\n\nconst PAGE_SIZE = 20;\n\nexport const LIST_AVAILABLE_USERS_BASE_KEY = (projectId: number) => ['project-users', projectId, 'out'];\nexport const LIST_AVAILABLE_USERS_QUERY_KEY = (projectId: number, search: string = '') => [\n ...LIST_AVAILABLE_USERS_BASE_KEY(projectId),\n search,\n];\n\nexport function useListAvailableUsers(projectId: number, search: string = '') {\n return useInfiniteQuery({\n queryKey: LIST_AVAILABLE_USERS_QUERY_KEY(projectId, search),\n queryFn: ({ pageParam }) =>\n withAction(() =>\n listAvailableUsersAction(projectId, {\n search: search || undefined,\n page: pageParam as number,\n limit: PAGE_SIZE,\n })\n )(),\n getNextPageParam: (lastPage, allPages) => {\n const loaded = allPages.reduce((sum, p) => sum + p.data.length, 0);\n return loaded < lastPage.total ? allPages.length + 1 : undefined;\n },\n initialPageParam: 1,\n enabled: !!projectId,\n });\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,kBAAkB;AAE3B,MAAM,YAAY;AAEX,MAAM,gCAAgC,CAAC,cAAsB,CAAC,iBAAiB,WAAW,KAAK;AAC/F,MAAM,iCAAiC,CAAC,WAAmB,SAAiB,OAAO;AAAA,EACxF,GAAG,8BAA8B,SAAS;AAAA,EAC1C;AACF;AAEO,SAAS,sBAAsB,WAAmB,SAAiB,IAAI;AAC5E,SAAO,iBAAiB;AAAA,IACtB,UAAU,+BAA+B,WAAW,MAAM;AAAA,IAC1D,SAAS,CAAC,EAAE,UAAU,MACpB;AAAA,MAAW,MACT,yBAAyB,WAAW;AAAA,QAClC,QAAQ,UAAU;AAAA,QAClB,MAAM;AAAA,QACN,OAAO;AAAA,MACT,CAAC;AAAA,IACH,EAAE;AAAA,IACJ,kBAAkB,CAAC,UAAU,aAAa;AACxC,YAAM,SAAS,SAAS,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,KAAK,QAAQ,CAAC;AACjE,aAAO,SAAS,SAAS,QAAQ,SAAS,SAAS,IAAI;AAAA,IACzD;AAAA,IACA,kBAAkB;AAAA,IAClB,SAAS,CAAC,CAAC;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { useInfiniteQuery } from "@tanstack/react-query";
3
+ import { listProjectUsersAction } from "../actions/list-project-users.action";
4
+ import { withAction } from "../../../utils/withAction";
5
+ const PAGE_SIZE = 20;
6
+ const LIST_PROJECT_USERS_BASE_KEY = (projectId) => ["project-users", projectId, "in"];
7
+ const LIST_PROJECT_USERS_QUERY_KEY = (projectId, search = "") => [
8
+ ...LIST_PROJECT_USERS_BASE_KEY(projectId),
9
+ search
10
+ ];
11
+ function useListProjectUsers(projectId, search = "") {
12
+ return useInfiniteQuery({
13
+ queryKey: LIST_PROJECT_USERS_QUERY_KEY(projectId, search),
14
+ queryFn: ({ pageParam }) => withAction(
15
+ () => listProjectUsersAction(projectId, {
16
+ search: search || void 0,
17
+ page: pageParam,
18
+ limit: PAGE_SIZE
19
+ })
20
+ )(),
21
+ getNextPageParam: (lastPage, allPages) => {
22
+ const loaded = allPages.reduce((sum, p) => sum + p.data.length, 0);
23
+ return loaded < lastPage.total ? allPages.length + 1 : void 0;
24
+ },
25
+ initialPageParam: 1,
26
+ enabled: !!projectId
27
+ });
28
+ }
29
+ export {
30
+ LIST_PROJECT_USERS_BASE_KEY,
31
+ LIST_PROJECT_USERS_QUERY_KEY,
32
+ useListProjectUsers
33
+ };
34
+ //# sourceMappingURL=list-project-users.hook.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/projects/hooks/list-project-users.hook.ts"],"sourcesContent":["'use client';\n\nimport { useInfiniteQuery } from '@tanstack/react-query';\nimport { listProjectUsersAction } from '../actions/list-project-users.action';\nimport { withAction } from '../../../utils/withAction';\n\nconst PAGE_SIZE = 20;\n\nexport const LIST_PROJECT_USERS_BASE_KEY = (projectId: number) => ['project-users', projectId, 'in'];\nexport const LIST_PROJECT_USERS_QUERY_KEY = (projectId: number, search: string = '') => [\n ...LIST_PROJECT_USERS_BASE_KEY(projectId),\n search,\n];\n\nexport function useListProjectUsers(projectId: number, search: string = '') {\n return useInfiniteQuery({\n queryKey: LIST_PROJECT_USERS_QUERY_KEY(projectId, search),\n queryFn: ({ pageParam }) =>\n withAction(() =>\n listProjectUsersAction(projectId, {\n search: search || undefined,\n page: pageParam as number,\n limit: PAGE_SIZE,\n })\n )(),\n getNextPageParam: (lastPage, allPages) => {\n const loaded = allPages.reduce((sum, p) => sum + p.data.length, 0);\n return loaded < lastPage.total ? allPages.length + 1 : undefined;\n },\n initialPageParam: 1,\n enabled: !!projectId,\n });\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAE3B,MAAM,YAAY;AAEX,MAAM,8BAA8B,CAAC,cAAsB,CAAC,iBAAiB,WAAW,IAAI;AAC5F,MAAM,+BAA+B,CAAC,WAAmB,SAAiB,OAAO;AAAA,EACtF,GAAG,4BAA4B,SAAS;AAAA,EACxC;AACF;AAEO,SAAS,oBAAoB,WAAmB,SAAiB,IAAI;AAC1E,SAAO,iBAAiB;AAAA,IACtB,UAAU,6BAA6B,WAAW,MAAM;AAAA,IACxD,SAAS,CAAC,EAAE,UAAU,MACpB;AAAA,MAAW,MACT,uBAAuB,WAAW;AAAA,QAChC,QAAQ,UAAU;AAAA,QAClB,MAAM;AAAA,QACN,OAAO;AAAA,MACT,CAAC;AAAA,IACH,EAAE;AAAA,IACJ,kBAAkB,CAAC,UAAU,aAAa;AACxC,YAAM,SAAS,SAAS,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,KAAK,QAAQ,CAAC;AACjE,aAAO,SAAS,SAAS,QAAQ,SAAS,SAAS,IAAI;AAAA,IACzD;AAAA,IACA,kBAAkB;AAAA,IAClB,SAAS,CAAC,CAAC;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -0,0 +1,78 @@
1
+ import "server-only";
2
+ import { api } from "../../../infra/api/client";
3
+ import { ApiError } from "../../../infra/api/types";
4
+ import { buildQueryParams } from "../../../infra/utils/params";
5
+ import { getUserContext } from "../../auth/utils/get-user-context";
6
+ import {
7
+ AccountUserSchema,
8
+ ProjectUserSchema
9
+ } from "../types";
10
+ class ProjectUsersService {
11
+ async listInProject(projectId, params = {}) {
12
+ const { id_account, id_user } = await getUserContext();
13
+ const query = buildQueryParams(params);
14
+ const url = `/account/${id_account}/user/${id_user}/projects/${projectId}/users${query ? `?${query}` : ""}`;
15
+ const response = await api.apps.get(url);
16
+ if (response.status === 0) {
17
+ throw new ApiError(
18
+ response.message || "Erro ao listar usu\xE1rios do projeto",
19
+ "LIST_PROJECT_USERS_FAILED",
20
+ 400
21
+ );
22
+ }
23
+ return {
24
+ data: response.data.map((item) => ProjectUserSchema.parse(item)),
25
+ total: response.total,
26
+ page: params.page ?? 1
27
+ };
28
+ }
29
+ async listNotInProject(projectId, params = {}) {
30
+ const { id_account } = await getUserContext();
31
+ const query = buildQueryParams({ notInProject: projectId, ...params });
32
+ const url = `/accounts/${id_account}/users${query ? `?${query}` : ""}`;
33
+ const response = await api.apps.get(url);
34
+ if (response.status === 0) {
35
+ throw new ApiError(
36
+ response.message || "Erro ao listar usu\xE1rios dispon\xEDveis",
37
+ "LIST_AVAILABLE_USERS_FAILED",
38
+ 400
39
+ );
40
+ }
41
+ return {
42
+ data: response.data.map((item) => AccountUserSchema.parse(item)),
43
+ total: response.total,
44
+ page: params.page ?? 1
45
+ };
46
+ }
47
+ async addToProject({ projectId, users }) {
48
+ const { id_account, id_user } = await getUserContext();
49
+ const url = `/account/${id_account}/user/${id_user}/projects/${projectId}/users`;
50
+ const response = await api.apps.post(url, { users });
51
+ if (response.status === 0) {
52
+ throw new ApiError(
53
+ response.message || "Erro ao adicionar usu\xE1rio ao projeto",
54
+ "ADD_PROJECT_USER_FAILED",
55
+ 400
56
+ );
57
+ }
58
+ }
59
+ async removeFromProject({ projectId, users }) {
60
+ const { id_account, id_user } = await getUserContext();
61
+ const url = `/account/${id_account}/user/${id_user}/projects/${projectId}/users`;
62
+ const response = await api.apps.delete(url, {
63
+ body: JSON.stringify({ users })
64
+ });
65
+ if (response.status === 0) {
66
+ throw new ApiError(
67
+ response.message || "Erro ao remover usu\xE1rio do projeto",
68
+ "REMOVE_PROJECT_USER_FAILED",
69
+ 400
70
+ );
71
+ }
72
+ }
73
+ }
74
+ const projectUsersService = new ProjectUsersService();
75
+ export {
76
+ projectUsersService
77
+ };
78
+ //# sourceMappingURL=project-users.service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/projects/services/project-users.service.ts"],"sourcesContent":["import 'server-only';\r\n\r\nimport { api } from '../../../infra/api/client';\r\nimport { ApiError } from '../../../infra/api/types';\r\nimport { buildQueryParams } from '../../../infra/utils/params';\r\nimport { getUserContext } from '../../auth/utils/get-user-context';\r\nimport {\r\n AccountUser,\r\n AccountUserSchema,\r\n AddRemoveProjectUsersParams,\r\n ListUsersParams,\r\n ProjectUser,\r\n ProjectUserSchema,\r\n UsersPage,\r\n} from '../types';\r\n\r\ninterface ApiListResponse<T> {\r\n data: T[];\r\n total: number;\r\n status: number;\r\n message?: string;\r\n}\r\n\r\ninterface ApiActionResponse {\r\n status: number;\r\n message?: string;\r\n}\r\n\r\nclass ProjectUsersService {\r\n async listInProject(projectId: number, params: ListUsersParams = {}): Promise<UsersPage<ProjectUser>> {\r\n const { id_account, id_user } = await getUserContext();\r\n const query = buildQueryParams(params as Record<string, string | number | boolean | undefined>);\r\n const url = `/account/${id_account}/user/${id_user}/projects/${projectId}/users${query ? `?${query}` : ''}`;\r\n\r\n const response = await api.apps.get<ApiListResponse<ProjectUser>>(url);\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(\r\n response.message || 'Erro ao listar usuários do projeto',\r\n 'LIST_PROJECT_USERS_FAILED',\r\n 400\r\n );\r\n }\r\n\r\n return {\r\n data: response.data.map((item) => ProjectUserSchema.parse(item)),\r\n total: response.total,\r\n page: params.page ?? 1,\r\n };\r\n }\r\n\r\n async listNotInProject(projectId: number, params: ListUsersParams = {}): Promise<UsersPage<AccountUser>> {\r\n const { id_account } = await getUserContext();\r\n const query = buildQueryParams({ notInProject: projectId, ...params } as Record<string, string | number | boolean | undefined>);\r\n const url = `/accounts/${id_account}/users${query ? `?${query}` : ''}`;\r\n\r\n const response = await api.apps.get<ApiListResponse<AccountUser>>(url);\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(\r\n response.message || 'Erro ao listar usuários disponíveis',\r\n 'LIST_AVAILABLE_USERS_FAILED',\r\n 400\r\n );\r\n }\r\n\r\n return {\r\n data: response.data.map((item) => AccountUserSchema.parse(item)),\r\n total: response.total,\r\n page: params.page ?? 1,\r\n };\r\n }\r\n\r\n async addToProject({ projectId, users }: AddRemoveProjectUsersParams): Promise<void> {\r\n const { id_account, id_user } = await getUserContext();\r\n const url = `/account/${id_account}/user/${id_user}/projects/${projectId}/users`;\r\n\r\n const response = await api.apps.post<ApiActionResponse>(url, { users });\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(\r\n response.message || 'Erro ao adicionar usuário ao projeto',\r\n 'ADD_PROJECT_USER_FAILED',\r\n 400\r\n );\r\n }\r\n }\r\n\r\n async removeFromProject({ projectId, users }: AddRemoveProjectUsersParams): Promise<void> {\r\n const { id_account, id_user } = await getUserContext();\r\n const url = `/account/${id_account}/user/${id_user}/projects/${projectId}/users`;\r\n\r\n const response = await api.apps.delete<ApiActionResponse>(url, {\r\n body: JSON.stringify({ users }),\r\n });\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(\r\n response.message || 'Erro ao remover usuário do projeto',\r\n 'REMOVE_PROJECT_USER_FAILED',\r\n 400\r\n );\r\n }\r\n }\r\n}\r\n\r\nexport const projectUsersService = new ProjectUsersService();\r\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B;AAAA,EAEE;AAAA,EAIA;AAAA,OAEK;AAcP,MAAM,oBAAoB;AAAA,EACxB,MAAM,cAAc,WAAmB,SAA0B,CAAC,GAAoC;AACpG,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AACrD,UAAM,QAAQ,iBAAiB,MAA+D;AAC9F,UAAM,MAAM,YAAY,UAAU,SAAS,OAAO,aAAa,SAAS,SAAS,QAAQ,IAAI,KAAK,KAAK,EAAE;AAEzG,UAAM,WAAW,MAAM,IAAI,KAAK,IAAkC,GAAG;AAErE,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,MACL,MAAM,SAAS,KAAK,IAAI,CAAC,SAAS,kBAAkB,MAAM,IAAI,CAAC;AAAA,MAC/D,OAAO,SAAS;AAAA,MAChB,MAAM,OAAO,QAAQ;AAAA,IACvB;AAAA,EACF;AAAA,EAEA,MAAM,iBAAiB,WAAmB,SAA0B,CAAC,GAAoC;AACvG,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAC5C,UAAM,QAAQ,iBAAiB,EAAE,cAAc,WAAW,GAAG,OAAO,CAA0D;AAC9H,UAAM,MAAM,aAAa,UAAU,SAAS,QAAQ,IAAI,KAAK,KAAK,EAAE;AAEpE,UAAM,WAAW,MAAM,IAAI,KAAK,IAAkC,GAAG;AAErE,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,MACL,MAAM,SAAS,KAAK,IAAI,CAAC,SAAS,kBAAkB,MAAM,IAAI,CAAC;AAAA,MAC/D,OAAO,SAAS;AAAA,MAChB,MAAM,OAAO,QAAQ;AAAA,IACvB;AAAA,EACF;AAAA,EAEA,MAAM,aAAa,EAAE,WAAW,MAAM,GAA+C;AACnF,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AACrD,UAAM,MAAM,YAAY,UAAU,SAAS,OAAO,aAAa,SAAS;AAExE,UAAM,WAAW,MAAM,IAAI,KAAK,KAAwB,KAAK,EAAE,MAAM,CAAC;AAEtE,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,kBAAkB,EAAE,WAAW,MAAM,GAA+C;AACxF,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AACrD,UAAM,MAAM,YAAY,UAAU,SAAS,OAAO,aAAa,SAAS;AAExE,UAAM,WAAW,MAAM,IAAI,KAAK,OAA0B,KAAK;AAAA,MAC7D,MAAM,KAAK,UAAU,EAAE,MAAM,CAAC;AAAA,IAChC,CAAC;AAED,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,sBAAsB,IAAI,oBAAoB;","names":[]}
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ const ProjectUserSchema = z.object({
3
+ id_user: z.union([z.number(), z.string()]).transform(Number),
4
+ id_account: z.union([z.number(), z.string()]).transform(Number),
5
+ id_project: z.union([z.number(), z.string()]).transform(Number),
6
+ name: z.string().nullable(),
7
+ email: z.string().nullable(),
8
+ profile: z.string().nullable().optional().default("viewer"),
9
+ photo: z.string().nullable().optional()
10
+ });
11
+ const AccountUserSchema = z.object({
12
+ id: z.union([z.number(), z.string()]).transform(Number),
13
+ name: z.string().nullable(),
14
+ email: z.string().nullable(),
15
+ profile: z.string().nullable().optional().default("viewer"),
16
+ photo: z.string().nullable().optional()
17
+ });
18
+ export {
19
+ AccountUserSchema,
20
+ ProjectUserSchema
21
+ };
22
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/modules/projects/types.ts"],"sourcesContent":["import { z } from \"zod\";\r\n\r\nexport const ProjectUserSchema = z.object({\r\n id_user: z.union([z.number(), z.string()]).transform(Number),\r\n id_account: z.union([z.number(), z.string()]).transform(Number),\r\n id_project: z.union([z.number(), z.string()]).transform(Number),\r\n name: z.string().nullable(),\r\n email: z.string().nullable(),\r\n profile: z.string().nullable().optional().default(\"viewer\"),\r\n photo: z.string().nullable().optional(),\r\n});\r\n\r\nexport type ProjectUser = z.infer<typeof ProjectUserSchema>;\r\n\r\nexport const AccountUserSchema = z.object({\r\n id: z.union([z.number(), z.string()]).transform(Number),\r\n name: z.string().nullable(),\r\n email: z.string().nullable(),\r\n profile: z.string().nullable().optional().default(\"viewer\"),\r\n photo: z.string().nullable().optional(),\r\n});\r\n\r\nexport type AccountUser = z.infer<typeof AccountUserSchema>;\r\n\r\nexport interface AddRemoveProjectUsersParams {\r\n projectId: number;\r\n users: number[];\r\n}\r\n\r\nexport interface ListUsersParams {\r\n search?: string;\r\n page?: number;\r\n limit?: number;\r\n}\r\n\r\nexport interface UsersPage<T> {\r\n data: T[];\r\n total: number;\r\n page: number;\r\n}\r\n"],"mappings":"AAAA,SAAS,SAAS;AAEX,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,MAAM;AAAA,EAC3D,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,MAAM;AAAA,EAC9D,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,MAAM;AAAA,EAC9D,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,QAAQ;AAAA,EAC1D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AACxC,CAAC;AAIM,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,MAAM;AAAA,EACtD,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,QAAQ;AAAA,EAC1D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AACxC,CAAC;","names":[]}
@@ -0,0 +1,10 @@
1
+ "use server";
2
+ import { safeServerAction } from "../../../utils/safeServerAction";
3
+ import { subscriptionsService } from "../services/subscriptions.service";
4
+ async function listSubscriptionsAction(params) {
5
+ return safeServerAction(() => subscriptionsService.listSubscriptions(params));
6
+ }
7
+ export {
8
+ listSubscriptionsAction
9
+ };
10
+ //# sourceMappingURL=list-subscriptions.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/subscriptions/actions/list-subscriptions.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport type { FindSubscriptionsParams } from '../types';\nimport { subscriptionsService } from '../services/subscriptions.service';\n\nexport async function listSubscriptionsAction(params?: Partial<FindSubscriptionsParams>) {\n return safeServerAction(() => subscriptionsService.listSubscriptions(params));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,4BAA4B;AAErC,eAAsB,wBAAwB,QAA2C;AACvF,SAAO,iBAAiB,MAAM,qBAAqB,kBAAkB,MAAM,CAAC;AAC9E;","names":[]}
@@ -0,0 +1,12 @@
1
+ const ADDON_IDS = {
2
+ DOMAINS: 1,
3
+ PAGES: 2,
4
+ PROJECTS: 3,
5
+ AB_TEST: 4,
6
+ HEATMAP: 5,
7
+ AI: 6
8
+ };
9
+ export {
10
+ ADDON_IDS
11
+ };
12
+ //# sourceMappingURL=addons.constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/subscriptions/constants/addons.constants.ts"],"sourcesContent":["export const ADDON_IDS = {\r\n DOMAINS: 1,\r\n PAGES: 2,\r\n PROJECTS: 3,\r\n AB_TEST: 4,\r\n HEATMAP: 5,\r\n AI: 6,\r\n} as const;\r\n\r\nexport type AddonKindEnum = (typeof ADDON_IDS)[keyof typeof ADDON_IDS];\r\n"],"mappings":"AAAO,MAAM,YAAY;AAAA,EACvB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAS;AAAA,EACT,IAAI;AACN;","names":[]}
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { listSubscriptionsAction } from "../actions/list-subscriptions.action";
4
+ import { parseResult } from "../../../infra/utils/parser";
5
+ import { SubscriptionSchema } from "../types";
6
+ import { SUBSCRIPTIONS_QUERY_KEY } from "./list-subscriptions.hook";
7
+ import { withAction } from "../../../utils/withAction";
8
+ function useActiveSubscription() {
9
+ return useQuery({
10
+ queryKey: [...SUBSCRIPTIONS_QUERY_KEY, "active"],
11
+ queryFn: async () => parseResult(
12
+ SubscriptionSchema,
13
+ await withAction(() => listSubscriptionsAction({ active: true }))()
14
+ )
15
+ });
16
+ }
17
+ export {
18
+ useActiveSubscription
19
+ };
20
+ //# sourceMappingURL=find-active-subscription.hook.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/subscriptions/hooks/find-active-subscription.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listSubscriptionsAction } from '../actions/list-subscriptions.action';\nimport { parseResult } from '../../../infra/utils/parser';\nimport { SubscriptionSchema } from '../types';\nimport { SUBSCRIPTIONS_QUERY_KEY } from './list-subscriptions.hook';\nimport { withAction } from '../../../utils/withAction';\n\nexport function useActiveSubscription() {\n return useQuery({\n queryKey: [...SUBSCRIPTIONS_QUERY_KEY, 'active'],\n queryFn: async () =>\n parseResult(\n SubscriptionSchema,\n await withAction(() => listSubscriptionsAction({ active: true }))()\n ),\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,kBAAkB;AAEpB,SAAS,wBAAwB;AACtC,SAAO,SAAS;AAAA,IACd,UAAU,CAAC,GAAG,yBAAyB,QAAQ;AAAA,IAC/C,SAAS,YACP;AAAA,MACE;AAAA,MACA,MAAM,WAAW,MAAM,wBAAwB,EAAE,QAAQ,KAAK,CAAC,CAAC,EAAE;AAAA,IACpE;AAAA,EACJ,CAAC;AACH;","names":[]}
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { listSubscriptionsAction } from "../actions/list-subscriptions.action";
4
+ import { parseResult } from "../../../infra/utils/parser";
5
+ import { SubscriptionSchema } from "../types";
6
+ import { withAction } from "../../../utils/withAction";
7
+ const SUBSCRIPTIONS_QUERY_KEY = ["subscriptions"];
8
+ function useSubscriptions(params) {
9
+ return useQuery({
10
+ queryKey: [...SUBSCRIPTIONS_QUERY_KEY, params],
11
+ queryFn: async () => parseResult(SubscriptionSchema, await withAction(() => listSubscriptionsAction(params))())
12
+ });
13
+ }
14
+ export {
15
+ SUBSCRIPTIONS_QUERY_KEY,
16
+ useSubscriptions
17
+ };
18
+ //# sourceMappingURL=list-subscriptions.hook.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/subscriptions/hooks/list-subscriptions.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listSubscriptionsAction } from '../actions/list-subscriptions.action';\nimport { parseResult } from '../../../infra/utils/parser';\nimport { SubscriptionSchema, type FindSubscriptionsParams } from '../types';\nimport { withAction } from '../../../utils/withAction';\n\nexport const SUBSCRIPTIONS_QUERY_KEY = ['subscriptions'];\n\nexport function useSubscriptions(params?: Partial<FindSubscriptionsParams>) {\n return useQuery({\n queryKey: [...SUBSCRIPTIONS_QUERY_KEY, params],\n queryFn: async () =>\n parseResult(SubscriptionSchema, await withAction(() => listSubscriptionsAction(params))()),\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,mBAAmB;AAC5B,SAAS,0BAAwD;AACjE,SAAS,kBAAkB;AAEpB,MAAM,0BAA0B,CAAC,eAAe;AAEhD,SAAS,iBAAiB,QAA2C;AAC1E,SAAO,SAAS;AAAA,IACd,UAAU,CAAC,GAAG,yBAAyB,MAAM;AAAA,IAC7C,SAAS,YACP,YAAY,oBAAoB,MAAM,WAAW,MAAM,wBAAwB,MAAM,CAAC,EAAE,CAAC;AAAA,EAC7F,CAAC;AACH;","names":[]}
@@ -0,0 +1,32 @@
1
+ import "server-only";
2
+ import { api } from "../../../infra/api/client";
3
+ import { ApiError } from "../../../infra/api/types";
4
+ import { buildQueryParams } from "../../../infra/utils/params";
5
+ import { getUserContext } from "../../auth/utils/get-user-context";
6
+ import { SubscriptionSchema } from "../types";
7
+ class SubscriptionsService {
8
+ async listSubscriptions(params) {
9
+ const { id_account } = await getUserContext();
10
+ const query = buildQueryParams(params);
11
+ const url = `/accounts/${id_account}/subscriptions${query ? `?${query}` : ""}`;
12
+ const response = await api.apps.get(url);
13
+ if (response.status === 0) {
14
+ throw new ApiError(
15
+ response.message || "Erro ao listar assinaturas",
16
+ "LIST_SUBSCRIPTIONS_FAILED",
17
+ 400
18
+ );
19
+ }
20
+ const data = response.data.map((item) => SubscriptionSchema.parse(item));
21
+ return {
22
+ data,
23
+ total: response.total,
24
+ success: true
25
+ };
26
+ }
27
+ }
28
+ const subscriptionsService = new SubscriptionsService();
29
+ export {
30
+ subscriptionsService
31
+ };
32
+ //# sourceMappingURL=subscriptions.service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/subscriptions/services/subscriptions.service.ts"],"sourcesContent":["import 'server-only';\r\n\r\nimport { api } from '../../../infra/api/client';\r\nimport { ApiError, ApiPaginatedActionResult, PaginatedSuccessResult } from '../../../infra/api/types';\r\nimport { buildQueryParams } from '../../../infra/utils/params';\r\nimport { getUserContext } from '../../auth/utils/get-user-context';\r\nimport { Subscription, SubscriptionSchema, FindSubscriptionsParams } from '../types';\r\n\r\nclass SubscriptionsService {\r\n async listSubscriptions(\r\n params?: Partial<FindSubscriptionsParams>\r\n ): Promise<PaginatedSuccessResult<Subscription>> {\r\n const { id_account } = await getUserContext();\r\n\r\n const query = buildQueryParams(params as Record<string, string | boolean | undefined>);\r\n const url = `/accounts/${id_account}/subscriptions${query ? `?${query}` : ''}`;\r\n\r\n const response = await api.apps.get<ApiPaginatedActionResult<Subscription>>(url);\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(\r\n response.message || 'Erro ao listar assinaturas',\r\n 'LIST_SUBSCRIPTIONS_FAILED',\r\n 400\r\n );\r\n }\r\n\r\n const data = response.data.map((item) => SubscriptionSchema.parse(item));\r\n\r\n return {\r\n data,\r\n total: response.total,\r\n success: true,\r\n } satisfies PaginatedSuccessResult<Subscription>;\r\n }\r\n}\r\n\r\nexport const subscriptionsService = new SubscriptionsService();\r\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,WAAW;AACpB,SAAS,gBAAkE;AAC3E,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAuB,0BAAmD;AAE1E,MAAM,qBAAqB;AAAA,EACzB,MAAM,kBACJ,QAC+C;AAC/C,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAE5C,UAAM,QAAQ,iBAAiB,MAAsD;AACrF,UAAM,MAAM,aAAa,UAAU,iBAAiB,QAAQ,IAAI,KAAK,KAAK,EAAE;AAE5E,UAAM,WAAW,MAAM,IAAI,KAAK,IAA4C,GAAG;AAE/E,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,UAAM,OAAO,SAAS,KAAK,IAAI,CAAC,SAAS,mBAAmB,MAAM,IAAI,CAAC;AAEvE,WAAO;AAAA,MACL;AAAA,MACA,OAAO,SAAS;AAAA,MAChB,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAEO,MAAM,uBAAuB,IAAI,qBAAqB;","names":[]}
@@ -0,0 +1,57 @@
1
+ import z from "zod";
2
+ const SubscriptionItemSchema = z.object({
3
+ id: z.union([z.number(), z.string()]),
4
+ deleted: z.number(),
5
+ datetime_alt: z.coerce.date().nullable().optional(),
6
+ datetime_del: z.coerce.date().nullable().optional(),
7
+ datetime_add: z.coerce.date(),
8
+ id_wl: z.number(),
9
+ id_subscription: z.union([z.number(), z.string()]),
10
+ id_addon: z.number().nullable(),
11
+ addon_name: z.string().optional(),
12
+ value: z.number(),
13
+ currency: z.string(),
14
+ quantity: z.number(),
15
+ payment_status: z.number(),
16
+ id_charge: z.union([z.number(), z.string()]).nullable(),
17
+ trial: z.boolean(),
18
+ trial_ends_at: z.coerce.date().nullable().optional()
19
+ });
20
+ const SubscriptionSchema = z.object({
21
+ id: z.union([z.number(), z.string()]),
22
+ deleted: z.number(),
23
+ datetime_alt: z.coerce.date().nullable().optional(),
24
+ datetime_del: z.coerce.date().nullable().optional(),
25
+ datetime_add: z.coerce.date(),
26
+ id_wl: z.number(),
27
+ id_account: z.union([z.number(), z.string()]),
28
+ id_card: z.union([z.number(), z.string()]).nullable(),
29
+ id_coupon: z.union([z.number(), z.string()]).nullable(),
30
+ type: z.string(),
31
+ payment_method: z.number().nullable(),
32
+ periodicity: z.union([z.number(), z.string()]).nullable(),
33
+ value: z.number().nullable(),
34
+ id_product: z.number(),
35
+ id_plan: z.number(),
36
+ plan_name: z.string().nullable().optional(),
37
+ id_gateway: z.union([z.number(), z.string()]).nullable(),
38
+ gateway_account: z.string().nullable(),
39
+ date_hiring: z.coerce.date().nullable(),
40
+ date_due: z.coerce.date(),
41
+ date_cancellation: z.coerce.date().nullable(),
42
+ date_verification: z.coerce.date().nullable(),
43
+ cancellation_reason: z.string().nullable(),
44
+ cancellation_description: z.string().nullable(),
45
+ active: z.boolean(),
46
+ charged: z.boolean(),
47
+ datetime_last_update_periodicity: z.coerce.date().nullable().optional(),
48
+ card_name: z.string().nullable().optional(),
49
+ card_brand: z.string().nullable().optional(),
50
+ card_number: z.string().nullable().optional(),
51
+ items: z.array(SubscriptionItemSchema)
52
+ });
53
+ export {
54
+ SubscriptionItemSchema,
55
+ SubscriptionSchema
56
+ };
57
+ //# sourceMappingURL=types.mjs.map