@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.
- 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/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/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,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useTranslations } from 'next-intl';
|
|
4
3
|
import { IconAlertTriangle } from '@tabler/icons-react';
|
|
5
4
|
import { toast } from 'sonner';
|
|
6
5
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';
|
|
@@ -16,7 +15,6 @@ import { useAuth } from '../../providers/auth.provider';
|
|
|
16
15
|
import { UserProfile } from '../../modules/users/schema';
|
|
17
16
|
|
|
18
17
|
export default function ConfirmDeleteAccountModal() {
|
|
19
|
-
const translate = useTranslations();
|
|
20
18
|
const { activeModal, deleteAccountPayload, openDeleteAccount, close } = useAccountModals();
|
|
21
19
|
const open = activeModal === 'confirmDelete';
|
|
22
20
|
|
|
@@ -35,7 +33,7 @@ export default function ConfirmDeleteAccountModal() {
|
|
|
35
33
|
if (!deleteAccountPayload) {
|
|
36
34
|
// Fluxo quebrado (usuário pulou o primeiro modal ou refresh) — manda
|
|
37
35
|
// de volta pro modal inicial pra re-coletar a senha.
|
|
38
|
-
openDeleteAccount(
|
|
36
|
+
openDeleteAccount('Sessão expirada. Preencha os campos novamente.');
|
|
39
37
|
return;
|
|
40
38
|
}
|
|
41
39
|
await deleteAccount.mutateAsync({ password: deleteAccountPayload.password });
|
|
@@ -43,25 +41,20 @@ export default function ConfirmDeleteAccountModal() {
|
|
|
43
41
|
await deleteAccountUser.mutateAsync(user!.id);
|
|
44
42
|
}
|
|
45
43
|
close();
|
|
46
|
-
toast.custom((
|
|
47
|
-
<Toast
|
|
48
|
-
variant="success"
|
|
49
|
-
message={translate('common.account.confirmDelete.success')}
|
|
50
|
-
toastId={toastId}
|
|
51
|
-
/>
|
|
44
|
+
toast.custom((t) => (
|
|
45
|
+
<Toast variant="success" message="Conta excluída com sucesso" toastId={t} />
|
|
52
46
|
));
|
|
53
47
|
await logout();
|
|
54
48
|
} catch (error) {
|
|
55
|
-
const message =
|
|
56
|
-
error instanceof Error ? error.message : translate('common.account.confirmDelete.error');
|
|
49
|
+
const message = error instanceof Error ? error.message : 'Erro ao excluir. Tente novamente.';
|
|
57
50
|
if (isOwner) {
|
|
58
51
|
// Falha no delete do owner (ex.: senha inválida) — volta pro primeiro
|
|
59
52
|
// modal com a mensagem do backend pra o usuário corrigir e tentar de novo.
|
|
60
53
|
openDeleteAccount(message);
|
|
61
54
|
return;
|
|
62
55
|
}
|
|
63
|
-
toast.custom((
|
|
64
|
-
<Toast variant="error" message={message} toastId={
|
|
56
|
+
toast.custom((t) => (
|
|
57
|
+
<Toast variant="error" message={message} toastId={t} />
|
|
65
58
|
));
|
|
66
59
|
}
|
|
67
60
|
};
|
|
@@ -72,17 +65,17 @@ export default function ConfirmDeleteAccountModal() {
|
|
|
72
65
|
<div className="flex flex-col gap-5 p-4 lg:p-5">
|
|
73
66
|
<DialogHeader className="p-0">
|
|
74
67
|
<DialogTitle className="paragraph-medium-semibold text-gray-950">
|
|
75
|
-
|
|
68
|
+
Uma pena te ver ir!
|
|
76
69
|
</DialogTitle>
|
|
77
70
|
</DialogHeader>
|
|
78
71
|
|
|
79
72
|
<div className="bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4">
|
|
80
73
|
<IconAlertTriangle size={20} className="text-red-500 shrink-0" strokeWidth={2} />
|
|
81
74
|
<p className="paragraph-small-regular text-gray-600">
|
|
82
|
-
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
Todas suas{' '}
|
|
76
|
+
<span className="font-semibold text-gray-950">{pagesCount} páginas</span>{' '}
|
|
77
|
+
serão deletadas permanentemente. Essa ação é{' '}
|
|
78
|
+
<span className="font-semibold text-gray-950">irreversível!</span>
|
|
86
79
|
</p>
|
|
87
80
|
</div>
|
|
88
81
|
</div>
|
|
@@ -91,7 +84,7 @@ export default function ConfirmDeleteAccountModal() {
|
|
|
91
84
|
|
|
92
85
|
<div className="flex items-center gap-2 p-4 lg:p-5">
|
|
93
86
|
<Button className="h-10 flex-1" onClick={close} disabled={isDeleting}>
|
|
94
|
-
|
|
87
|
+
Manter minha conta
|
|
95
88
|
</Button>
|
|
96
89
|
<Button
|
|
97
90
|
variant="secondary"
|
|
@@ -99,9 +92,7 @@ export default function ConfirmDeleteAccountModal() {
|
|
|
99
92
|
onClick={handleConfirm}
|
|
100
93
|
disabled={isDeleting}
|
|
101
94
|
>
|
|
102
|
-
{isDeleting
|
|
103
|
-
? translate('common.account.confirmDelete.deleting')
|
|
104
|
-
: translate('common.account.confirmDelete.deleteAnyway')}
|
|
95
|
+
{isDeleting ? 'Excluindo...' : 'Excluir mesmo assim'}
|
|
105
96
|
</Button>
|
|
106
97
|
</div>
|
|
107
98
|
</DialogContent>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useTranslations } from 'next-intl';
|
|
4
3
|
import { IconAlertTriangle } from '@tabler/icons-react';
|
|
5
4
|
import { Button } from '../ui/buttons/Button';
|
|
6
5
|
import {
|
|
@@ -23,14 +22,13 @@ export default function ConfirmGlobalPreferencesModal({
|
|
|
23
22
|
onConfirm,
|
|
24
23
|
onCancel,
|
|
25
24
|
}: ConfirmGlobalPreferencesModalProps) {
|
|
26
|
-
const translate = useTranslations();
|
|
27
25
|
return (
|
|
28
26
|
<Dialog open={open} onOpenChange={onCancel}>
|
|
29
27
|
<DialogContent className="flex flex-col p-0 gap-0 md:w-[386px]! lg:w-[386px]! max-w-[386px]! max-[386px]:w-[calc(100%-32px)]">
|
|
30
28
|
<DialogHeader className="sr-only">
|
|
31
|
-
<DialogTitle>
|
|
29
|
+
<DialogTitle>Alterar preferências globais</DialogTitle>
|
|
32
30
|
<DialogDescription>
|
|
33
|
-
|
|
31
|
+
Confirmação de alteração de preferências globais da conta
|
|
34
32
|
</DialogDescription>
|
|
35
33
|
</DialogHeader>
|
|
36
34
|
|
|
@@ -40,14 +38,14 @@ export default function ConfirmGlobalPreferencesModal({
|
|
|
40
38
|
</div>
|
|
41
39
|
<div className="flex flex-col gap-2">
|
|
42
40
|
<span className="paragraph-medium-semibold text-gray-950">
|
|
43
|
-
|
|
41
|
+
Alterar preferências globais
|
|
44
42
|
</span>
|
|
45
43
|
<span className="paragraph-small-regular text-gray-600">
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
Você está alterando configurações que impactam{' '}
|
|
45
|
+
<span className="paragraph-small-semibold text-gray-950">
|
|
46
|
+
todos os usuários da conta
|
|
47
|
+
</span>
|
|
48
|
+
. Deseja confirmar?
|
|
51
49
|
</span>
|
|
52
50
|
</div>
|
|
53
51
|
</div>
|
|
@@ -56,10 +54,10 @@ export default function ConfirmGlobalPreferencesModal({
|
|
|
56
54
|
|
|
57
55
|
<div className="flex items-center gap-2 p-5">
|
|
58
56
|
<Button onClick={onConfirm} className="h-10!">
|
|
59
|
-
|
|
57
|
+
Confirmar
|
|
60
58
|
</Button>
|
|
61
59
|
<Button variant="secondary" onClick={onCancel} className="h-10!">
|
|
62
|
-
|
|
60
|
+
Cancelar
|
|
63
61
|
</Button>
|
|
64
62
|
</div>
|
|
65
63
|
</DialogContent>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useState, useCallback, useEffect } from 'react';
|
|
4
|
-
import { useTranslations } from 'next-intl';
|
|
5
4
|
import { IconLock, IconAlertTriangle } from '@tabler/icons-react';
|
|
6
5
|
import { toast } from 'sonner';
|
|
7
6
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';
|
|
@@ -14,16 +13,16 @@ import usePasswordVisibility from '../../hooks/usePasswordVisibility';
|
|
|
14
13
|
import { useAccountModals } from '../../store/useAccountModals';
|
|
15
14
|
import { AccountSectionType } from '../../enums/AccountSectionType';
|
|
16
15
|
|
|
16
|
+
const REASON_OPTIONS = [
|
|
17
|
+
{ value: 'sem-funcao', label: 'A ferramenta não possui uma função que eu preciso' },
|
|
18
|
+
{ value: 'problemas', label: 'Encontrei problemas técnicos ou erros no sistema' },
|
|
19
|
+
{ value: 'suporte', label: 'Tive problemas com o suporte ou atendimento' },
|
|
20
|
+
{ value: 'demora', label: 'As atualizações demoram mais do que o esperado' },
|
|
21
|
+
{ value: 'temporario', label: 'O cancelamento é temporário' },
|
|
22
|
+
{ value: 'outro', label: 'Outro motivo' },
|
|
23
|
+
];
|
|
24
|
+
|
|
17
25
|
export default function DeleteAccountModal() {
|
|
18
|
-
const translate = useTranslations();
|
|
19
|
-
const reasonOptions = [
|
|
20
|
-
{ value: 'sem-funcao', label: translate('common.account.deleteAccount.reasons.noFeature') },
|
|
21
|
-
{ value: 'problemas', label: translate('common.account.deleteAccount.reasons.technical') },
|
|
22
|
-
{ value: 'suporte', label: translate('common.account.deleteAccount.reasons.support') },
|
|
23
|
-
{ value: 'demora', label: translate('common.account.deleteAccount.reasons.updates') },
|
|
24
|
-
{ value: 'temporario', label: translate('common.account.deleteAccount.reasons.temporary') },
|
|
25
|
-
{ value: 'outro', label: translate('common.account.deleteAccount.reasons.other') },
|
|
26
|
-
];
|
|
27
26
|
const {
|
|
28
27
|
activeModal,
|
|
29
28
|
deleteAccountError,
|
|
@@ -62,12 +61,8 @@ export default function DeleteAccountModal() {
|
|
|
62
61
|
const handleDelete = (e: React.FormEvent) => {
|
|
63
62
|
e.preventDefault();
|
|
64
63
|
if (!isFormValid) {
|
|
65
|
-
toast.custom((
|
|
66
|
-
<Toast
|
|
67
|
-
variant="error"
|
|
68
|
-
message={translate('common.account.deleteAccount.requiredFields')}
|
|
69
|
-
toastId={toastId}
|
|
70
|
-
/>
|
|
64
|
+
toast.custom((t) => (
|
|
65
|
+
<Toast variant="error" message="Preencha todos os campos obrigatórios" toastId={t} />
|
|
71
66
|
));
|
|
72
67
|
return;
|
|
73
68
|
}
|
|
@@ -85,21 +80,18 @@ export default function DeleteAccountModal() {
|
|
|
85
80
|
<div className="flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5 mb-5">
|
|
86
81
|
<IconAlertTriangle size={20} className="text-red-500" />
|
|
87
82
|
</div>
|
|
88
|
-
<DialogTitle>
|
|
83
|
+
<DialogTitle>Excluir conta</DialogTitle>
|
|
89
84
|
<DialogDescription className="paragraph-small-regular">
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<span className="font-semibold text-gray-950">{chunks}</span>
|
|
93
|
-
),
|
|
94
|
-
})}
|
|
85
|
+
Esta ação é <span className="font-semibold text-gray-950">irreversível</span>. Ao
|
|
86
|
+
confirmar, sua conta e todos os seus dados serão excluídos.
|
|
95
87
|
</DialogDescription>
|
|
96
88
|
</DialogHeader>
|
|
97
89
|
|
|
98
90
|
<SelectField
|
|
99
|
-
label=
|
|
91
|
+
label="Motivo do cancelamento"
|
|
100
92
|
required
|
|
101
|
-
placeholder=
|
|
102
|
-
options={
|
|
93
|
+
placeholder="Selecione"
|
|
94
|
+
options={REASON_OPTIONS}
|
|
103
95
|
value={reason}
|
|
104
96
|
onChange={(value) => setReason(value as string)}
|
|
105
97
|
className="h-10!"
|
|
@@ -107,26 +99,24 @@ export default function DeleteAccountModal() {
|
|
|
107
99
|
|
|
108
100
|
<div>
|
|
109
101
|
<TextAreaField
|
|
110
|
-
label=
|
|
102
|
+
label="Descreva o que levou a tomar essa decisão"
|
|
111
103
|
required
|
|
112
|
-
placeholder=
|
|
104
|
+
placeholder="Explique sua decisão..."
|
|
113
105
|
value={description}
|
|
114
106
|
onChange={(e) => setDescription(e.target.value)}
|
|
115
107
|
rows={4}
|
|
116
108
|
maxLength={400}
|
|
117
109
|
/>
|
|
118
110
|
<span className="paragraph-xsmall-medium text-gray-600 text-left mt-1 block">
|
|
119
|
-
{
|
|
120
|
-
count: String(description.length),
|
|
121
|
-
})}
|
|
111
|
+
{description.length}/400 caracteres
|
|
122
112
|
</span>
|
|
123
113
|
</div>
|
|
124
114
|
|
|
125
115
|
<FormField
|
|
126
116
|
className="text-gray-600"
|
|
127
|
-
label=
|
|
117
|
+
label="Senha"
|
|
128
118
|
type="password"
|
|
129
|
-
placeholder=
|
|
119
|
+
placeholder="Informe sua senha"
|
|
130
120
|
leftIcon={IconLock}
|
|
131
121
|
value={password}
|
|
132
122
|
onChange={(e) => {
|
|
@@ -147,10 +137,10 @@ export default function DeleteAccountModal() {
|
|
|
147
137
|
className="h-10"
|
|
148
138
|
type="submit"
|
|
149
139
|
>
|
|
150
|
-
|
|
140
|
+
Excluir conta
|
|
151
141
|
</Button>
|
|
152
142
|
<Button variant="secondary" className="h-10" type="button" onClick={handleClose}>
|
|
153
|
-
|
|
143
|
+
Fechar
|
|
154
144
|
</Button>
|
|
155
145
|
</div>
|
|
156
146
|
</form>
|
|
@@ -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
|
-
|
|
46
|
+
Desabilitar autenticação 2FA
|
|
49
47
|
</DialogTitle>
|
|
50
48
|
<DialogDescription className="paragraph-small-regular text-gray-600">
|
|
51
|
-
|
|
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
|
-
|
|
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
|
-
|
|
22
|
+
Não é possível excluir a conta
|
|
25
23
|
</DialogTitle>
|
|
26
24
|
<DialogDescription className="paragraph-small-regular text-gray-600">
|
|
27
|
-
{
|
|
28
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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>
|
|
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
|
-
|
|
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
|
-
|
|
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>
|
|
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>
|
|
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
|
-
|
|
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
|
-
|
|
100
|
+
Cancelar
|
|
100
101
|
</Button>
|
|
101
102
|
<Button className="h-10!" type="button" onClick={handleFinalize}>
|
|
102
|
-
|
|
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>
|
|
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
|
-
|
|
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
|
-
{
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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=
|
|
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
|
-
|
|
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
|
-
|
|
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>
|
|
@@ -18,12 +18,9 @@ export const TIME_FORMAT_OPTIONS = [
|
|
|
18
18
|
{ value: '12h', label: '12 horas (AM/PM)', displayValue: '12 horas (AM/PM)' },
|
|
19
19
|
];
|
|
20
20
|
|
|
21
|
-
// Catalog keys — consumers call translate(type) to get the localized label.
|
|
22
|
-
// pt-br values: 'Atualizações de projetos' | 'Alertas de segurança' |
|
|
23
|
-
// 'Mudanças no plano ou faturamento' | 'Manutenções programadas'
|
|
24
21
|
export const NOTIFICATION_TYPES = [
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
]
|
|
22
|
+
'Atualizações de projetos',
|
|
23
|
+
'Alertas de segurança',
|
|
24
|
+
'Mudanças no plano ou faturamento',
|
|
25
|
+
'Manutenções programadas',
|
|
26
|
+
];
|
|
@@ -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((
|
|
24
|
+
toast.custom((t) => (
|
|
27
25
|
<Toast
|
|
28
26
|
variant="error"
|
|
29
|
-
message={result.error ??
|
|
30
|
-
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((
|
|
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((
|
|
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((
|
|
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
|
});
|