@greatapps/common 1.1.540 → 1.1.542

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.
Files changed (34) hide show
  1. package/dist/components/account/ConfigurationsMyAccountModal.mjs +7 -3
  2. package/dist/components/account/ConfigurationsMyAccountModal.mjs.map +1 -1
  3. package/dist/components/account/ConfirmDeleteAccountModal.mjs +46 -7
  4. package/dist/components/account/ConfirmDeleteAccountModal.mjs.map +1 -1
  5. package/dist/components/account/DeleteAccountModal.mjs +2 -2
  6. package/dist/components/account/DeleteAccountModal.mjs.map +1 -1
  7. package/dist/components/modals/Modals.mjs +3 -3
  8. package/dist/components/modals/Modals.mjs.map +1 -1
  9. package/dist/index.mjs +8 -0
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/modules/pages/actions/count-pages.action.mjs +12 -0
  12. package/dist/modules/pages/actions/count-pages.action.mjs.map +1 -0
  13. package/dist/modules/pages/constants/query-keys.constants.mjs +5 -0
  14. package/dist/modules/pages/constants/query-keys.constants.mjs.map +1 -0
  15. package/dist/modules/pages/hooks/count-pages.hook.mjs +23 -0
  16. package/dist/modules/pages/hooks/count-pages.hook.mjs.map +1 -0
  17. package/dist/modules/pages/services/pages.service.mjs +24 -0
  18. package/dist/modules/pages/services/pages.service.mjs.map +1 -0
  19. package/dist/server.mjs +2 -0
  20. package/dist/server.mjs.map +1 -1
  21. package/dist/store/useAccountModals.mjs +2 -3
  22. package/dist/store/useAccountModals.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/src/components/account/ConfigurationsMyAccountModal.tsx +14 -3
  25. package/src/components/account/ConfirmDeleteAccountModal.tsx +47 -10
  26. package/src/components/account/DeleteAccountModal.tsx +2 -2
  27. package/src/components/modals/Modals.tsx +3 -4
  28. package/src/index.ts +5 -0
  29. package/src/modules/pages/actions/count-pages.action.ts +10 -0
  30. package/src/modules/pages/constants/query-keys.constants.ts +1 -0
  31. package/src/modules/pages/hooks/count-pages.hook.ts +22 -0
  32. package/src/modules/pages/services/pages.service.ts +27 -0
  33. package/src/server.ts +1 -0
  34. package/src/store/useAccountModals.ts +6 -9
@@ -14,16 +14,20 @@ import useIsMobile from "../../hooks/useIsMobile";
14
14
  import { useAccountModals } from "../../store/useAccountModals";
15
15
  import { useAuth } from "../../providers/auth.provider";
16
16
  import { UserProfile } from "../../modules/users/schema";
17
+ import { useActiveSubscription } from "../../modules/subscriptions/hooks/find-active-subscription.hook";
18
+ import { hasSubscriptionExpired } from "../../modules/subscriptions/utils/has-subscription-expired";
17
19
  function ConfigurationsMyAccountModal() {
18
20
  const {
19
21
  activeModal,
20
- config,
21
22
  openDeleteAccount,
22
23
  openIsntPossibleDelete,
23
24
  close
24
25
  } = useAccountModals();
25
26
  const open = activeModal === "configurations";
26
- const { hasActiveSubscription } = config;
27
+ const { data: subscriptionData } = useActiveSubscription();
28
+ const subscription = subscriptionData?.data?.[0] ?? null;
29
+ const isPaidSubscriptionType = !!subscription && subscription.type !== "free" && subscription.type !== "trial";
30
+ const isBlockingSubscription = isPaidSubscriptionType && subscription.active === true && !hasSubscriptionExpired(subscription.date_due);
27
31
  const { user } = useAuth();
28
32
  const isOwner = user?.profile === UserProfile.owner;
29
33
  const isMobile = useIsMobile();
@@ -32,7 +36,7 @@ function ConfigurationsMyAccountModal() {
32
36
  });
33
37
  const handleDeleteAccount = () => {
34
38
  close();
35
- if (hasActiveSubscription) {
39
+ if (isBlockingSubscription) {
36
40
  openIsntPossibleDelete();
37
41
  } else {
38
42
  openDeleteAccount();
@@ -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';\n\nexport default function ConfigurationsMyAccountModal() {\n const {\n activeModal,\n config,\n openDeleteAccount,\n openIsntPossibleDelete,\n close,\n } = useAccountModals();\n\n const open = activeModal === 'configurations';\n const { hasActiveSubscription } = config;\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 (hasActiveSubscription) {\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 && (\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":";AAyEU,SAoEI,UApEJ,KAEF,YAFE;AAvEV,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;AAEb,SAAR,+BAAgD;AACrD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,iBAAiB;AAErB,QAAM,OAAO,gBAAgB;AAC7B,QAAM,EAAE,sBAA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AAAA,2CAAC,eAAY,OAAO,mBAAmB,aAAa,WAAW,mBAC7D;AAAA,4CAAC,iBAAc,MAAM,IAAI,WAAU,YAAW;AAAA,wBAC9C,oBAAC,UAAK,WAAU,0BAAyB,6BAAY;AAAA,yBACvD;AAAA,sBAEC,WACC,qBAAC,eAAY,OAAO,mBAAmB,OAAO,WAAW,mBACvD;AAAA,4CAAC,WAAQ,MAAM,IAAI,WAAU,YAAW;AAAA,wBACxC,oBAAC,UAAK,WAAU,0BAAyB,4BAAc;AAAA,yBACzD;AAAA,sBAGD,WACC,qBAAC,eAAY,OAAO,mBAAmB,UAAU,WAAW,mBAC1D;AAAA,4CAAC,YAAS,MAAM,IAAI,WAAU,YAAW;AAAA,wBACzC,oBAAC,UAAK,WAAU,0BAAyB,0BAAS;AAAA,yBACpD;AAAA,uBAEJ;AAAA;AAAA;AAAA,cACF;AAAA,cAEA,qBAAC,SAAI,WAAU,8FACb;AAAA,oCAAC,eAAY,OAAO,mBAAmB,aAAa,WAAU,oCAC5D,8BAAC,sBAAmB,SAAS,OAAO,GACtC;AAAA,gBAEC,WACC,oBAAC,eAAY,OAAO,mBAAmB,OAAO,WAAU,oCACtD,8BAAC,gBAAa,GAChB;AAAA,gBAGD,WACC,iCACE;AAAA,sCAAC,eAAY,OAAO,mBAAmB,UAAU,WAAU,oCACzD;AAAA,oBAAC;AAAA;AAAA,sBACC;AAAA,sBACA,SAAS;AAAA,sBACT,iBAAiB;AAAA;AAAA,kBACnB,GACF;AAAA,kBAEA,oBAAC,eAAY,OAAO,mBAAmB,iBAAiB,WAAU,oCAChE,8BAAC,yBAAsB,QAAQ,MAAM,iBAAiB,mBAAmB,QAAQ,GAAG,GACtF;AAAA,mBACF;AAAA,iBAEJ;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/account/ConfigurationsMyAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { IconKey, IconLock, IconSettings2, IconX } from '@tabler/icons-react';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../ui/data-display/Tabs';\nimport { cn } from '../../infra/utils/clsx';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\nimport { PreferencesSection } from './sections/PreferencesSection';\nimport { ChangePasswordSection } from './sections/ChangePasswordSection';\nimport { TokenSection } from './sections/TokenSection';\nimport { SecuritySection } from './sections/SecuritySection';\nimport useConfigurationsModal from './hooks/useConfigurationsModal';\nimport useIsMobile from '../../hooks/useIsMobile';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { useAuth } from '../../providers/auth.provider';\nimport { UserProfile } from '../../modules/users/schema';\nimport { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';\nimport { hasSubscriptionExpired } from '../../modules/subscriptions/utils/has-subscription-expired';\n\nexport default function ConfigurationsMyAccountModal() {\n const {\n activeModal,\n openDeleteAccount,\n openIsntPossibleDelete,\n close,\n } = useAccountModals();\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 !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 && (\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":";AAoFU,SAoEI,UApEJ,KAEF,YAFE;AAlFV,SAAS,SAAS,UAAU,eAAe,aAAa;AACx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AAA,cAEA,qBAAC,SAAI,WAAU,8FACb;AAAA,oCAAC,eAAY,OAAO,mBAAmB,aAAa,WAAU,oCAC5D,8BAAC,sBAAmB,SAAS,OAAO,GACtC;AAAA,gBAEC,WACC,oBAAC,eAAY,OAAO,mBAAmB,OAAO,WAAU,oCACtD,8BAAC,gBAAa,GAChB;AAAA,gBAGD,WACC,iCACE;AAAA,sCAAC,eAAY,OAAO,mBAAmB,UAAU,WAAU,oCACzD;AAAA,oBAAC;AAAA;AAAA,sBACC;AAAA,sBACA,SAAS;AAAA,sBACT,iBAAiB;AAAA;AAAA,kBACnB,GACF;AAAA,kBAEA,oBAAC,eAAY,OAAO,mBAAmB,iBAAiB,WAAU,oCAChE,8BAAC,yBAAsB,QAAQ,MAAM,iBAAiB,mBAAmB,QAAQ,GAAG,GACtF;AAAA,mBACF;AAAA,iBAEJ;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":[]}
@@ -6,14 +6,44 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/overlay/
6
6
  import { Button } from "../ui/buttons/Button";
7
7
  import { Toast } from "../ui/feedback/Toast";
8
8
  import { useAccountModals } from "../../store/useAccountModals";
9
+ import { useCountPages } from "../../modules/pages/hooks/count-pages.hook";
10
+ import {
11
+ useDeleteAccount,
12
+ useDeleteAccountUser
13
+ } from "../../modules/accounts/hooks/useAccountManagement";
14
+ import { useAuth } from "../../providers/auth.provider";
15
+ import { UserProfile } from "../../modules/users/schema";
9
16
  function ConfirmDeleteAccountModal() {
10
- const { activeModal, pagesCount, close } = useAccountModals();
17
+ const { activeModal, close } = useAccountModals();
11
18
  const open = activeModal === "confirmDelete";
12
- const handleConfirm = () => {
13
- toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Conta exclu\xEDda com sucesso", toastId: t }));
14
- close();
19
+ const { data: pagesCount = 0 } = useCountPages();
20
+ const { user, logout } = useAuth();
21
+ const isOwner = user?.profile === UserProfile.owner;
22
+ const deleteAccount = useDeleteAccount();
23
+ const deleteAccountUser = useDeleteAccountUser();
24
+ const isDeleting = deleteAccount.isPending || deleteAccountUser.isPending;
25
+ const handleConfirm = async () => {
26
+ try {
27
+ if (isOwner) {
28
+ await deleteAccount.mutateAsync();
29
+ } else {
30
+ await deleteAccountUser.mutateAsync(user.id);
31
+ }
32
+ close();
33
+ toast.custom((t) => /* @__PURE__ */ jsx(Toast, { variant: "success", message: "Conta exclu\xEDda com sucesso", toastId: t }));
34
+ await logout();
35
+ } catch (error) {
36
+ toast.custom((t) => /* @__PURE__ */ jsx(
37
+ Toast,
38
+ {
39
+ variant: "error",
40
+ message: error instanceof Error ? error.message : "Erro ao excluir. Tente novamente.",
41
+ toastId: t
42
+ }
43
+ ));
44
+ }
15
45
  };
16
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: 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: [
46
+ 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: [
17
47
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 p-4 lg:p-5", children: [
18
48
  /* @__PURE__ */ jsx(DialogHeader, { className: "p-0", children: /* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-gray-950", children: "Uma pena te ver ir!" }) }),
19
49
  /* @__PURE__ */ jsxs("div", { className: "bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4", children: [
@@ -34,8 +64,17 @@ function ConfirmDeleteAccountModal() {
34
64
  ] }),
35
65
  /* @__PURE__ */ jsx("div", { className: "h-px bg-gray-200" }),
36
66
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-4 lg:p-5", children: [
37
- /* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: close, children: "Manter minha conta" }),
38
- /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "h-10! flex-1", onClick: handleConfirm, children: "Excluir mesmo assim" })
67
+ /* @__PURE__ */ jsx(Button, { className: "h-10 flex-1", onClick: close, disabled: isDeleting, children: "Manter minha conta" }),
68
+ /* @__PURE__ */ jsx(
69
+ Button,
70
+ {
71
+ variant: "secondary",
72
+ className: "h-10! flex-1",
73
+ onClick: handleConfirm,
74
+ disabled: isDeleting,
75
+ children: isDeleting ? "Excluindo..." : "Excluir mesmo assim"
76
+ }
77
+ )
39
78
  ] })
40
79
  ] }) });
41
80
  }
@@ -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';\n\nexport default function ConfirmDeleteAccountModal() {\n const { activeModal, pagesCount, close } = useAccountModals();\n const open = activeModal === 'confirmDelete';\n\n const handleConfirm = () => {\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Conta excluída com sucesso\" toastId={t} />\n ));\n close();\n };\n\n return (\n <Dialog open={open} onOpenChange={close}>\n <DialogContent className=\"flex flex-col p-0 gap-0 max-w-[calc(100%-2rem)]! w-full rounded-lg border sm:max-w-[400px]! lg:max-w-[470px]! lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!\">\n <div className=\"flex flex-col gap-5 p-4 lg:p-5\">\n <DialogHeader className=\"p-0\">\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950\">\n Uma pena te ver ir!\n </DialogTitle>\n </DialogHeader>\n\n <div className=\"bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4\">\n <IconAlertTriangle size={20} className=\"text-red-500 shrink-0\" strokeWidth={2} />\n <p className=\"paragraph-small-regular text-gray-600\">\n Todas suas{' '}\n <span className=\"font-semibold text-gray-950\">{pagesCount} páginas</span>{' '}\n serão deletadas permanentemente. Essa ação é{' '}\n <span className=\"font-semibold text-gray-950\">irreversível!</span>\n </p>\n </div>\n </div>\n\n <div className=\"h-px bg-gray-200\" />\n\n <div className=\"flex items-center gap-2 p-4 lg:p-5\">\n <Button className=\"h-10 flex-1\" onClick={close}>\n Manter minha conta\n </Button>\n <Button variant=\"secondary\" className=\"h-10! flex-1\" onClick={handleConfirm}>\n Excluir mesmo assim\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAeM,cAmBQ,YAnBR;AAbN,SAAS,yBAAyB;AAClC,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,cAAc,mBAAmB;AACjE,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,wBAAwB;AAElB,SAAR,4BAA6C;AAClD,QAAM,EAAE,aAAa,YAAY,MAAM,IAAI,iBAAiB;AAC5D,QAAM,OAAO,gBAAgB;AAE7B,QAAM,gBAAgB,MAAM;AAC1B,UAAM,OAAO,CAAC,MACZ,oBAAC,SAAM,SAAQ,WAAU,SAAQ,iCAA6B,SAAS,GAAG,CAC3E;AACD,UAAM;AAAA,EACR;AAEA,SACE,oBAAC,UAAO,MAAY,cAAc,OAChC,+BAAC,iBAAc,WAAU,2NACvB;AAAA,yBAAC,SAAI,WAAU,kCACb;AAAA,0BAAC,gBAAa,WAAU,OACtB,8BAAC,eAAY,WAAU,2CAA0C,iCAEjE,GACF;AAAA,MAEA,qBAAC,SAAI,WAAU,2DACb;AAAA,4BAAC,qBAAkB,MAAM,IAAI,WAAU,yBAAwB,aAAa,GAAG;AAAA,QAC/E,qBAAC,OAAE,WAAU,yCAAwC;AAAA;AAAA,UACxC;AAAA,UACX,qBAAC,UAAK,WAAU,+BAA+B;AAAA;AAAA,YAAW;AAAA,aAAQ;AAAA,UAAQ;AAAA,UAAI;AAAA,UACjC;AAAA,UAC7C,oBAAC,UAAK,WAAU,+BAA8B,8BAAa;AAAA,WAC7D;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,SAAI,WAAU,oBAAmB;AAAA,IAElC,qBAAC,SAAI,WAAU,sCACb;AAAA,0BAAC,UAAO,WAAU,eAAc,SAAS,OAAO,gCAEhD;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,WAAU,gBAAe,SAAS,eAAe,iCAE7E;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
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, 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 await deleteAccount.mutateAsync();\n } else {\n await deleteAccountUser.mutateAsync(user!.id);\n }\n close();\n toast.custom((t) => (\n <Toast variant=\"success\" message=\"Conta excluída com sucesso\" toastId={t} />\n ));\n await logout();\n } catch (error) {\n toast.custom((t) => (\n <Toast\n variant=\"error\"\n message={error instanceof Error ? error.message : 'Erro ao excluir. Tente novamente.'}\n toastId={t}\n />\n ));\n }\n };\n\n return (\n <Dialog open={open} onOpenChange={isDeleting ? undefined : close}>\n <DialogContent className=\"flex flex-col p-0 gap-0 max-w-[calc(100%-2rem)]! w-full rounded-lg border sm:max-w-[400px]! lg:max-w-[470px]! lg:top-[50%]! lg:left-[50%]! lg:right-auto! lg:bottom-auto! lg:translate-x-[-50%]! lg:translate-y-[-50%]!\">\n <div className=\"flex flex-col gap-5 p-4 lg:p-5\">\n <DialogHeader className=\"p-0\">\n <DialogTitle className=\"paragraph-medium-semibold text-gray-950\">\n Uma pena te ver ir!\n </DialogTitle>\n </DialogHeader>\n\n <div className=\"bg-red-50 p-4 lg:p-5 rounded-lg flex items-center gap-4\">\n <IconAlertTriangle size={20} className=\"text-red-500 shrink-0\" strokeWidth={2} />\n <p className=\"paragraph-small-regular text-gray-600\">\n Todas suas{' '}\n <span className=\"font-semibold text-gray-950\">{pagesCount} páginas</span>{' '}\n serão deletadas permanentemente. Essa ação é{' '}\n <span className=\"font-semibold text-gray-950\">irreversível!</span>\n </p>\n </div>\n </div>\n\n <div className=\"h-px bg-gray-200\" />\n\n <div className=\"flex items-center gap-2 p-4 lg:p-5\">\n <Button className=\"h-10 flex-1\" onClick={close} disabled={isDeleting}>\n Manter minha conta\n </Button>\n <Button\n variant=\"secondary\"\n className=\"h-10! flex-1\"\n onClick={handleConfirm}\n disabled={isDeleting}\n >\n {isDeleting ? 'Excluindo...' : 'Excluir mesmo assim'}\n </Button>\n </div>\n </Dial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,2CAA0C,iCAEjE,GACF;AAAA,MAEA,qBAAC,SAAI,WAAU,2DACb;AAAA,4BAAC,qBAAkB,MAAM,IAAI,WAAU,yBAAwB,aAAa,GAAG;AAAA,QAC/E,qBAAC,OAAE,WAAU,yCAAwC;AAAA;AAAA,UACxC;AAAA,UACX,qBAAC,UAAK,WAAU,+BAA+B;AAAA;AAAA,YAAW;AAAA,aAAQ;AAAA,UAAQ;AAAA,UAAI;AAAA,UACjC;AAAA,UAC7C,oBAAC,UAAK,WAAU,+BAA8B,8BAAa;AAAA,WAC7D;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,SAAI,WAAU,oBAAmB;AAAA,IAElC,qBAAC,SAAI,WAAU,sCACb;AAAA,0BAAC,UAAO,WAAU,eAAc,SAAS,OAAO,UAAU,YAAY,gCAEtE;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,SAAS;AAAA,UACT,UAAU;AAAA,UAET,uBAAa,iBAAiB;AAAA;AAAA,MACjC;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
@@ -21,7 +21,7 @@ const REASON_OPTIONS = [
21
21
  { value: "outro", label: "Outro motivo" }
22
22
  ];
23
23
  function DeleteAccountModal() {
24
- const { activeModal, pagesCount, openConfigurations, openConfirmDelete, close } = useAccountModals();
24
+ const { activeModal, openConfigurations, openConfirmDelete, close } = useAccountModals();
25
25
  const open = activeModal === "deleteAccount";
26
26
  const [reason, setReason] = useState("");
27
27
  const [description, setDescription] = useState("");
@@ -44,7 +44,7 @@ function DeleteAccountModal() {
44
44
  return;
45
45
  }
46
46
  resetForm();
47
- openConfirmDelete(pagesCount);
47
+ openConfirmDelete();
48
48
  };
49
49
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsx(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", children: /* @__PURE__ */ jsxs("form", { onSubmit: handleDelete, className: "flex flex-col flex-1 lg:flex-none", children: [
50
50
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 p-4 lg:p-6 flex-1 lg:flex-none", children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/account/DeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback } from 'react';\nimport { IconLock, IconAlertTriangle } from '@tabler/icons-react';\nimport { toast } from 'sonner';\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Button } from '../ui/buttons/Button';\nimport { FormField } from '../ui/form/FormField';\nimport { SelectField } from '../ui/form/SelectField';\nimport { TextAreaField } from '../ui/form/TextAreaField';\nimport { Toast } from '../ui/feedback/Toast';\nimport usePasswordVisibility from '../../hooks/usePasswordVisibility';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\n\nconst REASON_OPTIONS = [\n { value: 'sem-funcao', label: 'A ferramenta não possui uma função que eu preciso' },\n { value: 'problemas', label: 'Encontrei problemas técnicos ou erros no sistema' },\n { value: 'suporte', label: 'Tive problemas com o suporte ou atendimento' },\n { value: 'demora', label: 'As atualizações demoram mais do que o esperado' },\n { value: 'temporario', label: 'O cancelamento é temporário' },\n { value: 'outro', label: 'Outro motivo' },\n];\n\nexport default function DeleteAccountModal() {\n const { activeModal, pagesCount, openConfigurations, openConfirmDelete, close } = 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 const handleClose = () => {\n resetForm();\n openConfigurations(AccountSectionType.SECURITY);\n };\n\n const handleDelete = (e: React.FormEvent) => {\n e.preventDefault();\n if (!isFormValid) {\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Preencha todos os campos obrigatórios\" toastId={t} />\n ));\n return;\n }\n resetForm();\n openConfirmDelete(pagesCount);\n };\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent className=\"flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-lg lg:h-auto lg:max-h-[90vh] lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%] overflow-y-auto\">\n <form onSubmit={handleDelete} className=\"flex flex-col flex-1 lg:flex-none\">\n <div className=\"flex flex-col gap-6 p-4 lg:p-6 flex-1 lg:flex-none\">\n <DialogHeader className=\"p-0\">\n <div className=\"flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5 mb-5\">\n <IconAlertTriangle size={20} className=\"text-red-500\" />\n </div>\n <DialogTitle>Excluir conta</DialogTitle>\n <DialogDescription className=\"paragraph-small-regular\">\n Esta ação é <span className=\"font-semibold text-gray-950\">irreversível</span>. Ao\n confirmar, sua conta e todos os seus dados serão excluídos.\n </DialogDescription>\n </DialogHeader>\n\n <SelectField\n label=\"Motivo do cancelamento\"\n required\n placeholder=\"Selecione\"\n options={REASON_OPTIONS}\n value={reason}\n onChange={(value) => setReason(value as string)}\n className=\"h-10!\"\n />\n\n <div>\n <TextAreaField\n label=\"Descreva o que levou a tomar essa decisão\"\n required\n placeholder=\"Explique sua decisão...\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={4}\n maxLength={400}\n />\n <span className=\"paragraph-xsmall-medium text-gray-600 text-left mt-1 block\">\n {description.length}/400 caracteres\n </span>\n </div>\n\n <FormField\n className=\"text-gray-600\"\n label=\"Senha\"\n type=\"password\"\n placeholder=\"Informe sua senha\"\n leftIcon={IconLock}\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n classnameContainer=\"h-10!\"\n showPassword={showPassword}\n onTogglePassword={togglePassword}\n />\n </div>\n\n <div className=\"flex flex-row items-center justify-start gap-2 p-4 lg:p-6 border-t border-gray-200 bg-white mt-auto lg:mt-0\">\n <Button\n variant=\"default\"\n className=\"h-10\"\n type=\"submit\"\n >\n Excluir conta\n </Button>\n <Button variant=\"secondary\" className=\"h-10\" type=\"button\" onClick={handleClose}>\n Fechar\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAkDQ,cAkBM,YAlBN;AAhDR,SAAS,UAAU,mBAAmB;AACtC,SAAS,UAAU,yBAAyB;AAC5C,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,mBAAmB,cAAc,mBAAmB;AACpF,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,OAAO,2BAA2B;AAClC,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAEnC,MAAM,iBAAiB;AAAA,EACrB,EAAE,OAAO,cAAc,OAAO,6DAAoD;AAAA,EAClF,EAAE,OAAO,aAAa,OAAO,sDAAmD;AAAA,EAChF,EAAE,OAAO,WAAW,OAAO,8CAA8C;AAAA,EACzE,EAAE,OAAO,UAAU,OAAO,uDAAiD;AAAA,EAC3E,EAAE,OAAO,cAAc,OAAO,oCAA8B;AAAA,EAC5D,EAAE,OAAO,SAAS,OAAO,eAAe;AAC1C;AAEe,SAAR,qBAAsC;AAC3C,QAAM,EAAE,aAAa,YAAY,oBAAoB,mBAAmB,MAAM,IAAI,iBAAiB;AACnG,QAAM,OAAO,gBAAgB;AAE7B,QAAM,CAA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AAAA;AAAA,MACZ;AAAA,MAEA,qBAAC,SACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,UAAQ;AAAA,YACR,aAAY;AAAA,YACZ,OAAO;AAAA,YACP,UAAU,CAAC,MAAM,eAAe,EAAE,OAAO,KAAK;AAAA,YAC9C,MAAM;AAAA,YACN,WAAW;AAAA;AAAA,QACb;AAAA,QACA,qBAAC,UAAK,WAAU,8DACb;AAAA,sBAAY;AAAA,UAAO;AAAA,WACtB;AAAA,SACF;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAM;AAAA,UACN,MAAK;AAAA,UACL,aAAY;AAAA,UACZ,UAAU;AAAA,UACV,OAAO;AAAA,UACP,UAAU,CAAC,MAAM,YAAY,EAAE,OAAO,KAAK;AAAA,UAC3C,oBAAmB;AAAA,UACnB;AAAA,UACA,kBAAkB;AAAA;AAAA,MACpB;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,+GACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,MAAK;AAAA,UACN;AAAA;AAAA,MAED;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,WAAU,QAAO,MAAK,UAAS,SAAS,aAAa,oBAEjF;AAAA,OACF;AAAA,KACF,GACF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/account/DeleteAccountModal.tsx"],"sourcesContent":["'use client';\n\nimport { useState, useCallback } from 'react';\nimport { IconLock, IconAlertTriangle } from '@tabler/icons-react';\nimport { toast } from 'sonner';\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '../ui/overlay/Dialog';\nimport { Button } from '../ui/buttons/Button';\nimport { FormField } from '../ui/form/FormField';\nimport { SelectField } from '../ui/form/SelectField';\nimport { TextAreaField } from '../ui/form/TextAreaField';\nimport { Toast } from '../ui/feedback/Toast';\nimport usePasswordVisibility from '../../hooks/usePasswordVisibility';\nimport { useAccountModals } from '../../store/useAccountModals';\nimport { AccountSectionType } from '../../enums/AccountSectionType';\n\nconst REASON_OPTIONS = [\n { value: 'sem-funcao', label: 'A ferramenta não possui uma função que eu preciso' },\n { value: 'problemas', label: 'Encontrei problemas técnicos ou erros no sistema' },\n { value: 'suporte', label: 'Tive problemas com o suporte ou atendimento' },\n { value: 'demora', label: 'As atualizações demoram mais do que o esperado' },\n { value: 'temporario', label: 'O cancelamento é temporário' },\n { value: 'outro', label: 'Outro motivo' },\n];\n\nexport default function DeleteAccountModal() {\n const { activeModal, openConfigurations, openConfirmDelete, close } = 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 const handleClose = () => {\n resetForm();\n openConfigurations(AccountSectionType.SECURITY);\n };\n\n const handleDelete = (e: React.FormEvent) => {\n e.preventDefault();\n if (!isFormValid) {\n toast.custom((t) => (\n <Toast variant=\"error\" message=\"Preencha todos os campos obrigatórios\" toastId={t} />\n ));\n return;\n }\n resetForm();\n openConfirmDelete();\n };\n\n return (\n <Dialog open={open} onOpenChange={handleClose}>\n <DialogContent className=\"flex flex-col p-0 gap-0 max-w-full sm:max-w-full border-0 rounded-t-2xl rounded-b-none h-[100dvh] top-0 bottom-0 left-0 right-0 translate-x-0 translate-y-0 lg:max-w-lg lg:h-auto lg:max-h-[90vh] lg:rounded-lg lg:border lg:top-[50%] lg:left-[50%] lg:right-auto lg:bottom-auto lg:translate-x-[-50%] lg:translate-y-[-50%] overflow-y-auto\">\n <form onSubmit={handleDelete} className=\"flex flex-col flex-1 lg:flex-none\">\n <div className=\"flex flex-col gap-6 p-4 lg:p-6 flex-1 lg:flex-none\">\n <DialogHeader className=\"p-0\">\n <div className=\"flex items-center justify-center w-fit bg-red-50 rounded-lg p-2.5 mb-5\">\n <IconAlertTriangle size={20} className=\"text-red-500\" />\n </div>\n <DialogTitle>Excluir conta</DialogTitle>\n <DialogDescription className=\"paragraph-small-regular\">\n Esta ação é <span className=\"font-semibold text-gray-950\">irreversível</span>. Ao\n confirmar, sua conta e todos os seus dados serão excluídos.\n </DialogDescription>\n </DialogHeader>\n\n <SelectField\n label=\"Motivo do cancelamento\"\n required\n placeholder=\"Selecione\"\n options={REASON_OPTIONS}\n value={reason}\n onChange={(value) => setReason(value as string)}\n className=\"h-10!\"\n />\n\n <div>\n <TextAreaField\n label=\"Descreva o que levou a tomar essa decisão\"\n required\n placeholder=\"Explique sua decisão...\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={4}\n maxLength={400}\n />\n <span className=\"paragraph-xsmall-medium text-gray-600 text-left mt-1 block\">\n {description.length}/400 caracteres\n </span>\n </div>\n\n <FormField\n className=\"text-gray-600\"\n label=\"Senha\"\n type=\"password\"\n placeholder=\"Informe sua senha\"\n leftIcon={IconLock}\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n classnameContainer=\"h-10!\"\n showPassword={showPassword}\n onTogglePassword={togglePassword}\n />\n </div>\n\n <div className=\"flex flex-row items-center justify-start gap-2 p-4 lg:p-6 border-t border-gray-200 bg-white mt-auto lg:mt-0\">\n <Button\n variant=\"default\"\n className=\"h-10\"\n type=\"submit\"\n >\n Excluir conta\n </Button>\n <Button variant=\"secondary\" className=\"h-10\" type=\"button\" onClick={handleClose}>\n Fechar\n </Button>\n </div>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAkDQ,cAkBM,YAlBN;AAhDR,SAAS,UAAU,mBAAmB;AACtC,SAAS,UAAU,yBAAyB;AAC5C,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,mBAAmB,cAAc,mBAAmB;AACpF,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAA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AA,MAED;AAAA,MACA,oBAAC,UAAO,SAAQ,aAAY,WAAU,QAAO,MAAK,UAAS,SAAS,aAAa,oBAEjF;AAAA,OACF;AAAA,KACF,GACF,GACF;AAEJ;","names":[]}
@@ -4,11 +4,11 @@ import { useEffect } from "react";
4
4
  import AccountModals from "../account/AccountModals";
5
5
  import { ModalManager } from "./ModalManager";
6
6
  import { useAccountModals } from "../../store/useAccountModals";
7
- function Modals({ registry, hasActiveSubscription, onGoToSubscription }) {
7
+ function Modals({ registry, onGoToSubscription }) {
8
8
  const { updateConfig } = useAccountModals();
9
9
  useEffect(() => {
10
- updateConfig({ hasActiveSubscription, onGoToSubscription });
11
- }, [hasActiveSubscription, onGoToSubscription, updateConfig]);
10
+ updateConfig({ onGoToSubscription });
11
+ }, [onGoToSubscription, updateConfig]);
12
12
  return /* @__PURE__ */ jsxs(Fragment, { children: [
13
13
  /* @__PURE__ */ jsx(AccountModals, {}),
14
14
  /* @__PURE__ */ jsx(ModalManager, { registry })
@@ -1 +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';\ninterface ModalsProps {\n registry: Record<string, ComponentType>;\n hasActiveSubscription?: boolean;\n onGoToSubscription?: () => void;\n}\n\nexport function Modals({ registry, hasActiveSubscription, onGoToSubscription }: ModalsProps) {\n const { updateConfig } = useAccountModals();\n\n useEffect(() => {\n updateConfig({ hasActiveSubscription, onGoToSubscription });\n }, [hasActiveSubscription, onGoToSubscription, updateConfig]);\n\n return (\n <>\n <AccountModals />\n <ModalManager registry={registry} />\n </>\n );\n}\n"],"mappings":";AAoBI,mBACE,KADF;AAlBJ,SAAwB,iBAAiB;AACzC,OAAO,mBAAmB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAO1B,SAAS,OAAO,EAAE,UAAU,uBAAuB,mBAAmB,GAAgB;AAC3F,QAAM,EAAE,aAAa,IAAI,iBAAiB;AAE1C,YAAU,MAAM;AACd,iBAAa,EAAE,uBAAuB,mBAAmB,CAAC;AAAA,EAC5D,GAAG,CAAC,uBAAuB,oBAAoB,YAAY,CAAC;AAE5D,SACE,iCACE;AAAA,wBAAC,iBAAc;AAAA,IACf,oBAAC,gBAAa,UAAoB;AAAA,KACpC;AAEJ;","names":[]}
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';\ninterface ModalsProps {\n registry: Record<string, ComponentType>;\n onGoToSubscription?: () => void;\n}\n\nexport function Modals({ registry, onGoToSubscription }: ModalsProps) {\n const { updateConfig } = useAccountModals();\n\n useEffect(() => {\n updateConfig({ onGoToSubscription });\n }, [onGoToSubscription, updateConfig]);\n\n return (\n <>\n <AccountModals />\n <ModalManager registry={registry} />\n </>\n );\n}\n"],"mappings":";AAmBI,mBACE,KADF;AAjBJ,SAAwB,iBAAiB;AACzC,OAAO,mBAAmB;AAC1B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAM1B,SAAS,OAAO,EAAE,UAAU,mBAAmB,GAAgB;AACpE,QAAM,EAAE,aAAa,IAAI,iBAAiB;AAE1C,YAAU,MAAM;AACd,iBAAa,EAAE,mBAAmB,CAAC;AAAA,EACrC,GAAG,CAAC,oBAAoB,YAAY,CAAC;AAErC,SACE,iCACE;AAAA,wBAAC,iBAAc;AAAA,IACf,oBAAC,gBAAa,UAAoB;AAAA,KACpC;AAEJ;","names":[]}
package/dist/index.mjs CHANGED
@@ -82,6 +82,11 @@ import {
82
82
  } from "./modules/cards/types";
83
83
  import { buildPlanExtras } from "./modules/subscriptions/utils/build-plan-extras";
84
84
  import { hasSubscriptionExpired } from "./modules/subscriptions/utils/has-subscription-expired";
85
+ import {
86
+ useCountPages,
87
+ COUNT_PAGES_QUERY_KEY
88
+ } from "./modules/pages/hooks/count-pages.hook";
89
+ import { PAGES_QUERY_KEY } from "./modules/pages/constants/query-keys.constants";
85
90
  import {
86
91
  getPriceFromCalculatedData,
87
92
  getOriginalPriceFromCalculatedData,
@@ -385,6 +390,7 @@ export {
385
390
  default2 as BuyCreditsModal,
386
391
  CARDS_QUERY_KEY,
387
392
  CHARGES_QUERY_KEY,
393
+ COUNT_PAGES_QUERY_KEY,
388
394
  CURRENCY_OPTIONS,
389
395
  Calendar,
390
396
  CalendarDayButton,
@@ -473,6 +479,7 @@ export {
473
479
  default5 as NotificationCard,
474
480
  NotificationPageContent,
475
481
  NotificationsPopover,
482
+ PAGES_QUERY_KEY,
476
483
  PLANS_QUERY_KEY,
477
484
  PROJECTS_BASE_KEY,
478
485
  PROJECTS_QUERY_KEY,
@@ -605,6 +612,7 @@ export {
605
612
  useCardById,
606
613
  useCards,
607
614
  default7 as useCopyToClipboard,
615
+ useCountPages,
608
616
  default12 as useCountdownTimer,
609
617
  useCreateCard,
610
618
  useCreateProject,
@@ -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\";\n// Style types now come from whitelabel schema directly\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 {\n useListProjectUsers,\n LIST_PROJECT_USERS_QUERY_KEY,\n LIST_PROJECT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-project-users.hook\";\nexport {\n useListAvailableUsers,\n LIST_AVAILABLE_USERS_QUERY_KEY,\n LIST_AVAILABLE_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-available-users.hook\";\nexport {\n useListAllAccountUsers,\n LIST_ALL_ACCOUNT_USERS_QUERY_KEY,\n LIST_ALL_ACCOUNT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-all-account-users.hook\";\nexport {\n useProjects,\n PROJECTS_BASE_KEY,\n PROJECTS_QUERY_KEY,\n} from \"./modules/projects/hooks/list-projects.hook\";\nexport {\n useInfiniteProjects,\n INFINITE_PROJECTS_QUERY_KEY,\n} from \"./modules/projects/hooks/list-infinite-projects.hook\";\nexport { useProject } from \"./modules/projects/hooks/find-project.hook\";\nexport { useCreateProject } from \"./modules/projects/hooks/create-project.hook\";\nexport { useUpdateProject } from \"./modules/projects/hooks/update-project.hook\";\nexport { useDeleteProject } from \"./modules/projects/hooks/delete-project.hook\";\nexport type {\n Project,\n ProjectsPage,\n CreateProjectRequest,\n UpdateProjectRequest,\n ProjectUser,\n AccountUser,\n AddRemoveProjectUsersParams,\n ListUsersParams,\n UsersPage,\n} from \"./modules/projects/types\";\nexport { ProjectSchema } from \"./modules/projects/types\";\nexport type { ListProjectsActionParams } from \"./modules/projects/actions/list-projects.action\";\nexport {\n useUserQuery,\n useUserValidateSession,\n useInvalidateUser,\n useSetUserData,\n useTwoFactorVerify,\n USER_QUERY_KEY,\n} from \"./modules/auth/hooks/useUserQuery\";\nexport { useManagementPermissions } from \"./modules/auth/hooks/useManagementPermissions\";\nexport type { ManagementPermission } from \"./modules/auth/types/management-permission.type\";\nexport { useSubscriptions } from \"./modules/subscriptions/hooks/list-subscriptions.hook\";\nexport {\n SUBSCRIPTIONS_QUERY_KEY,\n CHARGES_QUERY_KEY,\n} from \"./modules/subscriptions/constants/query-keys.constants\";\nexport { useActiveSubscription } from \"./modules/subscriptions/hooks/find-active-subscription.hook\";\nexport { useCancelledSubscriptionGuard } from \"./modules/subscriptions/hooks/use-cancelled-subscription-guard\";\nexport { usePlanById } from \"./modules/plans/hooks/use-plan-by-id.hook\";\nexport { useHasPlanAddon } from \"./modules/plans/hooks/use-has-plan-addon.hook\";\nexport { useCalculateSubscription } from \"./modules/subscriptions/hooks/calculate-subscription.hook\";\nexport { useUpdateSubscriptionPlan } from \"./modules/subscriptions/hooks/update-subscription-plan.hook\";\nexport { useCards, CARDS_QUERY_KEY } from \"./modules/cards/hooks/cards.hook\";\nexport { useCardById } from \"./modules/cards/hooks/card-by-id.hook\";\nexport { useCreateCard } from \"./modules/cards/hooks/create-card.hook\";\nexport { useSetDefaultCard } from \"./modules/cards/hooks/set-default-card.hook\";\nexport { useDeleteCard } from \"./modules/cards/hooks/delete-card.hook\";\nexport { useIaCredits } from \"./modules/ia-credits/hooks/ia-credits.hook\";\nexport type {\n IaCreditsSummary,\n IaCreditOperation,\n} from \"./modules/ia-credits/types\";\nexport type {\n Subscription,\n SubscriptionItem,\n FindSubscriptionsParams,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n SubscriptionSchema,\n SubscriptionItemSchema,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n ADDON_IDS,\n AI_CREDIT_OPTIONS,\n AI_CREDIT_VALUES,\n} from \"./modules/subscriptions/constants/addons.constants\";\nexport type {\n AddonKindEnum,\n AiCreditOption,\n} from \"./modules/subscriptions/constants/addons.constants\";\nexport type {\n Plan,\n PlanItem,\n UiPlan,\n PlanFeature,\n PlanMainFeatures,\n PlanPricingByPeriod,\n PlanTooltips,\n} from \"./modules/plans/types/plan.type\";\nexport { PlanSchema, PlanItemSchema } from \"./modules/plans/types/plan.type\";\nexport { mapApiPlanToUiPlan } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport type { PlanBillingPeriod } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport {\n usePlans,\n PLANS_QUERY_KEY,\n} from \"./modules/plans/hooks/list-plans.hook\";\nexport type { BillingPeriod } from \"./modules/subscriptions/types/billing-period.type\";\nexport type {\n CalculateSubscriptionRequest,\n CalculateSubscriptionResponse,\n UpdateSubscriptionPlanRequest,\n} from \"./modules/subscriptions/types/calculate-subscription.type\";\nexport type {\n Card as PaymentCard,\n CreateCardRequest,\n FindCardsParams,\n} from \"./modules/cards/types\";\nexport {\n CardSchema as PaymentCardSchema,\n CreateCardRequestSchema,\n FindCardsParamsSchema,\n} from \"./modules/cards/types\";\nexport { buildPlanExtras } from \"./modules/subscriptions/utils/build-plan-extras\";\nexport { hasSubscriptionExpired } from \"./modules/subscriptions/utils/has-subscription-expired\";\nexport {\n getPriceFromCalculatedData,\n getOriginalPriceFromCalculatedData,\n periodicityToBillingPeriod,\n} from \"./modules/subscriptions/utils/periodicity\";\nexport { useBuyCreditsModal } from \"./store/useBuyCreditsModal\";\nexport { usePaidPlanRequiredModal } from \"./store/usePaidPlanRequiredModal\";\nexport { default as BuyCreditsModal } from \"./components/modals/BuyCreditsModal\";\nexport { default as PaidPlanRequiredModal } from \"./components/modals/PaidPlanRequiredModal\";\nexport { default as AddCardModal } from \"./components/modals/cards/AddCardModal\";\nexport {\n CardFormFields,\n cardFormSchema,\n} from \"./components/modals/cards/CardFormFields\";\nexport type { CardFormData } from \"./components/modals/cards/CardFormFields\";\nexport { Skeleton } from \"./components/ui/feedback/Skeleton\";\nexport { PaymentInfoCard } from \"./components/ui/data-display/PaymentInfoCard\";\nexport { CardBrandIcon } from \"./components/ui/data-display/CardBrandIcons\";\nexport { CardItem } from \"./components/ui/data-display/CardItem\";\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 {\n MiddlewareFunction,\n MiddlewareConfig,\n MiddlewareResult,\n} from \"./middlewares/types\";\n\n// Utils\nexport { cn } from \"./infra/utils/clsx\";\nexport { formatShortDate, formatDateTime } from \"./infra/utils/date\";\nexport { buildQueryParams } from \"./infra/utils/params\";\nexport { parseSchema, parseResult } from \"./infra/utils/parser\";\nexport { withAction } from \"./utils/withAction\";\n\n// Layout\nexport {\n MainLayout,\n MainLayoutContent,\n MainLayoutSpacer,\n MainLayoutMain,\n} 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 { default as NotificationCard } from \"./components/widgets/notifications/NotificationCard\";\nexport type { NotificationCardProps } from \"./components/widgets/notifications/NotificationCard\";\nexport { NotificationsPopover } from \"./components/layouts/NotificationsPopover\";\nexport type { NotificationsPopoverProps } from \"./components/layouts/NotificationsPopover\";\nexport { NotificationPageContent } from \"./components/pages/notifications/Notifications\";\nexport { NotFoundPage } from \"./components/pages/NotFoundPage\";\nexport { UsersSelectorPopover } from \"./components/layouts/UsersSelectorPopover\";\nexport type { UsersSelectorPopoverProps } from \"./components/layouts/UsersSelectorPopover\";\nexport { ProfilePopover } from \"./components/layouts/ProfilePopover\";\nexport type {\n ProfilePopoverProps,\n ProfileMenuItem,\n} from \"./components/layouts/ProfilePopover\";\nexport { default as WhitelabelCodes } from \"./components/layouts/WhitelabelCodes\";\nexport { NavBarItem } from \"./components/layouts/NavBarItem\";\nexport type { NavBarItemProps } from \"./components/layouts/NavBarItem\";\n\n// Navigation\nexport { AppNavigation } from \"./components/navigation/AppNavigation\";\nexport { CancelledSubscriptionBanner } from \"./components/navigation/CancelledSubscriptionBanner\";\nexport type { NavItemConfig } from \"./components/navigation/subcomponents/NavItems\";\nexport { useMobileNavbarSheet } from \"./store/useMobileNavbarSheet\";\n\n// Auth Query Key Utilities\nexport {\n useAuthQueryKey,\n useWlQueryKey,\n useWlId,\n} from \"./hooks/useAuthQueryKey\";\n\n// Hooks\nexport { default as useCopyToClipboard } from \"./hooks/copy-to-clipboard.hook\";\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 {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from \"./components/ui/data-display/Accordion\";\nexport { Badge, badgeVariants } from \"./components/ui/data-display/Badge\";\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n} from \"./components/ui/data-display/Card\";\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"./components/ui/data-display/Pagination\";\nexport { ScrollArea, ScrollBar } from \"./components/ui/data-display/ScrollArea\";\nexport { Separator } from \"./components/ui/data-display/Separator\";\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from \"./components/ui/data-display/Table\";\nexport {\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n} 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 {\n Toast,\n toastVariants,\n toastIconContainerVariants,\n} 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 {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n InputOTPSeparator,\n} from \"./components/ui/form/InputOtp\";\nexport { RadioGroup, RadioGroupItem } from \"./components/ui/form/RadioGroup\";\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from \"./components/ui/form/Select\";\nexport { Switch } from \"./components/ui/form/Switch\";\nexport { Textarea } from \"./components/ui/form/Textarea\";\n\n// UI - Overlay\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n} from \"./components/ui/overlay/Command\";\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n} from \"./components/ui/overlay/Dialog\";\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n} from \"./components/ui/overlay/Popover\";\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from \"./components/ui/overlay/Sheet\";\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n} from \"./components/ui/overlay/Tooltip\";\n\n// Embeds\nexport { FrillEmbed } from \"./components/embeds/FrillEmbed\";\nexport {\n CrispEmbed,\n openCrispHelpdesk,\n hideCrisp,\n showCrisp,\n updateCrispUser,\n} from \"./components/embeds/CrispEmbed\";\nexport { EmbedWidgets } from \"./components/embeds/EmbedWidgets\";\nexport { ClarityEmbed } from \"./components/embeds/ClarityEmbed\";\n\n// Store\nexport { useMdSidebarStore } from \"./store/useMdSidebarStore\";\nexport { useDesktopSidebarStore } from \"./store/useDesktopSidebarStore\";\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\";\nexport { useDebounce } from \"./hooks/useDebounce\";\nexport { useDebouncedEffect } from \"./hooks/useDebouncedEffect\";\nexport { useDebounceState } from \"./hooks/useDebounceState\";\n\n// Utils\nexport {\n formatPhone,\n formatTimer,\n formatFullName,\n formatCPF,\n formatCNPJ,\n formatCardNumber,\n} from \"./utils/format/masks\";\nexport { formatCurrencyNumber } from \"./utils/format/currency\";\nexport { BR_STATE_OPTIONS } from \"./utils/constants/br-states\";\nexport type { TimezoneOption } from \"./modules/accounts/services/timezone.service\";\nexport {\n buildLocaleOptions,\n LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS,\n} 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 useCurrentAccount,\n ACCOUNT_QUERY_KEY,\n} from \"./modules/accounts/hooks/current-account.hook\";\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n ACCOUNT_USERS_QUERY_KEY,\n} from \"./modules/accounts/hooks/useAccountManagement\";\nexport { useViaCep } from \"./modules/accounts/hooks/useViaCep\";\nexport { useAccountToken } from \"./modules/accounts/hooks/use-account-token.hook\";\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 TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from \"./components/account/constants\";\n\n// Image Upload\nexport {\n ImageUpload,\n ImageCropModal,\n ImageTooSmallModal,\n} from \"./components/widgets/ImageUpload\";\nexport {\n useImageUpload,\n type ImageTooSmallError,\n} from \"./modules/images/hooks/use-image-upload.hook\";\nexport {\n ACCEPTED_IMAGE_FORMATS,\n ACCEPTED_IMAGE_FORMATS_STRING,\n MAX_FILE_SIZE_MB,\n} from \"./modules/images/constants/image.constants\";\nexport type {\n ImageConfig,\n CropArea,\n ProcessedImage,\n CompressImageOptions,\n} from \"./modules/images/types/image.type\";\nexport { compressImage } from \"./modules/images/utils/compress-image\";\nexport { cropImageToCanvas } from \"./modules/images/utils/crop-image\";\nexport { base64ToFile, fileToBase64 } from \"./modules/images/utils/base64\";\nexport {\n validateImage,\n validateImageFormat,\n validateImageSize,\n getImageDimensions,\n} from \"./modules/images/utils/validate-image\";\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAYjC,SAAS,qBAAqB;AAE9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AAEzC,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,qCAAqC;AAC9C,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,gCAAgC;AACzC,SAAS,iCAAiC;AAC1C,SAAS,UAAU,uBAAuB;AAC1C,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAU7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,E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;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,oBAAAC;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOP,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,cAAc,oBAAoB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;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\";\n// Style types now come from whitelabel schema directly\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 {\n useListProjectUsers,\n LIST_PROJECT_USERS_QUERY_KEY,\n LIST_PROJECT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-project-users.hook\";\nexport {\n useListAvailableUsers,\n LIST_AVAILABLE_USERS_QUERY_KEY,\n LIST_AVAILABLE_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-available-users.hook\";\nexport {\n useListAllAccountUsers,\n LIST_ALL_ACCOUNT_USERS_QUERY_KEY,\n LIST_ALL_ACCOUNT_USERS_BASE_KEY,\n} from \"./modules/projects/hooks/list-all-account-users.hook\";\nexport {\n useProjects,\n PROJECTS_BASE_KEY,\n PROJECTS_QUERY_KEY,\n} from \"./modules/projects/hooks/list-projects.hook\";\nexport {\n useInfiniteProjects,\n INFINITE_PROJECTS_QUERY_KEY,\n} from \"./modules/projects/hooks/list-infinite-projects.hook\";\nexport { useProject } from \"./modules/projects/hooks/find-project.hook\";\nexport { useCreateProject } from \"./modules/projects/hooks/create-project.hook\";\nexport { useUpdateProject } from \"./modules/projects/hooks/update-project.hook\";\nexport { useDeleteProject } from \"./modules/projects/hooks/delete-project.hook\";\nexport type {\n Project,\n ProjectsPage,\n CreateProjectRequest,\n UpdateProjectRequest,\n ProjectUser,\n AccountUser,\n AddRemoveProjectUsersParams,\n ListUsersParams,\n UsersPage,\n} from \"./modules/projects/types\";\nexport { ProjectSchema } from \"./modules/projects/types\";\nexport type { ListProjectsActionParams } from \"./modules/projects/actions/list-projects.action\";\nexport {\n useUserQuery,\n useUserValidateSession,\n useInvalidateUser,\n useSetUserData,\n useTwoFactorVerify,\n USER_QUERY_KEY,\n} from \"./modules/auth/hooks/useUserQuery\";\nexport { useManagementPermissions } from \"./modules/auth/hooks/useManagementPermissions\";\nexport type { ManagementPermission } from \"./modules/auth/types/management-permission.type\";\nexport { useSubscriptions } from \"./modules/subscriptions/hooks/list-subscriptions.hook\";\nexport {\n SUBSCRIPTIONS_QUERY_KEY,\n CHARGES_QUERY_KEY,\n} from \"./modules/subscriptions/constants/query-keys.constants\";\nexport { useActiveSubscription } from \"./modules/subscriptions/hooks/find-active-subscription.hook\";\nexport { useCancelledSubscriptionGuard } from \"./modules/subscriptions/hooks/use-cancelled-subscription-guard\";\nexport { usePlanById } from \"./modules/plans/hooks/use-plan-by-id.hook\";\nexport { useHasPlanAddon } from \"./modules/plans/hooks/use-has-plan-addon.hook\";\nexport { useCalculateSubscription } from \"./modules/subscriptions/hooks/calculate-subscription.hook\";\nexport { useUpdateSubscriptionPlan } from \"./modules/subscriptions/hooks/update-subscription-plan.hook\";\nexport { useCards, CARDS_QUERY_KEY } from \"./modules/cards/hooks/cards.hook\";\nexport { useCardById } from \"./modules/cards/hooks/card-by-id.hook\";\nexport { useCreateCard } from \"./modules/cards/hooks/create-card.hook\";\nexport { useSetDefaultCard } from \"./modules/cards/hooks/set-default-card.hook\";\nexport { useDeleteCard } from \"./modules/cards/hooks/delete-card.hook\";\nexport { useIaCredits } from \"./modules/ia-credits/hooks/ia-credits.hook\";\nexport type {\n IaCreditsSummary,\n IaCreditOperation,\n} from \"./modules/ia-credits/types\";\nexport type {\n Subscription,\n SubscriptionItem,\n FindSubscriptionsParams,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n SubscriptionSchema,\n SubscriptionItemSchema,\n} from \"./modules/subscriptions/types/subscription.type\";\nexport {\n ADDON_IDS,\n AI_CREDIT_OPTIONS,\n AI_CREDIT_VALUES,\n} from \"./modules/subscriptions/constants/addons.constants\";\nexport type {\n AddonKindEnum,\n AiCreditOption,\n} from \"./modules/subscriptions/constants/addons.constants\";\nexport type {\n Plan,\n PlanItem,\n UiPlan,\n PlanFeature,\n PlanMainFeatures,\n PlanPricingByPeriod,\n PlanTooltips,\n} from \"./modules/plans/types/plan.type\";\nexport { PlanSchema, PlanItemSchema } from \"./modules/plans/types/plan.type\";\nexport { mapApiPlanToUiPlan } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport type { PlanBillingPeriod } from \"./modules/plans/utils/map-api-plan-to-ui\";\nexport {\n usePlans,\n PLANS_QUERY_KEY,\n} from \"./modules/plans/hooks/list-plans.hook\";\nexport type { BillingPeriod } from \"./modules/subscriptions/types/billing-period.type\";\nexport type {\n CalculateSubscriptionRequest,\n CalculateSubscriptionResponse,\n UpdateSubscriptionPlanRequest,\n} from \"./modules/subscriptions/types/calculate-subscription.type\";\nexport type {\n Card as PaymentCard,\n CreateCardRequest,\n FindCardsParams,\n} from \"./modules/cards/types\";\nexport {\n CardSchema as PaymentCardSchema,\n CreateCardRequestSchema,\n FindCardsParamsSchema,\n} from \"./modules/cards/types\";\nexport { buildPlanExtras } from \"./modules/subscriptions/utils/build-plan-extras\";\nexport { hasSubscriptionExpired } from \"./modules/subscriptions/utils/has-subscription-expired\";\nexport {\n useCountPages,\n COUNT_PAGES_QUERY_KEY,\n} from \"./modules/pages/hooks/count-pages.hook\";\nexport { PAGES_QUERY_KEY } from \"./modules/pages/constants/query-keys.constants\";\nexport {\n getPriceFromCalculatedData,\n getOriginalPriceFromCalculatedData,\n periodicityToBillingPeriod,\n} from \"./modules/subscriptions/utils/periodicity\";\nexport { useBuyCreditsModal } from \"./store/useBuyCreditsModal\";\nexport { usePaidPlanRequiredModal } from \"./store/usePaidPlanRequiredModal\";\nexport { default as BuyCreditsModal } from \"./components/modals/BuyCreditsModal\";\nexport { default as PaidPlanRequiredModal } from \"./components/modals/PaidPlanRequiredModal\";\nexport { default as AddCardModal } from \"./components/modals/cards/AddCardModal\";\nexport {\n CardFormFields,\n cardFormSchema,\n} from \"./components/modals/cards/CardFormFields\";\nexport type { CardFormData } from \"./components/modals/cards/CardFormFields\";\nexport { Skeleton } from \"./components/ui/feedback/Skeleton\";\nexport { PaymentInfoCard } from \"./components/ui/data-display/PaymentInfoCard\";\nexport { CardBrandIcon } from \"./components/ui/data-display/CardBrandIcons\";\nexport { CardItem } from \"./components/ui/data-display/CardItem\";\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 {\n MiddlewareFunction,\n MiddlewareConfig,\n MiddlewareResult,\n} from \"./middlewares/types\";\n\n// Utils\nexport { cn } from \"./infra/utils/clsx\";\nexport { formatShortDate, formatDateTime } from \"./infra/utils/date\";\nexport { buildQueryParams } from \"./infra/utils/params\";\nexport { parseSchema, parseResult } from \"./infra/utils/parser\";\nexport { withAction } from \"./utils/withAction\";\n\n// Layout\nexport {\n MainLayout,\n MainLayoutContent,\n MainLayoutSpacer,\n MainLayoutMain,\n} 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 { default as NotificationCard } from \"./components/widgets/notifications/NotificationCard\";\nexport type { NotificationCardProps } from \"./components/widgets/notifications/NotificationCard\";\nexport { NotificationsPopover } from \"./components/layouts/NotificationsPopover\";\nexport type { NotificationsPopoverProps } from \"./components/layouts/NotificationsPopover\";\nexport { NotificationPageContent } from \"./components/pages/notifications/Notifications\";\nexport { NotFoundPage } from \"./components/pages/NotFoundPage\";\nexport { UsersSelectorPopover } from \"./components/layouts/UsersSelectorPopover\";\nexport type { UsersSelectorPopoverProps } from \"./components/layouts/UsersSelectorPopover\";\nexport { ProfilePopover } from \"./components/layouts/ProfilePopover\";\nexport type {\n ProfilePopoverProps,\n ProfileMenuItem,\n} from \"./components/layouts/ProfilePopover\";\nexport { default as WhitelabelCodes } from \"./components/layouts/WhitelabelCodes\";\nexport { NavBarItem } from \"./components/layouts/NavBarItem\";\nexport type { NavBarItemProps } from \"./components/layouts/NavBarItem\";\n\n// Navigation\nexport { AppNavigation } from \"./components/navigation/AppNavigation\";\nexport { CancelledSubscriptionBanner } from \"./components/navigation/CancelledSubscriptionBanner\";\nexport type { NavItemConfig } from \"./components/navigation/subcomponents/NavItems\";\nexport { useMobileNavbarSheet } from \"./store/useMobileNavbarSheet\";\n\n// Auth Query Key Utilities\nexport {\n useAuthQueryKey,\n useWlQueryKey,\n useWlId,\n} from \"./hooks/useAuthQueryKey\";\n\n// Hooks\nexport { default as useCopyToClipboard } from \"./hooks/copy-to-clipboard.hook\";\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 {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from \"./components/ui/data-display/Accordion\";\nexport { Badge, badgeVariants } from \"./components/ui/data-display/Badge\";\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n} from \"./components/ui/data-display/Card\";\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"./components/ui/data-display/Pagination\";\nexport { ScrollArea, ScrollBar } from \"./components/ui/data-display/ScrollArea\";\nexport { Separator } from \"./components/ui/data-display/Separator\";\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from \"./components/ui/data-display/Table\";\nexport {\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n} 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 {\n Toast,\n toastVariants,\n toastIconContainerVariants,\n} 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 {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n InputOTPSeparator,\n} from \"./components/ui/form/InputOtp\";\nexport { RadioGroup, RadioGroupItem } from \"./components/ui/form/RadioGroup\";\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from \"./components/ui/form/Select\";\nexport { Switch } from \"./components/ui/form/Switch\";\nexport { Textarea } from \"./components/ui/form/Textarea\";\n\n// UI - Overlay\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n} from \"./components/ui/overlay/Command\";\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n} from \"./components/ui/overlay/Dialog\";\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n} from \"./components/ui/overlay/Popover\";\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from \"./components/ui/overlay/Sheet\";\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n} from \"./components/ui/overlay/Tooltip\";\n\n// Embeds\nexport { FrillEmbed } from \"./components/embeds/FrillEmbed\";\nexport {\n CrispEmbed,\n openCrispHelpdesk,\n hideCrisp,\n showCrisp,\n updateCrispUser,\n} from \"./components/embeds/CrispEmbed\";\nexport { EmbedWidgets } from \"./components/embeds/EmbedWidgets\";\nexport { ClarityEmbed } from \"./components/embeds/ClarityEmbed\";\n\n// Store\nexport { useMdSidebarStore } from \"./store/useMdSidebarStore\";\nexport { useDesktopSidebarStore } from \"./store/useDesktopSidebarStore\";\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\";\nexport { useDebounce } from \"./hooks/useDebounce\";\nexport { useDebouncedEffect } from \"./hooks/useDebouncedEffect\";\nexport { useDebounceState } from \"./hooks/useDebounceState\";\n\n// Utils\nexport {\n formatPhone,\n formatTimer,\n formatFullName,\n formatCPF,\n formatCNPJ,\n formatCardNumber,\n} from \"./utils/format/masks\";\nexport { formatCurrencyNumber } from \"./utils/format/currency\";\nexport { BR_STATE_OPTIONS } from \"./utils/constants/br-states\";\nexport type { TimezoneOption } from \"./modules/accounts/services/timezone.service\";\nexport {\n buildLocaleOptions,\n LANGUAGE_OPTIONS as LOCALE_LANGUAGE_OPTIONS,\n} 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 useCurrentAccount,\n ACCOUNT_QUERY_KEY,\n} from \"./modules/accounts/hooks/current-account.hook\";\nexport {\n useUpdateAccount,\n useUpdateAccountUser,\n useUpdateAccountUserById,\n useDeleteAccountUser,\n useDeleteAccount,\n ACCOUNT_USERS_QUERY_KEY,\n} from \"./modules/accounts/hooks/useAccountManagement\";\nexport { useViaCep } from \"./modules/accounts/hooks/useViaCep\";\nexport { useAccountToken } from \"./modules/accounts/hooks/use-account-token.hook\";\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 TIME_FORMAT_OPTIONS,\n NOTIFICATION_TYPES,\n LANGUAGE_OPTIONS,\n} from \"./components/account/constants\";\n\n// Image Upload\nexport {\n ImageUpload,\n ImageCropModal,\n ImageTooSmallModal,\n} from \"./components/widgets/ImageUpload\";\nexport {\n useImageUpload,\n type ImageTooSmallError,\n} from \"./modules/images/hooks/use-image-upload.hook\";\nexport {\n ACCEPTED_IMAGE_FORMATS,\n ACCEPTED_IMAGE_FORMATS_STRING,\n MAX_FILE_SIZE_MB,\n} from \"./modules/images/constants/image.constants\";\nexport type {\n ImageConfig,\n CropArea,\n ProcessedImage,\n CompressImageOptions,\n} from \"./modules/images/types/image.type\";\nexport { compressImage } from \"./modules/images/utils/compress-image\";\nexport { cropImageToCanvas } from \"./modules/images/utils/crop-image\";\nexport { base64ToFile, fileToBase64 } from \"./modules/images/utils/base64\";\nexport {\n validateImage,\n validateImageFormat,\n validateImageSize,\n getImageDimensions,\n} from \"./modules/images/utils/validate-image\";\n"],"mappings":"AACA,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AAGd,cAAc;AACd,cAAc;AACd,cAAc;AAGd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAYjC,SAAS,qBAAqB;AAE9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AAEzC,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,qCAAqC;AAC9C,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,gCAAgC;AACzC,SAAS,iCAAiC;AAC1C,SAAS,UAAU,uBAAuB;AAC1C,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAU7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA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,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,oBAAAC;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOP,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,cAAc,oBAAoB;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["default","LANGUAGE_OPTIONS"]}
@@ -0,0 +1,12 @@
1
+ "use server";
2
+ import { safeServerAction } from "../../../utils/safeServerAction";
3
+ import { pagesService } from "../services/pages.service";
4
+ async function countPagesAction() {
5
+ return safeServerAction(async () => ({
6
+ total: await pagesService.countPages()
7
+ }));
8
+ }
9
+ export {
10
+ countPagesAction
11
+ };
12
+ //# sourceMappingURL=count-pages.action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/pages/actions/count-pages.action.ts"],"sourcesContent":["'use server';\n\nimport { safeServerAction } from '../../../utils/safeServerAction';\nimport { pagesService } from '../services/pages.service';\n\nexport async function countPagesAction() {\n return safeServerAction(async () => ({\n total: await pagesService.countPages(),\n }));\n}\n"],"mappings":";AAEA,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAE7B,eAAsB,mBAAmB;AACvC,SAAO,iBAAiB,aAAa;AAAA,IACnC,OAAO,MAAM,aAAa,WAAW;AAAA,EACvC,EAAE;AACJ;","names":[]}
@@ -0,0 +1,5 @@
1
+ const PAGES_QUERY_KEY = ["pages"];
2
+ export {
3
+ PAGES_QUERY_KEY
4
+ };
5
+ //# sourceMappingURL=query-keys.constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/pages/constants/query-keys.constants.ts"],"sourcesContent":["export const PAGES_QUERY_KEY = ['pages'] as const;\n"],"mappings":"AAAO,MAAM,kBAAkB,CAAC,OAAO;","names":[]}
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { countPagesAction } from "../actions/count-pages.action";
4
+ import { PAGES_QUERY_KEY } from "../constants/query-keys.constants";
5
+ import { withAction } from "../../../utils/withAction";
6
+ import { useAuthQueryKey } from "../../../hooks/useAuthQueryKey";
7
+ const COUNT_PAGES_QUERY_KEY = [...PAGES_QUERY_KEY, "count"];
8
+ function useCountPages() {
9
+ const queryKey = useAuthQueryKey([...COUNT_PAGES_QUERY_KEY]);
10
+ return useQuery({
11
+ queryKey,
12
+ queryFn: async () => {
13
+ const result = await withAction(countPagesAction)();
14
+ return result.total;
15
+ },
16
+ staleTime: 3e4
17
+ });
18
+ }
19
+ export {
20
+ COUNT_PAGES_QUERY_KEY,
21
+ useCountPages
22
+ };
23
+ //# sourceMappingURL=count-pages.hook.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/pages/hooks/count-pages.hook.ts"],"sourcesContent":["'use client';\n\nimport { useQuery } from '@tanstack/react-query';\nimport { countPagesAction } from '../actions/count-pages.action';\nimport { PAGES_QUERY_KEY } from '../constants/query-keys.constants';\nimport { withAction } from '../../../utils/withAction';\nimport { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';\n\nexport const COUNT_PAGES_QUERY_KEY = [...PAGES_QUERY_KEY, 'count'] as const;\n\nexport function useCountPages() {\n const queryKey = useAuthQueryKey([...COUNT_PAGES_QUERY_KEY]);\n\n return useQuery({\n queryKey,\n queryFn: async () => {\n const result = await withAction(countPagesAction)();\n return result.total;\n },\n staleTime: 30_000,\n });\n}\n"],"mappings":";AAEA,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAEzB,MAAM,wBAAwB,CAAC,GAAG,iBAAiB,OAAO;AAE1D,SAAS,gBAAgB;AAC9B,QAAM,WAAW,gBAAgB,CAAC,GAAG,qBAAqB,CAAC;AAE3D,SAAO,SAAS;AAAA,IACd;AAAA,IACA,SAAS,YAAY;AACnB,YAAM,SAAS,MAAM,WAAW,gBAAgB,EAAE;AAClD,aAAO,OAAO;AAAA,IAChB;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -0,0 +1,24 @@
1
+ import "server-only";
2
+ import { api } from "../../../infra/api/client";
3
+ import { ApiError } from "../../../infra/api/types";
4
+ import { getUserContext } from "../../auth/utils/get-user-context";
5
+ class PagesService {
6
+ async countPages() {
7
+ const { id_account } = await getUserContext();
8
+ const url = `/account/${id_account}/pages?limit=1`;
9
+ const response = await api.pages.get(url);
10
+ if (response.status === 0) {
11
+ throw new ApiError(
12
+ response.message || "Erro ao contar p\xE1ginas",
13
+ "COUNT_PAGES_FAILED",
14
+ 400
15
+ );
16
+ }
17
+ return response.total;
18
+ }
19
+ }
20
+ const pagesService = new PagesService();
21
+ export {
22
+ pagesService
23
+ };
24
+ //# sourceMappingURL=pages.service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/pages/services/pages.service.ts"],"sourcesContent":["import 'server-only';\n\nimport { api } from '../../../infra/api/client';\nimport { ApiError, ApiPaginatedActionResult } from '../../../infra/api/types';\nimport { getUserContext } from '../../auth/utils/get-user-context';\n\nclass PagesService {\n async countPages(): Promise<number> {\n const { id_account } = await getUserContext();\n\n const url = `/account/${id_account}/pages?limit=1`;\n\n const response = await api.pages.get<ApiPaginatedActionResult<unknown>>(url);\n\n if (response.status === 0) {\n throw new ApiError(\n response.message || 'Erro ao contar páginas',\n 'COUNT_PAGES_FAILED',\n 400,\n );\n }\n\n return response.total;\n }\n}\n\nexport const pagesService = new PagesService();\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,WAAW;AACpB,SAAS,gBAA0C;AACnD,SAAS,sBAAsB;AAE/B,MAAM,aAAa;AAAA,EACjB,MAAM,aAA8B;AAClC,UAAM,EAAE,WAAW,IAAI,MAAM,eAAe;AAE5C,UAAM,MAAM,YAAY,UAAU;AAElC,UAAM,WAAW,MAAM,IAAI,MAAM,IAAuC,GAAG;AAE3E,QAAI,SAAS,WAAW,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,WAAW;AAAA,QACpB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,SAAS;AAAA,EAClB;AACF;AAEO,MAAM,eAAe,IAAI,aAAa;","names":[]}
package/dist/server.mjs CHANGED
@@ -26,6 +26,7 @@ import { createCardAction } from "./modules/cards/actions/create-card.action";
26
26
  import { resolvePlanExtrasPrices } from "./modules/subscriptions/utils/resolve-plan-extras-prices";
27
27
  import { hasSubscriptionExpired } from "./modules/subscriptions/utils/has-subscription-expired";
28
28
  import { listIaCreditsAction } from "./modules/ia-credits/actions/list-ia-credits.action";
29
+ import { countPagesAction } from "./modules/pages/actions/count-pages.action";
29
30
  import { projectsService } from "./modules/projects/services/projects.service";
30
31
  import { listProjectsAction } from "./modules/projects/actions/list-projects.action";
31
32
  import { findProjectAction } from "./modules/projects/actions/find-project.action";
@@ -81,6 +82,7 @@ export {
81
82
  confirmEmailChangeAction,
82
83
  confirmPhoneChangeAction,
83
84
  confirmTwoFactorAction,
85
+ countPagesAction,
84
86
  createAccountUserAction,
85
87
  createCardAction,
86
88
  createProjectAction,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\r\n\r\n// API Client\r\nexport { ApiClient, api, apiClient } from './infra/api/client';\r\n\r\n// Services\r\nexport { authService } from './modules/auth/services/auth.service';\r\nexport { whitelabelService } from './modules/whitelabel/services/whitelabel.service';\r\nexport { revalidateWhitelabelAction } from './modules/whitelabel/actions/revalidate-whitelabel.action';\r\nexport { assertManagementPermission } from './modules/auth/utils/assert-management-permission';\r\nexport { assertManagementSubscription } from './modules/auth/utils/assert-management-subscription';\r\nexport { assertSubscriptionAddon } from './modules/auth/utils/assert-subscription-addon';\r\nexport { assertPaidSubscription } from './modules/auth/utils/assert-paid-subscription';\r\nexport { subscriptionsService } from './modules/subscriptions/services/subscriptions.service';\r\nexport { plansService } from './modules/plans/services/plans.service';\r\nexport { cardsService } from './modules/cards/services/cards.service';\r\nexport { iaCreditsService } from './modules/ia-credits/services/ia-credits.service';\r\n\r\n// Actions\r\nexport { findWhitelabel } from './modules/whitelabel/actions/find-whitelabel.action';\r\nexport { validateSessionAction } from './modules/auth/actions/validate-session.action';\r\nexport { findUserById } from './modules/users/action/find-user-by-id.action';\r\nexport { findCurrentAccount } from './modules/accounts/actions/find-current-account.action';\r\nexport { getAccountTokenAction } from './modules/accounts/actions/get-account-token.action';\r\nexport { listSubscriptionsAction } from './modules/subscriptions/actions/list-subscriptions.action';\r\nexport { findPlanByIdAction } from './modules/plans/actions/find-plan-by-id.action';\r\nexport { listPlansAction } from './modules/plans/actions/list-plans.action';\r\nexport { calculateSubscriptionAction } from './modules/subscriptions/actions/calculate-subscription.action';\r\nexport { updateSubscriptionPlanAction } from './modules/subscriptions/actions/update-subscription-plan.action';\r\nexport { listCardsAction } from './modules/cards/actions/list-cards.action';\r\nexport { createCardAction } from './modules/cards/actions/create-card.action';\r\nexport { resolvePlanExtrasPrices } from './modules/subscriptions/utils/resolve-plan-extras-prices';\r\nexport { hasSubscriptionExpired } from './modules/subscriptions/utils/has-subscription-expired';\r\nexport { listIaCreditsAction } from './modules/ia-credits/actions/list-ia-credits.action';\r\n\r\n// Project Services & Actions (server-only)\r\nexport { projectsService } from './modules/projects/services/projects.service';\r\nexport { listProjectsAction } from './modules/projects/actions/list-projects.action';\r\nexport { findProjectAction } from './modules/projects/actions/find-project.action';\r\nexport { createProjectAction } from './modules/projects/actions/create-project.action';\r\nexport { updateProjectAction } from './modules/projects/actions/update-project.action';\r\nexport { deleteProjectAction } from './modules/projects/actions/delete-project.action';\r\n\r\n// Project Users Services & Actions (server-only)\r\nexport { projectUsersService } from './modules/projects/services/project-users.service';\r\nexport { listProjectUsersAction } from './modules/projects/actions/list-project-users.action';\r\nexport { listAvailableUsersAction } from './modules/projects/actions/list-available-users.action';\r\nexport { addProjectUserAction } from './modules/projects/actions/add-project-user.action';\r\nexport { removeProjectUserAction } from './modules/projects/actions/remove-project-user.action';\r\n\r\n// Account Services & Actions (server-only)\r\nexport { accountService } from './modules/accounts/services/account.service';\r\nexport { twoFactorService } from './modules/accounts/services/two-factor.service';\r\nexport {\r\n listAccountUsersAction,\r\n updateUserAction,\r\n updateAccountAction,\r\n updateAccountUserByIdAction,\r\n deleteAccountUserAction,\r\n deleteAccountAction,\r\n createAccountUserAction,\r\n changePasswordAction,\r\n requestEmailChangeAction,\r\n confirmEmailChangeAction,\r\n requestPhoneChangeAction,\r\n confirmPhoneChangeAction,\r\n generateTwoFactorAction,\r\n confirmTwoFactorAction,\r\n disableTwoFactorAction,\r\n} from './modules/accounts/actions/account-management.action';\r\n\r\n// Server Utils\r\nexport { getClientInfoFromRequest } from './infra/utils/client-info';\r\nexport { getUserContext } from './modules/auth/utils/get-user-context';\r\nexport { buildWlOverride, buildWlOverrideFromJwt } from './modules/auth/utils/build-wl-override';\r\nexport { safeServerAction } from './utils/safeServerAction';\r\n\r\n// Image Processing (server-side)\r\nexport { processImageAction } from './modules/images/actions/process-image.action';\r\nexport { processImage } from './modules/images/services/image-processing.service';\r\nexport type {\r\n ProcessImageInput,\r\n ProcessImageOutput,\r\n ProcessImageActionInput,\r\n ProcessImageActionOutput,\r\n} from './modules/images/types/image.type';\r\n"],"mappings":"AAAA,OAAO;AAGP,SAAS,WAAW,KAAK,iBAAiB;AAG1C,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,kCAAkC;AAC3C,SAAS,oCAAoC;AAC7C,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AAGjC,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,2BAA2B;AAGpC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,2BAA2B;AACpC,SAAS,2BAA2B;AAGpC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AAGxC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB,8BAA8B;AACxD,SAAS,wBAAwB;AAGjC,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;","names":[]}
1
+ {"version":3,"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\r\n\r\n// API Client\r\nexport { ApiClient, api, apiClient } from './infra/api/client';\r\n\r\n// Services\r\nexport { authService } from './modules/auth/services/auth.service';\r\nexport { whitelabelService } from './modules/whitelabel/services/whitelabel.service';\r\nexport { revalidateWhitelabelAction } from './modules/whitelabel/actions/revalidate-whitelabel.action';\r\nexport { assertManagementPermission } from './modules/auth/utils/assert-management-permission';\r\nexport { assertManagementSubscription } from './modules/auth/utils/assert-management-subscription';\r\nexport { assertSubscriptionAddon } from './modules/auth/utils/assert-subscription-addon';\r\nexport { assertPaidSubscription } from './modules/auth/utils/assert-paid-subscription';\r\nexport { subscriptionsService } from './modules/subscriptions/services/subscriptions.service';\r\nexport { plansService } from './modules/plans/services/plans.service';\r\nexport { cardsService } from './modules/cards/services/cards.service';\r\nexport { iaCreditsService } from './modules/ia-credits/services/ia-credits.service';\r\n\r\n// Actions\r\nexport { findWhitelabel } from './modules/whitelabel/actions/find-whitelabel.action';\r\nexport { validateSessionAction } from './modules/auth/actions/validate-session.action';\r\nexport { findUserById } from './modules/users/action/find-user-by-id.action';\r\nexport { findCurrentAccount } from './modules/accounts/actions/find-current-account.action';\r\nexport { getAccountTokenAction } from './modules/accounts/actions/get-account-token.action';\r\nexport { listSubscriptionsAction } from './modules/subscriptions/actions/list-subscriptions.action';\r\nexport { findPlanByIdAction } from './modules/plans/actions/find-plan-by-id.action';\r\nexport { listPlansAction } from './modules/plans/actions/list-plans.action';\r\nexport { calculateSubscriptionAction } from './modules/subscriptions/actions/calculate-subscription.action';\r\nexport { updateSubscriptionPlanAction } from './modules/subscriptions/actions/update-subscription-plan.action';\r\nexport { listCardsAction } from './modules/cards/actions/list-cards.action';\r\nexport { createCardAction } from './modules/cards/actions/create-card.action';\r\nexport { resolvePlanExtrasPrices } from './modules/subscriptions/utils/resolve-plan-extras-prices';\r\nexport { hasSubscriptionExpired } from './modules/subscriptions/utils/has-subscription-expired';\r\nexport { listIaCreditsAction } from './modules/ia-credits/actions/list-ia-credits.action';\r\nexport { countPagesAction } from './modules/pages/actions/count-pages.action';\r\n\r\n// Project Services & Actions (server-only)\r\nexport { projectsService } from './modules/projects/services/projects.service';\r\nexport { listProjectsAction } from './modules/projects/actions/list-projects.action';\r\nexport { findProjectAction } from './modules/projects/actions/find-project.action';\r\nexport { createProjectAction } from './modules/projects/actions/create-project.action';\r\nexport { updateProjectAction } from './modules/projects/actions/update-project.action';\r\nexport { deleteProjectAction } from './modules/projects/actions/delete-project.action';\r\n\r\n// Project Users Services & Actions (server-only)\r\nexport { projectUsersService } from './modules/projects/services/project-users.service';\r\nexport { listProjectUsersAction } from './modules/projects/actions/list-project-users.action';\r\nexport { listAvailableUsersAction } from './modules/projects/actions/list-available-users.action';\r\nexport { addProjectUserAction } from './modules/projects/actions/add-project-user.action';\r\nexport { removeProjectUserAction } from './modules/projects/actions/remove-project-user.action';\r\n\r\n// Account Services & Actions (server-only)\r\nexport { accountService } from './modules/accounts/services/account.service';\r\nexport { twoFactorService } from './modules/accounts/services/two-factor.service';\r\nexport {\r\n listAccountUsersAction,\r\n updateUserAction,\r\n updateAccountAction,\r\n updateAccountUserByIdAction,\r\n deleteAccountUserAction,\r\n deleteAccountAction,\r\n createAccountUserAction,\r\n changePasswordAction,\r\n requestEmailChangeAction,\r\n confirmEmailChangeAction,\r\n requestPhoneChangeAction,\r\n confirmPhoneChangeAction,\r\n generateTwoFactorAction,\r\n confirmTwoFactorAction,\r\n disableTwoFactorAction,\r\n} from './modules/accounts/actions/account-management.action';\r\n\r\n// Server Utils\r\nexport { getClientInfoFromRequest } from './infra/utils/client-info';\r\nexport { getUserContext } from './modules/auth/utils/get-user-context';\r\nexport { buildWlOverride, buildWlOverrideFromJwt } from './modules/auth/utils/build-wl-override';\r\nexport { safeServerAction } from './utils/safeServerAction';\r\n\r\n// Image Processing (server-side)\r\nexport { processImageAction } from './modules/images/actions/process-image.action';\r\nexport { processImage } from './modules/images/services/image-processing.service';\r\nexport type {\r\n ProcessImageInput,\r\n ProcessImageOutput,\r\n ProcessImageActionInput,\r\n ProcessImageActionOutput,\r\n} from './modules/images/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12 +4,11 @@ const useAccountModals = create((set) => ({
4
4
  activeModal: null,
5
5
  config: {},
6
6
  initialSection: void 0,
7
- pagesCount: 0,
8
7
  updateConfig: (config) => set({ config }),
9
8
  openConfigurations: (initialSection) => set({ activeModal: "configurations", initialSection }),
10
- openDeleteAccount: (pagesCount = 0) => set({ activeModal: "deleteAccount", pagesCount }),
9
+ openDeleteAccount: () => set({ activeModal: "deleteAccount" }),
11
10
  openIsntPossibleDelete: () => set({ activeModal: "isntPossibleDelete" }),
12
- openConfirmDelete: (pagesCount = 0) => set({ activeModal: "confirmDelete", pagesCount }),
11
+ openConfirmDelete: () => set({ activeModal: "confirmDelete" }),
13
12
  close: () => set({ activeModal: null, initialSection: void 0 })
14
13
  }));
15
14
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/store/useAccountModals.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\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 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;AA8BhB,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":[]}
1
+ {"version":3,"sources":["../../src/store/useAccountModals.ts"],"sourcesContent":["'use client';\n\nimport { create } from 'zustand';\nimport type { AccountSectionType } from '../enums/AccountSectionType';\n\ntype AccountModalType =\n | 'configurations'\n | 'deleteAccount'\n | 'isntPossibleDelete'\n | 'confirmDelete';\n\nexport interface AccountModalsConfig {\n onGoToSubscription?: () => void;\n}\n\ninterface AccountModalsState {\n activeModal: AccountModalType | null;\n config: AccountModalsConfig;\n initialSection?: AccountSectionType;\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: () => void;\n openIsntPossibleDelete: () => void;\n openConfirmDelete: () => void;\n close: () => void;\n}\n\nexport const useAccountModals = create<AccountModalsState>((set) => ({\n activeModal: null,\n config: {},\n initialSection: undefined,\n\n updateConfig: (config) => set({ config }),\n\n openConfigurations: (initialSection) =>\n set({ activeModal: 'configurations', initialSection }),\n\n openDeleteAccount: () =>\n set({ activeModal: 'deleteAccount' }),\n\n openIsntPossibleDelete: () =>\n set({ activeModal: 'isntPossibleDelete' }),\n\n openConfirmDelete: () =>\n set({ activeModal: 'confirmDelete' }),\n\n close: () =>\n set({ activeModal: null, initialSection: undefined }),\n}));\n"],"mappings":";AAEA,SAAS,cAAc;AA4BhB,MAAM,mBAAmB,OAA2B,CAAC,SAAS;AAAA,EACnE,aAAa;AAAA,EACb,QAAQ,CAAC;AAAA,EACT,gBAAgB;AAAA,EAEhB,cAAc,CAAC,WAAW,IAAI,EAAE,OAAO,CAAC;AAAA,EAExC,oBAAoB,CAAC,mBACnB,IAAI,EAAE,aAAa,kBAAkB,eAAe,CAAC;AAAA,EAEvD,mBAAmB,MACjB,IAAI,EAAE,aAAa,gBAAgB,CAAC;AAAA,EAEtC,wBAAwB,MACtB,IAAI,EAAE,aAAa,qBAAqB,CAAC;AAAA,EAE3C,mBAAmB,MACjB,IAAI,EAAE,aAAa,gBAAgB,CAAC;AAAA,EAEtC,OAAO,MACL,IAAI,EAAE,aAAa,MAAM,gBAAgB,OAAU,CAAC;AACxD,EAAE;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatapps/common",
3
- "version": "1.1.540",
3
+ "version": "1.1.542",
4
4
  "description": "Shared library for GreatApps frontend applications",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./src/index.ts",
@@ -14,18 +14,29 @@ import useIsMobile from '../../hooks/useIsMobile';
14
14
  import { useAccountModals } from '../../store/useAccountModals';
15
15
  import { useAuth } from '../../providers/auth.provider';
16
16
  import { UserProfile } from '../../modules/users/schema';
17
+ import { useActiveSubscription } from '../../modules/subscriptions/hooks/find-active-subscription.hook';
18
+ import { hasSubscriptionExpired } from '../../modules/subscriptions/utils/has-subscription-expired';
17
19
 
18
20
  export default function ConfigurationsMyAccountModal() {
19
21
  const {
20
22
  activeModal,
21
- config,
22
23
  openDeleteAccount,
23
24
  openIsntPossibleDelete,
24
25
  close,
25
26
  } = useAccountModals();
26
27
 
27
28
  const open = activeModal === 'configurations';
28
- const { hasActiveSubscription } = config;
29
+
30
+ const { data: subscriptionData } = useActiveSubscription();
31
+ const subscription = subscriptionData?.data?.[0] ?? null;
32
+ const isPaidSubscriptionType =
33
+ !!subscription &&
34
+ subscription.type !== 'free' &&
35
+ subscription.type !== 'trial';
36
+ const isBlockingSubscription =
37
+ isPaidSubscriptionType &&
38
+ subscription.active === true &&
39
+ !hasSubscriptionExpired(subscription.date_due);
29
40
 
30
41
  const { user } = useAuth();
31
42
  const isOwner = user?.profile === UserProfile.owner;
@@ -37,7 +48,7 @@ export default function ConfigurationsMyAccountModal() {
37
48
 
38
49
  const handleDeleteAccount = () => {
39
50
  close();
40
- if (hasActiveSubscription) {
51
+ if (isBlockingSubscription) {
41
52
  openIsntPossibleDelete();
42
53
  } else {
43
54
  openDeleteAccount();
@@ -6,20 +6,52 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/overlay/
6
6
  import { Button } from '../ui/buttons/Button';
7
7
  import { Toast } from '../ui/feedback/Toast';
8
8
  import { useAccountModals } from '../../store/useAccountModals';
9
+ import { useCountPages } from '../../modules/pages/hooks/count-pages.hook';
10
+ import {
11
+ useDeleteAccount,
12
+ useDeleteAccountUser,
13
+ } from '../../modules/accounts/hooks/useAccountManagement';
14
+ import { useAuth } from '../../providers/auth.provider';
15
+ import { UserProfile } from '../../modules/users/schema';
9
16
 
10
17
  export default function ConfirmDeleteAccountModal() {
11
- const { activeModal, pagesCount, close } = useAccountModals();
18
+ const { activeModal, close } = useAccountModals();
12
19
  const open = activeModal === 'confirmDelete';
13
20
 
14
- const handleConfirm = () => {
15
- toast.custom((t) => (
16
- <Toast variant="success" message="Conta excluída com sucesso" toastId={t} />
17
- ));
18
- close();
21
+ const { data: pagesCount = 0 } = useCountPages();
22
+
23
+ const { user, logout } = useAuth();
24
+ const isOwner = user?.profile === UserProfile.owner;
25
+
26
+ const deleteAccount = useDeleteAccount();
27
+ const deleteAccountUser = useDeleteAccountUser();
28
+ const isDeleting = deleteAccount.isPending || deleteAccountUser.isPending;
29
+
30
+ const handleConfirm = async () => {
31
+ try {
32
+ if (isOwner) {
33
+ await deleteAccount.mutateAsync();
34
+ } else {
35
+ await deleteAccountUser.mutateAsync(user!.id);
36
+ }
37
+ close();
38
+ toast.custom((t) => (
39
+ <Toast variant="success" message="Conta excluída com sucesso" toastId={t} />
40
+ ));
41
+ await logout();
42
+ } catch (error) {
43
+ toast.custom((t) => (
44
+ <Toast
45
+ variant="error"
46
+ message={error instanceof Error ? error.message : 'Erro ao excluir. Tente novamente.'}
47
+ toastId={t}
48
+ />
49
+ ));
50
+ }
19
51
  };
20
52
 
21
53
  return (
22
- <Dialog open={open} onOpenChange={close}>
54
+ <Dialog open={open} onOpenChange={isDeleting ? undefined : close}>
23
55
  <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
56
  <div className="flex flex-col gap-5 p-4 lg:p-5">
25
57
  <DialogHeader className="p-0">
@@ -42,11 +74,16 @@ export default function ConfirmDeleteAccountModal() {
42
74
  <div className="h-px bg-gray-200" />
43
75
 
44
76
  <div className="flex items-center gap-2 p-4 lg:p-5">
45
- <Button className="h-10 flex-1" onClick={close}>
77
+ <Button className="h-10 flex-1" onClick={close} disabled={isDeleting}>
46
78
  Manter minha conta
47
79
  </Button>
48
- <Button variant="secondary" className="h-10! flex-1" onClick={handleConfirm}>
49
- Excluir mesmo assim
80
+ <Button
81
+ variant="secondary"
82
+ className="h-10! flex-1"
83
+ onClick={handleConfirm}
84
+ disabled={isDeleting}
85
+ >
86
+ {isDeleting ? 'Excluindo...' : 'Excluir mesmo assim'}
50
87
  </Button>
51
88
  </div>
52
89
  </DialogContent>
@@ -23,7 +23,7 @@ const REASON_OPTIONS = [
23
23
  ];
24
24
 
25
25
  export default function DeleteAccountModal() {
26
- const { activeModal, pagesCount, openConfigurations, openConfirmDelete, close } = useAccountModals();
26
+ const { activeModal, openConfigurations, openConfirmDelete, close } = useAccountModals();
27
27
  const open = activeModal === 'deleteAccount';
28
28
 
29
29
  const [reason, setReason] = useState('');
@@ -53,7 +53,7 @@ export default function DeleteAccountModal() {
53
53
  return;
54
54
  }
55
55
  resetForm();
56
- openConfirmDelete(pagesCount);
56
+ openConfirmDelete();
57
57
  };
58
58
 
59
59
  return (
@@ -6,16 +6,15 @@ import { ModalManager } from './ModalManager';
6
6
  import { useAccountModals } from '../../store/useAccountModals';
7
7
  interface ModalsProps {
8
8
  registry: Record<string, ComponentType>;
9
- hasActiveSubscription?: boolean;
10
9
  onGoToSubscription?: () => void;
11
10
  }
12
11
 
13
- export function Modals({ registry, hasActiveSubscription, onGoToSubscription }: ModalsProps) {
12
+ export function Modals({ registry, onGoToSubscription }: ModalsProps) {
14
13
  const { updateConfig } = useAccountModals();
15
14
 
16
15
  useEffect(() => {
17
- updateConfig({ hasActiveSubscription, onGoToSubscription });
18
- }, [hasActiveSubscription, onGoToSubscription, updateConfig]);
16
+ updateConfig({ onGoToSubscription });
17
+ }, [onGoToSubscription, updateConfig]);
19
18
 
20
19
  return (
21
20
  <>
package/src/index.ts CHANGED
@@ -135,6 +135,11 @@ export {
135
135
  } from "./modules/cards/types";
136
136
  export { buildPlanExtras } from "./modules/subscriptions/utils/build-plan-extras";
137
137
  export { hasSubscriptionExpired } from "./modules/subscriptions/utils/has-subscription-expired";
138
+ export {
139
+ useCountPages,
140
+ COUNT_PAGES_QUERY_KEY,
141
+ } from "./modules/pages/hooks/count-pages.hook";
142
+ export { PAGES_QUERY_KEY } from "./modules/pages/constants/query-keys.constants";
138
143
  export {
139
144
  getPriceFromCalculatedData,
140
145
  getOriginalPriceFromCalculatedData,
@@ -0,0 +1,10 @@
1
+ 'use server';
2
+
3
+ import { safeServerAction } from '../../../utils/safeServerAction';
4
+ import { pagesService } from '../services/pages.service';
5
+
6
+ export async function countPagesAction() {
7
+ return safeServerAction(async () => ({
8
+ total: await pagesService.countPages(),
9
+ }));
10
+ }
@@ -0,0 +1 @@
1
+ export const PAGES_QUERY_KEY = ['pages'] as const;
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+
3
+ import { useQuery } from '@tanstack/react-query';
4
+ import { countPagesAction } from '../actions/count-pages.action';
5
+ import { PAGES_QUERY_KEY } from '../constants/query-keys.constants';
6
+ import { withAction } from '../../../utils/withAction';
7
+ import { useAuthQueryKey } from '../../../hooks/useAuthQueryKey';
8
+
9
+ export const COUNT_PAGES_QUERY_KEY = [...PAGES_QUERY_KEY, 'count'] as const;
10
+
11
+ export function useCountPages() {
12
+ const queryKey = useAuthQueryKey([...COUNT_PAGES_QUERY_KEY]);
13
+
14
+ return useQuery({
15
+ queryKey,
16
+ queryFn: async () => {
17
+ const result = await withAction(countPagesAction)();
18
+ return result.total;
19
+ },
20
+ staleTime: 30_000,
21
+ });
22
+ }
@@ -0,0 +1,27 @@
1
+ import 'server-only';
2
+
3
+ import { api } from '../../../infra/api/client';
4
+ import { ApiError, ApiPaginatedActionResult } from '../../../infra/api/types';
5
+ import { getUserContext } from '../../auth/utils/get-user-context';
6
+
7
+ class PagesService {
8
+ async countPages(): Promise<number> {
9
+ const { id_account } = await getUserContext();
10
+
11
+ const url = `/account/${id_account}/pages?limit=1`;
12
+
13
+ const response = await api.pages.get<ApiPaginatedActionResult<unknown>>(url);
14
+
15
+ if (response.status === 0) {
16
+ throw new ApiError(
17
+ response.message || 'Erro ao contar páginas',
18
+ 'COUNT_PAGES_FAILED',
19
+ 400,
20
+ );
21
+ }
22
+
23
+ return response.total;
24
+ }
25
+ }
26
+
27
+ export const pagesService = new PagesService();
package/src/server.ts CHANGED
@@ -32,6 +32,7 @@ export { createCardAction } from './modules/cards/actions/create-card.action';
32
32
  export { resolvePlanExtrasPrices } from './modules/subscriptions/utils/resolve-plan-extras-prices';
33
33
  export { hasSubscriptionExpired } from './modules/subscriptions/utils/has-subscription-expired';
34
34
  export { listIaCreditsAction } from './modules/ia-credits/actions/list-ia-credits.action';
35
+ export { countPagesAction } from './modules/pages/actions/count-pages.action';
35
36
 
36
37
  // Project Services & Actions (server-only)
37
38
  export { projectsService } from './modules/projects/services/projects.service';
@@ -10,7 +10,6 @@ type AccountModalType =
10
10
  | 'confirmDelete';
11
11
 
12
12
  export interface AccountModalsConfig {
13
- hasActiveSubscription?: boolean;
14
13
  onGoToSubscription?: () => void;
15
14
  }
16
15
 
@@ -18,15 +17,14 @@ interface AccountModalsState {
18
17
  activeModal: AccountModalType | null;
19
18
  config: AccountModalsConfig;
20
19
  initialSection?: AccountSectionType;
21
- pagesCount: number;
22
20
 
23
21
  /** Called by <AccountModals> to keep app-level config in sync */
24
22
  updateConfig: (config: AccountModalsConfig) => void;
25
23
 
26
24
  openConfigurations: (initialSection?: AccountSectionType) => void;
27
- openDeleteAccount: (pagesCount?: number) => void;
25
+ openDeleteAccount: () => void;
28
26
  openIsntPossibleDelete: () => void;
29
- openConfirmDelete: (pagesCount?: number) => void;
27
+ openConfirmDelete: () => void;
30
28
  close: () => void;
31
29
  }
32
30
 
@@ -34,21 +32,20 @@ export const useAccountModals = create<AccountModalsState>((set) => ({
34
32
  activeModal: null,
35
33
  config: {},
36
34
  initialSection: undefined,
37
- pagesCount: 0,
38
35
 
39
36
  updateConfig: (config) => set({ config }),
40
37
 
41
38
  openConfigurations: (initialSection) =>
42
39
  set({ activeModal: 'configurations', initialSection }),
43
40
 
44
- openDeleteAccount: (pagesCount = 0) =>
45
- set({ activeModal: 'deleteAccount', pagesCount }),
41
+ openDeleteAccount: () =>
42
+ set({ activeModal: 'deleteAccount' }),
46
43
 
47
44
  openIsntPossibleDelete: () =>
48
45
  set({ activeModal: 'isntPossibleDelete' }),
49
46
 
50
- openConfirmDelete: (pagesCount = 0) =>
51
- set({ activeModal: 'confirmDelete', pagesCount }),
47
+ openConfirmDelete: () =>
48
+ set({ activeModal: 'confirmDelete' }),
52
49
 
53
50
  close: () =>
54
51
  set({ activeModal: null, initialSection: undefined }),