@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,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":[]}
@@ -0,0 +1,180 @@
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 { fileToBase64 } from "../../../utils/file/index";
7
+ class AccountService {
8
+ async findCurrentAccount() {
9
+ const { id_account } = await getUserContext();
10
+ const response = await api.apps.get(`/accounts/${id_account}`);
11
+ if (response.status === 0 || !response.data?.[0]) {
12
+ throw new ApiError(
13
+ response.message || "Erro ao buscar dados da conta",
14
+ "GET_ACCOUNT_FAILED",
15
+ 400
16
+ );
17
+ }
18
+ return response.data[0];
19
+ }
20
+ async listAccountUsers(params) {
21
+ const { id_account } = await getUserContext();
22
+ const queryParams = buildQueryParams(params);
23
+ const endpoint = `/accounts/${id_account}/users?${queryParams}`;
24
+ const response = await api.apps.get(endpoint);
25
+ if (response.status === 0) {
26
+ throw new ApiError(
27
+ response.message || "Erro ao listar usu\xE1rios",
28
+ "LIST_ACCOUNT_USERS_FAILED",
29
+ 400
30
+ );
31
+ }
32
+ return {
33
+ users: response.data || [],
34
+ total: response.total || 0
35
+ };
36
+ }
37
+ async changeUserPhoto(userId, photo) {
38
+ const { id_account } = await getUserContext();
39
+ const base64 = await fileToBase64(photo);
40
+ const response = await api.apps.put(
41
+ `/accounts/${id_account}/users/${userId}/file/photo`,
42
+ { file: base64 }
43
+ );
44
+ if (response.status === 0) {
45
+ throw new ApiError(
46
+ response.message || "Erro ao mudar foto do usu\xE1rio",
47
+ "CHANGE_USER_PHOTO_FAILED",
48
+ 400
49
+ );
50
+ }
51
+ return response;
52
+ }
53
+ async deleteAccountUser(userId) {
54
+ const { id_account } = await getUserContext();
55
+ const response = await api.apps.delete(
56
+ `/accounts/${id_account}/users/${userId}`
57
+ );
58
+ if (response.status === 0) {
59
+ throw new ApiError(response.message || "Erro ao deletar usu\xE1rio", "DELETE_USER_FAILED", 400);
60
+ }
61
+ return response;
62
+ }
63
+ async deleteAccount() {
64
+ const { id_account } = await getUserContext();
65
+ const response = await api.apps.delete(`/accounts/${id_account}`);
66
+ if (response.status === 0) {
67
+ throw new ApiError(response.message || "Erro ao deletar conta", "DELETE_ACCOUNT_FAILED", 400);
68
+ }
69
+ return response;
70
+ }
71
+ async createAccountUser(user) {
72
+ const { id_account } = await getUserContext();
73
+ const response = await api.apps.post(
74
+ `/accounts/${id_account}/users`,
75
+ {
76
+ ...user,
77
+ photo: user.photo ? await fileToBase64(user.photo) : null
78
+ }
79
+ );
80
+ if (response.status === 0) {
81
+ throw new ApiError(response.message || "Erro ao criar usu\xE1rio", "CREATE_USER_FAILED", 400);
82
+ }
83
+ return response;
84
+ }
85
+ async resolvePhotoField(user) {
86
+ if (user.photo === void 0) return {};
87
+ const photo = user.photo != null && typeof user.photo !== "string" ? await fileToBase64(user.photo) : user.photo;
88
+ return { photo };
89
+ }
90
+ async updateAccountUser(user) {
91
+ const { id_account, id_user } = await getUserContext();
92
+ const response = await api.apps.put(
93
+ `/accounts/${id_account}/users/${id_user}`,
94
+ { ...user, ...await this.resolvePhotoField(user) }
95
+ );
96
+ if (response.status === 0) {
97
+ throw new ApiError(
98
+ response.message || "Erro ao atualizar usu\xE1rio",
99
+ "UPDATE_USER_FAILED",
100
+ 400
101
+ );
102
+ }
103
+ return response;
104
+ }
105
+ async updateAccountUserById(userId, user) {
106
+ const { id_account } = await getUserContext();
107
+ const response = await api.apps.put(
108
+ `/accounts/${id_account}/users/${userId}`,
109
+ { ...user, ...await this.resolvePhotoField(user) }
110
+ );
111
+ if (response.status === 0) {
112
+ throw new ApiError(
113
+ response.message || "Erro ao atualizar usu\xE1rio",
114
+ "UPDATE_USER_FAILED",
115
+ 400
116
+ );
117
+ }
118
+ return response;
119
+ }
120
+ async updateAccount(data) {
121
+ const { id_account } = await getUserContext();
122
+ const response = await api.apps.put(`/accounts/${id_account}`, data);
123
+ if (response.status === 0) {
124
+ throw new ApiError(
125
+ response.message || "Erro ao atualizar conta",
126
+ "UPDATE_ACCOUNT_FAILED",
127
+ 400
128
+ );
129
+ }
130
+ return response;
131
+ }
132
+ async requestContactReset(type, newContact, ddi) {
133
+ const { id_account, id_user } = await getUserContext();
134
+ const response = await api.apps.post(
135
+ `/accounts/${id_account}/users/${id_user}/resetContact/request`,
136
+ { type, newContact, ...ddi ? { ddi } : {} }
137
+ );
138
+ if (response.status === 0) {
139
+ throw new ApiError(
140
+ response.message || "Erro ao solicitar altera\xE7\xE3o",
141
+ "REQUEST_CONTACT_RESET_FAILED",
142
+ 400
143
+ );
144
+ }
145
+ }
146
+ async confirmContactReset(type, token, newContact, ddi) {
147
+ const { id_account, id_user } = await getUserContext();
148
+ const response = await api.apps.post(
149
+ `/accounts/${id_account}/users/${id_user}/resetContact/confirm`,
150
+ { type, token, newContact, ...ddi ? { ddi } : {} }
151
+ );
152
+ if (response.status === 0) {
153
+ throw new ApiError(
154
+ response.message || "C\xF3digo inv\xE1lido ou expirado",
155
+ "CONFIRM_CONTACT_RESET_FAILED",
156
+ 400
157
+ );
158
+ }
159
+ }
160
+ async changePassword(data) {
161
+ const { id_account, id_user } = await getUserContext();
162
+ const response = await api.apps.put(
163
+ `/accounts/${id_account}/users/${id_user}/action/changePassword`,
164
+ data
165
+ );
166
+ if (response.status === 0) {
167
+ throw new ApiError(
168
+ response.message || "Erro ao alterar senha",
169
+ "CHANGE_PASSWORD_FAILED",
170
+ 400
171
+ );
172
+ }
173
+ return response;
174
+ }
175
+ }
176
+ const accountService = new AccountService();
177
+ export {
178
+ accountService
179
+ };
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, ddi?: 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, ...(ddi ? { ddi } : {}) }\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, ddi?: 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, ...(ddi ? { ddi } : {}) }\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 'CHANGE_PASSWORD_FAILED',\n 400\n );\n }\n\n return response;\n }\n}\n\nexport const accountService = new AccountService();\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAmB7B,MAAM,eAAe;AAAA,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,YAAoB,KAA6B;AACjH,UAAM,EAAE,YAAY,QAAQ,IAAI,MAAM,eAAe;AACrD,UAAM,WAAW,MAAM,IAAI,KAAK;AAAA,MAC9B,aAAa,UAAU,UAAU,OAAO;AAAA,MACxC,EAAE,MAAM,OAAO,YAAY,GAAI,MAAM,EAAE,IAAI,IAAI,CAAC,EAAG;AAAA,IACrD;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,EAC3F,EAAE,OAAO,sBAAsB,OAAO,8BAA8B,cAAc,qBAAqB;AAAA,EACvG,EAAE,OAAO,oBAAoB,OAAO,4BAA4B,cAAc,mBAAmB;AAAA,EACj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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,OAAO,KAAK,UAAU,IAAI,IAAI;AAAA,IACtC,CAAC;AAED,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,YAAY,MAAM,SAAS,KAAK,EAAE,MAAM,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AsB,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 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","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 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":[]}