@greatapps/common 1.1.429 → 1.1.430

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 (477) 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 +129 -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 +182 -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 +91 -0
  24. package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -0
  25. package/dist/components/account/hooks/useConfigurationsModal.mjs +34 -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 +192 -0
  38. package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -0
  39. package/dist/components/account/sections/MyProfileSection.mjs +317 -0
  40. package/dist/components/account/sections/MyProfileSection.mjs.map +1 -0
  41. package/dist/components/account/sections/PreferencesSection.mjs +227 -0
  42. package/dist/components/account/sections/PreferencesSection.mjs.map +1 -0
  43. package/dist/components/account/sections/SecuritySection.mjs +31 -0
  44. package/dist/components/account/sections/SecuritySection.mjs.map +1 -0
  45. package/dist/components/embeds/CrispEmbed.mjs +89 -0
  46. package/dist/components/embeds/CrispEmbed.mjs.map +1 -0
  47. package/dist/components/embeds/FrillEmbed.mjs +107 -0
  48. package/dist/components/embeds/FrillEmbed.mjs.map +1 -0
  49. package/dist/components/handlers/SearchParamsHandler.mjs +24 -0
  50. package/dist/components/handlers/SearchParamsHandler.mjs.map +1 -0
  51. package/dist/components/layouts/AppMobileNavBar.mjs +60 -0
  52. package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -0
  53. package/dist/components/layouts/AppNavBar.mjs +37 -0
  54. package/dist/components/layouts/AppNavBar.mjs.map +1 -0
  55. package/dist/components/layouts/CollapsibleSidebar.mjs +65 -0
  56. package/dist/components/layouts/CollapsibleSidebar.mjs.map +1 -0
  57. package/dist/components/layouts/MainLayout.mjs +60 -0
  58. package/dist/components/layouts/MainLayout.mjs.map +1 -0
  59. package/dist/components/layouts/MdSideBarNavigation.mjs +54 -0
  60. package/dist/components/layouts/MdSideBarNavigation.mjs.map +1 -0
  61. package/dist/components/layouts/NavBar.mjs +152 -0
  62. package/dist/components/layouts/NavBar.mjs.map +1 -0
  63. package/dist/components/layouts/NavBarItem.mjs +23 -0
  64. package/dist/components/layouts/NavBarItem.mjs.map +1 -0
  65. package/dist/components/layouts/NotificationsPopover.mjs +97 -0
  66. package/dist/components/layouts/NotificationsPopover.mjs.map +1 -0
  67. package/dist/components/layouts/ProfilePopover.mjs +152 -0
  68. package/dist/components/layouts/ProfilePopover.mjs.map +1 -0
  69. package/dist/components/layouts/SideBarNavigation.mjs +63 -0
  70. package/dist/components/layouts/SideBarNavigation.mjs.map +1 -0
  71. package/dist/components/layouts/UsersSelectorPopover.mjs +210 -0
  72. package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -0
  73. package/dist/components/layouts/WhitelabelCodes.mjs +50 -0
  74. package/dist/components/layouts/WhitelabelCodes.mjs.map +1 -0
  75. package/dist/components/modals/BuyCreditsModal.mjs +281 -0
  76. package/dist/components/modals/BuyCreditsModal.mjs.map +1 -0
  77. package/dist/components/modals/ModalManager.mjs +19 -0
  78. package/dist/components/modals/ModalManager.mjs.map +1 -0
  79. package/dist/components/modals/Modals.mjs +20 -0
  80. package/dist/components/modals/Modals.mjs.map +1 -0
  81. package/dist/components/modals/PaidPlanRequiredModal.mjs +46 -0
  82. package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -0
  83. package/dist/components/modals/cards/AddCardModal.mjs +215 -0
  84. package/dist/components/modals/cards/AddCardModal.mjs.map +1 -0
  85. package/dist/components/modals/cards/CardFormFields.mjs +268 -0
  86. package/dist/components/modals/cards/CardFormFields.mjs.map +1 -0
  87. package/dist/components/navigation/AppNavigation.mjs +33 -0
  88. package/dist/components/navigation/AppNavigation.mjs.map +1 -0
  89. package/dist/components/navigation/AppNavigationContext.mjs +13 -0
  90. package/dist/components/navigation/AppNavigationContext.mjs.map +1 -0
  91. package/dist/components/navigation/CancelledSubscriptionBanner.mjs +52 -0
  92. package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -0
  93. package/dist/components/navigation/NavItem.mjs +41 -0
  94. package/dist/components/navigation/NavItem.mjs.map +1 -0
  95. package/dist/components/navigation/NavItemsContext.mjs +16 -0
  96. package/dist/components/navigation/NavItemsContext.mjs.map +1 -0
  97. package/dist/components/navigation/ProjectSelectorPopover.mjs +147 -0
  98. package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -0
  99. package/dist/components/navigation/shells/DesktopShell.mjs +11 -0
  100. package/dist/components/navigation/shells/DesktopShell.mjs.map +1 -0
  101. package/dist/components/navigation/shells/MdShell.mjs +11 -0
  102. package/dist/components/navigation/shells/MdShell.mjs.map +1 -0
  103. package/dist/components/navigation/shells/MobileShell.mjs +27 -0
  104. package/dist/components/navigation/shells/MobileShell.mjs.map +1 -0
  105. package/dist/components/navigation/shells/TabsMobileShell.mjs +61 -0
  106. package/dist/components/navigation/shells/TabsMobileShell.mjs.map +1 -0
  107. package/dist/components/navigation/subcomponents/BottomLinks.mjs +35 -0
  108. package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +1 -0
  109. package/dist/components/navigation/subcomponents/CreditsCard.mjs +33 -0
  110. package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -0
  111. package/dist/components/navigation/subcomponents/NavItems.mjs +25 -0
  112. package/dist/components/navigation/subcomponents/NavItems.mjs.map +1 -0
  113. package/dist/components/navigation/subcomponents/PlanCard.mjs +25 -0
  114. package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -0
  115. package/dist/components/navigation/subcomponents/ProjectSelector.mjs +145 -0
  116. package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -0
  117. package/dist/components/navigation/types.mjs +1 -0
  118. package/dist/components/navigation/types.mjs.map +1 -0
  119. package/dist/components/pages/NotFoundPage.mjs +47 -0
  120. package/dist/components/pages/NotFoundPage.mjs.map +1 -0
  121. package/dist/components/pages/notifications/Notifications.mjs +159 -0
  122. package/dist/components/pages/notifications/Notifications.mjs.map +1 -0
  123. package/dist/components/ui/buttons/Button.mjs +52 -0
  124. package/dist/components/ui/buttons/Button.mjs.map +1 -0
  125. package/dist/components/ui/buttons/CancelButton.mjs +17 -0
  126. package/dist/components/ui/buttons/CancelButton.mjs.map +1 -0
  127. package/dist/components/ui/buttons/CopyButton.mjs +42 -0
  128. package/dist/components/ui/buttons/CopyButton.mjs.map +1 -0
  129. package/dist/components/ui/data-display/Accordion.mjs +76 -0
  130. package/dist/components/ui/data-display/Accordion.mjs.map +1 -0
  131. package/dist/components/ui/data-display/Badge.mjs +42 -0
  132. package/dist/components/ui/data-display/Badge.mjs.map +1 -0
  133. package/dist/components/ui/data-display/Card.mjs +92 -0
  134. package/dist/components/ui/data-display/Card.mjs.map +1 -0
  135. package/dist/components/ui/data-display/CardBrandIcons.mjs +484 -0
  136. package/dist/components/ui/data-display/CardBrandIcons.mjs.map +1 -0
  137. package/dist/components/ui/data-display/CardItem.mjs +67 -0
  138. package/dist/components/ui/data-display/CardItem.mjs.map +1 -0
  139. package/dist/components/ui/data-display/Pagination.mjs +118 -0
  140. package/dist/components/ui/data-display/Pagination.mjs.map +1 -0
  141. package/dist/components/ui/data-display/PaymentInfoCard.mjs +161 -0
  142. package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -0
  143. package/dist/components/ui/data-display/ScrollArea.mjs +62 -0
  144. package/dist/components/ui/data-display/ScrollArea.mjs.map +1 -0
  145. package/dist/components/ui/data-display/Separator.mjs +28 -0
  146. package/dist/components/ui/data-display/Separator.mjs.map +1 -0
  147. package/dist/components/ui/data-display/Table.mjs +116 -0
  148. package/dist/components/ui/data-display/Table.mjs.map +1 -0
  149. package/dist/components/ui/data-display/Tabs.mjs +69 -0
  150. package/dist/components/ui/data-display/Tabs.mjs.map +1 -0
  151. package/dist/components/ui/data-display/UserAvatar.mjs +49 -0
  152. package/dist/components/ui/data-display/UserAvatar.mjs.map +1 -0
  153. package/dist/components/ui/feedback/CircularProgress.mjs +71 -0
  154. package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -0
  155. package/dist/components/ui/feedback/DefaultCircularProgress.mjs +63 -0
  156. package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -0
  157. package/dist/components/ui/feedback/LoadingOverlay.mjs +19 -0
  158. package/dist/components/ui/feedback/LoadingOverlay.mjs.map +1 -0
  159. package/dist/components/ui/feedback/Progress.mjs +37 -0
  160. package/dist/components/ui/feedback/Progress.mjs.map +1 -0
  161. package/dist/components/ui/feedback/Skeleton.mjs +9 -0
  162. package/dist/components/ui/feedback/Skeleton.mjs.map +1 -0
  163. package/dist/components/ui/feedback/Toast.mjs +77 -0
  164. package/dist/components/ui/feedback/Toast.mjs.map +1 -0
  165. package/dist/components/ui/form/Calendar.mjs +204 -0
  166. package/dist/components/ui/form/Calendar.mjs.map +1 -0
  167. package/dist/components/ui/form/Checkbox.mjs +33 -0
  168. package/dist/components/ui/form/Checkbox.mjs.map +1 -0
  169. package/dist/components/ui/form/ComboboxField.mjs +130 -0
  170. package/dist/components/ui/form/ComboboxField.mjs.map +1 -0
  171. package/dist/components/ui/form/DatePicker.mjs +82 -0
  172. package/dist/components/ui/form/DatePicker.mjs.map +1 -0
  173. package/dist/components/ui/form/DateRangePicker.mjs +92 -0
  174. package/dist/components/ui/form/DateRangePicker.mjs.map +1 -0
  175. package/dist/components/ui/form/FormField.mjs +103 -0
  176. package/dist/components/ui/form/FormField.mjs.map +1 -0
  177. package/dist/components/ui/form/Input.mjs +21 -0
  178. package/dist/components/ui/form/Input.mjs.map +1 -0
  179. package/dist/components/ui/form/InputOtp.mjs +70 -0
  180. package/dist/components/ui/form/InputOtp.mjs.map +1 -0
  181. package/dist/components/ui/form/PhoneInput.mjs +176 -0
  182. package/dist/components/ui/form/PhoneInput.mjs.map +1 -0
  183. package/dist/components/ui/form/RadioGroup.mjs +37 -0
  184. package/dist/components/ui/form/RadioGroup.mjs.map +1 -0
  185. package/dist/components/ui/form/Select.mjs +179 -0
  186. package/dist/components/ui/form/Select.mjs.map +1 -0
  187. package/dist/components/ui/form/SelectField.mjs +80 -0
  188. package/dist/components/ui/form/SelectField.mjs.map +1 -0
  189. package/dist/components/ui/form/Switch.mjs +33 -0
  190. package/dist/components/ui/form/Switch.mjs.map +1 -0
  191. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs +40 -0
  192. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs.map +1 -0
  193. package/dist/components/ui/form/TextAreaField.mjs +56 -0
  194. package/dist/components/ui/form/TextAreaField.mjs.map +1 -0
  195. package/dist/components/ui/form/Textarea.mjs +20 -0
  196. package/dist/components/ui/form/Textarea.mjs.map +1 -0
  197. package/dist/components/ui/overlay/Command.mjs +178 -0
  198. package/dist/components/ui/overlay/Command.mjs.map +1 -0
  199. package/dist/components/ui/overlay/Dialog.mjs +142 -0
  200. package/dist/components/ui/overlay/Dialog.mjs.map +1 -0
  201. package/dist/components/ui/overlay/Popover.mjs +46 -0
  202. package/dist/components/ui/overlay/Popover.mjs.map +1 -0
  203. package/dist/components/ui/overlay/Sheet.mjs +149 -0
  204. package/dist/components/ui/overlay/Sheet.mjs.map +1 -0
  205. package/dist/components/ui/overlay/Tooltip.mjs +57 -0
  206. package/dist/components/ui/overlay/Tooltip.mjs.map +1 -0
  207. package/dist/components/widgets/notifications/NotificationCard.mjs +54 -0
  208. package/dist/components/widgets/notifications/NotificationCard.mjs.map +1 -0
  209. package/dist/enums/AccountSectionType.mjs +11 -0
  210. package/dist/enums/AccountSectionType.mjs.map +1 -0
  211. package/dist/hooks/copy-to-clipboard.hook.mjs +52 -0
  212. package/dist/hooks/copy-to-clipboard.hook.mjs.map +1 -0
  213. package/dist/hooks/useCountdownTimer.mjs +29 -0
  214. package/dist/hooks/useCountdownTimer.mjs.map +1 -0
  215. package/dist/hooks/useDebounce.mjs +19 -0
  216. package/dist/hooks/useDebounce.mjs.map +1 -0
  217. package/dist/hooks/useDebounceState.mjs +12 -0
  218. package/dist/hooks/useDebounceState.mjs.map +1 -0
  219. package/dist/hooks/useDebouncedEffect.mjs +44 -0
  220. package/dist/hooks/useDebouncedEffect.mjs.map +1 -0
  221. package/dist/hooks/useIsMobile.mjs +18 -0
  222. package/dist/hooks/useIsMobile.mjs.map +1 -0
  223. package/dist/hooks/usePasswordVisibility.mjs +13 -0
  224. package/dist/hooks/usePasswordVisibility.mjs.map +1 -0
  225. package/dist/index.mjs +528 -0
  226. package/dist/index.mjs.map +1 -0
  227. package/dist/infra/api/client.mjs +162 -0
  228. package/dist/infra/api/client.mjs.map +1 -0
  229. package/dist/infra/api/types.mjs +31 -0
  230. package/dist/infra/api/types.mjs.map +1 -0
  231. package/dist/infra/utils/client-info.mjs +27 -0
  232. package/dist/infra/utils/client-info.mjs.map +1 -0
  233. package/dist/infra/utils/clsx.mjs +9 -0
  234. package/dist/infra/utils/clsx.mjs.map +1 -0
  235. package/dist/infra/utils/date.mjs +11 -0
  236. package/dist/infra/utils/date.mjs.map +1 -0
  237. package/dist/infra/utils/params.mjs +21 -0
  238. package/dist/infra/utils/params.mjs.map +1 -0
  239. package/dist/infra/utils/parser.mjs +24 -0
  240. package/dist/infra/utils/parser.mjs.map +1 -0
  241. package/dist/infra/utils/percentage.mjs +20 -0
  242. package/dist/infra/utils/percentage.mjs.map +1 -0
  243. package/dist/middleware.mjs +10 -0
  244. package/dist/middleware.mjs.map +1 -0
  245. package/dist/middlewares/chain.mjs +37 -0
  246. package/dist/middlewares/chain.mjs.map +1 -0
  247. package/dist/middlewares/create-auth-middleware.mjs +32 -0
  248. package/dist/middlewares/create-auth-middleware.mjs.map +1 -0
  249. package/dist/middlewares/types.mjs +11 -0
  250. package/dist/middlewares/types.mjs.map +1 -0
  251. package/dist/modules/accounts/actions/account-management.action.mjs +98 -0
  252. package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -0
  253. package/dist/modules/accounts/actions/find-current-account.action.mjs +10 -0
  254. package/dist/modules/accounts/actions/find-current-account.action.mjs.map +1 -0
  255. package/dist/modules/accounts/actions/list-currencies.action.mjs +10 -0
  256. package/dist/modules/accounts/actions/list-currencies.action.mjs.map +1 -0
  257. package/dist/modules/accounts/actions/list-timezones.action.mjs +10 -0
  258. package/dist/modules/accounts/actions/list-timezones.action.mjs.map +1 -0
  259. package/dist/modules/accounts/hooks/current-account.hook.mjs +24 -0
  260. package/dist/modules/accounts/hooks/current-account.hook.mjs.map +1 -0
  261. package/dist/modules/accounts/hooks/useAccountManagement.mjs +71 -0
  262. package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -0
  263. package/dist/modules/accounts/hooks/useCurrencies.mjs +17 -0
  264. package/dist/modules/accounts/hooks/useCurrencies.mjs.map +1 -0
  265. package/dist/modules/accounts/hooks/useTimezones.mjs +17 -0
  266. package/dist/modules/accounts/hooks/useTimezones.mjs.map +1 -0
  267. package/dist/modules/accounts/hooks/useViaCep.mjs +19 -0
  268. package/dist/modules/accounts/hooks/useViaCep.mjs.map +1 -0
  269. package/dist/modules/accounts/services/account.service.mjs +182 -0
  270. package/dist/modules/accounts/services/account.service.mjs.map +1 -0
  271. package/dist/modules/accounts/services/currency.service.mjs +24 -0
  272. package/dist/modules/accounts/services/currency.service.mjs.map +1 -0
  273. package/dist/modules/accounts/services/timezone.service.mjs +65 -0
  274. package/dist/modules/accounts/services/timezone.service.mjs.map +1 -0
  275. package/dist/modules/accounts/services/two-factor.service.mjs +78 -0
  276. package/dist/modules/accounts/services/two-factor.service.mjs.map +1 -0
  277. package/dist/modules/accounts/types.mjs +1 -0
  278. package/dist/modules/accounts/types.mjs.map +1 -0
  279. package/dist/modules/auth/actions/login.action.mjs +14 -0
  280. package/dist/modules/auth/actions/login.action.mjs.map +1 -0
  281. package/dist/modules/auth/actions/logout.action.mjs +14 -0
  282. package/dist/modules/auth/actions/logout.action.mjs.map +1 -0
  283. package/dist/modules/auth/actions/register.action.mjs +14 -0
  284. package/dist/modules/auth/actions/register.action.mjs.map +1 -0
  285. package/dist/modules/auth/actions/validate-session.action.mjs +48 -0
  286. package/dist/modules/auth/actions/validate-session.action.mjs.map +1 -0
  287. package/dist/modules/auth/actions/verify-two-factor.action.mjs +17 -0
  288. package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +1 -0
  289. package/dist/modules/auth/hooks/login.hook.mjs +13 -0
  290. package/dist/modules/auth/hooks/login.hook.mjs.map +1 -0
  291. package/dist/modules/auth/hooks/logout.hook.mjs +13 -0
  292. package/dist/modules/auth/hooks/logout.hook.mjs.map +1 -0
  293. package/dist/modules/auth/hooks/register.hook.mjs +13 -0
  294. package/dist/modules/auth/hooks/register.hook.mjs.map +1 -0
  295. package/dist/modules/auth/hooks/useManagementPermissions.mjs +41 -0
  296. package/dist/modules/auth/hooks/useManagementPermissions.mjs.map +1 -0
  297. package/dist/modules/auth/hooks/useUserQuery.mjs +63 -0
  298. package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -0
  299. package/dist/modules/auth/schema.mjs +1 -0
  300. package/dist/modules/auth/schema.mjs.map +1 -0
  301. package/dist/modules/auth/services/auth.service.mjs +341 -0
  302. package/dist/modules/auth/services/auth.service.mjs.map +1 -0
  303. package/dist/modules/auth/types/management-permission.type.mjs +1 -0
  304. package/dist/modules/auth/types/management-permission.type.mjs.map +1 -0
  305. package/dist/modules/auth/utils/assert-management-permission.mjs +42 -0
  306. package/dist/modules/auth/utils/assert-management-permission.mjs.map +1 -0
  307. package/dist/modules/auth/utils/assert-management-subscription.mjs +33 -0
  308. package/dist/modules/auth/utils/assert-management-subscription.mjs.map +1 -0
  309. package/dist/modules/auth/utils/assert-paid-subscription.mjs +40 -0
  310. package/dist/modules/auth/utils/assert-paid-subscription.mjs.map +1 -0
  311. package/dist/modules/auth/utils/assert-subscription-addon.mjs +35 -0
  312. package/dist/modules/auth/utils/assert-subscription-addon.mjs.map +1 -0
  313. package/dist/modules/auth/utils/build-wl-override.mjs +27 -0
  314. package/dist/modules/auth/utils/build-wl-override.mjs.map +1 -0
  315. package/dist/modules/auth/utils/get-user-context.mjs +25 -0
  316. package/dist/modules/auth/utils/get-user-context.mjs.map +1 -0
  317. package/dist/modules/cards/actions/create-card.action.mjs +10 -0
  318. package/dist/modules/cards/actions/create-card.action.mjs.map +1 -0
  319. package/dist/modules/cards/actions/list-cards.action.mjs +10 -0
  320. package/dist/modules/cards/actions/list-cards.action.mjs.map +1 -0
  321. package/dist/modules/cards/hooks/cards.hook.mjs +16 -0
  322. package/dist/modules/cards/hooks/cards.hook.mjs.map +1 -0
  323. package/dist/modules/cards/hooks/create-card.hook.mjs +18 -0
  324. package/dist/modules/cards/hooks/create-card.hook.mjs.map +1 -0
  325. package/dist/modules/cards/services/cards.service.mjs +44 -0
  326. package/dist/modules/cards/services/cards.service.mjs.map +1 -0
  327. package/dist/modules/cards/types.mjs +27 -0
  328. package/dist/modules/cards/types.mjs.map +1 -0
  329. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs +10 -0
  330. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs.map +1 -0
  331. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +76 -0
  332. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +1 -0
  333. package/dist/modules/ia-credits/services/ia-credits.service.mjs +31 -0
  334. package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +1 -0
  335. package/dist/modules/ia-credits/types.mjs +25 -0
  336. package/dist/modules/ia-credits/types.mjs.map +1 -0
  337. package/dist/modules/plans/actions/find-plan-by-id.action.mjs +10 -0
  338. package/dist/modules/plans/actions/find-plan-by-id.action.mjs.map +1 -0
  339. package/dist/modules/plans/hooks/use-has-plan-addon.hook.mjs +13 -0
  340. package/dist/modules/plans/hooks/use-has-plan-addon.hook.mjs.map +1 -0
  341. package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs +15 -0
  342. package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs.map +1 -0
  343. package/dist/modules/plans/services/plans.service.mjs +34 -0
  344. package/dist/modules/plans/services/plans.service.mjs.map +1 -0
  345. package/dist/modules/plans/types/plan.type.mjs +20 -0
  346. package/dist/modules/plans/types/plan.type.mjs.map +1 -0
  347. package/dist/modules/projects/actions/add-project-user.action.mjs +10 -0
  348. package/dist/modules/projects/actions/add-project-user.action.mjs.map +1 -0
  349. package/dist/modules/projects/actions/list-all-account-users.action.mjs +10 -0
  350. package/dist/modules/projects/actions/list-all-account-users.action.mjs.map +1 -0
  351. package/dist/modules/projects/actions/list-available-users.action.mjs +10 -0
  352. package/dist/modules/projects/actions/list-available-users.action.mjs.map +1 -0
  353. package/dist/modules/projects/actions/list-project-users.action.mjs +10 -0
  354. package/dist/modules/projects/actions/list-project-users.action.mjs.map +1 -0
  355. package/dist/modules/projects/actions/remove-project-user.action.mjs +10 -0
  356. package/dist/modules/projects/actions/remove-project-user.action.mjs.map +1 -0
  357. package/dist/modules/projects/hooks/add-project-user.hook.mjs +61 -0
  358. package/dist/modules/projects/hooks/add-project-user.hook.mjs.map +1 -0
  359. package/dist/modules/projects/hooks/list-all-account-users.hook.mjs +35 -0
  360. package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +1 -0
  361. package/dist/modules/projects/hooks/list-available-users.hook.mjs +34 -0
  362. package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -0
  363. package/dist/modules/projects/hooks/list-project-users.hook.mjs +34 -0
  364. package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -0
  365. package/dist/modules/projects/hooks/remove-project-user.hook.mjs +61 -0
  366. package/dist/modules/projects/hooks/remove-project-user.hook.mjs.map +1 -0
  367. package/dist/modules/projects/services/project-users.service.mjs +96 -0
  368. package/dist/modules/projects/services/project-users.service.mjs.map +1 -0
  369. package/dist/modules/projects/types.mjs +23 -0
  370. package/dist/modules/projects/types.mjs.map +1 -0
  371. package/dist/modules/subscriptions/actions/calculate-subscription.action.mjs +10 -0
  372. package/dist/modules/subscriptions/actions/calculate-subscription.action.mjs.map +1 -0
  373. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs +10 -0
  374. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs.map +1 -0
  375. package/dist/modules/subscriptions/actions/update-subscription-plan.action.mjs +12 -0
  376. package/dist/modules/subscriptions/actions/update-subscription-plan.action.mjs.map +1 -0
  377. package/dist/modules/subscriptions/constants/addons.constants.mjs +24 -0
  378. package/dist/modules/subscriptions/constants/addons.constants.mjs.map +1 -0
  379. package/dist/modules/subscriptions/constants/query-keys.constants.mjs +5 -0
  380. package/dist/modules/subscriptions/constants/query-keys.constants.mjs.map +1 -0
  381. package/dist/modules/subscriptions/hooks/calculate-subscription.hook.mjs +13 -0
  382. package/dist/modules/subscriptions/hooks/calculate-subscription.hook.mjs.map +1 -0
  383. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +17 -0
  384. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +1 -0
  385. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +17 -0
  386. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +1 -0
  387. package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs +22 -0
  388. package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs.map +1 -0
  389. package/dist/modules/subscriptions/hooks/use-cancelled-subscription-guard.mjs +37 -0
  390. package/dist/modules/subscriptions/hooks/use-cancelled-subscription-guard.mjs.map +1 -0
  391. package/dist/modules/subscriptions/services/subscriptions.service.mjs +75 -0
  392. package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +1 -0
  393. package/dist/modules/subscriptions/types/billing-period.type.mjs +1 -0
  394. package/dist/modules/subscriptions/types/billing-period.type.mjs.map +1 -0
  395. package/dist/modules/subscriptions/types/calculate-subscription.type.mjs +72 -0
  396. package/dist/modules/subscriptions/types/calculate-subscription.type.mjs.map +1 -0
  397. package/dist/modules/subscriptions/types/subscription.type.mjs +57 -0
  398. package/dist/modules/subscriptions/types/subscription.type.mjs.map +1 -0
  399. package/dist/modules/subscriptions/utils/build-plan-extras.mjs +37 -0
  400. package/dist/modules/subscriptions/utils/build-plan-extras.mjs.map +1 -0
  401. package/dist/modules/subscriptions/utils/has-subscription-expired.mjs +10 -0
  402. package/dist/modules/subscriptions/utils/has-subscription-expired.mjs.map +1 -0
  403. package/dist/modules/subscriptions/utils/periodicity.mjs +48 -0
  404. package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -0
  405. package/dist/modules/subscriptions/utils/resolve-plan-extras-prices.mjs +14 -0
  406. package/dist/modules/subscriptions/utils/resolve-plan-extras-prices.mjs.map +1 -0
  407. package/dist/modules/users/action/find-user-by-id.action.mjs +10 -0
  408. package/dist/modules/users/action/find-user-by-id.action.mjs.map +1 -0
  409. package/dist/modules/users/action/list-messages.action.mjs +13 -0
  410. package/dist/modules/users/action/list-messages.action.mjs.map +1 -0
  411. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs +10 -0
  412. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs.map +1 -0
  413. package/dist/modules/users/action/mark-message-as-read.action.mjs +10 -0
  414. package/dist/modules/users/action/mark-message-as-read.action.mjs.map +1 -0
  415. package/dist/modules/users/hooks/messages.hook.mjs +57 -0
  416. package/dist/modules/users/hooks/messages.hook.mjs.map +1 -0
  417. package/dist/modules/users/schema/messages.schema.mjs +21 -0
  418. package/dist/modules/users/schema/messages.schema.mjs.map +1 -0
  419. package/dist/modules/users/schema.mjs +11 -0
  420. package/dist/modules/users/schema.mjs.map +1 -0
  421. package/dist/modules/users/services/messages.service.mjs +35 -0
  422. package/dist/modules/users/services/messages.service.mjs.map +1 -0
  423. package/dist/modules/users/services/user.service.mjs +52 -0
  424. package/dist/modules/users/services/user.service.mjs.map +1 -0
  425. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +21 -0
  426. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +1 -0
  427. package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs +19 -0
  428. package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs.map +1 -0
  429. package/dist/modules/whitelabel/schema.mjs +1 -0
  430. package/dist/modules/whitelabel/schema.mjs.map +1 -0
  431. package/dist/modules/whitelabel/services/whitelabel.service.mjs +146 -0
  432. package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +1 -0
  433. package/dist/modules/whitelabel/utils/normalize-hostname.mjs +35 -0
  434. package/dist/modules/whitelabel/utils/normalize-hostname.mjs.map +1 -0
  435. package/dist/providers/auth.provider.mjs +114 -0
  436. package/dist/providers/auth.provider.mjs.map +1 -0
  437. package/dist/providers/query.provider.mjs +99 -0
  438. package/dist/providers/query.provider.mjs.map +1 -0
  439. package/dist/providers/whitelabel.provider.mjs +42 -0
  440. package/dist/providers/whitelabel.provider.mjs.map +1 -0
  441. package/dist/server.mjs +111 -0
  442. package/dist/server.mjs.map +1 -0
  443. package/dist/store/useAccountModals.mjs +18 -0
  444. package/dist/store/useAccountModals.mjs.map +1 -0
  445. package/dist/store/useBuyCreditsModal.mjs +16 -0
  446. package/dist/store/useBuyCreditsModal.mjs.map +1 -0
  447. package/dist/store/useDesktopSidebarStore.mjs +39 -0
  448. package/dist/store/useDesktopSidebarStore.mjs.map +1 -0
  449. package/dist/store/useMdSidebarStore.mjs +28 -0
  450. package/dist/store/useMdSidebarStore.mjs.map +1 -0
  451. package/dist/store/useMobileNavbarSheet.mjs +14 -0
  452. package/dist/store/useMobileNavbarSheet.mjs.map +1 -0
  453. package/dist/store/useModalManager.mjs +75 -0
  454. package/dist/store/useModalManager.mjs.map +1 -0
  455. package/dist/store/usePaidPlanRequiredModal.mjs +14 -0
  456. package/dist/store/usePaidPlanRequiredModal.mjs.map +1 -0
  457. package/dist/utils/browser/clipboard.mjs +36 -0
  458. package/dist/utils/browser/clipboard.mjs.map +1 -0
  459. package/dist/utils/constants/br-states.mjs +33 -0
  460. package/dist/utils/constants/br-states.mjs.map +1 -0
  461. package/dist/utils/countries.mjs +219 -0
  462. package/dist/utils/countries.mjs.map +1 -0
  463. package/dist/utils/file/index.mjs +9 -0
  464. package/dist/utils/file/index.mjs.map +1 -0
  465. package/dist/utils/format/masks.mjs +67 -0
  466. package/dist/utils/format/masks.mjs.map +1 -0
  467. package/dist/utils/intl/locales.mjs +12 -0
  468. package/dist/utils/intl/locales.mjs.map +1 -0
  469. package/dist/utils/safeServerAction.mjs +16 -0
  470. package/dist/utils/safeServerAction.mjs.map +1 -0
  471. package/dist/utils/validators/account.mjs +27 -0
  472. package/dist/utils/validators/account.mjs.map +1 -0
  473. package/dist/utils/validators/common.mjs +47 -0
  474. package/dist/utils/validators/common.mjs.map +1 -0
  475. package/dist/utils/withAction.mjs +13 -0
  476. package/dist/utils/withAction.mjs.map +1 -0
  477. package/package.json +1 -1
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useState, useCallback } from "react";
4
+ import { toast } from "sonner";
5
+ import { Toast } from "../../ui/feedback/Toast";
6
+ import useCountdownTimer from "../../../hooks/useCountdownTimer";
7
+ import { OTP_CODE_LENGTH, VALID_OTP_CODE } from "../../../utils/validators/account";
8
+ import { hasExactLength } from "../../../utils/validators/common";
9
+ function useOtpVerification({
10
+ onSuccess,
11
+ successMessage,
12
+ validateFn,
13
+ resendFn
14
+ }) {
15
+ const [code, setCode] = useState("");
16
+ const [isLoading, setIsLoading] = useState(false);
17
+ const [hasError, setHasError] = useState(false);
18
+ const {
19
+ seconds: timer,
20
+ isExpired: canResend,
21
+ reset: resetTimer
22
+ } = useCountdownTimer({ initialSeconds: 59 });
23
+ const handleCodeChange = useCallback(
24
+ (value) => {
25
+ setCode(value.toUpperCase());
26
+ if (hasError) {
27
+ setHasError(false);
28
+ }
29
+ },
30
+ [hasError]
31
+ );
32
+ const handleValidate = useCallback(async () => {
33
+ if (!hasExactLength(code, OTP_CODE_LENGTH)) return;
34
+ setIsLoading(true);
35
+ setHasError(false);
36
+ try {
37
+ let isValid;
38
+ if (validateFn) {
39
+ isValid = await validateFn(code);
40
+ } else {
41
+ await new Promise((resolve) => setTimeout(resolve, 500));
42
+ isValid = code === VALID_OTP_CODE;
43
+ }
44
+ if (!isValid) {
45
+ setHasError(true);
46
+ return;
47
+ }
48
+ toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: successMessage, toastId: t }));
49
+ setCode("");
50
+ onSuccess();
51
+ } catch (error) {
52
+ console.error("Erro ao validar c\xF3digo:", error);
53
+ setHasError(true);
54
+ } finally {
55
+ setIsLoading(false);
56
+ }
57
+ }, [code, onSuccess, successMessage, validateFn]);
58
+ const handleResend = useCallback(async () => {
59
+ if (!canResend) return;
60
+ try {
61
+ resetTimer();
62
+ setHasError(false);
63
+ setCode("");
64
+ if (resendFn) {
65
+ await resendFn();
66
+ }
67
+ toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "C\xF3digo reenviado", toastId: t }));
68
+ } catch (error) {
69
+ console.error("Erro ao reenviar c\xF3digo:", error);
70
+ toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Erro ao reenviar c\xF3digo. Tente novamente.", toastId: t }));
71
+ }
72
+ }, [canResend, resetTimer, resendFn]);
73
+ const reset = useCallback(() => {
74
+ setCode("");
75
+ setHasError(false);
76
+ }, []);
77
+ const isValidLength = hasExactLength(code, OTP_CODE_LENGTH);
78
+ return {
79
+ code,
80
+ isLoading,
81
+ hasError,
82
+ timer,
83
+ canResend,
84
+ isValidLength,
85
+ handleCodeChange,
86
+ handleValidate,
87
+ handleResend,
88
+ reset
89
+ };
90
+ }
91
+ export {
92
+ useOtpVerification as default
93
+ };
94
+ //# sourceMappingURL=useOtpVerification.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/account/hooks/useOtpVerification.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport useCountdownTimer from '../../../hooks/useCountdownTimer';\r\nimport { OTP_CODE_LENGTH, VALID_OTP_CODE } from '../../../utils/validators/account';\r\nimport { hasExactLength } from '../../../utils/validators/common';\r\n\r\ninterface UseOtpVerificationOptions {\r\n onSuccess: () => void;\r\n successMessage: string;\r\n validateFn?: (code: string) => Promise<boolean>;\r\n resendFn?: () => Promise<void>;\r\n}\r\n\r\nexport default function useOtpVerification({\r\n onSuccess,\r\n successMessage,\r\n validateFn,\r\n resendFn,\r\n}: UseOtpVerificationOptions) {\r\n const [code, setCode] = useState('');\r\n const [isLoading, setIsLoading] = useState(false);\r\n const [hasError, setHasError] = useState(false);\r\n\r\n const {\r\n seconds: timer,\r\n isExpired: canResend,\r\n reset: resetTimer,\r\n } = useCountdownTimer({ initialSeconds: 59 });\r\n\r\n const handleCodeChange = useCallback(\r\n (value: string) => {\r\n setCode(value.toUpperCase());\r\n if (hasError) {\r\n setHasError(false);\r\n }\r\n },\r\n [hasError]\r\n );\r\n\r\n const handleValidate = useCallback(async () => {\r\n if (!hasExactLength(code, OTP_CODE_LENGTH)) return;\r\n\r\n setIsLoading(true);\r\n setHasError(false);\r\n\r\n try {\r\n let isValid: boolean;\r\n\r\n if (validateFn) {\r\n isValid = await validateFn(code);\r\n } else {\r\n await new Promise((resolve) => setTimeout(resolve, 500));\r\n isValid = code === VALID_OTP_CODE;\r\n }\r\n\r\n if (!isValid) {\r\n setHasError(true);\r\n return;\r\n }\r\n\r\n toast.custom((t) => <Toast variant=\"success\" message={successMessage} toastId={t} />);\r\n\r\n setCode('');\r\n onSuccess();\r\n } catch (error) {\r\n console.error('Erro ao validar código:', error);\r\n setHasError(true);\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n }, [code, onSuccess, successMessage, validateFn]);\r\n\r\n const handleResend = useCallback(async () => {\r\n if (!canResend) return;\r\n\r\n try {\r\n resetTimer();\r\n setHasError(false);\r\n setCode('');\r\n\r\n if (resendFn) {\r\n await resendFn();\r\n }\r\n\r\n toast.custom((t) => <Toast variant=\"success\" message=\"Código reenviado\" toastId={t} />);\r\n } catch (error) {\r\n console.error('Erro ao reenviar código:', error);\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message=\"Erro ao reenviar código. Tente novamente.\" toastId={t} />\r\n ));\r\n }\r\n }, [canResend, resetTimer, resendFn]);\r\n\r\n const reset = useCallback(() => {\r\n setCode('');\r\n setHasError(false);\r\n }, []);\r\n\r\n const isValidLength = hasExactLength(code, OTP_CODE_LENGTH);\r\n\r\n return {\r\n code,\r\n isLoading,\r\n hasError,\r\n timer,\r\n canResend,\r\n isValidLength,\r\n handleCodeChange,\r\n handleValidate,\r\n handleResend,\r\n reset,\r\n };\r\n}\r\n"],"mappings":";AA+D0B;AA7D1B,SAAS,UAAU,mBAAmB;AACtC,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,OAAO,uBAAuB;AAC9B,SAAS,iBAAiB,sBAAsB;AAChD,SAAS,sBAAsB;AAShB,SAAR,mBAAoC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA8B;AAC5B,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AACnC,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAE9C,QAAM;AAAA,IACJ,SAAS;AAAA,IACT,WAAW;AAAA,IACX,OAAO;AAAA,EACT,IAAI,kBAAkB,EAAE,gBAAgB,GAAG,CAAC;AAE5C,QAAM,mBAAmB;AAAA,IACvB,CAAC,UAAkB;AACjB,cAAQ,MAAM,YAAY,CAAC;AAC3B,UAAI,UAAU;AACZ,oBAAY,KAAK;AAAA,MACnB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,QAAM,iBAAiB,YAAY,YAAY;AAC7C,QAAI,CAAC,eAAe,MAAM,eA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A;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useState, useCallback, useEffect } from "react";
4
+ import { useMutation } from "@tanstack/react-query";
5
+ import { toast } from "sonner";
6
+ import { Toast } from "../../ui/feedback/Toast";
7
+ import { copyToClipboard } from "../../../utils/browser/clipboard";
8
+ import {
9
+ generateTwoFactorAction,
10
+ confirmTwoFactorAction
11
+ } from "../../../modules/accounts/actions/account-management.action";
12
+ import { withAction } from "../../../utils/withAction";
13
+ function useTwoFactorAuthForm({ onSuccess, open } = {}) {
14
+ const [code, setCode] = useState("");
15
+ const [step, setStep] = useState("code");
16
+ const generateMutation = useMutation({
17
+ mutationFn: withAction(generateTwoFactorAction),
18
+ onError: () => {
19
+ toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Erro ao gerar QR Code. Tente novamente.", toastId: t }));
20
+ }
21
+ });
22
+ const confirmMutation = useMutation({
23
+ mutationFn: withAction(confirmTwoFactorAction),
24
+ onSuccess: () => {
25
+ setStep("recovery");
26
+ },
27
+ onError: () => {
28
+ toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Erro ao confirmar c\xF3digo. Tente novamente.", toastId: t }));
29
+ }
30
+ });
31
+ const { mutate: triggerGenerate } = generateMutation;
32
+ useEffect(() => {
33
+ if (open) {
34
+ triggerGenerate();
35
+ }
36
+ }, [open, triggerGenerate]);
37
+ const generateFailed = generateMutation.isError;
38
+ const isCodeComplete = code.length === 6;
39
+ const handleSubmit = () => {
40
+ if (!isCodeComplete) return;
41
+ confirmMutation.mutate(code);
42
+ };
43
+ const handleFinalize = () => {
44
+ onSuccess?.();
45
+ setTimeout(resetForm, 300);
46
+ };
47
+ const handleCopyCodes = useCallback(async () => {
48
+ const codes = generateMutation.data?.backupCodes ?? [];
49
+ const success = await copyToClipboard(codes.join("\n"));
50
+ if (success) {
51
+ toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "C\xF3digos copiados com sucesso", toastId: t }));
52
+ }
53
+ }, [generateMutation.data]);
54
+ const resetForm = () => {
55
+ setCode("");
56
+ setStep("code");
57
+ generateMutation.reset();
58
+ confirmMutation.reset();
59
+ };
60
+ return {
61
+ code,
62
+ setCode,
63
+ isCodeComplete,
64
+ isGenerating: generateMutation.isPending,
65
+ isConfirming: confirmMutation.isPending,
66
+ generateFailed,
67
+ retryGenerate: triggerGenerate,
68
+ qrcode: generateMutation.data?.qrcode,
69
+ backupCodes: generateMutation.data?.backupCodes ?? [],
70
+ step,
71
+ handleSubmit,
72
+ handleFinalize,
73
+ handleCopyCodes,
74
+ resetForm
75
+ };
76
+ }
77
+ export {
78
+ useTwoFactorAuthForm as default
79
+ };
80
+ //# sourceMappingURL=useTwoFactorAuthForm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/account/hooks/useTwoFactorAuthForm.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback, useEffect } from 'react';\nimport { useMutation } from '@tanstack/react-query';\nimport { toast } from 'sonner';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { copyToClipboard } from '../../../utils/browser/clipboard';\nimport {\n generateTwoFactorAction,\n confirmTwoFactorAction,\n} from '../../../modules/accounts/actions/account-management.action';\nimport { withAction } from '../../../utils/withAction';\n\ntype Step = 'code' | 'recovery';\n\ninterface UseTwoFactorAuthFormProps {\n onSuccess?: () => void;\n open?: boolean;\n}\n\nexport default function useTwoFactorAuthForm({ onSuccess, open }: UseTwoFactorAuthFormProps = {}) {\n const [code, setCode] = useState('');\n const [step, setStep] = useState<Step>('code');\n\n const generateMutation = useMutation({\n mutationFn: withAction(generateTwoFactorAction),\n onError: () => {\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Erro ao gerar QR Code. Tente novamente.\" toastId={t} />\n ));\n },\n });\n\n const confirmMutation = useMutation({\n mutationFn: withAction(confirmTwoFactorAction),\n onSuccess: () => {\n setStep('recovery');\n },\n onError: () => {\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Erro ao confirmar código. Tente novamente.\" toastId={t} />\n ));\n },\n });\n\n const { mutate: triggerGenerate } = generateMutation;\n\n useEffect(() => {\n if (open) {\n triggerGenerate();\n }\n }, [open, triggerGenerate]);\n\n const generateFailed = generateMutation.isError;\n\n const isCodeComplete = code.length === 6;\n\n const handleSubmit = () => {\n if (!isCodeComplete) return;\n confirmMutation.mutate(code);\n };\n\n const handleFinalize = () => {\n onSuccess?.();\n setTimeout(resetForm, 300);\n };\n\n const handleCopyCodes = useCallback(async () => {\n const codes = generateMutation.data?.backupCodes ?? [];\n const success = await copyToClipboard(codes.join('\\n'));\n if (success) {\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Códigos copiados com sucesso\" toastId={t} />\n ));\n }\n }, [generateMutation.data]);\n\n const resetForm = () => {\n setCode('');\n setStep('code');\n generateMutation.reset();\n confirmMutation.reset();\n };\n\n return {\n code,\n setCode,\n isCodeComplete,\n isGenerating: generateMutation.isPending,\n isConfirming: confirmMutation.isPending,\n generateFailed,\n retryGenerate: triggerGenerate,\n qrcode: generateMutation.data?.qrcode,\n backupCodes: generateMutation.data?.backupCodes ?? [],\n step,\n handleSubmit,\n handleFinalize,\n handleCopyCodes,\n resetForm,\n };\n}\n"],"mappings":";AA4BQ;AA1BR,SAAS,UAAU,aAAa,iBAAiB;AACjD,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AASZ,SAAR,qBAAsC,EAAE,WAAW,KAAK,IAA+B,CAAC,GAAG;AAChG,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AACnC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAe,MAAM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AAA,EACxB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,iBAAiB;AAAA,IAC/B,cAAc,gBAAgB;AAAA,IAC9B;AAAA,IACA,eAAe;AAAA,IACf,QAAQ,iBAAiB,MAAM;AAAA,IAC/B,aAAa,iBAAiB,MAAM,eAAe,CAAC;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,181 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { IconChevronLeft, IconX, IconMail } from "@tabler/icons-react";
4
+ import { Button } from "../../ui/buttons/Button";
5
+ import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../../ui/overlay/Dialog";
6
+ import { Separator } from "../../ui/data-display/Separator";
7
+ import { InputOTP, InputOTPGroup, InputOTPSlot } from "../../ui/form/InputOtp";
8
+ import { FormField } from "../../ui/form/FormField";
9
+ import { formatTimer } from "../../../utils/format/masks";
10
+ import { OTP_CODE_LENGTH } from "../../../utils/validators/account";
11
+ import { useAuth } from "../../../providers/auth.provider";
12
+ import { useInvalidateUser } from "../../../modules/auth/hooks/useUserQuery";
13
+ import { confirmEmailChangeAction } from "../../../modules/accounts/actions/account-management.action";
14
+ import useChangeEmailForm from "../hooks/useChangeEmailForm";
15
+ import useOtpVerification from "../hooks/useOtpVerification";
16
+ function ChangeEmailModal({ open, onClose }) {
17
+ const { user } = useAuth();
18
+ const invalidateUser = useInvalidateUser();
19
+ const {
20
+ showVerification,
21
+ emailToVerify,
22
+ isSubmitting,
23
+ errors,
24
+ register,
25
+ handleContinue,
26
+ handleBack,
27
+ resetForm
28
+ } = useChangeEmailForm();
29
+ const handleSuccess = () => {
30
+ invalidateUser();
31
+ resetForm();
32
+ onClose();
33
+ };
34
+ const {
35
+ code,
36
+ isLoading,
37
+ hasError,
38
+ timer,
39
+ canResend,
40
+ isValidLength,
41
+ handleCodeChange,
42
+ handleValidate,
43
+ handleResend,
44
+ reset: resetOtp
45
+ } = useOtpVerification({
46
+ onSuccess: handleSuccess,
47
+ successMessage: "E-mail alterado com sucesso",
48
+ validateFn: async (token) => {
49
+ const result = await confirmEmailChangeAction(token, emailToVerify);
50
+ return result.success;
51
+ },
52
+ resendFn: async () => {
53
+ const { requestEmailChangeAction } = await import("../../../modules/accounts/actions/account-management.action");
54
+ const result = await requestEmailChangeAction(emailToVerify);
55
+ if (!result.success) {
56
+ throw new Error(result.error);
57
+ }
58
+ }
59
+ });
60
+ const handleClose = () => {
61
+ resetForm();
62
+ resetOtp();
63
+ onClose();
64
+ };
65
+ const handleBackFromVerification = () => {
66
+ resetOtp();
67
+ handleBack();
68
+ };
69
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(
70
+ DialogContent,
71
+ {
72
+ showCloseButton: false,
73
+ overlayClassName: "z-[1002]",
74
+ className: "flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-dvh top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-125 lg:h-auto lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%] z-[1003]",
75
+ children: [
76
+ showVerification ? /* @__PURE__ */ jsxs(DialogHeader, { className: "flex flex-row items-center justify-between px-4 py-3 border-b border-gray-200 lg:border-b-0", children: [
77
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", className: "size-8! p-0", onClick: handleBackFromVerification, children: /* @__PURE__ */ jsx(IconChevronLeft, { size: 20, className: "text-gray-950" }) }),
78
+ /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950 text-center flex-1", children: "Alterar e-mail" }),
79
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", className: "size-8! p-0", onClick: handleClose, children: /* @__PURE__ */ jsx(IconX, { size: 18, className: "text-gray-500" }) })
80
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
81
+ /* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "Alterar e-mail" }) }),
82
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0", children: [
83
+ /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950 text-center", children: "Alterar e-mail" }),
84
+ /* @__PURE__ */ jsx(
85
+ Button,
86
+ {
87
+ variant: "ghost",
88
+ className: "absolute right-2 size-8! p-0",
89
+ onClick: handleClose,
90
+ children: /* @__PURE__ */ jsx(IconX, { size: 18, className: "text-gray-500" })
91
+ }
92
+ )
93
+ ] })
94
+ ] }),
95
+ /* @__PURE__ */ jsx("div", { className: `${showVerification ? "w-full" : "w-1/2"} h-0.75 bg-cyan-300` }),
96
+ showVerification ? /* @__PURE__ */ jsxs(
97
+ "form",
98
+ {
99
+ onSubmit: (e) => {
100
+ e.preventDefault();
101
+ handleValidate();
102
+ },
103
+ className: "flex flex-col flex-1 lg:flex-none",
104
+ children: [
105
+ /* @__PURE__ */ jsxs("div", { className: "px-4 lg:px-5 py-5 lg:py-6 flex flex-col gap-4 flex-1 lg:flex-none", children: [
106
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center size-12 bg-white rounded-lg shadow-xs border border-gray-200", children: /* @__PURE__ */ jsx(IconMail, { size: 20, className: "text-gray-950" }) }),
107
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
108
+ /* @__PURE__ */ jsx("h3", { className: "paragraph-medium-semibold text-gray-950", children: "C\xF3digo de valida\xE7\xE3o" }),
109
+ /* @__PURE__ */ jsxs("p", { className: "paragraph-small-regular text-gray-600", children: [
110
+ "Enviamos um c\xF3digo de valida\xE7\xE3o para o E-mail",
111
+ " ",
112
+ /* @__PURE__ */ jsxs("span", { className: "font-semibold text-gray-950 break-all", children: [
113
+ user?.email,
114
+ "."
115
+ ] })
116
+ ] })
117
+ ] }),
118
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
119
+ /* @__PURE__ */ jsx(InputOTP, { maxLength: OTP_CODE_LENGTH, value: code, onChange: handleCodeChange, children: /* @__PURE__ */ jsx(InputOTPGroup, { className: "flex flex-row gap-2", children: [...Array(OTP_CODE_LENGTH)].map((_, i) => /* @__PURE__ */ jsx(
120
+ InputOTPSlot,
121
+ {
122
+ index: i,
123
+ className: `uppercase text-2xl font-medium w-11 lg:w-12 h-13 lg:h-14 rounded-lg border bg-white shadow-none [&_div.animate-caret-blink]:bg-gray-950 ${hasError ? "border-red-500" : "border-gray-200"}`
124
+ },
125
+ i
126
+ )) }) }),
127
+ hasError && /* @__PURE__ */ jsx("p", { className: "paragraph-small-regular text-red-500", children: "C\xF3digo incorreto" })
128
+ ] }),
129
+ canResend ? /* @__PURE__ */ jsx(
130
+ "button",
131
+ {
132
+ type: "button",
133
+ onClick: handleResend,
134
+ className: "paragraph-small-medium text-gray-950 underline cursor-pointer hover:text-gray-700 w-fit",
135
+ children: "Reenviar c\xF3digo"
136
+ }
137
+ ) : /* @__PURE__ */ jsxs("p", { className: "paragraph-small-regular text-gray-500", children: [
138
+ "Reenviar em",
139
+ " ",
140
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-gray-950", children: formatTimer(timer) })
141
+ ] })
142
+ ] }),
143
+ /* @__PURE__ */ jsx(Separator, {}),
144
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 lg:px-5 py-4 lg:py-5 mt-auto lg:mt-0", children: [
145
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children: "Cancelar" }),
146
+ /* @__PURE__ */ jsx(Button, { className: "h-10!", type: "submit", disabled: !isValidLength || isLoading, children: isLoading ? "Validando..." : "Alterar e-mail" })
147
+ ] })
148
+ ]
149
+ }
150
+ ) : /* @__PURE__ */ jsxs("form", { onSubmit: handleContinue, className: "flex flex-col flex-1 lg:flex-none", children: [
151
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 lg:gap-6 px-4 lg:px-5 py-5 lg:py-6 flex-1 lg:flex-none", children: [
152
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
153
+ /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children: "Atualizar E-mail de contato" }),
154
+ /* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-gray-600", children: "Informe o seu novo E-mail para manter seu contato atualizado." })
155
+ ] }),
156
+ /* @__PURE__ */ jsx(
157
+ FormField,
158
+ {
159
+ label: "Novo e-mail",
160
+ placeholder: "Digite seu novo e-mail",
161
+ type: "email",
162
+ ...register("email"),
163
+ error: !!errors.email,
164
+ errorMessage: errors.email?.message,
165
+ leftIcon: IconMail
166
+ }
167
+ )
168
+ ] }),
169
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0", children: [
170
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children: "Cancelar" }),
171
+ /* @__PURE__ */ jsx(Button, { className: "h-10!", type: "submit", disabled: isSubmitting, children: isSubmitting ? "Enviando..." : "Continuar" })
172
+ ] })
173
+ ] })
174
+ ]
175
+ }
176
+ ) });
177
+ }
178
+ export {
179
+ ChangeEmailModal
180
+ };
181
+ //# sourceMappingURL=ChangeEmailModal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/account/sections/ChangeEmailModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconChevronLeft, IconX, IconMail } from '@tabler/icons-react';\nimport { Button } from '../../ui/buttons/Button';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../../ui/overlay/Dialog';\nimport { Separator } from '../../ui/data-display/Separator';\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from '../../ui/form/InputOtp';\nimport { FormField } from '../../ui/form/FormField';\nimport { formatTimer } from '../../../utils/format/masks';\nimport { OTP_CODE_LENGTH } from '../../../utils/validators/account';\nimport { useAuth } from '../../../providers/auth.provider';\nimport { useInvalidateUser } from '../../../modules/auth/hooks/useUserQuery';\nimport { confirmEmailChangeAction } from '../../../modules/accounts/actions/account-management.action';\nimport useChangeEmailForm from '../hooks/useChangeEmailForm';\nimport useOtpVerification from '../hooks/useOtpVerification';\n\ninterface ChangeEmailModalProps {\n open: boolean;\n onClose: () => void;\n}\n\nexport function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {\n const { user } = useAuth();\n const invalidateUser = useInvalidateUser();\n\n const {\n showVerification,\n emailToVerify,\n isSubmitting,\n errors,\n register,\n handleContinue,\n handleBack,\n resetForm,\n } = useChangeEmailForm();\n\n const handleSuccess = () => {\n invalidateUser();\n resetForm();\n onClose();\n };\n\n const {\n code,\n isLoading,\n hasError,\n timer,\n canResend,\n isValidLength,\n handleCodeChange,\n handleValidate,\n handleResend,\n reset: resetOtp,\n } = useOtpVerification({\n onSuccess: handleSuccess,\n successMessage: 'E-mail alterado com sucesso',\n validateFn: async (token) => {\n const result = await confirmEmailChangeAction(token, emailToVerify);\n return result.success;\n },\n resendFn: async () => {\n const { requestEmailChangeAction } = await import('../../../modules/accounts/actions/account-management.action');\n const result = await requestEmailChangeAction(emailToVerify);\n if (!result.success) {\n throw new Error(result.error);\n }\n },\n });\n\n const handleClose = () => {\n resetForm();\n resetOtp();\n onClose();\n };\n\n const handleBackFromVerification = () => {\n resetOtp();\n handleBack();\n };\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent\n showCloseButton={false}\n overlayClassName=\"z-[1002]\"\n className=\"flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-dvh top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-125 lg:h-auto lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%] z-[1003]\"\n >\n {showVerification ? (\n <DialogHeader className=\"flex flex-row items-center justify-between px-4 py-3 border-b border-gray-200 lg:border-b-0\">\n <Button variant=\"ghost\" className=\"size-8! p-0\" onClick={handleBackFromVerification}>\n <IconChevronLeft size={20} className=\"text-gray-950\" />\n </Button>\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950 text-center flex-1\">\n Alterar e-mail\n </DialogTitle>\n <Button variant=\"ghost\" className=\"size-8! p-0\" onClick={handleClose}>\n <IconX size={18} className=\"text-gray-500\" />\n </Button>\n </DialogHeader>\n ) : (\n <>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Alterar e-mail</DialogTitle>\n </DialogHeader>\n <div className=\"flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0\">\n <span className=\"paragraph-medium-semibold text-gray-950 text-center\">\n Alterar e-mail\n </span>\n <Button\n variant=\"ghost\"\n className=\"absolute right-2 size-8! p-0\"\n onClick={handleClose}\n >\n <IconX size={18} className=\"text-gray-500\" />\n </Button>\n </div>\n </>\n )}\n\n <div className={`${showVerification ? 'w-full' : 'w-1/2'} h-0.75 bg-cyan-300`} />\n\n {showVerification ? (\n <form\n onSubmit={(e) => {\n e.preventDefault();\n handleValidate();\n }}\n className=\"flex flex-col flex-1 lg:flex-none\"\n >\n <div className=\"px-4 lg:px-5 py-5 lg:py-6 flex flex-col gap-4 flex-1 lg:flex-none\">\n <div className=\"flex items-center justify-center size-12 bg-white rounded-lg shadow-xs border border-gray-200\">\n <IconMail size={20} className=\"text-gray-950\" />\n </div>\n\n <div className=\"flex flex-col gap-1\">\n <h3 className=\"paragraph-medium-semibold text-gray-950\">Código de validação</h3>\n <p className=\"paragraph-small-regular text-gray-600\">\n Enviamos um código de validação para o E-mail{' '}\n <span className=\"font-semibold text-gray-950 break-all\">{user?.email}.</span>\n </p>\n </div>\n\n <div className=\"flex flex-col gap-2\">\n <InputOTP maxLength={OTP_CODE_LENGTH} value={code} onChange={handleCodeChange}>\n <InputOTPGroup className=\"flex flex-row gap-2\">\n {[...Array(OTP_CODE_LENGTH)].map((_, i) => (\n <InputOTPSlot\n key={i}\n index={i}\n className={`uppercase text-2xl font-medium w-11 lg:w-12 h-13 lg:h-14 rounded-lg border bg-white shadow-none [&_div.animate-caret-blink]:bg-gray-950 ${hasError ? 'border-red-500' : 'border-gray-200'}`}\n />\n ))}\n </InputOTPGroup>\n </InputOTP>\n {hasError && (\n <p className=\"paragraph-small-regular text-red-500\">Código incorreto</p>\n )}\n </div>\n\n {canResend ? (\n <button\n type=\"button\"\n onClick={handleResend}\n className=\"paragraph-small-medium text-gray-950 underline cursor-pointer hover:text-gray-700 w-fit\"\n >\n Reenviar código\n </button>\n ) : (\n <p className=\"paragraph-small-regular text-gray-500\">\n Reenviar em{' '}\n <span className=\"paragraph-small-semibold text-gray-950\">\n {formatTimer(timer)}\n </span>\n </p>\n )}\n </div>\n\n <Separator />\n\n <div className=\"flex items-center justify-between px-4 lg:px-5 py-4 lg:py-5 mt-auto lg:mt-0\">\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={handleClose}>\n Cancelar\n </Button>\n <Button className=\"h-10!\" type=\"submit\" disabled={!isValidLength || isLoading}>\n {isLoading ? 'Validando...' : 'Alterar e-mail'}\n </Button>\n </div>\n </form>\n ) : (\n <form onSubmit={handleContinue} className=\"flex flex-col flex-1 lg:flex-none\">\n <div className=\"flex flex-col gap-5 lg:gap-6 px-4 lg:px-5 py-5 lg:py-6 flex-1 lg:flex-none\">\n <div className=\"flex flex-col gap-1\">\n <span className=\"paragraph-medium-semibold text-gray-950\">\n Atualizar E-mail de contato\n </span>\n <span className=\"paragraph-small-regular text-gray-600\">\n Informe o seu novo E-mail para manter seu contato atualizado.\n </span>\n </div>\n\n <FormField\n label=\"Novo e-mail\"\n placeholder=\"Digite seu novo e-mail\"\n type=\"email\"\n {...register('email')}\n error={!!errors.email}\n errorMessage={errors.email?.message}\n leftIcon={IconMail}\n />\n </div>\n\n <div className=\"flex items-center justify-between p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0\">\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={handleClose}>\n Cancelar\n </Button>\n <Button className=\"h-10!\" type=\"submit\" disabled={isSubmitting}>\n {isSubmitting ? 'Enviando...' : 'Continuar'}\n </Button>\n </div>\n </form>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAwFU,SAYA,UAVI,KAFJ;AAtFV,SAAS,iBAAiB,OAAO,gBAAgB;AACjD,SAAS,cAAc;AACvB,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,iBAAiB;AAC1B,SAAS,UAAU,eAAe,oBAAoB;AACtD,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AACzC,OAAO,wBAAwB;AAC/B,OAAO,wBAAwB;AAOxB,SAAS,iBAAiB,EAAE,MAAM,QAAQ,GAA0B;AACzE,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,iBAAiB,kBAAkB;AAEzC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,mBAAmB;AAEvB,QAAM,gBAAgB,MAAM;AAC1B,mBAAe;AACf,cAAU;AACV,YAAQ;AAAA,EACV;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,EACT,IAAI,mBAAmB;AAAA,IACrB,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,YAAY,OAAO,UAAU;AAC3B,YAAM,SAAS,MAAM,yBAAyB,OAAO,aAAa;AACl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,MAAK,UAAS,SAAS,aAAa,sBAElF;AAAA,gBACA,oBAAC,UAAO,WAAU,SAAQ,MAAK,UAAS,UAAU,CAAC,iBAAiB,WACjE,sBAAY,iBAAiB,kBAChC;AAAA,iBACF;AAAA;AAAA;AAAA,QACF,IAEA,qBAAC,UAAK,UAAU,gBAAgB,WAAU,qCACxC;AAAA,+BAAC,SAAI,WAAU,8EACb;AAAA,iCAAC,SAAI,WAAU,uBACb;AAAA,kCAAC,UAAK,WAAU,2CAA0C,yCAE1D;AAAA,cACA,oBAAC,UAAK,WAAU,yCAAwC,2EAExD;AAAA,eACF;AAAA,YAEA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAM;AAAA,gBACN,aAAY;AAAA,gBACZ,MAAK;AAAA,gBACJ,GAAG,SAAS,OAAO;AAAA,gBACpB,OAAO,CAAC,CAAC,OAAO;AAAA,gBAChB,cAAc,OAAO,OAAO;AAAA,gBAC5B,UAAU;AAAA;AAAA,YACZ;AAAA,aACF;AAAA,UAEA,qBAAC,SAAI,WAAU,yFACb;AAAA,gCAAC,UAAO,SAAQ,aAAY,WAAU,SAAQ,MAAK,UAAS,SAAS,aAAa,sBAElF;AAAA,YACA,oBAAC,UAAO,WAAU,SAAQ,MAAK,UAAS,UAAU,cAC/C,yBAAe,gBAAgB,aAClC;AAAA,aACF;AAAA,WACF;AAAA;AAAA;AAAA,EAEJ,GACF;AAEJ;","names":[]}
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { IconLock, IconX } from "@tabler/icons-react";
4
+ import { Button } from "../../ui/buttons/Button";
5
+ import { FormField } from "../../ui/form/FormField";
6
+ import useChangePasswordForm from "../hooks/useChangePasswordForm";
7
+ import usePasswordVisibility from "../../../hooks/usePasswordVisibility";
8
+ function ChangePasswordSection({ onBack }) {
9
+ const { register, handleSubmit, errors } = useChangePasswordForm({
10
+ onSuccess: onBack
11
+ });
12
+ const { showPassword: showCurrentPw, togglePassword: toggleCurrentPw } = usePasswordVisibility();
13
+ const { showPassword: showNewPw, togglePassword: toggleNewPw } = usePasswordVisibility();
14
+ return /* @__PURE__ */ jsxs(
15
+ "form",
16
+ {
17
+ onSubmit: handleSubmit,
18
+ className: "flex-1 overflow-y-auto px-4 pb-5 lg:p-5 flex flex-col h-full lg:h-full gap-5 lg:gap-6",
19
+ children: [
20
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
21
+ /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children: "Alterar senha" }),
22
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", className: "size-8! p-0", onClick: onBack, children: /* @__PURE__ */ jsx(IconX, { size: 18 }) })
23
+ ] }),
24
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
25
+ /* @__PURE__ */ jsx(
26
+ FormField,
27
+ {
28
+ label: "Senha atual",
29
+ type: "password",
30
+ placeholder: "Digite sua senha atual",
31
+ leftIcon: IconLock,
32
+ error: !!errors.currentPassword,
33
+ errorMessage: errors.currentPassword?.message,
34
+ classnameContainer: "h-10!",
35
+ showPassword: showCurrentPw,
36
+ onTogglePassword: toggleCurrentPw,
37
+ ...register("currentPassword")
38
+ }
39
+ ),
40
+ /* @__PURE__ */ jsx(
41
+ FormField,
42
+ {
43
+ label: "Nova senha",
44
+ type: "password",
45
+ placeholder: "Digite sua nova senha",
46
+ leftIcon: IconLock,
47
+ error: !!errors.newPassword,
48
+ errorMessage: errors.newPassword?.message,
49
+ classnameContainer: "h-10!",
50
+ showPassword: showNewPw,
51
+ onTogglePassword: toggleNewPw,
52
+ ...register("newPassword")
53
+ }
54
+ )
55
+ ] }),
56
+ /* @__PURE__ */ jsx(Button, { type: "submit", className: "w-fit h-10!", children: "Salvar nova senha" })
57
+ ]
58
+ }
59
+ );
60
+ }
61
+ export {
62
+ ChangePasswordSection
63
+ };
64
+ //# sourceMappingURL=ChangePasswordSection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/account/sections/ChangePasswordSection.tsx"],"sourcesContent":["'use client';\n\nimport { IconLock, IconX } from '@tabler/icons-react';\nimport { Button } from '../../ui/buttons/Button';\nimport { FormField } from '../../ui/form/FormField';\nimport useChangePasswordForm from '../hooks/useChangePasswordForm';\nimport usePasswordVisibility from '../../../hooks/usePasswordVisibility';\n\ninterface ChangePasswordSectionProps {\n onBack: () => void;\n}\n\nexport function ChangePasswordSection({ onBack }: ChangePasswordSectionProps) {\n const { register, handleSubmit, errors } = useChangePasswordForm({\n onSuccess: onBack,\n });\n const { showPassword: showCurrentPw, togglePassword: toggleCurrentPw } = usePasswordVisibility();\n const { showPassword: showNewPw, togglePassword: toggleNewPw } = usePasswordVisibility();\n\n return (\n <form\n onSubmit={handleSubmit}\n className=\"flex-1 overflow-y-auto px-4 pb-5 lg:p-5 flex flex-col h-full lg:h-full gap-5 lg:gap-6\"\n >\n <div className=\"flex items-center justify-between\">\n <span className=\"paragraph-medium-semibold text-gray-950\">Alterar senha</span>\n <Button type=\"button\" variant=\"ghost\" className=\"size-8! p-0\" onClick={onBack}>\n <IconX size={18} />\n </Button>\n </div>\n\n <div className=\"flex flex-col gap-4\">\n <FormField\n label=\"Senha atual\"\n type=\"password\"\n placeholder=\"Digite sua senha atual\"\n leftIcon={IconLock}\n error={!!errors.currentPassword}\n errorMessage={errors.currentPassword?.message}\n classnameContainer=\"h-10!\"\n showPassword={showCurrentPw}\n onTogglePassword={toggleCurrentPw}\n {...register('currentPassword')}\n />\n <FormField\n label=\"Nova senha\"\n type=\"password\"\n placeholder=\"Digite sua nova senha\"\n leftIcon={IconLock}\n error={!!errors.newPassword}\n errorMessage={errors.newPassword?.message}\n classnameContainer=\"h-10!\"\n showPassword={showNewPw}\n onTogglePassword={toggleNewPw}\n {...register('newPassword')}\n />\n </div>\n\n <Button type=\"submit\" className=\"w-fit h-10!\">\n Salvar nova senha\n </Button>\n </form>\n );\n}\n"],"mappings":";AAwBM,SACE,KADF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