@greatapps/common 1.1.674 → 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 (234) 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/constants.mjs +4 -4
  16. package/dist/components/account/constants.mjs.map +1 -1
  17. package/dist/components/account/hooks/useChangeEmailForm.mjs +3 -5
  18. package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -1
  19. package/dist/components/account/hooks/useChangePasswordForm.mjs +3 -26
  20. package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -1
  21. package/dist/components/account/hooks/useChangePhoneForm.mjs +9 -18
  22. package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -1
  23. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +3 -26
  24. package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -1
  25. package/dist/components/account/hooks/useOtpVerification.mjs +3 -19
  26. package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -1
  27. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +4 -27
  28. package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -1
  29. package/dist/components/account/sections/ChangeEmailModal.mjs +28 -25
  30. package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -1
  31. package/dist/components/account/sections/ChangePasswordSection.mjs +6 -8
  32. package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
  33. package/dist/components/account/sections/ChangePhoneModal.mjs +27 -24
  34. package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -1
  35. package/dist/components/account/sections/MyProfileSection.mjs +22 -37
  36. package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
  37. package/dist/components/account/sections/PreferencesSection.mjs +24 -48
  38. package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
  39. package/dist/components/account/sections/SecuritySection.mjs +9 -11
  40. package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
  41. package/dist/components/account/sections/TokenSection.mjs +8 -24
  42. package/dist/components/account/sections/TokenSection.mjs.map +1 -1
  43. package/dist/components/layouts/AppMobileNavBar.mjs +148 -2
  44. package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -1
  45. package/dist/components/layouts/NavBar.mjs +3 -5
  46. package/dist/components/layouts/NavBar.mjs.map +1 -1
  47. package/dist/components/layouts/NotificationsPopover.mjs +3 -5
  48. package/dist/components/layouts/NotificationsPopover.mjs.map +1 -1
  49. package/dist/components/layouts/ProfilePopover.mjs +4 -6
  50. package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
  51. package/dist/components/layouts/UsersSelectorPopover.mjs +7 -9
  52. package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
  53. package/dist/components/modals/BuyCreditsModal.mjs +18 -17
  54. package/dist/components/modals/BuyCreditsModal.mjs.map +1 -1
  55. package/dist/components/modals/CreditsDisabledModal.mjs +4 -6
  56. package/dist/components/modals/CreditsDisabledModal.mjs.map +1 -1
  57. package/dist/components/modals/PaidPlanRequiredModal.mjs +3 -5
  58. package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
  59. package/dist/components/modals/cards/AddCardModal.mjs +24 -27
  60. package/dist/components/modals/cards/AddCardModal.mjs.map +1 -1
  61. package/dist/components/modals/cards/CannotDeleteCardModal.mjs +7 -9
  62. package/dist/components/modals/cards/CannotDeleteCardModal.mjs.map +1 -1
  63. package/dist/components/modals/cards/CardFormFields.mjs +22 -25
  64. package/dist/components/modals/cards/CardFormFields.mjs.map +1 -1
  65. package/dist/components/modals/cards/DeleteCardModal.mjs +8 -10
  66. package/dist/components/modals/cards/DeleteCardModal.mjs.map +1 -1
  67. package/dist/components/navigation/CancelledSubscriptionBanner.mjs +2 -4
  68. package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
  69. package/dist/components/navigation/OverdueInvoiceBanner.mjs +2 -4
  70. package/dist/components/navigation/OverdueInvoiceBanner.mjs.map +1 -1
  71. package/dist/components/navigation/PendingCancellationBanner.mjs +6 -4
  72. package/dist/components/navigation/PendingCancellationBanner.mjs.map +1 -1
  73. package/dist/components/navigation/ProjectSelectorPopover.mjs +6 -8
  74. package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -1
  75. package/dist/components/navigation/UpcomingInvoiceBanner.mjs +6 -4
  76. package/dist/components/navigation/UpcomingInvoiceBanner.mjs.map +1 -1
  77. package/dist/components/navigation/subcomponents/BottomLinks.mjs +3 -5
  78. package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +1 -1
  79. package/dist/components/navigation/subcomponents/CreditsCard.mjs +1 -3
  80. package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -1
  81. package/dist/components/navigation/subcomponents/PlanCard.mjs +1 -3
  82. package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -1
  83. package/dist/components/navigation/subcomponents/ProjectSelector.mjs +3 -5
  84. package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
  85. package/dist/components/pages/NotFoundPage.mjs +3 -5
  86. package/dist/components/pages/NotFoundPage.mjs.map +1 -1
  87. package/dist/components/pages/notifications/Notifications.mjs +10 -13
  88. package/dist/components/pages/notifications/Notifications.mjs.map +1 -1
  89. package/dist/components/ui/buttons/CopyButton.mjs +5 -9
  90. package/dist/components/ui/buttons/CopyButton.mjs.map +1 -1
  91. package/dist/components/ui/data-display/CardItem.mjs +5 -7
  92. package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
  93. package/dist/components/ui/data-display/PaymentInfoCard.mjs +8 -10
  94. package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -1
  95. package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -1
  96. package/dist/components/ui/feedback/DefaultCircularProgress.mjs +1 -3
  97. package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -1
  98. package/dist/components/ui/form/ComboboxField.mjs +6 -11
  99. package/dist/components/ui/form/ComboboxField.mjs.map +1 -1
  100. package/dist/components/ui/form/DatePicker.mjs +2 -5
  101. package/dist/components/ui/form/DatePicker.mjs.map +1 -1
  102. package/dist/components/ui/form/DateRangePicker.mjs +2 -5
  103. package/dist/components/ui/form/DateRangePicker.mjs.map +1 -1
  104. package/dist/components/ui/form/PhoneInput.mjs +3 -5
  105. package/dist/components/ui/form/PhoneInput.mjs.map +1 -1
  106. package/dist/components/ui/form/SelectField.mjs +3 -6
  107. package/dist/components/ui/form/SelectField.mjs.map +1 -1
  108. package/dist/components/widgets/ImageUpload/ImageCropModal.mjs +18 -11
  109. package/dist/components/widgets/ImageUpload/ImageCropModal.mjs.map +1 -1
  110. package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs +15 -6
  111. package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs.map +1 -1
  112. package/dist/index.mjs +2 -16
  113. package/dist/index.mjs.map +1 -1
  114. package/dist/modules/cards/hooks/handle-delete-card.hook.mjs +1 -2
  115. package/dist/modules/cards/hooks/handle-delete-card.hook.mjs.map +1 -1
  116. package/dist/modules/images/utils/validate-image.mjs +8 -8
  117. package/dist/modules/images/utils/validate-image.mjs.map +1 -1
  118. package/dist/modules/plans/types/plan.type.mjs +0 -3
  119. package/dist/modules/plans/types/plan.type.mjs.map +1 -1
  120. package/dist/modules/plans/utils/map-api-plan-to-ui.mjs +34 -56
  121. package/dist/modules/plans/utils/map-api-plan-to-ui.mjs.map +1 -1
  122. package/dist/modules/subscriptions/utils/periodicity.mjs +14 -20
  123. package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
  124. package/dist/providers/auth.provider.mjs +1 -9
  125. package/dist/providers/auth.provider.mjs.map +1 -1
  126. package/dist/server.mjs +0 -2
  127. package/dist/server.mjs.map +1 -1
  128. package/dist/utils/format/currency.mjs +4 -32
  129. package/dist/utils/format/currency.mjs.map +1 -1
  130. package/dist/utils/intl/locales.mjs +2 -3
  131. package/dist/utils/intl/locales.mjs.map +1 -1
  132. package/package.json +1 -7
  133. package/src/components/account/ConfigurationsMyAccountModal.tsx +6 -10
  134. package/src/components/account/ConfirmDeleteAccountModal.tsx +13 -22
  135. package/src/components/account/ConfirmGlobalPreferencesModal.tsx +10 -12
  136. package/src/components/account/DeleteAccountModal.tsx +24 -34
  137. package/src/components/account/DisableTwoFactorAuthModal.tsx +6 -11
  138. package/src/components/account/IsntPossibleDeleteAccountModal.tsx +6 -8
  139. package/src/components/account/TwoFactorAuthModal.tsx +29 -33
  140. package/src/components/account/constants.ts +5 -8
  141. package/src/components/account/hooks/useChangeEmailForm.tsx +3 -5
  142. package/src/components/account/hooks/useChangePasswordForm.tsx +6 -20
  143. package/src/components/account/hooks/useChangePhoneForm.tsx +10 -16
  144. package/src/components/account/hooks/useDisableTwoFactorAuthForm.tsx +6 -20
  145. package/src/components/account/hooks/useOtpVerification.tsx +4 -16
  146. package/src/components/account/hooks/useTwoFactorAuthForm.tsx +7 -21
  147. package/src/components/account/sections/ChangeEmailModal.tsx +21 -35
  148. package/src/components/account/sections/ChangePasswordSection.tsx +6 -10
  149. package/src/components/account/sections/ChangePhoneModal.tsx +22 -50
  150. package/src/components/account/sections/MyProfileSection.tsx +23 -37
  151. package/src/components/account/sections/PreferencesSection.tsx +25 -52
  152. package/src/components/account/sections/SecuritySection.tsx +10 -19
  153. package/src/components/account/sections/TokenSection.tsx +10 -22
  154. package/src/components/layouts/AppMobileNavBar.tsx +154 -1
  155. package/src/components/layouts/NavBar.tsx +3 -5
  156. package/src/components/layouts/NotificationsPopover.tsx +3 -5
  157. package/src/components/layouts/ProfilePopover.tsx +4 -6
  158. package/src/components/layouts/UsersSelectorPopover.tsx +7 -9
  159. package/src/components/modals/BuyCreditsModal.tsx +16 -18
  160. package/src/components/modals/CreditsDisabledModal.tsx +6 -6
  161. package/src/components/modals/PaidPlanRequiredModal.tsx +3 -5
  162. package/src/components/modals/cards/AddCardModal.tsx +27 -29
  163. package/src/components/modals/cards/CannotDeleteCardModal.tsx +8 -9
  164. package/src/components/modals/cards/CardFormFields.tsx +22 -25
  165. package/src/components/modals/cards/DeleteCardModal.tsx +8 -10
  166. package/src/components/navigation/CancelledSubscriptionBanner.tsx +2 -4
  167. package/src/components/navigation/OverdueInvoiceBanner.tsx +2 -4
  168. package/src/components/navigation/PendingCancellationBanner.tsx +2 -4
  169. package/src/components/navigation/ProjectSelectorPopover.tsx +6 -8
  170. package/src/components/navigation/UpcomingInvoiceBanner.tsx +2 -4
  171. package/src/components/navigation/subcomponents/BottomLinks.tsx +3 -5
  172. package/src/components/navigation/subcomponents/CreditsCard.tsx +1 -3
  173. package/src/components/navigation/subcomponents/PlanCard.tsx +1 -3
  174. package/src/components/navigation/subcomponents/ProjectSelector.tsx +3 -5
  175. package/src/components/pages/NotFoundPage.tsx +3 -5
  176. package/src/components/pages/notifications/Notifications.tsx +10 -13
  177. package/src/components/ui/buttons/CopyButton.tsx +5 -10
  178. package/src/components/ui/data-display/CardItem.tsx +5 -7
  179. package/src/components/ui/data-display/PaymentInfoCard.tsx +8 -10
  180. package/src/components/ui/feedback/CircularProgress.tsx +0 -4
  181. package/src/components/ui/feedback/DefaultCircularProgress.tsx +1 -3
  182. package/src/components/ui/form/ComboboxField.tsx +6 -11
  183. package/src/components/ui/form/DatePicker.tsx +2 -5
  184. package/src/components/ui/form/DateRangePicker.tsx +2 -5
  185. package/src/components/ui/form/PhoneInput.tsx +3 -5
  186. package/src/components/ui/form/SelectField.tsx +3 -6
  187. package/src/components/widgets/ImageUpload/ImageCropModal.tsx +11 -19
  188. package/src/components/widgets/ImageUpload/ImageTooSmallModal.tsx +5 -6
  189. package/src/index.ts +2 -12
  190. package/src/modules/cards/hooks/handle-delete-card.hook.ts +3 -8
  191. package/src/modules/images/utils/validate-image.ts +8 -23
  192. package/src/modules/plans/types/plan.type.ts +0 -3
  193. package/src/modules/plans/utils/map-api-plan-to-ui.ts +46 -103
  194. package/src/modules/subscriptions/utils/periodicity.ts +12 -29
  195. package/src/providers/auth.provider.tsx +1 -13
  196. package/src/server.ts +0 -2
  197. package/src/utils/format/currency.ts +7 -62
  198. package/src/utils/intl/locales.ts +2 -3
  199. package/dist/i18n/config.mjs +0 -13
  200. package/dist/i18n/config.mjs.map +0 -1
  201. package/dist/i18n/country-language.mjs +0 -74
  202. package/dist/i18n/country-language.mjs.map +0 -1
  203. package/dist/i18n/messages/en-us.mjs +0 -492
  204. package/dist/i18n/messages/en-us.mjs.map +0 -1
  205. package/dist/i18n/messages/es-es.mjs +0 -492
  206. package/dist/i18n/messages/es-es.mjs.map +0 -1
  207. package/dist/i18n/messages/index.mjs +0 -16
  208. package/dist/i18n/messages/index.mjs.map +0 -1
  209. package/dist/i18n/messages/pt-br.mjs +0 -505
  210. package/dist/i18n/messages/pt-br.mjs.map +0 -1
  211. package/dist/i18n/normalize.mjs +0 -12
  212. package/dist/i18n/normalize.mjs.map +0 -1
  213. package/dist/i18n/resolve-locale.mjs +0 -42
  214. package/dist/i18n/resolve-locale.mjs.map +0 -1
  215. package/dist/i18n.mjs +0 -14
  216. package/dist/i18n.mjs.map +0 -1
  217. package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs +0 -20
  218. package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs.map +0 -1
  219. package/dist/utils/intl/cookie-domain.mjs +0 -17
  220. package/dist/utils/intl/cookie-domain.mjs.map +0 -1
  221. package/dist/utils/intl/locale-cookie.mjs +0 -13
  222. package/dist/utils/intl/locale-cookie.mjs.map +0 -1
  223. package/src/i18n/config.ts +0 -17
  224. package/src/i18n/country-language.ts +0 -60
  225. package/src/i18n/messages/en-us.ts +0 -512
  226. package/src/i18n/messages/es-es.ts +0 -513
  227. package/src/i18n/messages/index.ts +0 -24
  228. package/src/i18n/messages/pt-br.ts +0 -536
  229. package/src/i18n/normalize.ts +0 -15
  230. package/src/i18n/resolve-locale.ts +0 -77
  231. package/src/i18n.ts +0 -10
  232. package/src/modules/accounts/hooks/use-currency-formatter.hook.tsx +0 -32
  233. package/src/utils/intl/cookie-domain.ts +0 -29
  234. package/src/utils/intl/locale-cookie.ts +0 -18
@@ -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('');
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- import { useTranslations } from 'next-intl';
4
3
  import { IconChevronLeft, IconX, IconMail } from '@tabler/icons-react';
5
4
  import { Button } from '../../ui/buttons/Button';
6
5
  import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../../ui/overlay/Dialog';
@@ -21,7 +20,6 @@ interface ChangeEmailModalProps {
21
20
  }
22
21
 
23
22
  export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
24
- const translate = useTranslations();
25
23
  const { user } = useAuth();
26
24
  const invalidateUser = useInvalidateUser();
27
25
 
@@ -55,7 +53,7 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
55
53
  reset: resetOtp,
56
54
  } = useOtpVerification({
57
55
  onSuccess: handleSuccess,
58
- successMessage: translate('common.account.changeEmail.emailChanged'),
56
+ successMessage: 'E-mail alterado com sucesso',
59
57
  validateFn: async (token) => {
60
58
  const result = await confirmEmailChangeAction(token, emailToVerify);
61
59
  return result.success;
@@ -93,7 +91,7 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
93
91
  <IconChevronLeft size={20} className="text-gray-950" />
94
92
  </Button>
95
93
  <DialogTitle className="paragraph-medium-semibold text-gray-950 text-center flex-1">
96
- {translate('common.account.changeEmail.title')}
94
+ Alterar e-mail
97
95
  </DialogTitle>
98
96
  <Button variant="ghost" className="size-8! p-0" onClick={handleClose}>
99
97
  <IconX size={18} className="text-gray-500" />
@@ -102,11 +100,11 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
102
100
  ) : (
103
101
  <>
104
102
  <DialogHeader className="sr-only">
105
- <DialogTitle>{translate('common.account.changeEmail.title')}</DialogTitle>
103
+ <DialogTitle>Alterar e-mail</DialogTitle>
106
104
  </DialogHeader>
107
105
  <div className="flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0">
108
106
  <span className="paragraph-medium-semibold text-gray-950 text-center">
109
- {translate('common.account.changeEmail.title')}
107
+ Alterar e-mail
110
108
  </span>
111
109
  <Button
112
110
  variant="ghost"
@@ -135,16 +133,10 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
135
133
  </div>
136
134
 
137
135
  <div className="flex flex-col gap-1">
138
- <h3 className="paragraph-medium-semibold text-gray-950">
139
- {translate('common.account.otp.validationCode')}
140
- </h3>
136
+ <h3 className="paragraph-medium-semibold text-gray-950">Código de validação</h3>
141
137
  <p className="paragraph-small-regular text-gray-600">
142
- {translate.rich('common.account.changeEmail.sentCodeTo', {
143
- email: user?.email ?? '',
144
- b: (chunks) => (
145
- <span className="font-semibold text-gray-950 break-all">{chunks}</span>
146
- ),
147
- })}
138
+ Enviamos um código de validação para o E-mail{' '}
139
+ <span className="font-semibold text-gray-950 break-all">{user?.email}.</span>
148
140
  </p>
149
141
  </div>
150
142
 
@@ -161,9 +153,7 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
161
153
  </InputOTPGroup>
162
154
  </InputOTP>
163
155
  {hasError && (
164
- <p className="paragraph-small-regular text-red-500">
165
- {translate('common.account.otp.incorrectCode')}
166
- </p>
156
+ <p className="paragraph-small-regular text-red-500">Código incorreto</p>
167
157
  )}
168
158
  </div>
169
159
 
@@ -173,16 +163,14 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
173
163
  onClick={handleResend}
174
164
  className="paragraph-small-medium text-gray-950 underline cursor-pointer hover:text-gray-700 w-fit"
175
165
  >
176
- {translate('common.account.otp.resend')}
166
+ Reenviar código
177
167
  </button>
178
168
  ) : (
179
169
  <p className="paragraph-small-regular text-gray-500">
180
- {translate.rich('common.account.otp.resendIn', {
181
- time: formatTimer(timer),
182
- b: (chunks) => (
183
- <span className="paragraph-small-semibold text-gray-950">{chunks}</span>
184
- ),
185
- })}
170
+ Reenviar em{' '}
171
+ <span className="paragraph-small-semibold text-gray-950">
172
+ {formatTimer(timer)}
173
+ </span>
186
174
  </p>
187
175
  )}
188
176
  </div>
@@ -191,12 +179,10 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
191
179
 
192
180
  <div className="flex items-center justify-between px-4 lg:px-5 py-4 lg:py-5 mt-auto lg:mt-0">
193
181
  <Button variant="secondary" className="h-10!" type="button" onClick={handleClose}>
194
- {translate('common.actions.cancel')}
182
+ Cancelar
195
183
  </Button>
196
184
  <Button className="h-10!" type="submit" disabled={!isValidLength || isLoading}>
197
- {isLoading
198
- ? translate('common.account.otp.validating')
199
- : translate('common.account.changeEmail.confirm')}
185
+ {isLoading ? 'Validando...' : 'Alterar e-mail'}
200
186
  </Button>
201
187
  </div>
202
188
  </form>
@@ -205,16 +191,16 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
205
191
  <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">
206
192
  <div className="flex flex-col gap-1">
207
193
  <span className="paragraph-medium-semibold text-gray-950">
208
- {translate('common.account.changeEmail.updateTitle')}
194
+ Atualizar E-mail de contato
209
195
  </span>
210
196
  <span className="paragraph-small-regular text-gray-600">
211
- {translate('common.account.changeEmail.updateDescription')}
197
+ Informe o seu novo E-mail para manter seu contato atualizado.
212
198
  </span>
213
199
  </div>
214
200
 
215
201
  <FormField
216
- label={translate('common.account.changeEmail.newEmail')}
217
- placeholder={translate('common.account.changeEmail.newEmailPlaceholder')}
202
+ label="Novo e-mail"
203
+ placeholder="Digite seu novo e-mail"
218
204
  type="email"
219
205
  {...register('email')}
220
206
  error={!!errors.email}
@@ -225,10 +211,10 @@ export function ChangeEmailModal({ open, onClose }: ChangeEmailModalProps) {
225
211
 
226
212
  <div className="flex items-center justify-between p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0">
227
213
  <Button variant="secondary" className="h-10!" type="button" onClick={handleClose}>
228
- {translate('common.actions.cancel')}
214
+ Cancelar
229
215
  </Button>
230
216
  <Button className="h-10!" type="submit" disabled={isSubmitting}>
231
- {isSubmitting ? translate('common.actions.sending') : translate('common.actions.continue')}
217
+ {isSubmitting ? 'Enviando...' : 'Continuar'}
232
218
  </Button>
233
219
  </div>
234
220
  </form>
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
3
  import { IconLock, IconX } from '@tabler/icons-react';
4
- import { useTranslations } from 'next-intl';
5
4
  import { Button } from '../../ui/buttons/Button';
6
5
  import { FormField } from '../../ui/form/FormField';
7
6
  import useChangePasswordForm from '../hooks/useChangePasswordForm';
@@ -12,7 +11,6 @@ interface ChangePasswordSectionProps {
12
11
  }
13
12
 
14
13
  export function ChangePasswordSection({ onBack }: ChangePasswordSectionProps) {
15
- const translate = useTranslations();
16
14
  const { register, handleSubmit, errors } = useChangePasswordForm({
17
15
  onSuccess: onBack,
18
16
  });
@@ -25,9 +23,7 @@ export function ChangePasswordSection({ onBack }: ChangePasswordSectionProps) {
25
23
  className="flex-1 overflow-y-auto px-4 pb-5 lg:p-5 flex flex-col h-full lg:h-full gap-5 lg:gap-6"
26
24
  >
27
25
  <div className="flex items-center justify-between">
28
- <span className="paragraph-medium-semibold text-gray-950">
29
- {translate('common.account.changePassword.title')}
30
- </span>
26
+ <span className="paragraph-medium-semibold text-gray-950">Alterar senha</span>
31
27
  <Button type="button" variant="ghost" className="size-8! p-0" onClick={onBack}>
32
28
  <IconX size={18} />
33
29
  </Button>
@@ -35,9 +31,9 @@ export function ChangePasswordSection({ onBack }: ChangePasswordSectionProps) {
35
31
 
36
32
  <div className="flex flex-col gap-4">
37
33
  <FormField
38
- label={translate('common.account.changePassword.currentPassword')}
34
+ label="Senha atual"
39
35
  type="password"
40
- placeholder={translate('common.account.changePassword.currentPasswordPlaceholder')}
36
+ placeholder="Digite sua senha atual"
41
37
  leftIcon={IconLock}
42
38
  error={!!errors.currentPassword}
43
39
  errorMessage={errors.currentPassword?.message}
@@ -47,9 +43,9 @@ export function ChangePasswordSection({ onBack }: ChangePasswordSectionProps) {
47
43
  {...register('currentPassword')}
48
44
  />
49
45
  <FormField
50
- label={translate('common.account.changePassword.newPassword')}
46
+ label="Nova senha"
51
47
  type="password"
52
- placeholder={translate('common.account.changePassword.newPasswordPlaceholder')}
48
+ placeholder="Digite sua nova senha"
53
49
  leftIcon={IconLock}
54
50
  error={!!errors.newPassword}
55
51
  errorMessage={errors.newPassword?.message}
@@ -61,7 +57,7 @@ export function ChangePasswordSection({ onBack }: ChangePasswordSectionProps) {
61
57
  </div>
62
58
 
63
59
  <Button type="submit" className="w-fit h-10!">
64
- {translate('common.account.changePassword.submit')}
60
+ Salvar nova senha
65
61
  </Button>
66
62
  </form>
67
63
  );
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
 
3
- import { useTranslations } from 'next-intl';
4
3
  import { IconChevronLeft, IconX, IconMessage } from '@tabler/icons-react';
5
4
  import { Button } from '../../ui/buttons/Button';
6
5
  import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../../ui/overlay/Dialog';
@@ -21,7 +20,6 @@ interface ChangePhoneModalProps {
21
20
  }
22
21
 
23
22
  export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
24
- const translate = useTranslations();
25
23
  const { user } = useAuth();
26
24
  const invalidateUser = useInvalidateUser();
27
25
 
@@ -72,7 +70,7 @@ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
72
70
  reset: resetOtp,
73
71
  } = useOtpVerification({
74
72
  onSuccess: handleSuccess,
75
- successMessage: translate('common.account.changePhone.phoneChanged'),
73
+ successMessage: 'Telefone alterado',
76
74
  validateFn: async (token) => {
77
75
  const result = await confirmPhoneChangeAction(token, submittedPhone.local, submittedPhone.ddi);
78
76
  return result.success;
@@ -110,7 +108,7 @@ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
110
108
  <IconChevronLeft size={20} className="text-gray-950" />
111
109
  </Button>
112
110
  <DialogTitle className="paragraph-medium-semibold text-gray-950 text-center flex-1">
113
- {translate('common.account.changePhone.titleEdit')}
111
+ Alterar telefone
114
112
  </DialogTitle>
115
113
  <Button variant="ghost" className="size-8! p-0" onClick={handleClose}>
116
114
  <IconX size={18} className="text-gray-500" />
@@ -119,17 +117,11 @@ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
119
117
  ) : (
120
118
  <>
121
119
  <DialogHeader className="sr-only">
122
- <DialogTitle>
123
- {hasExistingPhone
124
- ? translate('common.account.changePhone.titleEdit')
125
- : translate('common.account.changePhone.titleAdd')}
126
- </DialogTitle>
120
+ <DialogTitle>{hasExistingPhone ? 'Alterar telefone' : 'Adicionar telefone'}</DialogTitle>
127
121
  </DialogHeader>
128
122
  <div className="flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0">
129
123
  <span className="paragraph-medium-semibold text-gray-950 text-center">
130
- {hasExistingPhone
131
- ? translate('common.account.changePhone.titleEdit')
132
- : translate('common.account.changePhone.titleAdd')}
124
+ {hasExistingPhone ? 'Alterar telefone' : 'Adicionar telefone'}
133
125
  </span>
134
126
  <Button
135
127
  variant="ghost"
@@ -158,14 +150,10 @@ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
158
150
  </div>
159
151
 
160
152
  <div className="flex flex-col gap-1">
161
- <h3 className="paragraph-medium-semibold text-gray-950">
162
- {translate('common.account.otp.validationCode')}
163
- </h3>
153
+ <h3 className="paragraph-medium-semibold text-gray-950">Código de validação</h3>
164
154
  <p className="paragraph-small-regular text-gray-600">
165
- {translate.rich('common.account.changePhone.sentCodeTo', {
166
- phone: currentPhoneDisplay,
167
- b: (chunks) => <span className="font-semibold text-gray-950">{chunks}</span>,
168
- })}
155
+ Enviamos um código de validação para o número atual{' '}
156
+ <span className="font-semibold text-gray-950">{currentPhoneDisplay}.</span>
169
157
  </p>
170
158
  </div>
171
159
 
@@ -182,9 +170,7 @@ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
182
170
  </InputOTPGroup>
183
171
  </InputOTP>
184
172
  {hasError && (
185
- <p className="paragraph-small-regular text-red-500">
186
- {translate('common.account.otp.incorrectCode')}
187
- </p>
173
+ <p className="paragraph-small-regular text-red-500">Código incorreto</p>
188
174
  )}
189
175
  </div>
190
176
 
@@ -194,16 +180,14 @@ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
194
180
  onClick={handleResend}
195
181
  className="paragraph-small-medium text-gray-950 underline cursor-pointer hover:text-gray-700 w-fit"
196
182
  >
197
- {translate('common.account.otp.resend')}
183
+ Reenviar código
198
184
  </button>
199
185
  ) : (
200
186
  <p className="paragraph-small-regular text-gray-500">
201
- {translate.rich('common.account.otp.resendIn', {
202
- time: formatTimer(timer),
203
- b: (chunks) => (
204
- <span className="paragraph-small-semibold text-gray-950">{chunks}</span>
205
- ),
206
- })}
187
+ Reenviar em{' '}
188
+ <span className="paragraph-small-semibold text-gray-950">
189
+ {formatTimer(timer)}
190
+ </span>
207
191
  </p>
208
192
  )}
209
193
  </div>
@@ -212,12 +196,10 @@ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
212
196
 
213
197
  <div className="flex items-center justify-between px-4 lg:px-5 py-4 lg:py-5 mt-auto lg:mt-0">
214
198
  <Button variant="secondary" className="h-10!" type="button" onClick={handleClose}>
215
- {translate('common.actions.cancel')}
199
+ Cancelar
216
200
  </Button>
217
201
  <Button className="h-10!" type="submit" disabled={!isValidLength || isLoading}>
218
- {isLoading
219
- ? translate('common.account.otp.validating')
220
- : translate('common.account.changePhone.confirm')}
202
+ {isLoading ? 'Validando...' : 'Alterar telefone'}
221
203
  </Button>
222
204
  </div>
223
205
  </form>
@@ -226,23 +208,17 @@ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
226
208
  <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">
227
209
  <div className="flex flex-col gap-1">
228
210
  <span className="paragraph-medium-semibold text-gray-950">
229
- {hasExistingPhone
230
- ? translate('common.account.changePhone.updateTitle')
231
- : translate('common.account.changePhone.addTitle')}
211
+ {hasExistingPhone ? 'Atualizar telefone de contato' : 'Adicionar telefone de contato'}
232
212
  </span>
233
213
  <span className="paragraph-small-regular text-gray-600">
234
214
  {hasExistingPhone
235
- ? translate('common.account.changePhone.updateDescription')
236
- : translate('common.account.changePhone.addDescription')}
215
+ ? 'Informe o novo número para manter seu contato atualizado.'
216
+ : 'Informe seu número de telefone para contato.'}
237
217
  </span>
238
218
  </div>
239
219
 
240
220
  <PhoneInput
241
- label={
242
- hasExistingPhone
243
- ? translate('common.account.changePhone.newNumber')
244
- : translate('common.account.changePhone.numberLabel')
245
- }
221
+ label={hasExistingPhone ? 'Novo número' : 'Número de telefone'}
246
222
  placeholder="(00) 0 0000-0000"
247
223
  value={phoneValue}
248
224
  onChange={handlePhoneChange}
@@ -253,16 +229,12 @@ export function ChangePhoneModal({ open, onClose }: ChangePhoneModalProps) {
253
229
 
254
230
  <div className="flex items-center justify-between p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0">
255
231
  <Button variant="secondary" className="h-10!" type="button" onClick={handleClose}>
256
- {translate('common.actions.cancel')}
232
+ Cancelar
257
233
  </Button>
258
234
  <Button className="h-10!" type="submit" disabled={isSubmitting}>
259
235
  {isSubmitting
260
- ? hasExistingPhone
261
- ? translate('common.actions.sending')
262
- : translate('common.actions.saving')
263
- : hasExistingPhone
264
- ? translate('common.actions.continue')
265
- : translate('common.actions.save')}
236
+ ? (hasExistingPhone ? 'Enviando...' : 'Salvando...')
237
+ : (hasExistingPhone ? 'Continuar' : 'Salvar')}
266
238
  </Button>
267
239
  </div>
268
240
  </form>