@greatapps/common 1.1.676 → 1.1.678
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 +8 -6
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
- package/dist/components/account/ConfirmDeleteAccountModal.mjs +20 -19
- package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs +10 -11
- package/dist/components/account/ConfirmGlobalPreferencesModal.mjs.map +1 -1
- package/dist/components/account/DeleteAccountModal.mjs +34 -28
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/DisableTwoFactorAuthModal.mjs +7 -5
- package/dist/components/account/DisableTwoFactorAuthModal.mjs.map +1 -1
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +8 -9
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -1
- package/dist/components/account/TwoFactorAuthModal.mjs +22 -23
- 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 +5 -3
- package/dist/components/account/hooks/useChangeEmailForm.mjs.map +1 -1
- package/dist/components/account/hooks/useChangePasswordForm.mjs +26 -3
- package/dist/components/account/hooks/useChangePasswordForm.mjs.map +1 -1
- package/dist/components/account/hooks/useChangePhoneForm.mjs +18 -9
- package/dist/components/account/hooks/useChangePhoneForm.mjs.map +1 -1
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs +26 -3
- package/dist/components/account/hooks/useDisableTwoFactorAuthForm.mjs.map +1 -1
- package/dist/components/account/hooks/useOtpVerification.mjs +19 -3
- package/dist/components/account/hooks/useOtpVerification.mjs.map +1 -1
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs +27 -4
- package/dist/components/account/hooks/useTwoFactorAuthForm.mjs.map +1 -1
- package/dist/components/account/sections/ChangeEmailModal.mjs +25 -28
- package/dist/components/account/sections/ChangeEmailModal.mjs.map +1 -1
- package/dist/components/account/sections/ChangePasswordSection.mjs +8 -6
- package/dist/components/account/sections/ChangePasswordSection.mjs.map +1 -1
- package/dist/components/account/sections/ChangePhoneModal.mjs +24 -27
- package/dist/components/account/sections/ChangePhoneModal.mjs.map +1 -1
- package/dist/components/account/sections/MyProfileSection.mjs +37 -22
- package/dist/components/account/sections/MyProfileSection.mjs.map +1 -1
- package/dist/components/account/sections/PreferencesSection.mjs +48 -24
- package/dist/components/account/sections/PreferencesSection.mjs.map +1 -1
- package/dist/components/account/sections/SecuritySection.mjs +11 -9
- package/dist/components/account/sections/SecuritySection.mjs.map +1 -1
- package/dist/components/account/sections/TokenSection.mjs +24 -8
- package/dist/components/account/sections/TokenSection.mjs.map +1 -1
- package/dist/components/layouts/NavBar.mjs +5 -3
- package/dist/components/layouts/NavBar.mjs.map +1 -1
- package/dist/components/layouts/NotificationsPopover.mjs +5 -3
- package/dist/components/layouts/NotificationsPopover.mjs.map +1 -1
- package/dist/components/layouts/ProfilePopover.mjs +6 -4
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/layouts/UsersSelectorPopover.mjs +9 -7
- package/dist/components/layouts/UsersSelectorPopover.mjs.map +1 -1
- package/dist/components/modals/BuyCreditsModal.mjs +17 -18
- package/dist/components/modals/BuyCreditsModal.mjs.map +1 -1
- package/dist/components/modals/CreditsDisabledModal.mjs +6 -4
- package/dist/components/modals/CreditsDisabledModal.mjs.map +1 -1
- package/dist/components/modals/PaidPlanRequiredModal.mjs +5 -3
- package/dist/components/modals/PaidPlanRequiredModal.mjs.map +1 -1
- package/dist/components/modals/cards/AddCardModal.mjs +64 -46
- package/dist/components/modals/cards/AddCardModal.mjs.map +1 -1
- package/dist/components/modals/cards/CannotDeleteCardModal.mjs +9 -7
- package/dist/components/modals/cards/CannotDeleteCardModal.mjs.map +1 -1
- package/dist/components/modals/cards/CardFormFields.mjs +65 -51
- package/dist/components/modals/cards/CardFormFields.mjs.map +1 -1
- package/dist/components/modals/cards/DeleteCardModal.mjs +10 -8
- package/dist/components/modals/cards/DeleteCardModal.mjs.map +1 -1
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs +4 -2
- package/dist/components/navigation/CancelledSubscriptionBanner.mjs.map +1 -1
- package/dist/components/navigation/OverdueInvoiceBanner.mjs +4 -2
- package/dist/components/navigation/OverdueInvoiceBanner.mjs.map +1 -1
- package/dist/components/navigation/PendingCancellationBanner.mjs +4 -6
- package/dist/components/navigation/PendingCancellationBanner.mjs.map +1 -1
- package/dist/components/navigation/ProjectSelectorPopover.mjs +8 -6
- package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -1
- package/dist/components/navigation/UpcomingInvoiceBanner.mjs +4 -6
- package/dist/components/navigation/UpcomingInvoiceBanner.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/BottomLinks.mjs +5 -3
- package/dist/components/navigation/subcomponents/BottomLinks.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/CreditsCard.mjs +3 -1
- package/dist/components/navigation/subcomponents/CreditsCard.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/PlanCard.mjs +3 -1
- package/dist/components/navigation/subcomponents/PlanCard.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs +5 -3
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
- package/dist/components/pages/NotFoundPage.mjs +5 -3
- package/dist/components/pages/NotFoundPage.mjs.map +1 -1
- package/dist/components/pages/notifications/Notifications.mjs +13 -10
- package/dist/components/pages/notifications/Notifications.mjs.map +1 -1
- package/dist/components/ui/buttons/CopyButton.mjs +9 -5
- package/dist/components/ui/buttons/CopyButton.mjs.map +1 -1
- package/dist/components/ui/data-display/CardItem.mjs +7 -5
- package/dist/components/ui/data-display/CardItem.mjs.map +1 -1
- package/dist/components/ui/data-display/PaymentInfoCard.mjs +10 -8
- package/dist/components/ui/data-display/PaymentInfoCard.mjs.map +1 -1
- package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs +3 -1
- package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -1
- package/dist/components/ui/form/ComboboxField.mjs +11 -6
- package/dist/components/ui/form/ComboboxField.mjs.map +1 -1
- package/dist/components/ui/form/DatePicker.mjs +5 -2
- package/dist/components/ui/form/DatePicker.mjs.map +1 -1
- package/dist/components/ui/form/DateRangePicker.mjs +5 -2
- package/dist/components/ui/form/DateRangePicker.mjs.map +1 -1
- package/dist/components/ui/form/PhoneInput.mjs +5 -3
- package/dist/components/ui/form/PhoneInput.mjs.map +1 -1
- package/dist/components/ui/form/SelectField.mjs +6 -3
- package/dist/components/ui/form/SelectField.mjs.map +1 -1
- package/dist/components/widgets/ImageUpload/ImageCropModal.mjs +11 -18
- package/dist/components/widgets/ImageUpload/ImageCropModal.mjs.map +1 -1
- package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs +6 -15
- package/dist/components/widgets/ImageUpload/ImageTooSmallModal.mjs.map +1 -1
- package/dist/i18n/config.mjs +13 -0
- package/dist/i18n/config.mjs.map +1 -0
- package/dist/i18n/country-language.mjs +74 -0
- package/dist/i18n/country-language.mjs.map +1 -0
- package/dist/i18n/messages/en-us.mjs +495 -0
- package/dist/i18n/messages/en-us.mjs.map +1 -0
- package/dist/i18n/messages/es-es.mjs +495 -0
- package/dist/i18n/messages/es-es.mjs.map +1 -0
- package/dist/i18n/messages/index.mjs +16 -0
- package/dist/i18n/messages/index.mjs.map +1 -0
- package/dist/i18n/messages/pt-br.mjs +508 -0
- package/dist/i18n/messages/pt-br.mjs.map +1 -0
- package/dist/i18n/normalize.mjs +12 -0
- package/dist/i18n/normalize.mjs.map +1 -0
- package/dist/i18n/resolve-locale.mjs +42 -0
- package/dist/i18n/resolve-locale.mjs.map +1 -0
- package/dist/i18n.mjs +14 -0
- package/dist/i18n.mjs.map +1 -0
- package/dist/index.mjs +19 -3
- package/dist/index.mjs.map +1 -1
- package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs +20 -0
- package/dist/modules/accounts/hooks/use-currency-formatter.hook.mjs.map +1 -0
- package/dist/modules/cards/hooks/handle-delete-card.hook.mjs +2 -1
- package/dist/modules/cards/hooks/handle-delete-card.hook.mjs.map +1 -1
- package/dist/modules/images/utils/validate-image.mjs +8 -8
- package/dist/modules/images/utils/validate-image.mjs.map +1 -1
- package/dist/modules/plans/handlers/list-plans.handler.mjs +1 -1
- package/dist/modules/plans/handlers/list-plans.handler.mjs.map +1 -1
- package/dist/modules/plans/hooks/list-plans.hook.mjs +2 -2
- package/dist/modules/plans/hooks/list-plans.hook.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 +9 -2
- package/dist/modules/plans/types/plan.type.mjs.map +1 -1
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs +66 -34
- package/dist/modules/plans/utils/map-api-plan-to-ui.mjs.map +1 -1
- package/dist/modules/projects/services/projects.service.mjs +9 -0
- package/dist/modules/projects/services/projects.service.mjs.map +1 -1
- package/dist/modules/subscriptions/utils/periodicity.mjs +20 -14
- package/dist/modules/subscriptions/utils/periodicity.mjs.map +1 -1
- package/dist/providers/auth.provider.mjs +9 -1
- package/dist/providers/auth.provider.mjs.map +1 -1
- package/dist/server.mjs +2 -0
- package/dist/server.mjs.map +1 -1
- package/dist/utils/format/currency.mjs +32 -4
- package/dist/utils/format/currency.mjs.map +1 -1
- package/dist/utils/intl/cookie-domain.mjs +17 -0
- package/dist/utils/intl/cookie-domain.mjs.map +1 -0
- package/dist/utils/intl/locale-cookie.mjs +13 -0
- package/dist/utils/intl/locale-cookie.mjs.map +1 -0
- package/dist/utils/intl/locales.mjs +3 -2
- package/dist/utils/intl/locales.mjs.map +1 -1
- package/package.json +7 -1
- package/src/components/account/ConfigurationsMyAccountModal.tsx +10 -6
- package/src/components/account/ConfirmDeleteAccountModal.tsx +22 -13
- package/src/components/account/ConfirmGlobalPreferencesModal.tsx +12 -10
- package/src/components/account/DeleteAccountModal.tsx +34 -24
- package/src/components/account/DisableTwoFactorAuthModal.tsx +11 -6
- package/src/components/account/IsntPossibleDeleteAccountModal.tsx +8 -6
- package/src/components/account/TwoFactorAuthModal.tsx +33 -29
- package/src/components/account/constants.ts +8 -5
- package/src/components/account/hooks/useChangeEmailForm.tsx +5 -3
- package/src/components/account/hooks/useChangePasswordForm.tsx +20 -6
- package/src/components/account/hooks/useChangePhoneForm.tsx +16 -10
- package/src/components/account/hooks/useDisableTwoFactorAuthForm.tsx +20 -6
- package/src/components/account/hooks/useOtpVerification.tsx +16 -4
- package/src/components/account/hooks/useTwoFactorAuthForm.tsx +21 -7
- package/src/components/account/sections/ChangeEmailModal.tsx +35 -21
- package/src/components/account/sections/ChangePasswordSection.tsx +10 -6
- package/src/components/account/sections/ChangePhoneModal.tsx +50 -22
- package/src/components/account/sections/MyProfileSection.tsx +37 -23
- package/src/components/account/sections/PreferencesSection.tsx +52 -25
- package/src/components/account/sections/SecuritySection.tsx +19 -10
- package/src/components/account/sections/TokenSection.tsx +22 -10
- package/src/components/layouts/NavBar.tsx +5 -3
- package/src/components/layouts/NotificationsPopover.tsx +5 -3
- package/src/components/layouts/ProfilePopover.tsx +6 -4
- package/src/components/layouts/UsersSelectorPopover.tsx +9 -7
- package/src/components/modals/BuyCreditsModal.tsx +18 -16
- package/src/components/modals/CreditsDisabledModal.tsx +6 -6
- package/src/components/modals/PaidPlanRequiredModal.tsx +5 -3
- package/src/components/modals/cards/AddCardModal.tsx +89 -62
- package/src/components/modals/cards/CannotDeleteCardModal.tsx +9 -8
- package/src/components/modals/cards/CardFormFields.tsx +93 -75
- package/src/components/modals/cards/DeleteCardModal.tsx +10 -8
- package/src/components/navigation/CancelledSubscriptionBanner.tsx +4 -2
- package/src/components/navigation/OverdueInvoiceBanner.tsx +4 -2
- package/src/components/navigation/PendingCancellationBanner.tsx +4 -2
- package/src/components/navigation/ProjectSelectorPopover.tsx +8 -6
- package/src/components/navigation/UpcomingInvoiceBanner.tsx +4 -2
- package/src/components/navigation/subcomponents/BottomLinks.tsx +5 -3
- package/src/components/navigation/subcomponents/CreditsCard.tsx +3 -1
- package/src/components/navigation/subcomponents/PlanCard.tsx +3 -1
- package/src/components/navigation/subcomponents/ProjectSelector.tsx +5 -3
- package/src/components/pages/NotFoundPage.tsx +5 -3
- package/src/components/pages/notifications/Notifications.tsx +13 -10
- package/src/components/ui/buttons/CopyButton.tsx +10 -5
- package/src/components/ui/data-display/CardItem.tsx +7 -5
- package/src/components/ui/data-display/PaymentInfoCard.tsx +10 -8
- package/src/components/ui/feedback/CircularProgress.tsx +4 -0
- package/src/components/ui/feedback/DefaultCircularProgress.tsx +3 -1
- package/src/components/ui/form/ComboboxField.tsx +11 -6
- package/src/components/ui/form/DatePicker.tsx +5 -2
- package/src/components/ui/form/DateRangePicker.tsx +5 -2
- package/src/components/ui/form/PhoneInput.tsx +5 -3
- package/src/components/ui/form/SelectField.tsx +6 -3
- package/src/components/widgets/ImageUpload/ImageCropModal.tsx +19 -11
- package/src/components/widgets/ImageUpload/ImageTooSmallModal.tsx +6 -5
- package/src/i18n/config.ts +17 -0
- package/src/i18n/country-language.ts +60 -0
- package/src/i18n/messages/en-us.ts +515 -0
- package/src/i18n/messages/es-es.ts +516 -0
- package/src/i18n/messages/index.ts +24 -0
- package/src/i18n/messages/pt-br.ts +539 -0
- package/src/i18n/normalize.ts +15 -0
- package/src/i18n/resolve-locale.ts +77 -0
- package/src/i18n.ts +10 -0
- package/src/index.ts +13 -2
- package/src/modules/accounts/hooks/use-currency-formatter.hook.tsx +32 -0
- package/src/modules/cards/hooks/handle-delete-card.hook.ts +8 -3
- package/src/modules/images/utils/validate-image.ts +23 -8
- package/src/modules/plans/handlers/list-plans.handler.ts +1 -1
- package/src/modules/plans/hooks/list-plans.hook.ts +2 -2
- package/src/modules/plans/services/plans.service.ts +1 -1
- package/src/modules/plans/types/plan.type.ts +9 -1
- package/src/modules/plans/utils/map-api-plan-to-ui.ts +115 -46
- package/src/modules/projects/services/projects.service.ts +12 -0
- package/src/modules/subscriptions/utils/periodicity.ts +29 -12
- package/src/providers/auth.provider.tsx +13 -1
- package/src/server.ts +2 -0
- package/src/utils/format/currency.ts +62 -7
- package/src/utils/intl/cookie-domain.ts +29 -0
- package/src/utils/intl/locale-cookie.ts +18 -0
- package/src/utils/intl/locales.ts +3 -2
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
|
|
5
6
|
import { Tabs, TabsList, TabsTrigger, TabsContent } from "../ui/data-display/Tabs";
|
|
6
7
|
import { cn } from "../../infra/utils/clsx";
|
|
@@ -18,6 +19,7 @@ import { useActiveSubscription } from "../../modules/subscriptions/hooks/find-ac
|
|
|
18
19
|
import { hasSubscriptionExpired } from "../../modules/subscriptions/utils/has-subscription-expired";
|
|
19
20
|
import { useWhitelabel } from "../../providers/whitelabel.provider";
|
|
20
21
|
function ConfigurationsMyAccountModal() {
|
|
22
|
+
const translate = useTranslations();
|
|
21
23
|
const {
|
|
22
24
|
activeModal,
|
|
23
25
|
openDeleteAccount,
|
|
@@ -62,9 +64,9 @@ function ConfigurationsMyAccountModal() {
|
|
|
62
64
|
overlayClassName: "bg-black/20 lg:bg-black/50",
|
|
63
65
|
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%]",
|
|
64
66
|
children: [
|
|
65
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: "
|
|
67
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "sr-only", children: /* @__PURE__ */ jsx(DialogTitle, { children: translate("common.account.configurations.title") }) }),
|
|
66
68
|
/* @__PURE__ */ jsxs("div", { className: "md:hidden flex items-center justify-between px-5 py-3 border-b border-gray-200", children: [
|
|
67
|
-
/* @__PURE__ */ jsx("span", { className: "text-gray-950 paragraph-medium-semibold", children: "
|
|
69
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-950 paragraph-medium-semibold", children: translate("common.account.configurations.title") }),
|
|
68
70
|
/* @__PURE__ */ jsx(
|
|
69
71
|
"button",
|
|
70
72
|
{
|
|
@@ -95,19 +97,19 @@ function ConfigurationsMyAccountModal() {
|
|
|
95
97
|
"[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-24px),transparent)] lg:[mask-image:none]"
|
|
96
98
|
),
|
|
97
99
|
children: [
|
|
98
|
-
/* @__PURE__ */ jsx("span", { className: "hidden lg:block paragraph-medium-semibold text-gray-950 mb-0", children: "
|
|
100
|
+
/* @__PURE__ */ jsx("span", { className: "hidden lg:block paragraph-medium-semibold text-gray-950 mb-0", children: translate("common.account.configurations.title") }),
|
|
99
101
|
/* @__PURE__ */ jsxs("div", { className: "lg:flex lg:flex-col flex flex-row lg:gap-0 gap-0 lg:w-full", children: [
|
|
100
102
|
/* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.PREFERENCES, className: tabTriggerClasses, children: [
|
|
101
103
|
/* @__PURE__ */ jsx(IconSettings2, { size: 20, className: "shrink-0" }),
|
|
102
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "
|
|
104
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: translate("common.preferences.title") })
|
|
103
105
|
] }),
|
|
104
106
|
isOwner && whitelabel?.id === 1 && /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.TOKEN, className: tabTriggerClasses, children: [
|
|
105
107
|
/* @__PURE__ */ jsx(IconKey, { size: 20, className: "shrink-0" }),
|
|
106
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "
|
|
108
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: translate("common.account.token.title") })
|
|
107
109
|
] }),
|
|
108
110
|
isOwner && /* @__PURE__ */ jsxs(TabsTrigger, { value: AccountSectionType.SECURITY, className: tabTriggerClasses, children: [
|
|
109
111
|
/* @__PURE__ */ jsx(IconLock, { size: 20, className: "shrink-0" }),
|
|
110
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: "
|
|
112
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium", children: translate("common.account.security.title") })
|
|
111
113
|
] })
|
|
112
114
|
] })
|
|
113
115
|
]
|
|
@@ -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 { 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,S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ACE;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 { 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,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,iBAAiB;AACrB,QAAM,EAAE,WAAW,IAAI,cAAc;AAErC,QAAM,OA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AA,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,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslations } from "next-intl";
|
|
3
4
|
import { IconAlertTriangle } from "@tabler/icons-react";
|
|
4
5
|
import { toast } from "sonner";
|
|
5
6
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
import { useAuth } from "../../providers/auth.provider";
|
|
15
16
|
import { UserProfile } from "../../modules/users/schema";
|
|
16
17
|
function ConfirmDeleteAccountModal() {
|
|
18
|
+
const translate = useTranslations();
|
|
17
19
|
const { activeModal, deleteAccountPayload, openDeleteAccount, close } = useAccountModals();
|
|
18
20
|
const open = activeModal === "confirmDelete";
|
|
19
21
|
const { data: pagesCount = 0 } = useCountPages();
|
|
@@ -26,7 +28,7 @@ function ConfirmDeleteAccountModal() {
|
|
|
26
28
|
try {
|
|
27
29
|
if (isOwner) {
|
|
28
30
|
if (!deleteAccountPayload) {
|
|
29
|
-
openDeleteAccount("
|
|
31
|
+
openDeleteAccount(translate("common.account.confirmDelete.sessionExpired"));
|
|
30
32
|
return;
|
|
31
33
|
}
|
|
32
34
|
await deleteAccount.mutateAsync({ password: deleteAccountPayload.password });
|
|
@@ -34,39 +36,38 @@ function ConfirmDeleteAccountModal() {
|
|
|
34
36
|
await deleteAccountUser.mutateAsync(user.id);
|
|
35
37
|
}
|
|
36
38
|
close();
|
|
37
|
-
toast.custom((
|
|
39
|
+
toast.custom((toastId) => /* @__PURE__ */ jsx(
|
|
40
|
+
Toast,
|
|
41
|
+
{
|
|
42
|
+
variant: "success",
|
|
43
|
+
message: translate("common.account.confirmDelete.success"),
|
|
44
|
+
toastId
|
|
45
|
+
}
|
|
46
|
+
));
|
|
38
47
|
await logout();
|
|
39
48
|
} catch (error) {
|
|
40
|
-
const message = error instanceof Error ? error.message : "
|
|
49
|
+
const message = error instanceof Error ? error.message : translate("common.account.confirmDelete.error");
|
|
41
50
|
if (isOwner) {
|
|
42
51
|
openDeleteAccount(message);
|
|
43
52
|
return;
|
|
44
53
|
}
|
|
45
|
-
toast.custom((
|
|
54
|
+
toast.custom((toastId) => /* @__PURE__ */ jsx(Toast, { variant: "error", message, toastId }));
|
|
46
55
|
}
|
|
47
56
|
};
|
|
48
57
|
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: [
|
|
49
58
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 p-4 lg:p-5", children: [
|
|
50
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "p-0", children: /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: "
|
|
59
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "p-0", children: /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: translate("common.account.confirmDelete.title") }) }),
|
|
51
60
|
/* @__PURE__ */ jsxs("div", { className: "bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4", children: [
|
|
52
61
|
/* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, className: "text-red-500 shrink-0", strokeWidth: 2 }),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
|
|
55
|
-
" ",
|
|
56
|
-
|
|
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
|
-
] })
|
|
62
|
+
/* @__PURE__ */ jsx("p", { className: "paragraph-small-regular text-gray-600", children: translate.rich("common.account.confirmDelete.warning", {
|
|
63
|
+
count: String(pagesCount),
|
|
64
|
+
b: (chunks) => /* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-950", children: chunks })
|
|
65
|
+
}) })
|
|
65
66
|
] })
|
|
66
67
|
] }),
|
|
67
68
|
/* @__PURE__ */ jsx("div", { className: "h-px bg-gray-200" }),
|
|
68
69
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-4 lg:p-5", children: [
|
|
69
|
-
/* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: close, disabled: isDeleting, children: "
|
|
70
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: close, disabled: isDeleting, children: translate("common.account.confirmDelete.keepAccount") }),
|
|
70
71
|
/* @__PURE__ */ jsx(
|
|
71
72
|
Button,
|
|
72
73
|
{
|
|
@@ -74,7 +75,7 @@ function ConfirmDeleteAccountModal() {
|
|
|
74
75
|
className: "h-10! flex-1",
|
|
75
76
|
onClick: handleConfirm,
|
|
76
77
|
disabled: isDeleting,
|
|
77
|
-
children: isDeleting ? "
|
|
78
|
+
children: isDeleting ? translate("common.account.confirmDelete.deleting") : translate("common.account.confirmDelete.deleteAnyway")
|
|
78
79
|
}
|
|
79
80
|
)
|
|
80
81
|
] })
|
|
@@ -1 +1 @@
|
|
|
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('
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/ConfirmDeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useTranslations } from 'next-intl';\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 translate = useTranslations();\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(translate('common.account.confirmDelete.sessionExpired'));\n return;\n }\n await deleteAccount.mutateAsync({ password: deleteAccountPayload.password });\n } else {\n await deleteAccountUser.mutateAsync(user!.id);\n }\n close();\n toast.custom((toastId) => (\n <Toast\n variant=\"success\"\n message={translate('common.account.confirmDelete.success')}\n toastId={toastId}\n />\n ));\n await logout();\n } catch (error) {\n const message =\n error instanceof Error ? error.message : translate('common.account.confirmDelete.error');\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((toastId) => (\n <Toast variant=\"error\" message={message} toastId={toastId} />\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 {translate('common.account.confirmDelete.title')}\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 {translate.rich('common.account.confirmDelete.warning', {\n count: String(pagesCount),\n b: (chunks) => <span className=\"font-semibold text-gray-950\">{chunks}</span>,\n })}\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 {translate('common.account.confirmDelete.keepAccount')}\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! flex-1\"\n onClick={handleConfirm}\n disabled={isDeleting}\n >\n {isDeleting\n ? translate('common.account.confirmDelete.deleting')\n : translate('common.account.confirmDelete.deleteAnyway')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA8CQ,cAgCE,YAhCF;AA5CR,SAAS,uBAAuB;AAChC,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,YAAY,gBAAgB;AAClC,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,oBAAoB,qBAAqB;AAC/C,QAAM,aAAa,cAAc,aAAa,kBAAkB;AAEhE,QAAM,gBAA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AU,eAAc,SAAS,OAAO,UAAU,YACvD,oBAAU,0CAA0C,GACvD;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,SAAS;AAAA,UACT,UAAU;AAAA,UAET,uBACG,UAAU,uCAAuC,IACjD,UAAU,2CAA2C;AAAA;AAAA,MAC3D;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslations } from "next-intl";
|
|
3
4
|
import { IconAlertTriangle } from "@tabler/icons-react";
|
|
4
5
|
import { Button } from "../ui/buttons/Button";
|
|
5
6
|
import {
|
|
@@ -15,27 +16,25 @@ function ConfirmGlobalPreferencesModal({
|
|
|
15
16
|
onConfirm,
|
|
16
17
|
onCancel
|
|
17
18
|
}) {
|
|
19
|
+
const translate = useTranslations();
|
|
18
20
|
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: [
|
|
19
21
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "sr-only", children: [
|
|
20
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "
|
|
21
|
-
/* @__PURE__ */ jsx(DialogDescription, { children: "
|
|
22
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: translate("common.account.globalPreferences.title") }),
|
|
23
|
+
/* @__PURE__ */ jsx(DialogDescription, { children: translate("common.account.globalPreferences.srDescription") })
|
|
22
24
|
] }),
|
|
23
25
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 p-5", children: [
|
|
24
26
|
/* @__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" }) }),
|
|
25
27
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
26
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children: "
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-gray-950", children: "todos os usu\xE1rios da conta" }),
|
|
31
|
-
". Deseja confirmar?"
|
|
32
|
-
] })
|
|
28
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-medium-semibold text-gray-950", children: translate("common.account.globalPreferences.title") }),
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-regular text-gray-600", children: translate.rich("common.account.globalPreferences.warning", {
|
|
30
|
+
b: (chunks) => /* @__PURE__ */ jsx("span", { className: "paragraph-small-semibold text-gray-950", children: chunks })
|
|
31
|
+
}) })
|
|
33
32
|
] })
|
|
34
33
|
] }),
|
|
35
34
|
/* @__PURE__ */ jsx(Separator, { className: "w-full" }),
|
|
36
35
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-5", children: [
|
|
37
|
-
/* @__PURE__ */ jsx(Button, { onClick: onConfirm, className: "h-10!", children: "
|
|
38
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: onCancel, className: "h-10!", children: "
|
|
36
|
+
/* @__PURE__ */ jsx(Button, { onClick: onConfirm, className: "h-10!", children: translate("common.actions.confirm") }),
|
|
37
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: onCancel, className: "h-10!", children: translate("common.actions.cancel") })
|
|
39
38
|
] })
|
|
40
39
|
] }) });
|
|
41
40
|
}
|
|
@@ -1 +1 @@
|
|
|
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>
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/ConfirmGlobalPreferencesModal.tsx"],"sourcesContent":["'use client';\n\nimport { useTranslations } from 'next-intl';\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 const translate = useTranslations();\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>{translate('common.account.globalPreferences.title')}</DialogTitle>\n <DialogDescription>\n {translate('common.account.globalPreferences.srDescription')}\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 {translate('common.account.globalPreferences.title')}\n </span>\n <span className=\"paragraph-small-regular text-gray-600\">\n {translate.rich('common.account.globalPreferences.warning', {\n b: (chunks) => (\n <span className=\"paragraph-small-semibold text-gray-950\">{chunks}</span>\n ),\n })}\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 {translate('common.actions.confirm')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel} className=\"h-10!\">\n {translate('common.actions.cancel')}\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA6BQ,SACE,KADF;AA3BR,SAAS,uBAAuB;AAChC,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,QAAM,YAAY,gBAAgB;AAClC,SACE,oBAAC,UAAO,MAAY,cAAc,UAChC,+BAAC,iBAAc,WAAU,sGACvB;AAAA,yBAAC,gBAAa,WAAU,WACtB;AAAA,0BAAC,eAAa,oBAAU,wCAAwC,GAAE;AAAA,MAClE,oBAAC,qBACE,oBAAU,gDAAgD,GAC7D;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,2CACb,oBAAU,wCAAwC,GACrD;AAAA,QACA,oBAAC,UAAK,WAAU,yCACb,oBAAU,KAAK,4CAA4C;AAAA,UAC1D,GAAG,CAAC,WACF,oBAAC,UAAK,WAAU,0CAA0C,kBAAO;AAAA,QAErE,CAAC,GACH;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,aAAU,WAAU,UAAS;AAAA,IAE9B,qBAAC,SAAI,WAAU,+BACb;AAAA,0BAAC,UAAO,SAAS,WAAW,WAAU,SACnC,oBAAU,wBAAwB,GACrC;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,SAAS,UAAU,WAAU,SACtD,oBAAU,uBAAuB,GACpC;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
import { IconLock, IconAlertTriangle } from "@tabler/icons-react";
|
|
5
6
|
import { toast } from "sonner";
|
|
6
7
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "../ui/overlay/Dialog";
|
|
@@ -12,15 +13,16 @@ import { Toast } from "../ui/feedback/Toast";
|
|
|
12
13
|
import usePasswordVisibility from "../../hooks/usePasswordVisibility";
|
|
13
14
|
import { useAccountModals } from "../../store/useAccountModals";
|
|
14
15
|
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
|
-
];
|
|
23
16
|
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
|
+
];
|
|
24
26
|
const {
|
|
25
27
|
activeModal,
|
|
26
28
|
deleteAccountError,
|
|
@@ -51,7 +53,14 @@ function DeleteAccountModal() {
|
|
|
51
53
|
const handleDelete = (e) => {
|
|
52
54
|
e.preventDefault();
|
|
53
55
|
if (!isFormValid) {
|
|
54
|
-
toast.custom((
|
|
56
|
+
toast.custom((toastId) => /* @__PURE__ */ jsx(
|
|
57
|
+
Toast,
|
|
58
|
+
{
|
|
59
|
+
variant: "error",
|
|
60
|
+
message: translate("common.account.deleteAccount.requiredFields"),
|
|
61
|
+
toastId
|
|
62
|
+
}
|
|
63
|
+
));
|
|
55
64
|
return;
|
|
56
65
|
}
|
|
57
66
|
openConfirmDelete({ password });
|
|
@@ -61,20 +70,18 @@ function DeleteAccountModal() {
|
|
|
61
70
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-4 lg:p-6 flex-1 lg:flex-none", children: [
|
|
62
71
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "p-0", children: [
|
|
63
72
|
/* @__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" }) }),
|
|
64
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
". Ao confirmar, sua conta e todos os seus dados ser\xE3o exclu\xEDdos."
|
|
69
|
-
] })
|
|
73
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: translate("common.account.deleteAccount.title") }),
|
|
74
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular", children: translate.rich("common.account.deleteAccount.description", {
|
|
75
|
+
b: (chunks) => /* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-950", children: chunks })
|
|
76
|
+
}) })
|
|
70
77
|
] }),
|
|
71
78
|
/* @__PURE__ */ jsx(
|
|
72
79
|
SelectField,
|
|
73
80
|
{
|
|
74
|
-
label: "
|
|
81
|
+
label: translate("common.account.deleteAccount.reasonLabel"),
|
|
75
82
|
required: true,
|
|
76
|
-
placeholder: "
|
|
77
|
-
options:
|
|
83
|
+
placeholder: translate("common.account.deleteAccount.reasonPlaceholder"),
|
|
84
|
+
options: reasonOptions,
|
|
78
85
|
value: reason,
|
|
79
86
|
onChange: (value) => setReason(value),
|
|
80
87
|
className: "h-10!"
|
|
@@ -84,27 +91,26 @@ function DeleteAccountModal() {
|
|
|
84
91
|
/* @__PURE__ */ jsx(
|
|
85
92
|
TextAreaField,
|
|
86
93
|
{
|
|
87
|
-
label: "
|
|
94
|
+
label: translate("common.account.deleteAccount.descriptionLabel"),
|
|
88
95
|
required: true,
|
|
89
|
-
placeholder: "
|
|
96
|
+
placeholder: translate("common.account.deleteAccount.descriptionPlaceholder"),
|
|
90
97
|
value: description,
|
|
91
98
|
onChange: (e) => setDescription(e.target.value),
|
|
92
99
|
rows: 4,
|
|
93
100
|
maxLength: 400
|
|
94
101
|
}
|
|
95
102
|
),
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
description.length
|
|
98
|
-
|
|
99
|
-
] })
|
|
103
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-xsmall-medium text-gray-600 text-left mt-1 block", children: translate("common.account.deleteAccount.charactersCount", {
|
|
104
|
+
count: String(description.length)
|
|
105
|
+
}) })
|
|
100
106
|
] }),
|
|
101
107
|
/* @__PURE__ */ jsx(
|
|
102
108
|
FormField,
|
|
103
109
|
{
|
|
104
110
|
className: "text-gray-600",
|
|
105
|
-
label: "
|
|
111
|
+
label: translate("common.account.deleteAccount.passwordLabel"),
|
|
106
112
|
type: "password",
|
|
107
|
-
placeholder: "
|
|
113
|
+
placeholder: translate("common.account.deleteAccount.passwordPlaceholder"),
|
|
108
114
|
leftIcon: IconLock,
|
|
109
115
|
value: password,
|
|
110
116
|
onChange: (e) => {
|
|
@@ -126,10 +132,10 @@ function DeleteAccountModal() {
|
|
|
126
132
|
variant: "default",
|
|
127
133
|
className: "h-10",
|
|
128
134
|
type: "submit",
|
|
129
|
-
children: "
|
|
135
|
+
children: translate("common.account.deleteAccount.submit")
|
|
130
136
|
}
|
|
131
137
|
),
|
|
132
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10", type: "button", onClick: handleClose, children: "
|
|
138
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10", type: "button", onClick: handleClose, children: translate("common.actions.close") })
|
|
133
139
|
] })
|
|
134
140
|
] }) }) });
|
|
135
141
|
}
|
|
@@ -1 +1 @@
|
|
|
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\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/DeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback, useEffect } from 'react';\nimport { useTranslations } from 'next-intl';\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\nexport default function DeleteAccountModal() {\n const translate = useTranslations();\n const reasonOptions = [\n { value: 'sem-funcao', label: translate('common.account.deleteAccount.reasons.noFeature') },\n { value: 'problemas', label: translate('common.account.deleteAccount.reasons.technical') },\n { value: 'suporte', label: translate('common.account.deleteAccount.reasons.support') },\n { value: 'demora', label: translate('common.account.deleteAccount.reasons.updates') },\n { value: 'temporario', label: translate('common.account.deleteAccount.reasons.temporary') },\n { value: 'outro', label: translate('common.account.deleteAccount.reasons.other') },\n ];\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((toastId) => (\n <Toast\n variant=\"error\"\n message={translate('common.account.deleteAccount.requiredFields')}\n toastId={toastId}\n />\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>{translate('common.account.deleteAccount.title')}</DialogTitle>\n <DialogDescription className=\"paragraph-small-regular\">\n {translate.rich('common.account.deleteAccount.description', {\n b: (chunks) => (\n <span className=\"font-semibold text-gray-950\">{chunks}</span>\n ),\n })}\n </DialogDescription>\n </DialogHeader>\n\n <SelectField\n label={translate('common.account.deleteAccount.reasonLabel')}\n required\n placeholder={translate('common.account.deleteAccount.reasonPlaceholder')}\n options={reasonOptions}\n value={reason}\n onChange={(value) => setReason(value as string)}\n className=\"h-10!\"\n />\n\n <div>\n <TextAreaField\n label={translate('common.account.deleteAccount.descriptionLabel')}\n required\n placeholder={translate('common.account.deleteAccount.descriptionPlaceholder')}\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 {translate('common.account.deleteAccount.charactersCount', {\n count: String(description.length),\n })}\n </span>\n </div>\n\n <FormField\n className=\"text-gray-600\"\n label={translate('common.account.deleteAccount.passwordLabel')}\n type=\"password\"\n placeholder={translate('common.account.deleteAccount.passwordPlaceholder')}\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 {translate('common.account.deleteAccount.submit')}\n </Button>\n <Button variant=\"secondary\" className=\"h-10\" type=\"button\" onClick={handleClose}>\n {translate('common.actions.close')}\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAiEQ,cAkBI,YAlBJ;AA/DR,SAAS,UAAU,aAAa,iBAAiB;AACjD,SAAS,uBAAuB;AAChC,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;AAEpB,SAAR,qBAAsC;AAC3C,QAAM,YAAY,gBAAgB;AAClC,QAAM,gBAAgB;AAAA,IACpB,EAAE,OAAO,cAAc,OAAO,UAAU,gDAAgD,EAAE;AAAA,IAC1F,EAAE,OAAO,aAAa,OAAO,UAAU,gDAAgD,EAAE;AAAA,IACzF,EAAE,OAAO,WAAW,OAAO,UAAU,8CAA8C,EAAE;AAAA,IACrF,EAAE,OAAO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A,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,UAEJ,oBAAU,qCAAqC;AAAA;AAAA,MAClD;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,WAAU,QAAO,MAAK,UAAS,SAAS,aACjE,oBAAU,sBAAsB,GACnC;AAAA,OACF;AAAA,KACF,GACF,GACF;AAEJ;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslations } from "next-intl";
|
|
3
4
|
import { IconShieldCheck } from "@tabler/icons-react";
|
|
4
5
|
import { Button } from "../ui/buttons/Button";
|
|
5
6
|
import {
|
|
@@ -17,6 +18,7 @@ function DisableTwoFactorAuthModal({
|
|
|
17
18
|
onClose,
|
|
18
19
|
onSuccess
|
|
19
20
|
}) {
|
|
21
|
+
const translate = useTranslations();
|
|
20
22
|
const { code, setCode, isValid, isLoading, handleClose, handleSubmit } = useDisableTwoFactorAuthForm({ onClose, onSuccess });
|
|
21
23
|
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(
|
|
22
24
|
"form",
|
|
@@ -30,11 +32,11 @@ function DisableTwoFactorAuthModal({
|
|
|
30
32
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 lg:gap-5 p-4 lg:p-5 flex-1 lg:flex-none", children: [
|
|
31
33
|
/* @__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" }) }),
|
|
32
34
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "p-0 gap-2", children: [
|
|
33
|
-
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: "
|
|
34
|
-
/* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular text-gray-600", children: "
|
|
35
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: translate("common.account.twoFactor.disableTitle") }),
|
|
36
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular text-gray-600", children: translate("common.account.twoFactor.disableDescription") })
|
|
35
37
|
] }),
|
|
36
38
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
37
|
-
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-gray-700", children: "
|
|
39
|
+
/* @__PURE__ */ jsx("span", { className: "paragraph-small-medium text-gray-700", children: translate("common.account.twoFactor.authenticatorCode") }),
|
|
38
40
|
/* @__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(
|
|
39
41
|
InputOTPSlot,
|
|
40
42
|
{
|
|
@@ -46,7 +48,7 @@ function DisableTwoFactorAuthModal({
|
|
|
46
48
|
] })
|
|
47
49
|
] }),
|
|
48
50
|
/* @__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: [
|
|
49
|
-
/* @__PURE__ */ jsx(Button, { className: "h-10! flex-1", disabled: !isValid || isLoading, type: "submit", children: isLoading ? "
|
|
51
|
+
/* @__PURE__ */ jsx(Button, { className: "h-10! flex-1", disabled: !isValid || isLoading, type: "submit", children: isLoading ? translate("common.account.twoFactor.disabling") : translate("common.account.twoFactor.disable") }),
|
|
50
52
|
/* @__PURE__ */ jsx(
|
|
51
53
|
Button,
|
|
52
54
|
{
|
|
@@ -54,7 +56,7 @@ function DisableTwoFactorAuthModal({
|
|
|
54
56
|
className: "h-10! flex-1",
|
|
55
57
|
type: "button",
|
|
56
58
|
onClick: handleClose,
|
|
57
|
-
children: "
|
|
59
|
+
children: translate("common.actions.cancel")
|
|
58
60
|
}
|
|
59
61
|
)
|
|
60
62
|
] })
|
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"sources":["../../../src/components/account/DisableTwoFactorAuthModal.tsx"],"sourcesContent":["'use client';\n\nimport { useTranslations } from 'next-intl';\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 translate = useTranslations();\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 {translate('common.account.twoFactor.disableTitle')}\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-gray-600\">\n {translate('common.account.twoFactor.disableDescription')}\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"flex flex-col gap-2\">\n <span className=\"paragraph-small-medium text-gray-700\">\n {translate('common.account.twoFactor.authenticatorCode')}\n </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\n ? translate('common.account.twoFactor.disabling')\n : translate('common.account.twoFactor.disable')}\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! flex-1\"\n type=\"button\"\n onClick={handleClose}\n >\n {translate('common.actions.cancel')}\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA2Cc,cAEF,YAFE;AAzCd,SAAS,uBAAu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