@greatapps/common 1.1.674 → 1.1.675
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/ConfigurationsMyAccountModal.mjs +6 -8
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
- package/dist/components/account/ConfirmDeleteAccountModal.mjs +19 -20
- package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +11 -10
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -1
- package/dist/components/account/DeleteAccountModal.mjs +28 -34
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/DisableTwoFactorAuthModal.mjs +5 -7
- package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +9 -8
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/TwoFactorAuthModal.mjs +23 -22
- package/dist/components/account/TwoFactorAuthModal.mjs.map +1 -1
- package/dist/components/account/constants.mjs +4 -4
- package/dist/components/account/constants.mjs.map +1 -1
- package/dist/components/account/hooks/useChangeEmailForm.mjs +3 -5
- package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -1
- package/dist/components/account/hooks/useChangePasswordForm.mjs +3 -26
- package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -1
- package/dist/components/account/hooks/useChangePhoneForm.mjs +9 -18
- package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -1
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +3 -26
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -1
- package/dist/components/account/hooks/useOtpVerification.mjs +3 -19
- package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -1
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +4 -27
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -1
- package/dist/components/account/sections/ChangeEmailModal.mjs +28 -25
- package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -1
- package/dist/components/account/sections/ChangePasswordSection.mjs +6 -8
- package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
- package/dist/components/account/sections/ChangePhoneModal.mjs +27 -24
- package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -1
- package/dist/components/account/sections/MyProfileSection.mjs +22 -37
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
- package/dist/components/account/sections/PreferencesSection.mjs +24 -48
- package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
- package/dist/components/account/sections/SecuritySection.mjs +9 -11
- package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
- package/dist/components/account/sections/TokenSection.mjs +8 -24
- package/dist/components/account/sections/TokenSection.mjs.map +1 -1
- package/dist/components/layouts/AppMobileNavBar.mjs +148 -2
- package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -1
- package/dist/components/layouts/NavBar.mjs +3 -5
- package/dist/components/layouts/NavBar.mjs.map +1 -1
- package/dist/components/layouts/NotificationsPopover.mjs +3 -5
- package/dist/components/layouts/NotificationsPopover.mjs.map +1 -1
- package/dist/components/layouts/ProfilePopover.mjs +4 -6
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/layouts/UsersSelectorPopover.mjs +7 -9
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
- package/dist/components/modals/BuyCreditsModal.mjs +18 -17
- package/dist/components/modals/BuyCreditsModal.mjs.map +1 -1
- package/dist/components/modals/CreditsDisabledModal.mjs +4 -6
- package/dist/components/modals/CreditsDisabledModal.mjs.map +1 -1
- package/dist/components/modals/PaidPlanRequiredModal.mjs +3 -5
- package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
- package/dist/components/modals/cards/AddCardModal.mjs +24 -27
- package/dist/components/modals/cards/AddCardModal.mjs.map +1 -1
- package/dist/components/modals/cards/CannotDeleteCardModal.mjs +7 -9
- package/dist/components/modals/cards/CannotDeleteCardModal.mjs.map +1 -1
- package/dist/components/modals/cards/CardFormFields.mjs +22 -25
- package/dist/components/modals/cards/CardFormFields.mjs.map +1 -1
- package/dist/components/modals/cards/DeleteCardModal.mjs +8 -10
- package/dist/components/modals/cards/DeleteCardModal.mjs.map +1 -1
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs +2 -4
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
- package/dist/components/navigation/OverdueInvoiceBanner.mjs +2 -4
- package/dist/components/navigation/OverdueInvoiceBanner.mjs.map +1 -1
- package/dist/components/navigation/PendingCancellationBanner.mjs +6 -4
- package/dist/components/navigation/PendingCancellationBanner.mjs.map +1 -1
- package/dist/components/navigation/ProjectSelectorPopover.mjs +6 -8
- package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -1
- package/dist/components/navigation/UpcomingInvoiceBanner.mjs +6 -4
- package/dist/components/navigation/UpcomingInvoiceBanner.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/BottomLinks.mjs +3 -5
- package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/CreditsCard.mjs +1 -3
- package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/PlanCard.mjs +1 -3
- package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs +3 -5
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
- package/dist/components/pages/NotFoundPage.mjs +3 -5
- package/dist/components/pages/NotFoundPage.mjs.map +1 -1
- package/dist/components/pages/notifications/Notifications.mjs +10 -13
- package/dist/components/pages/notifications/Notifications.mjs.map +1 -1
- package/dist/components/ui/buttons/CopyButton.mjs +5 -9
- package/dist/components/ui/buttons/CopyButton.mjs.map +1 -1
- package/dist/components/ui/data-display/CardItem.mjs +5 -7
- package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
- package/dist/components/ui/data-display/PaymentInfoCard.mjs +8 -10
- package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -1
- package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs +1 -3
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -1
- package/dist/components/ui/form/ComboboxField.mjs +6 -11
- package/dist/components/ui/form/ComboboxField.mjs.map +1 -1
- package/dist/components/ui/form/DatePicker.mjs +2 -5
- package/dist/components/ui/form/DatePicker.mjs.map +1 -1
- package/dist/components/ui/form/DateRangePicker.mjs +2 -5
- package/dist/components/ui/form/DateRangePicker.mjs.map +1 -1
- package/dist/components/ui/form/PhoneInput.mjs +3 -5
- package/dist/components/ui/form/PhoneInput.mjs.map +1 -1
- package/dist/components/ui/form/SelectField.mjs +3 -6
- package/dist/components/ui/form/SelectField.mjs.map +1 -1
- package/dist/components/widgets/ImageUpload/ImageCropModal.mjs +18 -11
- package/dist/components/widgets/ImageUpload/ImageCropModal.mjs.map +1 -1
- package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs +15 -6
- package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs.map +1 -1
- package/dist/index.mjs +2 -16
- package/dist/index.mjs.map +1 -1
- package/dist/modules/cards/hooks/handle-delete-card.hook.mjs +1 -2
- package/dist/modules/cards/hooks/handle-delete-card.hook.mjs.map +1 -1
- package/dist/modules/images/utils/validate-image.mjs +8 -8
- package/dist/modules/images/utils/validate-image.mjs.map +1 -1
- package/dist/modules/plans/types/plan.type.mjs +0 -3
- package/dist/modules/plans/types/plan.type.mjs.map +1 -1
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs +34 -56
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/periodicity.mjs +14 -20
- package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
- package/dist/providers/auth.provider.mjs +1 -9
- package/dist/providers/auth.provider.mjs.map +1 -1
- package/dist/server.mjs +0 -2
- package/dist/server.mjs.map +1 -1
- package/dist/utils/format/currency.mjs +4 -32
- package/dist/utils/format/currency.mjs.map +1 -1
- package/dist/utils/intl/locales.mjs +2 -3
- package/dist/utils/intl/locales.mjs.map +1 -1
- package/package.json +1 -7
- package/src/components/account/ConfigurationsMyAccountModal.tsx +6 -10
- package/src/components/account/ConfirmDeleteAccountModal.tsx +13 -22
- package/src/components/account/ConfirmGlobalPreferencesModal.tsx +10 -12
- package/src/components/account/DeleteAccountModal.tsx +24 -34
- package/src/components/account/DisableTwoFactorAuthModal.tsx +6 -11
- package/src/components/account/IsntPossibleDeleteAccountModal.tsx +6 -8
- package/src/components/account/TwoFactorAuthModal.tsx +29 -33
- package/src/components/account/constants.ts +5 -8
- package/src/components/account/hooks/useChangeEmailForm.tsx +3 -5
- package/src/components/account/hooks/useChangePasswordForm.tsx +6 -20
- package/src/components/account/hooks/useChangePhoneForm.tsx +10 -16
- package/src/components/account/hooks/useDisableTwoFactorAuthForm.tsx +6 -20
- package/src/components/account/hooks/useOtpVerification.tsx +4 -16
- package/src/components/account/hooks/useTwoFactorAuthForm.tsx +7 -21
- package/src/components/account/sections/ChangeEmailModal.tsx +21 -35
- package/src/components/account/sections/ChangePasswordSection.tsx +6 -10
- package/src/components/account/sections/ChangePhoneModal.tsx +22 -50
- package/src/components/account/sections/MyProfileSection.tsx +23 -37
- package/src/components/account/sections/PreferencesSection.tsx +25 -52
- package/src/components/account/sections/SecuritySection.tsx +10 -19
- package/src/components/account/sections/TokenSection.tsx +10 -22
- package/src/components/layouts/AppMobileNavBar.tsx +154 -1
- package/src/components/layouts/NavBar.tsx +3 -5
- package/src/components/layouts/NotificationsPopover.tsx +3 -5
- package/src/components/layouts/ProfilePopover.tsx +4 -6
- package/src/components/layouts/UsersSelectorPopover.tsx +7 -9
- package/src/components/modals/BuyCreditsModal.tsx +16 -18
- package/src/components/modals/CreditsDisabledModal.tsx +6 -6
- package/src/components/modals/PaidPlanRequiredModal.tsx +3 -5
- package/src/components/modals/cards/AddCardModal.tsx +27 -29
- package/src/components/modals/cards/CannotDeleteCardModal.tsx +8 -9
- package/src/components/modals/cards/CardFormFields.tsx +22 -25
- package/src/components/modals/cards/DeleteCardModal.tsx +8 -10
- package/src/components/navigation/CancelledSubscriptionBanner.tsx +2 -4
- package/src/components/navigation/OverdueInvoiceBanner.tsx +2 -4
- package/src/components/navigation/PendingCancellationBanner.tsx +2 -4
- package/src/components/navigation/ProjectSelectorPopover.tsx +6 -8
- package/src/components/navigation/UpcomingInvoiceBanner.tsx +2 -4
- package/src/components/navigation/subcomponents/BottomLinks.tsx +3 -5
- package/src/components/navigation/subcomponents/CreditsCard.tsx +1 -3
- package/src/components/navigation/subcomponents/PlanCard.tsx +1 -3
- package/src/components/navigation/subcomponents/ProjectSelector.tsx +3 -5
- package/src/components/pages/NotFoundPage.tsx +3 -5
- package/src/components/pages/notifications/Notifications.tsx +10 -13
- package/src/components/ui/buttons/CopyButton.tsx +5 -10
- package/src/components/ui/data-display/CardItem.tsx +5 -7
- package/src/components/ui/data-display/PaymentInfoCard.tsx +8 -10
- package/src/components/ui/feedback/CircularProgress.tsx +0 -4
- package/src/components/ui/feedback/DefaultCircularProgress.tsx +1 -3
- package/src/components/ui/form/ComboboxField.tsx +6 -11
- package/src/components/ui/form/DatePicker.tsx +2 -5
- package/src/components/ui/form/DateRangePicker.tsx +2 -5
- package/src/components/ui/form/PhoneInput.tsx +3 -5
- package/src/components/ui/form/SelectField.tsx +3 -6
- package/src/components/widgets/ImageUpload/ImageCropModal.tsx +11 -19
- package/src/components/widgets/ImageUpload/ImageTooSmallModal.tsx +5 -6
- package/src/index.ts +2 -12
- package/src/modules/cards/hooks/handle-delete-card.hook.ts +3 -8
- package/src/modules/images/utils/validate-image.ts +8 -23
- package/src/modules/plans/types/plan.type.ts +0 -3
- package/src/modules/plans/utils/map-api-plan-to-ui.ts +46 -103
- package/src/modules/subscriptions/utils/periodicity.ts +12 -29
- package/src/providers/auth.provider.tsx +1 -13
- package/src/server.ts +0 -2
- package/src/utils/format/currency.ts +7 -62
- package/src/utils/intl/locales.ts +2 -3
- package/dist/i18n/config.mjs +0 -13
- package/dist/i18n/config.mjs.map +0 -1
- package/dist/i18n/country-language.mjs +0 -74
- package/dist/i18n/country-language.mjs.map +0 -1
- package/dist/i18n/messages/en-us.mjs +0 -492
- package/dist/i18n/messages/en-us.mjs.map +0 -1
- package/dist/i18n/messages/es-es.mjs +0 -492
- package/dist/i18n/messages/es-es.mjs.map +0 -1
- package/dist/i18n/messages/index.mjs +0 -16
- package/dist/i18n/messages/index.mjs.map +0 -1
- package/dist/i18n/messages/pt-br.mjs +0 -505
- package/dist/i18n/messages/pt-br.mjs.map +0 -1
- package/dist/i18n/normalize.mjs +0 -12
- package/dist/i18n/normalize.mjs.map +0 -1
- package/dist/i18n/resolve-locale.mjs +0 -42
- package/dist/i18n/resolve-locale.mjs.map +0 -1
- package/dist/i18n.mjs +0 -14
- package/dist/i18n.mjs.map +0 -1
- package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs +0 -20
- package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs.map +0 -1
- package/dist/utils/intl/cookie-domain.mjs +0 -17
- package/dist/utils/intl/cookie-domain.mjs.map +0 -1
- package/dist/utils/intl/locale-cookie.mjs +0 -13
- package/dist/utils/intl/locale-cookie.mjs.map +0 -1
- package/src/i18n/config.ts +0 -17
- package/src/i18n/country-language.ts +0 -60
- package/src/i18n/messages/en-us.ts +0 -512
- package/src/i18n/messages/es-es.ts +0 -513
- package/src/i18n/messages/index.ts +0 -24
- package/src/i18n/messages/pt-br.ts +0 -536
- package/src/i18n/normalize.ts +0 -15
- package/src/i18n/resolve-locale.ts +0 -77
- package/src/i18n.ts +0 -10
- package/src/modules/accounts/hooks/use-currency-formatter.hook.tsx +0 -32
- package/src/utils/intl/cookie-domain.ts +0 -29
- package/src/utils/intl/locale-cookie.ts +0 -18
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useTranslations } from "next-intl";
|
|
4
3
|
import { IconAlertTriangle } from "@tabler/icons-react";
|
|
5
4
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
|
|
6
5
|
import { Button } from "../ui/buttons/Button";
|
|
7
6
|
import { useAccountModals } from "../../store/useAccountModals";
|
|
8
7
|
function IsntPossibleDeleteAccountModal() {
|
|
9
|
-
const translate = useTranslations();
|
|
10
8
|
const { activeModal, close, config } = useAccountModals();
|
|
11
9
|
const { onGoToSubscription } = config;
|
|
12
10
|
const open = activeModal === "isntPossibleDelete";
|
|
@@ -14,22 +12,25 @@ function IsntPossibleDeleteAccountModal() {
|
|
|
14
12
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
15
13
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5", children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, className: "text-red-500" }) }),
|
|
16
14
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "p-0 gap-2", children: [
|
|
17
|
-
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children:
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: "N\xE3o \xE9 poss\xEDvel excluir a conta" }),
|
|
16
|
+
/* @__PURE__ */ jsxs(DialogDescription, { className: "paragraph-small-regular text-gray-600", children: [
|
|
17
|
+
"Voc\xEA tem uma assinatura ativa. Para excluir sua conta,",
|
|
18
|
+
" ",
|
|
19
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-950", children: "primeiro cancele a assinatura" }),
|
|
20
|
+
" na p\xE1gina Assinatura e depois tente novamente."
|
|
21
|
+
] })
|
|
21
22
|
] })
|
|
22
23
|
] }),
|
|
23
24
|
/* @__PURE__ */ jsx("div", { className: "h-px bg-gray-200 -mx-6" }),
|
|
24
25
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2", children: [
|
|
25
|
-
/* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: close, children:
|
|
26
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: close, children: "Ok, entendi" }),
|
|
26
27
|
/* @__PURE__ */ jsx(
|
|
27
28
|
Button,
|
|
28
29
|
{
|
|
29
30
|
variant: "secondary",
|
|
30
31
|
className: "h-10 flex-1",
|
|
31
32
|
onClick: onGoToSubscription ?? close,
|
|
32
|
-
children:
|
|
33
|
+
children: "Ir para assinatura"
|
|
33
34
|
}
|
|
34
35
|
)
|
|
35
36
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/account/IsntPossibleDeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/IsntPossibleDeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconAlertTriangle } from '@tabler/icons-react';\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Button } from '../ui/buttons/Button';\nimport { useAccountModals } from '../../store/useAccountModals';\n\nexport default function IsntPossibleDeleteAccountModal() {\n const { activeModal, close, config } = useAccountModals();\n const { onGoToSubscription } = config;\n const open = activeModal === 'isntPossibleDelete';\n\n return (\n <Dialog open={open} onOpenChange={close}>\n <DialogContent className=\"max-w-[calc(100%-2rem)]! w-full rounded-lg border sm:max-w-[400px]! lg:max-w-[470px]! lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!\">\n <div className=\"flex flex-col gap-5\">\n <div className=\"flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5\">\n <IconAlertTriangle size={20} className=\"text-red-500\" />\n </div>\n <DialogHeader className=\"p-0 gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950\">\n Não é possível excluir a conta\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-gray-600\">\n Você tem uma assinatura ativa. Para excluir sua conta,{' '}\n <span className=\"font-semibold text-gray-950\">primeiro cancele a assinatura</span> na\n página Assinatura e depois tente novamente.\n </DialogDescription>\n </DialogHeader>\n </div>\n\n <div className=\"h-px bg-gray-200 -mx-6\" />\n\n <div className=\"flex flex-row items-center gap-2\">\n <Button className=\"h-10 flex-1\" onClick={close}>\n Ok, entendi\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10 flex-1\"\n onClick={onGoToSubscription ?? close}\n >\n Ir para assinatura\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAiBY,cAMA,YANA;AAfZ,SAAS,yBAAyB;AAClC,SAAS,QAAQ,eAAe,mBAAmB,cAAc,mBAAmB;AACpF,SAAS,cAAc;AACvB,SAAS,wBAAwB;AAElB,SAAR,iCAAkD;AACvD,QAAM,EAAE,aAAa,OAAO,OAAO,IAAI,iBAAiB;AACxD,QAAM,EAAE,mBAAmB,IAAI;AAC/B,QAAM,OAAO,gBAAgB;AAE7B,SACE,oBAAC,UAAO,MAAY,cAAc,OAChC,+BAAC,iBAAc,WAAU,mMACvB;AAAA,yBAAC,SAAI,WAAU,uBACb;AAAA,0BAAC,SAAI,WAAU,qEACb,8BAAC,qBAAkB,MAAM,IAAI,WAAU,gBAAe,GACxD;AAAA,MACA,qBAAC,gBAAa,WAAU,aACtB;AAAA,4BAAC,eAAY,WAAU,2CAA0C,qDAEjE;AAAA,QACA,qBAAC,qBAAkB,WAAU,yCAAwC;AAAA;AAAA,UACZ;AAAA,UACvD,oBAAC,UAAK,WAAU,+BAA8B,2CAA6B;AAAA,UAAO;AAAA,WAEpF;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,SAAI,WAAU,0BAAyB;AAAA,IAExC,qBAAC,SAAI,WAAU,oCACb;AAAA,0BAAC,UAAO,WAAU,eAAc,SAAS,OAAO,yBAEhD;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,SAAS,sBAAsB;AAAA,UAChC;AAAA;AAAA,MAED;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useTranslations } from "next-intl";
|
|
4
3
|
import { IconX, IconCopy, IconRefresh } from "@tabler/icons-react";
|
|
5
4
|
import { Button } from "../ui/buttons/Button";
|
|
6
5
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
|
|
@@ -9,7 +8,6 @@ import { InputOTP, InputOTPGroup, InputOTPSlot } from "../ui/form/InputOtp";
|
|
|
9
8
|
import { REGEXP_ONLY_DIGITS } from "input-otp";
|
|
10
9
|
import useTwoFactorAuthForm from "./hooks/useTwoFactorAuthForm";
|
|
11
10
|
function TwoFactorAuthModal({ open, onClose, onSuccess }) {
|
|
12
|
-
const translate = useTranslations();
|
|
13
11
|
const {
|
|
14
12
|
code,
|
|
15
13
|
setCode,
|
|
@@ -38,9 +36,9 @@ function TwoFactorAuthModal({ open, onClose, onSuccess }) {
|
|
|
38
36
|
overlayClassName: "z-[1010]",
|
|
39
37
|
className: "z-[1011] flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] lg:h-auto lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%]",
|
|
40
38
|
children: [
|
|
41
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children:
|
|
39
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "C\xF3digos de seguran\xE7a" }) }),
|
|
42
40
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0", children: [
|
|
43
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950 text-center", children:
|
|
41
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950 text-center", children: "C\xF3digos de seguran\xE7a" }),
|
|
44
42
|
/* @__PURE__ */ jsx(
|
|
45
43
|
Button,
|
|
46
44
|
{
|
|
@@ -54,11 +52,11 @@ function TwoFactorAuthModal({ open, onClose, onSuccess }) {
|
|
|
54
52
|
] }),
|
|
55
53
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 lg:gap-6 px-4 lg:px-5 py-5 lg:py-6 flex-1 lg:flex-none", children: [
|
|
56
54
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
57
|
-
/* @__PURE__ */ jsx("h3", { className: "paragraph-medium-semibold text-gray-950 max-w-[269px]", children:
|
|
55
|
+
/* @__PURE__ */ jsx("h3", { className: "paragraph-medium-semibold text-gray-950 max-w-[269px]", children: "Salve estes c\xF3digos de recupera\xE7\xE3o de emerg\xEAncia" }),
|
|
58
56
|
/* @__PURE__ */ jsxs("div", { className: "paragraph-small-regular text-gray-600", children: [
|
|
59
|
-
/* @__PURE__ */ jsx("p", { children:
|
|
57
|
+
/* @__PURE__ */ jsx("p", { children: "Se voc\xEA perder acesso ao seu telefone, n\xE3o ser\xE1 poss\xEDvel fazer login em sua conta sem um c\xF3digo de dois fatores." }),
|
|
60
58
|
/* @__PURE__ */ jsx("br", {}),
|
|
61
|
-
/* @__PURE__ */ jsx("p", { children:
|
|
59
|
+
/* @__PURE__ */ jsx("p", { children: "Imprima, copie ou escreva em um local seguro os c\xF3digos abaixo." })
|
|
62
60
|
] })
|
|
63
61
|
] }),
|
|
64
62
|
/* @__PURE__ */ jsxs("div", { className: "bg-gray-50 rounded-lg p-4 flex flex-col gap-4", children: [
|
|
@@ -72,15 +70,15 @@ function TwoFactorAuthModal({ open, onClose, onSuccess }) {
|
|
|
72
70
|
onClick: handleCopyCodes,
|
|
73
71
|
children: [
|
|
74
72
|
/* @__PURE__ */ jsx(IconCopy, { size: 16 }),
|
|
75
|
-
|
|
73
|
+
"Copiar c\xF3digos"
|
|
76
74
|
]
|
|
77
75
|
}
|
|
78
76
|
)
|
|
79
77
|
] })
|
|
80
78
|
] }),
|
|
81
79
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between mt-auto lg:mt-0", children: [
|
|
82
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children:
|
|
83
|
-
/* @__PURE__ */ jsx(Button, { className: "h-10!", type: "button", onClick: handleFinalize, children:
|
|
80
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children: "Cancelar" }),
|
|
81
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10!", type: "button", onClick: handleFinalize, children: "Finalizar" })
|
|
84
82
|
] })
|
|
85
83
|
]
|
|
86
84
|
}
|
|
@@ -93,9 +91,9 @@ function TwoFactorAuthModal({ open, onClose, onSuccess }) {
|
|
|
93
91
|
overlayClassName: "z-[1010]",
|
|
94
92
|
className: "z-[1011] flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] lg:h-auto lg:max-h-[90vh] lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%]",
|
|
95
93
|
children: [
|
|
96
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children:
|
|
94
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "Autentica\xE7\xE3o de dois fatores" }) }),
|
|
97
95
|
/* @__PURE__ */ jsxs("div", { className: "shrink-0 flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0", children: [
|
|
98
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950 text-center", children:
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950 text-center", children: "Autentica\xE7\xE3o de dois fatores" }),
|
|
99
97
|
/* @__PURE__ */ jsx(
|
|
100
98
|
Button,
|
|
101
99
|
{
|
|
@@ -117,18 +115,21 @@ function TwoFactorAuthModal({ open, onClose, onSuccess }) {
|
|
|
117
115
|
},
|
|
118
116
|
children: [
|
|
119
117
|
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto overscroll-contain lg:overflow-visible", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4 lg:gap-8 px-4 lg:px-5 py-4 lg:py-6 pb-60 lg:pb-6", children: [
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
|
|
118
|
+
/* @__PURE__ */ jsxs("p", { className: "paragraph-small-regular text-gray-950 text-center max-w-full lg:max-w-[412px]", children: [
|
|
119
|
+
"Instale um aplicativo autenticador no seu celular (ex.:",
|
|
120
|
+
" ",
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
122
|
"a",
|
|
123
123
|
{
|
|
124
124
|
href: "https://support.google.com/accounts/answer/1066447",
|
|
125
125
|
target: "_blank",
|
|
126
126
|
rel: "noopener noreferrer",
|
|
127
127
|
className: "paragraph-small-medium underline",
|
|
128
|
-
children:
|
|
128
|
+
children: "Google Authenticator"
|
|
129
129
|
}
|
|
130
|
-
)
|
|
131
|
-
|
|
130
|
+
),
|
|
131
|
+
"), escaneie o QR Code ao lado ou copie a chave no aplicativo e, em seguida, digite o c\xF3digo de 6 d\xEDgitos gerado para continuar."
|
|
132
|
+
] }),
|
|
132
133
|
/* @__PURE__ */ jsx("div", { className: "border border-gray-200 rounded-lg overflow-hidden p-2 lg:p-3 flex items-center justify-center w-[136px] h-[136px] lg:w-[203px] lg:h-[203px]", children: generateFailed ? /* @__PURE__ */ jsxs(
|
|
133
134
|
"button",
|
|
134
135
|
{
|
|
@@ -137,7 +138,7 @@ function TwoFactorAuthModal({ open, onClose, onSuccess }) {
|
|
|
137
138
|
className: "flex flex-col items-center gap-1.5 text-center",
|
|
138
139
|
children: [
|
|
139
140
|
/* @__PURE__ */ jsx(IconRefresh, { size: 20, className: "text-gray-400" }),
|
|
140
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-gray-500", children:
|
|
141
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-gray-500", children: "Tentar novamente" })
|
|
141
142
|
]
|
|
142
143
|
}
|
|
143
144
|
) : isGenerating || !qrcode ? /* @__PURE__ */ jsx("div", { className: "skeleton w-full h-full rounded" }) : (
|
|
@@ -146,14 +147,14 @@ function TwoFactorAuthModal({ open, onClose, onSuccess }) {
|
|
|
146
147
|
"img",
|
|
147
148
|
{
|
|
148
149
|
src: qrcode,
|
|
149
|
-
alt:
|
|
150
|
+
alt: "QR Code para autentica\xE7\xE3o de dois fatores",
|
|
150
151
|
className: "w-full h-full"
|
|
151
152
|
}
|
|
152
153
|
)
|
|
153
154
|
) }),
|
|
154
155
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 w-full", children: [
|
|
155
156
|
/* @__PURE__ */ jsx(Separator, { className: "flex-1" }),
|
|
156
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-gray-500 opacity-80 whitespace-nowrap", children:
|
|
157
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-gray-500 opacity-80 whitespace-nowrap", children: "Cole os 6 d\xEDgitos abaixo" }),
|
|
157
158
|
/* @__PURE__ */ jsx(Separator, { className: "flex-1" })
|
|
158
159
|
] }),
|
|
159
160
|
/* @__PURE__ */ jsx("div", { className: "scroll-mt-20", children: /* @__PURE__ */ jsx(InputOTP, { maxLength: 6, pattern: REGEXP_ONLY_DIGITS, value: code, onChange: setCode, children: /* @__PURE__ */ jsx(InputOTPGroup, { className: "gap-2", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx(
|
|
@@ -166,8 +167,8 @@ function TwoFactorAuthModal({ open, onClose, onSuccess }) {
|
|
|
166
167
|
)) }) }) })
|
|
167
168
|
] }) }),
|
|
168
169
|
/* @__PURE__ */ jsxs("div", { className: "shrink-0 flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between gap-2 bg-white", children: [
|
|
169
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children:
|
|
170
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", className: "h-10!", disabled: !isCodeComplete || isConfirming, children: isConfirming ?
|
|
170
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10!", type: "button", onClick: handleClose, children: "Cancelar" }),
|
|
171
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", className: "h-10!", disabled: !isCodeComplete || isConfirming, children: isConfirming ? "Ativando..." : "Ativar autentica\xE7\xE3o" })
|
|
171
172
|
] })
|
|
172
173
|
]
|
|
173
174
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/account/TwoFactorAuthModal.tsx"],"sourcesContent":["'use client';\n\nimport { useTranslations } from 'next-intl';\nimport { IconX, IconCopy, IconRefresh } from '@tabler/icons-react';\nimport { Button } from '../ui/buttons/Button';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Separator } from '../ui/data-display/Separator';\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from '../ui/form/InputOtp';\nimport { REGEXP_ONLY_DIGITS } from 'input-otp';\nimport useTwoFactorAuthForm from './hooks/useTwoFactorAuthForm';\n\ninterface TwoFactorAuthModalProps {\n open: boolean;\n onClose: () => void;\n onSuccess?: () => void;\n}\n\nexport default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFactorAuthModalProps) {\n const translate = useTranslations();\n const {\n code,\n setCode,\n isCodeComplete,\n isGenerating,\n isConfirming,\n generateFailed,\n retryGenerate,\n qrcode,\n backupCodes,\n step,\n handleSubmit,\n handleFinalize,\n handleCopyCodes,\n resetForm,\n } = useTwoFactorAuthForm({ onSuccess, open });\n\n const handleClose = () => {\n resetForm();\n onClose();\n };\n\n if (step === 'recovery') {\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent\n showCloseButton={false}\n overlayClassName=\"z-[1010]\"\n className=\"z-[1011] flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] lg:h-auto lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{translate('common.account.twoFactor.recoveryTitle')}</DialogTitle>\n </DialogHeader>\n <div className=\"flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0\">\n <span className=\"paragraph-medium-semibold text-gray-950 text-center\">\n {translate('common.account.twoFactor.recoveryTitle')}\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n className=\"size-8! p-0 absolute right-4\"\n onClick={handleClose}\n >\n <IconX size={18} />\n </Button>\n </div>\n\n <div className=\"flex flex-col gap-5 lg:gap-6 px-4 lg:px-5 py-5 lg:py-6 flex-1 lg:flex-none\">\n <div className=\"flex flex-col gap-2\">\n <h3 className=\"paragraph-medium-semibold text-gray-950 max-w-[269px]\">\n {translate('common.account.twoFactor.recoveryHeading')}\n </h3>\n <div className=\"paragraph-small-regular text-gray-600\">\n <p>{translate('common.account.twoFactor.recoveryText1')}</p>\n <br />\n <p>{translate('common.account.twoFactor.recoveryText2')}</p>\n </div>\n </div>\n\n <div className=\"bg-gray-50 rounded-lg p-4 flex flex-col gap-4\">\n <div className=\"paragraph-small-medium text-gray-950 whitespace-nowrap\">\n {backupCodes.map((backupCode, i) => (\n <p key={i}>{backupCode}</p>\n ))}\n </div>\n <Button\n type=\"button\"\n variant=\"secondary\"\n className=\"h-8! w-fit\"\n onClick={handleCopyCodes}\n >\n <IconCopy size={16} />\n {translate('common.account.twoFactor.copyCodes')}\n </Button>\n </div>\n </div>\n\n <div className=\"flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between mt-auto lg:mt-0\">\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={handleClose}>\n {translate('common.actions.cancel')}\n </Button>\n <Button className=\"h-10!\" type=\"button\" onClick={handleFinalize}>\n {translate('common.account.twoFactor.finish')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n }\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent\n showCloseButton={false}\n overlayClassName=\"z-[1010]\"\n className=\"z-[1011] flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] lg:h-auto lg:max-h-[90vh] lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{translate('common.account.twoFactor.title')}</DialogTitle>\n </DialogHeader>\n <div className=\"shrink-0 flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0\">\n <span className=\"paragraph-medium-semibold text-gray-950 text-center\">\n {translate('common.account.twoFactor.title')}\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n className=\"size-8! p-0 absolute right-4\"\n onClick={handleClose}\n >\n <IconX size={18} />\n </Button>\n </div>\n\n <form\n className=\"flex-1 min-h-0 flex flex-col\"\n onSubmit={(e) => {\n e.preventDefault();\n if (isCodeComplete) handleSubmit();\n }}\n >\n <div className=\"flex-1 min-h-0 overflow-y-auto overscroll-contain lg:overflow-visible\">\n <div className=\"flex flex-col items-center gap-4 lg:gap-8 px-4 lg:px-5 py-4 lg:py-6 pb-60 lg:pb-6\">\n <p className=\"paragraph-small-regular text-gray-950 text-center max-w-full lg:max-w-[412px]\">\n {translate.rich('common.account.twoFactor.instructions', {\n link: (chunks) => (\n <a\n href=\"https://support.google.com/accounts/answer/1066447\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"paragraph-small-medium underline\"\n >\n {chunks}\n </a>\n ),\n })}\n </p>\n\n <div className=\"border border-gray-200 rounded-lg overflow-hidden p-2 lg:p-3 flex items-center justify-center w-[136px] h-[136px] lg:w-[203px] lg:h-[203px]\">\n {generateFailed ? (\n <button\n type=\"button\"\n onClick={() => retryGenerate()}\n className=\"flex flex-col items-center gap-1.5 text-center\"\n >\n <IconRefresh size={20} className=\"text-gray-400\" />\n <span className=\"paragraph-xsmall-medium text-gray-500\">\n {translate('common.account.twoFactor.retry')}\n </span>\n </button>\n ) : isGenerating || !qrcode ? (\n <div className=\"skeleton w-full h-full rounded\" />\n ) : (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n src={qrcode}\n alt={translate('common.account.twoFactor.qrAlt')}\n className=\"w-full h-full\"\n />\n )}\n </div>\n\n <div className=\"flex items-center gap-3 w-full\">\n <Separator className=\"flex-1\" />\n <span className=\"paragraph-xsmall-medium text-gray-500 opacity-80 whitespace-nowrap\">\n {translate('common.account.twoFactor.pasteDigits')}\n </span>\n <Separator className=\"flex-1\" />\n </div>\n\n <div className=\"scroll-mt-20\">\n <InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS} value={code} onChange={setCode}>\n <InputOTPGroup className=\"gap-2\">\n {Array.from({ length: 6 }).map((_, i) => (\n <InputOTPSlot\n key={i}\n index={i}\n className=\"w-11! lg:w-12! h-13! lg:h-14! rounded-lg! text-lg border-gray-200\"\n />\n ))}\n </InputOTPGroup>\n </InputOTP>\n </div>\n </div>\n </div>\n\n <div className=\"shrink-0 flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between gap-2 bg-white\">\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={handleClose}>\n {translate('common.actions.cancel')}\n </Button>\n <Button type=\"submit\" className=\"h-10!\" disabled={!isCodeComplete || isConfirming}>\n {isConfirming\n ? translate('common.account.twoFactor.activating')\n : translate('common.account.twoFactor.activate')}\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAkDY,cAEF,YAFE;AAhDZ,SAAS,uBAAuB;AAChC,SAAS,OAAO,UAAU,mBAAmB;AAC7C,SAAS,cAAc;AACvB,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,iBAAiB;AAC1B,SAAS,UAAU,eAAe,oBAAoB;AACtD,SAAS,0BAA0B;AACnC,OAAO,0BAA0B;AAQlB,SAAR,mBAAoC,EAAE,MAAM,SAAS,UAAU,GAA4B;AAChG,QAAM,YAAY,gBAAgB;AAClC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,qBAAqB,EAAE,WAAW,KAAK,CAAC;AAE5C,QAAM,cAAc,MAAM;AACxB,cAAU;AACV,YAAQ;AAAA,EACV;AAEA,MAAI,SAAS,YAAY;AACvB,WACE,oBAAC,UAAO,MAA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AK,WAAU,yCACb,oBAAU,gCAAgC,GAC7C;AAAA;AAAA;AAAA,gBACF,IACE,gBAAgB,CAAC,SACnB,oBAAC,SAAI,WAAU,kCAAiC;AAAA;AAAA,kBAGhD;AAAA,oBAAC;AAAA;AAAA,sBACC,KAAK;AAAA,sBACL,KAAK,UAAU,gCAAgC;AAAA,sBAC/C,WAAU;AAAA;AAAA,kBACZ;AAAA,mBAEJ;AAAA,gBAEA,qBAAC,SAAI,WAAU,kCACb;AAAA,sCAAC,aAAU,WAAU,UAAS;AAAA,kBAC9B,oBAAC,UAAK,WAAU,sEACb,oBAAU,sCAAsC,GACnD;AAAA,kBACA,oBAAC,aAAU,WAAU,UAAS;AAAA,mBAChC;AAAA,gBAEA,oBAAC,SAAI,WAAU,gBACb,8BAAC,YAAS,WAAW,GAAG,SAAS,oBAAoB,OAAO,MAAM,UAAU,SAC1E,8BAAC,iBAAc,WAAU,SACtB,gBAAM,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,MACjC;AAAA,kBAAC;AAAA;AAAA,oBAEC,OAAO;AAAA,oBACP,WAAU;AAAA;AAAA,kBAFL;AAAA,gBAGP,CACD,GACH,GACF,GACF;AAAA,iBACF,GACF;AAAA,cAEA,qBAAC,SAAI,WAAU,iGACb;AAAA,oCAAC,UAAO,SAAQ,aAAY,WAAU,SAAQ,MAAK,UAAS,SAAS,aAClE,oBAAU,uBAAuB,GACpC;AAAA,gBACA,oBAAC,UAAO,MAAK,UAAS,WAAU,SAAQ,UAAU,CAAC,kBAAkB,cAClE,yBACG,UAAU,qCAAqC,IAC/C,UAAU,mCAAmC,GACnD;AAAA,iBACF;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/TwoFactorAuthModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconX, IconCopy, IconRefresh } from '@tabler/icons-react';\nimport { Button } from '../ui/buttons/Button';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Separator } from '../ui/data-display/Separator';\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from '../ui/form/InputOtp';\nimport { REGEXP_ONLY_DIGITS } from 'input-otp';\nimport useTwoFactorAuthForm from './hooks/useTwoFactorAuthForm';\n\ninterface TwoFactorAuthModalProps {\n open: boolean;\n onClose: () => void;\n onSuccess?: () => void;\n}\n\nexport default function TwoFactorAuthModal({ open, onClose, onSuccess }: TwoFactorAuthModalProps) {\n const {\n code,\n setCode,\n isCodeComplete,\n isGenerating,\n isConfirming,\n generateFailed,\n retryGenerate,\n qrcode,\n backupCodes,\n step,\n handleSubmit,\n handleFinalize,\n handleCopyCodes,\n resetForm,\n } = useTwoFactorAuthForm({ onSuccess, open });\n\n const handleClose = () => {\n resetForm();\n onClose();\n };\n\n if (step === 'recovery') {\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent\n showCloseButton={false}\n overlayClassName=\"z-[1010]\"\n className=\"z-[1011] flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] lg:h-auto lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Códigos de segurança</DialogTitle>\n </DialogHeader>\n <div className=\"flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0\">\n <span className=\"paragraph-medium-semibold text-gray-950 text-center\">\n Códigos de segurança\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n className=\"size-8! p-0 absolute right-4\"\n onClick={handleClose}\n >\n <IconX size={18} />\n </Button>\n </div>\n\n <div className=\"flex flex-col gap-5 lg:gap-6 px-4 lg:px-5 py-5 lg:py-6 flex-1 lg:flex-none\">\n <div className=\"flex flex-col gap-2\">\n <h3 className=\"paragraph-medium-semibold text-gray-950 max-w-[269px]\">\n Salve estes códigos de recuperação de emergência\n </h3>\n <div className=\"paragraph-small-regular text-gray-600\">\n <p>\n Se você perder acesso ao seu telefone, não será possível fazer login em sua conta\n sem um código de dois fatores.\n </p>\n <br />\n <p>Imprima, copie ou escreva em um local seguro os códigos abaixo.</p>\n </div>\n </div>\n\n <div className=\"bg-gray-50 rounded-lg p-4 flex flex-col gap-4\">\n <div className=\"paragraph-small-medium text-gray-950 whitespace-nowrap\">\n {backupCodes.map((backupCode, i) => (\n <p key={i}>{backupCode}</p>\n ))}\n </div>\n <Button\n type=\"button\"\n variant=\"secondary\"\n className=\"h-8! w-fit\"\n onClick={handleCopyCodes}\n >\n <IconCopy size={16} />\n Copiar códigos\n </Button>\n </div>\n </div>\n\n <div className=\"flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between mt-auto lg:mt-0\">\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={handleClose}>\n Cancelar\n </Button>\n <Button className=\"h-10!\" type=\"button\" onClick={handleFinalize}>\n Finalizar\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n }\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent\n showCloseButton={false}\n overlayClassName=\"z-[1010]\"\n className=\"z-[1011] flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-[470px] lg:h-auto lg:max-h-[90vh] lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Autenticação de dois fatores</DialogTitle>\n </DialogHeader>\n <div className=\"shrink-0 flex items-center justify-center px-4 py-3 relative border-b border-gray-200 lg:border-b-0\">\n <span className=\"paragraph-medium-semibold text-gray-950 text-center\">\n Autenticação de dois fatores\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n className=\"size-8! p-0 absolute right-4\"\n onClick={handleClose}\n >\n <IconX size={18} />\n </Button>\n </div>\n\n <form\n className=\"flex-1 min-h-0 flex flex-col\"\n onSubmit={(e) => {\n e.preventDefault();\n if (isCodeComplete) handleSubmit();\n }}\n >\n <div className=\"flex-1 min-h-0 overflow-y-auto overscroll-contain lg:overflow-visible\">\n <div className=\"flex flex-col items-center gap-4 lg:gap-8 px-4 lg:px-5 py-4 lg:py-6 pb-60 lg:pb-6\">\n <p className=\"paragraph-small-regular text-gray-950 text-center max-w-full lg:max-w-[412px]\">\n Instale um aplicativo autenticador no seu celular (ex.:{' '}\n <a\n href=\"https://support.google.com/accounts/answer/1066447\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"paragraph-small-medium underline\"\n >\n Google Authenticator\n </a>\n ), escaneie o QR Code ao lado ou copie a chave no aplicativo e, em seguida, digite o\n código de 6 dígitos gerado para continuar.\n </p>\n\n <div className=\"border border-gray-200 rounded-lg overflow-hidden p-2 lg:p-3 flex items-center justify-center w-[136px] h-[136px] lg:w-[203px] lg:h-[203px]\">\n {generateFailed ? (\n <button\n type=\"button\"\n onClick={() => retryGenerate()}\n className=\"flex flex-col items-center gap-1.5 text-center\"\n >\n <IconRefresh size={20} className=\"text-gray-400\" />\n <span className=\"paragraph-xsmall-medium text-gray-500\">Tentar novamente</span>\n </button>\n ) : isGenerating || !qrcode ? (\n <div className=\"skeleton w-full h-full rounded\" />\n ) : (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n src={qrcode}\n alt=\"QR Code para autenticação de dois fatores\"\n className=\"w-full h-full\"\n />\n )}\n </div>\n\n <div className=\"flex items-center gap-3 w-full\">\n <Separator className=\"flex-1\" />\n <span className=\"paragraph-xsmall-medium text-gray-500 opacity-80 whitespace-nowrap\">\n Cole os 6 dígitos abaixo\n </span>\n <Separator className=\"flex-1\" />\n </div>\n\n <div className=\"scroll-mt-20\">\n <InputOTP maxLength={6} pattern={REGEXP_ONLY_DIGITS} value={code} onChange={setCode}>\n <InputOTPGroup className=\"gap-2\">\n {Array.from({ length: 6 }).map((_, i) => (\n <InputOTPSlot\n key={i}\n index={i}\n className=\"w-11! lg:w-12! h-13! lg:h-14! rounded-lg! text-lg border-gray-200\"\n />\n ))}\n </InputOTPGroup>\n </InputOTP>\n </div>\n </div>\n </div>\n\n <div className=\"shrink-0 flex items-center p-4 lg:p-5 border-t border-gray-200 justify-between gap-2 bg-white\">\n <Button variant=\"secondary\" className=\"h-10!\" type=\"button\" onClick={handleClose}>\n Cancelar\n </Button>\n <Button type=\"submit\" className=\"h-10!\" disabled={!isCodeComplete || isConfirming}>\n {isConfirming ? 'Ativando...' : 'Ativar autenticação'}\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAgDY,cAEF,YAFE;AA9CZ,SAAS,OAAO,UAAU,mBAAmB;AAC7C,SAAS,cAAc;AACvB,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,iBAAiB;AAC1B,SAAS,UAAU,eAAe,oBAAoB;AACtD,SAAS,0BAA0B;AACnC,OAAO,0BAA0B;AAQlB,SAAR,mBAAoC,EAAE,MAAM,SAAS,UAAU,GAA4B;AAChG,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,qBAAqB,EAAE,WAAW,KAAK,CAAC;AAE5C,QAAM,cAAc,MAAM;AACxB,cAAU;AACV,YAAQ;AAAA,EACV;AAEA,MAAI,SAAS,YAAY;AACvB,WACE,oBAAC,UAAO,MAAY,cAAc,aAChC;AAAA,MAAC;AAAA;AAAA,QACC,iBAAiB;AAAA,QACjB,kBAAiB;AAAA,QACjB,WA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AAA,gBAEA,qBAAC,SAAI,WAAU,kCACb;AAAA,sCAAC,aAAU,WAAU,UAAS;AAAA,kBAC9B,oBAAC,UAAK,WAAU,sEAAqE,yCAErF;AAAA,kBACA,oBAAC,aAAU,WAAU,UAAS;AAAA,mBAChC;AAAA,gBAEA,oBAAC,SAAI,WAAU,gBACb,8BAAC,YAAS,WAAW,GAAG,SAAS,oBAAoB,OAAO,MAAM,UAAU,SAC1E,8BAAC,iBAAc,WAAU,SACtB,gBAAM,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,MACjC;AAAA,kBAAC;AAAA;AAAA,oBAEC,OAAO;AAAA,oBACP,WAAU;AAAA;AAAA,kBAFL;AAAA,gBAGP,CACD,GACH,GACF,GACF;AAAA,iBACF,GACF;AAAA,cAEA,qBAAC,SAAI,WAAU,iGACb;AAAA,oCAAC,UAAO,SAAQ,aAAY,WAAU,SAAQ,MAAK,UAAS,SAAS,aAAa,sBAElF;AAAA,gBACA,oBAAC,UAAO,MAAK,UAAS,WAAU,SAAQ,UAAU,CAAC,kBAAkB,cAClE,yBAAe,gBAAgB,6BAClC;AAAA,iBACF;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
|
|
@@ -14,10 +14,10 @@ const TIME_FORMAT_OPTIONS = [
|
|
|
14
14
|
{ value: "12h", label: "12 horas (AM/PM)", displayValue: "12 horas (AM/PM)" }
|
|
15
15
|
];
|
|
16
16
|
const NOTIFICATION_TYPES = [
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
17
|
+
"Atualiza\xE7\xF5es de projetos",
|
|
18
|
+
"Alertas de seguran\xE7a",
|
|
19
|
+
"Mudan\xE7as no plano ou faturamento",
|
|
20
|
+
"Manuten\xE7\xF5es programadas"
|
|
21
21
|
];
|
|
22
22
|
export {
|
|
23
23
|
CURRENCY_OPTIONS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/account/constants.ts"],"sourcesContent":["import { buildLocaleOptions } from '../../utils/intl/locales';\r\n\r\nexport const GENDER_OPTIONS = [\r\n { value: 'masculino', label: 'Masculino', apiValue: 1 },\r\n { value: 'feminino', label: 'Feminino', apiValue: 0 },\r\n];\r\n\r\nexport const LANGUAGE_OPTIONS = buildLocaleOptions();\r\n\r\nexport const CURRENCY_OPTIONS = [\r\n { value: 'BRL', label: 'BRL (R$)', displayValue: 'BRL (R$)' },\r\n { value: 'USD', label: 'USD ($)', displayValue: 'USD ($)' },\r\n { value: 'EUR', label: 'EUR (€)', displayValue: 'EUR (€)' },\r\n];\r\n\r\nexport const TIME_FORMAT_OPTIONS = [\r\n { value: '24h', label: '24 horas', displayValue: '24 horas' },\r\n { value: '12h', label: '12 horas (AM/PM)', displayValue: '12 horas (AM/PM)' },\r\n];\r\n\r\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/constants.ts"],"sourcesContent":["import { buildLocaleOptions } from '../../utils/intl/locales';\r\n\r\nexport const GENDER_OPTIONS = [\r\n { value: 'masculino', label: 'Masculino', apiValue: 1 },\r\n { value: 'feminino', label: 'Feminino', apiValue: 0 },\r\n];\r\n\r\nexport const LANGUAGE_OPTIONS = buildLocaleOptions();\r\n\r\nexport const CURRENCY_OPTIONS = [\r\n { value: 'BRL', label: 'BRL (R$)', displayValue: 'BRL (R$)' },\r\n { value: 'USD', label: 'USD ($)', displayValue: 'USD ($)' },\r\n { value: 'EUR', label: 'EUR (€)', displayValue: 'EUR (€)' },\r\n];\r\n\r\nexport const TIME_FORMAT_OPTIONS = [\r\n { value: '24h', label: '24 horas', displayValue: '24 horas' },\r\n { value: '12h', label: '12 horas (AM/PM)', displayValue: '12 horas (AM/PM)' },\r\n];\r\n\r\nexport const NOTIFICATION_TYPES = [\r\n 'Atualizações de projetos',\r\n 'Alertas de segurança',\r\n 'Mudanças no plano ou faturamento',\r\n 'Manutenções programadas',\r\n];\r\n"],"mappings":"AAAA,SAAS,0BAA0B;AAE5B,MAAM,iBAAiB;AAAA,EAC5B,EAAE,OAAO,aAAa,OAAO,aAAa,UAAU,EAAE;AAAA,EACtD,EAAE,OAAO,YAAY,OAAO,YAAY,UAAU,EAAE;AACtD;AAEO,MAAM,mBAAmB,mBAAmB;AAE5C,MAAM,mBAAmB;AAAA,EAC9B,EAAE,OAAO,OAAO,OAAO,YAAY,cAAc,WAAW;AAAA,EAC5D,EAAE,OAAO,OAAO,OAAO,WAAW,cAAc,UAAU;AAAA,EAC1D,EAAE,OAAO,OAAO,OAAO,gBAAW,cAAc,eAAU;AAC5D;AAEO,MAAM,sBAAsB;AAAA,EACjC,EAAE,OAAO,OAAO,OAAO,YAAY,cAAc,WAAW;AAAA,EAC5D,EAAE,OAAO,OAAO,OAAO,oBAAoB,cAAc,mBAAmB;AAC9E;AAEO,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
|
@@ -3,13 +3,11 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState, useCallback } from "react";
|
|
4
4
|
import { useForm } from "react-hook-form";
|
|
5
5
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
6
|
-
import { useTranslations } from "next-intl";
|
|
7
6
|
import { toast } from "sonner";
|
|
8
7
|
import { Toast } from "../../ui/feedback/Toast";
|
|
9
8
|
import { changeEmailSchema } from "../../../utils/validators/account";
|
|
10
9
|
import { requestEmailChangeAction } from "../../../modules/accounts/actions/account-management.action";
|
|
11
10
|
function useChangeEmailForm() {
|
|
12
|
-
const translate = useTranslations();
|
|
13
11
|
const [showVerification, setShowVerification] = useState(false);
|
|
14
12
|
const { register, handleSubmit, reset, watch, formState: { errors, isSubmitting } } = useForm({
|
|
15
13
|
resolver: zodResolver(changeEmailSchema),
|
|
@@ -19,12 +17,12 @@ function useChangeEmailForm() {
|
|
|
19
17
|
const handleContinue = handleSubmit(async (data) => {
|
|
20
18
|
const result = await requestEmailChangeAction(data.email);
|
|
21
19
|
if (!result.success) {
|
|
22
|
-
toast.custom((
|
|
20
|
+
toast.custom((t) => /* @__PURE__ */ jsx(
|
|
23
21
|
Toast,
|
|
24
22
|
{
|
|
25
23
|
variant: "error",
|
|
26
|
-
message: result.error ??
|
|
27
|
-
toastId
|
|
24
|
+
message: result.error ?? "E-mail j\xE1 existente ou ocorreu um erro. Tente novamente mais tarde.",
|
|
25
|
+
toastId: t
|
|
28
26
|
}
|
|
29
27
|
));
|
|
30
28
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/account/hooks/useChangeEmailForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { useForm } from 'react-hook-form';\r\nimport { zodResolver } from '@hookform/resolvers/zod';\r\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/account/hooks/useChangeEmailForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useState, useCallback } from 'react';\r\nimport { useForm } from 'react-hook-form';\r\nimport { zodResolver } from '@hookform/resolvers/zod';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { changeEmailSchema, type ChangeEmailFormData } from '../../../utils/validators/account';\r\nimport { requestEmailChangeAction } from '../../../modules/accounts/actions/account-management.action';\r\n\r\nexport default function useChangeEmailForm() {\r\n const [showVerification, setShowVerification] = useState(false);\r\n\r\n const { register, handleSubmit, reset, watch, formState: { errors, isSubmitting } } = useForm<ChangeEmailFormData>({\r\n resolver: zodResolver(changeEmailSchema),\r\n mode: 'onChange',\r\n defaultValues: { email: '' },\r\n });\r\n\r\n const handleContinue = handleSubmit(async (data) => {\r\n const result = await requestEmailChangeAction(data.email);\r\n\r\n if (!result.success) {\r\n toast.custom((t) => (\r\n <Toast\r\n variant=\"error\"\r\n message={result.error ?? 'E-mail já existente ou ocorreu um erro. Tente novamente mais tarde.'}\r\n toastId={t}\r\n />\r\n ));\r\n return;\r\n }\r\n\r\n setShowVerification(true);\r\n });\r\n\r\n const handleBack = useCallback(() => {\r\n setShowVerification(false);\r\n }, []);\r\n\r\n const resetForm = useCallback(() => {\r\n reset();\r\n setShowVerification(false);\r\n }, [reset]);\r\n\r\n return {\r\n showVerification,\r\n emailToVerify: watch('email'),\r\n isSubmitting,\r\n errors,\r\n register,\r\n handleContinue,\r\n handleBack,\r\n resetForm,\r\n };\r\n}\r\n"],"mappings":";AAwBQ;AAtBR,SAAS,UAAU,mBAAmB;AACtC,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,yBAAmD;AAC5D,SAAS,gCAAgC;AAE1B,SAAR,qBAAsC;AAC3C,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,KAAK;AAE9D,QAAM,EAAE,UAAU,cAAc,OAAO,OAAO,WAAW,EAAE,QAAQ,aAAa,EAAE,IAAI,QAA6B;AAAA,IACjH,UAAU,YAAY,iBAAiB;AAAA,IACvC,MAAM;AAAA,IACN,eAAe,EAAE,OAAO,GAAG;AAAA,EAC7B,CAAC;AAED,QAAM,iBAAiB,aAAa,OAAO,SAAS;AAClD,UAAM,SAAS,MAAM,yBAAyB,KAAK,KAAK;AAExD,QAAI,CAAC,OAAO,SAAS;AACnB,YAAM,OAAO,CAAC,MACZ;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,OAAO,SAAS;AAAA,UACzB,SAAS;AAAA;AAAA,MACX,CACD;AACD;AAAA,IACF;AAEA,wBAAoB,IAAI;AAAA,EAC1B,CAAC;AAED,QAAM,aAAa,YAAY,MAAM;AACnC,wBAAoB,KAAK;AAAA,EAC3B,GAAG,CAAC,CAAC;AAEL,QAAM,YAAY,YAAY,MAAM;AAClC,UAAM;AACN,wBAAoB,KAAK;AAAA,EAC3B,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AAAA,IACL;AAAA,IACA,eAAe,MAAM,OAAO;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -3,13 +3,11 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useForm } from "react-hook-form";
|
|
4
4
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
5
5
|
import { useMutation } from "@tanstack/react-query";
|
|
6
|
-
import { useTranslations } from "next-intl";
|
|
7
6
|
import { toast } from "sonner";
|
|
8
7
|
import { Toast } from "../../ui/feedback/Toast";
|
|
9
8
|
import { changePasswordSchema } from "../../../utils/validators/account";
|
|
10
9
|
import { changePasswordAction } from "../../../modules/accounts/actions/account-management.action";
|
|
11
10
|
function useChangePasswordForm({ onSuccess } = {}) {
|
|
12
|
-
const translate = useTranslations();
|
|
13
11
|
const form = useForm({
|
|
14
12
|
resolver: zodResolver(changePasswordSchema),
|
|
15
13
|
mode: "onChange",
|
|
@@ -22,36 +20,15 @@ function useChangePasswordForm({ onSuccess } = {}) {
|
|
|
22
20
|
mutationFn: changePasswordAction,
|
|
23
21
|
onSuccess: (result) => {
|
|
24
22
|
if (!result.success) {
|
|
25
|
-
toast.custom((
|
|
26
|
-
Toast,
|
|
27
|
-
{
|
|
28
|
-
variant: "error",
|
|
29
|
-
message: result.error ?? translate("common.account.changePassword.changeError"),
|
|
30
|
-
toastId
|
|
31
|
-
}
|
|
32
|
-
));
|
|
23
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: result.error ?? "Erro ao alterar senha", toastId: t }));
|
|
33
24
|
return;
|
|
34
25
|
}
|
|
35
|
-
toast.custom((
|
|
36
|
-
Toast,
|
|
37
|
-
{
|
|
38
|
-
variant: "success",
|
|
39
|
-
message: translate("common.account.changePassword.changedSuccess"),
|
|
40
|
-
toastId
|
|
41
|
-
}
|
|
42
|
-
));
|
|
26
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Senha alterada com sucesso", toastId: t }));
|
|
43
27
|
form.reset();
|
|
44
28
|
onSuccess?.();
|
|
45
29
|
},
|
|
46
30
|
onError: () => {
|
|
47
|
-
toast.custom((
|
|
48
|
-
Toast,
|
|
49
|
-
{
|
|
50
|
-
variant: "error",
|
|
51
|
-
message: translate("common.account.changePassword.genericError"),
|
|
52
|
-
toastId
|
|
53
|
-
}
|
|
54
|
-
));
|
|
31
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Erro ao alterar senha. Tente novamente.", toastId: t }));
|
|
55
32
|
}
|
|
56
33
|
});
|
|
57
34
|
const onSubmit = (data) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/account/hooks/useChangePasswordForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useForm } from 'react-hook-form';\r\nimport { zodResolver } from '@hookform/resolvers/zod';\r\nimport { useMutation } from '@tanstack/react-query';\r\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/account/hooks/useChangePasswordForm.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { useForm } from 'react-hook-form';\r\nimport { zodResolver } from '@hookform/resolvers/zod';\r\nimport { useMutation } from '@tanstack/react-query';\r\nimport { toast } from 'sonner';\r\nimport { Toast } from '../../ui/feedback/Toast';\r\nimport { changePasswordSchema, type ChangePasswordFormData } from '../../../utils/validators/account';\r\nimport { changePasswordAction } from '../../../modules/accounts/actions/account-management.action';\r\n\r\ninterface UseChangePasswordFormProps {\r\n onSuccess?: () => void;\r\n}\r\n\r\nexport default function useChangePasswordForm({ onSuccess }: UseChangePasswordFormProps = {}) {\r\n const form = useForm<ChangePasswordFormData>({\r\n resolver: zodResolver(changePasswordSchema),\r\n mode: 'onChange',\r\n defaultValues: {\r\n currentPassword: '',\r\n newPassword: '',\r\n },\r\n });\r\n\r\n const mutation = useMutation({\r\n mutationFn: changePasswordAction,\r\n onSuccess: (result) => {\r\n if (!result.success) {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message={result.error ?? 'Erro ao alterar senha'} toastId={t} />\r\n ));\r\n return;\r\n }\r\n\r\n toast.custom((t) => (\r\n <Toast variant=\"success\" message=\"Senha alterada com sucesso\" toastId={t} />\r\n ));\r\n\r\n form.reset();\r\n onSuccess?.();\r\n },\r\n onError: () => {\r\n toast.custom((t) => (\r\n <Toast variant=\"error\" message=\"Erro ao alterar senha. Tente novamente.\" toastId={t} />\r\n ));\r\n },\r\n });\r\n\r\n const onSubmit = (data: ChangePasswordFormData) => {\r\n mutation.mutate(data);\r\n };\r\n\r\n return {\r\n register: form.register,\r\n handleSubmit: form.handleSubmit(onSubmit),\r\n errors: form.formState.errors,\r\n isLoading: mutation.isPending,\r\n };\r\n}\r\n"],"mappings":";AA6BU;AA3BV,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,4BAAyD;AAClE,SAAS,4BAA4B;AAMtB,SAAR,sBAAuC,EAAE,UAAU,IAAgC,CAAC,GAAG;AAC5F,QAAM,OAAO,QAAgC;AAAA,IAC3C,UAAU,YAAY,oBAAoB;AAAA,IAC1C,MAAM;AAAA,IACN,eAAe;AAAA,MACb,iBAAiB;AAAA,MACjB,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AAED,QAAM,WAAW,YAAY;AAAA,IAC3B,YAAY;AAAA,IACZ,WAAW,CAAC,WAAW;AACrB,UAAI,CAAC,OAAO,SAAS;AACnB,cAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAS,OAAO,SAAS,yBAAyB,SAAS,GAAG,CACtF;AACD;AAAA,MACF;AAEA,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,WAAU,SAAQ,8BAA6B,SAAS,GAAG,CAC3E;AAED,WAAK,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,IACA,SAAS,MAAM;AACb,YAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,SAAQ,SAAQ,2CAA0C,SAAS,GAAG,CACtF;AAAA,IACH;AAAA,EACF,CAAC;AAED,QAAM,WAAW,CAAC,SAAiC;AACjD,aAAS,OAAO,IAAI;AAAA,EACtB;AAEA,SAAO;AAAA,IACL,UAAU,KAAK;AAAA,IACf,cAAc,KAAK,aAAa,QAAQ;AAAA,IACxC,QAAQ,KAAK,UAAU;AAAA,IACvB,WAAW,SAAS;AAAA,EACtB;AACF;","names":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useCallback } from "react";
|
|
4
|
-
import { useTranslations } from "next-intl";
|
|
5
4
|
import { toast } from "sonner";
|
|
6
5
|
import { Toast } from "../../ui/feedback/Toast";
|
|
7
6
|
import { requestPhoneChangeAction, updateUserAction } from "../../../modules/accounts/actions/account-management.action";
|
|
@@ -12,7 +11,6 @@ function splitPhoneValue(fullValue) {
|
|
|
12
11
|
return { ddi: trimmed.slice(0, spaceIdx), local: trimmed.slice(spaceIdx + 1) };
|
|
13
12
|
}
|
|
14
13
|
function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuccess }) {
|
|
15
|
-
const translate = useTranslations();
|
|
16
14
|
const [showVerification, setShowVerification] = useState(false);
|
|
17
15
|
const [phoneValue, setPhoneValue] = useState("");
|
|
18
16
|
const [phoneError, setPhoneError] = useState("");
|
|
@@ -26,7 +24,7 @@ function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuccess }) {
|
|
|
26
24
|
e.preventDefault();
|
|
27
25
|
const { ddi, local } = splitPhoneValue(phoneValue);
|
|
28
26
|
if (!local || local.replace(/\D/g, "").length < 8) {
|
|
29
|
-
setPhoneError(
|
|
27
|
+
setPhoneError("N\xFAmero de telefone inv\xE1lido");
|
|
30
28
|
return;
|
|
31
29
|
}
|
|
32
30
|
setIsSubmitting(true);
|
|
@@ -34,35 +32,28 @@ function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuccess }) {
|
|
|
34
32
|
if (!hasExistingPhone) {
|
|
35
33
|
const result2 = await updateUserAction({ phone: local, ddi });
|
|
36
34
|
if (!result2.success) {
|
|
37
|
-
toast.custom((
|
|
35
|
+
toast.custom((t) => /* @__PURE__ */ jsx(
|
|
38
36
|
Toast,
|
|
39
37
|
{
|
|
40
38
|
variant: "error",
|
|
41
|
-
message: result2.error ??
|
|
42
|
-
toastId
|
|
39
|
+
message: result2.error ?? "Ocorreu um erro ao salvar o telefone. Tente novamente mais tarde.",
|
|
40
|
+
toastId: t
|
|
43
41
|
}
|
|
44
42
|
));
|
|
45
43
|
return;
|
|
46
44
|
}
|
|
47
|
-
toast.custom((
|
|
48
|
-
Toast,
|
|
49
|
-
{
|
|
50
|
-
variant: "success",
|
|
51
|
-
message: translate("common.account.changePhone.phoneAdded"),
|
|
52
|
-
toastId
|
|
53
|
-
}
|
|
54
|
-
));
|
|
45
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Telefone adicionado", toastId: t }));
|
|
55
46
|
onDirectUpdateSuccess?.();
|
|
56
47
|
return;
|
|
57
48
|
}
|
|
58
49
|
const result = await requestPhoneChangeAction(local, ddi);
|
|
59
50
|
if (!result.success) {
|
|
60
|
-
toast.custom((
|
|
51
|
+
toast.custom((t) => /* @__PURE__ */ jsx(
|
|
61
52
|
Toast,
|
|
62
53
|
{
|
|
63
54
|
variant: "error",
|
|
64
|
-
message: result.error ??
|
|
65
|
-
toastId
|
|
55
|
+
message: result.error ?? "N\xFAmero j\xE1 existente ou ocorreu um erro. Tente novamente mais tarde.",
|
|
56
|
+
toastId: t
|
|
66
57
|
}
|
|
67
58
|
));
|
|
68
59
|
return;
|
|
@@ -72,7 +63,7 @@ function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuccess }) {
|
|
|
72
63
|
} finally {
|
|
73
64
|
setIsSubmitting(false);
|
|
74
65
|
}
|
|
75
|
-
}, [phoneValue, hasExistingPhone, onDirectUpdateSuccess
|
|
66
|
+
}, [phoneValue, hasExistingPhone, onDirectUpdateSuccess]);
|
|
76
67
|
const handleBack = useCallback(() => {
|
|
77
68
|
setShowVerification(false);
|
|
78
69
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/account/hooks/useChangePhoneForm.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback } from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/account/hooks/useChangePhoneForm.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback } from 'react';\nimport { toast } from 'sonner';\nimport { Toast } from '../../ui/feedback/Toast';\nimport { requestPhoneChangeAction, updateUserAction } from '../../../modules/accounts/actions/account-management.action';\n\nfunction splitPhoneValue(fullValue: string): { ddi: string; local: string } {\n const trimmed = fullValue.trim();\n const spaceIdx = trimmed.indexOf(' ');\n if (spaceIdx === -1) return { ddi: '+55', local: trimmed };\n return { ddi: trimmed.slice(0, spaceIdx), local: trimmed.slice(spaceIdx + 1) };\n}\n\ninterface UseChangePhoneFormOptions {\n hasExistingPhone: boolean;\n onDirectUpdateSuccess?: () => void;\n}\n\nexport default function useChangePhoneForm({ hasExistingPhone, onDirectUpdateSuccess }: UseChangePhoneFormOptions) {\n const [showVerification, setShowVerification] = useState(false);\n const [phoneValue, setPhoneValue] = useState('');\n const [phoneError, setPhoneError] = useState('');\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [submittedPhone, setSubmittedPhone] = useState({ ddi: '+55', local: '' });\n\n const handlePhoneChange = useCallback((value: string) => {\n setPhoneValue(value);\n if (phoneError) setPhoneError('');\n }, [phoneError]);\n\n const handleContinue = useCallback(async (e: React.FormEvent) => {\n e.preventDefault();\n\n const { ddi, local } = splitPhoneValue(phoneValue);\n\n if (!local || local.replace(/\\D/g, '').length < 8) {\n setPhoneError('Número de telefone inválido');\n return;\n }\n\n setIsSubmitting(true);\n try {\n if (!hasExistingPhone) {\n const result = await updateUserAction({ phone: local, ddi });\n\n if (!result.success) {\n toast.custom((t) => (\n <Toast\n variant=\"error\"\n message={result.error ?? 'Ocorreu um erro ao salvar o telefone. Tente novamente mais tarde.'}\n toastId={t}\n />\n ));\n return;\n }\n\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Telefone adicionado\" toastId={t} />\n ));\n onDirectUpdateSuccess?.();\n return;\n }\n\n const result = await requestPhoneChangeAction(local, ddi);\n\n if (!result.success) {\n toast.custom((t) => (\n <Toast\n variant=\"error\"\n message={result.error ?? 'Número já existente ou ocorreu um erro. Tente novamente mais tarde.'}\n toastId={t}\n />\n ));\n return;\n }\n\n setSubmittedPhone({ ddi, local });\n setShowVerification(true);\n } finally {\n setIsSubmitting(false);\n }\n }, [phoneValue, hasExistingPhone, onDirectUpdateSuccess]);\n\n const handleBack = useCallback(() => {\n setShowVerification(false);\n }, []);\n\n const resetForm = useCallback(() => {\n setPhoneValue('');\n setPhoneError('');\n setSubmittedPhone({ ddi: '+55', local: '' });\n setShowVerification(false);\n }, []);\n\n return {\n showVerification,\n phoneValue,\n phoneError,\n isSubmitting,\n submittedPhone,\n handlePhoneChange,\n handleContinue,\n handleBack,\n resetForm,\n };\n}\n"],"mappings":";AAgDY;AA9CZ,SAAS,UAAU,mBAAmB;AACtC,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,0BAA0B,wBAAwB;AAE3D,SAAS,gBAAgB,WAAmD;AAC1E,QAAM,UAAU,UAAU,KAAK;AAC/B,QAAM,WAAW,QAAQ,QAAQ,GAAG;AACpC,MAAI,aAAa,GAAI,QAAO,EAAE,KAAK,OAAO,OAAO,QAAQ;AACzD,SAAO,EAAE,KAAK,QAAQ,MAAM,GAAG,QAAQ,GAAG,OAAO,QAAQ,MAAM,WAAW,CAAC,EAAE;AAC/E;AAOe,SAAR,mBAAoC,EAAE,kBAAkB,sBAAsB,GAA8B;AACjH,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,KAAK;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wBAAkB,EAAE,KAAK,MAAM,CAAC;AAChC,0BAAoB,IAAI;AAAA,IAC1B,UAAE;AACA,sBAAgB,KAAK;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,YAAY,kBAAkB,qBAAqB,CAAC;AAExD,QAAM,aAAa,YAAY,MAAM;AACnC,wBAAoB,KAAK;AAAA,EAC3B,GAAG,CAAC,CAAC;AAEL,QAAM,YAAY,YAAY,MAAM;AAClC,kBAAc,EAAE;AAChB,kBAAc,EAAE;AAChB,sBAAkB,EAAE,KAAK,OAAO,OAAO,GAAG,CAAC;AAC3C,wBAAoB,KAAK;AAAA,EAC3B,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["result"]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useCallback } from "react";
|
|
4
4
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
|
-
import { useTranslations } from "next-intl";
|
|
6
5
|
import { toast } from "sonner";
|
|
7
6
|
import { Toast } from "../../ui/feedback/Toast";
|
|
8
7
|
import { USER_QUERY_KEY } from "../../../modules/auth/hooks/useUserQuery";
|
|
@@ -12,7 +11,6 @@ function useDisableTwoFactorAuthForm({
|
|
|
12
11
|
onClose,
|
|
13
12
|
onSuccess
|
|
14
13
|
}) {
|
|
15
|
-
const translate = useTranslations();
|
|
16
14
|
const [code, setCode] = useState("");
|
|
17
15
|
const queryClient = useQueryClient();
|
|
18
16
|
const userKey = useWlQueryKey([...USER_QUERY_KEY]);
|
|
@@ -22,38 +20,17 @@ function useDisableTwoFactorAuthForm({
|
|
|
22
20
|
onSuccess: (result) => {
|
|
23
21
|
if (!result.success) {
|
|
24
22
|
setCode("");
|
|
25
|
-
toast.custom((
|
|
26
|
-
Toast,
|
|
27
|
-
{
|
|
28
|
-
variant: "error",
|
|
29
|
-
message: result.error ?? translate("common.account.twoFactor.invalidCode"),
|
|
30
|
-
toastId
|
|
31
|
-
}
|
|
32
|
-
));
|
|
23
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: result.error ?? "C\xF3digo inv\xE1lido", toastId: t }));
|
|
33
24
|
return;
|
|
34
25
|
}
|
|
35
26
|
queryClient.invalidateQueries({ queryKey: userKey });
|
|
36
|
-
toast.custom((
|
|
37
|
-
Toast,
|
|
38
|
-
{
|
|
39
|
-
variant: "success",
|
|
40
|
-
message: translate("common.account.twoFactor.disabledSuccess"),
|
|
41
|
-
toastId
|
|
42
|
-
}
|
|
43
|
-
));
|
|
27
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Autentica\xE7\xE3o de dois fatores desabilitada", toastId: t }));
|
|
44
28
|
setCode("");
|
|
45
29
|
onSuccess?.();
|
|
46
30
|
},
|
|
47
31
|
onError: () => {
|
|
48
32
|
setCode("");
|
|
49
|
-
toast.custom((
|
|
50
|
-
Toast,
|
|
51
|
-
{
|
|
52
|
-
variant: "error",
|
|
53
|
-
message: translate("common.account.twoFactor.disableError"),
|
|
54
|
-
toastId
|
|
55
|
-
}
|
|
56
|
-
));
|
|
33
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Erro ao desabilitar 2FA. Tente novamente.", toastId: t }));
|
|
57
34
|
}
|
|
58
35
|
});
|
|
59
36
|
const { mutate, reset } = mutation;
|