@greatapps/common 1.1.673 → 1.1.675

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 (223) hide show
  1. package/dist/components/account/ConfigurationsMyAccountModal.mjs +6 -8
  2. package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
  3. package/dist/components/account/ConfirmDeleteAccountModal.mjs +19 -20
  4. package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -1
  5. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +11 -10
  6. package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -1
  7. package/dist/components/account/DeleteAccountModal.mjs +28 -34
  8. package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
  9. package/dist/components/account/DisableTwoFactorAuthModal.mjs +5 -7
  10. package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -1
  11. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +9 -8
  12. package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -1
  13. package/dist/components/account/TwoFactorAuthModal.mjs +23 -22
  14. package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -1
  15. package/dist/components/account/hooks/useChangeEmailForm.mjs +3 -5
  16. package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -1
  17. package/dist/components/account/hooks/useChangePasswordForm.mjs +3 -26
  18. package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -1
  19. package/dist/components/account/hooks/useChangePhoneForm.mjs +9 -18
  20. package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -1
  21. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +3 -26
  22. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -1
  23. package/dist/components/account/hooks/useOtpVerification.mjs +3 -19
  24. package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -1
  25. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +4 -27
  26. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -1
  27. package/dist/components/account/sections/ChangeEmailModal.mjs +28 -25
  28. package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -1
  29. package/dist/components/account/sections/ChangePasswordSection.mjs +6 -8
  30. package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
  31. package/dist/components/account/sections/ChangePhoneModal.mjs +27 -24
  32. package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -1
  33. package/dist/components/account/sections/MyProfileSection.mjs +22 -37
  34. package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
  35. package/dist/components/account/sections/PreferencesSection.mjs +24 -48
  36. package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
  37. package/dist/components/account/sections/SecuritySection.mjs +9 -11
  38. package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
  39. package/dist/components/account/sections/TokenSection.mjs +8 -24
  40. package/dist/components/account/sections/TokenSection.mjs.map +1 -1
  41. package/dist/components/layouts/AppMobileNavBar.mjs +148 -2
  42. package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -1
  43. package/dist/components/layouts/NavBar.mjs +3 -5
  44. package/dist/components/layouts/NavBar.mjs.map +1 -1
  45. package/dist/components/layouts/NotificationsPopover.mjs +3 -5
  46. package/dist/components/layouts/NotificationsPopover.mjs.map +1 -1
  47. package/dist/components/layouts/ProfilePopover.mjs +4 -6
  48. package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
  49. package/dist/components/layouts/UsersSelectorPopover.mjs +7 -9
  50. package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
  51. package/dist/components/modals/BuyCreditsModal.mjs +18 -17
  52. package/dist/components/modals/BuyCreditsModal.mjs.map +1 -1
  53. package/dist/components/modals/CreditsDisabledModal.mjs +4 -6
  54. package/dist/components/modals/CreditsDisabledModal.mjs.map +1 -1
  55. package/dist/components/modals/PaidPlanRequiredModal.mjs +3 -5
  56. package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
  57. package/dist/components/modals/cards/AddCardModal.mjs +24 -27
  58. package/dist/components/modals/cards/AddCardModal.mjs.map +1 -1
  59. package/dist/components/modals/cards/CannotDeleteCardModal.mjs +7 -9
  60. package/dist/components/modals/cards/CannotDeleteCardModal.mjs.map +1 -1
  61. package/dist/components/modals/cards/CardFormFields.mjs +22 -25
  62. package/dist/components/modals/cards/CardFormFields.mjs.map +1 -1
  63. package/dist/components/modals/cards/DeleteCardModal.mjs +8 -10
  64. package/dist/components/modals/cards/DeleteCardModal.mjs.map +1 -1
  65. package/dist/components/navigation/CancelledSubscriptionBanner.mjs +2 -4
  66. package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
  67. package/dist/components/navigation/OverdueInvoiceBanner.mjs +2 -4
  68. package/dist/components/navigation/OverdueInvoiceBanner.mjs.map +1 -1
  69. package/dist/components/navigation/PendingCancellationBanner.mjs +6 -4
  70. package/dist/components/navigation/PendingCancellationBanner.mjs.map +1 -1
  71. package/dist/components/navigation/ProjectSelectorPopover.mjs +6 -8
  72. package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -1
  73. package/dist/components/navigation/UpcomingInvoiceBanner.mjs +6 -4
  74. package/dist/components/navigation/UpcomingInvoiceBanner.mjs.map +1 -1
  75. package/dist/components/navigation/subcomponents/BottomLinks.mjs +3 -5
  76. package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +1 -1
  77. package/dist/components/navigation/subcomponents/CreditsCard.mjs +1 -3
  78. package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -1
  79. package/dist/components/navigation/subcomponents/PlanCard.mjs +1 -3
  80. package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -1
  81. package/dist/components/navigation/subcomponents/ProjectSelector.mjs +3 -5
  82. package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
  83. package/dist/components/pages/NotFoundPage.mjs +3 -5
  84. package/dist/components/pages/NotFoundPage.mjs.map +1 -1
  85. package/dist/components/pages/notifications/Notifications.mjs +10 -13
  86. package/dist/components/pages/notifications/Notifications.mjs.map +1 -1
  87. package/dist/components/ui/buttons/CopyButton.mjs +5 -9
  88. package/dist/components/ui/buttons/CopyButton.mjs.map +1 -1
  89. package/dist/components/ui/data-display/CardItem.mjs +5 -7
  90. package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
  91. package/dist/components/ui/data-display/PaymentInfoCard.mjs +8 -10
  92. package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -1
  93. package/dist/components/ui/feedback/DefaultCircularProgress.mjs +1 -3
  94. package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -1
  95. package/dist/components/ui/form/ComboboxField.mjs +6 -11
  96. package/dist/components/ui/form/ComboboxField.mjs.map +1 -1
  97. package/dist/components/ui/form/DatePicker.mjs +2 -5
  98. package/dist/components/ui/form/DatePicker.mjs.map +1 -1
  99. package/dist/components/ui/form/DateRangePicker.mjs +2 -5
  100. package/dist/components/ui/form/DateRangePicker.mjs.map +1 -1
  101. package/dist/components/ui/form/PhoneInput.mjs +3 -5
  102. package/dist/components/ui/form/PhoneInput.mjs.map +1 -1
  103. package/dist/components/ui/form/SelectField.mjs +3 -6
  104. package/dist/components/ui/form/SelectField.mjs.map +1 -1
  105. package/dist/components/widgets/ImageUpload/ImageCropModal.mjs +18 -11
  106. package/dist/components/widgets/ImageUpload/ImageCropModal.mjs.map +1 -1
  107. package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs +15 -6
  108. package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs.map +1 -1
  109. package/dist/index.mjs +2 -16
  110. package/dist/index.mjs.map +1 -1
  111. package/dist/modules/cards/hooks/handle-delete-card.hook.mjs +1 -2
  112. package/dist/modules/cards/hooks/handle-delete-card.hook.mjs.map +1 -1
  113. package/dist/modules/plans/types/plan.type.mjs +0 -3
  114. package/dist/modules/plans/types/plan.type.mjs.map +1 -1
  115. package/dist/modules/plans/utils/map-api-plan-to-ui.mjs +8 -15
  116. package/dist/modules/plans/utils/map-api-plan-to-ui.mjs.map +1 -1
  117. package/dist/providers/auth.provider.mjs +1 -9
  118. package/dist/providers/auth.provider.mjs.map +1 -1
  119. package/dist/server.mjs +0 -2
  120. package/dist/server.mjs.map +1 -1
  121. package/dist/utils/format/currency.mjs +4 -32
  122. package/dist/utils/format/currency.mjs.map +1 -1
  123. package/dist/utils/intl/locales.mjs +2 -3
  124. package/dist/utils/intl/locales.mjs.map +1 -1
  125. package/package.json +1 -7
  126. package/src/components/account/ConfigurationsMyAccountModal.tsx +6 -10
  127. package/src/components/account/ConfirmDeleteAccountModal.tsx +13 -22
  128. package/src/components/account/ConfirmGlobalPreferencesModal.tsx +10 -12
  129. package/src/components/account/DeleteAccountModal.tsx +24 -34
  130. package/src/components/account/DisableTwoFactorAuthModal.tsx +6 -11
  131. package/src/components/account/IsntPossibleDeleteAccountModal.tsx +6 -8
  132. package/src/components/account/TwoFactorAuthModal.tsx +29 -33
  133. package/src/components/account/hooks/useChangeEmailForm.tsx +3 -5
  134. package/src/components/account/hooks/useChangePasswordForm.tsx +6 -20
  135. package/src/components/account/hooks/useChangePhoneForm.tsx +10 -16
  136. package/src/components/account/hooks/useDisableTwoFactorAuthForm.tsx +6 -20
  137. package/src/components/account/hooks/useOtpVerification.tsx +4 -16
  138. package/src/components/account/hooks/useTwoFactorAuthForm.tsx +7 -21
  139. package/src/components/account/sections/ChangeEmailModal.tsx +21 -35
  140. package/src/components/account/sections/ChangePasswordSection.tsx +6 -10
  141. package/src/components/account/sections/ChangePhoneModal.tsx +22 -50
  142. package/src/components/account/sections/MyProfileSection.tsx +23 -37
  143. package/src/components/account/sections/PreferencesSection.tsx +25 -52
  144. package/src/components/account/sections/SecuritySection.tsx +10 -19
  145. package/src/components/account/sections/TokenSection.tsx +10 -22
  146. package/src/components/layouts/AppMobileNavBar.tsx +154 -1
  147. package/src/components/layouts/NavBar.tsx +3 -5
  148. package/src/components/layouts/NotificationsPopover.tsx +3 -5
  149. package/src/components/layouts/ProfilePopover.tsx +4 -6
  150. package/src/components/layouts/UsersSelectorPopover.tsx +7 -9
  151. package/src/components/modals/BuyCreditsModal.tsx +16 -18
  152. package/src/components/modals/CreditsDisabledModal.tsx +6 -6
  153. package/src/components/modals/PaidPlanRequiredModal.tsx +3 -5
  154. package/src/components/modals/cards/AddCardModal.tsx +27 -29
  155. package/src/components/modals/cards/CannotDeleteCardModal.tsx +8 -9
  156. package/src/components/modals/cards/CardFormFields.tsx +22 -25
  157. package/src/components/modals/cards/DeleteCardModal.tsx +8 -10
  158. package/src/components/navigation/CancelledSubscriptionBanner.tsx +2 -4
  159. package/src/components/navigation/OverdueInvoiceBanner.tsx +2 -4
  160. package/src/components/navigation/PendingCancellationBanner.tsx +2 -4
  161. package/src/components/navigation/ProjectSelectorPopover.tsx +6 -8
  162. package/src/components/navigation/UpcomingInvoiceBanner.tsx +2 -4
  163. package/src/components/navigation/subcomponents/BottomLinks.tsx +3 -5
  164. package/src/components/navigation/subcomponents/CreditsCard.tsx +1 -3
  165. package/src/components/navigation/subcomponents/PlanCard.tsx +1 -3
  166. package/src/components/navigation/subcomponents/ProjectSelector.tsx +3 -5
  167. package/src/components/pages/NotFoundPage.tsx +3 -5
  168. package/src/components/pages/notifications/Notifications.tsx +10 -13
  169. package/src/components/ui/buttons/CopyButton.tsx +5 -10
  170. package/src/components/ui/data-display/CardItem.tsx +5 -7
  171. package/src/components/ui/data-display/PaymentInfoCard.tsx +8 -10
  172. package/src/components/ui/feedback/DefaultCircularProgress.tsx +1 -3
  173. package/src/components/ui/form/ComboboxField.tsx +6 -11
  174. package/src/components/ui/form/DatePicker.tsx +2 -5
  175. package/src/components/ui/form/DateRangePicker.tsx +2 -5
  176. package/src/components/ui/form/PhoneInput.tsx +3 -5
  177. package/src/components/ui/form/SelectField.tsx +3 -6
  178. package/src/components/widgets/ImageUpload/ImageCropModal.tsx +11 -19
  179. package/src/components/widgets/ImageUpload/ImageTooSmallModal.tsx +5 -6
  180. package/src/index.ts +2 -12
  181. package/src/modules/cards/hooks/handle-delete-card.hook.ts +3 -8
  182. package/src/modules/plans/types/plan.type.ts +0 -3
  183. package/src/modules/plans/utils/map-api-plan-to-ui.ts +7 -30
  184. package/src/providers/auth.provider.tsx +1 -13
  185. package/src/server.ts +0 -2
  186. package/src/utils/format/currency.ts +7 -62
  187. package/src/utils/intl/locales.ts +2 -3
  188. package/dist/i18n/config.mjs +0 -13
  189. package/dist/i18n/config.mjs.map +0 -1
  190. package/dist/i18n/country-language.mjs +0 -74
  191. package/dist/i18n/country-language.mjs.map +0 -1
  192. package/dist/i18n/messages/en-us.mjs +0 -450
  193. package/dist/i18n/messages/en-us.mjs.map +0 -1
  194. package/dist/i18n/messages/es-es.mjs +0 -450
  195. package/dist/i18n/messages/es-es.mjs.map +0 -1
  196. package/dist/i18n/messages/index.mjs +0 -16
  197. package/dist/i18n/messages/index.mjs.map +0 -1
  198. package/dist/i18n/messages/pt-br.mjs +0 -463
  199. package/dist/i18n/messages/pt-br.mjs.map +0 -1
  200. package/dist/i18n/normalize.mjs +0 -12
  201. package/dist/i18n/normalize.mjs.map +0 -1
  202. package/dist/i18n/resolve-locale.mjs +0 -42
  203. package/dist/i18n/resolve-locale.mjs.map +0 -1
  204. package/dist/i18n.mjs +0 -14
  205. package/dist/i18n.mjs.map +0 -1
  206. package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs +0 -20
  207. package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs.map +0 -1
  208. package/dist/utils/intl/cookie-domain.mjs +0 -17
  209. package/dist/utils/intl/cookie-domain.mjs.map +0 -1
  210. package/dist/utils/intl/locale-cookie.mjs +0 -13
  211. package/dist/utils/intl/locale-cookie.mjs.map +0 -1
  212. package/src/i18n/config.ts +0 -17
  213. package/src/i18n/country-language.ts +0 -60
  214. package/src/i18n/messages/en-us.ts +0 -468
  215. package/src/i18n/messages/es-es.ts +0 -469
  216. package/src/i18n/messages/index.ts +0 -24
  217. package/src/i18n/messages/pt-br.ts +0 -492
  218. package/src/i18n/normalize.ts +0 -15
  219. package/src/i18n/resolve-locale.ts +0 -77
  220. package/src/i18n.ts +0 -10
  221. package/src/modules/accounts/hooks/use-currency-formatter.hook.tsx +0 -32
  222. package/src/utils/intl/cookie-domain.ts +0 -29
  223. package/src/utils/intl/locale-cookie.ts +0 -18
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- import { useTranslations } from 'next-intl';
4
3
  import { IconShieldCheck } from '@tabler/icons-react';
5
4
  import { Button } from '../ui/buttons/Button';
6
5
  import {
@@ -25,7 +24,6 @@ export default function DisableTwoFactorAuthModal({
25
24
  onClose,
26
25
  onSuccess,
27
26
  }: DisableTwoFactorAuthModalProps) {
28
- const translate = useTranslations();
29
27
  const { code, setCode, isValid, isLoading, handleClose, handleSubmit } =
30
28
  useDisableTwoFactorAuthForm({ onClose, onSuccess });
31
29
 
@@ -45,17 +43,16 @@ export default function DisableTwoFactorAuthModal({
45
43
  </div>
46
44
  <DialogHeader className="p-0 gap-2">
47
45
  <DialogTitle className="paragraph-medium-semibold text-gray-950">
48
- {translate('common.account.twoFactor.disableTitle')}
46
+ Desabilitar autenticação 2FA
49
47
  </DialogTitle>
50
48
  <DialogDescription className="paragraph-small-regular text-gray-600">
51
- {translate('common.account.twoFactor.disableDescription')}
49
+ Informe o código de 6 dígitos do seu aplicativo autenticador para confirmar a
50
+ desativação.
52
51
  </DialogDescription>
53
52
  </DialogHeader>
54
53
 
55
54
  <div className="flex flex-col gap-2">
56
- <span className="paragraph-small-medium text-gray-700">
57
- {translate('common.account.twoFactor.authenticatorCode')}
58
- </span>
55
+ <span className="paragraph-small-medium text-gray-700">Código do autenticador</span>
59
56
  <InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS} value={code} onChange={setCode}>
60
57
  <InputOTPGroup className="gap-2">
61
58
  {Array.from({ length: 6 }).map((_, i) => (
@@ -72,9 +69,7 @@ export default function DisableTwoFactorAuthModal({
72
69
 
73
70
  <div className="flex flex-row items-center gap-2 p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0">
74
71
  <Button className="h-10! flex-1" disabled={!isValid || isLoading} type="submit">
75
- {isLoading
76
- ? translate('common.account.twoFactor.disabling')
77
- : translate('common.account.twoFactor.disable')}
72
+ {isLoading ? 'Desabilitando...' : 'Desabilitar 2FA'}
78
73
  </Button>
79
74
  <Button
80
75
  variant="secondary"
@@ -82,7 +77,7 @@ export default function DisableTwoFactorAuthModal({
82
77
  type="button"
83
78
  onClick={handleClose}
84
79
  >
85
- {translate('common.actions.cancel')}
80
+ Cancelar
86
81
  </Button>
87
82
  </div>
88
83
  </form>
@@ -1,13 +1,11 @@
1
1
  'use client';
2
2
 
3
- import { useTranslations } from 'next-intl';
4
3
  import { IconAlertTriangle } from '@tabler/icons-react';
5
4
  import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';
6
5
  import { Button } from '../ui/buttons/Button';
7
6
  import { useAccountModals } from '../../store/useAccountModals';
8
7
 
9
8
  export default function IsntPossibleDeleteAccountModal() {
10
- const translate = useTranslations();
11
9
  const { activeModal, close, config } = useAccountModals();
12
10
  const { onGoToSubscription } = config;
13
11
  const open = activeModal === 'isntPossibleDelete';
@@ -21,12 +19,12 @@ export default function IsntPossibleDeleteAccountModal() {
21
19
  </div>
22
20
  <DialogHeader className="p-0 gap-2">
23
21
  <DialogTitle className="paragraph-medium-semibold text-gray-950">
24
- {translate('common.account.cantDelete.title')}
22
+ Não é possível excluir a conta
25
23
  </DialogTitle>
26
24
  <DialogDescription className="paragraph-small-regular text-gray-600">
27
- {translate.rich('common.account.cantDelete.description', {
28
- b: (chunks) => <span className="font-semibold text-gray-950">{chunks}</span>,
29
- })}
25
+ Você tem uma assinatura ativa. Para excluir sua conta,{' '}
26
+ <span className="font-semibold text-gray-950">primeiro cancele a assinatura</span> na
27
+ página Assinatura e depois tente novamente.
30
28
  </DialogDescription>
31
29
  </DialogHeader>
32
30
  </div>
@@ -35,14 +33,14 @@ export default function IsntPossibleDeleteAccountModal() {
35
33
 
36
34
  <div className="flex flex-row items-center gap-2">
37
35
  <Button className="h-10 flex-1" onClick={close}>
38
- {translate('common.account.cantDelete.confirm')}
36
+ Ok, entendi
39
37
  </Button>
40
38
  <Button
41
39
  variant="secondary"
42
40
  className="h-10 flex-1"
43
41
  onClick={onGoToSubscription ?? close}
44
42
  >
45
- {translate('common.account.cantDelete.goToSubscription')}
43
+ Ir para assinatura
46
44
  </Button>
47
45
  </div>
48
46
  </DialogContent>
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- import { useTranslations } from 'next-intl';
4
3
  import { IconX, IconCopy, IconRefresh } from '@tabler/icons-react';
5
4
  import { Button } from '../ui/buttons/Button';
6
5
  import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';
@@ -16,7 +15,6 @@ interface TwoFactorAuthModalProps {
16
15
  }
17
16
 
18
17
  export default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFactorAuthModalProps) {
19
- const translate = useTranslations();
20
18
  const {
21
19
  code,
22
20
  setCode,
@@ -48,11 +46,11 @@ export default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFact
48
46
  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%]"
49
47
  >
50
48
  <DialogHeader className="sr-only">
51
- <DialogTitle>{translate('common.account.twoFactor.recoveryTitle')}</DialogTitle>
49
+ <DialogTitle>Códigos de segurança</DialogTitle>
52
50
  </DialogHeader>
53
51
  <div className="flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0">
54
52
  <span className="paragraph-medium-semibold text-gray-950 text-center">
55
- {translate('common.account.twoFactor.recoveryTitle')}
53
+ Códigos de segurança
56
54
  </span>
57
55
  <Button
58
56
  type="button"
@@ -67,12 +65,15 @@ export default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFact
67
65
  <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">
68
66
  <div className="flex flex-col gap-2">
69
67
  <h3 className="paragraph-medium-semibold text-gray-950 max-w-[269px]">
70
- {translate('common.account.twoFactor.recoveryHeading')}
68
+ Salve estes códigos de recuperação de emergência
71
69
  </h3>
72
70
  <div className="paragraph-small-regular text-gray-600">
73
- <p>{translate('common.account.twoFactor.recoveryText1')}</p>
71
+ <p>
72
+ Se você perder acesso ao seu telefone, não será possível fazer login em sua conta
73
+ sem um código de dois fatores.
74
+ </p>
74
75
  <br />
75
- <p>{translate('common.account.twoFactor.recoveryText2')}</p>
76
+ <p>Imprima, copie ou escreva em um local seguro os códigos abaixo.</p>
76
77
  </div>
77
78
  </div>
78
79
 
@@ -89,17 +90,17 @@ export default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFact
89
90
  onClick={handleCopyCodes}
90
91
  >
91
92
  <IconCopy size={16} />
92
- {translate('common.account.twoFactor.copyCodes')}
93
+ Copiar códigos
93
94
  </Button>
94
95
  </div>
95
96
  </div>
96
97
 
97
98
  <div className="flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between mt-auto lg:mt-0">
98
99
  <Button variant="secondary" className="h-10!" type="button" onClick={handleClose}>
99
- {translate('common.actions.cancel')}
100
+ Cancelar
100
101
  </Button>
101
102
  <Button className="h-10!" type="button" onClick={handleFinalize}>
102
- {translate('common.account.twoFactor.finish')}
103
+ Finalizar
103
104
  </Button>
104
105
  </div>
105
106
  </DialogContent>
@@ -115,11 +116,11 @@ export default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFact
115
116
  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%]"
116
117
  >
117
118
  <DialogHeader className="sr-only">
118
- <DialogTitle>{translate('common.account.twoFactor.title')}</DialogTitle>
119
+ <DialogTitle>Autenticação de dois fatores</DialogTitle>
119
120
  </DialogHeader>
120
121
  <div className="shrink-0 flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0">
121
122
  <span className="paragraph-medium-semibold text-gray-950 text-center">
122
- {translate('common.account.twoFactor.title')}
123
+ Autenticação de dois fatores
123
124
  </span>
124
125
  <Button
125
126
  type="button"
@@ -141,18 +142,17 @@ export default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFact
141
142
  <div className="flex-1 min-h-0 overflow-y-auto overscroll-contain lg:overflow-visible">
142
143
  <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">
143
144
  <p className="paragraph-small-regular text-gray-950 text-center max-w-full lg:max-w-[412px]">
144
- {translate.rich('common.account.twoFactor.instructions', {
145
- link: (chunks) => (
146
- <a
147
- href="https://support.google.com/accounts/answer/1066447"
148
- target="_blank"
149
- rel="noopener noreferrer"
150
- className="paragraph-small-medium underline"
151
- >
152
- {chunks}
153
- </a>
154
- ),
155
- })}
145
+ Instale um aplicativo autenticador no seu celular (ex.:{' '}
146
+ <a
147
+ href="https://support.google.com/accounts/answer/1066447"
148
+ target="_blank"
149
+ rel="noopener noreferrer"
150
+ className="paragraph-small-medium underline"
151
+ >
152
+ Google Authenticator
153
+ </a>
154
+ ), escaneie o QR Code ao lado ou copie a chave no aplicativo e, em seguida, digite o
155
+ código de 6 dígitos gerado para continuar.
156
156
  </p>
157
157
 
158
158
  <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]">
@@ -163,9 +163,7 @@ export default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFact
163
163
  className="flex flex-col items-center gap-1.5 text-center"
164
164
  >
165
165
  <IconRefresh size={20} className="text-gray-400" />
166
- <span className="paragraph-xsmall-medium text-gray-500">
167
- {translate('common.account.twoFactor.retry')}
168
- </span>
166
+ <span className="paragraph-xsmall-medium text-gray-500">Tentar novamente</span>
169
167
  </button>
170
168
  ) : isGenerating || !qrcode ? (
171
169
  <div className="skeleton w-full h-full rounded" />
@@ -173,7 +171,7 @@ export default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFact
173
171
  // eslint-disable-next-line @next/next/no-img-element
174
172
  <img
175
173
  src={qrcode}
176
- alt={translate('common.account.twoFactor.qrAlt')}
174
+ alt="QR Code para autenticação de dois fatores"
177
175
  className="w-full h-full"
178
176
  />
179
177
  )}
@@ -182,7 +180,7 @@ export default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFact
182
180
  <div className="flex items-center gap-3 w-full">
183
181
  <Separator className="flex-1" />
184
182
  <span className="paragraph-xsmall-medium text-gray-500 opacity-80 whitespace-nowrap">
185
- {translate('common.account.twoFactor.pasteDigits')}
183
+ Cole os 6 dígitos abaixo
186
184
  </span>
187
185
  <Separator className="flex-1" />
188
186
  </div>
@@ -205,12 +203,10 @@ export default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFact
205
203
 
206
204
  <div className="shrink-0 flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between gap-2 bg-white">
207
205
  <Button variant="secondary" className="h-10!" type="button" onClick={handleClose}>
208
- {translate('common.actions.cancel')}
206
+ Cancelar
209
207
  </Button>
210
208
  <Button type="submit" className="h-10!" disabled={!isCodeComplete || isConfirming}>
211
- {isConfirming
212
- ? translate('common.account.twoFactor.activating')
213
- : translate('common.account.twoFactor.activate')}
209
+ {isConfirming ? 'Ativando...' : 'Ativar autenticação'}
214
210
  </Button>
215
211
  </div>
216
212
  </form>
@@ -3,14 +3,12 @@
3
3
  import { useState, useCallback } from 'react';
4
4
  import { useForm } from 'react-hook-form';
5
5
  import { zodResolver } from '@hookform/resolvers/zod';
6
- import { useTranslations } from 'next-intl';
7
6
  import { toast } from 'sonner';
8
7
  import { Toast } from '../../ui/feedback/Toast';
9
8
  import { changeEmailSchema, type ChangeEmailFormData } from '../../../utils/validators/account';
10
9
  import { requestEmailChangeAction } from '../../../modules/accounts/actions/account-management.action';
11
10
 
12
11
  export default function useChangeEmailForm() {
13
- const translate = useTranslations();
14
12
  const [showVerification, setShowVerification] = useState(false);
15
13
 
16
14
  const { register, handleSubmit, reset, watch, formState: { errors, isSubmitting } } = useForm<ChangeEmailFormData>({
@@ -23,11 +21,11 @@ export default function useChangeEmailForm() {
23
21
  const result = await requestEmailChangeAction(data.email);
24
22
 
25
23
  if (!result.success) {
26
- toast.custom((toastId) => (
24
+ toast.custom((t) => (
27
25
  <Toast
28
26
  variant="error"
29
- message={result.error ?? translate('common.account.changeEmail.emailExistsError')}
30
- toastId={toastId}
27
+ message={result.error ?? 'E-mail já existente ou ocorreu um erro. Tente novamente mais tarde.'}
28
+ toastId={t}
31
29
  />
32
30
  ));
33
31
  return;
@@ -3,7 +3,6 @@
3
3
  import { useForm } from 'react-hook-form';
4
4
  import { zodResolver } from '@hookform/resolvers/zod';
5
5
  import { useMutation } from '@tanstack/react-query';
6
- import { useTranslations } from 'next-intl';
7
6
  import { toast } from 'sonner';
8
7
  import { Toast } from '../../ui/feedback/Toast';
9
8
  import { changePasswordSchema, type ChangePasswordFormData } from '../../../utils/validators/account';
@@ -14,7 +13,6 @@ interface UseChangePasswordFormProps {
14
13
  }
15
14
 
16
15
  export default function useChangePasswordForm({ onSuccess }: UseChangePasswordFormProps = {}) {
17
- const translate = useTranslations();
18
16
  const form = useForm<ChangePasswordFormData>({
19
17
  resolver: zodResolver(changePasswordSchema),
20
18
  mode: 'onChange',
@@ -28,34 +26,22 @@ export default function useChangePasswordForm({ onSuccess }: UseChangePasswordFo
28
26
  mutationFn: changePasswordAction,
29
27
  onSuccess: (result) => {
30
28
  if (!result.success) {
31
- toast.custom((toastId) => (
32
- <Toast
33
- variant="error"
34
- message={result.error ?? translate('common.account.changePassword.changeError')}
35
- toastId={toastId}
36
- />
29
+ toast.custom((t) => (
30
+ <Toast variant="error" message={result.error ?? 'Erro ao alterar senha'} toastId={t} />
37
31
  ));
38
32
  return;
39
33
  }
40
34
 
41
- toast.custom((toastId) => (
42
- <Toast
43
- variant="success"
44
- message={translate('common.account.changePassword.changedSuccess')}
45
- toastId={toastId}
46
- />
35
+ toast.custom((t) => (
36
+ <Toast variant="success" message="Senha alterada com sucesso" toastId={t} />
47
37
  ));
48
38
 
49
39
  form.reset();
50
40
  onSuccess?.();
51
41
  },
52
42
  onError: () => {
53
- toast.custom((toastId) => (
54
- <Toast
55
- variant="error"
56
- message={translate('common.account.changePassword.genericError')}
57
- toastId={toastId}
58
- />
43
+ toast.custom((t) => (
44
+ <Toast variant="error" message="Erro ao alterar senha. Tente novamente." toastId={t} />
59
45
  ));
60
46
  },
61
47
  });
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
3
  import { useState, useCallback } from 'react';
4
- import { useTranslations } from 'next-intl';
5
4
  import { toast } from 'sonner';
6
5
  import { Toast } from '../../ui/feedback/Toast';
7
6
  import { requestPhoneChangeAction, updateUserAction } from '../../../modules/accounts/actions/account-management.action';
@@ -19,7 +18,6 @@ interface UseChangePhoneFormOptions {
19
18
  }
20
19
 
21
20
  export default function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuccess }: UseChangePhoneFormOptions) {
22
- const translate = useTranslations();
23
21
  const [showVerification, setShowVerification] = useState(false);
24
22
  const [phoneValue, setPhoneValue] = useState('');
25
23
  const [phoneError, setPhoneError] = useState('');
@@ -37,7 +35,7 @@ export default function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuc
37
35
  const { ddi, local } = splitPhoneValue(phoneValue);
38
36
 
39
37
  if (!local || local.replace(/\D/g, '').length < 8) {
40
- setPhoneError(translate('common.account.changePhone.invalidNumber'));
38
+ setPhoneError('Número de telefone inválido');
41
39
  return;
42
40
  }
43
41
 
@@ -47,22 +45,18 @@ export default function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuc
47
45
  const result = await updateUserAction({ phone: local, ddi });
48
46
 
49
47
  if (!result.success) {
50
- toast.custom((toastId) => (
48
+ toast.custom((t) => (
51
49
  <Toast
52
50
  variant="error"
53
- message={result.error ?? translate('common.account.changePhone.saveError')}
54
- toastId={toastId}
51
+ message={result.error ?? 'Ocorreu um erro ao salvar o telefone. Tente novamente mais tarde.'}
52
+ toastId={t}
55
53
  />
56
54
  ));
57
55
  return;
58
56
  }
59
57
 
60
- toast.custom((toastId) => (
61
- <Toast
62
- variant="success"
63
- message={translate('common.account.changePhone.phoneAdded')}
64
- toastId={toastId}
65
- />
58
+ toast.custom((t) => (
59
+ <Toast variant="success" message="Telefone adicionado" toastId={t} />
66
60
  ));
67
61
  onDirectUpdateSuccess?.();
68
62
  return;
@@ -71,11 +65,11 @@ export default function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuc
71
65
  const result = await requestPhoneChangeAction(local, ddi);
72
66
 
73
67
  if (!result.success) {
74
- toast.custom((toastId) => (
68
+ toast.custom((t) => (
75
69
  <Toast
76
70
  variant="error"
77
- message={result.error ?? translate('common.account.changePhone.numberExistsError')}
78
- toastId={toastId}
71
+ message={result.error ?? 'Número já existente ou ocorreu um erro. Tente novamente mais tarde.'}
72
+ toastId={t}
79
73
  />
80
74
  ));
81
75
  return;
@@ -86,7 +80,7 @@ export default function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuc
86
80
  } finally {
87
81
  setIsSubmitting(false);
88
82
  }
89
- }, [phoneValue, hasExistingPhone, onDirectUpdateSuccess, translate]);
83
+ }, [phoneValue, hasExistingPhone, onDirectUpdateSuccess]);
90
84
 
91
85
  const handleBack = useCallback(() => {
92
86
  setShowVerification(false);
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { useState, useCallback } from 'react';
4
4
  import { useMutation, useQueryClient } from '@tanstack/react-query';
5
- import { useTranslations } from 'next-intl';
6
5
  import { toast } from 'sonner';
7
6
  import { Toast } from '../../ui/feedback/Toast';
8
7
  import { USER_QUERY_KEY } from '../../../modules/auth/hooks/useUserQuery';
@@ -18,7 +17,6 @@ export default function useDisableTwoFactorAuthForm({
18
17
  onClose,
19
18
  onSuccess,
20
19
  }: UseDisableTwoFactorAuthFormProps) {
21
- const translate = useTranslations();
22
20
  const [code, setCode] = useState('');
23
21
  const queryClient = useQueryClient();
24
22
  const userKey = useWlQueryKey([...USER_QUERY_KEY]);
@@ -30,35 +28,23 @@ export default function useDisableTwoFactorAuthForm({
30
28
  onSuccess: (result) => {
31
29
  if (!result.success) {
32
30
  setCode('');
33
- toast.custom((toastId) => (
34
- <Toast
35
- variant="error"
36
- message={result.error ?? translate('common.account.twoFactor.invalidCode')}
37
- toastId={toastId}
38
- />
31
+ toast.custom((t) => (
32
+ <Toast variant="error" message={result.error ?? 'Código inválido'} toastId={t} />
39
33
  ));
40
34
  return;
41
35
  }
42
36
 
43
37
  queryClient.invalidateQueries({ queryKey: userKey });
44
- toast.custom((toastId) => (
45
- <Toast
46
- variant="success"
47
- message={translate('common.account.twoFactor.disabledSuccess')}
48
- toastId={toastId}
49
- />
38
+ toast.custom((t) => (
39
+ <Toast variant="success" message="Autenticação de dois fatores desabilitada" toastId={t} />
50
40
  ));
51
41
  setCode('');
52
42
  onSuccess?.();
53
43
  },
54
44
  onError: () => {
55
45
  setCode('');
56
- toast.custom((toastId) => (
57
- <Toast
58
- variant="error"
59
- message={translate('common.account.twoFactor.disableError')}
60
- toastId={toastId}
61
- />
46
+ toast.custom((t) => (
47
+ <Toast variant="error" message="Erro ao desabilitar 2FA. Tente novamente." toastId={t} />
62
48
  ));
63
49
  },
64
50
  });
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
3
  import { useState, useCallback } from 'react';
4
- import { useTranslations } from 'next-intl';
5
4
  import { toast } from 'sonner';
6
5
  import { Toast } from '../../ui/feedback/Toast';
7
6
  import useCountdownTimer from '../../../hooks/useCountdownTimer';
@@ -21,7 +20,6 @@ export default function useOtpVerification({
21
20
  validateFn,
22
21
  resendFn,
23
22
  }: UseOtpVerificationOptions) {
24
- const translate = useTranslations();
25
23
  const [code, setCode] = useState('');
26
24
  const [isLoading, setIsLoading] = useState(false);
27
25
  const [hasError, setHasError] = useState(false);
@@ -87,24 +85,14 @@ export default function useOtpVerification({
87
85
  await resendFn();
88
86
  }
89
87
 
90
- toast.custom((toastId) => (
91
- <Toast
92
- variant="success"
93
- message={translate('common.account.twoFactor.codeResent')}
94
- toastId={toastId}
95
- />
96
- ));
88
+ toast.custom((t) => <Toast variant="success" message="Código reenviado" toastId={t} />);
97
89
  } catch (error) {
98
90
  console.error('Erro ao reenviar código:', error);
99
- toast.custom((toastId) => (
100
- <Toast
101
- variant="error"
102
- message={translate('common.account.twoFactor.resendError')}
103
- toastId={toastId}
104
- />
91
+ toast.custom((t) => (
92
+ <Toast variant="error" message="Erro ao reenviar código. Tente novamente." toastId={t} />
105
93
  ));
106
94
  }
107
- }, [canResend, resetTimer, resendFn, translate]);
95
+ }, [canResend, resetTimer, resendFn]);
108
96
 
109
97
  const reset = useCallback(() => {
110
98
  setCode('');
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { useState, useCallback, useEffect } from 'react';
4
4
  import { useMutation } from '@tanstack/react-query';
5
- import { useTranslations } from 'next-intl';
6
5
  import { toast } from 'sonner';
7
6
  import { Toast } from '../../ui/feedback/Toast';
8
7
  import { copyToClipboard } from '../../../utils/browser/clipboard';
@@ -20,19 +19,14 @@ interface UseTwoFactorAuthFormProps {
20
19
  }
21
20
 
22
21
  export default function useTwoFactorAuthForm({ onSuccess, open }: UseTwoFactorAuthFormProps = {}) {
23
- const translate = useTranslations();
24
22
  const [code, setCode] = useState('');
25
23
  const [step, setStep] = useState<Step>('code');
26
24
 
27
25
  const generateMutation = useMutation({
28
26
  mutationFn: withAction(generateTwoFactorAction),
29
27
  onError: () => {
30
- toast.custom((toastId) => (
31
- <Toast
32
- variant="error"
33
- message={translate('common.account.twoFactor.generateError')}
34
- toastId={toastId}
35
- />
28
+ toast.custom((t) => (
29
+ <Toast variant="error" message="Erro ao gerar QR Code. Tente novamente." toastId={t} />
36
30
  ));
37
31
  },
38
32
  });
@@ -44,12 +38,8 @@ export default function useTwoFactorAuthForm({ onSuccess, open }: UseTwoFactorAu
44
38
  },
45
39
  onError: () => {
46
40
  setCode('');
47
- toast.custom((toastId) => (
48
- <Toast
49
- variant="error"
50
- message={translate('common.account.twoFactor.confirmError')}
51
- toastId={toastId}
52
- />
41
+ toast.custom((t) => (
42
+ <Toast variant="error" message="Erro ao confirmar código. Tente novamente." toastId={t} />
53
43
  ));
54
44
  },
55
45
  });
@@ -80,15 +70,11 @@ export default function useTwoFactorAuthForm({ onSuccess, open }: UseTwoFactorAu
80
70
  const codes = generateMutation.data?.backupCodes ?? [];
81
71
  const success = await copyToClipboard(codes.join('\n'));
82
72
  if (success) {
83
- toast.custom((toastId) => (
84
- <Toast
85
- variant="success"
86
- message={translate('common.account.twoFactor.codesCopied')}
87
- toastId={toastId}
88
- />
73
+ toast.custom((t) => (
74
+ <Toast variant="success" message="Códigos copiados com sucesso" toastId={t} />
89
75
  ));
90
76
  }
91
- }, [generateMutation.data, translate]);
77
+ }, [generateMutation.data]);
92
78
 
93
79
  const resetForm = () => {
94
80
  setCode('');