@greatapps/common 1.1.674 → 1.1.676
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/services/plans.service.mjs +1 -1
- package/dist/modules/plans/services/plans.service.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/services/plans.service.ts +1 -1
- 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,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { IconKey, IconLock, IconSettings2, IconX } from "@tabler/icons-react";
|
|
4
|
-
import { useTranslations } from "next-intl";
|
|
5
4
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
|
|
6
5
|
import { Tabs, TabsList, TabsTrigger, TabsContent } from "../ui/data-display/Tabs";
|
|
7
6
|
import { cn } from "../../infra/utils/clsx";
|
|
@@ -19,7 +18,6 @@ import { useActiveSubscription } from "../../modules/subscriptions/hooks/find-ac
|
|
|
19
18
|
import { hasSubscriptionExpired } from "../../modules/subscriptions/utils/has-subscription-expired";
|
|
20
19
|
import { useWhitelabel } from "../../providers/whitelabel.provider";
|
|
21
20
|
function ConfigurationsMyAccountModal() {
|
|
22
|
-
const translate = useTranslations();
|
|
23
21
|
const {
|
|
24
22
|
activeModal,
|
|
25
23
|
openDeleteAccount,
|
|
@@ -64,9 +62,9 @@ function ConfigurationsMyAccountModal() {
|
|
|
64
62
|
overlayClassName: "bg-black/20 lg:bg-black/50",
|
|
65
63
|
className: "\n flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0\n rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0\n lg:flex-row lg:w-[892px] lg:max-w-[892px] lg:h-[626px] lg:rounded-lg lg:border\n lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]",
|
|
66
64
|
children: [
|
|
67
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children:
|
|
65
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "Configura\xE7\xF5es" }) }),
|
|
68
66
|
/* @__PURE__ */ jsxs("div", { className: "md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200", children: [
|
|
69
|
-
/* @__PURE__ */ jsx("span", { className: "text-gray-950 paragraph-medium-semibold", children:
|
|
67
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-950 paragraph-medium-semibold", children: "Configura\xE7\xF5es" }),
|
|
70
68
|
/* @__PURE__ */ jsx(
|
|
71
69
|
"button",
|
|
72
70
|
{
|
|
@@ -97,19 +95,19 @@ function ConfigurationsMyAccountModal() {
|
|
|
97
95
|
"[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]"
|
|
98
96
|
),
|
|
99
97
|
children: [
|
|
100
|
-
/* @__PURE__ */ jsx("span", { className: "hidden lg:block paragraph-medium-semibold text-gray-950 mb-0", children:
|
|
98
|
+
/* @__PURE__ */ jsx("span", { className: "hidden lg:block paragraph-medium-semibold text-gray-950 mb-0", children: "Configura\xE7\xF5es" }),
|
|
101
99
|
/* @__PURE__ */ jsxs("div", { className: "lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full", children: [
|
|
102
100
|
/* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.PREFERENCES, className: tabTriggerClasses, children: [
|
|
103
101
|
/* @__PURE__ */ jsx(IconSettings2, { size: 20, className: "shrink-0" }),
|
|
104
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children:
|
|
102
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Prefer\xEAncias" })
|
|
105
103
|
] }),
|
|
106
104
|
isOwner && whitelabel?.id === 1 && /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.TOKEN, className: tabTriggerClasses, children: [
|
|
107
105
|
/* @__PURE__ */ jsx(IconKey, { size: 20, className: "shrink-0" }),
|
|
108
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children:
|
|
106
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Token da conta" })
|
|
109
107
|
] }),
|
|
110
108
|
isOwner && /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.SECURITY, className: tabTriggerClasses, children: [
|
|
111
109
|
/* @__PURE__ */ jsx(IconLock, { size: 20, className: "shrink-0" }),
|
|
112
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children:
|
|
110
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "Seguran\xE7a" })
|
|
113
111
|
] })
|
|
114
112
|
] })
|
|
115
113
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/account/ConfigurationsMyAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconKey, IconLock, IconSettings2, IconX } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../ui/data-display/Tabs';\nimport { cn } from '../../infra/utils/clsx';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\nimport { PreferencesSection } from './sections/PreferencesSection';\nimport { ChangePasswordSection } from './sections/ChangePasswordSection';\nimport { TokenSection } from './sections/TokenSection';\nimport { SecuritySection } from './sections/SecuritySection';\nimport useConfigurationsModal from './hooks/useConfigurationsModal';\nimport useIsMobile from '../../hooks/useIsMobile';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { useAuth } from '../../providers/auth.provider';\nimport { UserProfile } from '../../modules/users/schema';\nimport { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';\nimport { hasSubscriptionExpired } from '../../modules/subscriptions/utils/has-subscription-expired';\nimport { useWhitelabel } from '../../providers/whitelabel.provider';\n\nexport default function ConfigurationsMyAccountModal() {\n const translate = useTranslations();\n const {\n activeModal,\n openDeleteAccount,\n openIsntPossibleDelete,\n close,\n } = useAccountModals();\n const { whitelabel } = useWhitelabel();\n\n const open = activeModal === 'configurations';\n\n const { data: subscriptionData } = useActiveSubscription();\n const subscription = subscriptionData?.data?.[0] ?? null;\n const isPaidSubscriptionType =\n !!subscription &&\n subscription.type !== 'free' &&\n subscription.type !== 'trial';\n const isBlockingSubscription =\n isPaidSubscriptionType &&\n subscription.active === true &&\n !subscription.date_cancellation &&\n !hasSubscriptionExpired(subscription.date_due);\n\n const { user } = useAuth();\n const isOwner = user?.profile === UserProfile.owner;\n\n const isMobile = useIsMobile();\n const { activeSection, setActiveSection } = useConfigurationsModal({\n isOpen: open,\n });\n\n const handleDeleteAccount = () => {\n close();\n if (isBlockingSubscription) {\n openIsntPossibleDelete();\n } else {\n openDeleteAccount();\n }\n };\n\n const tabTriggerClasses = cn(\n 'border-0! px-0 py-0',\n\n 'lg:rounded-md lg:flex lg:items-center lg:gap-2 lg:p-3 lg:justify-start lg:w-full',\n 'lg:bg-white lg:hover:bg-gray-100 lg:active:bg-gray-50 lg:border-0',\n 'lg:data-[state=active]:bg-gray-50',\n\n 'flex items-center gap-1.5 px-3 py-3 justify-center whitespace-nowrap',\n 'border-b-2 border-transparent',\n 'data-[state=active]:bg-gray-50 rounded-lg',\n\n 'text-gray-500 data-[state=active]:text-gray-950',\n 'hover:text-gray-900 transition-colors'\n );\n\n return (\n <Dialog open={open} onOpenChange={close}>\n <DialogContent\n showCloseButton={!isMobile}\n overlayClassName=\"bg-black/20 lg:bg-black/50\"\n className=\"\n flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0\n rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0\n lg:flex-row lg:w-[892px] lg:max-w-[892px] lg:h-[626px] lg:rounded-lg lg:border\n lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{translate('common.account.configurations.title')}</DialogTitle>\n </DialogHeader>\n <div className=\"md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200\">\n <span className=\"text-gray-950 paragraph-medium-semibold\">\n {translate('common.account.configurations.title')}\n </span>\n <button\n type=\"button\"\n className=\"size-8 flex items-center justify-center text-gray-500 cursor-pointer\"\n onClick={close}\n >\n <IconX size={18} />\n </button>\n </div>\n <Tabs\n value={activeSection}\n onValueChange={(value) => setActiveSection(value as AccountSectionType)}\n orientation=\"vertical\"\n className=\"flex lg:flex-row flex-col w-full h-full flex-1 lg:h-full lg:pt-0 lg:gap-0\"\n >\n <TabsList\n className={cn(\n 'flex gap-0 bg-transparent border-b-0',\n\n 'lg:flex-col lg:items-stretch lg:justify-start lg:w-auto lg:min-w-60',\n 'lg:border-r lg:border-gray-200 lg:pl-5 lg:pr-5 lg:pt-5 lg:gap-5 lg:overflow-x-visible lg:self-stretch',\n\n 'flex-row items-center justify-start w-full overflow-x-auto scrollbar-hide shrink-0',\n 'px-4 py-3',\n '[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]'\n )}\n >\n <span className=\"hidden lg:block paragraph-medium-semibold text-gray-950 mb-0\">\n {translate('common.account.configurations.title')}\n </span>\n\n <div className=\"lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full\">\n <TabsTrigger value={AccountSectionType.PREFERENCES} className={tabTriggerClasses}>\n <IconSettings2 size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">{translate('common.preferences.title')}</span>\n </TabsTrigger>\n\n {isOwner && whitelabel?.id === 1 && (\n <TabsTrigger value={AccountSectionType.TOKEN} className={tabTriggerClasses}>\n <IconKey size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">{translate('common.account.token.title')}</span>\n </TabsTrigger>\n )}\n\n {isOwner && (\n <TabsTrigger value={AccountSectionType.SECURITY} className={tabTriggerClasses}>\n <IconLock size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">{translate('common.account.security.title')}</span>\n </TabsTrigger>\n )}\n </div>\n </TabsList>\n\n <div className=\"w-full flex-1 min-h-0 lg:h-full overflow-hidden lg:overflow-visible relative flex flex-col\">\n <TabsContent value={AccountSectionType.PREFERENCES} className=\"h-full! relative overflow-hidden\">\n <PreferencesSection onClose={close} />\n </TabsContent>\n\n {isOwner && (\n <TabsContent value={AccountSectionType.TOKEN} className=\"h-full! relative overflow-hidden\">\n <TokenSection />\n </TabsContent>\n )}\n\n {isOwner && (\n <>\n <TabsContent value={AccountSectionType.SECURITY} className=\"h-full! relative overflow-hidden\">\n <SecuritySection\n setActiveSection={setActiveSection}\n onClose={close}\n onDeleteAccount={handleDeleteAccount}\n />\n </TabsContent>\n\n <TabsContent value={AccountSectionType.CHANGE_PASSWORD} className=\"h-full! relative overflow-hidden\">\n <ChangePasswordSection onBack={() => setActiveSection(AccountSectionType.SECURITY)} />\n </TabsContent>\n </>\n )}\n </div>\n </Tabs>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAyFU,SAsEI,UAtEJ,KAEF,YAFE;AAvFV,SAAS,SAAS,UAAU,eAAe,aAAa;AACxD,SAAS,uBAAuB;AAChC,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,MAAM,UAAU,aAAa,mBAAmB;AACzD,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,OAAO,4BAA4B;AACnC,OAAO,iBAAiB;AACxB,SAAS,wBAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAEf,SAAR,+BAAgD;AACrD,QAAM,YAAY,gBAAgB;AAClC,QAAM;AAAA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WACC,iCACE;AAAA,sCAAC,eAAY,OAAO,mBAAmB,UAAU,WAAU,oCACzD;AAAA,oBAAC;AAAA;AAAA,sBACC;AAAA,sBACA,SAAS;AAAA,sBACT,iBAAiB;AAAA;AAAA,kBACnB,GACF;AAAA,kBAEA,oBAAC,eAAY,OAAO,mBAAmB,iBAAiB,WAAU,oCAChE,8BAAC,yBAAsB,QAAQ,MAAM,iBAAiB,mBAAmB,QAAQ,GAAG,GACtF;AAAA,mBACF;AAAA,iBAEJ;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/ConfigurationsMyAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconKey, IconLock, IconSettings2, IconX } from '@tabler/icons-react';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../ui/data-display/Tabs';\nimport { cn } from '../../infra/utils/clsx';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\nimport { PreferencesSection } from './sections/PreferencesSection';\nimport { ChangePasswordSection } from './sections/ChangePasswordSection';\nimport { TokenSection } from './sections/TokenSection';\nimport { SecuritySection } from './sections/SecuritySection';\nimport useConfigurationsModal from './hooks/useConfigurationsModal';\nimport useIsMobile from '../../hooks/useIsMobile';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { useAuth } from '../../providers/auth.provider';\nimport { UserProfile } from '../../modules/users/schema';\nimport { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';\nimport { hasSubscriptionExpired } from '../../modules/subscriptions/utils/has-subscription-expired';\nimport { useWhitelabel } from '../../providers/whitelabel.provider';\n\nexport default function ConfigurationsMyAccountModal() {\n const {\n activeModal,\n openDeleteAccount,\n openIsntPossibleDelete,\n close,\n } = useAccountModals();\n const { whitelabel } = useWhitelabel();\n\n const open = activeModal === 'configurations';\n\n const { data: subscriptionData } = useActiveSubscription();\n const subscription = subscriptionData?.data?.[0] ?? null;\n const isPaidSubscriptionType =\n !!subscription &&\n subscription.type !== 'free' &&\n subscription.type !== 'trial';\n const isBlockingSubscription =\n isPaidSubscriptionType &&\n subscription.active === true &&\n !subscription.date_cancellation &&\n !hasSubscriptionExpired(subscription.date_due);\n\n const { user } = useAuth();\n const isOwner = user?.profile === UserProfile.owner;\n\n const isMobile = useIsMobile();\n const { activeSection, setActiveSection } = useConfigurationsModal({\n isOpen: open,\n });\n\n const handleDeleteAccount = () => {\n close();\n if (isBlockingSubscription) {\n openIsntPossibleDelete();\n } else {\n openDeleteAccount();\n }\n };\n\n const tabTriggerClasses = cn(\n 'border-0! px-0 py-0',\n\n 'lg:rounded-md lg:flex lg:items-center lg:gap-2 lg:p-3 lg:justify-start lg:w-full',\n 'lg:bg-white lg:hover:bg-gray-100 lg:active:bg-gray-50 lg:border-0',\n 'lg:data-[state=active]:bg-gray-50',\n\n 'flex items-center gap-1.5 px-3 py-3 justify-center whitespace-nowrap',\n 'border-b-2 border-transparent',\n 'data-[state=active]:bg-gray-50 rounded-lg',\n\n 'text-gray-500 data-[state=active]:text-gray-950',\n 'hover:text-gray-900 transition-colors'\n );\n\n return (\n <Dialog open={open} onOpenChange={close}>\n <DialogContent\n showCloseButton={!isMobile}\n overlayClassName=\"bg-black/20 lg:bg-black/50\"\n className=\"\n flex flex-col p-0 gap-0 max-w-full sm:max-w-full overflow-x-hidden border-0\n rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0\n lg:flex-row lg:w-[892px] lg:max-w-[892px] lg:h-[626px] lg:rounded-lg lg:border\n lg:top-[50%] lg:bottom-auto lg:left-[50%] lg:right-auto lg:translate-x-[-50%] lg:translate-y-[-50%]\"\n >\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Configurações</DialogTitle>\n </DialogHeader>\n <div className=\"md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200\">\n <span className=\"text-gray-950 paragraph-medium-semibold\">Configurações</span>\n <button\n type=\"button\"\n className=\"size-8 flex items-center justify-center text-gray-500 cursor-pointer\"\n onClick={close}\n >\n <IconX size={18} />\n </button>\n </div>\n <Tabs\n value={activeSection}\n onValueChange={(value) => setActiveSection(value as AccountSectionType)}\n orientation=\"vertical\"\n className=\"flex lg:flex-row flex-col w-full h-full flex-1 lg:h-full lg:pt-0 lg:gap-0\"\n >\n <TabsList\n className={cn(\n 'flex gap-0 bg-transparent border-b-0',\n\n 'lg:flex-col lg:items-stretch lg:justify-start lg:w-auto lg:min-w-60',\n 'lg:border-r lg:border-gray-200 lg:pl-5 lg:pr-5 lg:pt-5 lg:gap-5 lg:overflow-x-visible lg:self-stretch',\n\n 'flex-row items-center justify-start w-full overflow-x-auto scrollbar-hide shrink-0',\n 'px-4 py-3',\n '[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]'\n )}\n >\n <span className=\"hidden lg:block paragraph-medium-semibold text-gray-950 mb-0\">\n Configurações\n </span>\n\n <div className=\"lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full\">\n <TabsTrigger value={AccountSectionType.PREFERENCES} className={tabTriggerClasses}>\n <IconSettings2 size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">Preferências</span>\n </TabsTrigger>\n\n {isOwner && whitelabel?.id === 1 && (\n <TabsTrigger value={AccountSectionType.TOKEN} className={tabTriggerClasses}>\n <IconKey size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">Token da conta</span>\n </TabsTrigger>\n )}\n\n {isOwner && (\n <TabsTrigger value={AccountSectionType.SECURITY} className={tabTriggerClasses}>\n <IconLock size={20} className=\"shrink-0\" />\n <span className=\"paragraph-small-medium\">Segurança</span>\n </TabsTrigger>\n )}\n </div>\n </TabsList>\n\n <div className=\"w-full flex-1 min-h-0 lg:h-full overflow-hidden lg:overflow-visible relative flex flex-col\">\n <TabsContent value={AccountSectionType.PREFERENCES} className=\"h-full! relative overflow-hidden\">\n <PreferencesSection onClose={close} />\n </TabsContent>\n\n {isOwner && (\n <TabsContent value={AccountSectionType.TOKEN} className=\"h-full! relative overflow-hidden\">\n <TokenSection />\n </TabsContent>\n )}\n\n {isOwner && (\n <>\n <TabsContent value={AccountSectionType.SECURITY} className=\"h-full! relative overflow-hidden\">\n <SecuritySection\n setActiveSection={setActiveSection}\n onClose={close}\n onDeleteAccount={handleDeleteAccount}\n />\n </TabsContent>\n\n <TabsContent value={AccountSectionType.CHANGE_PASSWORD} className=\"h-full! relative overflow-hidden\">\n <ChangePasswordSection onBack={() => setActiveSection(AccountSectionType.SECURITY)} />\n </TabsContent>\n </>\n )}\n </div>\n </Tabs>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAuFU,SAoEI,UApEJ,KAEF,YAFE;AArFV,SAAS,SAAS,UAAU,eAAe,aAAa;AACxD,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,MAAM,UAAU,aAAa,mBAAmB;AACzD,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,OAAO,4BAA4B;AACnC,OAAO,iBAAiB;AACxB,SAAS,wBAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAEf,SAAR,+BAAgD;AACrD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,iBAAiB;AACrB,QAAM,EAAE,WAAW,IAAI,cAAc;AAErC,QAAM,OAAO,gBAAgB;AAE7B,QAAM,EAAE,MAAM,iBAAiB,IAAI,sBAAsB;AACzD,QAAM,eAAe,kBAAkB,OAAO,CAAC,KAAK;AACpD,QAAM,yBACJ,CAAC,CAAC,gBACF,aAAa,SAAS,U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AA,EACF,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 { IconAlertTriangle } from "@tabler/icons-react";
|
|
5
4
|
import { toast } from "sonner";
|
|
6
5
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
|
|
@@ -15,7 +14,6 @@ import {
|
|
|
15
14
|
import { useAuth } from "../../providers/auth.provider";
|
|
16
15
|
import { UserProfile } from "../../modules/users/schema";
|
|
17
16
|
function ConfirmDeleteAccountModal() {
|
|
18
|
-
const translate = useTranslations();
|
|
19
17
|
const { activeModal, deleteAccountPayload, openDeleteAccount, close } = useAccountModals();
|
|
20
18
|
const open = activeModal === "confirmDelete";
|
|
21
19
|
const { data: pagesCount = 0 } = useCountPages();
|
|
@@ -28,7 +26,7 @@ function ConfirmDeleteAccountModal() {
|
|
|
28
26
|
try {
|
|
29
27
|
if (isOwner) {
|
|
30
28
|
if (!deleteAccountPayload) {
|
|
31
|
-
openDeleteAccount(
|
|
29
|
+
openDeleteAccount("Sess\xE3o expirada. Preencha os campos novamente.");
|
|
32
30
|
return;
|
|
33
31
|
}
|
|
34
32
|
await deleteAccount.mutateAsync({ password: deleteAccountPayload.password });
|
|
@@ -36,38 +34,39 @@ function ConfirmDeleteAccountModal() {
|
|
|
36
34
|
await deleteAccountUser.mutateAsync(user.id);
|
|
37
35
|
}
|
|
38
36
|
close();
|
|
39
|
-
toast.custom((
|
|
40
|
-
Toast,
|
|
41
|
-
{
|
|
42
|
-
variant: "success",
|
|
43
|
-
message: translate("common.account.confirmDelete.success"),
|
|
44
|
-
toastId
|
|
45
|
-
}
|
|
46
|
-
));
|
|
37
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Conta exclu\xEDda com sucesso", toastId: t }));
|
|
47
38
|
await logout();
|
|
48
39
|
} catch (error) {
|
|
49
|
-
const message = error instanceof Error ? error.message :
|
|
40
|
+
const message = error instanceof Error ? error.message : "Erro ao excluir. Tente novamente.";
|
|
50
41
|
if (isOwner) {
|
|
51
42
|
openDeleteAccount(message);
|
|
52
43
|
return;
|
|
53
44
|
}
|
|
54
|
-
toast.custom((
|
|
45
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message, toastId: t }));
|
|
55
46
|
}
|
|
56
47
|
};
|
|
57
48
|
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: isDeleting ? void 0 : close, children: /* @__PURE__ */ jsxs(DialogContent, { className: "flex flex-col p-0 gap-0 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%]!", children: [
|
|
58
49
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 p-4 lg:p-5", children: [
|
|
59
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "p-0", children: /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children:
|
|
50
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "p-0", children: /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: "Uma pena te ver ir!" }) }),
|
|
60
51
|
/* @__PURE__ */ jsxs("div", { className: "bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4", children: [
|
|
61
52
|
/* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, className: "text-red-500 shrink-0", strokeWidth: 2 }),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
/* @__PURE__ */ jsxs("p", { className: "paragraph-small-regular text-gray-600", children: [
|
|
54
|
+
"Todas suas",
|
|
55
|
+
" ",
|
|
56
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold text-gray-950", children: [
|
|
57
|
+
pagesCount,
|
|
58
|
+
" p\xE1ginas"
|
|
59
|
+
] }),
|
|
60
|
+
" ",
|
|
61
|
+
"ser\xE3o deletadas permanentemente. Essa a\xE7\xE3o \xE9",
|
|
62
|
+
" ",
|
|
63
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-950", children: "irrevers\xEDvel!" })
|
|
64
|
+
] })
|
|
66
65
|
] })
|
|
67
66
|
] }),
|
|
68
67
|
/* @__PURE__ */ jsx("div", { className: "h-px bg-gray-200" }),
|
|
69
68
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-4 lg:p-5", children: [
|
|
70
|
-
/* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: close, disabled: isDeleting, children:
|
|
69
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: close, disabled: isDeleting, children: "Manter minha conta" }),
|
|
71
70
|
/* @__PURE__ */ jsx(
|
|
72
71
|
Button,
|
|
73
72
|
{
|
|
@@ -75,7 +74,7 @@ function ConfirmDeleteAccountModal() {
|
|
|
75
74
|
className: "h-10! flex-1",
|
|
76
75
|
onClick: handleConfirm,
|
|
77
76
|
disabled: isDeleting,
|
|
78
|
-
children: isDeleting ?
|
|
77
|
+
children: isDeleting ? "Excluindo..." : "Excluir mesmo assim"
|
|
79
78
|
}
|
|
80
79
|
)
|
|
81
80
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/account/ConfirmDeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/ConfirmDeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconAlertTriangle } from '@tabler/icons-react';\nimport { toast } from 'sonner';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Button } from '../ui/buttons/Button';\nimport { Toast } from '../ui/feedback/Toast';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { useCountPages } from '../../modules/pages/hooks/count-pages.hook';\nimport {\n useDeleteAccount,\n useDeleteAccountUser,\n} from '../../modules/accounts/hooks/useAccountManagement';\nimport { useAuth } from '../../providers/auth.provider';\nimport { UserProfile } from '../../modules/users/schema';\n\nexport default function ConfirmDeleteAccountModal() {\n const { activeModal, deleteAccountPayload, openDeleteAccount, close } = useAccountModals();\n const open = activeModal === 'confirmDelete';\n\n const { data: pagesCount = 0 } = useCountPages();\n\n const { user, logout } = useAuth();\n const isOwner = user?.profile === UserProfile.owner;\n\n const deleteAccount = useDeleteAccount();\n const deleteAccountUser = useDeleteAccountUser();\n const isDeleting = deleteAccount.isPending || deleteAccountUser.isPending;\n\n const handleConfirm = async () => {\n try {\n if (isOwner) {\n if (!deleteAccountPayload) {\n // Fluxo quebrado (usuário pulou o primeiro modal ou refresh) — manda\n // de volta pro modal inicial pra re-coletar a senha.\n openDeleteAccount('Sessão expirada. Preencha os campos novamente.');\n return;\n }\n await deleteAccount.mutateAsync({ password: deleteAccountPayload.password });\n } else {\n await deleteAccountUser.mutateAsync(user!.id);\n }\n close();\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Conta excluída com sucesso\" toastId={t} />\n ));\n await logout();\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Erro ao excluir. Tente novamente.';\n if (isOwner) {\n // Falha no delete do owner (ex.: senha inválida) — volta pro primeiro\n // modal com a mensagem do backend pra o usuário corrigir e tentar de novo.\n openDeleteAccount(message);\n return;\n }\n toast.custom((t) => (\n <Toast variant=\"error\" message={message} toastId={t} />\n ));\n }\n };\n\n return (\n <Dialog open={open} onOpenChange={isDeleting ? undefined : close}>\n <DialogContent className=\"flex flex-col p-0 gap-0 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 p-4 lg:p-5\">\n <DialogHeader className=\"p-0\">\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950\">\n Uma pena te ver ir!\n </DialogTitle>\n </DialogHeader>\n\n <div className=\"bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4\">\n <IconAlertTriangle size={20} className=\"text-red-500 shrink-0\" strokeWidth={2} />\n <p className=\"paragraph-small-regular text-gray-600\">\n Todas suas{' '}\n <span className=\"font-semibold text-gray-950\">{pagesCount} páginas</span>{' '}\n serão deletadas permanentemente. Essa ação é{' '}\n <span className=\"font-semibold text-gray-950\">irreversível!</span>\n </p>\n </div>\n </div>\n\n <div className=\"h-px bg-gray-200\" />\n\n <div className=\"flex items-center gap-2 p-4 lg:p-5\">\n <Button className=\"h-10 flex-1\" onClick={close} disabled={isDeleting}>\n Manter minha conta\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! flex-1\"\n onClick={handleConfirm}\n disabled={isDeleting}\n >\n {isDeleting ? 'Excluindo...' : 'Excluir mesmo assim'}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA4CQ,cA+BM,YA/BN;AA1CR,SAAS,yBAAyB;AAClC,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAEb,SAAR,4BAA6C;AAClD,QAAM,EAAE,aAAa,sBAAsB,mBAAmB,MAAM,IAAI,iBAAiB;AACzF,QAAM,OAAO,gBAAgB;AAE7B,QAAM,EAAE,MAAM,aAAa,EAAE,IAAI,cAAc;AAE/C,QAAM,EAAE,MAAM,OAAO,IAAI,QAAQ;AACjC,QAAM,UAAU,MAAM,YAAY,YAAY;AAE9C,QAAM,gBAAgB,iBAAiB;AACvC,QAAM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C,qBAAC,SAAI,WAAU,sCACb;AAAA,0BAAC,UAAO,WAAU,eAAc,SAAS,OAAO,UAAU,YAAY,gCAEtE;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,SAAS;AAAA,UACT,UAAU;AAAA,UAET,uBAAa,iBAAiB;AAAA;AAAA,MACjC;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 { IconAlertTriangle } from "@tabler/icons-react";
|
|
5
4
|
import { Button } from "../ui/buttons/Button";
|
|
6
5
|
import {
|
|
@@ -16,25 +15,27 @@ function ConfirmGlobalPreferencesModal({
|
|
|
16
15
|
onConfirm,
|
|
17
16
|
onCancel
|
|
18
17
|
}) {
|
|
19
|
-
const translate = useTranslations();
|
|
20
18
|
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: onCancel, children: /* @__PURE__ */ jsxs(DialogContent, { className: "flex flex-col p-0 gap-0 md:w-[386px]! lg:w-[386px]! max-w-[386px]! max-[386px]:w-[calc(100%-32px)]", children: [
|
|
21
19
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "sr-only", children: [
|
|
22
|
-
/* @__PURE__ */ jsx(DialogTitle, { children:
|
|
23
|
-
/* @__PURE__ */ jsx(DialogDescription, { children:
|
|
20
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Alterar prefer\xEAncias globais" }),
|
|
21
|
+
/* @__PURE__ */ jsx(DialogDescription, { children: "Confirma\xE7\xE3o de altera\xE7\xE3o de prefer\xEAncias globais da conta" })
|
|
24
22
|
] }),
|
|
25
23
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 p-5", children: [
|
|
26
24
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center bg-gray-50 rounded-lg size-10", children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 24, className: "text-gray-950" }) }),
|
|
27
25
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
28
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children:
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children: "Alterar prefer\xEAncias globais" }),
|
|
27
|
+
/* @__PURE__ */ jsxs("span", { className: "paragraph-small-regular text-gray-600", children: [
|
|
28
|
+
"Voc\xEA est\xE1 alterando configura\xE7\xF5es que impactam",
|
|
29
|
+
" ",
|
|
30
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-gray-950", children: "todos os usu\xE1rios da conta" }),
|
|
31
|
+
". Deseja confirmar?"
|
|
32
|
+
] })
|
|
32
33
|
] })
|
|
33
34
|
] }),
|
|
34
35
|
/* @__PURE__ */ jsx(Separator, { className: "w-full" }),
|
|
35
36
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-5", children: [
|
|
36
|
-
/* @__PURE__ */ jsx(Button, { onClick: onConfirm, className: "h-10!", children:
|
|
37
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: onCancel, className: "h-10!", children:
|
|
37
|
+
/* @__PURE__ */ jsx(Button, { onClick: onConfirm, className: "h-10!", children: "Confirmar" }),
|
|
38
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: onCancel, className: "h-10!", children: "Cancelar" })
|
|
38
39
|
] })
|
|
39
40
|
] }) });
|
|
40
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/account/ConfirmGlobalPreferencesModal.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/ConfirmGlobalPreferencesModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconAlertTriangle } from '@tabler/icons-react';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n} from '../ui/overlay/Dialog';\nimport { Separator } from '../ui/data-display/Separator';\n\ninterface ConfirmGlobalPreferencesModalProps {\n open: boolean;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\nexport default function ConfirmGlobalPreferencesModal({\n open,\n onConfirm,\n onCancel,\n}: ConfirmGlobalPreferencesModalProps) {\n return (\n <Dialog open={open} onOpenChange={onCancel}>\n <DialogContent className=\"flex flex-col p-0 gap-0 md:w-[386px]! lg:w-[386px]! max-w-[386px]! max-[386px]:w-[calc(100%-32px)]\">\n <DialogHeader className=\"sr-only\">\n <DialogTitle>Alterar preferências globais</DialogTitle>\n <DialogDescription>\n Confirmação de alteração de preferências globais da conta\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"flex flex-col gap-3 p-5\">\n <div className=\"flex items-center justify-center bg-gray-50 rounded-lg size-10\">\n <IconAlertTriangle size={24} className=\"text-gray-950\" />\n </div>\n <div className=\"flex flex-col gap-2\">\n <span className=\"paragraph-medium-semibold text-gray-950\">\n Alterar preferências globais\n </span>\n <span className=\"paragraph-small-regular text-gray-600\">\n Você está alterando configurações que impactam{' '}\n <span className=\"paragraph-small-semibold text-gray-950\">\n todos os usuários da conta\n </span>\n . Deseja confirmar?\n </span>\n </div>\n </div>\n\n <Separator className=\"w-full\" />\n\n <div className=\"flex items-center gap-2 p-5\">\n <Button onClick={onConfirm} className=\"h-10!\">\n Confirmar\n </Button>\n <Button variant=\"secondary\" onClick={onCancel} className=\"h-10!\">\n Cancelar\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA2BQ,SACE,KADF;AAzBR,SAAS,yBAAyB;AAClC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAQX,SAAR,8BAA+C;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AACF,GAAuC;AACrC,SACE,oBAAC,UAAO,MAAY,cAAc,UAChC,+BAAC,iBAAc,WAAU,sGACvB;AAAA,yBAAC,gBAAa,WAAU,WACtB;AAAA,0BAAC,eAAY,6CAA4B;AAAA,MACzC,oBAAC,qBAAkB,sFAEnB;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,2BACb;AAAA,0BAAC,SAAI,WAAU,kEACb,8BAAC,qBAAkB,MAAM,IAAI,WAAU,iBAAgB,GACzD;AAAA,MACA,qBAAC,SAAI,WAAU,uBACb;AAAA,4BAAC,UAAK,WAAU,2CAA0C,6CAE1D;AAAA,QACA,qBAAC,UAAK,WAAU,yCAAwC;AAAA;AAAA,UACP;AAAA,UAC/C,oBAAC,UAAK,WAAU,0CAAyC,2CAEzD;AAAA,UAAO;AAAA,WAET;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,aAAU,WAAU,UAAS;AAAA,IAE9B,qBAAC,SAAI,WAAU,+BACb;AAAA,0BAAC,UAAO,SAAS,WAAW,WAAU,SAAQ,uBAE9C;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,SAAS,UAAU,WAAU,SAAQ,sBAEjE;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useCallback, useEffect } from "react";
|
|
4
|
-
import { useTranslations } from "next-intl";
|
|
5
4
|
import { IconLock, IconAlertTriangle } from "@tabler/icons-react";
|
|
6
5
|
import { toast } from "sonner";
|
|
7
6
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
|
|
@@ -13,16 +12,15 @@ import { Toast } from "../ui/feedback/Toast";
|
|
|
13
12
|
import usePasswordVisibility from "../../hooks/usePasswordVisibility";
|
|
14
13
|
import { useAccountModals } from "../../store/useAccountModals";
|
|
15
14
|
import { AccountSectionType } from "../../enums/AccountSectionType";
|
|
15
|
+
const REASON_OPTIONS = [
|
|
16
|
+
{ value: "sem-funcao", label: "A ferramenta n\xE3o possui uma fun\xE7\xE3o que eu preciso" },
|
|
17
|
+
{ value: "problemas", label: "Encontrei problemas t\xE9cnicos ou erros no sistema" },
|
|
18
|
+
{ value: "suporte", label: "Tive problemas com o suporte ou atendimento" },
|
|
19
|
+
{ value: "demora", label: "As atualiza\xE7\xF5es demoram mais do que o esperado" },
|
|
20
|
+
{ value: "temporario", label: "O cancelamento \xE9 tempor\xE1rio" },
|
|
21
|
+
{ value: "outro", label: "Outro motivo" }
|
|
22
|
+
];
|
|
16
23
|
function DeleteAccountModal() {
|
|
17
|
-
const translate = useTranslations();
|
|
18
|
-
const reasonOptions = [
|
|
19
|
-
{ value: "sem-funcao", label: translate("common.account.deleteAccount.reasons.noFeature") },
|
|
20
|
-
{ value: "problemas", label: translate("common.account.deleteAccount.reasons.technical") },
|
|
21
|
-
{ value: "suporte", label: translate("common.account.deleteAccount.reasons.support") },
|
|
22
|
-
{ value: "demora", label: translate("common.account.deleteAccount.reasons.updates") },
|
|
23
|
-
{ value: "temporario", label: translate("common.account.deleteAccount.reasons.temporary") },
|
|
24
|
-
{ value: "outro", label: translate("common.account.deleteAccount.reasons.other") }
|
|
25
|
-
];
|
|
26
24
|
const {
|
|
27
25
|
activeModal,
|
|
28
26
|
deleteAccountError,
|
|
@@ -53,14 +51,7 @@ function DeleteAccountModal() {
|
|
|
53
51
|
const handleDelete = (e) => {
|
|
54
52
|
e.preventDefault();
|
|
55
53
|
if (!isFormValid) {
|
|
56
|
-
toast.custom((
|
|
57
|
-
Toast,
|
|
58
|
-
{
|
|
59
|
-
variant: "error",
|
|
60
|
-
message: translate("common.account.deleteAccount.requiredFields"),
|
|
61
|
-
toastId
|
|
62
|
-
}
|
|
63
|
-
));
|
|
54
|
+
toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "error", message: "Preencha todos os campos obrigat\xF3rios", toastId: t }));
|
|
64
55
|
return;
|
|
65
56
|
}
|
|
66
57
|
openConfirmDelete({ password });
|
|
@@ -70,18 +61,20 @@ function DeleteAccountModal() {
|
|
|
70
61
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-4 lg:p-6 flex-1 lg:flex-none", children: [
|
|
71
62
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "p-0", children: [
|
|
72
63
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5 mb-5", children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, className: "text-red-500" }) }),
|
|
73
|
-
/* @__PURE__ */ jsx(DialogTitle, { children:
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: "Excluir conta" }),
|
|
65
|
+
/* @__PURE__ */ jsxs(DialogDescription, { className: "paragraph-small-regular", children: [
|
|
66
|
+
"Esta a\xE7\xE3o \xE9 ",
|
|
67
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-950", children: "irrevers\xEDvel" }),
|
|
68
|
+
". Ao confirmar, sua conta e todos os seus dados ser\xE3o exclu\xEDdos."
|
|
69
|
+
] })
|
|
77
70
|
] }),
|
|
78
71
|
/* @__PURE__ */ jsx(
|
|
79
72
|
SelectField,
|
|
80
73
|
{
|
|
81
|
-
label:
|
|
74
|
+
label: "Motivo do cancelamento",
|
|
82
75
|
required: true,
|
|
83
|
-
placeholder:
|
|
84
|
-
options:
|
|
76
|
+
placeholder: "Selecione",
|
|
77
|
+
options: REASON_OPTIONS,
|
|
85
78
|
value: reason,
|
|
86
79
|
onChange: (value) => setReason(value),
|
|
87
80
|
className: "h-10!"
|
|
@@ -91,26 +84,27 @@ function DeleteAccountModal() {
|
|
|
91
84
|
/* @__PURE__ */ jsx(
|
|
92
85
|
TextAreaField,
|
|
93
86
|
{
|
|
94
|
-
label:
|
|
87
|
+
label: "Descreva o que levou a tomar essa decis\xE3o",
|
|
95
88
|
required: true,
|
|
96
|
-
placeholder:
|
|
89
|
+
placeholder: "Explique sua decis\xE3o...",
|
|
97
90
|
value: description,
|
|
98
91
|
onChange: (e) => setDescription(e.target.value),
|
|
99
92
|
rows: 4,
|
|
100
93
|
maxLength: 400
|
|
101
94
|
}
|
|
102
95
|
),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
/* @__PURE__ */ jsxs("span", { className: "paragraph-xsmall-medium text-gray-600 text-left mt-1 block", children: [
|
|
97
|
+
description.length,
|
|
98
|
+
"/400 caracteres"
|
|
99
|
+
] })
|
|
106
100
|
] }),
|
|
107
101
|
/* @__PURE__ */ jsx(
|
|
108
102
|
FormField,
|
|
109
103
|
{
|
|
110
104
|
className: "text-gray-600",
|
|
111
|
-
label:
|
|
105
|
+
label: "Senha",
|
|
112
106
|
type: "password",
|
|
113
|
-
placeholder:
|
|
107
|
+
placeholder: "Informe sua senha",
|
|
114
108
|
leftIcon: IconLock,
|
|
115
109
|
value: password,
|
|
116
110
|
onChange: (e) => {
|
|
@@ -132,10 +126,10 @@ function DeleteAccountModal() {
|
|
|
132
126
|
variant: "default",
|
|
133
127
|
className: "h-10",
|
|
134
128
|
type: "submit",
|
|
135
|
-
children:
|
|
129
|
+
children: "Excluir conta"
|
|
136
130
|
}
|
|
137
131
|
),
|
|
138
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10", type: "button", onClick: handleClose, children:
|
|
132
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10", type: "button", onClick: handleClose, children: "Fechar" })
|
|
139
133
|
] })
|
|
140
134
|
] }) }) });
|
|
141
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/account/DeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback, useEffect } from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/DeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback, useEffect } from 'react';\nimport { IconLock, IconAlertTriangle } from '@tabler/icons-react';\nimport { toast } from 'sonner';\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Button } from '../ui/buttons/Button';\nimport { FormField } from '../ui/form/FormField';\nimport { SelectField } from '../ui/form/SelectField';\nimport { TextAreaField } from '../ui/form/TextAreaField';\nimport { Toast } from '../ui/feedback/Toast';\nimport usePasswordVisibility from '../../hooks/usePasswordVisibility';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\n\nconst REASON_OPTIONS = [\n { value: 'sem-funcao', label: 'A ferramenta não possui uma função que eu preciso' },\n { value: 'problemas', label: 'Encontrei problemas técnicos ou erros no sistema' },\n { value: 'suporte', label: 'Tive problemas com o suporte ou atendimento' },\n { value: 'demora', label: 'As atualizações demoram mais do que o esperado' },\n { value: 'temporario', label: 'O cancelamento é temporário' },\n { value: 'outro', label: 'Outro motivo' },\n];\n\nexport default function DeleteAccountModal() {\n const {\n activeModal,\n deleteAccountError,\n openConfigurations,\n openConfirmDelete,\n clearDeleteAccountError,\n } = useAccountModals();\n const open = activeModal === 'deleteAccount';\n\n const [reason, setReason] = useState('');\n const [description, setDescription] = useState('');\n const [password, setPassword] = useState('');\n const { showPassword, togglePassword } = usePasswordVisibility();\n\n const isFormValid = Boolean(reason && description && password);\n\n const resetForm = useCallback(() => {\n setReason('');\n setDescription('');\n setPassword('');\n }, []);\n\n // Quando o modal deixa de estar aberto, limpa o erro residual do store\n // pra não aparecer numa próxima abertura vinda de fluxo limpo.\n useEffect(() => {\n if (!open) {\n clearDeleteAccountError();\n }\n }, [open, clearDeleteAccountError]);\n\n const handleClose = () => {\n resetForm();\n openConfigurations(AccountSectionType.SECURITY);\n };\n\n const handleDelete = (e: React.FormEvent) => {\n e.preventDefault();\n if (!isFormValid) {\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Preencha todos os campos obrigatórios\" toastId={t} />\n ));\n return;\n }\n openConfirmDelete({ password });\n // Campos locais podem ser limpos — o payload já está no store.\n resetForm();\n };\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent className=\"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-lg 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-y-auto\">\n <form onSubmit={handleDelete} className=\"flex flex-col flex-1 lg:flex-none\">\n <div className=\"flex flex-col gap-6 p-4 lg:p-6 flex-1 lg:flex-none\">\n <DialogHeader className=\"p-0\">\n <div className=\"flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5 mb-5\">\n <IconAlertTriangle size={20} className=\"text-red-500\" />\n </div>\n <DialogTitle>Excluir conta</DialogTitle>\n <DialogDescription className=\"paragraph-small-regular\">\n Esta ação é <span className=\"font-semibold text-gray-950\">irreversível</span>. Ao\n confirmar, sua conta e todos os seus dados serão excluídos.\n </DialogDescription>\n </DialogHeader>\n\n <SelectField\n label=\"Motivo do cancelamento\"\n required\n placeholder=\"Selecione\"\n options={REASON_OPTIONS}\n value={reason}\n onChange={(value) => setReason(value as string)}\n className=\"h-10!\"\n />\n\n <div>\n <TextAreaField\n label=\"Descreva o que levou a tomar essa decisão\"\n required\n placeholder=\"Explique sua decisão...\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={4}\n maxLength={400}\n />\n <span className=\"paragraph-xsmall-medium text-gray-600 text-left mt-1 block\">\n {description.length}/400 caracteres\n </span>\n </div>\n\n <FormField\n className=\"text-gray-600\"\n label=\"Senha\"\n type=\"password\"\n placeholder=\"Informe sua senha\"\n leftIcon={IconLock}\n value={password}\n onChange={(e) => {\n setPassword(e.target.value);\n if (deleteAccountError) clearDeleteAccountError();\n }}\n classnameContainer=\"h-10!\"\n showPassword={showPassword}\n onTogglePassword={togglePassword}\n error={!!deleteAccountError}\n errorMessage={deleteAccountError ?? undefined}\n />\n </div>\n\n <div className=\"flex flex-row items-center justify-start gap-2 p-4 lg:p-6 border-t border-gray-200 bg-white mt-auto lg:mt-0\">\n <Button\n variant=\"default\"\n className=\"h-10\"\n type=\"submit\"\n >\n Excluir conta\n </Button>\n <Button variant=\"secondary\" className=\"h-10\" type=\"button\" onClick={handleClose}>\n Fechar\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAgEQ,cAmBM,YAnBN;AA9DR,SAAS,UAAU,aAAa,iBAAiB;AACjD,SAAS,UAAU,yBAAyB;AAC5C,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,mBAAmB,cAAc,mBAAmB;AACpF,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,OAAO,2BAA2B;AAClC,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAEnC,MAAM,iBAAiB;AAAA,EACrB,EAAE,OAAO,cAAc,OAAO,6DAAoD;AAAA,EAClF,EAAE,OAAO,aAAa,OAAO,sDAAmD;AAAA,EAChF,EAAE,OAAO,WAAW,OAAO,8CAA8C;AAAA,EACzE,EAAE,OAAO,UAAU,OAAO,uDAAiD;AAAA,EAC3E,EAAE,OAAO,cAAc,OAAO,oCAA8B;AAAA,EAC5D,EAAE,OAAO,SAAS,OAAO,eAAe;AAC1C;AAEe,SAAR,qBAAsC;AAC3C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,iBAAiB;AACrB,QAAM,OAAO,gBAAgB;AAE7B,QA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;AAAA,UACN,UAAQ;AAAA,UACR,aAAY;AAAA,UACZ,SAAS;AAAA,UACT,OAAO;AAAA,UACP,UAAU,CAAC,UAAU,UAAU,KAAe;AAAA,UAC9C,WAAU;AAAA;AAAA,MACZ;AAAA,MAEA,qBAAC,SACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,UAAQ;AAAA,YACR,aAAY;AAAA,YACZ,OAAO;AAAA,YACP,UAAU,CAAC,MAAM,eAAe,EAAE,OAAO,KAAK;AAAA,YAC9C,MAAM;AAAA,YACN,WAAW;AAAA;AAAA,QACb;AAAA,QACA,qBAAC,UAAK,WAAU,8DACb;AAAA,sBAAY;AAAA,UAAO;AAAA,WACtB;AAAA,SACF;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAM;AAAA,UACN,MAAK;AAAA,UACL,aAAY;AAAA,UACZ,UAAU;AAAA,UACV,OAAO;AAAA,UACP,UAAU,CAAC,MAAM;AACf,wBAAY,EAAE,OAAO,KAAK;AAC1B,gBAAI,mBAAoB,yBAAwB;AAAA,UAClD;AAAA,UACA,oBAAmB;AAAA,UACnB;AAAA,UACA,kBAAkB;AAAA,UAClB,OAAO,CAAC,CAAC;AAAA,UACT,cAAc,sBAAsB;AAAA;AAAA,MACtC;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,+GACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,MAAK;AAAA,UACN;AAAA;AAAA,MAED;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,WAAU,QAAO,MAAK,UAAS,SAAS,aAAa,oBAEjF;AAAA,OACF;AAAA,KACF,GACF,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 { IconShieldCheck } from "@tabler/icons-react";
|
|
5
4
|
import { Button } from "../ui/buttons/Button";
|
|
6
5
|
import {
|
|
@@ -18,7 +17,6 @@ function DisableTwoFactorAuthModal({
|
|
|
18
17
|
onClose,
|
|
19
18
|
onSuccess
|
|
20
19
|
}) {
|
|
21
|
-
const translate = useTranslations();
|
|
22
20
|
const { code, setCode, isValid, isLoading, handleClose, handleSubmit } = useDisableTwoFactorAuthForm({ onClose, onSuccess });
|
|
23
21
|
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsx(DialogContent, { overlayClassName: "z-[1010]", 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-dvh top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-117.5 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%]", children: /* @__PURE__ */ jsxs(
|
|
24
22
|
"form",
|
|
@@ -32,11 +30,11 @@ function DisableTwoFactorAuthModal({
|
|
|
32
30
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 lg:gap-5 p-4 lg:p-5 flex-1 lg:flex-none", children: [
|
|
33
31
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-fit bg-gray-50 rounded-lg p-2", children: /* @__PURE__ */ jsx(IconShieldCheck, { size: 20, className: "text-gray-600" }) }),
|
|
34
32
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "p-0 gap-2", children: [
|
|
35
|
-
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children:
|
|
36
|
-
/* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular text-gray-600", children:
|
|
33
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: "Desabilitar autentica\xE7\xE3o 2FA" }),
|
|
34
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular text-gray-600", children: "Informe o c\xF3digo de 6 d\xEDgitos do seu aplicativo autenticador para confirmar a desativa\xE7\xE3o." })
|
|
37
35
|
] }),
|
|
38
36
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
39
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-gray-700", children:
|
|
37
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-gray-700", children: "C\xF3digo do autenticador" }),
|
|
40
38
|
/* @__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(
|
|
41
39
|
InputOTPSlot,
|
|
42
40
|
{
|
|
@@ -48,7 +46,7 @@ function DisableTwoFactorAuthModal({
|
|
|
48
46
|
] })
|
|
49
47
|
] }),
|
|
50
48
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0", children: [
|
|
51
|
-
/* @__PURE__ */ jsx(Button, { className: "h-10! flex-1", disabled: !isValid || isLoading, type: "submit", children: isLoading ?
|
|
49
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10! flex-1", disabled: !isValid || isLoading, type: "submit", children: isLoading ? "Desabilitando..." : "Desabilitar 2FA" }),
|
|
52
50
|
/* @__PURE__ */ jsx(
|
|
53
51
|
Button,
|
|
54
52
|
{
|
|
@@ -56,7 +54,7 @@ function DisableTwoFactorAuthModal({
|
|
|
56
54
|
className: "h-10! flex-1",
|
|
57
55
|
type: "button",
|
|
58
56
|
onClick: handleClose,
|
|
59
|
-
children:
|
|
57
|
+
children: "Cancelar"
|
|
60
58
|
}
|
|
61
59
|
)
|
|
62
60
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/account/DisableTwoFactorAuthModal.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/DisableTwoFactorAuthModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconShieldCheck } from '@tabler/icons-react';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../ui/overlay/Dialog';\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from '../ui/form/InputOtp';\nimport { REGEXP_ONLY_DIGITS } from 'input-otp';\nimport useDisableTwoFactorAuthForm from './hooks/useDisableTwoFactorAuthForm';\n\ninterface DisableTwoFactorAuthModalProps {\n open: boolean;\n onClose: () => void;\n onSuccess?: () => void;\n}\n\nexport default function DisableTwoFactorAuthModal({\n open,\n onClose,\n onSuccess,\n}: DisableTwoFactorAuthModalProps) {\n const { code, setCode, isValid, isLoading, handleClose, handleSubmit } =\n useDisableTwoFactorAuthForm({ onClose, onSuccess });\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent overlayClassName=\"z-[1010]\" 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-dvh top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-117.5 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 <form\n onSubmit={(e) => {\n e.preventDefault();\n handleSubmit();\n }}\n className=\"flex flex-col flex-1 lg:flex-none\"\n >\n <div className=\"flex flex-col gap-4 lg:gap-5 p-4 lg:p-5 flex-1 lg:flex-none\">\n <div className=\"flex items-center justify-center w-fit bg-gray-50 rounded-lg p-2\">\n <IconShieldCheck size={20} className=\"text-gray-600\" />\n </div>\n <DialogHeader className=\"p-0 gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950\">\n Desabilitar autenticação 2FA\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-gray-600\">\n Informe o código de 6 dígitos do seu aplicativo autenticador para confirmar a\n desativação.\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"flex flex-col gap-2\">\n <span className=\"paragraph-small-medium text-gray-700\">Código do autenticador</span>\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\n <div className=\"flex flex-row items-center gap-2 p-4 lg:p-5 border-t border-gray-200 mt-auto lg:mt-0\">\n <Button className=\"h-10! flex-1\" disabled={!isValid || isLoading} type=\"submit\">\n {isLoading ? 'Desabilitando...' : 'Desabilitar 2FA'}\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! flex-1\"\n type=\"button\"\n onClick={handleClose}\n >\n Cancelar\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAyCc,cAEF,YAFE;AAvCd,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU,eAAe,oBAAoB;AACtD,SAAS,0BAA0B;AACnC,OAAO,iCAAiC;AAQzB,SAAR,0BAA2C;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AACF,GAAmC;AACjC,QAAM,EAAE,MAAM,SAAS,SAAS,WAAW,aAAa,aAAa,IACnE,4BAA4B,EAAE,SAAS,UAAU,CAAC;AAEpD,SACE,oBAAC,UAAO,MAAY,cAAc,aAChC,8BAAC,iBAAc,kBAAiB,YAAW,WAAU,wTACnD;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,CAAC,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