@greatapps/common 1.1.428 → 1.1.429

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/package.json +1 -1
  2. package/dist/components/account/AccountModals.mjs +0 -18
  3. package/dist/components/account/AccountModals.mjs.map +0 -1
  4. package/dist/components/account/ConfigurationsMyAccountModal.mjs +0 -129
  5. package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +0 -1
  6. package/dist/components/account/ConfirmDeleteAccountModal.mjs +0 -45
  7. package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +0 -1
  8. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +0 -45
  9. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +0 -1
  10. package/dist/components/account/DeleteAccountModal.mjs +0 -123
  11. package/dist/components/account/DeleteAccountModal.mjs.map +0 -1
  12. package/dist/components/account/DisableTwoFactorAuthModal.mjs +0 -67
  13. package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +0 -1
  14. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +0 -42
  15. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +0 -1
  16. package/dist/components/account/TwoFactorAuthModal.mjs +0 -182
  17. package/dist/components/account/TwoFactorAuthModal.mjs.map +0 -1
  18. package/dist/components/account/constants.mjs +0 -29
  19. package/dist/components/account/constants.mjs.map +0 -1
  20. package/dist/components/account/hooks/useChangeEmailForm.mjs +0 -53
  21. package/dist/components/account/hooks/useChangeEmailForm.mjs.map +0 -1
  22. package/dist/components/account/hooks/useChangePasswordForm.mjs +0 -47
  23. package/dist/components/account/hooks/useChangePasswordForm.mjs.map +0 -1
  24. package/dist/components/account/hooks/useChangePhoneForm.mjs +0 -91
  25. package/dist/components/account/hooks/useChangePhoneForm.mjs.map +0 -1
  26. package/dist/components/account/hooks/useConfigurationsModal.mjs +0 -34
  27. package/dist/components/account/hooks/useConfigurationsModal.mjs.map +0 -1
  28. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +0 -54
  29. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +0 -1
  30. package/dist/components/account/hooks/useOtpVerification.mjs +0 -94
  31. package/dist/components/account/hooks/useOtpVerification.mjs.map +0 -1
  32. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +0 -80
  33. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +0 -1
  34. package/dist/components/account/sections/ChangeEmailModal.mjs +0 -181
  35. package/dist/components/account/sections/ChangeEmailModal.mjs.map +0 -1
  36. package/dist/components/account/sections/ChangePasswordSection.mjs +0 -64
  37. package/dist/components/account/sections/ChangePasswordSection.mjs.map +0 -1
  38. package/dist/components/account/sections/ChangePhoneModal.mjs +0 -192
  39. package/dist/components/account/sections/ChangePhoneModal.mjs.map +0 -1
  40. package/dist/components/account/sections/MyProfileSection.mjs +0 -317
  41. package/dist/components/account/sections/MyProfileSection.mjs.map +0 -1
  42. package/dist/components/account/sections/PreferencesSection.mjs +0 -227
  43. package/dist/components/account/sections/PreferencesSection.mjs.map +0 -1
  44. package/dist/components/account/sections/SecuritySection.mjs +0 -31
  45. package/dist/components/account/sections/SecuritySection.mjs.map +0 -1
  46. package/dist/components/embeds/CrispEmbed.mjs +0 -89
  47. package/dist/components/embeds/CrispEmbed.mjs.map +0 -1
  48. package/dist/components/embeds/FrillEmbed.mjs +0 -107
  49. package/dist/components/embeds/FrillEmbed.mjs.map +0 -1
  50. package/dist/components/handlers/SearchParamsHandler.mjs +0 -24
  51. package/dist/components/handlers/SearchParamsHandler.mjs.map +0 -1
  52. package/dist/components/layouts/AppMobileNavBar.mjs +0 -60
  53. package/dist/components/layouts/AppMobileNavBar.mjs.map +0 -1
  54. package/dist/components/layouts/AppNavBar.mjs +0 -37
  55. package/dist/components/layouts/AppNavBar.mjs.map +0 -1
  56. package/dist/components/layouts/CollapsibleSidebar.mjs +0 -65
  57. package/dist/components/layouts/CollapsibleSidebar.mjs.map +0 -1
  58. package/dist/components/layouts/MainLayout.mjs +0 -60
  59. package/dist/components/layouts/MainLayout.mjs.map +0 -1
  60. package/dist/components/layouts/MdSideBarNavigation.mjs +0 -54
  61. package/dist/components/layouts/MdSideBarNavigation.mjs.map +0 -1
  62. package/dist/components/layouts/NavBar.mjs +0 -152
  63. package/dist/components/layouts/NavBar.mjs.map +0 -1
  64. package/dist/components/layouts/NavBarItem.mjs +0 -23
  65. package/dist/components/layouts/NavBarItem.mjs.map +0 -1
  66. package/dist/components/layouts/NotificationsPopover.mjs +0 -97
  67. package/dist/components/layouts/NotificationsPopover.mjs.map +0 -1
  68. package/dist/components/layouts/ProfilePopover.mjs +0 -152
  69. package/dist/components/layouts/ProfilePopover.mjs.map +0 -1
  70. package/dist/components/layouts/SideBarNavigation.mjs +0 -63
  71. package/dist/components/layouts/SideBarNavigation.mjs.map +0 -1
  72. package/dist/components/layouts/UsersSelectorPopover.mjs +0 -210
  73. package/dist/components/layouts/UsersSelectorPopover.mjs.map +0 -1
  74. package/dist/components/layouts/WhitelabelCodes.mjs +0 -50
  75. package/dist/components/layouts/WhitelabelCodes.mjs.map +0 -1
  76. package/dist/components/modals/BuyCreditsModal.mjs +0 -281
  77. package/dist/components/modals/BuyCreditsModal.mjs.map +0 -1
  78. package/dist/components/modals/ModalManager.mjs +0 -19
  79. package/dist/components/modals/ModalManager.mjs.map +0 -1
  80. package/dist/components/modals/Modals.mjs +0 -20
  81. package/dist/components/modals/Modals.mjs.map +0 -1
  82. package/dist/components/modals/PaidPlanRequiredModal.mjs +0 -46
  83. package/dist/components/modals/PaidPlanRequiredModal.mjs.map +0 -1
  84. package/dist/components/modals/cards/AddCardModal.mjs +0 -215
  85. package/dist/components/modals/cards/AddCardModal.mjs.map +0 -1
  86. package/dist/components/modals/cards/CardFormFields.mjs +0 -268
  87. package/dist/components/modals/cards/CardFormFields.mjs.map +0 -1
  88. package/dist/components/navigation/AppNavigation.mjs +0 -33
  89. package/dist/components/navigation/AppNavigation.mjs.map +0 -1
  90. package/dist/components/navigation/AppNavigationContext.mjs +0 -13
  91. package/dist/components/navigation/AppNavigationContext.mjs.map +0 -1
  92. package/dist/components/navigation/CancelledSubscriptionBanner.mjs +0 -52
  93. package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +0 -1
  94. package/dist/components/navigation/NavItem.mjs +0 -41
  95. package/dist/components/navigation/NavItem.mjs.map +0 -1
  96. package/dist/components/navigation/NavItemsContext.mjs +0 -16
  97. package/dist/components/navigation/NavItemsContext.mjs.map +0 -1
  98. package/dist/components/navigation/ProjectSelectorPopover.mjs +0 -147
  99. package/dist/components/navigation/ProjectSelectorPopover.mjs.map +0 -1
  100. package/dist/components/navigation/shells/DesktopShell.mjs +0 -11
  101. package/dist/components/navigation/shells/DesktopShell.mjs.map +0 -1
  102. package/dist/components/navigation/shells/MdShell.mjs +0 -11
  103. package/dist/components/navigation/shells/MdShell.mjs.map +0 -1
  104. package/dist/components/navigation/shells/MobileShell.mjs +0 -27
  105. package/dist/components/navigation/shells/MobileShell.mjs.map +0 -1
  106. package/dist/components/navigation/shells/TabsMobileShell.mjs +0 -61
  107. package/dist/components/navigation/shells/TabsMobileShell.mjs.map +0 -1
  108. package/dist/components/navigation/subcomponents/BottomLinks.mjs +0 -35
  109. package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +0 -1
  110. package/dist/components/navigation/subcomponents/CreditsCard.mjs +0 -33
  111. package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +0 -1
  112. package/dist/components/navigation/subcomponents/NavItems.mjs +0 -25
  113. package/dist/components/navigation/subcomponents/NavItems.mjs.map +0 -1
  114. package/dist/components/navigation/subcomponents/PlanCard.mjs +0 -25
  115. package/dist/components/navigation/subcomponents/PlanCard.mjs.map +0 -1
  116. package/dist/components/navigation/subcomponents/ProjectSelector.mjs +0 -145
  117. package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +0 -1
  118. package/dist/components/navigation/types.mjs +0 -1
  119. package/dist/components/navigation/types.mjs.map +0 -1
  120. package/dist/components/pages/NotFoundPage.mjs +0 -47
  121. package/dist/components/pages/NotFoundPage.mjs.map +0 -1
  122. package/dist/components/pages/notifications/Notifications.mjs +0 -156
  123. package/dist/components/pages/notifications/Notifications.mjs.map +0 -1
  124. package/dist/components/ui/buttons/Button.mjs +0 -52
  125. package/dist/components/ui/buttons/Button.mjs.map +0 -1
  126. package/dist/components/ui/buttons/CancelButton.mjs +0 -17
  127. package/dist/components/ui/buttons/CancelButton.mjs.map +0 -1
  128. package/dist/components/ui/buttons/CopyButton.mjs +0 -42
  129. package/dist/components/ui/buttons/CopyButton.mjs.map +0 -1
  130. package/dist/components/ui/data-display/Accordion.mjs +0 -76
  131. package/dist/components/ui/data-display/Accordion.mjs.map +0 -1
  132. package/dist/components/ui/data-display/Badge.mjs +0 -42
  133. package/dist/components/ui/data-display/Badge.mjs.map +0 -1
  134. package/dist/components/ui/data-display/Card.mjs +0 -92
  135. package/dist/components/ui/data-display/Card.mjs.map +0 -1
  136. package/dist/components/ui/data-display/CardBrandIcons.mjs +0 -484
  137. package/dist/components/ui/data-display/CardBrandIcons.mjs.map +0 -1
  138. package/dist/components/ui/data-display/CardItem.mjs +0 -67
  139. package/dist/components/ui/data-display/CardItem.mjs.map +0 -1
  140. package/dist/components/ui/data-display/Pagination.mjs +0 -118
  141. package/dist/components/ui/data-display/Pagination.mjs.map +0 -1
  142. package/dist/components/ui/data-display/PaymentInfoCard.mjs +0 -161
  143. package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +0 -1
  144. package/dist/components/ui/data-display/ScrollArea.mjs +0 -62
  145. package/dist/components/ui/data-display/ScrollArea.mjs.map +0 -1
  146. package/dist/components/ui/data-display/Separator.mjs +0 -28
  147. package/dist/components/ui/data-display/Separator.mjs.map +0 -1
  148. package/dist/components/ui/data-display/Table.mjs +0 -116
  149. package/dist/components/ui/data-display/Table.mjs.map +0 -1
  150. package/dist/components/ui/data-display/Tabs.mjs +0 -69
  151. package/dist/components/ui/data-display/Tabs.mjs.map +0 -1
  152. package/dist/components/ui/data-display/UserAvatar.mjs +0 -49
  153. package/dist/components/ui/data-display/UserAvatar.mjs.map +0 -1
  154. package/dist/components/ui/feedback/CircularProgress.mjs +0 -71
  155. package/dist/components/ui/feedback/CircularProgress.mjs.map +0 -1
  156. package/dist/components/ui/feedback/DefaultCircularProgress.mjs +0 -63
  157. package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +0 -1
  158. package/dist/components/ui/feedback/LoadingOverlay.mjs +0 -19
  159. package/dist/components/ui/feedback/LoadingOverlay.mjs.map +0 -1
  160. package/dist/components/ui/feedback/Progress.mjs +0 -37
  161. package/dist/components/ui/feedback/Progress.mjs.map +0 -1
  162. package/dist/components/ui/feedback/Skeleton.mjs +0 -9
  163. package/dist/components/ui/feedback/Skeleton.mjs.map +0 -1
  164. package/dist/components/ui/feedback/Toast.mjs +0 -77
  165. package/dist/components/ui/feedback/Toast.mjs.map +0 -1
  166. package/dist/components/ui/form/Calendar.mjs +0 -204
  167. package/dist/components/ui/form/Calendar.mjs.map +0 -1
  168. package/dist/components/ui/form/Checkbox.mjs +0 -33
  169. package/dist/components/ui/form/Checkbox.mjs.map +0 -1
  170. package/dist/components/ui/form/ComboboxField.mjs +0 -130
  171. package/dist/components/ui/form/ComboboxField.mjs.map +0 -1
  172. package/dist/components/ui/form/DatePicker.mjs +0 -82
  173. package/dist/components/ui/form/DatePicker.mjs.map +0 -1
  174. package/dist/components/ui/form/DateRangePicker.mjs +0 -92
  175. package/dist/components/ui/form/DateRangePicker.mjs.map +0 -1
  176. package/dist/components/ui/form/FormField.mjs +0 -103
  177. package/dist/components/ui/form/FormField.mjs.map +0 -1
  178. package/dist/components/ui/form/Input.mjs +0 -21
  179. package/dist/components/ui/form/Input.mjs.map +0 -1
  180. package/dist/components/ui/form/InputOtp.mjs +0 -70
  181. package/dist/components/ui/form/InputOtp.mjs.map +0 -1
  182. package/dist/components/ui/form/PhoneInput.mjs +0 -176
  183. package/dist/components/ui/form/PhoneInput.mjs.map +0 -1
  184. package/dist/components/ui/form/RadioGroup.mjs +0 -37
  185. package/dist/components/ui/form/RadioGroup.mjs.map +0 -1
  186. package/dist/components/ui/form/Select.mjs +0 -179
  187. package/dist/components/ui/form/Select.mjs.map +0 -1
  188. package/dist/components/ui/form/SelectField.mjs +0 -80
  189. package/dist/components/ui/form/SelectField.mjs.map +0 -1
  190. package/dist/components/ui/form/Switch.mjs +0 -33
  191. package/dist/components/ui/form/Switch.mjs.map +0 -1
  192. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs +0 -40
  193. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs.map +0 -1
  194. package/dist/components/ui/form/TextAreaField.mjs +0 -56
  195. package/dist/components/ui/form/TextAreaField.mjs.map +0 -1
  196. package/dist/components/ui/form/Textarea.mjs +0 -20
  197. package/dist/components/ui/form/Textarea.mjs.map +0 -1
  198. package/dist/components/ui/overlay/Command.mjs +0 -178
  199. package/dist/components/ui/overlay/Command.mjs.map +0 -1
  200. package/dist/components/ui/overlay/Dialog.mjs +0 -142
  201. package/dist/components/ui/overlay/Dialog.mjs.map +0 -1
  202. package/dist/components/ui/overlay/Popover.mjs +0 -46
  203. package/dist/components/ui/overlay/Popover.mjs.map +0 -1
  204. package/dist/components/ui/overlay/Sheet.mjs +0 -149
  205. package/dist/components/ui/overlay/Sheet.mjs.map +0 -1
  206. package/dist/components/ui/overlay/Tooltip.mjs +0 -57
  207. package/dist/components/ui/overlay/Tooltip.mjs.map +0 -1
  208. package/dist/components/widgets/notifications/NotificationCard.mjs +0 -54
  209. package/dist/components/widgets/notifications/NotificationCard.mjs.map +0 -1
  210. package/dist/enums/AccountSectionType.mjs +0 -11
  211. package/dist/enums/AccountSectionType.mjs.map +0 -1
  212. package/dist/hooks/copy-to-clipboard.hook.mjs +0 -52
  213. package/dist/hooks/copy-to-clipboard.hook.mjs.map +0 -1
  214. package/dist/hooks/useCountdownTimer.mjs +0 -29
  215. package/dist/hooks/useCountdownTimer.mjs.map +0 -1
  216. package/dist/hooks/useDebounce.mjs +0 -19
  217. package/dist/hooks/useDebounce.mjs.map +0 -1
  218. package/dist/hooks/useDebounceState.mjs +0 -12
  219. package/dist/hooks/useDebounceState.mjs.map +0 -1
  220. package/dist/hooks/useDebouncedEffect.mjs +0 -44
  221. package/dist/hooks/useDebouncedEffect.mjs.map +0 -1
  222. package/dist/hooks/useIsMobile.mjs +0 -18
  223. package/dist/hooks/useIsMobile.mjs.map +0 -1
  224. package/dist/hooks/usePasswordVisibility.mjs +0 -13
  225. package/dist/hooks/usePasswordVisibility.mjs.map +0 -1
  226. package/dist/index.mjs +0 -528
  227. package/dist/index.mjs.map +0 -1
  228. package/dist/infra/api/client.mjs +0 -162
  229. package/dist/infra/api/client.mjs.map +0 -1
  230. package/dist/infra/api/types.mjs +0 -31
  231. package/dist/infra/api/types.mjs.map +0 -1
  232. package/dist/infra/utils/client-info.mjs +0 -27
  233. package/dist/infra/utils/client-info.mjs.map +0 -1
  234. package/dist/infra/utils/clsx.mjs +0 -9
  235. package/dist/infra/utils/clsx.mjs.map +0 -1
  236. package/dist/infra/utils/date.mjs +0 -11
  237. package/dist/infra/utils/date.mjs.map +0 -1
  238. package/dist/infra/utils/params.mjs +0 -21
  239. package/dist/infra/utils/params.mjs.map +0 -1
  240. package/dist/infra/utils/parser.mjs +0 -24
  241. package/dist/infra/utils/parser.mjs.map +0 -1
  242. package/dist/infra/utils/percentage.mjs +0 -20
  243. package/dist/infra/utils/percentage.mjs.map +0 -1
  244. package/dist/middleware.mjs +0 -10
  245. package/dist/middleware.mjs.map +0 -1
  246. package/dist/middlewares/chain.mjs +0 -37
  247. package/dist/middlewares/chain.mjs.map +0 -1
  248. package/dist/middlewares/create-auth-middleware.mjs +0 -32
  249. package/dist/middlewares/create-auth-middleware.mjs.map +0 -1
  250. package/dist/middlewares/types.mjs +0 -11
  251. package/dist/middlewares/types.mjs.map +0 -1
  252. package/dist/modules/accounts/actions/account-management.action.mjs +0 -98
  253. package/dist/modules/accounts/actions/account-management.action.mjs.map +0 -1
  254. package/dist/modules/accounts/actions/find-current-account.action.mjs +0 -10
  255. package/dist/modules/accounts/actions/find-current-account.action.mjs.map +0 -1
  256. package/dist/modules/accounts/actions/list-currencies.action.mjs +0 -10
  257. package/dist/modules/accounts/actions/list-currencies.action.mjs.map +0 -1
  258. package/dist/modules/accounts/actions/list-timezones.action.mjs +0 -10
  259. package/dist/modules/accounts/actions/list-timezones.action.mjs.map +0 -1
  260. package/dist/modules/accounts/hooks/current-account.hook.mjs +0 -24
  261. package/dist/modules/accounts/hooks/current-account.hook.mjs.map +0 -1
  262. package/dist/modules/accounts/hooks/useAccountManagement.mjs +0 -71
  263. package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +0 -1
  264. package/dist/modules/accounts/hooks/useCurrencies.mjs +0 -17
  265. package/dist/modules/accounts/hooks/useCurrencies.mjs.map +0 -1
  266. package/dist/modules/accounts/hooks/useTimezones.mjs +0 -17
  267. package/dist/modules/accounts/hooks/useTimezones.mjs.map +0 -1
  268. package/dist/modules/accounts/hooks/useViaCep.mjs +0 -19
  269. package/dist/modules/accounts/hooks/useViaCep.mjs.map +0 -1
  270. package/dist/modules/accounts/services/account.service.mjs +0 -182
  271. package/dist/modules/accounts/services/account.service.mjs.map +0 -1
  272. package/dist/modules/accounts/services/currency.service.mjs +0 -24
  273. package/dist/modules/accounts/services/currency.service.mjs.map +0 -1
  274. package/dist/modules/accounts/services/timezone.service.mjs +0 -65
  275. package/dist/modules/accounts/services/timezone.service.mjs.map +0 -1
  276. package/dist/modules/accounts/services/two-factor.service.mjs +0 -78
  277. package/dist/modules/accounts/services/two-factor.service.mjs.map +0 -1
  278. package/dist/modules/accounts/types.mjs +0 -1
  279. package/dist/modules/accounts/types.mjs.map +0 -1
  280. package/dist/modules/auth/actions/login.action.mjs +0 -14
  281. package/dist/modules/auth/actions/login.action.mjs.map +0 -1
  282. package/dist/modules/auth/actions/logout.action.mjs +0 -14
  283. package/dist/modules/auth/actions/logout.action.mjs.map +0 -1
  284. package/dist/modules/auth/actions/register.action.mjs +0 -14
  285. package/dist/modules/auth/actions/register.action.mjs.map +0 -1
  286. package/dist/modules/auth/actions/validate-session.action.mjs +0 -48
  287. package/dist/modules/auth/actions/validate-session.action.mjs.map +0 -1
  288. package/dist/modules/auth/actions/verify-two-factor.action.mjs +0 -17
  289. package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +0 -1
  290. package/dist/modules/auth/hooks/login.hook.mjs +0 -13
  291. package/dist/modules/auth/hooks/login.hook.mjs.map +0 -1
  292. package/dist/modules/auth/hooks/logout.hook.mjs +0 -13
  293. package/dist/modules/auth/hooks/logout.hook.mjs.map +0 -1
  294. package/dist/modules/auth/hooks/register.hook.mjs +0 -13
  295. package/dist/modules/auth/hooks/register.hook.mjs.map +0 -1
  296. package/dist/modules/auth/hooks/useManagementPermissions.mjs +0 -41
  297. package/dist/modules/auth/hooks/useManagementPermissions.mjs.map +0 -1
  298. package/dist/modules/auth/hooks/useUserQuery.mjs +0 -63
  299. package/dist/modules/auth/hooks/useUserQuery.mjs.map +0 -1
  300. package/dist/modules/auth/schema.mjs +0 -1
  301. package/dist/modules/auth/schema.mjs.map +0 -1
  302. package/dist/modules/auth/services/auth.service.mjs +0 -342
  303. package/dist/modules/auth/services/auth.service.mjs.map +0 -1
  304. package/dist/modules/auth/types/management-permission.type.mjs +0 -1
  305. package/dist/modules/auth/types/management-permission.type.mjs.map +0 -1
  306. package/dist/modules/auth/utils/assert-management-permission.mjs +0 -42
  307. package/dist/modules/auth/utils/assert-management-permission.mjs.map +0 -1
  308. package/dist/modules/auth/utils/assert-management-subscription.mjs +0 -33
  309. package/dist/modules/auth/utils/assert-management-subscription.mjs.map +0 -1
  310. package/dist/modules/auth/utils/assert-paid-subscription.mjs +0 -40
  311. package/dist/modules/auth/utils/assert-paid-subscription.mjs.map +0 -1
  312. package/dist/modules/auth/utils/assert-subscription-addon.mjs +0 -35
  313. package/dist/modules/auth/utils/assert-subscription-addon.mjs.map +0 -1
  314. package/dist/modules/auth/utils/build-wl-override.mjs +0 -27
  315. package/dist/modules/auth/utils/build-wl-override.mjs.map +0 -1
  316. package/dist/modules/auth/utils/get-user-context.mjs +0 -25
  317. package/dist/modules/auth/utils/get-user-context.mjs.map +0 -1
  318. package/dist/modules/cards/actions/create-card.action.mjs +0 -10
  319. package/dist/modules/cards/actions/create-card.action.mjs.map +0 -1
  320. package/dist/modules/cards/actions/list-cards.action.mjs +0 -10
  321. package/dist/modules/cards/actions/list-cards.action.mjs.map +0 -1
  322. package/dist/modules/cards/hooks/cards.hook.mjs +0 -16
  323. package/dist/modules/cards/hooks/cards.hook.mjs.map +0 -1
  324. package/dist/modules/cards/hooks/create-card.hook.mjs +0 -18
  325. package/dist/modules/cards/hooks/create-card.hook.mjs.map +0 -1
  326. package/dist/modules/cards/services/cards.service.mjs +0 -44
  327. package/dist/modules/cards/services/cards.service.mjs.map +0 -1
  328. package/dist/modules/cards/types.mjs +0 -27
  329. package/dist/modules/cards/types.mjs.map +0 -1
  330. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs +0 -10
  331. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs.map +0 -1
  332. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +0 -76
  333. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +0 -1
  334. package/dist/modules/ia-credits/services/ia-credits.service.mjs +0 -31
  335. package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +0 -1
  336. package/dist/modules/ia-credits/types.mjs +0 -25
  337. package/dist/modules/ia-credits/types.mjs.map +0 -1
  338. package/dist/modules/plans/actions/find-plan-by-id.action.mjs +0 -10
  339. package/dist/modules/plans/actions/find-plan-by-id.action.mjs.map +0 -1
  340. package/dist/modules/plans/hooks/use-has-plan-addon.hook.mjs +0 -13
  341. package/dist/modules/plans/hooks/use-has-plan-addon.hook.mjs.map +0 -1
  342. package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs +0 -15
  343. package/dist/modules/plans/hooks/use-plan-by-id.hook.mjs.map +0 -1
  344. package/dist/modules/plans/services/plans.service.mjs +0 -34
  345. package/dist/modules/plans/services/plans.service.mjs.map +0 -1
  346. package/dist/modules/plans/types/plan.type.mjs +0 -20
  347. package/dist/modules/plans/types/plan.type.mjs.map +0 -1
  348. package/dist/modules/projects/actions/add-project-user.action.mjs +0 -10
  349. package/dist/modules/projects/actions/add-project-user.action.mjs.map +0 -1
  350. package/dist/modules/projects/actions/list-all-account-users.action.mjs +0 -10
  351. package/dist/modules/projects/actions/list-all-account-users.action.mjs.map +0 -1
  352. package/dist/modules/projects/actions/list-available-users.action.mjs +0 -10
  353. package/dist/modules/projects/actions/list-available-users.action.mjs.map +0 -1
  354. package/dist/modules/projects/actions/list-project-users.action.mjs +0 -10
  355. package/dist/modules/projects/actions/list-project-users.action.mjs.map +0 -1
  356. package/dist/modules/projects/actions/remove-project-user.action.mjs +0 -10
  357. package/dist/modules/projects/actions/remove-project-user.action.mjs.map +0 -1
  358. package/dist/modules/projects/hooks/add-project-user.hook.mjs +0 -61
  359. package/dist/modules/projects/hooks/add-project-user.hook.mjs.map +0 -1
  360. package/dist/modules/projects/hooks/list-all-account-users.hook.mjs +0 -35
  361. package/dist/modules/projects/hooks/list-all-account-users.hook.mjs.map +0 -1
  362. package/dist/modules/projects/hooks/list-available-users.hook.mjs +0 -34
  363. package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +0 -1
  364. package/dist/modules/projects/hooks/list-project-users.hook.mjs +0 -34
  365. package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +0 -1
  366. package/dist/modules/projects/hooks/remove-project-user.hook.mjs +0 -61
  367. package/dist/modules/projects/hooks/remove-project-user.hook.mjs.map +0 -1
  368. package/dist/modules/projects/services/project-users.service.mjs +0 -96
  369. package/dist/modules/projects/services/project-users.service.mjs.map +0 -1
  370. package/dist/modules/projects/types.mjs +0 -23
  371. package/dist/modules/projects/types.mjs.map +0 -1
  372. package/dist/modules/subscriptions/actions/calculate-subscription.action.mjs +0 -10
  373. package/dist/modules/subscriptions/actions/calculate-subscription.action.mjs.map +0 -1
  374. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs +0 -10
  375. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs.map +0 -1
  376. package/dist/modules/subscriptions/actions/update-subscription-plan.action.mjs +0 -12
  377. package/dist/modules/subscriptions/actions/update-subscription-plan.action.mjs.map +0 -1
  378. package/dist/modules/subscriptions/constants/addons.constants.mjs +0 -24
  379. package/dist/modules/subscriptions/constants/addons.constants.mjs.map +0 -1
  380. package/dist/modules/subscriptions/constants/query-keys.constants.mjs +0 -5
  381. package/dist/modules/subscriptions/constants/query-keys.constants.mjs.map +0 -1
  382. package/dist/modules/subscriptions/hooks/calculate-subscription.hook.mjs +0 -13
  383. package/dist/modules/subscriptions/hooks/calculate-subscription.hook.mjs.map +0 -1
  384. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +0 -17
  385. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +0 -1
  386. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +0 -17
  387. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +0 -1
  388. package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs +0 -22
  389. package/dist/modules/subscriptions/hooks/update-subscription-plan.hook.mjs.map +0 -1
  390. package/dist/modules/subscriptions/hooks/use-cancelled-subscription-guard.mjs +0 -37
  391. package/dist/modules/subscriptions/hooks/use-cancelled-subscription-guard.mjs.map +0 -1
  392. package/dist/modules/subscriptions/services/subscriptions.service.mjs +0 -75
  393. package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +0 -1
  394. package/dist/modules/subscriptions/types/billing-period.type.mjs +0 -1
  395. package/dist/modules/subscriptions/types/billing-period.type.mjs.map +0 -1
  396. package/dist/modules/subscriptions/types/calculate-subscription.type.mjs +0 -72
  397. package/dist/modules/subscriptions/types/calculate-subscription.type.mjs.map +0 -1
  398. package/dist/modules/subscriptions/types/subscription.type.mjs +0 -57
  399. package/dist/modules/subscriptions/types/subscription.type.mjs.map +0 -1
  400. package/dist/modules/subscriptions/utils/build-plan-extras.mjs +0 -37
  401. package/dist/modules/subscriptions/utils/build-plan-extras.mjs.map +0 -1
  402. package/dist/modules/subscriptions/utils/has-subscription-expired.mjs +0 -10
  403. package/dist/modules/subscriptions/utils/has-subscription-expired.mjs.map +0 -1
  404. package/dist/modules/subscriptions/utils/periodicity.mjs +0 -48
  405. package/dist/modules/subscriptions/utils/periodicity.mjs.map +0 -1
  406. package/dist/modules/subscriptions/utils/resolve-plan-extras-prices.mjs +0 -14
  407. package/dist/modules/subscriptions/utils/resolve-plan-extras-prices.mjs.map +0 -1
  408. package/dist/modules/users/action/find-user-by-id.action.mjs +0 -10
  409. package/dist/modules/users/action/find-user-by-id.action.mjs.map +0 -1
  410. package/dist/modules/users/action/list-messages.action.mjs +0 -13
  411. package/dist/modules/users/action/list-messages.action.mjs.map +0 -1
  412. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs +0 -10
  413. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs.map +0 -1
  414. package/dist/modules/users/action/mark-message-as-read.action.mjs +0 -10
  415. package/dist/modules/users/action/mark-message-as-read.action.mjs.map +0 -1
  416. package/dist/modules/users/hooks/messages.hook.mjs +0 -57
  417. package/dist/modules/users/hooks/messages.hook.mjs.map +0 -1
  418. package/dist/modules/users/schema/messages.schema.mjs +0 -21
  419. package/dist/modules/users/schema/messages.schema.mjs.map +0 -1
  420. package/dist/modules/users/schema.mjs +0 -11
  421. package/dist/modules/users/schema.mjs.map +0 -1
  422. package/dist/modules/users/services/messages.service.mjs +0 -35
  423. package/dist/modules/users/services/messages.service.mjs.map +0 -1
  424. package/dist/modules/users/services/user.service.mjs +0 -52
  425. package/dist/modules/users/services/user.service.mjs.map +0 -1
  426. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +0 -21
  427. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +0 -1
  428. package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs +0 -19
  429. package/dist/modules/whitelabel/actions/revalidate-whitelabel.action.mjs.map +0 -1
  430. package/dist/modules/whitelabel/schema.mjs +0 -1
  431. package/dist/modules/whitelabel/schema.mjs.map +0 -1
  432. package/dist/modules/whitelabel/services/whitelabel.service.mjs +0 -146
  433. package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +0 -1
  434. package/dist/modules/whitelabel/utils/normalize-hostname.mjs +0 -35
  435. package/dist/modules/whitelabel/utils/normalize-hostname.mjs.map +0 -1
  436. package/dist/providers/auth.provider.mjs +0 -114
  437. package/dist/providers/auth.provider.mjs.map +0 -1
  438. package/dist/providers/query.provider.mjs +0 -99
  439. package/dist/providers/query.provider.mjs.map +0 -1
  440. package/dist/providers/whitelabel.provider.mjs +0 -42
  441. package/dist/providers/whitelabel.provider.mjs.map +0 -1
  442. package/dist/server.mjs +0 -111
  443. package/dist/server.mjs.map +0 -1
  444. package/dist/store/useAccountModals.mjs +0 -18
  445. package/dist/store/useAccountModals.mjs.map +0 -1
  446. package/dist/store/useBuyCreditsModal.mjs +0 -16
  447. package/dist/store/useBuyCreditsModal.mjs.map +0 -1
  448. package/dist/store/useDesktopSidebarStore.mjs +0 -39
  449. package/dist/store/useDesktopSidebarStore.mjs.map +0 -1
  450. package/dist/store/useMdSidebarStore.mjs +0 -28
  451. package/dist/store/useMdSidebarStore.mjs.map +0 -1
  452. package/dist/store/useMobileNavbarSheet.mjs +0 -14
  453. package/dist/store/useMobileNavbarSheet.mjs.map +0 -1
  454. package/dist/store/useModalManager.mjs +0 -75
  455. package/dist/store/useModalManager.mjs.map +0 -1
  456. package/dist/store/usePaidPlanRequiredModal.mjs +0 -14
  457. package/dist/store/usePaidPlanRequiredModal.mjs.map +0 -1
  458. package/dist/utils/browser/clipboard.mjs +0 -36
  459. package/dist/utils/browser/clipboard.mjs.map +0 -1
  460. package/dist/utils/constants/br-states.mjs +0 -33
  461. package/dist/utils/constants/br-states.mjs.map +0 -1
  462. package/dist/utils/countries.mjs +0 -219
  463. package/dist/utils/countries.mjs.map +0 -1
  464. package/dist/utils/file/index.mjs +0 -9
  465. package/dist/utils/file/index.mjs.map +0 -1
  466. package/dist/utils/format/masks.mjs +0 -67
  467. package/dist/utils/format/masks.mjs.map +0 -1
  468. package/dist/utils/intl/locales.mjs +0 -12
  469. package/dist/utils/intl/locales.mjs.map +0 -1
  470. package/dist/utils/safeServerAction.mjs +0 -16
  471. package/dist/utils/safeServerAction.mjs.map +0 -1
  472. package/dist/utils/validators/account.mjs +0 -27
  473. package/dist/utils/validators/account.mjs.map +0 -1
  474. package/dist/utils/validators/common.mjs +0 -47
  475. package/dist/utils/validators/common.mjs.map +0 -1
  476. package/dist/utils/withAction.mjs +0 -13
  477. package/dist/utils/withAction.mjs.map +0 -1
@@ -1,182 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { IconX, IconCopy, IconRefresh } 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 useTwoFactorAuthForm from "./hooks/useTwoFactorAuthForm";
9
- function TwoFactorAuthModal({ open, onClose, onSuccess }) {
10
- const {
11
- code,
12
- setCode,
13
- isCodeComplete,
14
- isGenerating,
15
- isConfirming,
16
- generateFailed,
17
- retryGenerate,
18
- qrcode,
19
- backupCodes,
20
- step,
21
- handleSubmit,
22
- handleFinalize,
23
- handleCopyCodes,
24
- resetForm
25
- } = useTwoFactorAuthForm({ onSuccess, open });
26
- const handleClose = () => {
27
- resetForm();
28
- onClose();
29
- };
30
- if (step === "recovery") {
31
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(
32
- DialogContent,
33
- {
34
- showCloseButton: false,
35
- overlayClassName: "z-[1010]",
36
- className: "z-[1011] flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] 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%]",
37
- children: [
38
- /* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "C\xF3digos de seguran\xE7a" }) }),
39
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0", children: [
40
- /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950 text-center", children: "C\xF3digos de seguran\xE7a" }),
41
- /* @__PURE__ */ jsx(
42
- Button,
43
- {
44
- type: "button",
45
- variant: "ghost",
46
- className: "size-8! p-0 absolute right-4",
47
- onClick: handleClose,
48
- children: /* @__PURE__ */ jsx(IconX, { size: 18 })
49
- }
50
- )
51
- ] }),
52
- /* @__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: [
53
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
54
- /* @__PURE__ */ jsx("h3", { className: "paragraph-medium-semibold text-gray-950 max-w-[269px]", children: "Salve estes c\xF3digos de recupera\xE7\xE3o de emerg\xEAncia" }),
55
- /* @__PURE__ */ jsxs("div", { className: "paragraph-small-regular text-gray-600", children: [
56
- /* @__PURE__ */ jsx("p", { children: "Se voc\xEA perder acesso ao seu telefone, n\xE3o ser\xE1 poss\xEDvel fazer login em sua conta sem um c\xF3digo de dois fatores." }),
57
- /* @__PURE__ */ jsx("br", {}),
58
- /* @__PURE__ */ jsx("p", { children: "Imprima, copie ou escreva em um local seguro os c\xF3digos abaixo." })
59
- ] })
60
- ] }),
61
- /* @__PURE__ */ jsxs("div", { className: "bg-gray-50 rounded-lg p-4 flex flex-col gap-4", children: [
62
- /* @__PURE__ */ jsx("div", { className: "paragraph-small-medium text-gray-950 whitespace-nowrap", children: backupCodes.map((backupCode, i) => /* @__PURE__ */ jsx("p", { children: backupCode }, i)) }),
63
- /* @__PURE__ */ jsxs(
64
- Button,
65
- {
66
- type: "button",
67
- variant: "secondary",
68
- className: "h-8! w-fit",
69
- onClick: handleCopyCodes,
70
- children: [
71
- /* @__PURE__ */ jsx(IconCopy, { size: 16 }),
72
- "Copiar c\xF3digos"
73
- ]
74
- }
75
- )
76
- ] })
77
- ] }),
78
- /* @__PURE__ */ jsxs("div", { className: "flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between mt-auto lg:mt-0", children: [
79
- /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children: "Cancelar" }),
80
- /* @__PURE__ */ jsx(Button, { className: "h-10!", type: "button", onClick: handleFinalize, children: "Finalizar" })
81
- ] })
82
- ]
83
- }
84
- ) });
85
- }
86
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(
87
- DialogContent,
88
- {
89
- showCloseButton: false,
90
- overlayClassName: "z-[1010]",
91
- className: "z-[1011] flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] lg:h-auto lg:max-h-[90vh] 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%]",
92
- children: [
93
- /* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "Autentica\xE7\xE3o de dois fatores" }) }),
94
- /* @__PURE__ */ jsxs("div", { className: "shrink-0 flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0", children: [
95
- /* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950 text-center", children: "Autentica\xE7\xE3o de dois fatores" }),
96
- /* @__PURE__ */ jsx(
97
- Button,
98
- {
99
- type: "button",
100
- variant: "ghost",
101
- className: "size-8! p-0 absolute right-4",
102
- onClick: handleClose,
103
- children: /* @__PURE__ */ jsx(IconX, { size: 18 })
104
- }
105
- )
106
- ] }),
107
- /* @__PURE__ */ jsxs(
108
- "form",
109
- {
110
- className: "flex-1 min-h-0 flex flex-col",
111
- onSubmit: (e) => {
112
- e.preventDefault();
113
- if (isCodeComplete) handleSubmit();
114
- },
115
- children: [
116
- /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto overscroll-contain lg:overflow-visible", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4 lg:gap-8 px-4 lg:px-5 py-4 lg:py-6 pb-60 lg:pb-6", children: [
117
- /* @__PURE__ */ jsxs("p", { className: "paragraph-small-regular text-gray-950 text-center max-w-full lg:max-w-[412px]", children: [
118
- "Instale um aplicativo autenticador no seu celular (ex.:",
119
- " ",
120
- /* @__PURE__ */ jsx(
121
- "a",
122
- {
123
- href: "https://support.google.com/accounts/answer/1066447",
124
- target: "_blank",
125
- rel: "noopener noreferrer",
126
- className: "paragraph-small-medium underline",
127
- children: "Google Authenticator"
128
- }
129
- ),
130
- "), escaneie o QR Code ao lado ou copie a chave no aplicativo e, em seguida, digite o c\xF3digo de 6 d\xEDgitos gerado para continuar."
131
- ] }),
132
- /* @__PURE__ */ jsx("div", { className: "border border-gray-200 rounded-lg overflow-hidden p-2 lg:p-3 flex items-center justify-center w-[136px] h-[136px] lg:w-[203px] lg:h-[203px]", children: generateFailed ? /* @__PURE__ */ jsxs(
133
- "button",
134
- {
135
- type: "button",
136
- onClick: () => retryGenerate(),
137
- className: "flex flex-col items-center gap-1.5 text-center",
138
- children: [
139
- /* @__PURE__ */ jsx(IconRefresh, { size: 20, className: "text-gray-400" }),
140
- /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-gray-500", children: "Tentar novamente" })
141
- ]
142
- }
143
- ) : isGenerating || !qrcode ? /* @__PURE__ */ jsx("div", { className: "skeleton w-full h-full rounded" }) : (
144
- // eslint-disable-next-line @next/next/no-img-element
145
- /* @__PURE__ */ jsx(
146
- "img",
147
- {
148
- src: qrcode,
149
- alt: "QR Code para autentica\xE7\xE3o de dois fatores",
150
- className: "w-full h-full"
151
- }
152
- )
153
- ) }),
154
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 w-full", children: [
155
- /* @__PURE__ */ jsx(Separator, { className: "flex-1" }),
156
- /* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-gray-500 opacity-80 whitespace-nowrap", children: "Cole os 6 d\xEDgitos abaixo" }),
157
- /* @__PURE__ */ jsx(Separator, { className: "flex-1" })
158
- ] }),
159
- /* @__PURE__ */ jsx("div", { className: "scroll-mt-20", children: /* @__PURE__ */ jsx(InputOTP, { maxLength: 6, value: code, onChange: setCode, children: /* @__PURE__ */ jsx(InputOTPGroup, { className: "gap-2", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx(
160
- InputOTPSlot,
161
- {
162
- index: i,
163
- className: "w-11! lg:w-12! h-13! lg:h-14! rounded-lg! text-lg border-gray-200"
164
- },
165
- i
166
- )) }) }) })
167
- ] }) }),
168
- /* @__PURE__ */ jsxs("div", { className: "shrink-0 flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between gap-2 bg-white", children: [
169
- /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children: "Cancelar" }),
170
- /* @__PURE__ */ jsx(Button, { type: "submit", className: "h-10!", disabled: !isCodeComplete || isConfirming, children: isConfirming ? "Ativando..." : "Ativar autentica\xE7\xE3o" })
171
- ] })
172
- ]
173
- }
174
- )
175
- ]
176
- }
177
- ) });
178
- }
179
- export {
180
- TwoFactorAuthModal as default
181
- };
182
- //# sourceMappingURL=TwoFactorAuthModal.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/account/TwoFactorAuthModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconX, IconCopy, IconRefresh } 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 useTwoFactorAuthForm from './hooks/useTwoFactorAuthForm';\n\ninterface TwoFactorAuthModalProps {\n open: boolean;\n onClose: () => void;\n onSuccess?: () => void;\n}\n\nexport default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFactorAuthModalProps) {\n const {\n code,\n setCode,\n isCodeComplete,\n isGenerating,\n isConfirming,\n generateFailed,\n retryGenerate,\n qrcode,\n backupCodes,\n step,\n handleSubmit,\n handleFinalize,\n handleCopyCodes,\n resetForm,\n } = useTwoFactorAuthForm({ onSuccess, open });\n\n const handleClose = () => {\n resetForm();\n onClose();\n };\n\n if (step === 'recovery') {\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent\n showCloseButton={false}\n overlayClassName=\"z-[1010]\"\n className=\"z-[1011] flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] 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%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Códigos de segurança</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 Códigos de segurança\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n className=\"size-8! p-0 absolute right-4\"\n onClick={handleClose}\n >\n <IconX size={18} />\n </Button>\n </div>\n\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-2\">\n <h3 className=\"paragraph-medium-semibold text-gray-950 max-w-[269px]\">\n Salve estes códigos de recuperação de emergência\n </h3>\n <div className=\"paragraph-small-regular text-gray-600\">\n <p>\n Se você perder acesso ao seu telefone, não será possível fazer login em sua conta\n sem um código de dois fatores.\n </p>\n <br />\n <p>Imprima, copie ou escreva em um local seguro os códigos abaixo.</p>\n </div>\n </div>\n\n <div className=\"bg-gray-50 rounded-lg p-4 flex flex-col gap-4\">\n <div className=\"paragraph-small-medium text-gray-950 whitespace-nowrap\">\n {backupCodes.map((backupCode, i) => (\n <p key={i}>{backupCode}</p>\n ))}\n </div>\n <Button\n type=\"button\"\n variant=\"secondary\"\n className=\"h-8! w-fit\"\n onClick={handleCopyCodes}\n >\n <IconCopy size={16} />\n Copiar códigos\n </Button>\n </div>\n </div>\n\n <div className=\"flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between 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=\"button\" onClick={handleFinalize}>\n Finalizar\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n }\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent\n showCloseButton={false}\n overlayClassName=\"z-[1010]\"\n className=\"z-[1011] flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] lg:h-auto lg:max-h-[90vh] 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%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Autenticação de dois fatores</DialogTitle>\n </DialogHeader>\n <div className=\"shrink-0 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 Autenticação de dois fatores\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n className=\"size-8! p-0 absolute right-4\"\n onClick={handleClose}\n >\n <IconX size={18} />\n </Button>\n </div>\n\n <form\n className=\"flex-1 min-h-0 flex flex-col\"\n onSubmit={(e) => {\n e.preventDefault();\n if (isCodeComplete) handleSubmit();\n }}\n >\n <div className=\"flex-1 min-h-0 overflow-y-auto overscroll-contain lg:overflow-visible\">\n <div className=\"flex flex-col items-center gap-4 lg:gap-8 px-4 lg:px-5 py-4 lg:py-6 pb-60 lg:pb-6\">\n <p className=\"paragraph-small-regular text-gray-950 text-center max-w-full lg:max-w-[412px]\">\n Instale um aplicativo autenticador no seu celular (ex.:{' '}\n <a\n href=\"https://support.google.com/accounts/answer/1066447\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"paragraph-small-medium underline\"\n >\n Google Authenticator\n </a>\n ), escaneie o QR Code ao lado ou copie a chave no aplicativo e, em seguida, digite o\n código de 6 dígitos gerado para continuar.\n </p>\n\n <div className=\"border border-gray-200 rounded-lg overflow-hidden p-2 lg:p-3 flex items-center justify-center w-[136px] h-[136px] lg:w-[203px] lg:h-[203px]\">\n {generateFailed ? (\n <button\n type=\"button\"\n onClick={() => retryGenerate()}\n className=\"flex flex-col items-center gap-1.5 text-center\"\n >\n <IconRefresh size={20} className=\"text-gray-400\" />\n <span className=\"paragraph-xsmall-medium text-gray-500\">Tentar novamente</span>\n </button>\n ) : isGenerating || !qrcode ? (\n <div className=\"skeleton w-full h-full rounded\" />\n ) : (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n src={qrcode}\n alt=\"QR Code para autenticação de dois fatores\"\n className=\"w-full h-full\"\n />\n )}\n </div>\n\n <div className=\"flex items-center gap-3 w-full\">\n <Separator className=\"flex-1\" />\n <span className=\"paragraph-xsmall-medium text-gray-500 opacity-80 whitespace-nowrap\">\n Cole os 6 dígitos abaixo\n </span>\n <Separator className=\"flex-1\" />\n </div>\n\n <div className=\"scroll-mt-20\">\n <InputOTP maxLength={6} value={code} onChange={setCode}>\n <InputOTPGroup className=\"gap-2\">\n {Array.from({ length: 6 }).map((_, i) => (\n <InputOTPSlot\n key={i}\n index={i}\n className=\"w-11! lg:w-12! h-13! lg:h-14! rounded-lg! text-lg border-gray-200\"\n />\n ))}\n </InputOTPGroup>\n </InputOTP>\n </div>\n </div>\n </div>\n\n <div className=\"shrink-0 flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between gap-2 bg-white\">\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={handleClose}>\n Cancelar\n </Button>\n <Button type=\"submit\" className=\"h-10!\" disabled={!isCodeComplete || isConfirming}>\n {isConfirming ? 'Ativando...' : 'Ativar autenticação'}\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":"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","names":[]}
@@ -1,29 +0,0 @@
1
- import { buildLocaleOptions } from "../../utils/intl/locales";
2
- const GENDER_OPTIONS = [
3
- { value: "masculino", label: "Masculino", apiValue: 1 },
4
- { value: "feminino", label: "Feminino", apiValue: 0 }
5
- ];
6
- const LANGUAGE_OPTIONS = buildLocaleOptions();
7
- const CURRENCY_OPTIONS = [
8
- { value: "BRL", label: "BRL (R$)", displayValue: "BRL (R$)" },
9
- { value: "USD", label: "USD ($)", displayValue: "USD ($)" },
10
- { value: "EUR", label: "EUR (\u20AC)", displayValue: "EUR (\u20AC)" }
11
- ];
12
- const TIME_FORMAT_OPTIONS = [
13
- { value: "24h", label: "24 horas", displayValue: "24 horas" },
14
- { value: "12h", label: "12 horas (AM/PM)", displayValue: "12 horas (AM/PM)" }
15
- ];
16
- const NOTIFICATION_TYPES = [
17
- "Atualiza\xE7\xF5es de projetos",
18
- "Alertas de seguran\xE7a",
19
- "Mudan\xE7as no plano ou faturamento",
20
- "Manuten\xE7\xF5es programadas"
21
- ];
22
- export {
23
- CURRENCY_OPTIONS,
24
- GENDER_OPTIONS,
25
- LANGUAGE_OPTIONS,
26
- NOTIFICATION_TYPES,
27
- TIME_FORMAT_OPTIONS
28
- };
29
- //# sourceMappingURL=constants.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/account/constants.ts"],"sourcesContent":["import { buildLocaleOptions } from '../../utils/intl/locales';\r\n\r\nexport const GENDER_OPTIONS = [\r\n { value: 'masculino', label: 'Masculino', apiValue: 1 },\r\n { value: 'feminino', label: 'Feminino', apiValue: 0 },\r\n];\r\n\r\nexport const LANGUAGE_OPTIONS = buildLocaleOptions();\r\n\r\nexport const CURRENCY_OPTIONS = [\r\n { value: 'BRL', label: 'BRL (R$)', displayValue: 'BRL (R$)' },\r\n { value: 'USD', label: 'USD ($)', displayValue: 'USD ($)' },\r\n { value: 'EUR', label: 'EUR (€)', displayValue: 'EUR (€)' },\r\n];\r\n\r\nexport const TIME_FORMAT_OPTIONS = [\r\n { value: '24h', label: '24 horas', displayValue: '24 horas' },\r\n { value: '12h', label: '12 horas (AM/PM)', displayValue: '12 horas (AM/PM)' },\r\n];\r\n\r\nexport const NOTIFICATION_TYPES = [\r\n 'Atualizações de projetos',\r\n 'Alertas de segurança',\r\n 'Mudanças no plano ou faturamento',\r\n 'Manutenções programadas',\r\n];\r\n"],"mappings":"AAAA,SAAS,0BAA0B;AAE5B,MAAM,iBAAiB;AAAA,EAC5B,EAAE,OAAO,aAAa,OAAO,aAAa,UAAU,EAAE;AAAA,EACtD,EAAE,OAAO,YAAY,OAAO,YAAY,UAAU,EAAE;AACtD;AAEO,MAAM,mBAAmB,mBAAmB;AAE5C,MAAM,mBAAmB;AAAA,EAC9B,EAAE,OAAO,OAAO,OAAO,YAAY,cAAc,WAAW;AAAA,EAC5D,EAAE,OAAO,OAAO,OAAO,WAAW,cAAc,UAAU;AAAA,EAC1D,EAAE,OAAO,OAAO,OAAO,gBAAW,cAAc,eAAU;AAC5D;AAEO,MAAM,sBAAsB;AAAA,EACjC,EAAE,OAAO,OAAO,OAAO,YAAY,cAAc,WAAW;AAAA,EAC5D,EAAE,OAAO,OAAO,OAAO,oBAAoB,cAAc,mBAAmB;AAC9E;AAEO,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -1,53 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { useState, useCallback } from "react";
4
- import { useForm } from "react-hook-form";
5
- import { zodResolver } from "@hookform/resolvers/zod";
6
- import { toast } from "sonner";
7
- import { Toast } from "../../ui/feedback/Toast";
8
- import { changeEmailSchema } from "../../../utils/validators/account";
9
- import { requestEmailChangeAction } from "../../../modules/accounts/actions/account-management.action";
10
- function useChangeEmailForm() {
11
- const [showVerification, setShowVerification] = useState(false);
12
- const { register, handleSubmit, reset, watch, formState: { errors, isSubmitting } } = useForm({
13
- resolver: zodResolver(changeEmailSchema),
14
- mode: "onChange",
15
- defaultValues: { email: "" }
16
- });
17
- const handleContinue = handleSubmit(async (data) => {
18
- const result = await requestEmailChangeAction(data.email);
19
- if (!result.success) {
20
- toast.custom((t) => /* @__PURE__ */ jsx(
21
- Toast,
22
- {
23
- variant: "error",
24
- message: result.error ?? "E-mail j\xE1 existente ou ocorreu um erro. Tente novamente mais tarde.",
25
- toastId: t
26
- }
27
- ));
28
- return;
29
- }
30
- setShowVerification(true);
31
- });
32
- const handleBack = useCallback(() => {
33
- setShowVerification(false);
34
- }, []);
35
- const resetForm = useCallback(() => {
36
- reset();
37
- setShowVerification(false);
38
- }, [reset]);
39
- return {
40
- showVerification,
41
- emailToVerify: watch("email"),
42
- isSubmitting,
43
- errors,
44
- register,
45
- handleContinue,
46
- handleBack,
47
- resetForm
48
- };
49
- }
50
- export {
51
- useChangeEmailForm as default
52
- };
53
- //# sourceMappingURL=useChangeEmailForm.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/account/hooks/useChangeEmailForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { useForm } from 'react-hook-form';\r\nimport { zodResolver } from '@hookform/resolvers/zod';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { changeEmailSchema, type ChangeEmailFormData } from '../../../utils/validators/account';\r\nimport { requestEmailChangeAction } from '../../../modules/accounts/actions/account-management.action';\r\n\r\nexport default function useChangeEmailForm() {\r\n const [showVerification, setShowVerification] = useState(false);\r\n\r\n const { register, handleSubmit, reset, watch, formState: { errors, isSubmitting } } = useForm<ChangeEmailFormData>({\r\n resolver: zodResolver(changeEmailSchema),\r\n mode: 'onChange',\r\n defaultValues: { email: '' },\r\n });\r\n\r\n const handleContinue = handleSubmit(async (data) => {\r\n const result = await requestEmailChangeAction(data.email);\r\n\r\n if (!result.success) {\r\n toast.custom((t) => (\r\n <Toast\r\n variant=\"error\"\r\n message={result.error ?? 'E-mail já existente ou ocorreu um erro. Tente novamente mais tarde.'}\r\n toastId={t}\r\n />\r\n ));\r\n return;\r\n }\r\n\r\n setShowVerification(true);\r\n });\r\n\r\n const handleBack = useCallback(() => {\r\n setShowVerification(false);\r\n }, []);\r\n\r\n const resetForm = useCallback(() => {\r\n reset();\r\n setShowVerification(false);\r\n }, [reset]);\r\n\r\n return {\r\n showVerification,\r\n emailToVerify: watch('email'),\r\n isSubmitting,\r\n errors,\r\n register,\r\n handleContinue,\r\n handleBack,\r\n resetForm,\r\n };\r\n}\r\n"],"mappings":";AAwBQ;AAtBR,SAAS,UAAU,mBAAmB;AACtC,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,yBAAmD;AAC5D,SAAS,gCAAgC;AAE1B,SAAR,qBAAsC;AAC3C,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,KAAK;AAE9D,QAAM,EAAE,UAAU,cAAc,OAAO,OAAO,WAAW,EAAE,QAAQ,aAAa,EAAE,IAAI,QAA6B;AAAA,IACjH,UAAU,YAAY,iBAAiB;AAAA,IACvC,MAAM;AAAA,IACN,eAAe,EAAE,OAAO,GAAG;AAAA,EAC7B,CAAC;AAED,QAAM,iBAAiB,aAAa,OAAO,SAAS;AAClD,UAAM,SAAS,MAAM,yBAAyB,KAAK,KAAK;AAExD,QAAI,CAAC,OAAO,SAAS;AACnB,YAAM,OAAO,CAAC,MACZ;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,OAAO,SAAS;AAAA,UACzB,SAAS;AAAA;AAAA,MACX,CACD;AACD;AAAA,IACF;AAEA,wBAAoB,IAAI;AAAA,EAC1B,CAAC;AAED,QAAM,aAAa,YAAY,MAAM;AACnC,wBAAoB,KAAK;AAAA,EAC3B,GAAG,CAAC,CAAC;AAEL,QAAM,YAAY,YAAY,MAAM;AAClC,UAAM;AACN,wBAAoB,KAAK;AAAA,EAC3B,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AAAA,IACL;AAAA,IACA,eAAe,MAAM,OAAO;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -1,47 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { useForm } from "react-hook-form";
4
- import { zodResolver } from "@hookform/resolvers/zod";
5
- import { useMutation } from "@tanstack/react-query";
6
- import { toast } from "sonner";
7
- import { Toast } from "../../ui/feedback/Toast";
8
- import { changePasswordSchema } from "../../../utils/validators/account";
9
- import { changePasswordAction } from "../../../modules/accounts/actions/account-management.action";
10
- function useChangePasswordForm({ onSuccess } = {}) {
11
- const form = useForm({
12
- resolver: zodResolver(changePasswordSchema),
13
- mode: "onChange",
14
- defaultValues: {
15
- currentPassword: "",
16
- newPassword: ""
17
- }
18
- });
19
- const mutation = useMutation({
20
- mutationFn: changePasswordAction,
21
- onSuccess: (result) => {
22
- if (!result.success) {
23
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: result.error ?? "Erro ao alterar senha", toastId: t }));
24
- return;
25
- }
26
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Senha alterada com sucesso", toastId: t }));
27
- form.reset();
28
- onSuccess?.();
29
- },
30
- onError: () => {
31
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Erro ao alterar senha. Tente novamente.", toastId: t }));
32
- }
33
- });
34
- const onSubmit = (data) => {
35
- mutation.mutate(data);
36
- };
37
- return {
38
- register: form.register,
39
- handleSubmit: form.handleSubmit(onSubmit),
40
- errors: form.formState.errors,
41
- isLoading: mutation.isPending
42
- };
43
- }
44
- export {
45
- useChangePasswordForm as default
46
- };
47
- //# sourceMappingURL=useChangePasswordForm.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/account/hooks/useChangePasswordForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useForm } from 'react-hook-form';\r\nimport { zodResolver } from '@hookform/resolvers/zod';\r\nimport { useMutation } from '@tanstack/react-query';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { changePasswordSchema, type ChangePasswordFormData } from '../../../utils/validators/account';\r\nimport { changePasswordAction } from '../../../modules/accounts/actions/account-management.action';\r\n\r\ninterface UseChangePasswordFormProps {\r\n onSuccess?: () => void;\r\n}\r\n\r\nexport default function useChangePasswordForm({ onSuccess }: UseChangePasswordFormProps = {}) {\r\n const form = useForm<ChangePasswordFormData>({\r\n resolver: zodResolver(changePasswordSchema),\r\n mode: 'onChange',\r\n defaultValues: {\r\n currentPassword: '',\r\n newPassword: '',\r\n },\r\n });\r\n\r\n const mutation = useMutation({\r\n mutationFn: changePasswordAction,\r\n onSuccess: (result) => {\r\n if (!result.success) {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message={result.error ?? 'Erro ao alterar senha'} toastId={t} />\r\n ));\r\n return;\r\n }\r\n\r\n toast.custom((t) => (\r\n <Toast variant=\"success\" message=\"Senha alterada com sucesso\" toastId={t} />\r\n ));\r\n\r\n form.reset();\r\n onSuccess?.();\r\n },\r\n onError: () => {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message=\"Erro ao alterar senha. Tente novamente.\" toastId={t} />\r\n ));\r\n },\r\n });\r\n\r\n const onSubmit = (data: ChangePasswordFormData) => {\r\n mutation.mutate(data);\r\n };\r\n\r\n return {\r\n register: form.register,\r\n handleSubmit: form.handleSubmit(onSubmit),\r\n errors: form.formState.errors,\r\n isLoading: mutation.isPending,\r\n };\r\n}\r\n"],"mappings":";AA6BU;AA3BV,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,4BAAyD;AAClE,SAAS,4BAA4B;AAMtB,SAAR,sBAAuC,EAAE,UAAU,IAAgC,CAAC,GAAG;AAC5F,QAAM,OAAO,QAAgC;AAAA,IAC3C,UAAU,YAAY,oBAAoB;AAAA,IAC1C,MAAM;AAAA,IACN,eAAe;AAAA,MACb,iBAAiB;AAAA,MACjB,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AAED,QAAM,WAAW,YAAY;AAAA,IAC3B,YAAY;AAAA,IACZ,WAAW,CAAC,WAAW;AACrB,UAAI,CAAC,OAAO,SAAS;AACnB,cAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAS,OAAO,SAAS,yBAAyB,SAAS,GAAG,CACtF;AACD;AAAA,MACF;AAEA,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,WAAU,SAAQ,8BAA6B,SAAS,GAAG,CAC3E;AAED,WAAK,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,IACA,SAAS,MAAM;AACb,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAQ,2CAA0C,SAAS,GAAG,CACtF;AAAA,IACH;AAAA,EACF,CAAC;AAED,QAAM,WAAW,CAAC,SAAiC;AACjD,aAAS,OAAO,IAAI;AAAA,EACtB;AAEA,SAAO;AAAA,IACL,UAAU,KAAK;AAAA,IACf,cAAc,KAAK,aAAa,QAAQ;AAAA,IACxC,QAAQ,KAAK,UAAU;AAAA,IACvB,WAAW,SAAS;AAAA,EACtB;AACF;","names":[]}
@@ -1,91 +0,0 @@
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 { requestPhoneChangeAction, updateUserAction } from "../../../modules/accounts/actions/account-management.action";
7
- function splitPhoneValue(fullValue) {
8
- const trimmed = fullValue.trim();
9
- const spaceIdx = trimmed.indexOf(" ");
10
- if (spaceIdx === -1) return { ddi: "+55", local: trimmed };
11
- return { ddi: trimmed.slice(0, spaceIdx), local: trimmed.slice(spaceIdx + 1) };
12
- }
13
- function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuccess }) {
14
- const [showVerification, setShowVerification] = useState(false);
15
- const [phoneValue, setPhoneValue] = useState("");
16
- const [phoneError, setPhoneError] = useState("");
17
- const [isSubmitting, setIsSubmitting] = useState(false);
18
- const [submittedPhone, setSubmittedPhone] = useState({ ddi: "+55", local: "" });
19
- const handlePhoneChange = useCallback((value) => {
20
- setPhoneValue(value);
21
- if (phoneError) setPhoneError("");
22
- }, [phoneError]);
23
- const handleContinue = useCallback(async (e) => {
24
- e.preventDefault();
25
- const { ddi, local } = splitPhoneValue(phoneValue);
26
- if (!local || local.replace(/\D/g, "").length < 8) {
27
- setPhoneError("N\xFAmero de telefone inv\xE1lido");
28
- return;
29
- }
30
- setIsSubmitting(true);
31
- try {
32
- if (!hasExistingPhone) {
33
- const result2 = await updateUserAction({ phone: local, ddi });
34
- if (!result2.success) {
35
- toast.custom((t) => /* @__PURE__ */ jsx(
36
- Toast,
37
- {
38
- variant: "error",
39
- message: result2.error ?? "Ocorreu um erro ao salvar o telefone. Tente novamente mais tarde.",
40
- toastId: t
41
- }
42
- ));
43
- return;
44
- }
45
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Telefone adicionado", toastId: t }));
46
- onDirectUpdateSuccess?.();
47
- return;
48
- }
49
- const result = await requestPhoneChangeAction(local, ddi);
50
- if (!result.success) {
51
- toast.custom((t) => /* @__PURE__ */ jsx(
52
- Toast,
53
- {
54
- variant: "error",
55
- message: result.error ?? "N\xFAmero j\xE1 existente ou ocorreu um erro. Tente novamente mais tarde.",
56
- toastId: t
57
- }
58
- ));
59
- return;
60
- }
61
- setSubmittedPhone({ ddi, local });
62
- setShowVerification(true);
63
- } finally {
64
- setIsSubmitting(false);
65
- }
66
- }, [phoneValue, hasExistingPhone, onDirectUpdateSuccess]);
67
- const handleBack = useCallback(() => {
68
- setShowVerification(false);
69
- }, []);
70
- const resetForm = useCallback(() => {
71
- setPhoneValue("");
72
- setPhoneError("");
73
- setSubmittedPhone({ ddi: "+55", local: "" });
74
- setShowVerification(false);
75
- }, []);
76
- return {
77
- showVerification,
78
- phoneValue,
79
- phoneError,
80
- isSubmitting,
81
- submittedPhone,
82
- handlePhoneChange,
83
- handleContinue,
84
- handleBack,
85
- resetForm
86
- };
87
- }
88
- export {
89
- useChangePhoneForm as default
90
- };
91
- //# sourceMappingURL=useChangePhoneForm.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/account/hooks/useChangePhoneForm.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback } from 'react';\nimport { toast } from 'sonner';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { requestPhoneChangeAction, updateUserAction } from '../../../modules/accounts/actions/account-management.action';\n\nfunction splitPhoneValue(fullValue: string): { ddi: string; local: string } {\n const trimmed = fullValue.trim();\n const spaceIdx = trimmed.indexOf(' ');\n if (spaceIdx === -1) return { ddi: '+55', local: trimmed };\n return { ddi: trimmed.slice(0, spaceIdx), local: trimmed.slice(spaceIdx + 1) };\n}\n\ninterface UseChangePhoneFormOptions {\n hasExistingPhone: boolean;\n onDirectUpdateSuccess?: () => void;\n}\n\nexport default function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuccess }: UseChangePhoneFormOptions) {\n const [showVerification, setShowVerification] = useState(false);\n const [phoneValue, setPhoneValue] = useState('');\n const [phoneError, setPhoneError] = useState('');\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [submittedPhone, setSubmittedPhone] = useState({ ddi: '+55', local: '' });\n\n const handlePhoneChange = useCallback((value: string) => {\n setPhoneValue(value);\n if (phoneError) setPhoneError('');\n }, [phoneError]);\n\n const handleContinue = useCallback(async (e: React.FormEvent) => {\n e.preventDefault();\n\n const { ddi, local } = splitPhoneValue(phoneValue);\n\n if (!local || local.replace(/\\D/g, '').length < 8) {\n setPhoneError('Número de telefone inválido');\n return;\n }\n\n setIsSubmitting(true);\n try {\n if (!hasExistingPhone) {\n const result = await updateUserAction({ phone: local, ddi });\n\n if (!result.success) {\n toast.custom((t) => (\n <Toast\n variant=\"error\"\n message={result.error ?? 'Ocorreu um erro ao salvar o telefone. Tente novamente mais tarde.'}\n toastId={t}\n />\n ));\n return;\n }\n\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Telefone adicionado\" toastId={t} />\n ));\n onDirectUpdateSuccess?.();\n return;\n }\n\n const result = await requestPhoneChangeAction(local, ddi);\n\n if (!result.success) {\n toast.custom((t) => (\n <Toast\n variant=\"error\"\n message={result.error ?? 'Número já existente ou ocorreu um erro. Tente novamente mais tarde.'}\n toastId={t}\n />\n ));\n return;\n }\n\n setSubmittedPhone({ ddi, local });\n setShowVerification(true);\n } finally {\n setIsSubmitting(false);\n }\n }, [phoneValue, hasExistingPhone, onDirectUpdateSuccess]);\n\n const handleBack = useCallback(() => {\n setShowVerification(false);\n }, []);\n\n const resetForm = useCallback(() => {\n setPhoneValue('');\n setPhoneError('');\n setSubmittedPhone({ ddi: '+55', local: '' });\n setShowVerification(false);\n }, []);\n\n return {\n showVerification,\n phoneValue,\n phoneError,\n isSubmitting,\n submittedPhone,\n handlePhoneChange,\n handleContinue,\n handleBack,\n resetForm,\n };\n}\n"],"mappings":";AAgDY;AA9CZ,SAAS,UAAU,mBAAmB;AACtC,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,0BAA0B,wBAAwB;AAE3D,SAAS,gBAAgB,WAAmD;AAC1E,QAAM,UAAU,UAAU,KAAK;AAC/B,QAAM,WAAW,QAAQ,QAAQ,GAAG;AACpC,MAAI,aAAa,GAAI,QAAO,EAAE,KAAK,OAAO,OAAO,QAAQ;AACzD,SAAO,EAAE,KAAK,QAAQ,MAAM,GAAG,QAAQ,GAAG,OAAO,QAAQ,MAAM,WAAW,CAAC,EAAE;AAC/E;AAOe,SAAR,mBAAoC,EAAE,kBAAkB,sBAAsB,GAA8B;AACjH,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,KAAK;AAC9D,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,EAAE;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,EAAE;AAC/C,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AACtD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,EAAE,KAAK,OAAO,OAAO,GAAG,CAAC;AAE9E,QAAM,oBAAoB,YAAY,CAAC,UAAkB;AACvD,kBAAc,KAAK;AACnB,QAAI,WAAY,eAAc,EAAE;AAAA,EAClC,GAAG,CAAC,UAAU,CAAC;AAEf,QAAM,iBAAiB,YAAY,OAAO,MAAuB;AAC/D,MAAE,eAAe;AAEjB,UAAM,EAAE,KAAK,MAAM,IAAI,gBAAgB,UAAU;AAEjD,QAAI,CAAC,SAAS,MAAM,QAAQ,OAAO,EAAE,EAAE,SAAS,GAAG;AACjD,oBAAc,mCAA6B;AAC3C;AAAA,IACF;AAEA,oBAAgB,IAAI;AACpB,QAAI;AACF,UAAI,CAAC,kBAAkB;AACrB,cAAMA,UAAS,MAAM,iBAAiB,EAAE,OAAO,OAAO,IAAI,CAAC;AAE3D,YAAI,CAACA,QAAO,SAAS;AACnB,gBAAM,OAAO,CAAC,MACZ;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAASA,QAAO,SAAS;AAAA,cACzB,SAAS;AAAA;AAAA,UACX,CACD;AACD;AAAA,QACF;AAEA,cAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,WAAU,SAAQ,uBAAsB,SAAS,GAAG,CACpE;AACD,gCAAwB;AACxB;AAAA,MACF;AAEA,YAAM,SAAS,MAAM,yBAAyB,OAAO,GAAG;AAExD,UAAI,CAAC,OAAO,SAAS;AACnB,cAAM,OAAO,CAAC,MACZ;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,SAAS,OAAO,SAAS;AAAA,YACzB,SAAS;AAAA;AAAA,QACX,CACD;AACD;AAAA,MACF;AAEA,wBAAkB,EAAE,KAAK,MAAM,CAAC;AAChC,0BAAoB,IAAI;AAAA,IAC1B,UAAE;AACA,sBAAgB,KAAK;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,YAAY,kBAAkB,qBAAqB,CAAC;AAExD,QAAM,aAAa,YAAY,MAAM;AACnC,wBAAoB,KAAK;AAAA,EAC3B,GAAG,CAAC,CAAC;AAEL,QAAM,YAAY,YAAY,MAAM;AAClC,kBAAc,EAAE;AAChB,kBAAc,EAAE;AAChB,sBAAkB,EAAE,KAAK,OAAO,OAAO,GAAG,CAAC;AAC3C,wBAAoB,KAAK;AAAA,EAC3B,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["result"]}
@@ -1,34 +0,0 @@
1
- "use client";
2
- import { useState, useCallback, useEffect } from "react";
3
- import { AccountSectionType } from "../../../enums/AccountSectionType";
4
- function useConfigurationsModal({
5
- isOpen,
6
- initialSection
7
- }) {
8
- const [activeSection, setActiveSection] = useState(
9
- AccountSectionType.PREFERENCES
10
- );
11
- const isValidSection = (section) => Object.values(AccountSectionType).includes(section);
12
- useEffect(() => {
13
- if (isOpen && isValidSection(initialSection)) {
14
- setActiveSection(initialSection);
15
- } else if (isOpen) {
16
- setActiveSection(AccountSectionType.PREFERENCES);
17
- }
18
- }, [isOpen, initialSection]);
19
- const handleSectionChange = useCallback((section) => {
20
- setActiveSection(section);
21
- }, []);
22
- const resetSection = useCallback(() => {
23
- setActiveSection(AccountSectionType.PREFERENCES);
24
- }, []);
25
- return {
26
- activeSection,
27
- setActiveSection: handleSectionChange,
28
- resetSection
29
- };
30
- }
31
- export {
32
- useConfigurationsModal as default
33
- };
34
- //# sourceMappingURL=useConfigurationsModal.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/account/hooks/useConfigurationsModal.ts"],"sourcesContent":["\"use client\";\r\n\r\nimport { useState, useCallback, useEffect } from \"react\";\r\nimport { AccountSectionType } from \"../../../enums/AccountSectionType\";\r\n\r\ninterface UseConfigurationsModalProps {\r\n isOpen: boolean;\r\n initialSection?: AccountSectionType;\r\n}\r\n\r\nexport default function useConfigurationsModal({\r\n isOpen,\r\n initialSection,\r\n}: UseConfigurationsModalProps) {\r\n const [activeSection, setActiveSection] = useState<AccountSectionType>(\r\n AccountSectionType.PREFERENCES,\r\n );\r\n\r\n const isValidSection = (\r\n section?: AccountSectionType,\r\n ): section is AccountSectionType =>\r\n Object.values(AccountSectionType).includes(section as AccountSectionType);\r\n\r\n useEffect(() => {\r\n if (isOpen && isValidSection(initialSection)) {\r\n setActiveSection(initialSection);\r\n } else if (isOpen) {\r\n setActiveSection(AccountSectionType.PREFERENCES);\r\n }\r\n }, [isOpen, initialSection]);\r\n\r\n const handleSectionChange = useCallback((section: AccountSectionType) => {\r\n setActiveSection(section);\r\n }, []);\r\n\r\n const resetSection = useCallback(() => {\r\n setActiveSection(AccountSectionType.PREFERENCES);\r\n }, []);\r\n\r\n return {\r\n activeSection,\r\n setActiveSection: handleSectionChange,\r\n resetSection,\r\n };\r\n}\r\n"],"mappings":";AAEA,SAAS,UAAU,aAAa,iBAAiB;AACjD,SAAS,0BAA0B;AAOpB,SAAR,uBAAwC;AAAA,EAC7C;AAAA,EACA;AACF,GAAgC;AAC9B,QAAM,CAAC,eAAe,gBAAgB,IAAI;AAAA,IACxC,mBAAmB;AAAA,EACrB;AAEA,QAAM,iBAAiB,CACrB,YAEA,OAAO,OAAO,kBAAkB,EAAE,SAAS,OAA6B;AAE1E,YAAU,MAAM;AACd,QAAI,UAAU,eAAe,cAAc,GAAG;AAC5C,uBAAiB,cAAc;AAAA,IACjC,WAAW,QAAQ;AACjB,uBAAiB,mBAAmB,WAAW;AAAA,IACjD;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,QAAM,sBAAsB,YAAY,CAAC,YAAgC;AACvE,qBAAiB,OAAO;AAAA,EAC1B,GAAG,CAAC,CAAC;AAEL,QAAM,eAAe,YAAY,MAAM;AACrC,qBAAiB,mBAAmB,WAAW;AAAA,EACjD,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,EACF;AACF;","names":[]}
@@ -1,54 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { useState, useCallback } from "react";
4
- import { useMutation, useQueryClient } from "@tanstack/react-query";
5
- import { toast } from "sonner";
6
- import { Toast } from "../../ui/feedback/Toast";
7
- import { USER_QUERY_KEY } from "../../../modules/auth/hooks/useUserQuery";
8
- import { disableTwoFactorAction } from "../../../modules/accounts/actions/account-management.action";
9
- function useDisableTwoFactorAuthForm({
10
- onClose,
11
- onSuccess
12
- }) {
13
- const [code, setCode] = useState("");
14
- const queryClient = useQueryClient();
15
- const isValid = code.length === 6;
16
- const mutation = useMutation({
17
- mutationFn: (otpCode) => disableTwoFactorAction(otpCode),
18
- onSuccess: (result) => {
19
- if (!result.success) {
20
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: result.error ?? "C\xF3digo inv\xE1lido", toastId: t }));
21
- return;
22
- }
23
- queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
24
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Autentica\xE7\xE3o de dois fatores desabilitada", toastId: t }));
25
- setCode("");
26
- onSuccess?.();
27
- },
28
- onError: () => {
29
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Erro ao desabilitar 2FA. Tente novamente.", toastId: t }));
30
- }
31
- });
32
- const { mutate, reset } = mutation;
33
- const handleClose = useCallback(() => {
34
- setCode("");
35
- reset();
36
- onClose();
37
- }, [onClose, reset]);
38
- const handleSubmit = useCallback(() => {
39
- if (!isValid) return;
40
- mutate(code);
41
- }, [code, isValid, mutate]);
42
- return {
43
- code,
44
- setCode,
45
- isValid,
46
- isLoading: mutation.isPending,
47
- handleClose,
48
- handleSubmit
49
- };
50
- }
51
- export {
52
- useDisableTwoFactorAuthForm as default
53
- };
54
- //# sourceMappingURL=useDisableTwoFactorAuthForm.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/account/hooks/useDisableTwoFactorAuthForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { USER_QUERY_KEY } from '../../../modules/auth/hooks/useUserQuery';\r\nimport { disableTwoFactorAction } from '../../../modules/accounts/actions/account-management.action';\r\n\r\ninterface UseDisableTwoFactorAuthFormProps {\r\n onClose: () => void;\r\n onSuccess?: () => void;\r\n}\r\n\r\nexport default function useDisableTwoFactorAuthForm({\r\n onClose,\r\n onSuccess,\r\n}: UseDisableTwoFactorAuthFormProps) {\r\n const [code, setCode] = useState('');\r\n const queryClient = useQueryClient();\r\n\r\n const isValid = code.length === 6;\r\n\r\n const mutation = useMutation({\r\n mutationFn: (otpCode: string) => disableTwoFactorAction(otpCode),\r\n onSuccess: (result) => {\r\n if (!result.success) {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message={result.error ?? 'Código inválido'} toastId={t} />\r\n ));\r\n return;\r\n }\r\n\r\n queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });\r\n toast.custom((t) => (\r\n <Toast variant=\"success\" message=\"Autenticação de dois fatores desabilitada\" toastId={t} />\r\n ));\r\n setCode('');\r\n onSuccess?.();\r\n },\r\n onError: () => {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message=\"Erro ao desabilitar 2FA. Tente novamente.\" toastId={t} />\r\n ));\r\n },\r\n });\r\n\r\n const { mutate, reset } = mutation;\r\n\r\n const handleClose = useCallback(() => {\r\n setCode('');\r\n reset();\r\n onClose();\r\n }, [onClose, reset]);\r\n\r\n const handleSubmit = useCallback(() => {\r\n if (!isValid) return;\r\n mutate(code);\r\n }, [code, isValid, mutate]);\r\n\r\n return {\r\n code,\r\n setCode,\r\n isValid,\r\n isLoading: mutation.isPending,\r\n handleClose,\r\n handleSubmit,\r\n };\r\n}\r\n"],"mappings":";AA4BU;AA1BV,SAAS,UAAU,mBAAmB;AACtC,SAAS,aAAa,sBAAsB;AAC5C,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAC/B,SAAS,8BAA8B;AAOxB,SAAR,4BAA6C;AAAA,EAClD;AAAA,EACA;AACF,GAAqC;AACnC,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,EAAE;AACnC,QAAM,cAAc,eAAe;AAEnC,QAAM,UAAU,KAAK,WAAW;AAEhC,QAAM,WAAW,YAAY;AAAA,IAC3B,YAAY,CAAC,YAAoB,uBAAuB,OAAO;AAAA,IAC/D,WAAW,CAAC,WAAW;AACrB,UAAI,CAAC,OAAO,SAAS;AACnB,cAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAS,OAAO,SAAS,yBAAmB,SAAS,GAAG,CAChF;AACD;AAAA,MACF;AAEA,kBAAY,kBAAkB,EAAE,UAAU,eAAe,CAAC;AAC1D,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,WAAU,SAAQ,mDAA4C,SAAS,GAAG,CAC1F;AACD,cAAQ,EAAE;AACV,kBAAY;AAAA,IACd;AAAA,IACA,SAAS,MAAM;AACb,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAQ,6CAA4C,SAAS,GAAG,CACxF;AAAA,IACH;AAAA,EACF,CAAC;AAED,QAAM,EAAE,QAAQ,MAAM,IAAI;AAE1B,QAAM,cAAc,YAAY,MAAM;AACpC,YAAQ,EAAE;AACV,UAAM;AACN,YAAQ;AAAA,EACV,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,QAAM,eAAe,YAAY,MAAM;AACrC,QAAI,CAAC,QAAS;AACd,WAAO,IAAI;AAAA,EACb,GAAG,CAAC,MAAM,SAAS,MAAM,CAAC;AAE1B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,SAAS;AAAA,IACpB;AAAA,IACA;AAAA,EACF;AACF;","names":[]}