@greatapps/common 1.1.173 → 1.1.175

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 (378) hide show
  1. package/dist/components/account/AccountModals.mjs +18 -0
  2. package/dist/components/account/AccountModals.mjs.map +1 -0
  3. package/dist/components/account/ConfigurationsMyAccountModal.mjs +132 -0
  4. package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -0
  5. package/dist/components/account/ConfirmDeleteAccountModal.mjs +45 -0
  6. package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -0
  7. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +45 -0
  8. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -0
  9. package/dist/components/account/DeleteAccountModal.mjs +123 -0
  10. package/dist/components/account/DeleteAccountModal.mjs.map +1 -0
  11. package/dist/components/account/DisableTwoFactorAuthModal.mjs +67 -0
  12. package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -0
  13. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +42 -0
  14. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -0
  15. package/dist/components/account/TwoFactorAuthModal.mjs +190 -0
  16. package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -0
  17. package/dist/components/account/constants.mjs +29 -0
  18. package/dist/components/account/constants.mjs.map +1 -0
  19. package/dist/components/account/hooks/useChangeEmailForm.mjs +53 -0
  20. package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -0
  21. package/dist/components/account/hooks/useChangePasswordForm.mjs +47 -0
  22. package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -0
  23. package/dist/components/account/hooks/useChangePhoneForm.mjs +74 -0
  24. package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -0
  25. package/dist/components/account/hooks/useConfigurationsModal.mjs +33 -0
  26. package/dist/components/account/hooks/useConfigurationsModal.mjs.map +1 -0
  27. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +54 -0
  28. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -0
  29. package/dist/components/account/hooks/useOtpVerification.mjs +94 -0
  30. package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -0
  31. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +80 -0
  32. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -0
  33. package/dist/components/account/sections/ChangeEmailModal.mjs +181 -0
  34. package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -0
  35. package/dist/components/account/sections/ChangePasswordSection.mjs +64 -0
  36. package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -0
  37. package/dist/components/account/sections/ChangePhoneModal.mjs +184 -0
  38. package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -0
  39. package/dist/components/account/sections/MyProfileSection.mjs +303 -0
  40. package/dist/components/account/sections/MyProfileSection.mjs.map +1 -0
  41. package/dist/components/account/sections/PreferencesSection.mjs +250 -0
  42. package/dist/components/account/sections/PreferencesSection.mjs.map +1 -0
  43. package/dist/components/account/sections/SecuritySection.mjs +147 -0
  44. package/dist/components/account/sections/SecuritySection.mjs.map +1 -0
  45. package/dist/components/handlers/SearchParamsHandler.mjs +24 -0
  46. package/dist/components/handlers/SearchParamsHandler.mjs.map +1 -0
  47. package/dist/components/layouts/AppMobileNavBar.mjs +115 -0
  48. package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -0
  49. package/dist/components/layouts/AppNavBar.mjs +49 -0
  50. package/dist/components/layouts/AppNavBar.mjs.map +1 -0
  51. package/dist/components/layouts/MainLayout.mjs +60 -0
  52. package/dist/components/layouts/MainLayout.mjs.map +1 -0
  53. package/dist/components/layouts/MdSideBarNavigation.mjs +54 -0
  54. package/dist/components/layouts/MdSideBarNavigation.mjs.map +1 -0
  55. package/dist/components/layouts/NavBar.mjs +132 -0
  56. package/dist/components/layouts/NavBar.mjs.map +1 -0
  57. package/dist/components/layouts/NavBarItem.mjs +23 -0
  58. package/dist/components/layouts/NavBarItem.mjs.map +1 -0
  59. package/dist/components/layouts/NotificationsPopover.mjs +97 -0
  60. package/dist/components/layouts/NotificationsPopover.mjs.map +1 -0
  61. package/dist/components/layouts/ProfilePopover.mjs +149 -0
  62. package/dist/components/layouts/ProfilePopover.mjs.map +1 -0
  63. package/dist/components/layouts/SideBarNavigation.mjs +22 -0
  64. package/dist/components/layouts/SideBarNavigation.mjs.map +1 -0
  65. package/dist/components/layouts/UsersSelectorPopover.mjs +230 -0
  66. package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -0
  67. package/dist/components/modals/ModalManager.mjs +19 -0
  68. package/dist/components/modals/ModalManager.mjs.map +1 -0
  69. package/dist/components/modals/Modals.mjs +20 -0
  70. package/dist/components/modals/Modals.mjs.map +1 -0
  71. package/dist/components/navigation/AppNavigation.mjs +30 -0
  72. package/dist/components/navigation/AppNavigation.mjs.map +1 -0
  73. package/dist/components/navigation/AppNavigationContext.mjs +13 -0
  74. package/dist/components/navigation/AppNavigationContext.mjs.map +1 -0
  75. package/dist/components/navigation/CancelledSubscriptionBanner.mjs +59 -0
  76. package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -0
  77. package/dist/components/navigation/NavItem.mjs +35 -0
  78. package/dist/components/navigation/NavItem.mjs.map +1 -0
  79. package/dist/components/navigation/NavItemsContext.mjs +16 -0
  80. package/dist/components/navigation/NavItemsContext.mjs.map +1 -0
  81. package/dist/components/navigation/ProjectSelectorPopover.mjs +128 -0
  82. package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -0
  83. package/dist/components/navigation/shells/DesktopShell.mjs +11 -0
  84. package/dist/components/navigation/shells/DesktopShell.mjs.map +1 -0
  85. package/dist/components/navigation/shells/MdShell.mjs +11 -0
  86. package/dist/components/navigation/shells/MdShell.mjs.map +1 -0
  87. package/dist/components/navigation/shells/MobileShell.mjs +27 -0
  88. package/dist/components/navigation/shells/MobileShell.mjs.map +1 -0
  89. package/dist/components/navigation/shells/TabsMobileShell.mjs +59 -0
  90. package/dist/components/navigation/shells/TabsMobileShell.mjs.map +1 -0
  91. package/dist/components/navigation/subcomponents/CreditsCard.mjs +30 -0
  92. package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -0
  93. package/dist/components/navigation/subcomponents/NavItems.mjs +25 -0
  94. package/dist/components/navigation/subcomponents/NavItems.mjs.map +1 -0
  95. package/dist/components/navigation/subcomponents/PlanCard.mjs +25 -0
  96. package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -0
  97. package/dist/components/navigation/subcomponents/ProjectSelector.mjs +130 -0
  98. package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -0
  99. package/dist/components/navigation/types.mjs +1 -0
  100. package/dist/components/navigation/types.mjs.map +1 -0
  101. package/dist/components/pages/notifications/Notifications.mjs +156 -0
  102. package/dist/components/pages/notifications/Notifications.mjs.map +1 -0
  103. package/dist/components/ui/buttons/Button.mjs +52 -0
  104. package/dist/components/ui/buttons/Button.mjs.map +1 -0
  105. package/dist/components/ui/buttons/CancelButton.mjs +17 -0
  106. package/dist/components/ui/buttons/CancelButton.mjs.map +1 -0
  107. package/dist/components/ui/buttons/CopyButton.mjs +42 -0
  108. package/dist/components/ui/buttons/CopyButton.mjs.map +1 -0
  109. package/dist/components/ui/data-display/Accordion.mjs +76 -0
  110. package/dist/components/ui/data-display/Accordion.mjs.map +1 -0
  111. package/dist/components/ui/data-display/Badge.mjs +42 -0
  112. package/dist/components/ui/data-display/Badge.mjs.map +1 -0
  113. package/dist/components/ui/data-display/Card.mjs +92 -0
  114. package/dist/components/ui/data-display/Card.mjs.map +1 -0
  115. package/dist/components/ui/data-display/Pagination.mjs +118 -0
  116. package/dist/components/ui/data-display/Pagination.mjs.map +1 -0
  117. package/dist/components/ui/data-display/ScrollArea.mjs +62 -0
  118. package/dist/components/ui/data-display/ScrollArea.mjs.map +1 -0
  119. package/dist/components/ui/data-display/Separator.mjs +28 -0
  120. package/dist/components/ui/data-display/Separator.mjs.map +1 -0
  121. package/dist/components/ui/data-display/Table.mjs +116 -0
  122. package/dist/components/ui/data-display/Table.mjs.map +1 -0
  123. package/dist/components/ui/data-display/Tabs.mjs +69 -0
  124. package/dist/components/ui/data-display/Tabs.mjs.map +1 -0
  125. package/dist/components/ui/data-display/UserAvatar.mjs +49 -0
  126. package/dist/components/ui/data-display/UserAvatar.mjs.map +1 -0
  127. package/dist/components/ui/feedback/CircularProgress.mjs +71 -0
  128. package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -0
  129. package/dist/components/ui/feedback/DefaultCircularProgress.mjs +50 -0
  130. package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -0
  131. package/dist/components/ui/feedback/LoadingOverlay.mjs +19 -0
  132. package/dist/components/ui/feedback/LoadingOverlay.mjs.map +1 -0
  133. package/dist/components/ui/feedback/Progress.mjs +37 -0
  134. package/dist/components/ui/feedback/Progress.mjs.map +1 -0
  135. package/dist/components/ui/feedback/Toast.mjs +77 -0
  136. package/dist/components/ui/feedback/Toast.mjs.map +1 -0
  137. package/dist/components/ui/form/Calendar.mjs +204 -0
  138. package/dist/components/ui/form/Calendar.mjs.map +1 -0
  139. package/dist/components/ui/form/Checkbox.mjs +33 -0
  140. package/dist/components/ui/form/Checkbox.mjs.map +1 -0
  141. package/dist/components/ui/form/ComboboxField.mjs +130 -0
  142. package/dist/components/ui/form/ComboboxField.mjs.map +1 -0
  143. package/dist/components/ui/form/DatePicker.mjs +82 -0
  144. package/dist/components/ui/form/DatePicker.mjs.map +1 -0
  145. package/dist/components/ui/form/DateRangePicker.mjs +92 -0
  146. package/dist/components/ui/form/DateRangePicker.mjs.map +1 -0
  147. package/dist/components/ui/form/FormField.mjs +103 -0
  148. package/dist/components/ui/form/FormField.mjs.map +1 -0
  149. package/dist/components/ui/form/Input.mjs +21 -0
  150. package/dist/components/ui/form/Input.mjs.map +1 -0
  151. package/dist/components/ui/form/InputOtp.mjs +70 -0
  152. package/dist/components/ui/form/InputOtp.mjs.map +1 -0
  153. package/dist/components/ui/form/PhoneInput.mjs +174 -0
  154. package/dist/components/ui/form/PhoneInput.mjs.map +1 -0
  155. package/dist/components/ui/form/RadioGroup.mjs +37 -0
  156. package/dist/components/ui/form/RadioGroup.mjs.map +1 -0
  157. package/dist/components/ui/form/Select.mjs +179 -0
  158. package/dist/components/ui/form/Select.mjs.map +1 -0
  159. package/dist/components/ui/form/SelectField.mjs +80 -0
  160. package/dist/components/ui/form/SelectField.mjs.map +1 -0
  161. package/dist/components/ui/form/Switch.mjs +33 -0
  162. package/dist/components/ui/form/Switch.mjs.map +1 -0
  163. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs +40 -0
  164. package/dist/components/ui/form/SwitchOptionFieldWithIcon.mjs.map +1 -0
  165. package/dist/components/ui/form/TextAreaField.mjs +56 -0
  166. package/dist/components/ui/form/TextAreaField.mjs.map +1 -0
  167. package/dist/components/ui/form/Textarea.mjs +20 -0
  168. package/dist/components/ui/form/Textarea.mjs.map +1 -0
  169. package/dist/components/ui/overlay/Command.mjs +178 -0
  170. package/dist/components/ui/overlay/Command.mjs.map +1 -0
  171. package/dist/components/ui/overlay/Dialog.mjs +142 -0
  172. package/dist/components/ui/overlay/Dialog.mjs.map +1 -0
  173. package/dist/components/ui/overlay/Popover.mjs +46 -0
  174. package/dist/components/ui/overlay/Popover.mjs.map +1 -0
  175. package/dist/components/ui/overlay/Sheet.mjs +142 -0
  176. package/dist/components/ui/overlay/Sheet.mjs.map +1 -0
  177. package/dist/components/ui/overlay/Tooltip.mjs +57 -0
  178. package/dist/components/ui/overlay/Tooltip.mjs.map +1 -0
  179. package/dist/components/widgets/notifications/NotificationCard.mjs +54 -0
  180. package/dist/components/widgets/notifications/NotificationCard.mjs.map +1 -0
  181. package/dist/enums/AccountSectionType.mjs +11 -0
  182. package/dist/enums/AccountSectionType.mjs.map +1 -0
  183. package/dist/hooks/copy-to-clipboard.hook.mjs +52 -0
  184. package/dist/hooks/copy-to-clipboard.hook.mjs.map +1 -0
  185. package/dist/hooks/useCountdownTimer.mjs +29 -0
  186. package/dist/hooks/useCountdownTimer.mjs.map +1 -0
  187. package/dist/hooks/useDebounce.mjs +19 -0
  188. package/dist/hooks/useDebounce.mjs.map +1 -0
  189. package/dist/hooks/useDebounceState.mjs +12 -0
  190. package/dist/hooks/useDebounceState.mjs.map +1 -0
  191. package/dist/hooks/useDebouncedEffect.mjs +44 -0
  192. package/dist/hooks/useDebouncedEffect.mjs.map +1 -0
  193. package/dist/hooks/useIsMobile.mjs +18 -0
  194. package/dist/hooks/useIsMobile.mjs.map +1 -0
  195. package/dist/hooks/usePasswordVisibility.mjs +13 -0
  196. package/dist/hooks/usePasswordVisibility.mjs.map +1 -0
  197. package/dist/index.mjs +457 -0
  198. package/dist/index.mjs.map +1 -0
  199. package/dist/infra/api/client.mjs +136 -0
  200. package/dist/infra/api/client.mjs.map +1 -0
  201. package/dist/infra/api/types.mjs +31 -0
  202. package/dist/infra/api/types.mjs.map +1 -0
  203. package/dist/infra/utils/client-info.mjs +27 -0
  204. package/dist/infra/utils/client-info.mjs.map +1 -0
  205. package/dist/infra/utils/clsx.mjs +9 -0
  206. package/dist/infra/utils/clsx.mjs.map +1 -0
  207. package/dist/infra/utils/params.mjs +21 -0
  208. package/dist/infra/utils/params.mjs.map +1 -0
  209. package/dist/infra/utils/parser.mjs +24 -0
  210. package/dist/infra/utils/parser.mjs.map +1 -0
  211. package/dist/infra/utils/percentage.mjs +20 -0
  212. package/dist/infra/utils/percentage.mjs.map +1 -0
  213. package/dist/middleware.mjs +10 -0
  214. package/dist/middleware.mjs.map +1 -0
  215. package/dist/middlewares/chain.mjs +37 -0
  216. package/dist/middlewares/chain.mjs.map +1 -0
  217. package/dist/middlewares/create-auth-middleware.mjs +28 -0
  218. package/dist/middlewares/create-auth-middleware.mjs.map +1 -0
  219. package/dist/middlewares/types.mjs +11 -0
  220. package/dist/middlewares/types.mjs.map +1 -0
  221. package/dist/modules/accounts/actions/account-management.action.mjs +82 -0
  222. package/dist/modules/accounts/actions/account-management.action.mjs.map +1 -0
  223. package/dist/modules/accounts/actions/find-current-account.action.mjs +10 -0
  224. package/dist/modules/accounts/actions/find-current-account.action.mjs.map +1 -0
  225. package/dist/modules/accounts/actions/list-currencies.action.mjs +10 -0
  226. package/dist/modules/accounts/actions/list-currencies.action.mjs.map +1 -0
  227. package/dist/modules/accounts/actions/list-timezones.action.mjs +10 -0
  228. package/dist/modules/accounts/actions/list-timezones.action.mjs.map +1 -0
  229. package/dist/modules/accounts/hooks/current-account.hook.mjs +24 -0
  230. package/dist/modules/accounts/hooks/current-account.hook.mjs.map +1 -0
  231. package/dist/modules/accounts/hooks/useAccountManagement.mjs +71 -0
  232. package/dist/modules/accounts/hooks/useAccountManagement.mjs.map +1 -0
  233. package/dist/modules/accounts/hooks/useCurrencies.mjs +17 -0
  234. package/dist/modules/accounts/hooks/useCurrencies.mjs.map +1 -0
  235. package/dist/modules/accounts/hooks/useTimezones.mjs +17 -0
  236. package/dist/modules/accounts/hooks/useTimezones.mjs.map +1 -0
  237. package/dist/modules/accounts/services/account.service.mjs +180 -0
  238. package/dist/modules/accounts/services/account.service.mjs.map +1 -0
  239. package/dist/modules/accounts/services/currency.service.mjs +24 -0
  240. package/dist/modules/accounts/services/currency.service.mjs.map +1 -0
  241. package/dist/modules/accounts/services/timezone.service.mjs +65 -0
  242. package/dist/modules/accounts/services/timezone.service.mjs.map +1 -0
  243. package/dist/modules/accounts/services/two-factor.service.mjs +77 -0
  244. package/dist/modules/accounts/services/two-factor.service.mjs.map +1 -0
  245. package/dist/modules/accounts/types.mjs +1 -0
  246. package/dist/modules/accounts/types.mjs.map +1 -0
  247. package/dist/modules/auth/actions/login.action.mjs +14 -0
  248. package/dist/modules/auth/actions/login.action.mjs.map +1 -0
  249. package/dist/modules/auth/actions/logout.action.mjs +14 -0
  250. package/dist/modules/auth/actions/logout.action.mjs.map +1 -0
  251. package/dist/modules/auth/actions/register.action.mjs +14 -0
  252. package/dist/modules/auth/actions/register.action.mjs.map +1 -0
  253. package/dist/modules/auth/actions/validate-session.action.mjs +60 -0
  254. package/dist/modules/auth/actions/validate-session.action.mjs.map +1 -0
  255. package/dist/modules/auth/actions/verify-two-factor.action.mjs +17 -0
  256. package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +1 -0
  257. package/dist/modules/auth/hooks/login.hook.mjs +13 -0
  258. package/dist/modules/auth/hooks/login.hook.mjs.map +1 -0
  259. package/dist/modules/auth/hooks/logout.hook.mjs +13 -0
  260. package/dist/modules/auth/hooks/logout.hook.mjs.map +1 -0
  261. package/dist/modules/auth/hooks/register.hook.mjs +13 -0
  262. package/dist/modules/auth/hooks/register.hook.mjs.map +1 -0
  263. package/dist/modules/auth/hooks/useUserQuery.mjs +63 -0
  264. package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -0
  265. package/dist/modules/auth/schema.mjs +1 -0
  266. package/dist/modules/auth/schema.mjs.map +1 -0
  267. package/dist/modules/auth/services/auth.service.mjs +294 -0
  268. package/dist/modules/auth/services/auth.service.mjs.map +1 -0
  269. package/dist/modules/auth/utils/get-user-context.mjs +24 -0
  270. package/dist/modules/auth/utils/get-user-context.mjs.map +1 -0
  271. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs +10 -0
  272. package/dist/modules/ia-credits/actions/list-ia-credits.action.mjs.map +1 -0
  273. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs +76 -0
  274. package/dist/modules/ia-credits/hooks/ia-credits.hook.mjs.map +1 -0
  275. package/dist/modules/ia-credits/services/ia-credits.service.mjs +31 -0
  276. package/dist/modules/ia-credits/services/ia-credits.service.mjs.map +1 -0
  277. package/dist/modules/ia-credits/types.mjs +25 -0
  278. package/dist/modules/ia-credits/types.mjs.map +1 -0
  279. package/dist/modules/projects/actions/add-project-user.action.mjs +10 -0
  280. package/dist/modules/projects/actions/add-project-user.action.mjs.map +1 -0
  281. package/dist/modules/projects/actions/list-available-users.action.mjs +10 -0
  282. package/dist/modules/projects/actions/list-available-users.action.mjs.map +1 -0
  283. package/dist/modules/projects/actions/list-project-users.action.mjs +10 -0
  284. package/dist/modules/projects/actions/list-project-users.action.mjs.map +1 -0
  285. package/dist/modules/projects/actions/remove-project-user.action.mjs +10 -0
  286. package/dist/modules/projects/actions/remove-project-user.action.mjs.map +1 -0
  287. package/dist/modules/projects/hooks/list-available-users.hook.mjs +34 -0
  288. package/dist/modules/projects/hooks/list-available-users.hook.mjs.map +1 -0
  289. package/dist/modules/projects/hooks/list-project-users.hook.mjs +34 -0
  290. package/dist/modules/projects/hooks/list-project-users.hook.mjs.map +1 -0
  291. package/dist/modules/projects/services/project-users.service.mjs +78 -0
  292. package/dist/modules/projects/services/project-users.service.mjs.map +1 -0
  293. package/dist/modules/projects/types.mjs +22 -0
  294. package/dist/modules/projects/types.mjs.map +1 -0
  295. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs +10 -0
  296. package/dist/modules/subscriptions/actions/list-subscriptions.action.mjs.map +1 -0
  297. package/dist/modules/subscriptions/constants/addons.constants.mjs +12 -0
  298. package/dist/modules/subscriptions/constants/addons.constants.mjs.map +1 -0
  299. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs +20 -0
  300. package/dist/modules/subscriptions/hooks/find-active-subscription.hook.mjs.map +1 -0
  301. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs +18 -0
  302. package/dist/modules/subscriptions/hooks/list-subscriptions.hook.mjs.map +1 -0
  303. package/dist/modules/subscriptions/services/subscriptions.service.mjs +32 -0
  304. package/dist/modules/subscriptions/services/subscriptions.service.mjs.map +1 -0
  305. package/dist/modules/subscriptions/types.mjs +57 -0
  306. package/dist/modules/subscriptions/types.mjs.map +1 -0
  307. package/dist/modules/users/action/find-user-by-id.action.mjs +10 -0
  308. package/dist/modules/users/action/find-user-by-id.action.mjs.map +1 -0
  309. package/dist/modules/users/action/list-messages.action.mjs +13 -0
  310. package/dist/modules/users/action/list-messages.action.mjs.map +1 -0
  311. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs +10 -0
  312. package/dist/modules/users/action/mark-all-messages-as-read.action.mjs.map +1 -0
  313. package/dist/modules/users/action/mark-message-as-read.action.mjs +10 -0
  314. package/dist/modules/users/action/mark-message-as-read.action.mjs.map +1 -0
  315. package/dist/modules/users/hooks/messages.hook.mjs +57 -0
  316. package/dist/modules/users/hooks/messages.hook.mjs.map +1 -0
  317. package/dist/modules/users/schema/messages.schema.mjs +21 -0
  318. package/dist/modules/users/schema/messages.schema.mjs.map +1 -0
  319. package/dist/modules/users/schema.mjs +11 -0
  320. package/dist/modules/users/schema.mjs.map +1 -0
  321. package/dist/modules/users/services/messages.service.mjs +35 -0
  322. package/dist/modules/users/services/messages.service.mjs.map +1 -0
  323. package/dist/modules/users/services/user.service.mjs +50 -0
  324. package/dist/modules/users/services/user.service.mjs.map +1 -0
  325. package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs +15 -0
  326. package/dist/modules/whitelabel/actions/find-whitelabel-styles.action.mjs.map +1 -0
  327. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +21 -0
  328. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +1 -0
  329. package/dist/modules/whitelabel/schema.mjs +1 -0
  330. package/dist/modules/whitelabel/schema.mjs.map +1 -0
  331. package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs +81 -0
  332. package/dist/modules/whitelabel/services/whitelabel-styles.service.mjs.map +1 -0
  333. package/dist/modules/whitelabel/services/whitelabel.service.mjs +61 -0
  334. package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +1 -0
  335. package/dist/modules/whitelabel/styles-schema.mjs +1 -0
  336. package/dist/modules/whitelabel/styles-schema.mjs.map +1 -0
  337. package/dist/providers/auth.provider.mjs +100 -0
  338. package/dist/providers/auth.provider.mjs.map +1 -0
  339. package/dist/providers/query.provider.mjs +99 -0
  340. package/dist/providers/query.provider.mjs.map +1 -0
  341. package/dist/providers/whitelabel.provider.mjs +31 -0
  342. package/dist/providers/whitelabel.provider.mjs.map +1 -0
  343. package/dist/server.mjs +84 -0
  344. package/dist/server.mjs.map +1 -0
  345. package/dist/store/useAccountModals.mjs +18 -0
  346. package/dist/store/useAccountModals.mjs.map +1 -0
  347. package/dist/store/useMdSidebarStore.mjs +11 -0
  348. package/dist/store/useMdSidebarStore.mjs.map +1 -0
  349. package/dist/store/useMobileNavbarSheet.mjs +14 -0
  350. package/dist/store/useMobileNavbarSheet.mjs.map +1 -0
  351. package/dist/store/useModalManager.mjs +75 -0
  352. package/dist/store/useModalManager.mjs.map +1 -0
  353. package/dist/utils/browser/clipboard.mjs +36 -0
  354. package/dist/utils/browser/clipboard.mjs.map +1 -0
  355. package/dist/utils/countries.mjs +219 -0
  356. package/dist/utils/countries.mjs.map +1 -0
  357. package/dist/utils/file/index.mjs +9 -0
  358. package/dist/utils/file/index.mjs.map +1 -0
  359. package/dist/utils/format/masks.mjs +56 -0
  360. package/dist/utils/format/masks.mjs.map +1 -0
  361. package/dist/utils/intl/locales.mjs +12 -0
  362. package/dist/utils/intl/locales.mjs.map +1 -0
  363. package/dist/utils/safeServerAction.mjs +16 -0
  364. package/dist/utils/safeServerAction.mjs.map +1 -0
  365. package/dist/utils/validators/account.mjs +26 -0
  366. package/dist/utils/validators/account.mjs.map +1 -0
  367. package/dist/utils/validators/common.mjs +47 -0
  368. package/dist/utils/validators/common.mjs.map +1 -0
  369. package/dist/utils/withAction.mjs +13 -0
  370. package/dist/utils/withAction.mjs.map +1 -0
  371. package/package.json +3 -2
  372. package/src/components/account/hooks/useChangePhoneForm.tsx +81 -69
  373. package/src/components/account/sections/ChangeEmailModal.tsx +2 -1
  374. package/src/components/account/sections/ChangePhoneModal.tsx +231 -229
  375. package/src/components/ui/form/PhoneInput.tsx +205 -98
  376. package/src/modules/accounts/actions/account-management.action.ts +4 -4
  377. package/src/modules/accounts/services/account.service.ts +4 -4
  378. package/src/utils/countries.ts +224 -0
@@ -1,69 +1,81 @@
1
- 'use client';
2
-
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 { changePhoneSchema, type ChangePhoneFormData } from '../../../utils/validators/account';
9
- import { formatPhone } from '../../../utils/format/masks';
10
- import { requestPhoneChangeAction } from '../../../modules/accounts/actions/account-management.action';
11
-
12
- export default function useChangePhoneForm() {
13
- const [showVerification, setShowVerification] = useState(false);
14
-
15
- const form = useForm<ChangePhoneFormData>({
16
- resolver: zodResolver(changePhoneSchema),
17
- mode: 'onChange',
18
- defaultValues: { phone: '' },
19
- });
20
-
21
- const phoneValue = form.watch('phone');
22
- const errors = form.formState.errors;
23
- const isSubmitting = form.formState.isSubmitting;
24
-
25
- const handlePhoneChange = useCallback(
26
- (e: React.ChangeEvent<HTMLInputElement>) => {
27
- const formatted = formatPhone(e.target.value);
28
- form.setValue('phone', formatted, { shouldValidate: true });
29
- },
30
- [form]
31
- );
32
-
33
- const handleContinue = form.handleSubmit(async (data) => {
34
- const result = await requestPhoneChangeAction(data.phone);
35
-
36
- if (!result.success) {
37
- toast.custom((t) => (
38
- <Toast
39
- variant="error"
40
- message={result.error ?? 'Número já existente ou ocorreu um erro. Tente novamente mais tarde.'}
41
- toastId={t}
42
- />
43
- ));
44
- return;
45
- }
46
-
47
- setShowVerification(true);
48
- });
49
-
50
- const handleBack = useCallback(() => {
51
- setShowVerification(false);
52
- }, []);
53
-
54
- const resetForm = useCallback(() => {
55
- form.reset();
56
- setShowVerification(false);
57
- }, [form]);
58
-
59
- return {
60
- showVerification,
61
- phoneValue,
62
- isSubmitting,
63
- errors,
64
- handlePhoneChange,
65
- handleContinue,
66
- handleBack,
67
- resetForm,
68
- };
69
- }
1
+ 'use client';
2
+
3
+ import { useState, useCallback } from 'react';
4
+ import { toast } from 'sonner';
5
+ import { Toast } from '../../ui/feedback/Toast';
6
+ import { requestPhoneChangeAction } from '../../../modules/accounts/actions/account-management.action';
7
+
8
+ function splitPhoneValue(fullValue: string): { ddi: string; local: string } {
9
+ const trimmed = fullValue.trim();
10
+ const spaceIdx = trimmed.indexOf(' ');
11
+ if (spaceIdx === -1) return { ddi: '+55', local: trimmed };
12
+ return { ddi: trimmed.slice(0, spaceIdx), local: trimmed.slice(spaceIdx + 1) };
13
+ }
14
+
15
+ export default function useChangePhoneForm() {
16
+ const [showVerification, setShowVerification] = useState(false);
17
+ const [phoneValue, setPhoneValue] = useState('');
18
+ const [phoneError, setPhoneError] = useState('');
19
+ const [isSubmitting, setIsSubmitting] = useState(false);
20
+ const [submittedPhone, setSubmittedPhone] = useState({ ddi: '+55', local: '' });
21
+
22
+ const handlePhoneChange = useCallback((value: string) => {
23
+ setPhoneValue(value);
24
+ if (phoneError) setPhoneError('');
25
+ }, [phoneError]);
26
+
27
+ const handleContinue = useCallback(async (e: React.FormEvent) => {
28
+ e.preventDefault();
29
+
30
+ const { ddi, local } = splitPhoneValue(phoneValue);
31
+
32
+ if (!local || local.replace(/\D/g, '').length < 8) {
33
+ setPhoneError('Número de telefone inválido');
34
+ return;
35
+ }
36
+
37
+ setIsSubmitting(true);
38
+ try {
39
+ const result = await requestPhoneChangeAction(local, ddi);
40
+
41
+ if (!result.success) {
42
+ toast.custom((t) => (
43
+ <Toast
44
+ variant="error"
45
+ message={result.error ?? 'Número já existente ou ocorreu um erro. Tente novamente mais tarde.'}
46
+ toastId={t}
47
+ />
48
+ ));
49
+ return;
50
+ }
51
+
52
+ setSubmittedPhone({ ddi, local });
53
+ setShowVerification(true);
54
+ } finally {
55
+ setIsSubmitting(false);
56
+ }
57
+ }, [phoneValue]);
58
+
59
+ const handleBack = useCallback(() => {
60
+ setShowVerification(false);
61
+ }, []);
62
+
63
+ const resetForm = useCallback(() => {
64
+ setPhoneValue('');
65
+ setPhoneError('');
66
+ setSubmittedPhone({ ddi: '+55', local: '' });
67
+ setShowVerification(false);
68
+ }, []);
69
+
70
+ return {
71
+ showVerification,
72
+ phoneValue,
73
+ phoneError,
74
+ isSubmitting,
75
+ submittedPhone,
76
+ handlePhoneChange,
77
+ handleContinue,
78
+ handleBack,
79
+ resetForm,
80
+ };
81
+ }
@@ -82,7 +82,8 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
82
82
  <Dialog open={open} onOpenChange={handleClose}>
83
83
  <DialogContent
84
84
  showCloseButton={false}
85
- className="flex flex-col p-0 gap-0 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%]!"
85
+ overlayClassName="z-[1002]"
86
+ className="flex flex-col p-0 gap-0 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]!"
86
87
  >
87
88
  {showVerification ? (
88
89
  <DialogHeader className="flex flex-row items-center justify-between px-4 py-3 border-b border-gray-200 lg:border-b-0">
@@ -1,229 +1,231 @@
1
- 'use client';
2
-
3
- import { ChevronLeft, X, MessageSquare } from 'lucide-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 PhoneInput from '../../ui/form/PhoneInput';
9
- import { formatTimer, formatPhone } 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 { confirmPhoneChangeAction } from '../../../modules/accounts/actions/account-management.action';
14
- import useChangePhoneForm from '../hooks/useChangePhoneForm';
15
- import useOtpVerification from '../hooks/useOtpVerification';
16
-
17
- interface ChangePhoneModalProps {
18
- open: boolean;
19
- onClose: () => void;
20
- }
21
-
22
- export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
23
- const { user } = useAuth();
24
- const invalidateUser = useInvalidateUser();
25
-
26
- const currentPhoneDisplay = user?.phone
27
- ? formatPhone(
28
- user.ddi && user.phone.startsWith(user.ddi) ? user.phone.slice(user.ddi.length) : user.phone
29
- )
30
- : '';
31
-
32
- const {
33
- showVerification,
34
- phoneValue,
35
- isSubmitting,
36
- errors,
37
- handlePhoneChange,
38
- handleContinue,
39
- handleBack,
40
- resetForm,
41
- } = useChangePhoneForm();
42
-
43
- const handleSuccess = () => {
44
- invalidateUser();
45
- resetForm();
46
- onClose();
47
- };
48
-
49
- const {
50
- code,
51
- isLoading,
52
- hasError,
53
- timer,
54
- canResend,
55
- isValidLength,
56
- handleCodeChange,
57
- handleValidate,
58
- handleResend,
59
- reset: resetOtp,
60
- } = useOtpVerification({
61
- onSuccess: handleSuccess,
62
- successMessage: 'Telefone alterado',
63
- validateFn: async (token) => {
64
- const result = await confirmPhoneChangeAction(token, phoneValue);
65
- return result.success;
66
- },
67
- resendFn: async () => {
68
- const { requestPhoneChangeAction } = await import('../../../modules/accounts/actions/account-management.action');
69
- const result = await requestPhoneChangeAction(phoneValue);
70
- if (!result.success) {
71
- throw new Error(result.error);
72
- }
73
- },
74
- });
75
-
76
- const handleClose = () => {
77
- resetForm();
78
- resetOtp();
79
- onClose();
80
- };
81
-
82
- const handleBackFromVerification = () => {
83
- resetOtp();
84
- handleBack();
85
- };
86
-
87
- return (
88
- <Dialog open={open} onOpenChange={handleClose}>
89
- <DialogContent
90
- showCloseButton={false}
91
- className="flex flex-col p-0 gap-0 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%]!"
92
- >
93
- {showVerification ? (
94
- <DialogHeader className="flex flex-row items-center justify-between px-4 py-3 border-b border-gray-200 lg:border-b-0">
95
- <Button variant="ghost" className="size-8! p-0" onClick={handleBackFromVerification}>
96
- <ChevronLeft size={20} className="text-gray-950" />
97
- </Button>
98
- <DialogTitle className="paragraph-medium-semibold text-gray-950 text-center flex-1">
99
- Alterar telefone
100
- </DialogTitle>
101
- <Button variant="ghost" className="size-8! p-0" onClick={handleClose}>
102
- <X size={18} className="text-gray-500" />
103
- </Button>
104
- </DialogHeader>
105
- ) : (
106
- <>
107
- <DialogHeader className="sr-only">
108
- <DialogTitle>Alterar telefone</DialogTitle>
109
- </DialogHeader>
110
- <div className="flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0">
111
- <span className="paragraph-medium-semibold text-gray-950 text-center">
112
- Alterar telefone
113
- </span>
114
- <Button
115
- variant="ghost"
116
- className="absolute right-2 size-8! p-0"
117
- onClick={handleClose}
118
- >
119
- <X size={18} className="text-gray-500" />
120
- </Button>
121
- </div>
122
- </>
123
- )}
124
-
125
- <div className={`${showVerification ? 'w-full' : 'w-1/2'} h-0.75 bg-pages-300`} />
126
-
127
- {showVerification ? (
128
- <form
129
- onSubmit={(e) => {
130
- e.preventDefault();
131
- handleValidate();
132
- }}
133
- className="flex flex-col flex-1 lg:flex-none"
134
- >
135
- <div className="px-4 lg:px-5 py-5 lg:py-6 flex flex-col gap-4 flex-1 lg:flex-none">
136
- <div className="flex items-center justify-center size-12 bg-white rounded-lg shadow-xs border border-gray-200">
137
- <MessageSquare size={20} className="text-gray-950" />
138
- </div>
139
-
140
- <div className="flex flex-col gap-1">
141
- <h3 className="paragraph-medium-semibold text-gray-950">Código de validação</h3>
142
- <p className="paragraph-small-regular text-gray-600">
143
- Enviamos um código de validação para o número atual{' '}
144
- <span className="font-semibold text-gray-950">{currentPhoneDisplay}.</span>
145
- </p>
146
- </div>
147
-
148
- <div className="flex flex-col gap-2">
149
- <InputOTP maxLength={OTP_CODE_LENGTH} value={code} onChange={handleCodeChange}>
150
- <InputOTPGroup className="flex flex-row gap-2">
151
- {[...Array(OTP_CODE_LENGTH)].map((_, i) => (
152
- <InputOTPSlot
153
- key={i}
154
- index={i}
155
- 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'}`}
156
- />
157
- ))}
158
- </InputOTPGroup>
159
- </InputOTP>
160
- {hasError && (
161
- <p className="paragraph-small-regular text-red-500">Código incorreto</p>
162
- )}
163
- </div>
164
-
165
- {canResend ? (
166
- <button
167
- type="button"
168
- onClick={handleResend}
169
- className="paragraph-small-medium text-gray-950 underline cursor-pointer hover:text-gray-700 w-fit"
170
- >
171
- Reenviar código
172
- </button>
173
- ) : (
174
- <p className="paragraph-small-regular text-gray-500">
175
- Reenviar em{' '}
176
- <span className="paragraph-small-semibold text-gray-950">
177
- {formatTimer(timer)}
178
- </span>
179
- </p>
180
- )}
181
- </div>
182
-
183
- <Separator />
184
-
185
- <div className="flex items-center justify-between px-4 lg:px-5 py-4 lg:py-5 mt-auto lg:mt-0">
186
- <Button variant="secondary" className="h-10!" type="button" onClick={handleClose}>
187
- Cancelar
188
- </Button>
189
- <Button className="h-10!" type="submit" disabled={!isValidLength || isLoading}>
190
- {isLoading ? 'Validando...' : 'Alterar telefone'}
191
- </Button>
192
- </div>
193
- </form>
194
- ) : (
195
- <form onSubmit={handleContinue} className="flex flex-col flex-1 lg:flex-none">
196
- <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">
197
- <div className="flex flex-col gap-1">
198
- <span className="paragraph-medium-semibold text-gray-950">
199
- Atualizar telefone de contato
200
- </span>
201
- <span className="paragraph-small-regular text-gray-600">
202
- Informe o novo número para manter seu contato atualizado.
203
- </span>
204
- </div>
205
-
206
- <PhoneInput
207
- label="Novo número"
208
- placeholder="(00) 0 0000-0000"
209
- value={phoneValue}
210
- onChange={handlePhoneChange}
211
- error={!!errors.phone}
212
- errorMessage={errors.phone?.message}
213
- />
214
- </div>
215
-
216
- <div className="flex items-center justify-between p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0">
217
- <Button variant="secondary" className="h-10!" type="button" onClick={handleClose}>
218
- Cancelar
219
- </Button>
220
- <Button className="h-10!" type="submit" disabled={isSubmitting}>
221
- {isSubmitting ? 'Enviando...' : 'Continuar'}
222
- </Button>
223
- </div>
224
- </form>
225
- )}
226
- </DialogContent>
227
- </Dialog>
228
- );
229
- }
1
+ 'use client';
2
+
3
+ import { ChevronLeft, X, MessageSquare } from 'lucide-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 PhoneInput from '../../ui/form/PhoneInput';
9
+ import { formatTimer, formatPhone } 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 { confirmPhoneChangeAction } from '../../../modules/accounts/actions/account-management.action';
14
+ import useChangePhoneForm from '../hooks/useChangePhoneForm';
15
+ import useOtpVerification from '../hooks/useOtpVerification';
16
+
17
+ interface ChangePhoneModalProps {
18
+ open: boolean;
19
+ onClose: () => void;
20
+ }
21
+
22
+ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
23
+ const { user } = useAuth();
24
+ const invalidateUser = useInvalidateUser();
25
+
26
+ const currentPhoneDisplay = user?.phone
27
+ ? formatPhone(
28
+ user.ddi && user.phone.startsWith(user.ddi) ? user.phone.slice(user.ddi.length) : user.phone
29
+ )
30
+ : '';
31
+
32
+ const {
33
+ showVerification,
34
+ phoneValue,
35
+ phoneError,
36
+ isSubmitting,
37
+ submittedPhone,
38
+ handlePhoneChange,
39
+ handleContinue,
40
+ handleBack,
41
+ resetForm,
42
+ } = useChangePhoneForm();
43
+
44
+ const handleSuccess = () => {
45
+ invalidateUser();
46
+ resetForm();
47
+ onClose();
48
+ };
49
+
50
+ const {
51
+ code,
52
+ isLoading,
53
+ hasError,
54
+ timer,
55
+ canResend,
56
+ isValidLength,
57
+ handleCodeChange,
58
+ handleValidate,
59
+ handleResend,
60
+ reset: resetOtp,
61
+ } = useOtpVerification({
62
+ onSuccess: handleSuccess,
63
+ successMessage: 'Telefone alterado',
64
+ validateFn: async (token) => {
65
+ const result = await confirmPhoneChangeAction(token, submittedPhone.local, submittedPhone.ddi);
66
+ return result.success;
67
+ },
68
+ resendFn: async () => {
69
+ const { requestPhoneChangeAction } = await import('../../../modules/accounts/actions/account-management.action');
70
+ const result = await requestPhoneChangeAction(submittedPhone.local, submittedPhone.ddi);
71
+ if (!result.success) {
72
+ throw new Error(result.error);
73
+ }
74
+ },
75
+ });
76
+
77
+ const handleClose = () => {
78
+ resetForm();
79
+ resetOtp();
80
+ onClose();
81
+ };
82
+
83
+ const handleBackFromVerification = () => {
84
+ resetOtp();
85
+ handleBack();
86
+ };
87
+
88
+ return (
89
+ <Dialog open={open} onOpenChange={handleClose}>
90
+ <DialogContent
91
+ showCloseButton={false}
92
+ overlayClassName="z-[1002]"
93
+ className="flex flex-col p-0 gap-0 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]!"
94
+ >
95
+ {showVerification ? (
96
+ <DialogHeader className="flex flex-row items-center justify-between px-4 py-3 border-b border-gray-200 lg:border-b-0">
97
+ <Button variant="ghost" className="size-8! p-0" onClick={handleBackFromVerification}>
98
+ <ChevronLeft size={20} className="text-gray-950" />
99
+ </Button>
100
+ <DialogTitle className="paragraph-medium-semibold text-gray-950 text-center flex-1">
101
+ Alterar telefone
102
+ </DialogTitle>
103
+ <Button variant="ghost" className="size-8! p-0" onClick={handleClose}>
104
+ <X size={18} className="text-gray-500" />
105
+ </Button>
106
+ </DialogHeader>
107
+ ) : (
108
+ <>
109
+ <DialogHeader className="sr-only">
110
+ <DialogTitle>Alterar telefone</DialogTitle>
111
+ </DialogHeader>
112
+ <div className="flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0">
113
+ <span className="paragraph-medium-semibold text-gray-950 text-center">
114
+ Alterar telefone
115
+ </span>
116
+ <Button
117
+ variant="ghost"
118
+ className="absolute right-2 size-8! p-0"
119
+ onClick={handleClose}
120
+ >
121
+ <X size={18} className="text-gray-500" />
122
+ </Button>
123
+ </div>
124
+ </>
125
+ )}
126
+
127
+ <div className={`${showVerification ? 'w-full' : 'w-1/2'} h-0.75 bg-pages-300`} />
128
+
129
+ {showVerification ? (
130
+ <form
131
+ onSubmit={(e) => {
132
+ e.preventDefault();
133
+ handleValidate();
134
+ }}
135
+ className="flex flex-col flex-1 lg:flex-none"
136
+ >
137
+ <div className="px-4 lg:px-5 py-5 lg:py-6 flex flex-col gap-4 flex-1 lg:flex-none">
138
+ <div className="flex items-center justify-center size-12 bg-white rounded-lg shadow-xs border border-gray-200">
139
+ <MessageSquare size={20} className="text-gray-950" />
140
+ </div>
141
+
142
+ <div className="flex flex-col gap-1">
143
+ <h3 className="paragraph-medium-semibold text-gray-950">Código de validação</h3>
144
+ <p className="paragraph-small-regular text-gray-600">
145
+ Enviamos um código de validação para o número atual{' '}
146
+ <span className="font-semibold text-gray-950">{currentPhoneDisplay}.</span>
147
+ </p>
148
+ </div>
149
+
150
+ <div className="flex flex-col gap-2">
151
+ <InputOTP maxLength={OTP_CODE_LENGTH} value={code} onChange={handleCodeChange}>
152
+ <InputOTPGroup className="flex flex-row gap-2">
153
+ {[...Array(OTP_CODE_LENGTH)].map((_, i) => (
154
+ <InputOTPSlot
155
+ key={i}
156
+ index={i}
157
+ 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'}`}
158
+ />
159
+ ))}
160
+ </InputOTPGroup>
161
+ </InputOTP>
162
+ {hasError && (
163
+ <p className="paragraph-small-regular text-red-500">Código incorreto</p>
164
+ )}
165
+ </div>
166
+
167
+ {canResend ? (
168
+ <button
169
+ type="button"
170
+ onClick={handleResend}
171
+ className="paragraph-small-medium text-gray-950 underline cursor-pointer hover:text-gray-700 w-fit"
172
+ >
173
+ Reenviar código
174
+ </button>
175
+ ) : (
176
+ <p className="paragraph-small-regular text-gray-500">
177
+ Reenviar em{' '}
178
+ <span className="paragraph-small-semibold text-gray-950">
179
+ {formatTimer(timer)}
180
+ </span>
181
+ </p>
182
+ )}
183
+ </div>
184
+
185
+ <Separator />
186
+
187
+ <div className="flex items-center justify-between px-4 lg:px-5 py-4 lg:py-5 mt-auto lg:mt-0">
188
+ <Button variant="secondary" className="h-10!" type="button" onClick={handleClose}>
189
+ Cancelar
190
+ </Button>
191
+ <Button className="h-10!" type="submit" disabled={!isValidLength || isLoading}>
192
+ {isLoading ? 'Validando...' : 'Alterar telefone'}
193
+ </Button>
194
+ </div>
195
+ </form>
196
+ ) : (
197
+ <form onSubmit={handleContinue} className="flex flex-col flex-1 lg:flex-none">
198
+ <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">
199
+ <div className="flex flex-col gap-1">
200
+ <span className="paragraph-medium-semibold text-gray-950">
201
+ Atualizar telefone de contato
202
+ </span>
203
+ <span className="paragraph-small-regular text-gray-600">
204
+ Informe o novo número para manter seu contato atualizado.
205
+ </span>
206
+ </div>
207
+
208
+ <PhoneInput
209
+ label="Novo número"
210
+ placeholder="(00) 0 0000-0000"
211
+ value={phoneValue}
212
+ onChange={handlePhoneChange}
213
+ error={!!phoneError}
214
+ errorMessage={phoneError}
215
+ />
216
+ </div>
217
+
218
+ <div className="flex items-center justify-between p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0">
219
+ <Button variant="secondary" className="h-10!" type="button" onClick={handleClose}>
220
+ Cancelar
221
+ </Button>
222
+ <Button className="h-10!" type="submit" disabled={isSubmitting}>
223
+ {isSubmitting ? 'Enviando...' : 'Continuar'}
224
+ </Button>
225
+ </div>
226
+ </form>
227
+ )}
228
+ </DialogContent>
229
+ </Dialog>
230
+ );
231
+ }