@greatapps/common 1.1.674 → 1.1.676
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.
- package/dist/components/account/ConfigurationsMyAccountModal.mjs +6 -8
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
- package/dist/components/account/ConfirmDeleteAccountModal.mjs +19 -20
- package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +11 -10
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -1
- package/dist/components/account/DeleteAccountModal.mjs +28 -34
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/DisableTwoFactorAuthModal.mjs +5 -7
- package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +9 -8
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/TwoFactorAuthModal.mjs +23 -22
- package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -1
- package/dist/components/account/constants.mjs +4 -4
- package/dist/components/account/constants.mjs.map +1 -1
- package/dist/components/account/hooks/useChangeEmailForm.mjs +3 -5
- package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -1
- package/dist/components/account/hooks/useChangePasswordForm.mjs +3 -26
- package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -1
- package/dist/components/account/hooks/useChangePhoneForm.mjs +9 -18
- package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -1
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +3 -26
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -1
- package/dist/components/account/hooks/useOtpVerification.mjs +3 -19
- package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -1
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +4 -27
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -1
- package/dist/components/account/sections/ChangeEmailModal.mjs +28 -25
- package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -1
- package/dist/components/account/sections/ChangePasswordSection.mjs +6 -8
- package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
- package/dist/components/account/sections/ChangePhoneModal.mjs +27 -24
- package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -1
- package/dist/components/account/sections/MyProfileSection.mjs +22 -37
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
- package/dist/components/account/sections/PreferencesSection.mjs +24 -48
- package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
- package/dist/components/account/sections/SecuritySection.mjs +9 -11
- package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
- package/dist/components/account/sections/TokenSection.mjs +8 -24
- package/dist/components/account/sections/TokenSection.mjs.map +1 -1
- package/dist/components/layouts/AppMobileNavBar.mjs +148 -2
- package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -1
- package/dist/components/layouts/NavBar.mjs +3 -5
- package/dist/components/layouts/NavBar.mjs.map +1 -1
- package/dist/components/layouts/NotificationsPopover.mjs +3 -5
- package/dist/components/layouts/NotificationsPopover.mjs.map +1 -1
- package/dist/components/layouts/ProfilePopover.mjs +4 -6
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/layouts/UsersSelectorPopover.mjs +7 -9
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
- package/dist/components/modals/BuyCreditsModal.mjs +18 -17
- package/dist/components/modals/BuyCreditsModal.mjs.map +1 -1
- package/dist/components/modals/CreditsDisabledModal.mjs +4 -6
- package/dist/components/modals/CreditsDisabledModal.mjs.map +1 -1
- package/dist/components/modals/PaidPlanRequiredModal.mjs +3 -5
- package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
- package/dist/components/modals/cards/AddCardModal.mjs +24 -27
- package/dist/components/modals/cards/AddCardModal.mjs.map +1 -1
- package/dist/components/modals/cards/CannotDeleteCardModal.mjs +7 -9
- package/dist/components/modals/cards/CannotDeleteCardModal.mjs.map +1 -1
- package/dist/components/modals/cards/CardFormFields.mjs +22 -25
- package/dist/components/modals/cards/CardFormFields.mjs.map +1 -1
- package/dist/components/modals/cards/DeleteCardModal.mjs +8 -10
- package/dist/components/modals/cards/DeleteCardModal.mjs.map +1 -1
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs +2 -4
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
- package/dist/components/navigation/OverdueInvoiceBanner.mjs +2 -4
- package/dist/components/navigation/OverdueInvoiceBanner.mjs.map +1 -1
- package/dist/components/navigation/PendingCancellationBanner.mjs +6 -4
- package/dist/components/navigation/PendingCancellationBanner.mjs.map +1 -1
- package/dist/components/navigation/ProjectSelectorPopover.mjs +6 -8
- package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -1
- package/dist/components/navigation/UpcomingInvoiceBanner.mjs +6 -4
- package/dist/components/navigation/UpcomingInvoiceBanner.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/BottomLinks.mjs +3 -5
- package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/CreditsCard.mjs +1 -3
- package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/PlanCard.mjs +1 -3
- package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs +3 -5
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
- package/dist/components/pages/NotFoundPage.mjs +3 -5
- package/dist/components/pages/NotFoundPage.mjs.map +1 -1
- package/dist/components/pages/notifications/Notifications.mjs +10 -13
- package/dist/components/pages/notifications/Notifications.mjs.map +1 -1
- package/dist/components/ui/buttons/CopyButton.mjs +5 -9
- package/dist/components/ui/buttons/CopyButton.mjs.map +1 -1
- package/dist/components/ui/data-display/CardItem.mjs +5 -7
- package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
- package/dist/components/ui/data-display/PaymentInfoCard.mjs +8 -10
- package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -1
- package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs +1 -3
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -1
- package/dist/components/ui/form/ComboboxField.mjs +6 -11
- package/dist/components/ui/form/ComboboxField.mjs.map +1 -1
- package/dist/components/ui/form/DatePicker.mjs +2 -5
- package/dist/components/ui/form/DatePicker.mjs.map +1 -1
- package/dist/components/ui/form/DateRangePicker.mjs +2 -5
- package/dist/components/ui/form/DateRangePicker.mjs.map +1 -1
- package/dist/components/ui/form/PhoneInput.mjs +3 -5
- package/dist/components/ui/form/PhoneInput.mjs.map +1 -1
- package/dist/components/ui/form/SelectField.mjs +3 -6
- package/dist/components/ui/form/SelectField.mjs.map +1 -1
- package/dist/components/widgets/ImageUpload/ImageCropModal.mjs +18 -11
- package/dist/components/widgets/ImageUpload/ImageCropModal.mjs.map +1 -1
- package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs +15 -6
- package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs.map +1 -1
- package/dist/index.mjs +2 -16
- package/dist/index.mjs.map +1 -1
- package/dist/modules/cards/hooks/handle-delete-card.hook.mjs +1 -2
- package/dist/modules/cards/hooks/handle-delete-card.hook.mjs.map +1 -1
- package/dist/modules/images/utils/validate-image.mjs +8 -8
- package/dist/modules/images/utils/validate-image.mjs.map +1 -1
- package/dist/modules/plans/services/plans.service.mjs +1 -1
- package/dist/modules/plans/services/plans.service.mjs.map +1 -1
- package/dist/modules/plans/types/plan.type.mjs +0 -3
- package/dist/modules/plans/types/plan.type.mjs.map +1 -1
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs +34 -56
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/periodicity.mjs +14 -20
- package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
- package/dist/providers/auth.provider.mjs +1 -9
- package/dist/providers/auth.provider.mjs.map +1 -1
- package/dist/server.mjs +0 -2
- package/dist/server.mjs.map +1 -1
- package/dist/utils/format/currency.mjs +4 -32
- package/dist/utils/format/currency.mjs.map +1 -1
- package/dist/utils/intl/locales.mjs +2 -3
- package/dist/utils/intl/locales.mjs.map +1 -1
- package/package.json +1 -7
- package/src/components/account/ConfigurationsMyAccountModal.tsx +6 -10
- package/src/components/account/ConfirmDeleteAccountModal.tsx +13 -22
- package/src/components/account/ConfirmGlobalPreferencesModal.tsx +10 -12
- package/src/components/account/DeleteAccountModal.tsx +24 -34
- package/src/components/account/DisableTwoFactorAuthModal.tsx +6 -11
- package/src/components/account/IsntPossibleDeleteAccountModal.tsx +6 -8
- package/src/components/account/TwoFactorAuthModal.tsx +29 -33
- package/src/components/account/constants.ts +5 -8
- package/src/components/account/hooks/useChangeEmailForm.tsx +3 -5
- package/src/components/account/hooks/useChangePasswordForm.tsx +6 -20
- package/src/components/account/hooks/useChangePhoneForm.tsx +10 -16
- package/src/components/account/hooks/useDisableTwoFactorAuthForm.tsx +6 -20
- package/src/components/account/hooks/useOtpVerification.tsx +4 -16
- package/src/components/account/hooks/useTwoFactorAuthForm.tsx +7 -21
- package/src/components/account/sections/ChangeEmailModal.tsx +21 -35
- package/src/components/account/sections/ChangePasswordSection.tsx +6 -10
- package/src/components/account/sections/ChangePhoneModal.tsx +22 -50
- package/src/components/account/sections/MyProfileSection.tsx +23 -37
- package/src/components/account/sections/PreferencesSection.tsx +25 -52
- package/src/components/account/sections/SecuritySection.tsx +10 -19
- package/src/components/account/sections/TokenSection.tsx +10 -22
- package/src/components/layouts/AppMobileNavBar.tsx +154 -1
- package/src/components/layouts/NavBar.tsx +3 -5
- package/src/components/layouts/NotificationsPopover.tsx +3 -5
- package/src/components/layouts/ProfilePopover.tsx +4 -6
- package/src/components/layouts/UsersSelectorPopover.tsx +7 -9
- package/src/components/modals/BuyCreditsModal.tsx +16 -18
- package/src/components/modals/CreditsDisabledModal.tsx +6 -6
- package/src/components/modals/PaidPlanRequiredModal.tsx +3 -5
- package/src/components/modals/cards/AddCardModal.tsx +27 -29
- package/src/components/modals/cards/CannotDeleteCardModal.tsx +8 -9
- package/src/components/modals/cards/CardFormFields.tsx +22 -25
- package/src/components/modals/cards/DeleteCardModal.tsx +8 -10
- package/src/components/navigation/CancelledSubscriptionBanner.tsx +2 -4
- package/src/components/navigation/OverdueInvoiceBanner.tsx +2 -4
- package/src/components/navigation/PendingCancellationBanner.tsx +2 -4
- package/src/components/navigation/ProjectSelectorPopover.tsx +6 -8
- package/src/components/navigation/UpcomingInvoiceBanner.tsx +2 -4
- package/src/components/navigation/subcomponents/BottomLinks.tsx +3 -5
- package/src/components/navigation/subcomponents/CreditsCard.tsx +1 -3
- package/src/components/navigation/subcomponents/PlanCard.tsx +1 -3
- package/src/components/navigation/subcomponents/ProjectSelector.tsx +3 -5
- package/src/components/pages/NotFoundPage.tsx +3 -5
- package/src/components/pages/notifications/Notifications.tsx +10 -13
- package/src/components/ui/buttons/CopyButton.tsx +5 -10
- package/src/components/ui/data-display/CardItem.tsx +5 -7
- package/src/components/ui/data-display/PaymentInfoCard.tsx +8 -10
- package/src/components/ui/feedback/CircularProgress.tsx +0 -4
- package/src/components/ui/feedback/DefaultCircularProgress.tsx +1 -3
- package/src/components/ui/form/ComboboxField.tsx +6 -11
- package/src/components/ui/form/DatePicker.tsx +2 -5
- package/src/components/ui/form/DateRangePicker.tsx +2 -5
- package/src/components/ui/form/PhoneInput.tsx +3 -5
- package/src/components/ui/form/SelectField.tsx +3 -6
- package/src/components/widgets/ImageUpload/ImageCropModal.tsx +11 -19
- package/src/components/widgets/ImageUpload/ImageTooSmallModal.tsx +5 -6
- package/src/index.ts +2 -12
- package/src/modules/cards/hooks/handle-delete-card.hook.ts +3 -8
- package/src/modules/images/utils/validate-image.ts +8 -23
- package/src/modules/plans/services/plans.service.ts +1 -1
- package/src/modules/plans/types/plan.type.ts +0 -3
- package/src/modules/plans/utils/map-api-plan-to-ui.ts +46 -103
- package/src/modules/subscriptions/utils/periodicity.ts +12 -29
- package/src/providers/auth.provider.tsx +1 -13
- package/src/server.ts +0 -2
- package/src/utils/format/currency.ts +7 -62
- package/src/utils/intl/locales.ts +2 -3
- package/dist/i18n/config.mjs +0 -13
- package/dist/i18n/config.mjs.map +0 -1
- package/dist/i18n/country-language.mjs +0 -74
- package/dist/i18n/country-language.mjs.map +0 -1
- package/dist/i18n/messages/en-us.mjs +0 -492
- package/dist/i18n/messages/en-us.mjs.map +0 -1
- package/dist/i18n/messages/es-es.mjs +0 -492
- package/dist/i18n/messages/es-es.mjs.map +0 -1
- package/dist/i18n/messages/index.mjs +0 -16
- package/dist/i18n/messages/index.mjs.map +0 -1
- package/dist/i18n/messages/pt-br.mjs +0 -505
- package/dist/i18n/messages/pt-br.mjs.map +0 -1
- package/dist/i18n/normalize.mjs +0 -12
- package/dist/i18n/normalize.mjs.map +0 -1
- package/dist/i18n/resolve-locale.mjs +0 -42
- package/dist/i18n/resolve-locale.mjs.map +0 -1
- package/dist/i18n.mjs +0 -14
- package/dist/i18n.mjs.map +0 -1
- package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs +0 -20
- package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs.map +0 -1
- package/dist/utils/intl/cookie-domain.mjs +0 -17
- package/dist/utils/intl/cookie-domain.mjs.map +0 -1
- package/dist/utils/intl/locale-cookie.mjs +0 -13
- package/dist/utils/intl/locale-cookie.mjs.map +0 -1
- package/src/i18n/config.ts +0 -17
- package/src/i18n/country-language.ts +0 -60
- package/src/i18n/messages/en-us.ts +0 -512
- package/src/i18n/messages/es-es.ts +0 -513
- package/src/i18n/messages/index.ts +0 -24
- package/src/i18n/messages/pt-br.ts +0 -536
- package/src/i18n/normalize.ts +0 -15
- package/src/i18n/resolve-locale.ts +0 -77
- package/src/i18n.ts +0 -10
- package/src/modules/accounts/hooks/use-currency-formatter.hook.tsx +0 -32
- package/src/utils/intl/cookie-domain.ts +0 -29
- 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(
|
|
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((
|
|
48
|
+
toast.custom((t) => (
|
|
51
49
|
<Toast
|
|
52
50
|
variant="error"
|
|
53
|
-
message={result.error ??
|
|
54
|
-
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((
|
|
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((
|
|
68
|
+
toast.custom((t) => (
|
|
75
69
|
<Toast
|
|
76
70
|
variant="error"
|
|
77
|
-
message={result.error ??
|
|
78
|
-
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
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
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
|
|
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((
|
|
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((
|
|
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((
|
|
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
|
|
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:
|
|
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
|
-
|
|
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>
|
|
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
|
-
|
|
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
|
-
{
|
|
143
|
-
|
|
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
|
-
|
|
166
|
+
Reenviar código
|
|
177
167
|
</button>
|
|
178
168
|
) : (
|
|
179
169
|
<p className="paragraph-small-regular text-gray-500">
|
|
180
|
-
{
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
-
|
|
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
|
-
|
|
194
|
+
Atualizar E-mail de contato
|
|
209
195
|
</span>
|
|
210
196
|
<span className="paragraph-small-regular text-gray-600">
|
|
211
|
-
|
|
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=
|
|
217
|
-
placeholder=
|
|
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
|
-
|
|
214
|
+
Cancelar
|
|
229
215
|
</Button>
|
|
230
216
|
<Button className="h-10!" type="submit" disabled={isSubmitting}>
|
|
231
|
-
{isSubmitting ?
|
|
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=
|
|
34
|
+
label="Senha atual"
|
|
39
35
|
type="password"
|
|
40
|
-
placeholder=
|
|
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=
|
|
46
|
+
label="Nova senha"
|
|
51
47
|
type="password"
|
|
52
|
-
placeholder=
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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
|
-
{
|
|
166
|
-
|
|
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
|
-
|
|
183
|
+
Reenviar código
|
|
198
184
|
</button>
|
|
199
185
|
) : (
|
|
200
186
|
<p className="paragraph-small-regular text-gray-500">
|
|
201
|
-
{
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
|
|
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
|
-
?
|
|
236
|
-
:
|
|
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
|
-
|
|
232
|
+
Cancelar
|
|
257
233
|
</Button>
|
|
258
234
|
<Button className="h-10!" type="submit" disabled={isSubmitting}>
|
|
259
235
|
{isSubmitting
|
|
260
|
-
? hasExistingPhone
|
|
261
|
-
|
|
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>
|