@greatapps/common 1.1.33 → 1.1.35
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/AccountModals.mjs +18 -0
- package/dist/components/account/AccountModals.mjs.map +1 -0
- package/dist/components/account/ConfigurationsMyAccountModal.mjs +26 -15
- package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
- package/dist/components/account/ConfirmDeleteAccountModal.mjs +45 -0
- package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -0
- package/dist/components/account/DeleteAccountModal.mjs +123 -0
- package/dist/components/account/DeleteAccountModal.mjs.map +1 -0
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs +42 -0
- package/dist/components/account/IsntPossibleDeleteAccountModal.mjs.map +1 -0
- package/dist/components/layouts/AppMobileNavBar.mjs +53 -0
- package/dist/components/layouts/AppMobileNavBar.mjs.map +1 -0
- package/dist/components/layouts/AppNavBar.mjs +75 -0
- package/dist/components/layouts/AppNavBar.mjs.map +1 -0
- package/dist/components/layouts/ProfilePopover.mjs +3 -3
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/modals/ModalManager.mjs +19 -0
- package/dist/components/modals/ModalManager.mjs.map +1 -0
- package/dist/components/modals/Modals.mjs +20 -0
- package/dist/components/modals/Modals.mjs.map +1 -0
- package/dist/components/ui/feedback/LoadingOverlay.mjs +19 -0
- package/dist/components/ui/feedback/LoadingOverlay.mjs.map +1 -0
- package/dist/index.mjs +16 -2
- package/dist/index.mjs.map +1 -1
- package/dist/store/useAccountModals.mjs +18 -0
- package/dist/store/useAccountModals.mjs.map +1 -0
- package/dist/store/useModalManager.mjs +75 -0
- package/dist/store/useModalManager.mjs.map +1 -0
- package/package.json +1 -1
- package/src/components/account/AccountModals.tsx +17 -0
- package/src/components/account/ConfigurationsMyAccountModal.tsx +29 -26
- package/src/components/account/ConfirmDeleteAccountModal.tsx +55 -0
- package/src/components/account/DeleteAccountModal.tsx +130 -0
- package/src/components/account/IsntPossibleDeleteAccountModal.tsx +49 -0
- package/src/components/layouts/AppMobileNavBar.tsx +70 -0
- package/src/components/layouts/AppNavBar.tsx +86 -0
- package/src/components/layouts/ProfilePopover.tsx +2 -3
- package/src/components/modals/ModalManager.tsx +29 -0
- package/src/components/modals/Modals.tsx +29 -0
- package/src/components/ui/feedback/LoadingOverlay.tsx +31 -0
- package/src/index.ts +14 -2
- package/src/store/useAccountModals.ts +57 -0
- package/src/store/useModalManager.ts +104 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/layouts/ProfilePopover.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { useState } from \"react\";\r\nimport { useRouter } from \"next/navigation\";\r\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\r\nimport { Popover } from \"../ui/overlay/Popover\";\r\nimport { Button } from \"../ui/buttons/Button\";\r\nimport { Progress } from \"../ui/feedback/Progress\";\r\nimport { Separator } from \"../ui/data-display/Separator\";\r\nimport { NavBarItem } from \"./NavBarItem\";\r\nimport { UserAvatar } from \"../ui/data-display/UserAvatar\";\r\nimport { useAuth } from \"../../providers/auth.provider\";\r\nimport { cn } from \"../../infra/utils/clsx\";\r\nimport { useIaCredits } from \"../../modules/ia-credits/hooks/ia-credits.hook\";\r\n\r\nexport interface ProfileMenuItem {\r\n icon?: React.ReactNode;\r\n label: string;\r\n onClick: () => void;\r\n}\r\n\r\nexport interface ProfilePopoverProps {\r\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\r\n align?: \"start\" | \"center\" | \"end\";\r\n contentClassName?: string;\r\n onEditProfile?: () => void;\r\n onCreditsClick?: () => void;\r\n menuItems?: ProfileMenuItem[];\r\n logoutRedirect?: string;\r\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/layouts/ProfilePopover.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { useState } from \"react\";\r\nimport { useRouter } from \"next/navigation\";\r\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\r\nimport { Popover } from \"../ui/overlay/Popover\";\r\nimport { Button } from \"../ui/buttons/Button\";\r\nimport { Progress } from \"../ui/feedback/Progress\";\r\nimport { Separator } from \"../ui/data-display/Separator\";\r\nimport { NavBarItem } from \"./NavBarItem\";\r\nimport { UserAvatar } from \"../ui/data-display/UserAvatar\";\r\nimport { LoadingOverlay } from \"../ui/feedback/LoadingOverlay\";\r\nimport { useAuth } from \"../../providers/auth.provider\";\r\nimport { cn } from \"../../infra/utils/clsx\";\r\nimport { useIaCredits } from \"../../modules/ia-credits/hooks/ia-credits.hook\";\r\n\r\nexport interface ProfileMenuItem {\r\n icon?: React.ReactNode;\r\n label: string;\r\n onClick: () => void;\r\n}\r\n\r\nexport interface ProfilePopoverProps {\r\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\r\n align?: \"start\" | \"center\" | \"end\";\r\n contentClassName?: string;\r\n onEditProfile?: () => void;\r\n onCreditsClick?: () => void;\r\n menuItems?: ProfileMenuItem[];\r\n logoutRedirect?: string;\r\n}\r\n\r\nfunction ProfilePopover({\r\n side = \"top\",\r\n align = \"start\",\r\n contentClassName = \"absolute bottom-2 left-[26px]\",\r\n onEditProfile,\r\n onCreditsClick,\r\n menuItems = [],\r\n logoutRedirect = \"/login\",\r\n}: ProfilePopoverProps) {\r\n const router = useRouter();\r\n const { user, logout } = useAuth();\r\n const [isLoggingOut, setIsLoggingOut] = useState(false);\r\n\r\n const { summary, subscription, isSubscriptionLoading, isCreditsLoading } =\r\n useIaCredits();\r\n\r\n const handleLogout = async () => {\r\n try {\r\n setIsLoggingOut(true);\r\n await logout();\r\n router.push(logoutRedirect);\r\n } catch (error) {\r\n console.error(\"Erro ao fazer logout:\", error);\r\n } finally {\r\n setIsLoggingOut(false);\r\n }\r\n };\r\n\r\n const hasSubscription = !isSubscriptionLoading && subscription !== null;\r\n const showCreditsSkeleton = hasSubscription && isCreditsLoading;\r\n const showCredits =\r\n hasSubscription && !isCreditsLoading;\r\n const creditsPercentage =\r\n showCredits && summary.totalCredits > 0\r\n ? (summary.usedCredits / summary.totalCredits) * 100\r\n : 0;\r\n\r\n return (\r\n <>\r\n <LoadingOverlay isLoading={isLoggingOut} message=\"Saindo da sua conta...\" />\r\n <Popover>\r\n <PopoverPrimitive.Trigger className=\"cursor-pointer\">\r\n {user && (\r\n <UserAvatar\r\n key={user.id}\r\n photo={user.photo}\r\n name={user.name}\r\n size={40}\r\n />\r\n )}\r\n </PopoverPrimitive.Trigger>\r\n\r\n <PopoverPrimitive.Portal>\r\n <PopoverPrimitive.Content\r\n className={cn(\r\n \"w-64.75 p-0 bg-white rounded-2xl shadow-md border border-gray-200 z-99\",\r\n contentClassName,\r\n )}\r\n side={side}\r\n align={align}\r\n sideOffset={8}\r\n >\r\n <div className=\"grid grid-cols-[32px_1fr_auto] items-center gap-3 p-3 w-full\">\r\n {user && (\r\n <UserAvatar\r\n key={user.id}\r\n photo={user.photo}\r\n name={user.name}\r\n size={32}\r\n />\r\n )}\r\n\r\n <div className=\"flex flex-col gap-0.5 min-w-0\">\r\n <span className=\"paragraph-small-semibold text-gray-950 truncate\">\r\n {user?.name || \"\"}\r\n </span>\r\n <span className=\"paragraph-xsmall-medium text-gray-500 truncate\">\r\n {user?.email || \"\"}\r\n </span>\r\n </div>\r\n\r\n {onEditProfile && (\r\n <Button\r\n variant=\"secondary\"\r\n className=\"paragraph-small-semibold h-8! whitespace-nowrap px-3 w-fit\"\r\n onClick={onEditProfile}\r\n >\r\n Editar Perfil\r\n </Button>\r\n )}\r\n </div>\r\n\r\n <div className=\"flex flex-col gap-2 border-t border-gray-200 rounded-2xl p-1.5\">\r\n {showCreditsSkeleton && (\r\n <div className=\"flex flex-col bg-gray-950 rounded-lg gap-4 w-full p-4\">\r\n <div className=\"flex items-center justify-between gap-2\">\r\n <span className=\"paragraph-xsmall-semibold text-white truncate\">\r\n Créditos usados\r\n </span>\r\n <div className=\"h-3.5 w-16 rounded bg-white/20 animate-pulse\" />\r\n </div>\r\n <div className=\"h-1.5 w-full rounded-full bg-white/20 animate-pulse\" />\r\n </div>\r\n )}\r\n\r\n {showCredits && (\r\n <div\r\n className={cn(\r\n \"flex flex-col bg-gray-950 rounded-lg gap-4 w-full p-4 transition-colors\",\r\n onCreditsClick && \"cursor-pointer hover:bg-gray-900\",\r\n )}\r\n onClick={onCreditsClick}\r\n >\r\n <div className=\"flex items-center justify-between gap-2\">\r\n <span className=\"paragraph-xsmall-semibold text-white truncate\">\r\n Créditos usados\r\n </span>\r\n <span className=\"paragraph-xsmall-medium text-white/50\">\r\n {summary.usedCredits.toLocaleString(\"pt-BR\")}/\r\n {summary.totalCredits.toLocaleString(\"pt-BR\")}\r\n </span>\r\n </div>\r\n <Progress\r\n className=\"bg-white/10\"\r\n indicatorColor=\"bg-white\"\r\n value={creditsPercentage}\r\n />\r\n </div>\r\n )}\r\n\r\n <div className=\"flex flex-col gap-2\">\r\n {menuItems.length > 0 && (\r\n <div className=\"flex flex-col\">\r\n {menuItems.map((item, index) => (\r\n <NavBarItem\r\n key={index}\r\n icon={item.icon}\r\n label={item.label}\r\n onClick={item.onClick}\r\n />\r\n ))}\r\n </div>\r\n )}\r\n <Separator />\r\n <NavBarItem label=\"Sair\" onClick={handleLogout} />\r\n </div>\r\n </div>\r\n </PopoverPrimitive.Content>\r\n </PopoverPrimitive.Portal>\r\n </Popover>\r\n </>\r\n );\r\n}\r\n\r\nexport { ProfilePopover };\r\n"],"mappings":";AAsEI,mBACE,KAiCQ,YAlCV;AApEJ,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,YAAY,sBAAsB;AAClC,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AACxB,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAkB7B,SAAS,eAAe;AAAA,EACtB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pB;AAAA,kBAAC;AAAA;AAAA,oBAEC,MAAM,KAAK;AAAA,oBACX,OAAO,KAAK;AAAA,oBACZ,SAAS,KAAK;AAAA;AAAA,kBAHT;AAAA,gBAIP,CACD,GACH;AAAA,gBAEF,oBAAC,aAAU;AAAA,gBACX,oBAAC,cAAW,OAAM,QAAO,SAAS,cAAc;AAAA,iBAClD;AAAA,eACF;AAAA;AAAA;AAAA,MACF,GACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useModalManager } from "../../store/useModalManager";
|
|
4
|
+
function ModalManager({ registry }) {
|
|
5
|
+
const { modalStack } = useModalManager();
|
|
6
|
+
if (modalStack.length === 0) return null;
|
|
7
|
+
return /* @__PURE__ */ jsx(Fragment, { children: modalStack.map((modal) => {
|
|
8
|
+
const ModalComponent = registry[modal.key];
|
|
9
|
+
if (!ModalComponent) {
|
|
10
|
+
console.warn(`Modal "${modal.key}" not found in registry`);
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ jsx(ModalComponent, {}, modal.key);
|
|
14
|
+
}) });
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
ModalManager
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=ModalManager.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/modals/ModalManager.tsx"],"sourcesContent":["'use client';\n\nimport { ComponentType } from 'react';\nimport { useModalManager } from '../../store/useModalManager';\n\ninterface ModalManagerProps {\n registry: Record<string, ComponentType>;\n}\n\nexport function ModalManager({ registry }: ModalManagerProps) {\n const { modalStack } = useModalManager();\n\n if (modalStack.length === 0) return null;\n\n return (\n <>\n {modalStack.map((modal) => {\n const ModalComponent = registry[modal.key];\n\n if (!ModalComponent) {\n console.warn(`Modal \"${modal.key}\" not found in registry`);\n return null;\n }\n\n return <ModalComponent key={modal.key} />;\n })}\n </>\n );\n}\n"],"mappings":";AAeI,mBASW,WATX;AAZJ,SAAS,uBAAuB;AAMzB,SAAS,aAAa,EAAE,SAAS,GAAsB;AAC5D,QAAM,EAAE,WAAW,IAAI,gBAAgB;AAEvC,MAAI,WAAW,WAAW,EAAG,QAAO;AAEpC,SACE,gCACG,qBAAW,IAAI,CAAC,UAAU;AACzB,UAAM,iBAAiB,SAAS,MAAM,GAAG;AAEzC,QAAI,CAAC,gBAAgB;AACnB,cAAQ,KAAK,UAAU,MAAM,GAAG,yBAAyB;AACzD,aAAO;AAAA,IACT;AAEA,WAAO,oBAAC,oBAAoB,MAAM,GAAK;AAAA,EACzC,CAAC,GACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import AccountModals from "../account/AccountModals";
|
|
5
|
+
import { ModalManager } from "./ModalManager";
|
|
6
|
+
import { useAccountModals } from "../../store/useAccountModals";
|
|
7
|
+
function Modals({ registry, hasActiveSubscription, currencies, onGoToSubscription }) {
|
|
8
|
+
const { updateConfig } = useAccountModals();
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
updateConfig({ hasActiveSubscription, currencies, onGoToSubscription });
|
|
11
|
+
}, [hasActiveSubscription, currencies, onGoToSubscription, updateConfig]);
|
|
12
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13
|
+
/* @__PURE__ */ jsx(AccountModals, {}),
|
|
14
|
+
/* @__PURE__ */ jsx(ModalManager, { registry })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
Modals
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Modals.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/modals/Modals.tsx"],"sourcesContent":["'use client';\n\nimport { ComponentType, useEffect } from 'react';\nimport AccountModals from '../account/AccountModals';\nimport { ModalManager } from './ModalManager';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport type { ComboboxOption } from '../ui/form/ComboboxField';\n\ninterface ModalsProps {\n registry: Record<string, ComponentType>;\n hasActiveSubscription?: boolean;\n currencies?: ComboboxOption[];\n onGoToSubscription?: () => void;\n}\n\nexport function Modals({ registry, hasActiveSubscription, currencies, onGoToSubscription }: ModalsProps) {\n const { updateConfig } = useAccountModals();\n\n useEffect(() => {\n updateConfig({ hasActiveSubscription, currencies, onGoToSubscription });\n }, [hasActiveSubscription, currencies, onGoToSubscription, updateConfig]);\n\n return (\n <>\n <AccountModals />\n <ModalManager registry={registry} />\n </>\n );\n}\n"],"mappings":";AAuBI,mBACE,KADF;AArBJ,SAAwB,iBAAiB;AACzC,OAAO,mBAAmB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAU1B,SAAS,OAAO,EAAE,UAAU,uBAAuB,YAAY,mBAAmB,GAAgB;AACvG,QAAM,EAAE,aAAa,IAAI,iBAAiB;AAE1C,YAAU,MAAM;AACd,iBAAa,EAAE,uBAAuB,YAAY,mBAAmB,CAAC;AAAA,EACxE,GAAG,CAAC,uBAAuB,YAAY,oBAAoB,YAAY,CAAC;AAExE,SACE,iCACE;AAAA,wBAAC,iBAAc;AAAA,IACf,oBAAC,gBAAa,UAAoB;AAAA,KACpC;AAEJ;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Image from "next/image";
|
|
4
|
+
function LoadingOverlay({ isLoading, message, icon }) {
|
|
5
|
+
if (!isLoading) return null;
|
|
6
|
+
const defaultIcon = /* @__PURE__ */ jsx(Image, { src: "/icons/great-icon.svg", alt: "Great Icon", width: 20, height: 20 });
|
|
7
|
+
return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl shadow-xl px-16 py-12 flex flex-col items-center gap-6 min-w-[380px]", children: [
|
|
8
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-center w-20 h-20", children: [
|
|
9
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 border-[5px] border-gray-100 rounded-full" }),
|
|
10
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 border-[5px] border-transparent border-t-black rounded-full animate-spin" }),
|
|
11
|
+
/* @__PURE__ */ jsx("div", { className: "relative z-20 flex items-center justify-center w-14 h-14 bg-gray-100 rounded-full", children: icon ?? defaultIcon })
|
|
12
|
+
] }),
|
|
13
|
+
/* @__PURE__ */ jsx("span", { className: "font-bold text-gray-900 text-lg", children: message })
|
|
14
|
+
] }) });
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
LoadingOverlay
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=LoadingOverlay.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ui/feedback/LoadingOverlay.tsx"],"sourcesContent":["'use client';\n\nimport Image from 'next/image';\nimport { ReactNode } from 'react';\n\ninterface LoadingOverlayProps {\n isLoading: boolean;\n message?: string;\n icon?: ReactNode;\n}\n\nexport function LoadingOverlay({ isLoading, message, icon }: LoadingOverlayProps) {\n if (!isLoading) return null;\n\n const defaultIcon = <Image src=\"/icons/great-icon.svg\" alt=\"Great Icon\" width={20} height={20} />;\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-[2px]\">\n <div className=\"bg-white rounded-2xl shadow-xl px-16 py-12 flex flex-col items-center gap-6 min-w-[380px]\">\n <div className=\"relative flex items-center justify-center w-20 h-20\">\n <div className=\"absolute inset-0 border-[5px] border-gray-100 rounded-full\" />\n <div className=\"absolute inset-0 border-[5px] border-transparent border-t-black rounded-full animate-spin\" />\n <div className=\"relative z-20 flex items-center justify-center w-14 h-14 bg-gray-100 rounded-full\">\n {icon ?? defaultIcon}\n </div>\n </div>\n <span className=\"font-bold text-gray-900 text-lg\">{message}</span>\n </div>\n </div>\n );\n}\n"],"mappings":";AAcsB,cAKd,YALc;AAZtB,OAAO,WAAW;AASX,SAAS,eAAe,EAAE,WAAW,SAAS,KAAK,GAAwB;AAChF,MAAI,CAAC,UAAW,QAAO;AAEvB,QAAM,cAAc,oBAAC,SAAM,KAAI,yBAAwB,KAAI,cAAa,OAAO,IAAI,QAAQ,IAAI;AAE/F,SACE,oBAAC,SAAI,WAAU,uFACb,+BAAC,SAAI,WAAU,6FACb;AAAA,yBAAC,SAAI,WAAU,uDACb;AAAA,0BAAC,SAAI,WAAU,8DAA6D;AAAA,MAC5E,oBAAC,SAAI,WAAU,6FAA4F;AAAA,MAC3G,oBAAC,SAAI,WAAU,qFACZ,kBAAQ,aACX;AAAA,OACF;AAAA,IACA,oBAAC,UAAK,WAAU,mCAAmC,mBAAQ;AAAA,KAC7D,GACF;AAEJ;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -20,6 +20,8 @@ import { buildQueryParams } from "./infra/utils/params";
|
|
|
20
20
|
import { parseSchema, parseResult } from "./infra/utils/parser";
|
|
21
21
|
import { MainLayout, MainLayoutContent, MainLayoutSpacer, MainLayoutMain } from "./components/layouts/MainLayout";
|
|
22
22
|
import { NavBar } from "./components/layouts/NavBar";
|
|
23
|
+
import { AppNavBar } from "./components/layouts/AppNavBar";
|
|
24
|
+
import { AppMobileNavBar } from "./components/layouts/AppMobileNavBar";
|
|
23
25
|
import { SideBarNavigation } from "./components/layouts/SideBarNavigation";
|
|
24
26
|
import { MdSideBarNavigation } from "./components/layouts/MdSideBarNavigation";
|
|
25
27
|
import { NotificationItem } from "./components/layouts/NotificationItem";
|
|
@@ -42,6 +44,7 @@ import { UserAvatar } from "./components/ui/data-display/UserAvatar";
|
|
|
42
44
|
import { default as default3 } from "./components/ui/feedback/CircularProgress";
|
|
43
45
|
import { default as default4 } from "./components/ui/feedback/DefaultCircularProgress";
|
|
44
46
|
import { Progress } from "./components/ui/feedback/Progress";
|
|
47
|
+
import { LoadingOverlay } from "./components/ui/feedback/LoadingOverlay";
|
|
45
48
|
import { Toast, toastVariants, toastIconContainerVariants } from "./components/ui/feedback/Toast";
|
|
46
49
|
import { Calendar, CalendarDayButton } from "./components/ui/form/Calendar";
|
|
47
50
|
import { Checkbox } from "./components/ui/form/Checkbox";
|
|
@@ -59,6 +62,7 @@ import { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from "./compon
|
|
|
59
62
|
import { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from "./components/ui/overlay/Sheet";
|
|
60
63
|
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "./components/ui/overlay/Tooltip";
|
|
61
64
|
import { useMdSidebarStore } from "./store/useMdSidebarStore";
|
|
65
|
+
import { useModalManager } from "./store/useModalManager";
|
|
62
66
|
import { AccountSectionType } from "./enums/AccountSectionType";
|
|
63
67
|
import { default as default5 } from "./hooks/usePasswordVisibility";
|
|
64
68
|
import { default as default6 } from "./hooks/useCountdownTimer";
|
|
@@ -80,7 +84,10 @@ import {
|
|
|
80
84
|
useDeleteAccountUser,
|
|
81
85
|
useDeleteAccount
|
|
82
86
|
} from "./modules/accounts/hooks/useAccountManagement";
|
|
83
|
-
import { default as default10 } from "./components/account/
|
|
87
|
+
import { default as default10 } from "./components/account/AccountModals";
|
|
88
|
+
import { useAccountModals } from "./store/useAccountModals";
|
|
89
|
+
import { ModalManager } from "./components/modals/ModalManager";
|
|
90
|
+
import { Modals } from "./components/modals/Modals";
|
|
84
91
|
import { default as default11 } from "./components/account/TwoFactorAuthModal";
|
|
85
92
|
import { default as default12 } from "./components/account/DisableTwoFactorAuthModal";
|
|
86
93
|
import { default as default13 } from "./components/account/ConfirmGlobalPreferencesModal";
|
|
@@ -104,7 +111,10 @@ export {
|
|
|
104
111
|
AccordionContent,
|
|
105
112
|
AccordionItem,
|
|
106
113
|
AccordionTrigger,
|
|
114
|
+
default10 as AccountModals,
|
|
107
115
|
AccountSectionType,
|
|
116
|
+
AppMobileNavBar,
|
|
117
|
+
AppNavBar,
|
|
108
118
|
Badge,
|
|
109
119
|
Button,
|
|
110
120
|
CURRENCY_OPTIONS,
|
|
@@ -133,7 +143,6 @@ export {
|
|
|
133
143
|
CommandList,
|
|
134
144
|
CommandSeparator,
|
|
135
145
|
CommandShortcut,
|
|
136
|
-
default10 as ConfigurationsMyAccountModal,
|
|
137
146
|
default13 as ConfirmGlobalPreferencesModal,
|
|
138
147
|
CopyButton,
|
|
139
148
|
DatePicker,
|
|
@@ -159,11 +168,14 @@ export {
|
|
|
159
168
|
InputOTPSlot,
|
|
160
169
|
LANGUAGE_OPTIONS2 as LANGUAGE_OPTIONS,
|
|
161
170
|
LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS,
|
|
171
|
+
LoadingOverlay,
|
|
162
172
|
MainLayout,
|
|
163
173
|
MainLayoutContent,
|
|
164
174
|
MainLayoutMain,
|
|
165
175
|
MainLayoutSpacer,
|
|
166
176
|
MdSideBarNavigation,
|
|
177
|
+
ModalManager,
|
|
178
|
+
Modals,
|
|
167
179
|
MyProfileSection,
|
|
168
180
|
NOTIFICATION_TYPES,
|
|
169
181
|
NavBar,
|
|
@@ -263,6 +275,7 @@ export {
|
|
|
263
275
|
stopChain,
|
|
264
276
|
toastIconContainerVariants,
|
|
265
277
|
toastVariants,
|
|
278
|
+
useAccountModals,
|
|
266
279
|
useActiveSubscription,
|
|
267
280
|
default6 as useCountdownTimer,
|
|
268
281
|
useDeleteAccount,
|
|
@@ -271,6 +284,7 @@ export {
|
|
|
271
284
|
useInvalidateUser,
|
|
272
285
|
default7 as useIsMobile,
|
|
273
286
|
useMdSidebarStore,
|
|
287
|
+
useModalManager,
|
|
274
288
|
default5 as usePasswordVisibility,
|
|
275
289
|
useSetUserData,
|
|
276
290
|
useSubscriptions,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from './modules/auth/schema';\nexport * from './modules/users/schema';\nexport * from './modules/whitelabel/schema';\nexport * from './infra/api/types';\n\n// Contexts\nexport * from './providers/query.provider';\nexport * from './providers/auth.provider';\nexport * from './providers/whitelabel.provider';\n\n// Hooks\nexport { useUserQuery, useUserValidateSession, useInvalidateUser, useSetUserData, USER_QUERY_KEY } from './modules/auth/hooks/useUserQuery';\nexport { useSubscriptions, SUBSCRIPTIONS_QUERY_KEY } from './modules/subscriptions/hooks/list-subscriptions.hook';\nexport { useActiveSubscription } from './modules/subscriptions/hooks/find-active-subscription.hook';\nexport { useIaCredits } from './modules/ia-credits/hooks/ia-credits.hook';\nexport type { IaCreditsSummary, IaCreditOperation } from './modules/ia-credits/types';\nexport type { Subscription, SubscriptionItem, FindSubscriptionsParams } from './modules/subscriptions/types';\nexport { SubscriptionSchema, SubscriptionItemSchema } from './modules/subscriptions/types';\nexport { ADDON_IDS } from './modules/subscriptions/constants/addons.constants';\nexport type { AddonKindEnum } from './modules/subscriptions/constants/addons.constants';\n\n// Providers\nexport { QueryProvider } from './providers/query.provider';\n\n// Middleware\nexport { createAuthMiddleware } from './middlewares/create-auth-middleware';\nexport { createMiddlewareChain } from './middlewares/chain';\nexport { continueChain, stopChain } from './middlewares/types';\nexport type { MiddlewareFunction, MiddlewareConfig, MiddlewareResult } from './middlewares/types';\n\n// Utils\nexport { cn } from './infra/utils/clsx';\nexport { buildQueryParams } from './infra/utils/params';\nexport { parseSchema, parseResult } from './infra/utils/parser';\n\n// Layout\nexport { MainLayout, MainLayoutContent, MainLayoutSpacer, MainLayoutMain } from './components/layouts/MainLayout';\nexport { NavBar } from './components/layouts/NavBar';\nexport type { NavBarProps } from './components/layouts/NavBar';\nexport { SideBarNavigation } from './components/layouts/SideBarNavigation';\nexport { MdSideBarNavigation } from './components/layouts/MdSideBarNavigation';\nexport { NotificationItem } from './components/layouts/NotificationItem';\nexport type { NotificationItemProps } from './components/layouts/NotificationItem';\nexport { NotificationsPopover } from './components/layouts/NotificationsPopover';\nexport type { NotificationsPopoverProps, NotificationData } from './components/layouts/NotificationsPopover';\nexport { UsersSelectorPopover } from './components/layouts/UsersSelectorPopover';\nexport type { UsersSelectorPopoverProps, UserSelectorItem } from './components/layouts/UsersSelectorPopover';\nexport { ProfilePopover } from './components/layouts/ProfilePopover';\nexport type { ProfilePopoverProps, ProfileMenuItem } from './components/layouts/ProfilePopover';\nexport { NavBarItem } from './components/layouts/NavBarItem';\nexport type { NavBarItemProps } from './components/layouts/NavBarItem';\n\n// UI - Buttons\nexport { Button, buttonVariants } from './components/ui/buttons/Button';\nexport { CopyButton } from './components/ui/buttons/CopyButton';\nexport { default as CancelButton } from './components/ui/buttons/CancelButton';\n\n// UI - Data Display\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './components/ui/data-display/Accordion';\nexport { Badge, badgeVariants } from './components/ui/data-display/Badge';\nexport { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent } from './components/ui/data-display/Card';\nexport { Pagination, PaginationContent, PaginationLink, PaginationItem, PaginationPrevious, PaginationNext, PaginationEllipsis } from './components/ui/data-display/Pagination';\nexport { ScrollArea, ScrollBar } from './components/ui/data-display/ScrollArea';\nexport { Separator } from './components/ui/data-display/Separator';\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } from './components/ui/data-display/Table';\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './components/ui/data-display/Tabs';\nexport { UserAvatar } from './components/ui/data-display/UserAvatar';\nexport type { UserAvatarProps } from './components/ui/data-display/UserAvatar';\n\n// UI - Feedback\nexport { default as CircularProgress } from './components/ui/feedback/CircularProgress';\nexport { default as DefaultCircularProgress } from './components/ui/feedback/DefaultCircularProgress';\nexport { Progress } from './components/ui/feedback/Progress';\nexport { Toast, toastVariants, toastIconContainerVariants } from './components/ui/feedback/Toast';\nexport type { ToastProps } from './components/ui/feedback/Toast';\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from './components/ui/form/Calendar';\nexport { Checkbox } from './components/ui/form/Checkbox';\nexport { DatePicker } from './components/ui/form/DatePicker';\nexport { DateRangePicker } from './components/ui/form/DateRangePicker';\nexport { Input } from './components/ui/form/Input';\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from './components/ui/form/InputOtp';\nexport { RadioGroup, RadioGroupItem } from './components/ui/form/RadioGroup';\nexport { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from './components/ui/form/Select';\nexport { Switch } from './components/ui/form/Switch';\nexport { Textarea } from './components/ui/form/Textarea';\n\n// UI - Overlay\nexport { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator } from './components/ui/overlay/Command';\nexport { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './components/ui/overlay/Dialog';\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from './components/ui/overlay/Popover';\nexport { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from './components/ui/overlay/Sheet';\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './components/ui/overlay/Tooltip';\n\n// Store\nexport { useMdSidebarStore } from './store/useMdSidebarStore';\n\n// Enums\nexport { AccountSectionType } from './enums/AccountSectionType';\n\n// Hooks\nexport { default as usePasswordVisibility } from './hooks/usePasswordVisibility';\nexport { default as useCountdownTimer } from './hooks/useCountdownTimer';\nexport { default as useIsMobile } from './hooks/useIsMobile';\n\n// Utils\nexport { formatPhone, formatTimer, formatFullName, formatCPF, formatCardNumber } from './utils/format/masks';\nexport { buildTimezoneOptions } from './utils/intl/timezones';\nexport type { TimezoneOption } from './utils/intl/timezones';\nexport { buildLocaleOptions, LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS } from './utils/intl/locales';\nexport type { LocaleOption } from './utils/intl/locales';\nexport { copyToClipboard, readFromClipboard } from './utils/browser/clipboard';\n\n// UI - Form (new widgets)\nexport { FormField } from './components/ui/form/FormField';\nexport { SelectField } from './components/ui/form/SelectField';\nexport { ComboboxField } from './components/ui/form/ComboboxField';\nexport type { ComboboxOption } from './components/ui/form/ComboboxField';\nexport { default as PhoneInput } from './components/ui/form/PhoneInput';\nexport { default as SwitchOptionFieldWithIcon } from './components/ui/form/SwitchOptionFieldWithIcon';\nexport { TextAreaField } from './components/ui/form/TextAreaField';\n\n// Account Module - Hooks\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n} from './modules/accounts/hooks/useAccountManagement';\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from './modules/accounts/types';\n\n// Account Components\nexport { default as ConfigurationsMyAccountModal } from './components/account/ConfigurationsMyAccountModal';\nexport { default as TwoFactorAuthModal } from './components/account/TwoFactorAuthModal';\nexport { default as DisableTwoFactorAuthModal } from './components/account/DisableTwoFactorAuthModal';\nexport { default as ConfirmGlobalPreferencesModal } from './components/account/ConfirmGlobalPreferencesModal';\nexport { MyProfileSection } from './components/account/sections/MyProfileSection';\nexport { PreferencesSection } from './components/account/sections/PreferencesSection';\nexport { SecuritySection } from './components/account/sections/SecuritySection';\nexport { ChangePasswordSection } from './components/account/sections/ChangePasswordSection';\nexport { ChangeEmailModal } from './components/account/sections/ChangeEmailModal';\nexport { ChangePhoneModal } from './components/account/sections/ChangePhoneModal';\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIMEZONE_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from './components/account/constants';\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,SAAS,cAAc,wBAAwB,mBAAmB,gBAAgB,sBAAsB;AACxG,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAG7B,SAAS,oBAAoB,8BAA8B;AAC3D,SAAS,iBAAiB;AAI1B,SAAS,qBAAqB;AAG9B,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,eAAe,iBAAiB;AAIzC,SAAS,UAAU;AACnB,SAAS,wBAAwB;AACjC,SAAS,aAAa,mBAAmB;AAGzC,SAAS,YAAY,mBAAmB,kBAAkB,sBAAsB;AAChF,SAAS,cAAc;AAEvB,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AAEjC,SAAS,4BAA4B;AAErC,SAAS,4BAA4B;AAErC,SAAS,sBAAsB;AAE/B,SAAS,kBAAkB;AAI3B,SAAS,QAAQ,sBAAsB;AACvC,SAAS,kBAAkB;AAC3B,SAAoB,WAAXA,gBAA+B;AAGxC,SAAS,WAAW,eAAe,kBAAkB,wBAAwB;AAC7E,SAAS,OAAO,qBAAqB;AACrC,SAAS,MAAM,YAAY,YAAY,WAAW,YAAY,iBAAiB,mBAAmB;AAClG,SAAS,YAAY,mBAAmB,gBAAgB,gBAAgB,oBAAoB,gBAAgB,0BAA0B;AACtI,SAAS,YAAY,iBAAiB;AACtC,SAAS,iBAAiB;AAC1B,SAAS,OAAO,aAAa,WAAW,aAAa,WAAW,UAAU,WAAW,oBAAoB;AACzG,SAAS,MAAM,UAAU,aAA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B,WAAXA,iBAA+C;AACxD,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAgD;AACzD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAAC;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Types\nexport * from './modules/auth/schema';\nexport * from './modules/users/schema';\nexport * from './modules/whitelabel/schema';\nexport * from './infra/api/types';\n\n// Contexts\nexport * from './providers/query.provider';\nexport * from './providers/auth.provider';\nexport * from './providers/whitelabel.provider';\n\n// Hooks\nexport { useUserQuery, useUserValidateSession, useInvalidateUser, useSetUserData, USER_QUERY_KEY } from './modules/auth/hooks/useUserQuery';\nexport { useSubscriptions, SUBSCRIPTIONS_QUERY_KEY } from './modules/subscriptions/hooks/list-subscriptions.hook';\nexport { useActiveSubscription } from './modules/subscriptions/hooks/find-active-subscription.hook';\nexport { useIaCredits } from './modules/ia-credits/hooks/ia-credits.hook';\nexport type { IaCreditsSummary, IaCreditOperation } from './modules/ia-credits/types';\nexport type { Subscription, SubscriptionItem, FindSubscriptionsParams } from './modules/subscriptions/types';\nexport { SubscriptionSchema, SubscriptionItemSchema } from './modules/subscriptions/types';\nexport { ADDON_IDS } from './modules/subscriptions/constants/addons.constants';\nexport type { AddonKindEnum } from './modules/subscriptions/constants/addons.constants';\n\n// Providers\nexport { QueryProvider } from './providers/query.provider';\n\n// Middleware\nexport { createAuthMiddleware } from './middlewares/create-auth-middleware';\nexport { createMiddlewareChain } from './middlewares/chain';\nexport { continueChain, stopChain } from './middlewares/types';\nexport type { MiddlewareFunction, MiddlewareConfig, MiddlewareResult } from './middlewares/types';\n\n// Utils\nexport { cn } from './infra/utils/clsx';\nexport { buildQueryParams } from './infra/utils/params';\nexport { parseSchema, parseResult } from './infra/utils/parser';\n\n// Layout\nexport { MainLayout, MainLayoutContent, MainLayoutSpacer, MainLayoutMain } from './components/layouts/MainLayout';\nexport { NavBar } from './components/layouts/NavBar';\nexport type { NavBarProps } from './components/layouts/NavBar';\nexport { AppNavBar } from './components/layouts/AppNavBar';\nexport type { AppNavBarProps } from './components/layouts/AppNavBar';\nexport { AppMobileNavBar } from './components/layouts/AppMobileNavBar';\nexport type { AppMobileNavBarProps } from './components/layouts/AppMobileNavBar';\nexport { SideBarNavigation } from './components/layouts/SideBarNavigation';\nexport { MdSideBarNavigation } from './components/layouts/MdSideBarNavigation';\nexport { NotificationItem } from './components/layouts/NotificationItem';\nexport type { NotificationItemProps } from './components/layouts/NotificationItem';\nexport { NotificationsPopover } from './components/layouts/NotificationsPopover';\nexport type { NotificationsPopoverProps, NotificationData } from './components/layouts/NotificationsPopover';\nexport { UsersSelectorPopover } from './components/layouts/UsersSelectorPopover';\nexport type { UsersSelectorPopoverProps, UserSelectorItem } from './components/layouts/UsersSelectorPopover';\nexport { ProfilePopover } from './components/layouts/ProfilePopover';\nexport type { ProfilePopoverProps, ProfileMenuItem } from './components/layouts/ProfilePopover';\nexport { NavBarItem } from './components/layouts/NavBarItem';\nexport type { NavBarItemProps } from './components/layouts/NavBarItem';\n\n// UI - Buttons\nexport { Button, buttonVariants } from './components/ui/buttons/Button';\nexport { CopyButton } from './components/ui/buttons/CopyButton';\nexport { default as CancelButton } from './components/ui/buttons/CancelButton';\n\n// UI - Data Display\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from './components/ui/data-display/Accordion';\nexport { Badge, badgeVariants } from './components/ui/data-display/Badge';\nexport { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent } from './components/ui/data-display/Card';\nexport { Pagination, PaginationContent, PaginationLink, PaginationItem, PaginationPrevious, PaginationNext, PaginationEllipsis } from './components/ui/data-display/Pagination';\nexport { ScrollArea, ScrollBar } from './components/ui/data-display/ScrollArea';\nexport { Separator } from './components/ui/data-display/Separator';\nexport { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } from './components/ui/data-display/Table';\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './components/ui/data-display/Tabs';\nexport { UserAvatar } from './components/ui/data-display/UserAvatar';\nexport type { UserAvatarProps } from './components/ui/data-display/UserAvatar';\n\n// UI - Feedback\nexport { default as CircularProgress } from './components/ui/feedback/CircularProgress';\nexport { default as DefaultCircularProgress } from './components/ui/feedback/DefaultCircularProgress';\nexport { Progress } from './components/ui/feedback/Progress';\nexport { LoadingOverlay } from './components/ui/feedback/LoadingOverlay';\nexport { Toast, toastVariants, toastIconContainerVariants } from './components/ui/feedback/Toast';\nexport type { ToastProps } from './components/ui/feedback/Toast';\n\n// UI - Form\nexport { Calendar, CalendarDayButton } from './components/ui/form/Calendar';\nexport { Checkbox } from './components/ui/form/Checkbox';\nexport { DatePicker } from './components/ui/form/DatePicker';\nexport { DateRangePicker } from './components/ui/form/DateRangePicker';\nexport { Input } from './components/ui/form/Input';\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from './components/ui/form/InputOtp';\nexport { RadioGroup, RadioGroupItem } from './components/ui/form/RadioGroup';\nexport { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from './components/ui/form/Select';\nexport { Switch } from './components/ui/form/Switch';\nexport { Textarea } from './components/ui/form/Textarea';\n\n// UI - Overlay\nexport { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator } from './components/ui/overlay/Command';\nexport { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './components/ui/overlay/Dialog';\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor } from './components/ui/overlay/Popover';\nexport { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from './components/ui/overlay/Sheet';\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './components/ui/overlay/Tooltip';\n\n// Store\nexport { useMdSidebarStore } from './store/useMdSidebarStore';\nexport { useModalManager } from './store/useModalManager';\nexport type { ModalData } from './store/useModalManager';\n\n// Enums\nexport { AccountSectionType } from './enums/AccountSectionType';\n\n// Hooks\nexport { default as usePasswordVisibility } from './hooks/usePasswordVisibility';\nexport { default as useCountdownTimer } from './hooks/useCountdownTimer';\nexport { default as useIsMobile } from './hooks/useIsMobile';\n\n// Utils\nexport { formatPhone, formatTimer, formatFullName, formatCPF, formatCardNumber } from './utils/format/masks';\nexport { buildTimezoneOptions } from './utils/intl/timezones';\nexport type { TimezoneOption } from './utils/intl/timezones';\nexport { buildLocaleOptions, LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS } from './utils/intl/locales';\nexport type { LocaleOption } from './utils/intl/locales';\nexport { copyToClipboard, readFromClipboard } from './utils/browser/clipboard';\n\n// UI - Form (new widgets)\nexport { FormField } from './components/ui/form/FormField';\nexport { SelectField } from './components/ui/form/SelectField';\nexport { ComboboxField } from './components/ui/form/ComboboxField';\nexport type { ComboboxOption } from './components/ui/form/ComboboxField';\nexport { default as PhoneInput } from './components/ui/form/PhoneInput';\nexport { default as SwitchOptionFieldWithIcon } from './components/ui/form/SwitchOptionFieldWithIcon';\nexport { TextAreaField } from './components/ui/form/TextAreaField';\n\n// Account Module - Hooks\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n} from './modules/accounts/hooks/useAccountManagement';\n\n// Account Types\nexport type {\n UpdateAccountRequest,\n UpdateAccountUserRequest,\n ChangePasswordRequest,\n DeleteAccountActionResult,\n DeleteUserActionResult,\n UpdateAccountActionResult,\n UpdateUserActionResult,\n TwoFactorGenerateResult,\n TwoFactorActionResult,\n ContactResetResult,\n} from './modules/accounts/types';\n\nexport { default as AccountModals } from './components/account/AccountModals';\nexport { useAccountModals } from './store/useAccountModals';\nexport type { AccountModalsConfig } from './store/useAccountModals';\n\nexport { ModalManager } from './components/modals/ModalManager';\nexport { Modals } from './components/modals/Modals';\n\nexport { default as TwoFactorAuthModal } from './components/account/TwoFactorAuthModal';\nexport { default as DisableTwoFactorAuthModal } from './components/account/DisableTwoFactorAuthModal';\nexport { default as ConfirmGlobalPreferencesModal } from './components/account/ConfirmGlobalPreferencesModal';\nexport { MyProfileSection } from './components/account/sections/MyProfileSection';\nexport { PreferencesSection } from './components/account/sections/PreferencesSection';\nexport { SecuritySection } from './components/account/sections/SecuritySection';\nexport { ChangePasswordSection } from './components/account/sections/ChangePasswordSection';\nexport { ChangeEmailModal } from './components/account/sections/ChangeEmailModal';\nexport { ChangePhoneModal } from './components/account/sections/ChangePhoneModal';\n\n// Account Constants\nexport {\n GENDER_OPTIONS,\n CURRENCY_OPTIONS,\n TIMEZONE_OPTIONS,\n TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from './components/account/constants';\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd,SAAS,cAAc,wBAAwB,mBAAmB,gBAAgB,sBAAsB;AACxG,SAAS,kBAAkB,+BAA+B;AAC1D,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAG7B,SAAS,oBAAoB,8BAA8B;AAC3D,SAAS,iBAAiB;AAI1B,SAAS,qBAAqB;AAG9B,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,eAAe,iBAAiB;AAIzC,SAAS,UAAU;AACnB,SAAS,wBAAwB;AACjC,SAAS,aAAa,mBAAmB;AAGzC,SAAS,YAAY,mBAAmB,kBAAkB,sBAAsB;AA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qB;AAC3J,SAAS,SAAS,gBAAgB,gBAAgB,qBAAqB;AACvE,SAAS,OAAO,cAAc,YAAY,cAAc,aAAa,aAAa,YAAY,wBAAwB;AACtH,SAAS,SAAS,gBAAgB,gBAAgB,uBAAuB;AAGzE,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAIhC,SAAS,0BAA0B;AAGnC,SAAoB,WAAXA,gBAAwC;AACjD,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAA8B;AAGvC,SAAS,aAAa,aAAa,gBAAgB,WAAW,wBAAwB;AACtF,SAAS,4BAA4B;AAErC,SAAS,oBAAwC,wBAA+B;AAEhF,SAAS,iBAAiB,yBAAyB;AAGnD,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAA4C;AACrD,SAAS,qBAAqB;AAG9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgBP,SAAoB,WAAXA,iBAAgC;AACzC,SAAS,wBAAwB;AAGjC,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAA4C;AACrD,SAAoB,WAAXA,iBAAgD;AACzD,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAGjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAAC;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
const useAccountModals = create((set) => ({
|
|
4
|
+
activeModal: null,
|
|
5
|
+
config: {},
|
|
6
|
+
initialSection: void 0,
|
|
7
|
+
pagesCount: 0,
|
|
8
|
+
updateConfig: (config) => set({ config }),
|
|
9
|
+
openConfigurations: (initialSection) => set({ activeModal: "configurations", initialSection }),
|
|
10
|
+
openDeleteAccount: (pagesCount = 0) => set({ activeModal: "deleteAccount", pagesCount }),
|
|
11
|
+
openIsntPossibleDelete: () => set({ activeModal: "isntPossibleDelete" }),
|
|
12
|
+
openConfirmDelete: (pagesCount = 0) => set({ activeModal: "confirmDelete", pagesCount }),
|
|
13
|
+
close: () => set({ activeModal: null, initialSection: void 0 })
|
|
14
|
+
}));
|
|
15
|
+
export {
|
|
16
|
+
useAccountModals
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=useAccountModals.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useAccountModals.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\nimport type { ComboboxOption } from '../components/ui/form/ComboboxField';\nimport type { AccountSectionType } from '../enums/AccountSectionType';\n\ntype AccountModalType =\n | 'configurations'\n | 'deleteAccount'\n | 'isntPossibleDelete'\n | 'confirmDelete';\n\nexport interface AccountModalsConfig {\n hasActiveSubscription?: boolean;\n currencies?: ComboboxOption[];\n onGoToSubscription?: () => void;\n}\n\ninterface AccountModalsState {\n activeModal: AccountModalType | null;\n config: AccountModalsConfig;\n initialSection?: AccountSectionType;\n pagesCount: number;\n\n /** Called by <AccountModals> to keep app-level config in sync */\n updateConfig: (config: AccountModalsConfig) => void;\n\n openConfigurations: (initialSection?: AccountSectionType) => void;\n openDeleteAccount: (pagesCount?: number) => void;\n openIsntPossibleDelete: () => void;\n openConfirmDelete: (pagesCount?: number) => void;\n close: () => void;\n}\n\nexport const useAccountModals = create<AccountModalsState>((set) => ({\n activeModal: null,\n config: {},\n initialSection: undefined,\n pagesCount: 0,\n\n updateConfig: (config) => set({ config }),\n\n openConfigurations: (initialSection) =>\n set({ activeModal: 'configurations', initialSection }),\n\n openDeleteAccount: (pagesCount = 0) =>\n set({ activeModal: 'deleteAccount', pagesCount }),\n\n openIsntPossibleDelete: () =>\n set({ activeModal: 'isntPossibleDelete' }),\n\n openConfirmDelete: (pagesCount = 0) =>\n set({ activeModal: 'confirmDelete', pagesCount }),\n\n close: () =>\n set({ activeModal: null, initialSection: undefined }),\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AAgChB,MAAM,mBAAmB,OAA2B,CAAC,SAAS;AAAA,EACnE,aAAa;AAAA,EACb,QAAQ,CAAC;AAAA,EACT,gBAAgB;AAAA,EAChB,YAAY;AAAA,EAEZ,cAAc,CAAC,WAAW,IAAI,EAAE,OAAO,CAAC;AAAA,EAExC,oBAAoB,CAAC,mBACnB,IAAI,EAAE,aAAa,kBAAkB,eAAe,CAAC;AAAA,EAEvD,mBAAmB,CAAC,aAAa,MAC/B,IAAI,EAAE,aAAa,iBAAiB,WAAW,CAAC;AAAA,EAElD,wBAAwB,MACtB,IAAI,EAAE,aAAa,qBAAqB,CAAC;AAAA,EAE3C,mBAAmB,CAAC,aAAa,MAC/B,IAAI,EAAE,aAAa,iBAAiB,WAAW,CAAC;AAAA,EAElD,OAAO,MACL,IAAI,EAAE,aAAa,MAAM,gBAAgB,OAAU,CAAC;AACxD,EAAE;","names":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
const useModalManager = create((set, get) => ({
|
|
4
|
+
modalStack: [],
|
|
5
|
+
activeModal: null,
|
|
6
|
+
modalData: {},
|
|
7
|
+
openModal: (key, data = {}) => {
|
|
8
|
+
set((state) => {
|
|
9
|
+
const existingIndex = state.modalStack.findIndex((item) => item.key === key);
|
|
10
|
+
if (existingIndex !== -1) {
|
|
11
|
+
const newStack2 = [...state.modalStack];
|
|
12
|
+
newStack2[existingIndex] = { key, data };
|
|
13
|
+
return {
|
|
14
|
+
modalStack: newStack2,
|
|
15
|
+
activeModal: newStack2[newStack2.length - 1]?.key ?? null,
|
|
16
|
+
modalData: newStack2[newStack2.length - 1]?.data ?? {}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const newStack = [...state.modalStack, { key, data }];
|
|
20
|
+
return {
|
|
21
|
+
modalStack: newStack,
|
|
22
|
+
activeModal: key,
|
|
23
|
+
modalData: data
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
closeModal: () => {
|
|
28
|
+
set((state) => {
|
|
29
|
+
const newStack = state.modalStack.slice(0, -1);
|
|
30
|
+
const topModal = newStack[newStack.length - 1];
|
|
31
|
+
return {
|
|
32
|
+
modalStack: newStack,
|
|
33
|
+
activeModal: topModal?.key ?? null,
|
|
34
|
+
modalData: topModal?.data ?? {}
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
closeModalByKey: (key) => {
|
|
39
|
+
set((state) => {
|
|
40
|
+
const newStack = state.modalStack.filter((item) => item.key !== key);
|
|
41
|
+
const topModal = newStack[newStack.length - 1];
|
|
42
|
+
return {
|
|
43
|
+
modalStack: newStack,
|
|
44
|
+
activeModal: topModal?.key ?? null,
|
|
45
|
+
modalData: topModal?.data ?? {}
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
updateModalData: (data) => {
|
|
50
|
+
set((state) => {
|
|
51
|
+
if (state.modalStack.length === 0) return state;
|
|
52
|
+
const newStack = [...state.modalStack];
|
|
53
|
+
const lastIndex = newStack.length - 1;
|
|
54
|
+
newStack[lastIndex] = {
|
|
55
|
+
...newStack[lastIndex],
|
|
56
|
+
data: { ...newStack[lastIndex].data, ...data }
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
modalStack: newStack,
|
|
60
|
+
modalData: newStack[lastIndex].data
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
isModalOpen: (key) => {
|
|
65
|
+
return get().modalStack.some((item) => item.key === key);
|
|
66
|
+
},
|
|
67
|
+
getModalData: (key) => {
|
|
68
|
+
const item = get().modalStack.find((item2) => item2.key === key);
|
|
69
|
+
return item?.data ?? {};
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
export {
|
|
73
|
+
useModalManager
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=useModalManager.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/useModalManager.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ModalData = Record<string, any>;\n\ninterface ModalStackItem {\n key: string;\n data: ModalData;\n}\n\ninterface ModalState {\n modalStack: ModalStackItem[];\n activeModal: string | null;\n modalData: ModalData;\n openModal: (key: string, data?: ModalData) => void;\n /** Closes the top modal in the stack */\n closeModal: () => void;\n /** Closes a specific modal by key */\n closeModalByKey: (key: string) => void;\n updateModalData: (data: ModalData) => void;\n isModalOpen: (key: string) => boolean;\n getModalData: (key: string) => ModalData;\n}\n\nexport const useModalManager = create<ModalState>((set, get) => ({\n modalStack: [],\n activeModal: null,\n modalData: {},\n\n openModal: (key, data = {}) => {\n set((state) => {\n const existingIndex = state.modalStack.findIndex((item) => item.key === key);\n if (existingIndex !== -1) {\n const newStack = [...state.modalStack];\n newStack[existingIndex] = { key, data };\n return {\n modalStack: newStack,\n activeModal: newStack[newStack.length - 1]?.key ?? null,\n modalData: newStack[newStack.length - 1]?.data ?? {},\n };\n }\n\n const newStack = [...state.modalStack, { key, data }];\n return {\n modalStack: newStack,\n activeModal: key,\n modalData: data,\n };\n });\n },\n\n closeModal: () => {\n set((state) => {\n const newStack = state.modalStack.slice(0, -1);\n const topModal = newStack[newStack.length - 1];\n return {\n modalStack: newStack,\n activeModal: topModal?.key ?? null,\n modalData: topModal?.data ?? {},\n };\n });\n },\n\n closeModalByKey: (key: string) => {\n set((state) => {\n const newStack = state.modalStack.filter((item) => item.key !== key);\n const topModal = newStack[newStack.length - 1];\n return {\n modalStack: newStack,\n activeModal: topModal?.key ?? null,\n modalData: topModal?.data ?? {},\n };\n });\n },\n\n updateModalData: (data) => {\n set((state) => {\n if (state.modalStack.length === 0) return state;\n\n const newStack = [...state.modalStack];\n const lastIndex = newStack.length - 1;\n newStack[lastIndex] = {\n ...newStack[lastIndex],\n data: { ...newStack[lastIndex].data, ...data },\n };\n\n return {\n modalStack: newStack,\n modalData: newStack[lastIndex].data,\n };\n });\n },\n\n isModalOpen: (key: string) => {\n return get().modalStack.some((item) => item.key === key);\n },\n\n getModalData: (key: string) => {\n const item = get().modalStack.find((item) => item.key === key);\n return item?.data ?? {};\n },\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AAwBhB,MAAM,kBAAkB,OAAmB,CAAC,KAAK,SAAS;AAAA,EAC/D,YAAY,CAAC;AAAA,EACb,aAAa;AAAA,EACb,WAAW,CAAC;AAAA,EAEZ,WAAW,CAAC,KAAK,OAAO,CAAC,MAAM;AAC7B,QAAI,CAAC,UAAU;AACb,YAAM,gBAAgB,MAAM,WAAW,UAAU,CAAC,SAAS,KAAK,QAAQ,GAAG;AAC3E,UAAI,kBAAkB,IAAI;AACxB,cAAMA,YAAW,CAAC,GAAG,MAAM,UAAU;AACrC,QAAAA,UAAS,aAAa,IAAI,EAAE,KAAK,KAAK;AACtC,eAAO;AAAA,UACL,YAAYA;AAAA,UACZ,aAAaA,UAASA,UAAS,SAAS,CAAC,GAAG,OAAO;AAAA,UACnD,WAAWA,UAASA,UAAS,SAAS,CAAC,GAAG,QAAQ,CAAC;AAAA,QACrD;AAAA,MACF;AAEA,YAAM,WAAW,CAAC,GAAG,MAAM,YAAY,EAAE,KAAK,KAAK,CAAC;AACpD,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,aAAa;AAAA,QACb,WAAW;AAAA,MACb;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,YAAY,MAAM;AAChB,QAAI,CAAC,UAAU;AACb,YAAM,WAAW,MAAM,WAAW,MAAM,GAAG,EAAE;AAC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
'use client';
|
|
2
|
+
|
|
3
|
+
import ConfigurationsMyAccountModal from './ConfigurationsMyAccountModal';
|
|
4
|
+
import DeleteAccountModal from './DeleteAccountModal';
|
|
5
|
+
import IsntPossibleDeleteAccountModal from './IsntPossibleDeleteAccountModal';
|
|
6
|
+
import ConfirmDeleteAccountModal from './ConfirmDeleteAccountModal';
|
|
7
|
+
|
|
8
|
+
export default function AccountModals() {
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<ConfigurationsMyAccountModal />
|
|
12
|
+
<DeleteAccountModal />
|
|
13
|
+
<IsntPossibleDeleteAccountModal />
|
|
14
|
+
<ConfirmDeleteAccountModal />
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -12,33 +12,36 @@ import { ChangePasswordSection } from './sections/ChangePasswordSection';
|
|
|
12
12
|
import { SecuritySection } from './sections/SecuritySection';
|
|
13
13
|
import useConfigurationsModal from './hooks/useConfigurationsModal';
|
|
14
14
|
import useIsMobile from '../../hooks/useIsMobile';
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
15
|
+
import { useAccountModals } from '../../store/useAccountModals';
|
|
16
|
+
|
|
17
|
+
export default function ConfigurationsMyAccountModal() {
|
|
18
|
+
const {
|
|
19
|
+
activeModal,
|
|
20
|
+
config,
|
|
21
|
+
initialSection,
|
|
22
|
+
openDeleteAccount,
|
|
23
|
+
openIsntPossibleDelete,
|
|
24
|
+
close,
|
|
25
|
+
} = useAccountModals();
|
|
26
|
+
|
|
27
|
+
const open = activeModal === 'configurations';
|
|
28
|
+
const { hasActiveSubscription, currencies = [] } = config;
|
|
26
29
|
|
|
27
|
-
export default function ConfigurationsMyAccountModal({
|
|
28
|
-
open,
|
|
29
|
-
onClose,
|
|
30
|
-
initialSection,
|
|
31
|
-
hasActiveSubscription,
|
|
32
|
-
currencies = [],
|
|
33
|
-
storageUrl,
|
|
34
|
-
onDeleteAccount,
|
|
35
|
-
}: ConfigurationsMyAccountModalProps) {
|
|
36
30
|
const isMobile = useIsMobile();
|
|
37
31
|
const { activeSection, setActiveSection } = useConfigurationsModal({
|
|
38
32
|
isOpen: open,
|
|
39
33
|
initialSection,
|
|
40
34
|
});
|
|
41
35
|
|
|
36
|
+
const handleDeleteAccount = () => {
|
|
37
|
+
close();
|
|
38
|
+
if (hasActiveSubscription) {
|
|
39
|
+
openIsntPossibleDelete();
|
|
40
|
+
} else {
|
|
41
|
+
openDeleteAccount();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
42
45
|
const tabTriggerClasses = cn(
|
|
43
46
|
'border-0! px-0 py-0',
|
|
44
47
|
|
|
@@ -55,7 +58,7 @@ export default function ConfigurationsMyAccountModal({
|
|
|
55
58
|
);
|
|
56
59
|
|
|
57
60
|
return (
|
|
58
|
-
<Dialog open={open} onOpenChange={
|
|
61
|
+
<Dialog open={open} onOpenChange={close}>
|
|
59
62
|
<DialogContent
|
|
60
63
|
showCloseButton={!isMobile}
|
|
61
64
|
overlayClassName="bg-black/20 lg:bg-black/50"
|
|
@@ -73,7 +76,7 @@ export default function ConfigurationsMyAccountModal({
|
|
|
73
76
|
<button
|
|
74
77
|
type="button"
|
|
75
78
|
className="size-8 flex items-center justify-center text-gray-500 cursor-pointer"
|
|
76
|
-
onClick={
|
|
79
|
+
onClick={close}
|
|
77
80
|
>
|
|
78
81
|
<X size={18} />
|
|
79
82
|
</button>
|
|
@@ -120,15 +123,15 @@ export default function ConfigurationsMyAccountModal({
|
|
|
120
123
|
|
|
121
124
|
<div className="w-full flex-1 min-h-0 lg:h-full overflow-hidden lg:overflow-visible relative">
|
|
122
125
|
<TabsContent value={AccountSectionType.MY_PROFILE} className="h-full! relative overflow-hidden">
|
|
123
|
-
<MyProfileSection onClose={
|
|
126
|
+
<MyProfileSection onClose={close} />
|
|
124
127
|
</TabsContent>
|
|
125
128
|
|
|
126
129
|
<TabsContent value={AccountSectionType.SECURITY} className="h-full! relative overflow-hidden">
|
|
127
130
|
<SecuritySection
|
|
128
131
|
setActiveSection={setActiveSection}
|
|
129
|
-
onClose={
|
|
132
|
+
onClose={close}
|
|
130
133
|
hasActiveSubscription={hasActiveSubscription}
|
|
131
|
-
onDeleteAccount={
|
|
134
|
+
onDeleteAccount={handleDeleteAccount}
|
|
132
135
|
/>
|
|
133
136
|
</TabsContent>
|
|
134
137
|
|
|
@@ -137,7 +140,7 @@ export default function ConfigurationsMyAccountModal({
|
|
|
137
140
|
</TabsContent>
|
|
138
141
|
|
|
139
142
|
<TabsContent value={AccountSectionType.PREFERENCES} className="h-full! relative overflow-hidden">
|
|
140
|
-
<PreferencesSection onClose={
|
|
143
|
+
<PreferencesSection onClose={close} currencies={currencies} />
|
|
141
144
|
</TabsContent>
|
|
142
145
|
</div>
|
|
143
146
|
</Tabs>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { TriangleAlert } from 'lucide-react';
|
|
4
|
+
import { toast } from 'sonner';
|
|
5
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';
|
|
6
|
+
import { Button } from '../ui/buttons/Button';
|
|
7
|
+
import { Toast } from '../ui/feedback/Toast';
|
|
8
|
+
import { useAccountModals } from '../../store/useAccountModals';
|
|
9
|
+
|
|
10
|
+
export default function ConfirmDeleteAccountModal() {
|
|
11
|
+
const { activeModal, pagesCount, close } = useAccountModals();
|
|
12
|
+
const open = activeModal === 'confirmDelete';
|
|
13
|
+
|
|
14
|
+
const handleConfirm = () => {
|
|
15
|
+
toast.custom((t) => (
|
|
16
|
+
<Toast variant="success" message="Conta excluída com sucesso" toastId={t} />
|
|
17
|
+
));
|
|
18
|
+
close();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Dialog open={open} onOpenChange={close}>
|
|
23
|
+
<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%]!">
|
|
24
|
+
<div className="flex flex-col gap-5 p-4 lg:p-5">
|
|
25
|
+
<DialogHeader className="p-0">
|
|
26
|
+
<DialogTitle className="paragraph-medium-semibold text-gray-950">
|
|
27
|
+
Uma pena te ver ir!
|
|
28
|
+
</DialogTitle>
|
|
29
|
+
</DialogHeader>
|
|
30
|
+
|
|
31
|
+
<div className="bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4">
|
|
32
|
+
<TriangleAlert size={20} className="text-red-500 shrink-0" strokeWidth={2} />
|
|
33
|
+
<p className="paragraph-small-regular text-gray-600">
|
|
34
|
+
Todas suas{' '}
|
|
35
|
+
<span className="font-semibold text-gray-950">{pagesCount} páginas</span>{' '}
|
|
36
|
+
serão deletadas permanentemente. Essa ação é{' '}
|
|
37
|
+
<span className="font-semibold text-gray-950">irreversível!</span>
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div className="h-px bg-gray-200" />
|
|
43
|
+
|
|
44
|
+
<div className="flex items-center gap-2 p-4 lg:p-5">
|
|
45
|
+
<Button className="h-10 flex-1" onClick={close}>
|
|
46
|
+
Manter minha conta
|
|
47
|
+
</Button>
|
|
48
|
+
<Button variant="secondary" className="h-10! flex-1" onClick={handleConfirm}>
|
|
49
|
+
Excluir mesmo assim
|
|
50
|
+
</Button>
|
|
51
|
+
</div>
|
|
52
|
+
</DialogContent>
|
|
53
|
+
</Dialog>
|
|
54
|
+
);
|
|
55
|
+
}
|