@greatapps/common 1.1.138 → 1.1.140

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 (392) 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 +64 -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 +180 -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 +182 -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 +150 -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 +236 -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/NavItem.mjs +35 -0
  76. package/dist/components/navigation/NavItem.mjs.map +1 -0
  77. package/dist/components/navigation/NavItemsContext.mjs +16 -0
  78. package/dist/components/navigation/NavItemsContext.mjs.map +1 -0
  79. package/dist/components/navigation/ProjectSelectorPopover.mjs +128 -0
  80. package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -0
  81. package/dist/components/navigation/shells/DesktopShell.mjs +11 -0
  82. package/dist/components/navigation/shells/DesktopShell.mjs.map +1 -0
  83. package/dist/components/navigation/shells/MdShell.mjs +11 -0
  84. package/dist/components/navigation/shells/MdShell.mjs.map +1 -0
  85. package/dist/components/navigation/shells/MobileShell.mjs +27 -0
  86. package/dist/components/navigation/shells/MobileShell.mjs.map +1 -0
  87. package/dist/components/navigation/shells/TabsMobileShell.mjs +59 -0
  88. package/dist/components/navigation/shells/TabsMobileShell.mjs.map +1 -0
  89. package/dist/components/navigation/subcomponents/CreditsCard.mjs +30 -0
  90. package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -0
  91. package/dist/components/navigation/subcomponents/NavItems.mjs +25 -0
  92. package/dist/components/navigation/subcomponents/NavItems.mjs.map +1 -0
  93. package/dist/components/navigation/subcomponents/PlanCard.mjs +25 -0
  94. package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -0
  95. package/dist/components/navigation/subcomponents/ProjectSelector.mjs +130 -0
  96. package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -0
  97. package/dist/components/navigation/types.mjs +1 -0
  98. package/dist/components/pages/notifications/Notifications.mjs +156 -0
  99. package/dist/components/pages/notifications/Notifications.mjs.map +1 -0
  100. package/dist/components/ui/buttons/Button.mjs +52 -0
  101. package/dist/components/ui/buttons/Button.mjs.map +1 -0
  102. package/dist/components/ui/buttons/CancelButton.mjs +17 -0
  103. package/dist/components/ui/buttons/CancelButton.mjs.map +1 -0
  104. package/dist/components/ui/buttons/CopyButton.mjs +42 -0
  105. package/dist/components/ui/buttons/CopyButton.mjs.map +1 -0
  106. package/dist/components/ui/data-display/Accordion.mjs +76 -0
  107. package/dist/components/ui/data-display/Accordion.mjs.map +1 -0
  108. package/dist/components/ui/data-display/Badge.mjs +42 -0
  109. package/dist/components/ui/data-display/Badge.mjs.map +1 -0
  110. package/dist/components/ui/data-display/Card.mjs +92 -0
  111. package/dist/components/ui/data-display/Card.mjs.map +1 -0
  112. package/dist/components/ui/data-display/Pagination.mjs +118 -0
  113. package/dist/components/ui/data-display/Pagination.mjs.map +1 -0
  114. package/dist/components/ui/data-display/ScrollArea.mjs +62 -0
  115. package/dist/components/ui/data-display/ScrollArea.mjs.map +1 -0
  116. package/dist/components/ui/data-display/Separator.mjs +28 -0
  117. package/dist/components/ui/data-display/Separator.mjs.map +1 -0
  118. package/dist/components/ui/data-display/Table.mjs +116 -0
  119. package/dist/components/ui/data-display/Table.mjs.map +1 -0
  120. package/dist/components/ui/data-display/Tabs.mjs +69 -0
  121. package/dist/components/ui/data-display/Tabs.mjs.map +1 -0
  122. package/dist/components/ui/data-display/UserAvatar.mjs +49 -0
  123. package/dist/components/ui/data-display/UserAvatar.mjs.map +1 -0
  124. package/dist/components/ui/feedback/CircularProgress.mjs +71 -0
  125. package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -0
  126. package/dist/components/ui/feedback/DefaultCircularProgress.mjs +50 -0
  127. package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -0
  128. package/dist/components/ui/feedback/LoadingOverlay.mjs +19 -0
  129. package/dist/components/ui/feedback/LoadingOverlay.mjs.map +1 -0
  130. package/dist/components/ui/feedback/Progress.mjs +37 -0
  131. package/dist/components/ui/feedback/Progress.mjs.map +1 -0
  132. package/dist/components/ui/feedback/Toast.mjs +77 -0
  133. package/dist/components/ui/feedback/Toast.mjs.map +1 -0
  134. package/dist/components/ui/form/Calendar.mjs +204 -0
  135. package/dist/components/ui/form/Calendar.mjs.map +1 -0
  136. package/dist/components/ui/form/Checkbox.mjs +33 -0
  137. package/dist/components/ui/form/Checkbox.mjs.map +1 -0
  138. package/dist/components/ui/form/ComboboxField.mjs +130 -0
  139. package/dist/components/ui/form/ComboboxField.mjs.map +1 -0
  140. package/dist/components/ui/form/DatePicker.mjs +82 -0
  141. package/dist/components/ui/form/DatePicker.mjs.map +1 -0
  142. package/dist/components/ui/form/DateRangePicker.mjs +92 -0
  143. package/dist/components/ui/form/DateRangePicker.mjs.map +1 -0
  144. package/dist/components/ui/form/FormField.mjs +103 -0
  145. package/dist/components/ui/form/FormField.mjs.map +1 -0
  146. package/dist/components/ui/form/Input.mjs +21 -0
  147. package/dist/components/ui/form/Input.mjs.map +1 -0
  148. package/dist/components/ui/form/InputOtp.mjs +70 -0
  149. package/dist/components/ui/form/InputOtp.mjs.map +1 -0
  150. package/dist/components/ui/form/PhoneInput.mjs +78 -0
  151. package/dist/components/ui/form/PhoneInput.mjs.map +1 -0
  152. package/dist/components/ui/form/RadioGroup.mjs +37 -0
  153. package/dist/components/ui/form/RadioGroup.mjs.map +1 -0
  154. package/dist/components/ui/form/Select.mjs +179 -0
  155. package/dist/components/ui/form/Select.mjs.map +1 -0
  156. package/dist/components/ui/form/SelectField.mjs +80 -0
  157. package/dist/components/ui/form/SelectField.mjs.map +1 -0
  158. package/dist/components/ui/form/Switch.mjs +33 -0
  159. package/dist/components/ui/form/Switch.mjs.map +1 -0
  160. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs +40 -0
  161. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs.map +1 -0
  162. package/dist/components/ui/form/TextAreaField.mjs +56 -0
  163. package/dist/components/ui/form/TextAreaField.mjs.map +1 -0
  164. package/dist/components/ui/form/Textarea.mjs +20 -0
  165. package/dist/components/ui/form/Textarea.mjs.map +1 -0
  166. package/dist/components/ui/overlay/Command.mjs +178 -0
  167. package/dist/components/ui/overlay/Command.mjs.map +1 -0
  168. package/dist/components/ui/overlay/Dialog.mjs +142 -0
  169. package/dist/components/ui/overlay/Dialog.mjs.map +1 -0
  170. package/dist/components/ui/overlay/Popover.mjs +46 -0
  171. package/dist/components/ui/overlay/Popover.mjs.map +1 -0
  172. package/dist/components/ui/overlay/Sheet.mjs +142 -0
  173. package/dist/components/ui/overlay/Sheet.mjs.map +1 -0
  174. package/dist/components/ui/overlay/Tooltip.mjs +57 -0
  175. package/dist/components/ui/overlay/Tooltip.mjs.map +1 -0
  176. package/dist/components/widgets/notifications/NotificationCard.mjs +54 -0
  177. package/dist/components/widgets/notifications/NotificationCard.mjs.map +1 -0
  178. package/dist/enums/AccountSectionType.mjs +11 -0
  179. package/dist/enums/AccountSectionType.mjs.map +1 -0
  180. package/dist/hooks/copy-to-clipboard.hook.mjs +52 -0
  181. package/dist/hooks/copy-to-clipboard.hook.mjs.map +1 -0
  182. package/dist/hooks/useCountdownTimer.mjs +29 -0
  183. package/dist/hooks/useCountdownTimer.mjs.map +1 -0
  184. package/dist/hooks/useDebounce.mjs +19 -0
  185. package/dist/hooks/useDebounce.mjs.map +1 -0
  186. package/dist/hooks/useDebounceState.mjs +12 -0
  187. package/dist/hooks/useDebounceState.mjs.map +1 -0
  188. package/dist/hooks/useDebouncedEffect.mjs +44 -0
  189. package/dist/hooks/useDebouncedEffect.mjs.map +1 -0
  190. package/dist/hooks/useIsMobile.mjs +18 -0
  191. package/dist/hooks/useIsMobile.mjs.map +1 -0
  192. package/dist/hooks/usePasswordVisibility.mjs +13 -0
  193. package/dist/hooks/usePasswordVisibility.mjs.map +1 -0
  194. package/dist/index.mjs +259 -9841
  195. package/dist/index.mjs.map +1 -1
  196. package/dist/{chunk-R2FMWFY6.mjs → infra/api/client.mjs} +10 -14
  197. package/dist/infra/api/client.mjs.map +1 -0
  198. package/dist/infra/api/types.mjs +31 -0
  199. package/dist/infra/api/types.mjs.map +1 -0
  200. package/dist/infra/utils/client-info.mjs +27 -0
  201. package/dist/infra/utils/client-info.mjs.map +1 -0
  202. package/dist/infra/utils/clsx.mjs +9 -0
  203. package/dist/infra/utils/clsx.mjs.map +1 -0
  204. package/dist/infra/utils/params.mjs +21 -0
  205. package/dist/infra/utils/params.mjs.map +1 -0
  206. package/dist/infra/utils/parser.mjs +24 -0
  207. package/dist/infra/utils/parser.mjs.map +1 -0
  208. package/dist/infra/utils/percentage.mjs +20 -0
  209. package/dist/infra/utils/percentage.mjs.map +1 -0
  210. package/dist/middleware.mjs +3 -69
  211. package/dist/middleware.mjs.map +1 -1
  212. package/dist/middlewares/chain.mjs +37 -0
  213. package/dist/middlewares/chain.mjs.map +1 -0
  214. package/dist/middlewares/create-auth-middleware.mjs +28 -0
  215. package/dist/middlewares/create-auth-middleware.mjs.map +1 -0
  216. package/dist/middlewares/types.mjs +11 -0
  217. package/dist/middlewares/types.mjs.map +1 -0
  218. package/dist/modules/accounts/actions/account-management.action.mjs +82 -0
  219. package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -0
  220. package/dist/modules/accounts/actions/find-current-account.action.mjs +10 -0
  221. package/dist/modules/accounts/actions/find-current-account.action.mjs.map +1 -0
  222. package/dist/modules/accounts/actions/list-currencies.action.mjs +10 -0
  223. package/dist/modules/accounts/actions/list-currencies.action.mjs.map +1 -0
  224. package/dist/modules/accounts/actions/list-timezones.action.mjs +10 -0
  225. package/dist/modules/accounts/actions/list-timezones.action.mjs.map +1 -0
  226. package/dist/modules/accounts/hooks/current-account.hook.mjs +24 -0
  227. package/dist/modules/accounts/hooks/current-account.hook.mjs.map +1 -0
  228. package/dist/modules/accounts/hooks/useAccountManagement.mjs +71 -0
  229. package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -0
  230. package/dist/modules/accounts/hooks/useCurrencies.mjs +17 -0
  231. package/dist/modules/accounts/hooks/useCurrencies.mjs.map +1 -0
  232. package/dist/modules/accounts/hooks/useTimezones.mjs +17 -0
  233. package/dist/modules/accounts/hooks/useTimezones.mjs.map +1 -0
  234. package/dist/{chunk-EDTDKGI5.mjs → modules/accounts/services/account.service.mjs} +9 -65
  235. package/dist/modules/accounts/services/account.service.mjs.map +1 -0
  236. package/dist/modules/accounts/services/currency.service.mjs +24 -0
  237. package/dist/modules/accounts/services/currency.service.mjs.map +1 -0
  238. package/dist/modules/accounts/services/timezone.service.mjs +65 -0
  239. package/dist/modules/accounts/services/timezone.service.mjs.map +1 -0
  240. package/dist/modules/accounts/services/two-factor.service.mjs +77 -0
  241. package/dist/modules/accounts/services/two-factor.service.mjs.map +1 -0
  242. package/dist/modules/accounts/types.mjs +1 -0
  243. package/dist/modules/auth/actions/login.action.mjs +14 -0
  244. package/dist/modules/auth/actions/login.action.mjs.map +1 -0
  245. package/dist/modules/auth/actions/logout.action.mjs +14 -0
  246. package/dist/modules/auth/actions/logout.action.mjs.map +1 -0
  247. package/dist/modules/auth/actions/register.action.mjs +14 -0
  248. package/dist/modules/auth/actions/register.action.mjs.map +1 -0
  249. package/dist/{validate-session.action-TMZN36SG.mjs → modules/auth/actions/validate-session.action.mjs} +3 -10
  250. package/dist/modules/auth/actions/validate-session.action.mjs.map +1 -0
  251. package/dist/{verify-two-factor.action-IQM6SU5U.mjs → modules/auth/actions/verify-two-factor.action.mjs} +4 -13
  252. package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +1 -0
  253. package/dist/modules/auth/hooks/login.hook.mjs +18 -0
  254. package/dist/modules/auth/hooks/login.hook.mjs.map +1 -0
  255. package/dist/modules/auth/hooks/logout.hook.mjs +13 -0
  256. package/dist/modules/auth/hooks/logout.hook.mjs.map +1 -0
  257. package/dist/modules/auth/hooks/register.hook.mjs +13 -0
  258. package/dist/modules/auth/hooks/register.hook.mjs.map +1 -0
  259. package/dist/modules/auth/hooks/useUserQuery.mjs +63 -0
  260. package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -0
  261. package/dist/modules/auth/schema.mjs +1 -0
  262. package/dist/{chunk-I26OTCGJ.mjs → modules/auth/services/auth.service.mjs} +13 -47
  263. package/dist/modules/auth/services/auth.service.mjs.map +1 -0
  264. package/dist/modules/auth/utils/get-user-context.mjs +24 -0
  265. package/dist/modules/auth/utils/get-user-context.mjs.map +1 -0
  266. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs +10 -0
  267. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs.map +1 -0
  268. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +76 -0
  269. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +1 -0
  270. package/dist/modules/ia-credits/services/ia-credits.service.mjs +31 -0
  271. package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +1 -0
  272. package/dist/modules/ia-credits/types.mjs +25 -0
  273. package/dist/modules/ia-credits/types.mjs.map +1 -0
  274. package/dist/modules/projects/actions/add-project-user.action.mjs +10 -0
  275. package/dist/modules/projects/actions/add-project-user.action.mjs.map +1 -0
  276. package/dist/modules/projects/actions/list-available-users.action.mjs +10 -0
  277. package/dist/modules/projects/actions/list-available-users.action.mjs.map +1 -0
  278. package/dist/modules/projects/actions/list-project-users.action.mjs +10 -0
  279. package/dist/modules/projects/actions/list-project-users.action.mjs.map +1 -0
  280. package/dist/modules/projects/actions/remove-project-user.action.mjs +10 -0
  281. package/dist/modules/projects/actions/remove-project-user.action.mjs.map +1 -0
  282. package/dist/modules/projects/hooks/list-available-users.hook.mjs +34 -0
  283. package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -0
  284. package/dist/modules/projects/hooks/list-project-users.hook.mjs +34 -0
  285. package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -0
  286. package/dist/modules/projects/services/project-users.service.mjs +78 -0
  287. package/dist/modules/projects/services/project-users.service.mjs.map +1 -0
  288. package/dist/modules/projects/types.mjs +22 -0
  289. package/dist/modules/projects/types.mjs.map +1 -0
  290. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs +10 -0
  291. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs.map +1 -0
  292. package/dist/modules/subscriptions/constants/addons.constants.mjs +12 -0
  293. package/dist/modules/subscriptions/constants/addons.constants.mjs.map +1 -0
  294. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +20 -0
  295. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +1 -0
  296. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +18 -0
  297. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +1 -0
  298. package/dist/modules/subscriptions/services/subscriptions.service.mjs +32 -0
  299. package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +1 -0
  300. package/dist/modules/subscriptions/types.mjs +57 -0
  301. package/dist/modules/subscriptions/types.mjs.map +1 -0
  302. package/dist/modules/users/action/find-user-by-id.action.mjs +10 -0
  303. package/dist/modules/users/action/find-user-by-id.action.mjs.map +1 -0
  304. package/dist/modules/users/action/list-messages.action.mjs +13 -0
  305. package/dist/modules/users/action/list-messages.action.mjs.map +1 -0
  306. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs +10 -0
  307. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs.map +1 -0
  308. package/dist/modules/users/action/mark-message-as-read.action.mjs +10 -0
  309. package/dist/modules/users/action/mark-message-as-read.action.mjs.map +1 -0
  310. package/dist/modules/users/hooks/messages.hook.mjs +57 -0
  311. package/dist/modules/users/hooks/messages.hook.mjs.map +1 -0
  312. package/dist/modules/users/schema/messages.schema.mjs +21 -0
  313. package/dist/modules/users/schema/messages.schema.mjs.map +1 -0
  314. package/dist/modules/users/schema.mjs +11 -0
  315. package/dist/modules/users/schema.mjs.map +1 -0
  316. package/dist/modules/users/services/messages.service.mjs +35 -0
  317. package/dist/modules/users/services/messages.service.mjs.map +1 -0
  318. package/dist/{chunk-ZQZNWUKB.mjs → modules/users/services/user.service.mjs} +8 -14
  319. package/dist/modules/users/services/user.service.mjs.map +1 -0
  320. package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs +15 -0
  321. package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs.map +1 -0
  322. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +21 -0
  323. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +1 -0
  324. package/dist/modules/whitelabel/schema.mjs +1 -0
  325. package/dist/modules/whitelabel/schema.mjs.map +1 -0
  326. package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs +76 -0
  327. package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs.map +1 -0
  328. package/dist/{chunk-4IBSIBU6.mjs → modules/whitelabel/services/whitelabel.service.mjs} +9 -60
  329. package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +1 -0
  330. package/dist/modules/whitelabel/styles-schema.mjs +1 -0
  331. package/dist/modules/whitelabel/styles-schema.mjs.map +1 -0
  332. package/dist/providers/auth.provider.mjs +94 -0
  333. package/dist/providers/auth.provider.mjs.map +1 -0
  334. package/dist/providers/query.provider.mjs +99 -0
  335. package/dist/providers/query.provider.mjs.map +1 -0
  336. package/dist/providers/whitelabel.provider.mjs +31 -0
  337. package/dist/providers/whitelabel.provider.mjs.map +1 -0
  338. package/dist/server.mjs +40 -1445
  339. package/dist/server.mjs.map +1 -1
  340. package/dist/store/useAccountModals.mjs +18 -0
  341. package/dist/store/useAccountModals.mjs.map +1 -0
  342. package/dist/store/useMdSidebarStore.mjs +11 -0
  343. package/dist/store/useMdSidebarStore.mjs.map +1 -0
  344. package/dist/store/useMobileNavbarSheet.mjs +14 -0
  345. package/dist/store/useMobileNavbarSheet.mjs.map +1 -0
  346. package/dist/store/useModalManager.mjs +75 -0
  347. package/dist/store/useModalManager.mjs.map +1 -0
  348. package/dist/utils/browser/clipboard.mjs +36 -0
  349. package/dist/utils/browser/clipboard.mjs.map +1 -0
  350. package/dist/utils/file/index.mjs +9 -0
  351. package/dist/utils/file/index.mjs.map +1 -0
  352. package/dist/utils/format/masks.mjs +56 -0
  353. package/dist/utils/format/masks.mjs.map +1 -0
  354. package/dist/utils/intl/locales.mjs +12 -0
  355. package/dist/utils/intl/locales.mjs.map +1 -0
  356. package/dist/{chunk-MXQIEEP6.mjs → utils/safeServerAction.mjs} +2 -8
  357. package/dist/utils/safeServerAction.mjs.map +1 -0
  358. package/dist/utils/validators/account.mjs +26 -0
  359. package/dist/utils/validators/account.mjs.map +1 -0
  360. package/dist/utils/validators/common.mjs +47 -0
  361. package/dist/utils/validators/common.mjs.map +1 -0
  362. package/dist/utils/withAction.mjs +13 -0
  363. package/dist/utils/withAction.mjs.map +1 -0
  364. package/package.json +2 -1
  365. package/dist/MMQ4R4NB-HKE335ZM.mjs +0 -62
  366. package/dist/MMQ4R4NB-HKE335ZM.mjs.map +0 -1
  367. package/dist/V4HPSUGU-XMVFKNNR.mjs +0 -52
  368. package/dist/V4HPSUGU-XMVFKNNR.mjs.map +0 -1
  369. package/dist/account-management.action-4D4A3IPF.mjs +0 -41
  370. package/dist/account.service-FPMIFBBX.mjs +0 -10
  371. package/dist/chunk-4IBSIBU6.mjs.map +0 -1
  372. package/dist/chunk-CO6HSV2G.mjs +0 -165
  373. package/dist/chunk-CO6HSV2G.mjs.map +0 -1
  374. package/dist/chunk-EDTDKGI5.mjs.map +0 -1
  375. package/dist/chunk-I26OTCGJ.mjs.map +0 -1
  376. package/dist/chunk-MXQIEEP6.mjs.map +0 -1
  377. package/dist/chunk-OO354ZZZ.mjs +0 -12702
  378. package/dist/chunk-OO354ZZZ.mjs.map +0 -1
  379. package/dist/chunk-OXVONU6X.mjs +0 -2930
  380. package/dist/chunk-OXVONU6X.mjs.map +0 -1
  381. package/dist/chunk-R2FMWFY6.mjs.map +0 -1
  382. package/dist/chunk-ZQZNWUKB.mjs.map +0 -1
  383. package/dist/find-user-by-id.action-K7PB7IH6.mjs +0 -18
  384. package/dist/find-user-by-id.action-K7PB7IH6.mjs.map +0 -1
  385. package/dist/modern-P2CXBCGW.mjs +0 -427
  386. package/dist/modern-P2CXBCGW.mjs.map +0 -1
  387. package/dist/user.service-GCI4YGGI.mjs +0 -9
  388. package/dist/validate-session.action-TMZN36SG.mjs.map +0 -1
  389. package/dist/verify-two-factor.action-IQM6SU5U.mjs.map +0 -1
  390. /package/dist/{account-management.action-4D4A3IPF.mjs.map → components/navigation/types.mjs.map} +0 -0
  391. /package/dist/{account.service-FPMIFBBX.mjs.map → modules/accounts/types.mjs.map} +0 -0
  392. /package/dist/{user.service-GCI4YGGI.mjs.map → modules/auth/schema.mjs.map} +0 -0
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { USER_QUERY_KEY } from "../../auth/hooks/useUserQuery";
4
+ import { ACCOUNT_QUERY_KEY } from "./current-account.hook";
5
+ import {
6
+ updateUserAction,
7
+ updateAccountAction,
8
+ updateAccountUserByIdAction,
9
+ deleteAccountUserAction,
10
+ deleteAccountAction
11
+ } from "../actions/account-management.action";
12
+ import { withAction } from "../../../utils/withAction";
13
+ const ACCOUNT_USERS_QUERY_KEY = ["account-users"];
14
+ function useUpdateAccount() {
15
+ const queryClient = useQueryClient();
16
+ return useMutation({
17
+ mutationFn: withAction(updateAccountAction),
18
+ onSuccess: () => {
19
+ queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });
20
+ queryClient.invalidateQueries({ queryKey: ACCOUNT_QUERY_KEY });
21
+ queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
22
+ }
23
+ });
24
+ }
25
+ function useUpdateAccountUser() {
26
+ const queryClient = useQueryClient();
27
+ return useMutation({
28
+ mutationFn: withAction(updateUserAction),
29
+ onSuccess: () => {
30
+ queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });
31
+ queryClient.invalidateQueries({ queryKey: ACCOUNT_QUERY_KEY });
32
+ queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
33
+ }
34
+ });
35
+ }
36
+ function useUpdateAccountUserById() {
37
+ const queryClient = useQueryClient();
38
+ return useMutation({
39
+ mutationFn: withAction(
40
+ ({ userId, ...user }) => updateAccountUserByIdAction(userId, user)
41
+ ),
42
+ onSuccess: () => {
43
+ queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });
44
+ }
45
+ });
46
+ }
47
+ function useDeleteAccountUser(options) {
48
+ const queryClient = useQueryClient();
49
+ return useMutation({
50
+ mutationFn: withAction(deleteAccountUserAction),
51
+ ...options,
52
+ onSuccess: (...params) => {
53
+ options?.onSuccess?.(...params);
54
+ queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });
55
+ }
56
+ });
57
+ }
58
+ function useDeleteAccount(options) {
59
+ return useMutation({
60
+ mutationFn: withAction(deleteAccountAction),
61
+ ...options
62
+ });
63
+ }
64
+ export {
65
+ useDeleteAccount,
66
+ useDeleteAccountUser,
67
+ useUpdateAccount,
68
+ useUpdateAccountUser,
69
+ useUpdateAccountUserById
70
+ };
71
+ //# sourceMappingURL=useAccountManagement.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/accounts/hooks/useAccountManagement.ts"],"sourcesContent":["'use client';\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { USER_QUERY_KEY } from '../../auth/hooks/useUserQuery';\nimport { ACCOUNT_QUERY_KEY } from './current-account.hook';\nimport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n DeleteAccountUserResponse,\n DeleteAccountResponse,\n} from '../types';\nimport {\n updateUserAction,\n updateAccountAction,\n updateAccountUserByIdAction,\n deleteAccountUserAction,\n deleteAccountAction,\n} from '../actions/account-management.action';\nimport { withAction } from '../../../utils/withAction';\nimport type { UseMutationOptions } from '@tanstack/react-query';\n\nconst ACCOUNT_USERS_QUERY_KEY = ['account-users'];\n\nexport function useUpdateAccount() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: withAction(updateAccountAction),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });\n queryClient.invalidateQueries({ queryKey: ACCOUNT_QUERY_KEY });\n queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });\n },\n });\n}\n\nexport function useUpdateAccountUser() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: withAction(updateUserAction),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });\n queryClient.invalidateQueries({ queryKey: ACCOUNT_QUERY_KEY });\n queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });\n },\n });\n}\n\nexport function useUpdateAccountUserById() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: withAction(({ userId, ...user }: UpdateAccountUserRequest & { userId: number }) =>\n updateAccountUserByIdAction(userId, user)\n ),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });\n },\n });\n}\n\nexport function useDeleteAccountUser(\n options?: UseMutationOptions<DeleteAccountUserResponse, Error, number>\n) {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: withAction(deleteAccountUserAction),\n ...options,\n onSuccess: (...params) => {\n options?.onSuccess?.(...params);\n queryClient.invalidateQueries({ queryKey: ACCOUNT_USERS_QUERY_KEY });\n },\n });\n}\n\nexport function useDeleteAccount(\n options?: UseMutationOptions<DeleteAccountResponse, Error, void>\n) {\n return useMutation({\n mutationFn: withAction(deleteAccountAction),\n ...options,\n });\n}\n"],"mappings":";AAEA,SAAS,aAAa,sBAAsB;AAC5C,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAOlC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAG3B,MAAM,0BAA0B,CAAC,eAAe;AAEzC,SAAS,mBAAmB;AACjC,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,mBAAmB;AAAA,IAC1C,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,wBAAwB,CAAC;AACnE,kBAAY,kBAAkB,EAAE,UAAU,kBAAkB,CAAC;AAC7D,kBAAY,kBAAkB,EAAE,UAAU,eAAe,CAAC;AAAA,IAC5D;AAAA,EACF,CAAC;AACH;AAEO,SAAS,uBAAuB;AACrC,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,gBAAgB;AAAA,IACvC,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,wBAAwB,CAAC;AACnE,kBAAY,kBAAkB,EAAE,UAAU,kBAAkB,CAAC;AAC7D,kBAAY,kBAAkB,EAAE,UAAU,eAAe,CAAC;AAAA,IAC5D;AAAA,EACF,CAAC;AACH;AAEO,SAAS,2BAA2B;AACzC,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY;AAAA,MAAW,CAAC,EAAE,QAAQ,GAAG,KAAK,MACxC,4BAA4B,QAAQ,IAAI;AAAA,IAC1C;AAAA,IACA,WAAW,MAAM;AACf,kBAAY,kBAAkB,EAAE,UAAU,wBAAwB,CAAC;AAAA,IACrE;AAAA,EACF,CAAC;AACH;AAEO,SAAS,qBACd,SACA;AACA,QAAM,cAAc,eAAe;AAEnC,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,uBAAuB;AAAA,IAC9C,GAAG;AAAA,IACH,WAAW,IAAI,WAAW;AACxB,eAAS,YAAY,GAAG,MAAM;AAC9B,kBAAY,kBAAkB,EAAE,UAAU,wBAAwB,CAAC;AAAA,IACrE;AAAA,EACF,CAAC;AACH;AAEO,SAAS,iBACd,SACA;AACA,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,mBAAmB;AAAA,IAC1C,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { listCurrenciesAction } from "../actions/list-currencies.action";
4
+ import { withAction } from "../../../utils/withAction";
5
+ const CURRENCIES_QUERY_KEY = ["currencies"];
6
+ function useCurrencies() {
7
+ return useQuery({
8
+ queryKey: CURRENCIES_QUERY_KEY,
9
+ queryFn: withAction(listCurrenciesAction),
10
+ staleTime: Infinity
11
+ });
12
+ }
13
+ export {
14
+ CURRENCIES_QUERY_KEY,
15
+ useCurrencies
16
+ };
17
+ //# sourceMappingURL=useCurrencies.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/accounts/hooks/useCurrencies.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listCurrenciesAction } from '../actions/list-currencies.action';\nimport { withAction } from '../../../utils/withAction';\n\nexport const CURRENCIES_QUERY_KEY = ['currencies'];\n\nexport function useCurrencies() {\n return useQuery({\n queryKey: CURRENCIES_QUERY_KEY,\n queryFn: withAction(listCurrenciesAction),\n staleTime: Infinity,\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAEpB,MAAM,uBAAuB,CAAC,YAAY;AAE1C,SAAS,gBAAgB;AAC9B,SAAO,SAAS;AAAA,IACd,UAAU;AAAA,IACV,SAAS,WAAW,oBAAoB;AAAA,IACxC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { listTimezonesAction } from "../actions/list-timezones.action";
4
+ import { withAction } from "../../../utils/withAction";
5
+ const TIMEZONES_QUERY_KEY = ["timezones"];
6
+ function useTimezones() {
7
+ return useQuery({
8
+ queryKey: TIMEZONES_QUERY_KEY,
9
+ queryFn: withAction(listTimezonesAction),
10
+ staleTime: Infinity
11
+ });
12
+ }
13
+ export {
14
+ TIMEZONES_QUERY_KEY,
15
+ useTimezones
16
+ };
17
+ //# sourceMappingURL=useTimezones.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/accounts/hooks/useTimezones.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { listTimezonesAction } from '../actions/list-timezones.action';\nimport { withAction } from '../../../utils/withAction';\n\nexport const TIMEZONES_QUERY_KEY = ['timezones'];\n\nexport function useTimezones() {\n return useQuery({\n queryKey: TIMEZONES_QUERY_KEY,\n queryFn: withAction(listTimezonesAction),\n staleTime: Infinity,\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AACpC,SAAS,kBAAkB;AAEpB,MAAM,sBAAsB,CAAC,WAAW;AAExC,SAAS,eAAe;AAC7B,SAAO,SAAS;AAAA,IACd,UAAU;AAAA,IACV,SAAS,WAAW,mBAAmB;AAAA,IACvC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -1,63 +1,10 @@
1
- "use client";
2
- import {
3
- api
4
- } from "./chunk-R2FMWFY6.mjs";
5
- import {
6
- ApiError
7
- } from "./chunk-4IBSIBU6.mjs";
8
-
9
- // src/modules/accounts/services/account.service.ts
10
1
  import "server-only";
11
-
12
- // src/infra/utils/params.ts
13
- function buildQueryParams(params) {
14
- if (!params) {
15
- return "";
16
- }
17
- const queryParams = new URLSearchParams();
18
- for (const [key, value] of Object.entries(params)) {
19
- if (value === null || value === void 0 || value === "") {
20
- continue;
21
- }
22
- if (Array.isArray(value)) {
23
- queryParams.set(key, value.join(","));
24
- } else {
25
- queryParams.set(key, value.toString());
26
- }
27
- }
28
- return queryParams.toString();
29
- }
30
-
31
- // src/modules/auth/utils/get-user-context.ts
32
- import "server-only";
33
- import { cookies } from "next/headers";
34
- var AUTH_COOKIE_NAME = "greatapps";
35
- async function getUserContext() {
36
- const cookieStore = await cookies();
37
- const token = process.env.DUMMY_AUTH_TOKEN || cookieStore.get(AUTH_COOKIE_NAME)?.value;
38
- if (!token) {
39
- throw new ApiError("Usu\xE1rio n\xE3o autenticado", "NOT_AUTHENTICATED_GUC", 401);
40
- }
41
- try {
42
- const payload = JSON.parse(atob(token.split(".")[1]));
43
- return {
44
- id_account: payload.id_account,
45
- id_user: payload.id_user
46
- };
47
- } catch {
48
- throw new ApiError("Token inv\xE1lido", "INVALID_TOKEN", 401);
49
- }
50
- }
51
-
52
- // src/utils/file/index.ts
53
- var fileToBase64 = async (file) => {
54
- const buffer = Buffer.from(await file.arrayBuffer());
55
- const mimeType = file.type || "application/octet-stream";
56
- return `data:${mimeType};base64,${buffer.toString("base64")}`;
57
- };
58
-
59
- // src/modules/accounts/services/account.service.ts
60
- var AccountService = class {
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 { fileToBase64 } from "../../../utils/file/index";
7
+ class AccountService {
61
8
  async findCurrentAccount() {
62
9
  const { id_account } = await getUserContext();
63
10
  const response = await api.apps.get(`/accounts/${id_account}`);
@@ -225,12 +172,9 @@ var AccountService = class {
225
172
  }
226
173
  return response;
227
174
  }
228
- };
229
- var accountService = new AccountService();
230
-
175
+ }
176
+ const accountService = new AccountService();
231
177
  export {
232
- buildQueryParams,
233
- getUserContext,
234
178
  accountService
235
179
  };
236
- //# sourceMappingURL=chunk-EDTDKGI5.mjs.map
180
+ //# sourceMappingURL=account.service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/accounts/services/account.service.ts"],"sourcesContent":["import 'server-only';\n\nimport { api } from '../../../infra/api/client';\nimport { ApiError } from '../../../infra/api/types';\nimport { buildQueryParams } from '../../../infra/utils/params';\nimport { getUserContext } from '../../auth/utils/get-user-context';\nimport { fileToBase64 } from '../../../utils/file/index';\nimport type {\n Account,\n AccountUsersPaginationParams,\n ChangePasswordRequest,\n ChangePasswordResponse,\n ChangeUserPhotoResponse,\n CreateAccountUserRequest,\n CreateAccountUserResponse,\n DeleteAccountResponse,\n DeleteAccountUserResponse,\n GetAccountDataResponse,\n ListAccountUsersResponse,\n UpdateAccountRequest,\n UpdateAccountResponse,\n UpdateAccountUserRequest,\n UpdateAccountUserResponse,\n} from '../types';\n\nclass AccountService {\n async findCurrentAccount(): Promise<Account> {\n const { id_account } = await getUserContext();\n const response = await api.apps.get<GetAccountDataResponse>(`/accounts/${id_account}`);\n\n if (response.status === 0 || !response.data?.[0]) {\n throw new ApiError(\n response.message || 'Erro ao buscar dados da conta',\n 'GET_ACCOUNT_FAILED',\n 400\n );\n }\n\n return response.data[0];\n }\n\n async listAccountUsers(params?: Partial<AccountUsersPaginationParams>) {\n const { id_account } = await getUserContext();\n const queryParams = buildQueryParams(params);\n const endpoint = `/accounts/${id_account}/users?${queryParams}`;\n const response = await api.apps.get<ListAccountUsersResponse>(endpoint);\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao listar usuários',\n 'LIST_ACCOUNT_USERS_FAILED',\n 400\n );\n }\n\n return {\n users: response.data || [],\n total: response.total || 0,\n };\n }\n\n async changeUserPhoto(userId: number, photo: File): Promise<ChangeUserPhotoResponse> {\n const { id_account } = await getUserContext();\n const base64 = await fileToBase64(photo);\n const response = await api.apps.put<ChangeUserPhotoResponse>(\n `/accounts/${id_account}/users/${userId}/file/photo`,\n { file: base64 }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao mudar foto do usuário',\n 'CHANGE_USER_PHOTO_FAILED',\n 400\n );\n }\n\n return response;\n }\n\n async deleteAccountUser(userId: number): Promise<DeleteAccountUserResponse> {\n const { id_account } = await getUserContext();\n const response = await api.apps.delete<DeleteAccountUserResponse>(\n `/accounts/${id_account}/users/${userId}`\n );\n\n if (response.status === 0) {\n throw new ApiError(response.message || 'Erro ao deletar usuário', 'DELETE_USER_FAILED', 400);\n }\n\n return response;\n }\n\n async deleteAccount(): Promise<DeleteAccountResponse> {\n const { id_account } = await getUserContext();\n const response = await api.apps.delete<DeleteAccountResponse>(`/accounts/${id_account}`);\n\n if (response.status === 0) {\n throw new ApiError(response.message || 'Erro ao deletar conta', 'DELETE_ACCOUNT_FAILED', 400);\n }\n\n return response;\n }\n\n async createAccountUser(user: CreateAccountUserRequest): Promise<CreateAccountUserResponse> {\n const { id_account } = await getUserContext();\n const response = await api.apps.post<CreateAccountUserResponse>(\n `/accounts/${id_account}/users`,\n {\n ...user,\n photo: user.photo ? await fileToBase64(user.photo) : null,\n }\n );\n\n if (response.status === 0) {\n throw new ApiError(response.message || 'Erro ao criar usuário', 'CREATE_USER_FAILED', 400);\n }\n\n return response;\n }\n\n private async resolvePhotoField(user: UpdateAccountUserRequest): Promise<{ photo?: string | null }> {\n if (user.photo === undefined) return {};\n const photo =\n user.photo != null && typeof user.photo !== 'string'\n ? await fileToBase64(user.photo)\n : user.photo;\n return { photo };\n }\n\n async updateAccountUser(user: UpdateAccountUserRequest): Promise<UpdateAccountUserResponse> {\n const { id_account, id_user } = await getUserContext();\n const response = await api.apps.put<UpdateAccountUserResponse>(\n `/accounts/${id_account}/users/${id_user}`,\n { ...user, ...(await this.resolvePhotoField(user)) }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao atualizar usuário',\n 'UPDATE_USER_FAILED',\n 400\n );\n }\n\n return response;\n }\n\n async updateAccountUserById(\n userId: number,\n user: UpdateAccountUserRequest\n ): Promise<UpdateAccountUserResponse> {\n const { id_account } = await getUserContext();\n const response = await api.apps.put<UpdateAccountUserResponse>(\n `/accounts/${id_account}/users/${userId}`,\n { ...user, ...(await this.resolvePhotoField(user)) }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao atualizar usuário',\n 'UPDATE_USER_FAILED',\n 400\n );\n }\n\n return response;\n }\n\n async updateAccount(data: UpdateAccountRequest): Promise<UpdateAccountResponse> {\n const { id_account } = await getUserContext();\n const response = await api.apps.put<UpdateAccountResponse>(`/accounts/${id_account}`, data);\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao atualizar conta',\n 'UPDATE_ACCOUNT_FAILED',\n 400\n );\n }\n\n return response;\n }\n\n async requestContactReset(type: 'email' | 'phone', newContact: string): Promise<void> {\n const { id_account, id_user } = await getUserContext();\n const response = await api.apps.post<{ status: number; message: string }>(\n `/accounts/${id_account}/users/${id_user}/resetContact/request`,\n { type, newContact }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao solicitar alteração',\n 'REQUEST_CONTACT_RESET_FAILED',\n 400\n );\n }\n }\n\n async confirmContactReset(type: 'email' | 'phone', token: string, newContact: string): Promise<void> {\n const { id_account, id_user } = await getUserContext();\n const response = await api.apps.post<{ status: number; message: string }>(\n `/accounts/${id_account}/users/${id_user}/resetContact/confirm`,\n { type, token, newContact }\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Código inválido ou expirado',\n 'CONFIRM_CONTACT_RESET_FAILED',\n 400\n );\n }\n }\n\n async changePassword(data: ChangePasswordRequest): Promise<ChangePasswordResponse> {\n const { id_account, id_user } = await getUserContext();\n const response = await api.apps.put<ChangePasswordResponse>(\n `/accounts/${id_account}/users/${id_user}/action/changePassword`,\n data\n );\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao alterar senha',\n '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IACrB;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,oBAAoB,MAAyB,OAAe,YAAmC;AACnG,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AACrD,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,UAAU,OAAO;AAAA,MACxC,EAAE,MAAM,OAAO,WAAW;AAAA,IAC5B;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,eAAe,MAA8D;AACjF,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AACrD,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,UAAU,OAAO;AAAA,MACxC;AAAA,IACF;AAEA,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEO,MAAM,iBAAiB,IAAI,eAAe;","names":[]}
@@ -0,0 +1,24 @@
1
+ import { api } from "../../../infra/api/client";
2
+ const FALLBACK_CURRENCIES = [
3
+ { value: "BRL", label: "Real (R$)" },
4
+ { value: "USD", label: "D\xF3lar Americano (US$)" },
5
+ { value: "EUR", label: "Euro (\u20AC)" }
6
+ ];
7
+ class CurrencyService {
8
+ async fetchOptions() {
9
+ try {
10
+ const response = await api.apps.get("/accounts/action/currencies");
11
+ return response.data.map((item) => ({
12
+ value: item.value,
13
+ label: item.title["pt-br"] || item.title["en-us"] || item.value
14
+ }));
15
+ } catch {
16
+ return FALLBACK_CURRENCIES;
17
+ }
18
+ }
19
+ }
20
+ const currencyService = new CurrencyService();
21
+ export {
22
+ currencyService
23
+ };
24
+ //# sourceMappingURL=currency.service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/accounts/services/currency.service.ts"],"sourcesContent":["import { api } from '../../../infra/api/client';\r\nimport type { ComboboxOption } from '../../../components/ui/form/ComboboxField';\r\n\r\ntype CurrencyApiItem = {\r\n value: string;\r\n icon: string;\r\n title: { 'pt-br': string; 'en-us': string };\r\n description: string;\r\n};\r\n\r\ntype CurrencyApiResponse = {\r\n status: number;\r\n message: string;\r\n data: CurrencyApiItem[];\r\n};\r\n\r\nconst FALLBACK_CURRENCIES: ComboboxOption[] = [\r\n { value: 'BRL', label: 'Real (R$)' },\r\n { value: 'USD', label: 'Dólar Americano (US$)' },\r\n { value: 'EUR', label: 'Euro (€)' },\r\n];\r\n\r\nclass CurrencyService {\r\n async fetchOptions(): Promise<ComboboxOption[]> {\r\n try {\r\n const response = await api.apps.get<CurrencyApiResponse>('/accounts/action/currencies');\r\n\r\n return response.data.map((item) => ({\r\n value: item.value,\r\n label: item.title['pt-br'] || item.title['en-us'] || item.value,\r\n }));\r\n } catch {\r\n return FALLBACK_CURRENCIES;\r\n }\r\n }\r\n}\r\n\r\nexport const currencyService = new CurrencyService();\r\n"],"mappings":"AAAA,SAAS,WAAW;AAgBpB,MAAM,sBAAwC;AAAA,EAC5C,EAAE,OAAO,OAAO,OAAO,YAAY;AAAA,EACnC,EAAE,OAAO,OAAO,OAAO,2BAAwB;AAAA,EAC/C,EAAE,OAAO,OAAO,OAAO,gBAAW;AACpC;AAEA,MAAM,gBAAgB;AAAA,EACpB,MAAM,eAA0C;AAC9C,QAAI;AACF,YAAM,WAAW,MAAM,IAAI,KAAK,IAAyB,6BAA6B;AAEtF,aAAO,SAAS,KAAK,IAAI,CAAC,UAAU;AAAA,QAClC,OAAO,KAAK;AAAA,QACZ,OAAO,KAAK,MAAM,OAAO,KAAK,KAAK,MAAM,OAAO,KAAK,KAAK;AAAA,MAC5D,EAAE;AAAA,IACJ,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,MAAM,kBAAkB,IAAI,gBAAgB;","names":[]}
@@ -0,0 +1,65 @@
1
+ import { api } from "../../../infra/api/client";
2
+ function parseOffsetMinutes(offsetStr) {
3
+ const match = offsetStr.match(/GMT([+-])(\d+)(?::(\d+))?/);
4
+ if (!match) return 0;
5
+ const sign = match[1] === "+" ? 1 : -1;
6
+ return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3] ?? "0", 10));
7
+ }
8
+ const FALLBACK_TIMEZONES = [
9
+ { value: "America/Noronha", label: "(GMT-2) America/Noronha", displayValue: "(GMT-2) Noronha" },
10
+ { value: "America/Sao_Paulo", label: "(GMT-3) America/Sao Paulo", displayValue: "(GMT-3) Sao Paulo" },
11
+ { value: "America/Manaus", label: "(GMT-4) America/Manaus", displayValue: "(GMT-4) Manaus" },
12
+ { value: "America/Rio_Branco", label: "(GMT-5) America/Rio Branco", displayValue: "(GMT-5) Rio Branco" },
13
+ { value: "America/New_York", label: "(GMT-5) America/New York", displayValue: "(GMT-5) New York" },
14
+ { value: "America/Los_Angeles", label: "(GMT-8) America/Los Angeles", displayValue: "(GMT-8) Los Angeles" },
15
+ { value: "Europe/London", label: "(GMT+0) Europe/London", displayValue: "(GMT+0) London" },
16
+ { value: "Europe/Paris", label: "(GMT+1) Europe/Paris", displayValue: "(GMT+1) Paris" },
17
+ { value: "Asia/Tokyo", label: "(GMT+9) Asia/Tokyo", displayValue: "(GMT+9) Tokyo" }
18
+ ];
19
+ class TimezoneService {
20
+ async fetchOptions() {
21
+ try {
22
+ const response = await api.apps.get("/accounts/action/timezones");
23
+ const now = /* @__PURE__ */ new Date();
24
+ const items = response.data.map((item) => {
25
+ const offsetStr = new Intl.DateTimeFormat("en", { timeZone: item.value, timeZoneName: "shortOffset" }).formatToParts(now).find((p) => p.type === "timeZoneName")?.value ?? "GMT";
26
+ const city = item.value.split("/").slice(1).join("/").replace(/_/g, " ") || item.value;
27
+ return {
28
+ value: item.value,
29
+ label: `(${offsetStr}) ${item.value.replace(/_/g, " ")}`,
30
+ displayValue: `(${offsetStr}) ${city}`,
31
+ sort: parseOffsetMinutes(offsetStr)
32
+ };
33
+ });
34
+ items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
35
+ return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
36
+ } catch {
37
+ return FALLBACK_TIMEZONES;
38
+ }
39
+ }
40
+ buildOptions() {
41
+ try {
42
+ const zones = Intl.supportedValuesOf("timeZone");
43
+ const now = /* @__PURE__ */ new Date();
44
+ const items = zones.map((tz) => {
45
+ const offsetStr = new Intl.DateTimeFormat("en", { timeZone: tz, timeZoneName: "shortOffset" }).formatToParts(now).find((p) => p.type === "timeZoneName")?.value ?? "GMT";
46
+ const city = tz.split("/").slice(1).join("/").replace(/_/g, " ") || tz;
47
+ return {
48
+ value: tz,
49
+ label: `(${offsetStr}) ${tz.replace(/_/g, " ")}`,
50
+ displayValue: `(${offsetStr}) ${city}`,
51
+ sort: parseOffsetMinutes(offsetStr)
52
+ };
53
+ });
54
+ items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));
55
+ return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));
56
+ } catch {
57
+ return FALLBACK_TIMEZONES;
58
+ }
59
+ }
60
+ }
61
+ const timezoneService = new TimezoneService();
62
+ export {
63
+ timezoneService
64
+ };
65
+ //# sourceMappingURL=timezone.service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/accounts/services/timezone.service.ts"],"sourcesContent":["import { api } from '../../../infra/api/client';\r\n\r\nexport type TimezoneOption = {\r\n value: string;\r\n label: string;\r\n displayValue: string;\r\n};\r\n\r\ntype TimezoneApiResponse = {\r\n message: string;\r\n data: { value: string; title: string }[];\r\n};\r\n\r\nfunction parseOffsetMinutes(offsetStr: string): number {\r\n const match = offsetStr.match(/GMT([+-])(\\d+)(?::(\\d+))?/);\r\n if (!match) return 0;\r\n const sign = match[1] === '+' ? 1 : -1;\r\n return sign * (parseInt(match[2], 10) * 60 + parseInt(match[3] ?? '0', 10));\r\n}\r\n\r\nconst FALLBACK_TIMEZONES: TimezoneOption[] = [\r\n { value: 'America/Noronha', label: '(GMT-2) America/Noronha', displayValue: '(GMT-2) Noronha' },\r\n { value: 'America/Sao_Paulo', label: '(GMT-3) America/Sao Paulo', displayValue: '(GMT-3) Sao Paulo' },\r\n { value: 'America/Manaus', label: '(GMT-4) America/Manaus', displayValue: '(GMT-4) Manaus' },\r\n { value: 'America/Rio_Branco', label: '(GMT-5) America/Rio Branco', displayValue: '(GMT-5) Rio Branco' },\r\n { value: 'America/New_York', label: '(GMT-5) America/New York', displayValue: '(GMT-5) New York' },\r\n { value: 'America/Los_Angeles', label: '(GMT-8) America/Los Angeles', displayValue: '(GMT-8) Los Angeles' },\r\n { value: 'Europe/London', label: '(GMT+0) Europe/London', displayValue: '(GMT+0) London' },\r\n { value: 'Europe/Paris', label: '(GMT+1) Europe/Paris', displayValue: '(GMT+1) Paris' },\r\n { value: 'Asia/Tokyo', label: '(GMT+9) Asia/Tokyo', displayValue: '(GMT+9) Tokyo' },\r\n];\r\n\r\nclass TimezoneService {\r\n async fetchOptions(): Promise<TimezoneOption[]> {\r\n try {\r\n const response = await api.apps.get<TimezoneApiResponse>('/accounts/action/timezones');\r\n const now = new Date();\r\n\r\n const items = response.data.map((item) => {\r\n const offsetStr =\r\n new Intl.DateTimeFormat('en', { timeZone: item.value, timeZoneName: 'shortOffset' })\r\n .formatToParts(now)\r\n .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';\r\n\r\n const city = item.value.split('/').slice(1).join('/').replace(/_/g, ' ') || item.value;\r\n\r\n return {\r\n value: item.value,\r\n label: `(${offsetStr}) ${item.value.replace(/_/g, ' ')}`,\r\n displayValue: `(${offsetStr}) ${city}`,\r\n sort: parseOffsetMinutes(offsetStr),\r\n };\r\n });\r\n\r\n items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));\r\n\r\n return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));\r\n } catch {\r\n return FALLBACK_TIMEZONES;\r\n }\r\n }\r\n\r\n buildOptions(): TimezoneOption[] {\r\n try {\r\n const zones = Intl.supportedValuesOf('timeZone');\r\n const now = new Date();\r\n\r\n const items = zones.map((tz) => {\r\n const offsetStr =\r\n new Intl.DateTimeFormat('en', { timeZone: tz, timeZoneName: 'shortOffset' })\r\n .formatToParts(now)\r\n .find((p) => p.type === 'timeZoneName')?.value ?? 'GMT';\r\n\r\n const city = tz.split('/').slice(1).join('/').replace(/_/g, ' ') || tz;\r\n\r\n return {\r\n value: tz,\r\n label: `(${offsetStr}) ${tz.replace(/_/g, ' ')}`,\r\n displayValue: `(${offsetStr}) ${city}`,\r\n sort: parseOffsetMinutes(offsetStr),\r\n };\r\n });\r\n\r\n items.sort((a, b) => a.sort - b.sort || a.label.localeCompare(b.label));\r\n\r\n return items.map(({ value, label, displayValue }) => ({ value, label, displayValue }));\r\n } catch {\r\n return FALLBACK_TIMEZONES;\r\n }\r\n }\r\n}\r\n\r\nexport const timezoneService = new TimezoneService();\r\n"],"mappings":"AAAA,SAAS,WAAW;AAapB,SAAS,mBAAmB,WAA2B;AACrD,QAAM,QAAQ,UAAU,MAAM,2BAA2B;AACzD,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,OAAO,MAAM,CAAC,MAAM,MAAM,IAAI;AACpC,SAAO,QAAQ,SAAS,MAAM,CAAC,GAAG,EAAE,IAAI,KAAK,SAAS,MAAM,CAAC,KAAK,KAAK,EAAE;AAC3E;AAEA,MAAM,qBAAuC;AAAA,EAC3C,EAAE,OAAO,mBAAmB,OAAO,2BAA2B,cAAc,kBAAkB;AAAA,EAC9F,EAAE,OAAO,qBAAqB,OAAO,6BAA6B,cAAc,oBAAoB;AAAA,EACpG,EAAE,OAAO,kBAAkB,OAAO,0BAA0B,cAAc,iBAAiB;AAAA,EAC3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,IACvF,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,eAAiC;AAC/B,QAAI;AACF,YAAM,QAAQ,KAAK,kBAAkB,UAAU;AAC/C,YAAM,MAAM,oBAAI,KAAK;AAErB,YAAM,QAAQ,MAAM,IAAI,CAAC,OAAO;AAC9B,cAAM,YACJ,IAAI,KAAK,eAAe,MAAM,EAAE,UAAU,IAAI,cAAc,cAAc,CAAC,EACxE,cAAc,GAAG,EACjB,KAAK,CAAC,MAAM,EAAE,SAAS,cAAc,GAAG,SAAS;AAEtD,cAAM,OAAO,GAAG,MAAM,GAAG,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,EAAE,QAAQ,MAAM,GAAG,KAAK;AAEpE,eAAO;AAAA,UACL,OAAO;AAAA,UACP,OAAO,IAAI,SAAS,KAAK,GAAG,QAAQ,MAAM,GAAG,CAAC;AAAA,UAC9C,cAAc,IAAI,SAAS,KAAK,IAAI;AAAA,UACpC,MAAM,mBAAmB,SAAS;AAAA,QACpC;AAAA,MACF,CAAC;AAED,YAAM,KAAK,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,EAAE,KAAK,CAAC;AAEtE,aAAO,MAAM,IAAI,CAAC,EAAE,OAAO,OAAO,aAAa,OAAO,EAAE,OAAO,OAAO,aAAa,EAAE;AAAA,IACvF,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,MAAM,kBAAkB,IAAI,gBAAgB;","names":[]}
@@ -0,0 +1,77 @@
1
+ import "server-only";
2
+ import { ApiError } from "../../../infra/api/types";
3
+ import { getUserContext } from "../../auth/utils/get-user-context";
4
+ import { findWhitelabel } from "../../whitelabel/actions/find-whitelabel.action";
5
+ const TWO_FA_BASE_URL = process.env.R2_2FA_URL || "https://r2-2fa.greatapps.dev.br";
6
+ class TwoFactorService {
7
+ async request(path, body) {
8
+ const { id, token } = await findWhitelabel();
9
+ const { id_account, id_user } = await getUserContext();
10
+ const url = `${TWO_FA_BASE_URL}/v1/${id}/account/${id_account}/users/${id_user}/2fa/${path}`;
11
+ const response = await fetch(url, {
12
+ method: "POST",
13
+ headers: {
14
+ "Content-Type": "application/json",
15
+ authorization: token
16
+ },
17
+ body: body ? JSON.stringify(body) : void 0
18
+ });
19
+ if (!response.ok) {
20
+ const errorData = await response.json().catch(() => ({}));
21
+ throw new ApiError(
22
+ errorData.message || `HTTP error ${response.status}`,
23
+ "HTTP_ERROR",
24
+ response.status
25
+ );
26
+ }
27
+ return response.json();
28
+ }
29
+ async generate() {
30
+ const response = await this.request("generate");
31
+ if (response.status === 0) {
32
+ throw new ApiError(response.message || "Erro ao gerar QR Code", "GENERATE_2FA_FAILED", 400);
33
+ }
34
+ return response;
35
+ }
36
+ async confirm(code) {
37
+ const response = await this.request("confirm", { code });
38
+ if (response.status === 0) {
39
+ throw new ApiError(response.message || "C\xF3digo inv\xE1lido", "CONFIRM_2FA_FAILED", 400);
40
+ }
41
+ return response;
42
+ }
43
+ async verify(code) {
44
+ const response = await this.request("verify", { code });
45
+ if (response.status === 0) {
46
+ throw new ApiError(response.message || "C\xF3digo inv\xE1lido", "VERIFY_2FA_FAILED", 400);
47
+ }
48
+ return response;
49
+ }
50
+ async disable() {
51
+ const { id, token } = await findWhitelabel();
52
+ const { id_account, id_user } = await getUserContext();
53
+ const url = `${TWO_FA_BASE_URL}/v1/${id}/account/${id_account}/users/${id_user}/2fa`;
54
+ const response = await fetch(url, {
55
+ method: "DELETE",
56
+ headers: { authorization: token }
57
+ });
58
+ if (!response.ok) {
59
+ const errorData = await response.json().catch(() => ({}));
60
+ throw new ApiError(
61
+ errorData.message || `HTTP error ${response.status}`,
62
+ "HTTP_ERROR",
63
+ response.status
64
+ );
65
+ }
66
+ const data = await response.json();
67
+ if (data.status === 0) {
68
+ throw new ApiError(data.message || "Erro ao desabilitar 2FA", "DISABLE_2FA_FAILED", 400);
69
+ }
70
+ return data;
71
+ }
72
+ }
73
+ const twoFactorService = new TwoFactorService();
74
+ export {
75
+ twoFactorService
76
+ };
77
+ //# sourceMappingURL=two-factor.service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/accounts/services/two-factor.service.ts"],"sourcesContent":["import 'server-only';\r\n\r\nimport { ApiError } from '../../../infra/api/types';\r\nimport { getUserContext } from '../../auth/utils/get-user-context';\r\nimport { findWhitelabel } from '../../whitelabel/actions/find-whitelabel.action';\r\nimport type { TwoFactorActionResponse, TwoFactorGenerateResponse } from '../types';\r\n\r\nconst TWO_FA_BASE_URL = process.env.R2_2FA_URL || 'https://r2-2fa.greatapps.dev.br';\r\n\r\nclass TwoFactorService {\r\n private async request<T>(path: string, body?: object): Promise<T> {\r\n const { id, token } = await findWhitelabel();\r\n const { id_account, id_user } = await getUserContext();\r\n\r\n const url = `${TWO_FA_BASE_URL}/v1/${id}/account/${id_account}/users/${id_user}/2fa/${path}`;\r\n\r\n const response = await fetch(url, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n authorization: token,\r\n },\r\n body: body ? JSON.stringify(body) : undefined,\r\n });\r\n\r\n if (!response.ok) {\r\n const errorData = await response.json().catch(() => ({})) as Record<string, unknown>;\r\n throw new ApiError(\r\n (errorData.message as string) || `HTTP error ${response.status}`,\r\n 'HTTP_ERROR',\r\n response.status\r\n );\r\n }\r\n\r\n return response.json() as Promise<T>;\r\n }\r\n\r\n async generate(): Promise<TwoFactorGenerateResponse> {\r\n const response = await this.request<TwoFactorGenerateResponse>('generate');\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(response.message || 'Erro ao gerar QR Code', 'GENERATE_2FA_FAILED', 400);\r\n }\r\n\r\n return response;\r\n }\r\n\r\n async confirm(code: string): Promise<TwoFactorActionResponse> {\r\n const response = await this.request<TwoFactorActionResponse>('confirm', { code });\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(response.message || 'Código inválido', 'CONFIRM_2FA_FAILED', 400);\r\n }\r\n\r\n return response;\r\n }\r\n\r\n async verify(code: string): Promise<TwoFactorActionResponse> {\r\n const response = await this.request<TwoFactorActionResponse>('verify', { code });\r\n\r\n if (response.status === 0) {\r\n throw new ApiError(response.message || 'Código inválido', 'VERIFY_2FA_FAILED', 400);\r\n }\r\n\r\n return response;\r\n }\r\n\r\n async disable(): Promise<TwoFactorActionResponse> {\r\n const { id, token } = await findWhitelabel();\r\n const { id_account, id_user } = await getUserContext();\r\n\r\n const url = `${TWO_FA_BASE_URL}/v1/${id}/account/${id_account}/users/${id_user}/2fa`;\r\n\r\n const response = await fetch(url, {\r\n method: 'DELETE',\r\n headers: { authorization: token },\r\n });\r\n\r\n if (!response.ok) {\r\n const errorData = await response.json().catch(() => ({})) as Record<string, unknown>;\r\n throw new ApiError(\r\n (errorData.message as string) || `HTTP error ${response.status}`,\r\n 'HTTP_ERROR',\r\n response.status\r\n );\r\n }\r\n\r\n const data = await response.json() as TwoFactorActionResponse;\r\n\r\n if (data.status === 0) {\r\n throw new ApiError(data.message || 'Erro ao desabilitar 2FA', 'DISABLE_2FA_FAILED', 400);\r\n }\r\n\r\n return data;\r\n }\r\n}\r\n\r\nexport const twoFactorService = new TwoFactorService();\r\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAG/B,MAAM,kBAAkB,QAAQ,IAAI,cAAc;AAElD,MAAM,iBAAiB;AAAA,EACrB,MAAc,QAAW,MAAc,MAA2B;AAChE,UAAM,EAAE,IAAI,MAAM,IAAI,MAAM,eAAe;AAC3C,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AAErD,UAAM,MAAM,GAAG,eAAe,OAAO,EAAE,YAAY,UAAU,UAAU,OAAO,QAAQ,IAAI;AAE1F,UAAM,WAAW,MAAM,MAAM,KAAK;AAAA,MAChC,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,eAAe;AAAA,MACjB;AAAA,MACA,MAAM,OA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,CAAC,SAAS,IAAI;AAChB,YAAM,YAAY,MAAM,SAAS,KAAK,EAAE,MAAM,OAAO,CAAC,EAAE;AACxD,YAAM,IAAI;AAAA,QACP,UAAU,WAAsB,cAAc,SAAS,MAAM;AAAA,QAC9D;AAAA,QACA,SAAS;AAAA,MACX;AAAA,IACF;AAEA,UAAM,OAAO,MAAM,SAAS,KAAK;AAEjC,QAAI,KAAK,WAAW,GAAG;AACrB,YAAM,IAAI,SAAS,KAAK,WAAW,2BAA2B,sBAAsB,GAAG;AAAA,IACzF;AAEA,WAAO;AAAA,EACT;AACF;AAEO,MAAM,mBAAmB,IAAI,iBAAiB;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1,14 @@
1
+ "use server";
2
+ import { safeServerAction } from "../../../utils/safeServerAction";
3
+ import { authService } from "../services/auth.service";
4
+ import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
5
+ async function loginAction(credentials) {
6
+ return safeServerAction(async () => {
7
+ const clientInfo = await getClientInfoFromRequest();
8
+ return authService.login(credentials, clientInfo);
9
+ });
10
+ }
11
+ export {
12
+ loginAction
13
+ };
14
+ //# sourceMappingURL=login.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/auth/actions/login.action.ts"],"sourcesContent":["\"use server\";\r\n\r\nimport { safeServerAction } from \"../../../utils/safeServerAction\";\r\nimport { authService } from \"../services/auth.service\";\r\nimport { LoginRequest } from \"../schema\";\r\nimport { getClientInfoFromRequest } from \"../../../infra/utils/client-info\";\r\n\r\nexport async function loginAction(credentials: LoginRequest) {\r\n return safeServerAction(async () => {\r\n const clientInfo = await getClientInfoFromRequest();\r\n return authService.login(credentials, clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAE5B,SAAS,gCAAgC;AAEzC,eAAsB,YAAY,aAA2B;AAC3D,SAAO,iBAAiB,YAAY;AAClC,UAAM,aAAa,MAAM,yBAAyB;AAClD,WAAO,YAAY,MAAM,aAAa,UAAU;AAAA,EAClD,CAAC;AACH;","names":[]}
@@ -0,0 +1,14 @@
1
+ "use server";
2
+ import { safeServerAction } from "../../../utils/safeServerAction";
3
+ import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
4
+ import { authService } from "../services/auth.service";
5
+ async function logoutAction() {
6
+ return safeServerAction(async () => {
7
+ const clientInfo = await getClientInfoFromRequest();
8
+ return authService.logout(clientInfo);
9
+ });
10
+ }
11
+ export {
12
+ logoutAction
13
+ };
14
+ //# sourceMappingURL=logout.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/auth/actions/logout.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { safeServerAction } from '../../../utils/safeServerAction';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\nimport { authService } from '../services/auth.service';\r\n\r\nexport async function logoutAction() {\r\n return safeServerAction(async () => {\r\n const clientInfo = await getClientInfoFromRequest();\r\n return authService.logout(clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,mBAAmB;AAE5B,eAAsB,eAAe;AACnC,SAAO,iBAAiB,YAAY;AAClC,UAAM,aAAa,MAAM,yBAAyB;AAClD,WAAO,YAAY,OAAO,UAAU;AAAA,EACtC,CAAC;AACH;","names":[]}
@@ -0,0 +1,14 @@
1
+ "use server";
2
+ import { safeServerAction } from "../../../utils/safeServerAction";
3
+ import { authService } from "../services/auth.service";
4
+ import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
5
+ async function registerAction(data) {
6
+ return safeServerAction(async () => {
7
+ const clientInfo = await getClientInfoFromRequest();
8
+ return authService.register(data, clientInfo);
9
+ });
10
+ }
11
+ export {
12
+ registerAction
13
+ };
14
+ //# sourceMappingURL=register.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/auth/actions/register.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { safeServerAction } from '../../../utils/safeServerAction';\r\nimport { RegisterRequest } from '../schema';\r\nimport { authService } from '../services/auth.service';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\n\r\nexport async function registerAction(data: RegisterRequest) {\r\n return safeServerAction(async () => {\r\n const clientInfo = await getClientInfoFromRequest();\r\n return authService.register(data, clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AAEjC,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AAEzC,eAAsB,eAAe,MAAuB;AAC1D,SAAO,iBAAiB,YAAY;AAClC,UAAM,aAAa,MAAM,yBAAyB;AAClD,WAAO,YAAY,SAAS,MAAM,UAAU;AAAA,EAC9C,CAAC;AACH;","names":[]}
@@ -1,15 +1,8 @@
1
- "use client";
2
1
  "use server";
3
- import {
4
- authService,
5
- getClientInfoFromRequest
6
- } from "./chunk-I26OTCGJ.mjs";
7
- import "./chunk-R2FMWFY6.mjs";
8
- import "./chunk-4IBSIBU6.mjs";
9
-
10
- // src/modules/auth/actions/validate-session.action.ts
11
2
  import { redirect } from "next/navigation";
12
3
  import { cookies, headers } from "next/headers";
4
+ import { authService } from "../services/auth.service";
5
+ import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
13
6
  async function redirectToLogin() {
14
7
  const h = await headers();
15
8
  const referer = h.get("referer") || "/";
@@ -50,4 +43,4 @@ async function validateSessionAction() {
50
43
  export {
51
44
  validateSessionAction
52
45
  };
53
- //# sourceMappingURL=validate-session.action-TMZN36SG.mjs.map
46
+ //# sourceMappingURL=validate-session.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/auth/actions/validate-session.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { redirect } from 'next/navigation';\r\nimport { cookies, headers } from 'next/headers';\r\nimport { authService } from '../services/auth.service';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\n\r\nasync function redirectToLogin() {\r\n const h = await headers();\r\n const referer = h.get('referer') || '/';\r\n\r\n if (!referer) {\r\n redirect('/login');\r\n return;\r\n }\r\n\r\n const url = new URL(referer);\r\n\r\n if (['/login', '/register', '/forgot-password'].includes(url.pathname)) {\r\n return;\r\n }\r\n\r\n redirect('/login');\r\n}\r\n\r\nexport async function validateSessionAction(): Promise<boolean> {\r\n if (process.env.DUMMY_AUTH_TOKEN) return true;\r\n\r\n const cookieStore = await cookies();\r\n const cookie = cookieStore.get('greatapps')?.value;\r\n\r\n if (!cookie) {\r\n await redirectToLogin();\r\n return false;\r\n }\r\n\r\n try {\r\n const clientInfo = await getClientInfoFromRequest();\r\n const isValid = await authService.validateSession(clientInfo);\r\n\r\n if (!isValid) {\r\n await authService.removeAuthCookie();\r\n await redirectToLogin();\r\n return false;\r\n }\r\n\r\n return true;\r\n } catch (error) {\r\n console.error('[validateSessionAction] Error:', error);\r\n await authService.removeAuthCookie();\r\n await redirectToLogin();\r\n return false;\r\n }\r\n}\r\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,SAAS,eAAe;AACjC,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AAEzC,eAAe,kBAAkB;AAC/B,QAAM,IAAI,MAAM,QAAQ;AACxB,QAAM,UAAU,EAAE,IAAI,SAAS,KAAK;AAEpC,MAAI,CAAC,SAAS;AACZ,aAAS,QAAQ;AACjB;AAAA,EACF;AAEA,QAAM,MAAM,IAAI,IAAI,OAAO;AAE3B,MAAI,CAAC,UAAU,aAAa,kBAAkB,EAAE,SAAS,IAAI,QAAQ,GAAG;AACtE;AAAA,EACF;AAEA,WAAS,QAAQ;AACnB;AAEA,eAAsB,wBAA0C;AAC9D,MAAI,QAAQ,IAAI,iBAAkB,QAAO;AAEzC,QAAM,cAAc,MAAM,QAAQ;AAClC,QAAM,SAAS,YAAY,IAAI,WAAW,GAAG;AAE7C,MAAI,CAAC,QAAQ;AACX,UAAM,gBAAgB;AACtB,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,aAAa,MAAM,yBAAyB;AAClD,UAAM,UAAU,MAAM,YAAY,gBAAgB,UAAU;AAE5D,QAAI,CAAC,SAAS;AACZ,YAAM,YAAY,iBAAiB;AACnC,YAAM,gBAAgB;AACtB,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,kCAAkC,KAAK;AACrD,UAAM,YAAY,iBAAiB;AACnC,UAAM,gBAAgB;AACtB,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,16 +1,7 @@
1
- "use client";
2
1
  "use server";
3
- import {
4
- safeServerAction
5
- } from "./chunk-MXQIEEP6.mjs";
6
- import {
7
- authService,
8
- getClientInfoFromRequest
9
- } from "./chunk-I26OTCGJ.mjs";
10
- import "./chunk-R2FMWFY6.mjs";
11
- import "./chunk-4IBSIBU6.mjs";
12
-
13
- // src/modules/auth/actions/verify-two-factor.action.ts
2
+ import { safeServerAction } from "../../../utils/safeServerAction";
3
+ import { authService } from "../services/auth.service";
4
+ import { getClientInfoFromRequest } from "../../../infra/utils/client-info";
14
5
  async function verifyTwoFactorAction(cookie, code) {
15
6
  return safeServerAction(async () => {
16
7
  if (!/^\d{6}$/.test(code)) {
@@ -23,4 +14,4 @@ async function verifyTwoFactorAction(cookie, code) {
23
14
  export {
24
15
  verifyTwoFactorAction
25
16
  };
26
- //# sourceMappingURL=verify-two-factor.action-IQM6SU5U.mjs.map
17
+ //# sourceMappingURL=verify-two-factor.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/auth/actions/verify-two-factor.action.ts"],"sourcesContent":["'use server';\r\n\r\nimport { safeServerAction } from '../../../utils/safeServerAction';\r\nimport { authService } from '../services/auth.service';\r\nimport { getClientInfoFromRequest } from '../../../infra/utils/client-info';\r\n\r\nexport async function verifyTwoFactorAction(cookie: string, code: string) {\r\n return safeServerAction(async () => {\r\n if (!/^\\d{6}$/.test(code)) {\r\n throw new Error('Formato inválido');\r\n }\r\n const clientInfo = await getClientInfoFromRequest();\r\n await authService.verifyTwoFactor(cookie, code, clientInfo);\r\n });\r\n}\r\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AAEzC,eAAsB,sBAAsB,QAAgB,MAAc;AACxE,SAAO,iBAAiB,YAAY;AAClC,QAAI,CAAC,UAAU,KAAK,IAAI,GAAG;AACzB,YAAM,IAAI,MAAM,qBAAkB;AAAA,IACpC;AACA,UAAM,aAAa,MAAM,yBAAyB;AAClD,UAAM,YAAY,gBAAgB,QAAQ,MAAM,UAAU;AAAA,EAC5D,CAAC;AACH;","names":[]}
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { useMutation } from "@tanstack/react-query";
3
+ import { loginAction } from "../actions/login.action";
4
+ function useLogin() {
5
+ return useMutation({
6
+ mutationFn: async (credentials) => {
7
+ const result = await loginAction(credentials);
8
+ if (!result.success) throw new Error(result.error ?? "Erro desconhecido");
9
+ const data = result.data;
10
+ if (data.result === "error") throw new Error(data.message);
11
+ return data;
12
+ }
13
+ });
14
+ }
15
+ export {
16
+ useLogin
17
+ };
18
+ //# sourceMappingURL=login.hook.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/auth/hooks/login.hook.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { loginAction } from \"../actions/login.action\";\nimport { LoginRequest, LoginSuccessResponse } from \"../schema\";\n\nexport function useLogin() {\n return useMutation({\n mutationFn: async (credentials: LoginRequest): Promise<LoginSuccessResponse> => {\n const result = await loginAction(credentials);\n if (!result.success) throw new Error(result.error ?? 'Erro desconhecido');\n const data = result.data!;\n if (data.result === 'error') throw new Error(data.message);\n return data as LoginSuccessResponse;\n },\n });\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAGrB,SAAS,WAAW;AACzB,SAAO,YAAY;AAAA,IACjB,YAAY,OAAO,gBAA6D;AAC9E,YAAM,SAAS,MAAM,YAAY,WAAW;AAC5C,UAAI,CAAC,OAAO,QAAS,OAAM,IAAI,MAAM,OAAO,SAAS,mBAAmB;AACxE,YAAM,OAAO,OAAO;AACpB,UAAI,KAAK,WAAW,QAAS,OAAM,IAAI,MAAM,KAAK,OAAO;AACzD,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { useMutation } from "@tanstack/react-query";
3
+ import { logoutAction } from "../actions/logout.action";
4
+ import { withAction } from "../../../utils/withAction";
5
+ function useLogout() {
6
+ return useMutation({
7
+ mutationFn: withAction(logoutAction)
8
+ });
9
+ }
10
+ export {
11
+ useLogout
12
+ };
13
+ //# sourceMappingURL=logout.hook.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/auth/hooks/logout.hook.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { logoutAction } from \"../actions/logout.action\";\nimport { withAction } from \"../../../utils/withAction\";\n\nexport function useLogout() {\n return useMutation({\n mutationFn: withAction(logoutAction),\n });\n}\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAEpB,SAAS,YAAY;AAC1B,SAAO,YAAY;AAAA,IACjB,YAAY,WAAW,YAAY;AAAA,EACrC,CAAC;AACH;","names":[]}