@greatapps/common 1.1.670 → 1.1.672
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/layouts/NavBar.mjs +5 -3
- package/dist/components/layouts/NavBar.mjs.map +1 -1
- package/dist/components/layouts/NotificationsPopover.mjs +5 -3
- package/dist/components/layouts/NotificationsPopover.mjs.map +1 -1
- package/dist/components/layouts/ProfilePopover.mjs +6 -4
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/layouts/UsersSelectorPopover.mjs +9 -7
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
- package/dist/components/modals/BuyCreditsModal.mjs +17 -18
- package/dist/components/modals/BuyCreditsModal.mjs.map +1 -1
- package/dist/components/modals/CreditsDisabledModal.mjs +6 -4
- package/dist/components/modals/CreditsDisabledModal.mjs.map +1 -1
- package/dist/components/modals/PaidPlanRequiredModal.mjs +5 -3
- package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
- package/dist/components/modals/cards/AddCardModal.mjs +27 -24
- package/dist/components/modals/cards/AddCardModal.mjs.map +1 -1
- package/dist/components/modals/cards/CannotDeleteCardModal.mjs +9 -7
- package/dist/components/modals/cards/CannotDeleteCardModal.mjs.map +1 -1
- package/dist/components/modals/cards/CardFormFields.mjs +25 -22
- package/dist/components/modals/cards/CardFormFields.mjs.map +1 -1
- package/dist/components/modals/cards/DeleteCardModal.mjs +10 -8
- package/dist/components/modals/cards/DeleteCardModal.mjs.map +1 -1
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs +4 -2
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
- package/dist/components/navigation/OverdueInvoiceBanner.mjs +4 -2
- package/dist/components/navigation/OverdueInvoiceBanner.mjs.map +1 -1
- package/dist/components/navigation/PendingCancellationBanner.mjs +4 -6
- package/dist/components/navigation/PendingCancellationBanner.mjs.map +1 -1
- package/dist/components/navigation/ProjectSelectorPopover.mjs +8 -6
- package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -1
- package/dist/components/navigation/UpcomingInvoiceBanner.mjs +4 -6
- package/dist/components/navigation/UpcomingInvoiceBanner.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/BottomLinks.mjs +5 -3
- package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/CreditsCard.mjs +3 -1
- package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/PlanCard.mjs +3 -1
- package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs +5 -3
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
- package/dist/components/pages/NotFoundPage.mjs +5 -3
- package/dist/components/pages/NotFoundPage.mjs.map +1 -1
- package/dist/components/pages/notifications/Notifications.mjs +13 -10
- package/dist/components/pages/notifications/Notifications.mjs.map +1 -1
- package/dist/components/ui/buttons/CopyButton.mjs +9 -5
- package/dist/components/ui/buttons/CopyButton.mjs.map +1 -1
- package/dist/components/ui/data-display/CardItem.mjs +7 -5
- package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
- package/dist/components/ui/data-display/PaymentInfoCard.mjs +10 -8
- package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs +3 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -1
- package/dist/components/ui/form/ComboboxField.mjs +11 -6
- package/dist/components/ui/form/ComboboxField.mjs.map +1 -1
- package/dist/components/ui/form/DatePicker.mjs +5 -2
- package/dist/components/ui/form/DatePicker.mjs.map +1 -1
- package/dist/components/ui/form/DateRangePicker.mjs +5 -2
- package/dist/components/ui/form/DateRangePicker.mjs.map +1 -1
- package/dist/components/ui/form/PhoneInput.mjs +5 -3
- package/dist/components/ui/form/PhoneInput.mjs.map +1 -1
- package/dist/components/ui/form/SelectField.mjs +6 -3
- package/dist/components/ui/form/SelectField.mjs.map +1 -1
- package/dist/components/widgets/ImageUpload/ImageCropModal.mjs +11 -18
- package/dist/components/widgets/ImageUpload/ImageCropModal.mjs.map +1 -1
- package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs +6 -15
- package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs.map +1 -1
- package/dist/i18n/messages/en-us.mjs +231 -0
- package/dist/i18n/messages/en-us.mjs.map +1 -1
- package/dist/i18n/messages/es-es.mjs +231 -0
- package/dist/i18n/messages/es-es.mjs.map +1 -1
- package/dist/i18n/messages/pt-br.mjs +239 -0
- package/dist/i18n/messages/pt-br.mjs.map +1 -1
- package/dist/index.mjs +5 -1
- package/dist/index.mjs.map +1 -1
- package/dist/modules/cards/hooks/handle-delete-card.hook.mjs +2 -1
- package/dist/modules/cards/hooks/handle-delete-card.hook.mjs.map +1 -1
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs +7 -2
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/layouts/NavBar.tsx +5 -3
- package/src/components/layouts/NotificationsPopover.tsx +5 -3
- package/src/components/layouts/ProfilePopover.tsx +6 -4
- package/src/components/layouts/UsersSelectorPopover.tsx +9 -7
- package/src/components/modals/BuyCreditsModal.tsx +18 -16
- package/src/components/modals/CreditsDisabledModal.tsx +6 -6
- package/src/components/modals/PaidPlanRequiredModal.tsx +5 -3
- package/src/components/modals/cards/AddCardModal.tsx +29 -27
- package/src/components/modals/cards/CannotDeleteCardModal.tsx +9 -8
- package/src/components/modals/cards/CardFormFields.tsx +25 -22
- package/src/components/modals/cards/DeleteCardModal.tsx +10 -8
- package/src/components/navigation/CancelledSubscriptionBanner.tsx +4 -2
- package/src/components/navigation/OverdueInvoiceBanner.tsx +4 -2
- package/src/components/navigation/PendingCancellationBanner.tsx +4 -2
- package/src/components/navigation/ProjectSelectorPopover.tsx +8 -6
- package/src/components/navigation/UpcomingInvoiceBanner.tsx +4 -2
- package/src/components/navigation/subcomponents/BottomLinks.tsx +5 -3
- package/src/components/navigation/subcomponents/CreditsCard.tsx +3 -1
- package/src/components/navigation/subcomponents/PlanCard.tsx +3 -1
- package/src/components/navigation/subcomponents/ProjectSelector.tsx +5 -3
- package/src/components/pages/NotFoundPage.tsx +5 -3
- package/src/components/pages/notifications/Notifications.tsx +13 -10
- package/src/components/ui/buttons/CopyButton.tsx +10 -5
- package/src/components/ui/data-display/CardItem.tsx +7 -5
- package/src/components/ui/data-display/PaymentInfoCard.tsx +10 -8
- package/src/components/ui/feedback/DefaultCircularProgress.tsx +3 -1
- package/src/components/ui/form/ComboboxField.tsx +11 -6
- package/src/components/ui/form/DatePicker.tsx +5 -2
- package/src/components/ui/form/DateRangePicker.tsx +5 -2
- package/src/components/ui/form/PhoneInput.tsx +5 -3
- package/src/components/ui/form/SelectField.tsx +6 -3
- package/src/components/widgets/ImageUpload/ImageCropModal.tsx +19 -11
- package/src/components/widgets/ImageUpload/ImageTooSmallModal.tsx +6 -5
- package/src/i18n/messages/en-us.ts +234 -0
- package/src/i18n/messages/es-es.ts +234 -0
- package/src/i18n/messages/pt-br.ts +248 -0
- package/src/index.ts +4 -1
- package/src/modules/cards/hooks/handle-delete-card.hook.ts +8 -3
- package/src/modules/plans/utils/map-api-plan-to-ui.ts +19 -1
|
@@ -10,9 +10,11 @@ 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';
|
|
13
14
|
import { useCreditsDisabledModal } from '../../store/useCreditsDisabledModal';
|
|
14
15
|
|
|
15
16
|
export default function CreditsDisabledModal() {
|
|
17
|
+
const translate = useTranslations();
|
|
16
18
|
const { open, closeModal } = useCreditsDisabledModal();
|
|
17
19
|
|
|
18
20
|
return (
|
|
@@ -32,14 +34,12 @@ export default function CreditsDisabledModal() {
|
|
|
32
34
|
</div>
|
|
33
35
|
<div className="flex flex-col gap-2">
|
|
34
36
|
<DialogTitle className="paragraph-medium-semibold text-zinc-950">
|
|
35
|
-
|
|
37
|
+
{translate('common.credits.disabled.title')}
|
|
36
38
|
</DialogTitle>
|
|
37
39
|
<DialogDescription className="paragraph-small-regular text-zinc-600" asChild>
|
|
38
40
|
<div className="flex flex-col gap-3">
|
|
39
|
-
<p>
|
|
40
|
-
<p>
|
|
41
|
-
Peça a um administrador ou proprietário da conta para adquirir mais créditos.
|
|
42
|
-
</p>
|
|
41
|
+
<p>{translate('common.credits.disabled.descriptionLine1')}</p>
|
|
42
|
+
<p>{translate('common.credits.disabled.descriptionLine2')}</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
|
+
{translate('common.credits.disabled.understood')}
|
|
57
57
|
</Button>
|
|
58
58
|
</div>
|
|
59
59
|
</DialogContent>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { IconLock } from '@tabler/icons-react';
|
|
4
|
+
import { useTranslations } from 'next-intl';
|
|
4
5
|
import { Button } from '../ui/buttons/Button';
|
|
5
6
|
import {
|
|
6
7
|
Dialog,
|
|
@@ -14,14 +15,15 @@ import { useModalManager } from '../../store/useModalManager';
|
|
|
14
15
|
import type { ModalData } from '../../store/useModalManager';
|
|
15
16
|
|
|
16
17
|
export default function PaidPlanRequiredModal() {
|
|
18
|
+
const translate = useTranslations();
|
|
17
19
|
const { activeModal, modalData, closeModal } = useModalManager();
|
|
18
20
|
const isOpen = activeModal === 'paidPlanRequiredModal';
|
|
19
21
|
const data = modalData as ModalData & { title?: string; description?: string };
|
|
20
22
|
const { accountsUrl } = useWhitelabelUrls();
|
|
21
23
|
const { redirectToExternal } = useExternalContracting();
|
|
22
24
|
|
|
23
|
-
const title = (data.title as string) ??
|
|
24
|
-
const description = (data.description as string) ??
|
|
25
|
+
const title = (data.title as string) ?? translate('common.credits.paidPlanRequired.defaultTitle');
|
|
26
|
+
const description = (data.description as string) ?? translate('common.credits.paidPlanRequired.defaultDescription');
|
|
25
27
|
|
|
26
28
|
const handleKnowPlans = () => {
|
|
27
29
|
if (redirectToExternal('plans')) return;
|
|
@@ -49,7 +51,7 @@ export default function PaidPlanRequiredModal() {
|
|
|
49
51
|
className="w-fit h-10!"
|
|
50
52
|
onClick={handleKnowPlans}
|
|
51
53
|
>
|
|
52
|
-
|
|
54
|
+
{translate('common.credits.paidPlanRequired.knowPlans')}
|
|
53
55
|
</Button>
|
|
54
56
|
</div>
|
|
55
57
|
</DialogContent>
|
|
@@ -17,6 +17,7 @@ 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';
|
|
20
21
|
|
|
21
22
|
const INITIAL_STRIPE_STATUS: StripeElementsStatus = {
|
|
22
23
|
cardNumber: false,
|
|
@@ -24,15 +25,15 @@ const INITIAL_STRIPE_STATUS: StripeElementsStatus = {
|
|
|
24
25
|
cardCvc: false,
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
const STEPS = [
|
|
28
|
-
{ number: 1, label: 'Cobrança' },
|
|
29
|
-
{ number: 2, label: 'Cartão' },
|
|
30
|
-
] as const;
|
|
31
|
-
|
|
32
28
|
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
|
+
];
|
|
33
34
|
return (
|
|
34
35
|
<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">
|
|
35
|
-
{
|
|
36
|
+
{steps.map((step, idx) => {
|
|
36
37
|
const isCompleted = currentStep > step.number;
|
|
37
38
|
const isCurrent = currentStep === step.number;
|
|
38
39
|
const isPending = !isCompleted && !isCurrent;
|
|
@@ -61,7 +62,7 @@ function CardStepper({ currentStep }: { readonly currentStep: number }) {
|
|
|
61
62
|
>
|
|
62
63
|
{step.label}
|
|
63
64
|
</span>
|
|
64
|
-
{idx <
|
|
65
|
+
{idx < steps.length - 1 && (
|
|
65
66
|
<IconChevronRight size={16} className="text-zinc-300 ml-1" />
|
|
66
67
|
)}
|
|
67
68
|
</div>
|
|
@@ -72,6 +73,7 @@ function CardStepper({ currentStep }: { readonly currentStep: number }) {
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
export default function AddCardModal() {
|
|
76
|
+
const translate = useTranslations();
|
|
75
77
|
const { activeModal, modalData, closeModal } = useModalManager();
|
|
76
78
|
const isOpen = activeModal === 'addCardModal';
|
|
77
79
|
const { isExternalContracting, redirectToExternal } = useExternalContracting();
|
|
@@ -137,9 +139,9 @@ export default function AddCardModal() {
|
|
|
137
139
|
|
|
138
140
|
async function handleSubmit(data: CardFormData) {
|
|
139
141
|
const newStripeErrors: Record<string, string | undefined> = {};
|
|
140
|
-
if (!stripeStatus.cardNumber) newStripeErrors.cardNumber = '
|
|
141
|
-
if (!stripeStatus.cardExpiry) newStripeErrors.cardExpiry = '
|
|
142
|
-
if (!stripeStatus.cardCvc) newStripeErrors.cardCvc = '
|
|
142
|
+
if (!stripeStatus.cardNumber) newStripeErrors.cardNumber = translate('common.cards.form.cardNumberRequired');
|
|
143
|
+
if (!stripeStatus.cardExpiry) newStripeErrors.cardExpiry = translate('common.cards.form.cardExpiryRequired');
|
|
144
|
+
if (!stripeStatus.cardCvc) newStripeErrors.cardCvc = translate('common.cards.form.cardCvcRequired');
|
|
143
145
|
setStripeErrors(newStripeErrors);
|
|
144
146
|
|
|
145
147
|
const stripeValid =
|
|
@@ -159,7 +161,7 @@ export default function AddCardModal() {
|
|
|
159
161
|
(t) => (
|
|
160
162
|
<Toast
|
|
161
163
|
variant="error"
|
|
162
|
-
message=
|
|
164
|
+
message={translate('common.cards.add.errorInitAuth')}
|
|
163
165
|
toastId={t}
|
|
164
166
|
/>
|
|
165
167
|
),
|
|
@@ -180,7 +182,7 @@ export default function AddCardModal() {
|
|
|
180
182
|
(t) => (
|
|
181
183
|
<Toast
|
|
182
184
|
variant="error"
|
|
183
|
-
message={error.message || '
|
|
185
|
+
message={error.message || translate('common.cards.add.errorAuth')}
|
|
184
186
|
toastId={t}
|
|
185
187
|
/>
|
|
186
188
|
),
|
|
@@ -194,7 +196,7 @@ export default function AddCardModal() {
|
|
|
194
196
|
(t) => (
|
|
195
197
|
<Toast
|
|
196
198
|
variant="error"
|
|
197
|
-
message={
|
|
199
|
+
message={translate('common.cards.add.errorAuthStatus', { status: setupIntent?.status ?? translate('common.cards.add.statusUnknown') })}
|
|
198
200
|
toastId={t}
|
|
199
201
|
/>
|
|
200
202
|
),
|
|
@@ -229,7 +231,7 @@ export default function AddCardModal() {
|
|
|
229
231
|
}
|
|
230
232
|
|
|
231
233
|
toast.custom(
|
|
232
|
-
(t) => <Toast variant="success" message=
|
|
234
|
+
(t) => <Toast variant="success" message={translate('common.cards.add.successToast')} toastId={t} />,
|
|
233
235
|
{ duration: 5000 }
|
|
234
236
|
);
|
|
235
237
|
handleClose();
|
|
@@ -238,7 +240,7 @@ export default function AddCardModal() {
|
|
|
238
240
|
(t) => (
|
|
239
241
|
<Toast
|
|
240
242
|
variant="error"
|
|
241
|
-
message=
|
|
243
|
+
message={translate('common.cards.add.errorSave')}
|
|
242
244
|
toastId={t}
|
|
243
245
|
/>
|
|
244
246
|
),
|
|
@@ -283,10 +285,10 @@ export default function AddCardModal() {
|
|
|
283
285
|
</div>
|
|
284
286
|
<div className="flex flex-col gap-2">
|
|
285
287
|
<DialogTitle className="paragraph-medium-semibold text-zinc-950">
|
|
286
|
-
|
|
288
|
+
{translate('common.cards.add.externalTitle')}
|
|
287
289
|
</DialogTitle>
|
|
288
290
|
<span className="paragraph-small-regular text-zinc-600">
|
|
289
|
-
|
|
291
|
+
{translate('common.cards.add.externalDescription')}
|
|
290
292
|
</span>
|
|
291
293
|
</div>
|
|
292
294
|
</DialogHeader>
|
|
@@ -298,7 +300,7 @@ export default function AddCardModal() {
|
|
|
298
300
|
redirectToExternal('contracting');
|
|
299
301
|
}}
|
|
300
302
|
>
|
|
301
|
-
|
|
303
|
+
{translate('common.cards.add.externalButton')}
|
|
302
304
|
</Button>
|
|
303
305
|
</div>
|
|
304
306
|
</DialogContent>
|
|
@@ -315,7 +317,7 @@ export default function AddCardModal() {
|
|
|
315
317
|
<DialogHeader className="p-0">
|
|
316
318
|
<div className="flex items-center justify-center px-4 py-3 relative border-b border-zinc-200 lg:border-b-0">
|
|
317
319
|
<DialogTitle className="paragraph-medium-semibold text-zinc-950 text-center">
|
|
318
|
-
|
|
320
|
+
{translate('common.cards.add.title')}
|
|
319
321
|
</DialogTitle>
|
|
320
322
|
<Button
|
|
321
323
|
type="button"
|
|
@@ -336,13 +338,13 @@ export default function AddCardModal() {
|
|
|
336
338
|
>
|
|
337
339
|
<div className={`flex flex-col gap-6 lg:gap-8 p-4 lg:p-5 flex-1 lg:flex-none ${currentStep !== 1 ? 'hidden' : ''}`}>
|
|
338
340
|
<h2 className="font-[family-name:var(--font-outfit)] text-[18px] leading-tight font-semibold text-zinc-950">
|
|
339
|
-
|
|
341
|
+
{translate('common.cards.add.billingHeading')}
|
|
340
342
|
</h2>
|
|
341
343
|
<BillingFormFields form={form} />
|
|
342
344
|
</div>
|
|
343
345
|
<div className={`flex flex-col gap-6 lg:gap-8 p-4 lg:p-5 flex-1 lg:flex-none ${currentStep !== 2 ? 'hidden' : ''}`}>
|
|
344
346
|
<h2 className="font-[family-name:var(--font-outfit)] text-[18px] leading-tight font-semibold text-zinc-950">
|
|
345
|
-
|
|
347
|
+
{translate('common.cards.add.cardHeading')}
|
|
346
348
|
</h2>
|
|
347
349
|
<CardFormFields
|
|
348
350
|
form={form}
|
|
@@ -355,7 +357,7 @@ export default function AddCardModal() {
|
|
|
355
357
|
{currentStep === 1 ? (
|
|
356
358
|
<>
|
|
357
359
|
<Button variant="secondary" type="button" onClick={handleClose} className="h-10!">
|
|
358
|
-
|
|
360
|
+
{translate('common.actions.cancel')}
|
|
359
361
|
</Button>
|
|
360
362
|
<Button
|
|
361
363
|
type="button"
|
|
@@ -363,13 +365,13 @@ export default function AddCardModal() {
|
|
|
363
365
|
onClick={handleContinue}
|
|
364
366
|
disabled={!isBillingValid}
|
|
365
367
|
>
|
|
366
|
-
|
|
368
|
+
{translate('common.actions.continue')}
|
|
367
369
|
</Button>
|
|
368
370
|
</>
|
|
369
371
|
) : (
|
|
370
372
|
<>
|
|
371
373
|
<Button variant="secondary" type="button" onClick={handleBack} className="h-10!">
|
|
372
|
-
|
|
374
|
+
{translate('common.actions.back')}
|
|
373
375
|
</Button>
|
|
374
376
|
<Button
|
|
375
377
|
type="submit"
|
|
@@ -378,10 +380,10 @@ export default function AddCardModal() {
|
|
|
378
380
|
loading={isAuthenticating || isSubmitting}
|
|
379
381
|
>
|
|
380
382
|
{isAuthenticating
|
|
381
|
-
? '
|
|
383
|
+
? translate('common.cards.add.authenticating')
|
|
382
384
|
: isSubmitting
|
|
383
|
-
? '
|
|
384
|
-
: '
|
|
385
|
+
? translate('common.cards.add.submitting')
|
|
386
|
+
: translate('common.cards.add.submit')}
|
|
385
387
|
</Button>
|
|
386
388
|
</>
|
|
387
389
|
)}
|
|
@@ -12,8 +12,10 @@ 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';
|
|
15
16
|
|
|
16
17
|
export function CannotDeleteCardModal() {
|
|
18
|
+
const translate = useTranslations();
|
|
17
19
|
const { activeModal, modalData, closeModal, openModal } = useModalManager();
|
|
18
20
|
const { data: cardsData } = useCards();
|
|
19
21
|
const { mutateAsync: updatePayment } = useUpdateSubscriptionPayment();
|
|
@@ -49,7 +51,7 @@ export function CannotDeleteCardModal() {
|
|
|
49
51
|
message={
|
|
50
52
|
error instanceof Error
|
|
51
53
|
? error.message
|
|
52
|
-
: '
|
|
54
|
+
: translate('common.cards.cannotDelete.errorUpdateCard')
|
|
53
55
|
}
|
|
54
56
|
toastId={t}
|
|
55
57
|
/>
|
|
@@ -69,7 +71,7 @@ export function CannotDeleteCardModal() {
|
|
|
69
71
|
return (
|
|
70
72
|
<Dialog open={isOpen} onOpenChange={(open) => !open && closeModal()}>
|
|
71
73
|
<DialogTitle className="sr-only">
|
|
72
|
-
|
|
74
|
+
{translate('common.cards.cannotDelete.title')}
|
|
73
75
|
</DialogTitle>
|
|
74
76
|
<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">
|
|
75
77
|
<div className="flex flex-col gap-5 p-4 lg:p-5">
|
|
@@ -79,11 +81,10 @@ export function CannotDeleteCardModal() {
|
|
|
79
81
|
|
|
80
82
|
<div className="flex flex-col gap-2">
|
|
81
83
|
<h2 className="paragraph-medium-semibold text-zinc-950">
|
|
82
|
-
|
|
84
|
+
{translate('common.cards.cannotDelete.title')}
|
|
83
85
|
</h2>
|
|
84
86
|
<p className="paragraph-small-regular text-zinc-600">
|
|
85
|
-
|
|
86
|
-
Selecione outro cartão como padrão ou adicione um novo.
|
|
87
|
+
{translate('common.cards.cannotDelete.description')}
|
|
87
88
|
</p>
|
|
88
89
|
</div>
|
|
89
90
|
</div>
|
|
@@ -91,7 +92,7 @@ export function CannotDeleteCardModal() {
|
|
|
91
92
|
{availableCards.length > 0 && (
|
|
92
93
|
<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">
|
|
93
94
|
<span className="paragraph-xsmall-semibold text-zinc-600">
|
|
94
|
-
|
|
95
|
+
{translate('common.cards.cannotDelete.selectDefault')}
|
|
95
96
|
</span>
|
|
96
97
|
{availableCards.map((card) => (
|
|
97
98
|
<CardItem
|
|
@@ -107,14 +108,14 @@ export function CannotDeleteCardModal() {
|
|
|
107
108
|
<div className="flex flex-row gap-2 p-4 lg:p-5 border-t border-zinc-200 mt-auto lg:mt-0">
|
|
108
109
|
<Button onClick={handleAddCard} className="h-10! flex-1">
|
|
109
110
|
<IconPlus size={20} />
|
|
110
|
-
|
|
111
|
+
{translate('common.cards.cannotDelete.addNewCard')}
|
|
111
112
|
</Button>
|
|
112
113
|
<Button
|
|
113
114
|
variant="secondary"
|
|
114
115
|
onClick={() => closeModal()}
|
|
115
116
|
className="h-10! flex-1"
|
|
116
117
|
>
|
|
117
|
-
|
|
118
|
+
{translate('common.actions.cancel')}
|
|
118
119
|
</Button>
|
|
119
120
|
</div>
|
|
120
121
|
</DialogContent>
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
CardExpiryElement,
|
|
17
17
|
CardNumberElement,
|
|
18
18
|
} from "@stripe/react-stripe-js";
|
|
19
|
+
import { useTranslations } from "next-intl";
|
|
19
20
|
|
|
20
21
|
const stripeElementOptions = {
|
|
21
22
|
style: {
|
|
@@ -91,6 +92,7 @@ export function CardFormFields({
|
|
|
91
92
|
onStripeChange,
|
|
92
93
|
stripeErrors,
|
|
93
94
|
}: CardFormFieldsProps) {
|
|
95
|
+
const translate = useTranslations();
|
|
94
96
|
const {
|
|
95
97
|
register,
|
|
96
98
|
watch,
|
|
@@ -103,8 +105,8 @@ export function CardFormFields({
|
|
|
103
105
|
return (
|
|
104
106
|
<div className="flex flex-col gap-5">
|
|
105
107
|
<FormField
|
|
106
|
-
label=
|
|
107
|
-
placeholder=
|
|
108
|
+
label={translate('common.cards.form.nameOnCard')}
|
|
109
|
+
placeholder={translate('common.cards.form.typeHere')}
|
|
108
110
|
{...register("name")}
|
|
109
111
|
error={!!errors.name}
|
|
110
112
|
errorMessage={errors.name?.message}
|
|
@@ -112,7 +114,7 @@ export function CardFormFields({
|
|
|
112
114
|
|
|
113
115
|
<div className="flex flex-col gap-1.5">
|
|
114
116
|
<label className="paragraph-xsmall-semibold text-zinc-600">
|
|
115
|
-
|
|
117
|
+
{translate('common.cards.form.cardNumber')}
|
|
116
118
|
</label>
|
|
117
119
|
<div className="h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400 relative">
|
|
118
120
|
<div className="w-full">
|
|
@@ -134,7 +136,7 @@ export function CardFormFields({
|
|
|
134
136
|
<div className="flex gap-4">
|
|
135
137
|
<div className="flex-1 flex flex-col gap-1.5">
|
|
136
138
|
<label className="paragraph-xsmall-semibold text-zinc-600">
|
|
137
|
-
|
|
139
|
+
{translate('common.cards.form.cardExpiry')}
|
|
138
140
|
</label>
|
|
139
141
|
<div className="h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400">
|
|
140
142
|
<div className="w-full">
|
|
@@ -154,7 +156,7 @@ export function CardFormFields({
|
|
|
154
156
|
</div>
|
|
155
157
|
|
|
156
158
|
<div className="flex-1 flex flex-col gap-1.5">
|
|
157
|
-
<label className="paragraph-xsmall-semibold text-zinc-600">
|
|
159
|
+
<label className="paragraph-xsmall-semibold text-zinc-600">{translate('common.cards.form.cardCvc')}</label>
|
|
158
160
|
<div className="h-10 px-3 flex items-center w-full border border-zinc-200 rounded-lg bg-white transition-colors focus-within:border-zinc-400">
|
|
159
161
|
<div className="w-full">
|
|
160
162
|
<CardCvcElement
|
|
@@ -174,8 +176,8 @@ export function CardFormFields({
|
|
|
174
176
|
</div>
|
|
175
177
|
|
|
176
178
|
<SelectField
|
|
177
|
-
label=
|
|
178
|
-
placeholder=
|
|
179
|
+
label={translate('common.cards.form.country')}
|
|
180
|
+
placeholder={translate('common.cards.form.select')}
|
|
179
181
|
value={watch("country")}
|
|
180
182
|
onChange={(value) => setValue("country", value as string)}
|
|
181
183
|
options={COUNTRIES.map((c) => ({ value: c.iso, label: c.name }))}
|
|
@@ -183,8 +185,8 @@ export function CardFormFields({
|
|
|
183
185
|
|
|
184
186
|
<div className="flex gap-4">
|
|
185
187
|
<SelectField
|
|
186
|
-
label=
|
|
187
|
-
placeholder=
|
|
188
|
+
label={translate('common.cards.form.personType')}
|
|
189
|
+
placeholder={translate('common.cards.form.select')}
|
|
188
190
|
value={personType}
|
|
189
191
|
onChange={(value) => {
|
|
190
192
|
setValue("personType", value as "pf" | "pj");
|
|
@@ -192,15 +194,15 @@ export function CardFormFields({
|
|
|
192
194
|
setValue("cnpj", "");
|
|
193
195
|
}}
|
|
194
196
|
options={[
|
|
195
|
-
{ value: "pf", label:
|
|
196
|
-
{ value: "pj", label:
|
|
197
|
+
{ value: "pf", label: translate('common.cards.form.personTypePf') },
|
|
198
|
+
{ value: "pj", label: translate('common.cards.form.personTypePj') },
|
|
197
199
|
]}
|
|
198
200
|
containerClassName="flex-1"
|
|
199
201
|
/>
|
|
200
202
|
<div className="flex-1">
|
|
201
203
|
{personType === "pj" ? (
|
|
202
204
|
<FormField
|
|
203
|
-
label=
|
|
205
|
+
label={translate('common.cards.form.cnpj')}
|
|
204
206
|
placeholder="__.___.___/____-__"
|
|
205
207
|
{...register("cnpj", {
|
|
206
208
|
onChange: (e) => {
|
|
@@ -212,7 +214,7 @@ export function CardFormFields({
|
|
|
212
214
|
/>
|
|
213
215
|
) : (
|
|
214
216
|
<FormField
|
|
215
|
-
label=
|
|
217
|
+
label={translate('common.cards.form.cpf')}
|
|
216
218
|
placeholder="___.___.___-__"
|
|
217
219
|
{...register("cpf", {
|
|
218
220
|
onChange: (e) => {
|
|
@@ -234,6 +236,7 @@ type BillingFormFieldsProps = {
|
|
|
234
236
|
};
|
|
235
237
|
|
|
236
238
|
export function BillingFormFields({ form }: BillingFormFieldsProps) {
|
|
239
|
+
const translate = useTranslations();
|
|
237
240
|
const {
|
|
238
241
|
register,
|
|
239
242
|
setValue,
|
|
@@ -264,15 +267,15 @@ export function BillingFormFields({ form }: BillingFormFieldsProps) {
|
|
|
264
267
|
return (
|
|
265
268
|
<div className="flex flex-col gap-5">
|
|
266
269
|
<FormField
|
|
267
|
-
label=
|
|
268
|
-
placeholder=
|
|
270
|
+
label={translate('common.cards.form.fullName')}
|
|
271
|
+
placeholder={translate('common.cards.form.typeHere')}
|
|
269
272
|
{...register("fullName")}
|
|
270
273
|
error={!!errors.fullName}
|
|
271
274
|
errorMessage={errors.fullName?.message}
|
|
272
275
|
/>
|
|
273
276
|
|
|
274
277
|
<FormField
|
|
275
|
-
label=
|
|
278
|
+
label={translate('common.cards.form.cep')}
|
|
276
279
|
placeholder="_____-___"
|
|
277
280
|
{...register("cep", {
|
|
278
281
|
onChange: (e) => handleCepChange(e.target.value),
|
|
@@ -284,7 +287,7 @@ export function BillingFormFields({ form }: BillingFormFieldsProps) {
|
|
|
284
287
|
<div className="flex gap-4">
|
|
285
288
|
<div className="flex-[4]">
|
|
286
289
|
<FormField
|
|
287
|
-
label=
|
|
290
|
+
label={translate('common.cards.form.street')}
|
|
288
291
|
placeholder=""
|
|
289
292
|
{...register("street")}
|
|
290
293
|
error={!!errors.street}
|
|
@@ -293,7 +296,7 @@ export function BillingFormFields({ form }: BillingFormFieldsProps) {
|
|
|
293
296
|
</div>
|
|
294
297
|
<div className="flex-[1]">
|
|
295
298
|
<FormField
|
|
296
|
-
label=
|
|
299
|
+
label={translate('common.cards.form.streetNumber')}
|
|
297
300
|
placeholder=""
|
|
298
301
|
{...register("streetNumber")}
|
|
299
302
|
error={!!errors.streetNumber}
|
|
@@ -305,7 +308,7 @@ export function BillingFormFields({ form }: BillingFormFieldsProps) {
|
|
|
305
308
|
<div className="flex gap-4">
|
|
306
309
|
<div className="flex-1">
|
|
307
310
|
<FormField
|
|
308
|
-
label=
|
|
311
|
+
label={translate('common.cards.form.city')}
|
|
309
312
|
placeholder=""
|
|
310
313
|
{...register("city")}
|
|
311
314
|
error={!!errors.city}
|
|
@@ -314,7 +317,7 @@ export function BillingFormFields({ form }: BillingFormFieldsProps) {
|
|
|
314
317
|
</div>
|
|
315
318
|
<div className="flex-1">
|
|
316
319
|
<FormField
|
|
317
|
-
label=
|
|
320
|
+
label={translate('common.cards.form.state')}
|
|
318
321
|
placeholder=""
|
|
319
322
|
{...register("state")}
|
|
320
323
|
error={!!errors.state}
|
|
@@ -325,14 +328,14 @@ export function BillingFormFields({ form }: BillingFormFieldsProps) {
|
|
|
325
328
|
|
|
326
329
|
<div className="flex gap-4">
|
|
327
330
|
<FormField
|
|
328
|
-
label=
|
|
331
|
+
label={translate('common.cards.form.neighborhood')}
|
|
329
332
|
placeholder=""
|
|
330
333
|
{...register("neighborhood")}
|
|
331
334
|
error={!!errors.neighborhood}
|
|
332
335
|
errorMessage={errors.neighborhood?.message}
|
|
333
336
|
/>
|
|
334
337
|
<FormField
|
|
335
|
-
label=
|
|
338
|
+
label={translate('common.cards.form.complement')}
|
|
336
339
|
optional
|
|
337
340
|
placeholder=""
|
|
338
341
|
{...register("complement")}
|
|
@@ -17,8 +17,10 @@ import { useModalManager } from '../../../store/useModalManager';
|
|
|
17
17
|
import { useDeleteConfirmation } from '../../../modules/cards/hooks/delete-confirmation.hook';
|
|
18
18
|
import { useDeleteCard } from '../../../modules/cards/hooks/delete-card.hook';
|
|
19
19
|
import { useCards } from '../../../modules/cards/hooks/cards.hook';
|
|
20
|
+
import { useTranslations } from 'next-intl';
|
|
20
21
|
|
|
21
22
|
export function DeleteCardModal() {
|
|
23
|
+
const translate = useTranslations();
|
|
22
24
|
const { activeModal, modalData, closeModal } = useModalManager();
|
|
23
25
|
const { form, isValidConfirmation, resetConfirmation } = useDeleteConfirmation();
|
|
24
26
|
const deleteCard = useDeleteCard();
|
|
@@ -50,7 +52,7 @@ export function DeleteCardModal() {
|
|
|
50
52
|
message={
|
|
51
53
|
error instanceof Error
|
|
52
54
|
? error.message
|
|
53
|
-
: '
|
|
55
|
+
: translate('common.cards.delete.errorToast')
|
|
54
56
|
}
|
|
55
57
|
/>
|
|
56
58
|
),
|
|
@@ -67,7 +69,7 @@ export function DeleteCardModal() {
|
|
|
67
69
|
(t) => (
|
|
68
70
|
<Toast
|
|
69
71
|
variant="success"
|
|
70
|
-
message={
|
|
72
|
+
message={translate('common.cards.delete.successToast', { digits: cardLastDigits })}
|
|
71
73
|
toastId={t}
|
|
72
74
|
/>
|
|
73
75
|
),
|
|
@@ -85,10 +87,10 @@ export function DeleteCardModal() {
|
|
|
85
87
|
</div>
|
|
86
88
|
<div className="flex flex-col gap-2">
|
|
87
89
|
<DialogTitle className="paragraph-medium-semibold text-zinc-950">
|
|
88
|
-
|
|
90
|
+
{translate('common.cards.delete.title')}
|
|
89
91
|
</DialogTitle>
|
|
90
92
|
<DialogDescription className="paragraph-small-regular text-zinc-600">
|
|
91
|
-
|
|
93
|
+
{translate('common.cards.delete.description')}{' '}
|
|
92
94
|
<span className="font-semibold text-zinc-950">
|
|
93
95
|
•••• {cardLastDigits}
|
|
94
96
|
</span>
|
|
@@ -99,9 +101,9 @@ export function DeleteCardModal() {
|
|
|
99
101
|
|
|
100
102
|
<div className="px-4 lg:px-5 py-5">
|
|
101
103
|
<FormField
|
|
102
|
-
label=
|
|
104
|
+
label={translate('common.cards.delete.confirmLabel')}
|
|
103
105
|
required
|
|
104
|
-
placeholder=
|
|
106
|
+
placeholder={translate('common.cards.delete.confirmPlaceholder')}
|
|
105
107
|
{...form.register('confirmText')}
|
|
106
108
|
/>
|
|
107
109
|
</div>
|
|
@@ -113,7 +115,7 @@ export function DeleteCardModal() {
|
|
|
113
115
|
loading={form.formState.isSubmitting}
|
|
114
116
|
className="h-10!"
|
|
115
117
|
>
|
|
116
|
-
{form.formState.isSubmitting ? '
|
|
118
|
+
{form.formState.isSubmitting ? translate('common.cards.delete.deleting') : translate('common.actions.delete')}
|
|
117
119
|
</Button>
|
|
118
120
|
<Button
|
|
119
121
|
type="button"
|
|
@@ -122,7 +124,7 @@ export function DeleteCardModal() {
|
|
|
122
124
|
onClick={handleClose}
|
|
123
125
|
disabled={form.formState.isSubmitting}
|
|
124
126
|
>
|
|
125
|
-
|
|
127
|
+
{translate('common.actions.cancel')}
|
|
126
128
|
</Button>
|
|
127
129
|
</div>
|
|
128
130
|
</form>
|
|
@@ -5,12 +5,14 @@ import { IconAlertOctagon, IconX } from '@tabler/icons-react';
|
|
|
5
5
|
import { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';
|
|
6
6
|
import { toCalendarDate } from '../../infra/utils/date';
|
|
7
7
|
import { getSubscriptionExpiryDate } from '../../modules/subscriptions/utils/get-subscription-expiry-date';
|
|
8
|
+
import { useTranslations } from 'next-intl';
|
|
8
9
|
|
|
9
10
|
interface CancelledSubscriptionBannerProps {
|
|
10
11
|
onReactivate?: () => void;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export function CancelledSubscriptionBanner({ onReactivate }: CancelledSubscriptionBannerProps) {
|
|
15
|
+
const translate = useTranslations();
|
|
14
16
|
const { data: { data: [subscription] = [] } = {} } = useActiveSubscription();
|
|
15
17
|
const [visible, setVisible] = useState(true);
|
|
16
18
|
const [animated, setAnimated] = useState(false);
|
|
@@ -40,7 +42,7 @@ export function CancelledSubscriptionBanner({ onReactivate }: CancelledSubscript
|
|
|
40
42
|
<div className="flex items-center gap-2 flex-1 w-full sm:w-auto">
|
|
41
43
|
<IconAlertOctagon size={16} className="text-white shrink-0" />
|
|
42
44
|
<span className="paragraph-xsmall-semibold text-white">
|
|
43
|
-
|
|
45
|
+
{translate('common.navigation.banners.cancelled.message')}
|
|
44
46
|
</span>
|
|
45
47
|
</div>
|
|
46
48
|
<div className="flex items-center gap-1.5 w-full sm:w-auto justify-between sm:justify-start">
|
|
@@ -50,7 +52,7 @@ export function CancelledSubscriptionBanner({ onReactivate }: CancelledSubscript
|
|
|
50
52
|
onClick={onReactivate}
|
|
51
53
|
>
|
|
52
54
|
<span className="paragraph-xsmall-semibold text-white underline">
|
|
53
|
-
|
|
55
|
+
{translate('common.navigation.banners.cancelled.choosePlan')}
|
|
54
56
|
</span>
|
|
55
57
|
</button>
|
|
56
58
|
<button type="button" className="cursor-pointer shrink-0" onClick={dismiss}>
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import { IconAlertTriangle, IconX } from '@tabler/icons-react';
|
|
5
|
+
import { useTranslations } from 'next-intl';
|
|
5
6
|
|
|
6
7
|
interface OverdueInvoiceBannerProps {
|
|
7
8
|
onDetails?: () => void;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export function OverdueInvoiceBanner({ onDetails }: OverdueInvoiceBannerProps) {
|
|
12
|
+
const translate = useTranslations();
|
|
11
13
|
const [visible, setVisible] = useState(true);
|
|
12
14
|
const [animated, setAnimated] = useState(false);
|
|
13
15
|
|
|
@@ -28,7 +30,7 @@ export function OverdueInvoiceBanner({ onDetails }: OverdueInvoiceBannerProps) {
|
|
|
28
30
|
<div className="flex items-center gap-2 flex-1 w-full sm:w-auto">
|
|
29
31
|
<IconAlertTriangle size={16} className="text-white shrink-0" />
|
|
30
32
|
<span className="paragraph-xsmall-semibold text-white">
|
|
31
|
-
|
|
33
|
+
{translate('common.navigation.banners.overdue.message')}
|
|
32
34
|
</span>
|
|
33
35
|
</div>
|
|
34
36
|
<div className="flex items-center gap-1.5 w-full sm:w-auto justify-between sm:justify-start">
|
|
@@ -37,7 +39,7 @@ export function OverdueInvoiceBanner({ onDetails }: OverdueInvoiceBannerProps) {
|
|
|
37
39
|
className="flex items-center justify-center p-1.5 cursor-pointer"
|
|
38
40
|
onClick={onDetails}
|
|
39
41
|
>
|
|
40
|
-
<span className="paragraph-xsmall-semibold text-white underline">
|
|
42
|
+
<span className="paragraph-xsmall-semibold text-white underline">{translate('common.navigation.banners.overdue.details')}</span>
|
|
41
43
|
</button>
|
|
42
44
|
<button type="button" className="cursor-pointer shrink-0" onClick={dismiss}>
|
|
43
45
|
<IconX size={18} className="text-orange-200" />
|