@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
|
@@ -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>
|
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import { useForm } from 'react-hook-form';
|
|
5
|
-
import { useTranslations, useLocale } from 'next-intl';
|
|
6
|
-
import { useRouter } from 'next/navigation';
|
|
7
5
|
import { toast } from 'sonner';
|
|
8
6
|
import { IconLock } from '@tabler/icons-react';
|
|
9
7
|
import { cn } from '../../../infra/utils/clsx';
|
|
10
|
-
import type { Locale } from '../../../i18n/config';
|
|
11
|
-
import { setLocaleCookie } from '../../../utils/intl/locale-cookie';
|
|
12
8
|
import { Button } from '../../ui/buttons/Button';
|
|
13
9
|
import { Separator } from '../../ui/data-display/Separator';
|
|
14
10
|
import { Toast } from '../../ui/feedback/Toast';
|
|
@@ -17,7 +13,6 @@ import { ComboboxField } from '../../ui/form/ComboboxField';
|
|
|
17
13
|
import { SelectField } from '../../ui/form/SelectField';
|
|
18
14
|
import ConfirmGlobalPreferencesModal from '../ConfirmGlobalPreferencesModal';
|
|
19
15
|
import { useAuth } from '../../../providers/auth.provider';
|
|
20
|
-
import { useWhitelabel } from '../../../providers/whitelabel.provider';
|
|
21
16
|
import { UserProfile } from '../../../modules/users/schema';
|
|
22
17
|
import type { UpdateAccountRequest } from '../../../modules/accounts/types';
|
|
23
18
|
import {
|
|
@@ -46,27 +41,9 @@ interface PreferencesSectionProps {
|
|
|
46
41
|
}
|
|
47
42
|
|
|
48
43
|
export function PreferencesSection({ onClose }: PreferencesSectionProps) {
|
|
49
|
-
// Padrão raiz: um único `translate` chamado pela chave inteira (`common.<modulo>.<chave>`).
|
|
50
|
-
const translate = useTranslations();
|
|
51
|
-
// Exceção: chave dinâmica (option.value) numa lista → namespace escopado.
|
|
52
|
-
const translateLanguage = useTranslations('common.languages');
|
|
53
|
-
const currentLocale = useLocale();
|
|
54
|
-
const router = useRouter();
|
|
55
44
|
const { data: timezones = [] } = useTimezones();
|
|
56
45
|
const { data: currencies = [] } = useCurrencies();
|
|
57
46
|
const { user, account } = useAuth();
|
|
58
|
-
const { whitelabel } = useWhitelabel();
|
|
59
|
-
const languageOptions = LANGUAGE_OPTIONS.map((option) => ({
|
|
60
|
-
...option,
|
|
61
|
-
label: translateLanguage(option.value as Locale),
|
|
62
|
-
displayValue: translateLanguage(option.value as Locale),
|
|
63
|
-
}));
|
|
64
|
-
const timeFormatOptions = TIME_FORMAT_OPTIONS.map((option) => ({
|
|
65
|
-
...option,
|
|
66
|
-
label: translate(
|
|
67
|
-
`common.preferences.timeFormatOptions.${option.value === '24h' ? 'h24' : 'h12'}`,
|
|
68
|
-
),
|
|
69
|
-
}));
|
|
70
47
|
const isOwner = user?.profile === UserProfile.owner;
|
|
71
48
|
const canEditPreferences = isOwner || user?.profile === UserProfile.admin;
|
|
72
49
|
const updateAccountUser = useUpdateAccountUser();
|
|
@@ -97,7 +74,7 @@ export function PreferencesSection({ onClose }: PreferencesSectionProps) {
|
|
|
97
74
|
companyName: account.name ?? '',
|
|
98
75
|
language: LANGUAGE_OPTIONS.find(
|
|
99
76
|
(o) => o.apiValue === user.language?.toLowerCase()
|
|
100
|
-
)?.value ?? 'pt-
|
|
77
|
+
)?.value ?? 'pt-BR',
|
|
101
78
|
currency: account.currency,
|
|
102
79
|
timezone: account.timezone,
|
|
103
80
|
timeFormat: '24h',
|
|
@@ -121,20 +98,16 @@ export function PreferencesSection({ onClose }: PreferencesSectionProps) {
|
|
|
121
98
|
}
|
|
122
99
|
|
|
123
100
|
reset(data);
|
|
124
|
-
toast.custom((
|
|
125
|
-
<Toast variant="success" message=
|
|
101
|
+
toast.custom((t) => (
|
|
102
|
+
<Toast variant="success" message="Preferências salvas com sucesso" toastId={t} />
|
|
126
103
|
));
|
|
127
104
|
onClose();
|
|
128
|
-
if (data.language !== currentLocale) {
|
|
129
|
-
setLocaleCookie(data.language, whitelabel?.domain);
|
|
130
|
-
router.refresh();
|
|
131
|
-
}
|
|
132
105
|
} catch (error) {
|
|
133
|
-
toast.custom((
|
|
106
|
+
toast.custom((t) => (
|
|
134
107
|
<Toast
|
|
135
108
|
variant="error"
|
|
136
|
-
message={error instanceof Error ? error.message :
|
|
137
|
-
toastId={
|
|
109
|
+
message={error instanceof Error ? error.message : 'Erro ao salvar preferências'}
|
|
110
|
+
toastId={t}
|
|
138
111
|
/>
|
|
139
112
|
));
|
|
140
113
|
} finally {
|
|
@@ -175,12 +148,12 @@ export function PreferencesSection({ onClose }: PreferencesSectionProps) {
|
|
|
175
148
|
<>
|
|
176
149
|
<form onSubmit={handleSubmit(onSubmit)} className="flex flex-col h-full">
|
|
177
150
|
<div className="overflow-y-auto overscroll-contain px-4 pb-4 lg:p-5 flex flex-col gap-5 lg:gap-6 flex-1">
|
|
178
|
-
<span className="paragraph-medium-semibold text-gray-950">
|
|
151
|
+
<span className="paragraph-medium-semibold text-gray-950">Preferências</span>
|
|
179
152
|
<div className="flex flex-col gap-8">
|
|
180
153
|
<div className="flex flex-col lg:flex-row items-center gap-3">
|
|
181
154
|
<FormField
|
|
182
|
-
label=
|
|
183
|
-
placeholder=
|
|
155
|
+
label="Nome da empresa"
|
|
156
|
+
placeholder="Digite o nome da empresa"
|
|
184
157
|
classnameContainer={cn('w-full', !isOwner && 'cursor-not-allowed opacity-50')}
|
|
185
158
|
value={watch('companyName')}
|
|
186
159
|
onChange={(e) => setValue('companyName', e.target.value, { shouldDirty: true })}
|
|
@@ -190,18 +163,18 @@ export function PreferencesSection({ onClose }: PreferencesSectionProps) {
|
|
|
190
163
|
|
|
191
164
|
<div className="flex flex-col lg:flex-row items-center gap-3">
|
|
192
165
|
<ComboboxField
|
|
193
|
-
label=
|
|
194
|
-
placeholder=
|
|
195
|
-
searchPlaceholder=
|
|
166
|
+
label="Idioma"
|
|
167
|
+
placeholder="Selecione o idioma"
|
|
168
|
+
searchPlaceholder="Buscar idioma..."
|
|
196
169
|
containerClassName="w-full"
|
|
197
|
-
options={
|
|
170
|
+
options={LANGUAGE_OPTIONS}
|
|
198
171
|
value={watch('language')}
|
|
199
172
|
onChange={(value) => setValue('language', value, { shouldDirty: true })}
|
|
200
173
|
/>
|
|
201
174
|
<ComboboxField
|
|
202
|
-
label=
|
|
203
|
-
placeholder=
|
|
204
|
-
searchPlaceholder=
|
|
175
|
+
label="Moeda"
|
|
176
|
+
placeholder="Selecione a moeda"
|
|
177
|
+
searchPlaceholder="Buscar moeda..."
|
|
205
178
|
containerClassName="w-full"
|
|
206
179
|
options={currencies}
|
|
207
180
|
value={watch('currency')}
|
|
@@ -214,12 +187,12 @@ export function PreferencesSection({ onClose }: PreferencesSectionProps) {
|
|
|
214
187
|
<Separator />
|
|
215
188
|
|
|
216
189
|
<div className="flex flex-col gap-4">
|
|
217
|
-
<span className="paragraph-medium-semibold text-gray-950">
|
|
190
|
+
<span className="paragraph-medium-semibold text-gray-950">Exibição hora</span>
|
|
218
191
|
<div className="flex flex-col lg:flex-row items-center gap-3">
|
|
219
192
|
<ComboboxField
|
|
220
|
-
label=
|
|
221
|
-
placeholder=
|
|
222
|
-
searchPlaceholder=
|
|
193
|
+
label="Fuso horário"
|
|
194
|
+
placeholder="Selecione o fuso horário"
|
|
195
|
+
searchPlaceholder="Buscar fuso horário..."
|
|
223
196
|
containerClassName="w-full"
|
|
224
197
|
options={timezones}
|
|
225
198
|
value={watch('timezone')}
|
|
@@ -228,11 +201,11 @@ export function PreferencesSection({ onClose }: PreferencesSectionProps) {
|
|
|
228
201
|
disabled={!canEditPreferences}
|
|
229
202
|
/>
|
|
230
203
|
<SelectField
|
|
231
|
-
label=
|
|
232
|
-
placeholder=
|
|
204
|
+
label="Formato hora"
|
|
205
|
+
placeholder="Selecione o formato"
|
|
233
206
|
className="h-10!"
|
|
234
207
|
containerClassName="w-full"
|
|
235
|
-
options={
|
|
208
|
+
options={TIME_FORMAT_OPTIONS}
|
|
236
209
|
value={watch('timeFormat')}
|
|
237
210
|
onChange={(value) =>
|
|
238
211
|
setValue('timeFormat', value as string, { shouldDirty: true })
|
|
@@ -257,10 +230,10 @@ export function PreferencesSection({ onClose }: PreferencesSectionProps) {
|
|
|
257
230
|
onClose();
|
|
258
231
|
}}
|
|
259
232
|
>
|
|
260
|
-
|
|
233
|
+
Cancelar
|
|
261
234
|
</Button>
|
|
262
235
|
<Button className="h-10!" type="submit" disabled={isSaving}>
|
|
263
|
-
{isSaving ?
|
|
236
|
+
{isSaving ? 'Salvando...' : 'Salvar alterações'}
|
|
264
237
|
</Button>
|
|
265
238
|
</div>
|
|
266
239
|
</form>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { IconAlertTriangle, IconBrandGoogleFilled } from '@tabler/icons-react';
|
|
4
|
-
import { useTranslations } from 'next-intl';
|
|
5
4
|
import { toast } from 'sonner';
|
|
6
5
|
import { useQueryClient } from '@tanstack/react-query';
|
|
7
6
|
import { useAuth } from '../../../providers/auth.provider';
|
|
@@ -19,7 +18,6 @@ interface SecuritySectionProps {
|
|
|
19
18
|
export function SecuritySection({
|
|
20
19
|
onDeleteAccount,
|
|
21
20
|
}: SecuritySectionProps) {
|
|
22
|
-
const translate = useTranslations();
|
|
23
21
|
const { user } = useAuth();
|
|
24
22
|
const queryClient = useQueryClient();
|
|
25
23
|
const { mutateAsync: unlinkGoogle, isPending: isUnlinking } = useUnlinkGoogle();
|
|
@@ -34,16 +32,14 @@ export function SecuritySection({
|
|
|
34
32
|
queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
|
|
35
33
|
} catch (error) {
|
|
36
34
|
const message =
|
|
37
|
-
error instanceof Error ? error.message :
|
|
38
|
-
toast.custom((
|
|
35
|
+
error instanceof Error ? error.message : 'Erro ao desvincular conta Google.';
|
|
36
|
+
toast.custom((t) => <Toast variant="error" message={message} toastId={t} />);
|
|
39
37
|
}
|
|
40
38
|
};
|
|
41
39
|
|
|
42
40
|
return (
|
|
43
41
|
<div className="h-full overflow-y-auto overscroll-contain px-4 pb-20 lg:p-5 lg:pt-5 flex flex-col gap-5 lg:gap-6 lg:pb-31 lg:overscroll-auto">
|
|
44
|
-
<span className="paragraph-medium-semibold text-gray-950 hidden lg:block">
|
|
45
|
-
{translate('common.account.security.title')}
|
|
46
|
-
</span>
|
|
42
|
+
<span className="paragraph-medium-semibold text-gray-950 hidden lg:block">Segurança</span>
|
|
47
43
|
|
|
48
44
|
{hasGoogleLinked && (
|
|
49
45
|
<div className="flex flex-col items-center lg:items-start gap-4">
|
|
@@ -52,11 +48,10 @@ export function SecuritySection({
|
|
|
52
48
|
</div>
|
|
53
49
|
|
|
54
50
|
<div className="flex flex-col gap-2">
|
|
55
|
-
<span className="paragraph-medium-semibold text-gray-950">
|
|
56
|
-
{translate('common.account.security.googleLinkedTitle')}
|
|
57
|
-
</span>
|
|
51
|
+
<span className="paragraph-medium-semibold text-gray-950">Conta Google vinculada</span>
|
|
58
52
|
<span className="paragraph-small-regular text-gray-600">
|
|
59
|
-
|
|
53
|
+
Sua conta está vinculada ao Google. Se desvincular, use "Esqueci minha senha" para
|
|
54
|
+
redefinir uma senha de acesso por e-mail.
|
|
60
55
|
</span>
|
|
61
56
|
</div>
|
|
62
57
|
|
|
@@ -66,9 +61,7 @@ export function SecuritySection({
|
|
|
66
61
|
className="paragraph-small-semibold text-zinc-700 bg-zinc-100 rounded-lg px-3 py-2 cursor-pointer hover:bg-zinc-200 transition-colors w-fit disabled:opacity-50 disabled:cursor-not-allowed"
|
|
67
62
|
onClick={handleUnlinkGoogle}
|
|
68
63
|
>
|
|
69
|
-
{isUnlinking
|
|
70
|
-
? translate('common.account.security.unlinking')
|
|
71
|
-
: translate('common.account.security.unlinkGoogle')}
|
|
64
|
+
{isUnlinking ? 'Desvinculando...' : 'Desvincular Google'}
|
|
72
65
|
</button>
|
|
73
66
|
</div>
|
|
74
67
|
)}
|
|
@@ -79,11 +72,9 @@ export function SecuritySection({
|
|
|
79
72
|
</div>
|
|
80
73
|
|
|
81
74
|
<div className="flex flex-col gap-2">
|
|
82
|
-
<span className="paragraph-medium-semibold text-gray-950">
|
|
83
|
-
{translate('common.account.deleteAccount.title')}
|
|
84
|
-
</span>
|
|
75
|
+
<span className="paragraph-medium-semibold text-gray-950">Excluir conta</span>
|
|
85
76
|
<span className="paragraph-small-regular text-gray-600">
|
|
86
|
-
|
|
77
|
+
Esta ação é permanente e não pode ser desfeita. Todos os seus dados, projetos e configurações serão removidos definitivamente.
|
|
87
78
|
</span>
|
|
88
79
|
</div>
|
|
89
80
|
|
|
@@ -93,7 +84,7 @@ export function SecuritySection({
|
|
|
93
84
|
className="paragraph-small-semibold text-red-600 bg-red-50 rounded-lg px-3 py-2 cursor-pointer hover:bg-red-100 transition-colors w-fit"
|
|
94
85
|
onClick={onDeleteAccount}
|
|
95
86
|
>
|
|
96
|
-
|
|
87
|
+
Excluir minha conta
|
|
97
88
|
</button>
|
|
98
89
|
)}
|
|
99
90
|
</div>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { IconCheck, IconCopy, IconInfoCircle } from '@tabler/icons-react';
|
|
4
|
-
import { useTranslations } from 'next-intl';
|
|
5
4
|
import { toast } from 'sonner';
|
|
6
5
|
import { Toast } from '../../ui/feedback/Toast';
|
|
7
6
|
import { Button } from '../../ui/buttons/Button';
|
|
@@ -11,42 +10,31 @@ import { useAccountToken } from '../../../modules/accounts/hooks/use-account-tok
|
|
|
11
10
|
import { useIsDefaultWhitelabel } from '../../../providers/whitelabel.provider';
|
|
12
11
|
|
|
13
12
|
export function TokenSection() {
|
|
14
|
-
const translate = useTranslations();
|
|
15
13
|
const { data: token = '', isLoading } = useAccountToken();
|
|
16
14
|
const isDefaultWl = useIsDefaultWhitelabel();
|
|
17
15
|
|
|
18
16
|
const { isCopied, copy } = useCopyToClipboard({
|
|
19
17
|
onSuccess: () => {
|
|
20
|
-
toast.custom((
|
|
21
|
-
<Toast
|
|
22
|
-
variant="success"
|
|
23
|
-
message={translate('common.account.token.copySuccess')}
|
|
24
|
-
toastId={toastId}
|
|
25
|
-
/>
|
|
18
|
+
toast.custom((t) => (
|
|
19
|
+
<Toast variant="success" message="Token copiado com sucesso" toastId={t} />
|
|
26
20
|
));
|
|
27
21
|
},
|
|
28
22
|
onError: () => {
|
|
29
|
-
toast.custom((
|
|
30
|
-
<Toast
|
|
31
|
-
variant="error"
|
|
32
|
-
message={translate('common.account.token.copyError')}
|
|
33
|
-
toastId={toastId}
|
|
34
|
-
/>
|
|
23
|
+
toast.custom((t) => (
|
|
24
|
+
<Toast variant="error" message="Não foi possível copiar o token" toastId={t} />
|
|
35
25
|
));
|
|
36
26
|
},
|
|
37
27
|
});
|
|
38
28
|
|
|
39
29
|
return (
|
|
40
30
|
<div className="h-full overflow-y-auto overscroll-contain px-4 pb-20 lg:p-5 lg:pt-5 flex flex-col gap-5 lg:gap-6 lg:pb-31 lg:overscroll-auto">
|
|
41
|
-
<span className="paragraph-medium-semibold text-gray-950">
|
|
42
|
-
{translate('common.account.token.title')}
|
|
43
|
-
</span>
|
|
31
|
+
<span className="paragraph-medium-semibold text-gray-950">Token da conta</span>
|
|
44
32
|
|
|
45
33
|
<div className="flex flex-col gap-3">
|
|
46
34
|
<div className="flex items-end gap-3">
|
|
47
35
|
<FormField
|
|
48
|
-
label=
|
|
49
|
-
value={isLoading ?
|
|
36
|
+
label="Token"
|
|
37
|
+
value={isLoading ? 'Carregando...' : token}
|
|
50
38
|
disabled
|
|
51
39
|
readOnly
|
|
52
40
|
classnameContainer="bg-gray-50 cursor-default opacity-100!"
|
|
@@ -60,14 +48,14 @@ export function TokenSection() {
|
|
|
60
48
|
disabled={isLoading || !token}
|
|
61
49
|
>
|
|
62
50
|
{isCopied ? <IconCheck size={16} /> : <IconCopy size={16} />}
|
|
63
|
-
{isCopied ?
|
|
51
|
+
{isCopied ? 'Copiado' : 'Copiar'}
|
|
64
52
|
</Button>
|
|
65
53
|
</div>
|
|
66
54
|
|
|
67
55
|
<div className={`flex items-center gap-3 p-4 rounded-lg ${isDefaultWl ? 'bg-cyan-50' : 'bg-zinc-50'}`}>
|
|
68
56
|
<IconInfoCircle className="size-4 text-zinc-950 shrink-0" />
|
|
69
57
|
<span className="paragraph-small-regular text-zinc-950 max-w-[420px]">
|
|
70
|
-
|
|
58
|
+
Este token é exclusivo da sua conta e permite acesso à API. Não compartilhe com terceiros.
|
|
71
59
|
</span>
|
|
72
60
|
</div>
|
|
73
61
|
|
|
@@ -77,7 +65,7 @@ export function TokenSection() {
|
|
|
77
65
|
rel="noopener noreferrer"
|
|
78
66
|
className="paragraph-small-medium text-gray-500 underline hover:text-gray-700 transition-colors w-fit"
|
|
79
67
|
>
|
|
80
|
-
|
|
68
|
+
Acessar a documentação
|
|
81
69
|
</a>
|
|
82
70
|
</div>
|
|
83
71
|
</div>
|