@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,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
|
-
import { useTranslations } from "next-intl";
|
|
5
4
|
import { IconPlus, IconUser, IconUsers } from '@tabler/icons-react';
|
|
6
5
|
import { UserAvatar } from "../ui/data-display/UserAvatar";
|
|
7
6
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/overlay/Popover";
|
|
@@ -47,7 +46,6 @@ export function UsersSelectorPopover({
|
|
|
47
46
|
align,
|
|
48
47
|
contentClassName,
|
|
49
48
|
}: UsersSelectorPopoverProps) {
|
|
50
|
-
const translate = useTranslations();
|
|
51
49
|
const { accountsUrl } = useWhitelabelUrls();
|
|
52
50
|
const [open, setOpen] = useState(false);
|
|
53
51
|
const [hoveredId, setHoveredId] = useState<number | null>(null);
|
|
@@ -110,7 +108,7 @@ export function UsersSelectorPopover({
|
|
|
110
108
|
>
|
|
111
109
|
<div className="flex flex-col p-3 gap-2">
|
|
112
110
|
<div className="flex items-center justify-between">
|
|
113
|
-
<span className="paragraph-small-semibold">
|
|
111
|
+
<span className="paragraph-small-semibold">Usuários</span>
|
|
114
112
|
<div className="flex items-center gap-1.5">
|
|
115
113
|
<Button
|
|
116
114
|
variant="secondary"
|
|
@@ -120,14 +118,14 @@ export function UsersSelectorPopover({
|
|
|
120
118
|
}}
|
|
121
119
|
>
|
|
122
120
|
<IconPlus size={16} />
|
|
123
|
-
|
|
121
|
+
Adicionar
|
|
124
122
|
</Button>
|
|
125
123
|
</div>
|
|
126
124
|
</div>
|
|
127
125
|
|
|
128
126
|
<Command shouldFilter={false} className="gap-2" value="">
|
|
129
127
|
<CommandInput
|
|
130
|
-
placeholder=
|
|
128
|
+
placeholder="Busque aqui"
|
|
131
129
|
value={searchInput}
|
|
132
130
|
onValueChange={setSearchInput}
|
|
133
131
|
/>
|
|
@@ -145,12 +143,12 @@ export function UsersSelectorPopover({
|
|
|
145
143
|
<div className="flex flex-col items-center justify-center gap-2 h-full text-gray-400 py-4">
|
|
146
144
|
<IconUsers size={28} className="text-gray-300" />
|
|
147
145
|
<span className="paragraph-small-medium text-center text-gray-500">
|
|
148
|
-
|
|
146
|
+
Nenhum usuário encontrado.
|
|
149
147
|
</span>
|
|
150
148
|
</div>
|
|
151
149
|
) : (
|
|
152
150
|
<>
|
|
153
|
-
<CommandEmpty>
|
|
151
|
+
<CommandEmpty>Nenhum resultado encontrado.</CommandEmpty>
|
|
154
152
|
{allUsers.map((user) => {
|
|
155
153
|
const inProject = user.in_project ?? false;
|
|
156
154
|
const removable =
|
|
@@ -202,7 +200,7 @@ export function UsersSelectorPopover({
|
|
|
202
200
|
</div>
|
|
203
201
|
</TooltipTrigger>
|
|
204
202
|
<TooltipContent className="z-[1002]">
|
|
205
|
-
{inProject ?
|
|
203
|
+
{inProject ? "Remover do projeto" : "Adicionar ao projeto"}
|
|
206
204
|
</TooltipContent>
|
|
207
205
|
</Tooltip>
|
|
208
206
|
</div>
|
|
@@ -227,7 +225,7 @@ export function UsersSelectorPopover({
|
|
|
227
225
|
window.location.href = `${accountsUrl}/my-teams`;
|
|
228
226
|
}}
|
|
229
227
|
>
|
|
230
|
-
|
|
228
|
+
Gerenciar equipe
|
|
231
229
|
</Button>
|
|
232
230
|
</div>
|
|
233
231
|
</PopoverContent>
|
|
@@ -26,7 +26,6 @@ import { useUpdateSubscriptionPlan } from '../../modules/subscriptions/hooks/upd
|
|
|
26
26
|
import { getPriceFromCalculatedData } from '../../modules/subscriptions/utils/periodicity';
|
|
27
27
|
import { useIsDefaultWhitelabel, useExternalContracting } from '../../providers/whitelabel.provider';
|
|
28
28
|
import { IconInfoCircle, IconX, IconLoader2, IconSparkles } from '@tabler/icons-react';
|
|
29
|
-
import { useTranslations } from 'next-intl';
|
|
30
29
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
31
30
|
import { useForm } from 'react-hook-form';
|
|
32
31
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
@@ -43,7 +42,6 @@ const buyCreditSchema = z.object({
|
|
|
43
42
|
type BuyCreditFormData = z.infer<typeof buyCreditSchema>;
|
|
44
43
|
|
|
45
44
|
export default function BuyCreditsModal() {
|
|
46
|
-
const translate = useTranslations();
|
|
47
45
|
const { open, closeModal } = useBuyCreditsModal();
|
|
48
46
|
const { openModal } = useModalManager();
|
|
49
47
|
const isDefaultWl = useIsDefaultWhitelabel();
|
|
@@ -188,12 +186,12 @@ export default function BuyCreditsModal() {
|
|
|
188
186
|
label: (
|
|
189
187
|
<div className="flex items-center justify-between gap-2 w-full">
|
|
190
188
|
<span className="paragraph-small-medium text-zinc-950 flex-1">
|
|
191
|
-
{
|
|
189
|
+
{opt.credits.toLocaleString('pt-BR')} créditos de IA
|
|
192
190
|
</span>
|
|
193
191
|
<span className="paragraph-small-medium text-zinc-500 opacity-70">{opt.priceLabel}</span>
|
|
194
192
|
</div>
|
|
195
193
|
),
|
|
196
|
-
displayValue:
|
|
194
|
+
displayValue: `${opt.credits.toLocaleString('pt-BR')} créditos de IA`,
|
|
197
195
|
}));
|
|
198
196
|
}, []);
|
|
199
197
|
|
|
@@ -219,7 +217,7 @@ export default function BuyCreditsModal() {
|
|
|
219
217
|
toast.custom((t) => (
|
|
220
218
|
<Toast
|
|
221
219
|
variant="success"
|
|
222
|
-
message={
|
|
220
|
+
message={`Créditos de IA alterados para ${data.creditOption.toLocaleString('pt-BR')}`}
|
|
223
221
|
toastId={t}
|
|
224
222
|
/>
|
|
225
223
|
));
|
|
@@ -236,7 +234,7 @@ export default function BuyCreditsModal() {
|
|
|
236
234
|
if (totalPrice !== null) {
|
|
237
235
|
return (
|
|
238
236
|
<span className="paragraph-xlarge-semibold text-zinc-950">
|
|
239
|
-
{totalPrice === 0 ?
|
|
237
|
+
{totalPrice === 0 ? 'Padrão' : formatPrice(totalPrice)}
|
|
240
238
|
</span>
|
|
241
239
|
);
|
|
242
240
|
}
|
|
@@ -253,10 +251,10 @@ export default function BuyCreditsModal() {
|
|
|
253
251
|
</div>
|
|
254
252
|
<div className="flex flex-col gap-2">
|
|
255
253
|
<DialogTitle className="paragraph-medium-semibold text-zinc-950">
|
|
256
|
-
|
|
254
|
+
Créditos de IA
|
|
257
255
|
</DialogTitle>
|
|
258
256
|
<span className="paragraph-small-regular text-zinc-600">
|
|
259
|
-
|
|
257
|
+
Para adquirir créditos de IA, acesse sua área de assinatura.
|
|
260
258
|
</span>
|
|
261
259
|
</div>
|
|
262
260
|
</DialogHeader>
|
|
@@ -268,7 +266,7 @@ export default function BuyCreditsModal() {
|
|
|
268
266
|
redirectToExternal('contracting');
|
|
269
267
|
}}
|
|
270
268
|
>
|
|
271
|
-
|
|
269
|
+
Acessar área de assinatura
|
|
272
270
|
</Button>
|
|
273
271
|
</div>
|
|
274
272
|
</DialogContent>
|
|
@@ -284,7 +282,7 @@ export default function BuyCreditsModal() {
|
|
|
284
282
|
>
|
|
285
283
|
<DialogHeader className="px-4 py-3 border-b border-zinc-200 shrink-0 relative">
|
|
286
284
|
<DialogTitle className="paragraph-medium-semibold text-zinc-950 text-center">
|
|
287
|
-
|
|
285
|
+
Comprar créditos de IA
|
|
288
286
|
</DialogTitle>
|
|
289
287
|
<button
|
|
290
288
|
type="button"
|
|
@@ -321,8 +319,8 @@ export default function BuyCreditsModal() {
|
|
|
321
319
|
<IconInfoCircle className="size-4 text-zinc-950 shrink-0" />
|
|
322
320
|
<span className="paragraph-small-regular text-zinc-950">
|
|
323
321
|
{isIncreasingCredits
|
|
324
|
-
?
|
|
325
|
-
:
|
|
322
|
+
? 'O pagamento será processado no momento da confirmação.'
|
|
323
|
+
: 'As alterações entrarão em vigor a partir da sua próxima fatura.'}
|
|
326
324
|
</span>
|
|
327
325
|
</div>
|
|
328
326
|
)}
|
|
@@ -333,7 +331,7 @@ export default function BuyCreditsModal() {
|
|
|
333
331
|
<div className="hidden lg:flex flex-col gap-2">
|
|
334
332
|
{immediateChargeTotal !== null && immediateChargeTotal > 0 && (
|
|
335
333
|
<div className="flex items-center justify-between">
|
|
336
|
-
<span className="paragraph-xsmall-medium text-zinc-500">
|
|
334
|
+
<span className="paragraph-xsmall-medium text-zinc-500">Cobrança imediata</span>
|
|
337
335
|
{isCalculatePending ? (
|
|
338
336
|
<Skeleton className="h-5 w-20" />
|
|
339
337
|
) : (
|
|
@@ -344,7 +342,7 @@ export default function BuyCreditsModal() {
|
|
|
344
342
|
</div>
|
|
345
343
|
)}
|
|
346
344
|
<div className="flex items-center justify-between">
|
|
347
|
-
<span className="paragraph-small-medium text-zinc-500">
|
|
345
|
+
<span className="paragraph-small-medium text-zinc-500">Valor total do plano</span>
|
|
348
346
|
{renderPriceDisplay()}
|
|
349
347
|
</div>
|
|
350
348
|
</div>
|
|
@@ -355,7 +353,7 @@ export default function BuyCreditsModal() {
|
|
|
355
353
|
className="w-full hidden lg:inline-flex"
|
|
356
354
|
>
|
|
357
355
|
{isSubmitting && <IconLoader2 className="size-4 animate-spin" />}
|
|
358
|
-
|
|
356
|
+
Confirmar e pagar
|
|
359
357
|
</Button>
|
|
360
358
|
</div>
|
|
361
359
|
|
|
@@ -363,7 +361,7 @@ export default function BuyCreditsModal() {
|
|
|
363
361
|
<div className="flex flex-col gap-2">
|
|
364
362
|
{immediateChargeTotal !== null && immediateChargeTotal > 0 && (
|
|
365
363
|
<div className="flex items-center justify-between">
|
|
366
|
-
<span className="paragraph-xsmall-medium text-zinc-500">
|
|
364
|
+
<span className="paragraph-xsmall-medium text-zinc-500">Cobrança imediata</span>
|
|
367
365
|
{isCalculatePending ? (
|
|
368
366
|
<Skeleton className="h-5 w-20" />
|
|
369
367
|
) : (
|
|
@@ -374,13 +372,13 @@ export default function BuyCreditsModal() {
|
|
|
374
372
|
</div>
|
|
375
373
|
)}
|
|
376
374
|
<div className="flex items-center justify-between">
|
|
377
|
-
<span className="paragraph-small-medium text-zinc-500">
|
|
375
|
+
<span className="paragraph-small-medium text-zinc-500">Valor total do plano</span>
|
|
378
376
|
{renderPriceDisplay()}
|
|
379
377
|
</div>
|
|
380
378
|
</div>
|
|
381
379
|
<Button type="submit" disabled={isConfirmDisabled} className="w-full">
|
|
382
380
|
{isSubmitting && <IconLoader2 className="size-4 animate-spin" />}
|
|
383
|
-
|
|
381
|
+
Confirmar e pagar
|
|
384
382
|
</Button>
|
|
385
383
|
</div>
|
|
386
384
|
</form>
|
|
@@ -10,11 +10,9 @@ import {
|
|
|
10
10
|
import { Button } from '../ui/buttons/Button';
|
|
11
11
|
import { Separator } from '../ui/data-display/Separator';
|
|
12
12
|
import { IconAlertTriangle } from '@tabler/icons-react';
|
|
13
|
-
import { useTranslations } from 'next-intl';
|
|
14
13
|
import { useCreditsDisabledModal } from '../../store/useCreditsDisabledModal';
|
|
15
14
|
|
|
16
15
|
export default function CreditsDisabledModal() {
|
|
17
|
-
const translate = useTranslations();
|
|
18
16
|
const { open, closeModal } = useCreditsDisabledModal();
|
|
19
17
|
|
|
20
18
|
return (
|
|
@@ -34,12 +32,14 @@ export default function CreditsDisabledModal() {
|
|
|
34
32
|
</div>
|
|
35
33
|
<div className="flex flex-col gap-2">
|
|
36
34
|
<DialogTitle className="paragraph-medium-semibold text-zinc-950">
|
|
37
|
-
|
|
35
|
+
Compra de créditos indisponível
|
|
38
36
|
</DialogTitle>
|
|
39
37
|
<DialogDescription className="paragraph-small-regular text-zinc-600" asChild>
|
|
40
38
|
<div className="flex flex-col gap-3">
|
|
41
|
-
<p>
|
|
42
|
-
<p>
|
|
39
|
+
<p>Apenas administradores e proprietários podem comprar créditos de IA.</p>
|
|
40
|
+
<p>
|
|
41
|
+
Peça a um administrador ou proprietário da conta para adquirir mais créditos.
|
|
42
|
+
</p>
|
|
43
43
|
</div>
|
|
44
44
|
</DialogDescription>
|
|
45
45
|
</div>
|
|
@@ -53,7 +53,7 @@ export default function CreditsDisabledModal() {
|
|
|
53
53
|
className="h-10! transition-colors"
|
|
54
54
|
onClick={() => closeModal()}
|
|
55
55
|
>
|
|
56
|
-
|
|
56
|
+
Entendi
|
|
57
57
|
</Button>
|
|
58
58
|
</div>
|
|
59
59
|
</DialogContent>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { IconLock } from '@tabler/icons-react';
|
|
4
|
-
import { useTranslations } from 'next-intl';
|
|
5
4
|
import { Button } from '../ui/buttons/Button';
|
|
6
5
|
import {
|
|
7
6
|
Dialog,
|
|
@@ -15,15 +14,14 @@ import { useModalManager } from '../../store/useModalManager';
|
|
|
15
14
|
import type { ModalData } from '../../store/useModalManager';
|
|
16
15
|
|
|
17
16
|
export default function PaidPlanRequiredModal() {
|
|
18
|
-
const translate = useTranslations();
|
|
19
17
|
const { activeModal, modalData, closeModal } = useModalManager();
|
|
20
18
|
const isOpen = activeModal === 'paidPlanRequiredModal';
|
|
21
19
|
const data = modalData as ModalData & { title?: string; description?: string };
|
|
22
20
|
const { accountsUrl } = useWhitelabelUrls();
|
|
23
21
|
const { redirectToExternal } = useExternalContracting();
|
|
24
22
|
|
|
25
|
-
const title = (data.title as string) ??
|
|
26
|
-
const description = (data.description as string) ??
|
|
23
|
+
const title = (data.title as string) ?? "Recurso disponível em planos pagos";
|
|
24
|
+
const description = (data.description as string) ?? "Para acessar este recurso, faça upgrade para um plano pago";
|
|
27
25
|
|
|
28
26
|
const handleKnowPlans = () => {
|
|
29
27
|
if (redirectToExternal('plans')) return;
|
|
@@ -51,7 +49,7 @@ export default function PaidPlanRequiredModal() {
|
|
|
51
49
|
className="w-fit h-10!"
|
|
52
50
|
onClick={handleKnowPlans}
|
|
53
51
|
>
|
|
54
|
-
|
|
52
|
+
Conhecer planos
|
|
55
53
|
</Button>
|
|
56
54
|
</div>
|
|
57
55
|
</DialogContent>
|
|
@@ -17,7 +17,6 @@ import { useForm } from 'react-hook-form';
|
|
|
17
17
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
18
18
|
import { CardNumberElement, useElements, useStripe } from '@stripe/react-stripe-js';
|
|
19
19
|
import { toast } from 'sonner';
|
|
20
|
-
import { useTranslations } from 'next-intl';
|
|
21
20
|
|
|
22
21
|
const INITIAL_STRIPE_STATUS: StripeElementsStatus = {
|
|
23
22
|
cardNumber: false,
|
|
@@ -25,15 +24,15 @@ const INITIAL_STRIPE_STATUS: StripeElementsStatus = {
|
|
|
25
24
|
cardCvc: false,
|
|
26
25
|
};
|
|
27
26
|
|
|
27
|
+
const STEPS = [
|
|
28
|
+
{ number: 1, label: 'Cobrança' },
|
|
29
|
+
{ number: 2, label: 'Cartão' },
|
|
30
|
+
] as const;
|
|
31
|
+
|
|
28
32
|
function CardStepper({ currentStep }: { readonly currentStep: number }) {
|
|
29
|
-
const translate = useTranslations();
|
|
30
|
-
const steps = [
|
|
31
|
-
{ number: 1, label: translate('common.cards.add.stepBilling') },
|
|
32
|
-
{ number: 2, label: translate('common.cards.add.stepCard') },
|
|
33
|
-
];
|
|
34
33
|
return (
|
|
35
34
|
<div className="flex items-center justify-start gap-2 px-4 py-3 bg-zinc-50 border-b border-zinc-200 lg:border-b-0">
|
|
36
|
-
{
|
|
35
|
+
{STEPS.map((step, idx) => {
|
|
37
36
|
const isCompleted = currentStep > step.number;
|
|
38
37
|
const isCurrent = currentStep === step.number;
|
|
39
38
|
const isPending = !isCompleted && !isCurrent;
|
|
@@ -62,7 +61,7 @@ function CardStepper({ currentStep }: { readonly currentStep: number }) {
|
|
|
62
61
|
>
|
|
63
62
|
{step.label}
|
|
64
63
|
</span>
|
|
65
|
-
{idx <
|
|
64
|
+
{idx < STEPS.length - 1 && (
|
|
66
65
|
<IconChevronRight size={16} className="text-zinc-300 ml-1" />
|
|
67
66
|
)}
|
|
68
67
|
</div>
|
|
@@ -73,7 +72,6 @@ function CardStepper({ currentStep }: { readonly currentStep: number }) {
|
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
export default function AddCardModal() {
|
|
76
|
-
const translate = useTranslations();
|
|
77
75
|
const { activeModal, modalData, closeModal } = useModalManager();
|
|
78
76
|
const isOpen = activeModal === 'addCardModal';
|
|
79
77
|
const { isExternalContracting, redirectToExternal } = useExternalContracting();
|
|
@@ -139,9 +137,9 @@ export default function AddCardModal() {
|
|
|
139
137
|
|
|
140
138
|
async function handleSubmit(data: CardFormData) {
|
|
141
139
|
const newStripeErrors: Record<string, string | undefined> = {};
|
|
142
|
-
if (!stripeStatus.cardNumber) newStripeErrors.cardNumber =
|
|
143
|
-
if (!stripeStatus.cardExpiry) newStripeErrors.cardExpiry =
|
|
144
|
-
if (!stripeStatus.cardCvc) newStripeErrors.cardCvc =
|
|
140
|
+
if (!stripeStatus.cardNumber) newStripeErrors.cardNumber = 'Número do cartão é obrigatório';
|
|
141
|
+
if (!stripeStatus.cardExpiry) newStripeErrors.cardExpiry = 'Data de validade é obrigatória';
|
|
142
|
+
if (!stripeStatus.cardCvc) newStripeErrors.cardCvc = 'Código de segurança é obrigatório';
|
|
145
143
|
setStripeErrors(newStripeErrors);
|
|
146
144
|
|
|
147
145
|
const stripeValid =
|
|
@@ -161,7 +159,7 @@ export default function AddCardModal() {
|
|
|
161
159
|
(t) => (
|
|
162
160
|
<Toast
|
|
163
161
|
variant="error"
|
|
164
|
-
message=
|
|
162
|
+
message="Não foi possível iniciar a autenticação do cartão, tente novamente."
|
|
165
163
|
toastId={t}
|
|
166
164
|
/>
|
|
167
165
|
),
|
|
@@ -182,7 +180,7 @@ export default function AddCardModal() {
|
|
|
182
180
|
(t) => (
|
|
183
181
|
<Toast
|
|
184
182
|
variant="error"
|
|
185
|
-
message={error.message ||
|
|
183
|
+
message={error.message || 'Falha na autenticação do cartão.'}
|
|
186
184
|
toastId={t}
|
|
187
185
|
/>
|
|
188
186
|
),
|
|
@@ -196,7 +194,7 @@ export default function AddCardModal() {
|
|
|
196
194
|
(t) => (
|
|
197
195
|
<Toast
|
|
198
196
|
variant="error"
|
|
199
|
-
message={
|
|
197
|
+
message={`Autenticação não concluída (status: ${setupIntent?.status ?? 'desconhecido'}).`}
|
|
200
198
|
toastId={t}
|
|
201
199
|
/>
|
|
202
200
|
),
|
|
@@ -231,7 +229,7 @@ export default function AddCardModal() {
|
|
|
231
229
|
}
|
|
232
230
|
|
|
233
231
|
toast.custom(
|
|
234
|
-
(t) => <Toast variant="success" message=
|
|
232
|
+
(t) => <Toast variant="success" message="Cartão adicionado com sucesso." toastId={t} />,
|
|
235
233
|
{ duration: 5000 }
|
|
236
234
|
);
|
|
237
235
|
handleClose();
|
|
@@ -240,7 +238,7 @@ export default function AddCardModal() {
|
|
|
240
238
|
(t) => (
|
|
241
239
|
<Toast
|
|
242
240
|
variant="error"
|
|
243
|
-
message=
|
|
241
|
+
message="Não foi possível salvar o seu novo cartão, tente novamente."
|
|
244
242
|
toastId={t}
|
|
245
243
|
/>
|
|
246
244
|
),
|
|
@@ -285,10 +283,10 @@ export default function AddCardModal() {
|
|
|
285
283
|
</div>
|
|
286
284
|
<div className="flex flex-col gap-2">
|
|
287
285
|
<DialogTitle className="paragraph-medium-semibold text-zinc-950">
|
|
288
|
-
|
|
286
|
+
Gerenciamento de cartões indisponível
|
|
289
287
|
</DialogTitle>
|
|
290
288
|
<span className="paragraph-small-regular text-zinc-600">
|
|
291
|
-
|
|
289
|
+
Acesse sua área de assinatura para gerenciar formas de pagamento.
|
|
292
290
|
</span>
|
|
293
291
|
</div>
|
|
294
292
|
</DialogHeader>
|
|
@@ -300,7 +298,7 @@ export default function AddCardModal() {
|
|
|
300
298
|
redirectToExternal('contracting');
|
|
301
299
|
}}
|
|
302
300
|
>
|
|
303
|
-
|
|
301
|
+
Acessar área de assinatura
|
|
304
302
|
</Button>
|
|
305
303
|
</div>
|
|
306
304
|
</DialogContent>
|
|
@@ -317,7 +315,7 @@ export default function AddCardModal() {
|
|
|
317
315
|
<DialogHeader className="p-0">
|
|
318
316
|
<div className="flex items-center justify-center px-4 py-3 relative border-b border-zinc-200 lg:border-b-0">
|
|
319
317
|
<DialogTitle className="paragraph-medium-semibold text-zinc-950 text-center">
|
|
320
|
-
|
|
318
|
+
Adicionar cartão
|
|
321
319
|
</DialogTitle>
|
|
322
320
|
<Button
|
|
323
321
|
type="button"
|
|
@@ -338,13 +336,13 @@ export default function AddCardModal() {
|
|
|
338
336
|
>
|
|
339
337
|
<div className={`flex flex-col gap-6 lg:gap-8 p-4 lg:p-5 flex-1 lg:flex-none ${currentStep !== 1 ? 'hidden' : ''}`}>
|
|
340
338
|
<h2 className="font-[family-name:var(--font-outfit)] text-[18px] leading-tight font-semibold text-zinc-950">
|
|
341
|
-
|
|
339
|
+
Adicione suas informações de cobrança
|
|
342
340
|
</h2>
|
|
343
341
|
<BillingFormFields form={form} />
|
|
344
342
|
</div>
|
|
345
343
|
<div className={`flex flex-col gap-6 lg:gap-8 p-4 lg:p-5 flex-1 lg:flex-none ${currentStep !== 2 ? 'hidden' : ''}`}>
|
|
346
344
|
<h2 className="font-[family-name:var(--font-outfit)] text-[18px] leading-tight font-semibold text-zinc-950">
|
|
347
|
-
|
|
345
|
+
Adicione informações do seu cartão
|
|
348
346
|
</h2>
|
|
349
347
|
<CardFormFields
|
|
350
348
|
form={form}
|
|
@@ -357,7 +355,7 @@ export default function AddCardModal() {
|
|
|
357
355
|
{currentStep === 1 ? (
|
|
358
356
|
<>
|
|
359
357
|
<Button variant="secondary" type="button" onClick={handleClose} className="h-10!">
|
|
360
|
-
|
|
358
|
+
Cancelar
|
|
361
359
|
</Button>
|
|
362
360
|
<Button
|
|
363
361
|
type="button"
|
|
@@ -365,13 +363,13 @@ export default function AddCardModal() {
|
|
|
365
363
|
onClick={handleContinue}
|
|
366
364
|
disabled={!isBillingValid}
|
|
367
365
|
>
|
|
368
|
-
|
|
366
|
+
Continuar
|
|
369
367
|
</Button>
|
|
370
368
|
</>
|
|
371
369
|
) : (
|
|
372
370
|
<>
|
|
373
371
|
<Button variant="secondary" type="button" onClick={handleBack} className="h-10!">
|
|
374
|
-
|
|
372
|
+
Voltar
|
|
375
373
|
</Button>
|
|
376
374
|
<Button
|
|
377
375
|
type="submit"
|
|
@@ -380,10 +378,10 @@ export default function AddCardModal() {
|
|
|
380
378
|
loading={isAuthenticating || isSubmitting}
|
|
381
379
|
>
|
|
382
380
|
{isAuthenticating
|
|
383
|
-
?
|
|
381
|
+
? 'Autenticando...'
|
|
384
382
|
: isSubmitting
|
|
385
|
-
?
|
|
386
|
-
:
|
|
383
|
+
? 'Adicionando cartão...'
|
|
384
|
+
: 'Adicionar cartão'}
|
|
387
385
|
</Button>
|
|
388
386
|
</>
|
|
389
387
|
)}
|
|
@@ -12,10 +12,8 @@ import { useCards } from '../../../modules/cards/hooks/cards.hook';
|
|
|
12
12
|
import { useActiveSubscription } from '../../../modules/subscriptions/hooks/find-active-subscription.hook';
|
|
13
13
|
import { useUpdateSubscriptionPayment } from '../../../modules/subscriptions/hooks/update-subscription-payment.hook';
|
|
14
14
|
import type { Card } from '../../../modules/cards/types';
|
|
15
|
-
import { useTranslations } from 'next-intl';
|
|
16
15
|
|
|
17
16
|
export function CannotDeleteCardModal() {
|
|
18
|
-
const translate = useTranslations();
|
|
19
17
|
const { activeModal, modalData, closeModal, openModal } = useModalManager();
|
|
20
18
|
const { data: cardsData } = useCards();
|
|
21
19
|
const { mutateAsync: updatePayment } = useUpdateSubscriptionPayment();
|
|
@@ -51,7 +49,7 @@ export function CannotDeleteCardModal() {
|
|
|
51
49
|
message={
|
|
52
50
|
error instanceof Error
|
|
53
51
|
? error.message
|
|
54
|
-
:
|
|
52
|
+
: 'Erro ao atualizar cartão da assinatura'
|
|
55
53
|
}
|
|
56
54
|
toastId={t}
|
|
57
55
|
/>
|
|
@@ -71,7 +69,7 @@ export function CannotDeleteCardModal() {
|
|
|
71
69
|
return (
|
|
72
70
|
<Dialog open={isOpen} onOpenChange={(open) => !open && closeModal()}>
|
|
73
71
|
<DialogTitle className="sr-only">
|
|
74
|
-
|
|
72
|
+
Não é possível excluir este cartão
|
|
75
73
|
</DialogTitle>
|
|
76
74
|
<DialogContent className="flex flex-col p-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-dvh top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[436px] 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%] overflow-hidden">
|
|
77
75
|
<div className="flex flex-col gap-5 p-4 lg:p-5">
|
|
@@ -81,10 +79,11 @@ export function CannotDeleteCardModal() {
|
|
|
81
79
|
|
|
82
80
|
<div className="flex flex-col gap-2">
|
|
83
81
|
<h2 className="paragraph-medium-semibold text-zinc-950">
|
|
84
|
-
|
|
82
|
+
Não é possível excluir este cartão
|
|
85
83
|
</h2>
|
|
86
84
|
<p className="paragraph-small-regular text-zinc-600">
|
|
87
|
-
|
|
85
|
+
Este cartão está em uso e tem uma assinatura ativa vinculada a ele.
|
|
86
|
+
Selecione outro cartão como padrão ou adicione um novo.
|
|
88
87
|
</p>
|
|
89
88
|
</div>
|
|
90
89
|
</div>
|
|
@@ -92,7 +91,7 @@ export function CannotDeleteCardModal() {
|
|
|
92
91
|
{availableCards.length > 0 && (
|
|
93
92
|
<div className="flex flex-col gap-3 px-4 lg:px-5 pb-4 lg:pb-5 overflow-y-auto max-h-[200px] flex-1 lg:flex-none">
|
|
94
93
|
<span className="paragraph-xsmall-semibold text-zinc-600">
|
|
95
|
-
|
|
94
|
+
Selecione um cartão como padrão:
|
|
96
95
|
</span>
|
|
97
96
|
{availableCards.map((card) => (
|
|
98
97
|
<CardItem
|
|
@@ -108,14 +107,14 @@ export function CannotDeleteCardModal() {
|
|
|
108
107
|
<div className="flex flex-row gap-2 p-4 lg:p-5 border-t border-zinc-200 mt-auto lg:mt-0">
|
|
109
108
|
<Button onClick={handleAddCard} className="h-10! flex-1">
|
|
110
109
|
<IconPlus size={20} />
|
|
111
|
-
|
|
110
|
+
Adicionar novo cartão
|
|
112
111
|
</Button>
|
|
113
112
|
<Button
|
|
114
113
|
variant="secondary"
|
|
115
114
|
onClick={() => closeModal()}
|
|
116
115
|
className="h-10! flex-1"
|
|
117
116
|
>
|
|
118
|
-
|
|
117
|
+
Cancelar
|
|
119
118
|
</Button>
|
|
120
119
|
</div>
|
|
121
120
|
</DialogContent>
|