@greatapps/common 1.1.673 → 1.1.675
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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/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/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 +8 -15
- package/dist/modules/plans/utils/map-api-plan-to-ui.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/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/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/plans/types/plan.type.ts +0 -3
- package/src/modules/plans/utils/map-api-plan-to-ui.ts +7 -30
- 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 -450
- package/dist/i18n/messages/en-us.mjs.map +0 -1
- package/dist/i18n/messages/es-es.mjs +0 -450
- 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 -463
- 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 -468
- package/src/i18n/messages/es-es.ts +0 -469
- package/src/i18n/messages/index.ts +0 -24
- package/src/i18n/messages/pt-br.ts +0 -492
- 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 { 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>
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState, useRef } from 'react';
|
|
4
4
|
import Image from 'next/image';
|
|
5
|
-
import { useTranslations } from 'next-intl';
|
|
6
5
|
import { useForm } from 'react-hook-form';
|
|
7
6
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
8
7
|
import { toast } from 'sonner';
|
|
@@ -27,13 +26,6 @@ interface MyProfileSectionProps {
|
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
export function MyProfileSection({ onClose, storageUrl }: MyProfileSectionProps) {
|
|
30
|
-
const translate = useTranslations();
|
|
31
|
-
const genderOptions = GENDER_OPTIONS.map((option) => ({
|
|
32
|
-
...option,
|
|
33
|
-
label: translate(
|
|
34
|
-
`common.account.profile.genderOptions.${option.value === 'masculino' ? 'male' : 'female'}`,
|
|
35
|
-
),
|
|
36
|
-
}));
|
|
37
29
|
const { user } = useAuth();
|
|
38
30
|
const updateAccountUser = useUpdateAccountUser();
|
|
39
31
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
@@ -94,20 +86,16 @@ export function MyProfileSection({ onClose, storageUrl }: MyProfileSectionProps)
|
|
|
94
86
|
form.reset(data);
|
|
95
87
|
setSelectedPhoto(null);
|
|
96
88
|
setPhotoRemoved(false);
|
|
97
|
-
toast.custom((
|
|
98
|
-
<Toast
|
|
99
|
-
variant="success"
|
|
100
|
-
message={translate('common.account.profile.savedSuccess')}
|
|
101
|
-
toastId={toastId}
|
|
102
|
-
/>
|
|
89
|
+
toast.custom((t) => (
|
|
90
|
+
<Toast variant="success" message="Perfil atualizado com sucesso" toastId={t} />
|
|
103
91
|
));
|
|
104
92
|
onClose();
|
|
105
93
|
} catch (error) {
|
|
106
|
-
toast.custom((
|
|
94
|
+
toast.custom((t) => (
|
|
107
95
|
<Toast
|
|
108
96
|
variant="error"
|
|
109
|
-
message={error instanceof Error ? error.message :
|
|
110
|
-
toastId={
|
|
97
|
+
message={error instanceof Error ? error.message : 'Erro ao atualizar perfil'}
|
|
98
|
+
toastId={t}
|
|
111
99
|
/>
|
|
112
100
|
));
|
|
113
101
|
}
|
|
@@ -125,14 +113,14 @@ export function MyProfileSection({ onClose, storageUrl }: MyProfileSectionProps)
|
|
|
125
113
|
/>
|
|
126
114
|
<div className="absolute inset-0 overflow-y-auto overscroll-contain px-4 pb-20 lg:p-5 lg:static lg:flex-1 lg:min-h-0 lg:overscroll-auto flex flex-col gap-5 lg:gap-6">
|
|
127
115
|
<span className="paragraph-medium-semibold text-gray-950 hidden lg:block">
|
|
128
|
-
|
|
116
|
+
Meu perfil
|
|
129
117
|
</span>
|
|
130
118
|
<div className="flex flex-col gap-5">
|
|
131
119
|
<div className="flex items-center gap-4">
|
|
132
120
|
{avatarPreview ? (
|
|
133
121
|
<Image
|
|
134
122
|
src={avatarPreview}
|
|
135
|
-
alt=
|
|
123
|
+
alt="Foto do usuário"
|
|
136
124
|
width={48}
|
|
137
125
|
height={48}
|
|
138
126
|
className="size-12 rounded-full object-cover cursor-pointer"
|
|
@@ -154,7 +142,7 @@ export function MyProfileSection({ onClose, storageUrl }: MyProfileSectionProps)
|
|
|
154
142
|
type="button"
|
|
155
143
|
onClick={() => fileInputRef.current?.click()}
|
|
156
144
|
>
|
|
157
|
-
|
|
145
|
+
Alterar foto
|
|
158
146
|
</Button>
|
|
159
147
|
<Button
|
|
160
148
|
type="button"
|
|
@@ -172,7 +160,7 @@ export function MyProfileSection({ onClose, storageUrl }: MyProfileSectionProps)
|
|
|
172
160
|
type="button"
|
|
173
161
|
onClick={() => fileInputRef.current?.click()}
|
|
174
162
|
>
|
|
175
|
-
|
|
163
|
+
Alterar foto
|
|
176
164
|
</Button>
|
|
177
165
|
)}
|
|
178
166
|
</div>
|
|
@@ -181,31 +169,31 @@ export function MyProfileSection({ onClose, storageUrl }: MyProfileSectionProps)
|
|
|
181
169
|
<div className="flex flex-col gap-4">
|
|
182
170
|
<div className="flex gap-4">
|
|
183
171
|
<FormField
|
|
184
|
-
label=
|
|
185
|
-
placeholder=
|
|
172
|
+
label="Nome"
|
|
173
|
+
placeholder="Digite seu nome"
|
|
186
174
|
error={!!errors.name}
|
|
187
175
|
errorMessage={errors.name?.message}
|
|
188
176
|
{...register('name')}
|
|
189
177
|
/>
|
|
190
178
|
<FormField
|
|
191
|
-
label=
|
|
192
|
-
placeholder=
|
|
179
|
+
label="Sobrenome"
|
|
180
|
+
placeholder="Digite seu sobrenome"
|
|
193
181
|
error={!!errors.last_name}
|
|
194
182
|
errorMessage={errors.last_name?.message}
|
|
195
183
|
{...register('last_name')}
|
|
196
184
|
/>
|
|
197
185
|
</div>
|
|
198
186
|
<SelectField
|
|
199
|
-
label=
|
|
200
|
-
placeholder=
|
|
201
|
-
options={
|
|
187
|
+
label="Gênero"
|
|
188
|
+
placeholder="Selecione seu gênero"
|
|
189
|
+
options={GENDER_OPTIONS}
|
|
202
190
|
value={watch('gender')}
|
|
203
191
|
className="h-10!"
|
|
204
192
|
onChange={(value) => setValue('gender', value as string)}
|
|
205
193
|
/>
|
|
206
194
|
<div className="relative">
|
|
207
195
|
<PhoneInput
|
|
208
|
-
label=
|
|
196
|
+
label="Telefone"
|
|
209
197
|
value={user?.phone ?? ''}
|
|
210
198
|
disabled
|
|
211
199
|
classnameContainer="bg-gray-50 border-0!"
|
|
@@ -215,7 +203,7 @@ export function MyProfileSection({ onClose, storageUrl }: MyProfileSectionProps)
|
|
|
215
203
|
className="absolute right-3 top-5.5 h-10 flex items-center paragraph-xsmall-semibold text-gray-950 underline cursor-pointer"
|
|
216
204
|
onClick={() => setChangePhoneOpen(true)}
|
|
217
205
|
>
|
|
218
|
-
|
|
206
|
+
Alterar
|
|
219
207
|
</button>
|
|
220
208
|
</div>
|
|
221
209
|
</div>
|
|
@@ -223,13 +211,11 @@ export function MyProfileSection({ onClose, storageUrl }: MyProfileSectionProps)
|
|
|
223
211
|
<Separator />
|
|
224
212
|
|
|
225
213
|
<div className="flex flex-col gap-4">
|
|
226
|
-
<span className="paragraph-medium-semibold text-gray-600">
|
|
227
|
-
{translate('common.account.profile.accessData')}
|
|
228
|
-
</span>
|
|
214
|
+
<span className="paragraph-medium-semibold text-gray-600">Dados de acesso</span>
|
|
229
215
|
<div className="relative">
|
|
230
216
|
<div className='cursor-not-allowed'>
|
|
231
217
|
<FormField
|
|
232
|
-
label=
|
|
218
|
+
label="E-mail"
|
|
233
219
|
value={user?.email ?? ''}
|
|
234
220
|
disabled
|
|
235
221
|
classnameContainer="bg-gray-50 border-0!"
|
|
@@ -240,7 +226,7 @@ export function MyProfileSection({ onClose, storageUrl }: MyProfileSectionProps)
|
|
|
240
226
|
className="absolute right-3 top-5.5 h-10 flex items-center paragraph-xsmall-semibold text-gray-950 underline cursor-pointer"
|
|
241
227
|
onClick={() => setChangeEmailOpen(true)}
|
|
242
228
|
>
|
|
243
|
-
|
|
229
|
+
Alterar
|
|
244
230
|
</button>
|
|
245
231
|
</div>
|
|
246
232
|
</div>
|
|
@@ -261,10 +247,10 @@ export function MyProfileSection({ onClose, storageUrl }: MyProfileSectionProps)
|
|
|
261
247
|
onClose();
|
|
262
248
|
}}
|
|
263
249
|
>
|
|
264
|
-
|
|
250
|
+
Cancelar
|
|
265
251
|
</Button>
|
|
266
252
|
<Button className="h-10! cursor-pointer" type="submit" disabled={isSubmitting}>
|
|
267
|
-
{isSubmitting ?
|
|
253
|
+
{isSubmitting ? 'Salvando...' : 'Salvar alterações'}
|
|
268
254
|
</Button>
|
|
269
255
|
</div>
|
|
270
256
|
</form>
|