@greatapps/common 1.1.388 → 1.1.391
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/layouts/ProfilePopover.mjs +8 -4
- package/dist/components/layouts/ProfilePopover.mjs.map +1 -1
- package/dist/components/navigation/ProjectSelectorPopover.mjs +44 -70
- package/dist/components/navigation/ProjectSelectorPopover.mjs.map +1 -1
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs +32 -59
- package/dist/components/navigation/subcomponents/ProjectSelector.mjs.map +1 -1
- package/dist/index.mjs +32 -36
- package/dist/index.mjs.map +1 -1
- package/dist/infra/api/types.mjs +1 -1
- package/dist/infra/api/types.mjs.map +1 -1
- package/dist/modules/accounts/services/two-factor.service.mjs +2 -3
- package/dist/modules/accounts/services/two-factor.service.mjs.map +1 -1
- package/dist/modules/auth/actions/verify-two-factor.action.mjs +2 -2
- package/dist/modules/auth/actions/verify-two-factor.action.mjs.map +1 -1
- package/dist/modules/auth/hooks/useUserQuery.mjs +2 -2
- package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -1
- package/dist/modules/auth/services/auth.service.mjs +5 -6
- package/dist/modules/auth/services/auth.service.mjs.map +1 -1
- package/dist/modules/auth/utils/assert-management-subscription.mjs +0 -7
- package/dist/modules/auth/utils/assert-management-subscription.mjs.map +1 -1
- package/dist/server.mjs +0 -4
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/layouts/AppMobileNavBar.tsx +15 -57
- package/dist/components/modals/PaidPlanRequiredModal.mjs +0 -46
- package/dist/components/modals/PaidPlanRequiredModal.mjs.map +0 -1
- package/dist/modules/auth/utils/assert-paid-subscription.mjs +0 -40
- package/dist/modules/auth/utils/assert-paid-subscription.mjs.map +0 -1
- package/dist/modules/auth/utils/assert-subscription-addon.mjs +0 -35
- package/dist/modules/auth/utils/assert-subscription-addon.mjs.map +0 -1
- package/dist/store/usePaidPlanRequiredModal.mjs +0 -14
- package/dist/store/usePaidPlanRequiredModal.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/utils/assert-management-subscription.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/auth/utils/assert-management-subscription.ts"],"sourcesContent":["import 'server-only';\n\nimport { ApiError } from '../../../infra/api/types';\nimport { listSubscriptionsAction } from '../../subscriptions/actions/list-subscriptions.action';\nimport { hasSubscriptionExpired } from '../../subscriptions/utils/has-subscription-expired';\n\nexport async function assertManagementSubscription() {\n const result = await listSubscriptionsAction({ active: true });\n\n if (!result.success) {\n throw new ApiError(\n result.error || 'Não foi possível validar a assinatura atual',\n 'SUBSCRIPTION_CONTEXT_FAILED',\n 403\n );\n }\n\n const subscription = result.data?.data?.[0];\n\n if (hasSubscriptionExpired(subscription?.date_due)) {\n throw new ApiError(\n 'Sua assinatura está vencida. Assine um novo plano para continuar.',\n 'SUBSCRIPTION_EXPIRED',\n 403\n );\n }\n}\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AAEvC,eAAsB,+BAA+B;AACnD,QAAM,SAAS,MAAM,wBAAwB,EAAE,QAAQ,KAAK,CAAC;AAE7D,MAAI,CAAC,OAAO,SAAS;AACnB,UAAM,IAAI;AAAA,MACR,OAAO,SAAS;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,eAAe,OAAO,MAAM,OAAO,CAAC;AAE1C,MAAI,uBAAuB,cAAc,QAAQ,GAAG;AAClD,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/dist/server.mjs
CHANGED
|
@@ -5,8 +5,6 @@ import { whitelabelService } from "./modules/whitelabel/services/whitelabel.serv
|
|
|
5
5
|
import { revalidateWhitelabelAction } from "./modules/whitelabel/actions/revalidate-whitelabel.action";
|
|
6
6
|
import { assertManagementPermission } from "./modules/auth/utils/assert-management-permission";
|
|
7
7
|
import { assertManagementSubscription } from "./modules/auth/utils/assert-management-subscription";
|
|
8
|
-
import { assertSubscriptionAddon } from "./modules/auth/utils/assert-subscription-addon";
|
|
9
|
-
import { assertPaidSubscription } from "./modules/auth/utils/assert-paid-subscription";
|
|
10
8
|
import { subscriptionsService } from "./modules/subscriptions/services/subscriptions.service";
|
|
11
9
|
import { plansService } from "./modules/plans/services/plans.service";
|
|
12
10
|
import { cardsService } from "./modules/cards/services/cards.service";
|
|
@@ -60,8 +58,6 @@ export {
|
|
|
60
58
|
apiClient,
|
|
61
59
|
assertManagementPermission,
|
|
62
60
|
assertManagementSubscription,
|
|
63
|
-
assertPaidSubscription,
|
|
64
|
-
assertSubscriptionAddon,
|
|
65
61
|
authService,
|
|
66
62
|
buildWlOverride,
|
|
67
63
|
buildWlOverrideFromJwt,
|
package/dist/server.mjs.map
CHANGED
|
@@ -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';\
|
|
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';\nexport { whitelabelService } from './modules/whitelabel/services/whitelabel.service';\nexport { revalidateWhitelabelAction } from './modules/whitelabel/actions/revalidate-whitelabel.action';\nexport { assertManagementPermission } from './modules/auth/utils/assert-management-permission';\nexport { assertManagementSubscription } from './modules/auth/utils/assert-management-subscription';\nexport { subscriptionsService } from './modules/subscriptions/services/subscriptions.service';\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 { listSubscriptionsAction } from './modules/subscriptions/actions/list-subscriptions.action';\r\nexport { findPlanByIdAction } from './modules/plans/actions/find-plan-by-id.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';\nexport { hasSubscriptionExpired } from './modules/subscriptions/utils/has-subscription-expired';\nexport { listIaCreditsAction } from './modules/ia-credits/actions/list-ia-credits.action';\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"],"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,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,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,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;","names":[]}
|
package/package.json
CHANGED
|
@@ -6,13 +6,10 @@ import { IconMenu2, IconX } from "@tabler/icons-react";
|
|
|
6
6
|
import { ProfilePopover } from "./ProfilePopover";
|
|
7
7
|
import { useMobileNavbarSheet } from "../../store/useMobileNavbarSheet";
|
|
8
8
|
import type { ProfileMenuItem } from "./ProfilePopover";
|
|
9
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/overlay/Tooltip";
|
|
10
9
|
|
|
11
10
|
export interface AppMobileNavBarProps {
|
|
12
11
|
/** Which app is currently active — controls which icon gets the indicator */
|
|
13
12
|
activeApp?: "gapps" | "gpages";
|
|
14
|
-
/** Called when the GreatApps logo is clicked */
|
|
15
|
-
onLogoClick?: () => void;
|
|
16
13
|
/** Called when the app icon (e.g. GreatPages) is clicked */
|
|
17
14
|
onAppIconClick?: () => void;
|
|
18
15
|
/** Extra slot rendered after the app icon (e.g. project selector) */
|
|
@@ -23,7 +20,6 @@ export interface AppMobileNavBarProps {
|
|
|
23
20
|
|
|
24
21
|
export function AppMobileNavBar({
|
|
25
22
|
activeApp,
|
|
26
|
-
onLogoClick,
|
|
27
23
|
onAppIconClick,
|
|
28
24
|
extraLeftSlot,
|
|
29
25
|
menuItems = [],
|
|
@@ -32,64 +28,26 @@ export function AppMobileNavBar({
|
|
|
32
28
|
const { isOpen, toggle } = useMobileNavbarSheet();
|
|
33
29
|
|
|
34
30
|
const isGpagesActive = activeApp === "gpages";
|
|
35
|
-
const isGappsActive = activeApp === "gapps";
|
|
36
31
|
|
|
37
32
|
return (
|
|
38
33
|
<div className="fixed top-0 left-0 right-0 flex md:hidden items-center justify-between p-4 bg-white z-50 border-b border-gray-200">
|
|
39
34
|
<div className="flex items-center gap-1.5">
|
|
40
|
-
<Tooltip>
|
|
41
|
-
<TooltipTrigger asChild>
|
|
42
|
-
<div
|
|
43
|
-
className={`relative size-10 flex items-center justify-center rounded-lg transition-colors ${onLogoClick ? "cursor-pointer hover:bg-gray-100" : ""}`}
|
|
44
|
-
onClick={onLogoClick}
|
|
45
|
-
>
|
|
46
|
-
<Image
|
|
47
|
-
src="/icons/great-icon.svg"
|
|
48
|
-
alt="Great"
|
|
49
|
-
width={28}
|
|
50
|
-
height={28}
|
|
51
|
-
/>
|
|
52
|
-
{isGappsActive && (
|
|
53
|
-
<div className="absolute bottom-[-17px] left-1/2 -translate-x-1/2 w-5 h-[3px] bg-gray-950 rounded-t-xl" />
|
|
54
|
-
)}
|
|
55
|
-
</div>
|
|
56
|
-
</TooltipTrigger>
|
|
57
|
-
<TooltipContent side="bottom">Great</TooltipContent>
|
|
58
|
-
</Tooltip>
|
|
59
35
|
<div className="relative">
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<div
|
|
76
|
-
className={`size-10 flex items-center justify-center rounded-lg ${onAppIconClick ? "cursor-pointer" : ""}`}
|
|
77
|
-
onClick={onAppIconClick}
|
|
78
|
-
>
|
|
79
|
-
<Image
|
|
80
|
-
src="/icons/icon-navbar.svg"
|
|
81
|
-
alt="GreatPages"
|
|
82
|
-
width={24}
|
|
83
|
-
height={24}
|
|
84
|
-
/>
|
|
85
|
-
</div>
|
|
86
|
-
)}
|
|
87
|
-
</TooltipTrigger>
|
|
88
|
-
<TooltipContent side="bottom">GreatPages</TooltipContent>
|
|
89
|
-
</Tooltip>
|
|
90
|
-
{isGpagesActive && (
|
|
91
|
-
<div className="absolute -bottom-[17px] left-1/2 -translate-x-1/2 w-5 h-[3px] bg-cyan-300 rounded-t-xl" />
|
|
92
|
-
)}
|
|
36
|
+
<div
|
|
37
|
+
className={`size-10 rounded-lg flex items-center justify-center transition-colors ${
|
|
38
|
+
isGpagesActive
|
|
39
|
+
? "bg-cyan-100 border-2 border-white ring-2 ring-cyan-300"
|
|
40
|
+
: onAppIconClick ? "cursor-pointer hover:bg-gray-100" : ""
|
|
41
|
+
}`}
|
|
42
|
+
onClick={onAppIconClick}
|
|
43
|
+
>
|
|
44
|
+
<Image
|
|
45
|
+
src="/icons/icon-navbar.svg"
|
|
46
|
+
alt="GreatPages"
|
|
47
|
+
width={24}
|
|
48
|
+
height={24}
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
93
51
|
</div>
|
|
94
52
|
{extraLeftSlot}
|
|
95
53
|
</div>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { IconLock } from "@tabler/icons-react";
|
|
4
|
-
import { Button } from "../ui/buttons/Button";
|
|
5
|
-
import {
|
|
6
|
-
Dialog,
|
|
7
|
-
DialogContent,
|
|
8
|
-
DialogDescription,
|
|
9
|
-
DialogHeader,
|
|
10
|
-
DialogTitle
|
|
11
|
-
} from "../ui/overlay/Dialog";
|
|
12
|
-
import { useWhitelabelUrls } from "../../modules/whitelabel/hooks/whitelabel.hook";
|
|
13
|
-
import { useModalManager } from "../../store/useModalManager";
|
|
14
|
-
function PaidPlanRequiredModal() {
|
|
15
|
-
const { activeModal, modalData, closeModal } = useModalManager();
|
|
16
|
-
const isOpen = activeModal === "paidPlanRequiredModal";
|
|
17
|
-
const data = modalData;
|
|
18
|
-
const { accountsUrl } = useWhitelabelUrls();
|
|
19
|
-
const title = data.title ?? "Recurso dispon\xEDvel em planos pagos";
|
|
20
|
-
const description = data.description ?? "Para acessar este recurso, fa\xE7a upgrade para um plano pago";
|
|
21
|
-
const handleKnowPlans = () => {
|
|
22
|
-
closeModal();
|
|
23
|
-
window.open(`${accountsUrl}/signature?tab=plans`, "_blank");
|
|
24
|
-
};
|
|
25
|
-
return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: () => closeModal(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "flex flex-col p-0 gap-0 w-full md:w-[410px] lg:w-[410px]", children: [
|
|
26
|
-
/* @__PURE__ */ jsxs(DialogHeader, { className: "gap-3 text-left p-5", children: [
|
|
27
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-10 h-10 bg-zinc-50 rounded-lg", children: /* @__PURE__ */ jsx(IconLock, { size: 24, className: "text-zinc-950" }) }),
|
|
28
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
29
|
-
/* @__PURE__ */ jsx(DialogTitle, { className: "paragraph-medium-semibold text-zinc-950", children: title }),
|
|
30
|
-
/* @__PURE__ */ jsx(DialogDescription, { className: "paragraph-small-regular text-zinc-600", children: description })
|
|
31
|
-
] })
|
|
32
|
-
] }),
|
|
33
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 p-5 border-t border-zinc-200", children: /* @__PURE__ */ jsx(
|
|
34
|
-
Button,
|
|
35
|
-
{
|
|
36
|
-
className: "w-fit h-10!",
|
|
37
|
-
onClick: handleKnowPlans,
|
|
38
|
-
children: "Conhecer planos"
|
|
39
|
-
}
|
|
40
|
-
) })
|
|
41
|
-
] }) });
|
|
42
|
-
}
|
|
43
|
-
export {
|
|
44
|
-
PaidPlanRequiredModal as default
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=PaidPlanRequiredModal.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/modals/PaidPlanRequiredModal.tsx"],"sourcesContent":["\"use client\";\n\nimport { IconLock } from '@tabler/icons-react';\nimport { Button } from '../ui/buttons/Button';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '../ui/overlay/Dialog';\nimport { useWhitelabelUrls } from '../../modules/whitelabel/hooks/whitelabel.hook';\nimport { useModalManager } from '../../store/useModalManager';\nimport type { ModalData } from '../../store/useModalManager';\n\nexport default function PaidPlanRequiredModal() {\n const { activeModal, modalData, closeModal } = useModalManager();\n const isOpen = activeModal === 'paidPlanRequiredModal';\n const data = modalData as ModalData & { title?: string; description?: string };\n const { accountsUrl } = useWhitelabelUrls();\n\n const title = (data.title as string) ?? \"Recurso disponível em planos pagos\";\n const description = (data.description as string) ?? \"Para acessar este recurso, faça upgrade para um plano pago\";\n\n const handleKnowPlans = () => {\n closeModal();\n window.open(`${accountsUrl}/signature?tab=plans`, '_blank');\n };\n\n return (\n <Dialog open={isOpen} onOpenChange={() => closeModal()}>\n <DialogContent className=\"flex flex-col p-0 gap-0 w-full md:w-[410px] lg:w-[410px]\">\n <DialogHeader className=\"gap-3 text-left p-5\">\n <div className=\"flex items-center justify-center w-10 h-10 bg-zinc-50 rounded-lg\">\n <IconLock size={24} className=\"text-zinc-950\" />\n </div>\n <div className=\"flex flex-col gap-2\">\n <DialogTitle className=\"paragraph-medium-semibold text-zinc-950\">\n {title}\n </DialogTitle>\n <DialogDescription className=\"paragraph-small-regular text-zinc-600\">\n {description}\n </DialogDescription>\n </div>\n </DialogHeader>\n <div className=\"flex items-center gap-2 p-5 border-t border-zinc-200\">\n <Button\n className=\"w-fit h-10!\"\n onClick={handleKnowPlans}\n >\n Conhecer planos\n </Button>\n </div>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AAkCwB,cAEJ,YAFI;AAhCxB,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAGjB,SAAR,wBAAyC;AAC5C,QAAM,EAAE,aAAa,WAAW,WAAW,IAAI,gBAAgB;AAC/D,QAAM,SAAS,gBAAgB;AAC/B,QAAM,OAAO;AACb,QAAM,EAAE,YAAY,IAAI,kBAAkB;AAE1C,QAAM,QAAS,KAAK,SAAoB;AACxC,QAAM,cAAe,KAAK,eAA0B;AAEpD,QAAM,kBAAkB,MAAM;AAC1B,eAAW;AACX,WAAO,KAAK,GAAG,WAAW,wBAAwB,QAAQ;AAAA,EAC9D;AAEA,SACI,oBAAC,UAAO,MAAM,QAAQ,cAAc,MAAM,WAAW,GACjD,+BAAC,iBAAc,WAAU,4DACrB;AAAA,yBAAC,gBAAa,WAAU,uBACpB;AAAA,0BAAC,SAAI,WAAU,oEACX,8BAAC,YAAS,MAAM,IAAI,WAAU,iBAAgB,GAClD;AAAA,MACA,qBAAC,SAAI,WAAU,uBACX;AAAA,4BAAC,eAAY,WAAU,2CAClB,iBACL;AAAA,QACA,oBAAC,qBAAkB,WAAU,yCACxB,uBACL;AAAA,SACJ;AAAA,OACJ;AAAA,IACA,oBAAC,SAAI,WAAU,wDACX;AAAA,MAAC;AAAA;AAAA,QACG,WAAU;AAAA,QACV,SAAS;AAAA,QACZ;AAAA;AAAA,IAED,GACJ;AAAA,KACJ,GACJ;AAER;","names":[]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import "server-only";
|
|
2
|
-
import { ApiError } from "../../../infra/api/types";
|
|
3
|
-
import { listSubscriptionsAction } from "../../subscriptions/actions/list-subscriptions.action";
|
|
4
|
-
import { hasSubscriptionExpired } from "../../subscriptions/utils/has-subscription-expired";
|
|
5
|
-
async function assertPaidSubscription() {
|
|
6
|
-
const result = await listSubscriptionsAction({ active: true });
|
|
7
|
-
if (!result.success) {
|
|
8
|
-
throw new ApiError(
|
|
9
|
-
result.error || "N\xE3o foi poss\xEDvel validar a assinatura atual",
|
|
10
|
-
"SUBSCRIPTION_CONTEXT_FAILED",
|
|
11
|
-
403
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
const subscription = result.data?.data?.[0];
|
|
15
|
-
if (!subscription) {
|
|
16
|
-
throw new ApiError(
|
|
17
|
-
"Nenhuma assinatura ativa encontrada. Assine um plano para continuar.",
|
|
18
|
-
"SUBSCRIPTION_NOT_FOUND",
|
|
19
|
-
403
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
if (hasSubscriptionExpired(subscription.date_due)) {
|
|
23
|
-
throw new ApiError(
|
|
24
|
-
"Sua assinatura est\xE1 vencida. Assine um novo plano para continuar.",
|
|
25
|
-
"SUBSCRIPTION_EXPIRED",
|
|
26
|
-
403
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
if (subscription.type === "free" || subscription.id_plan === 5 || subscription.type === "trial") {
|
|
30
|
-
throw new ApiError(
|
|
31
|
-
"Este recurso est\xE1 dispon\xEDvel apenas para planos pagos. Fa\xE7a upgrade do seu plano para continuar.",
|
|
32
|
-
"PAID_SUBSCRIPTION_REQUIRED",
|
|
33
|
-
403
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
assertPaidSubscription
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=assert-paid-subscription.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/utils/assert-paid-subscription.ts"],"sourcesContent":["import \"server-only\";\n\nimport { ApiError } from \"../../../infra/api/types\";\nimport { listSubscriptionsAction } from \"../../subscriptions/actions/list-subscriptions.action\";\nimport { hasSubscriptionExpired } from \"../../subscriptions/utils/has-subscription-expired\";\n\nexport async function assertPaidSubscription() {\n const result = await listSubscriptionsAction({ active: true });\n\n if (!result.success) {\n throw new ApiError(\n result.error || \"Não foi possível validar a assinatura atual\",\n \"SUBSCRIPTION_CONTEXT_FAILED\",\n 403,\n );\n }\n\n const subscription = result.data?.data?.[0];\n\n if (!subscription) {\n throw new ApiError(\n \"Nenhuma assinatura ativa encontrada. Assine um plano para continuar.\",\n \"SUBSCRIPTION_NOT_FOUND\",\n 403,\n );\n }\n\n if (hasSubscriptionExpired(subscription.date_due)) {\n throw new ApiError(\n \"Sua assinatura está vencida. Assine um novo plano para continuar.\",\n \"SUBSCRIPTION_EXPIRED\",\n 403,\n );\n }\n\n if (subscription.type === 'free' || subscription.id_plan === 5 || subscription.type === 'trial') {\n throw new ApiError(\n \"Este recurso está disponível apenas para planos pagos. Faça upgrade do seu plano para continuar.\",\n \"PAID_SUBSCRIPTION_REQUIRED\",\n 403,\n );\n }\n}\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AAEvC,eAAsB,yBAAyB;AAC7C,QAAM,SAAS,MAAM,wBAAwB,EAAE,QAAQ,KAAK,CAAC;AAE7D,MAAI,CAAC,OAAO,SAAS;AACnB,UAAM,IAAI;AAAA,MACR,OAAO,SAAS;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,eAAe,OAAO,MAAM,OAAO,CAAC;AAE1C,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI,uBAAuB,aAAa,QAAQ,GAAG;AACjD,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI,aAAa,SAAS,UAAU,aAAa,YAAY,KAAK,aAAa,SAAS,SAAS;AAC/F,UAAM,IAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import "server-only";
|
|
2
|
-
import { ApiError } from "../../../infra/api/types";
|
|
3
|
-
import { listSubscriptionsAction } from "../../subscriptions/actions/list-subscriptions.action";
|
|
4
|
-
async function assertSubscriptionAddon(addonId, addonLabel) {
|
|
5
|
-
const result = await listSubscriptionsAction({ active: true });
|
|
6
|
-
if (!result.success) {
|
|
7
|
-
throw new ApiError(
|
|
8
|
-
result.error || "N\xE3o foi poss\xEDvel validar a assinatura atual",
|
|
9
|
-
"SUBSCRIPTION_CONTEXT_FAILED",
|
|
10
|
-
403
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
const subscription = result.data?.data?.[0];
|
|
14
|
-
if (!subscription) {
|
|
15
|
-
throw new ApiError(
|
|
16
|
-
`Nenhuma assinatura ativa encontrada. Para acessar este recurso, \xE9 necess\xE1rio ter uma assinatura com ${addonLabel}.`,
|
|
17
|
-
"NO_ACTIVE_SUBSCRIPTION",
|
|
18
|
-
403
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
const hasAddon = subscription?.items?.some(
|
|
22
|
-
(item) => item.id_addon === addonId
|
|
23
|
-
);
|
|
24
|
-
if (!hasAddon) {
|
|
25
|
-
throw new ApiError(
|
|
26
|
-
`Sua assinatura n\xE3o inclui ${addonLabel}. Fa\xE7a upgrade do seu plano.`,
|
|
27
|
-
"ADDON_NOT_AVAILABLE",
|
|
28
|
-
403
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
assertSubscriptionAddon
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=assert-subscription-addon.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/auth/utils/assert-subscription-addon.ts"],"sourcesContent":["import \"server-only\";\n\nimport { ApiError } from \"../../../infra/api/types\";\nimport { listSubscriptionsAction } from \"../../subscriptions/actions/list-subscriptions.action\";\nimport type { AddonKindEnum } from \"../../subscriptions/constants/addons.constants\";\n\nexport async function assertSubscriptionAddon(\n addonId: AddonKindEnum,\n addonLabel: string,\n) {\n const result = await listSubscriptionsAction({ active: true });\n\n if (!result.success) {\n throw new ApiError(\n result.error || \"Não foi possível validar a assinatura atual\",\n \"SUBSCRIPTION_CONTEXT_FAILED\",\n 403,\n );\n }\n\n const subscription = result.data?.data?.[0];\n\n if (!subscription) {\n throw new ApiError(\n `Nenhuma assinatura ativa encontrada. Para acessar este recurso, é necessário ter uma assinatura com ${addonLabel}.`,\n \"NO_ACTIVE_SUBSCRIPTION\",\n 403,\n );\n }\n\n const hasAddon = subscription?.items?.some(\n (item) => item.id_addon === addonId,\n );\n\n if (!hasAddon) {\n throw new ApiError(\n `Sua assinatura não inclui ${addonLabel}. Faça upgrade do seu plano.`,\n \"ADDON_NOT_AVAILABLE\",\n 403,\n );\n }\n}\n"],"mappings":"AAAA,OAAO;AAEP,SAAS,gBAAgB;AACzB,SAAS,+BAA+B;AAGxC,eAAsB,wBACpB,SACA,YACA;AACA,QAAM,SAAS,MAAM,wBAAwB,EAAE,QAAQ,KAAK,CAAC;AAE7D,MAAI,CAAC,OAAO,SAAS;AACnB,UAAM,IAAI;AAAA,MACR,OAAO,SAAS;AAAA,MAChB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,eAAe,OAAO,MAAM,OAAO,CAAC;AAE1C,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR,6GAAuG,UAAU;AAAA,MACjH;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,WAAW,cAAc,OAAO;AAAA,IACpC,CAAC,SAAS,KAAK,aAAa;AAAA,EAC9B;AAEA,MAAI,CAAC,UAAU;AACb,UAAM,IAAI;AAAA,MACR,gCAA6B,UAAU;AAAA,MACvC;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useModalManager } from "./useModalManager";
|
|
2
|
-
function usePaidPlanRequiredModal() {
|
|
3
|
-
const { activeModal, openModal, closeModal } = useModalManager();
|
|
4
|
-
const isOpen = activeModal === "paidPlanRequiredModal";
|
|
5
|
-
return {
|
|
6
|
-
open: isOpen,
|
|
7
|
-
openModal: (options) => openModal("paidPlanRequiredModal", options ?? {}),
|
|
8
|
-
closeModal
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
usePaidPlanRequiredModal
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=usePaidPlanRequiredModal.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/store/usePaidPlanRequiredModal.ts"],"sourcesContent":["import { useModalManager } from './useModalManager';\n\ninterface PaidPlanRequiredModalOptions {\n title?: string;\n description?: string;\n}\n\nexport function usePaidPlanRequiredModal() {\n const { activeModal, openModal, closeModal } = useModalManager();\n\n const isOpen = activeModal === 'paidPlanRequiredModal';\n\n return {\n open: isOpen,\n openModal: (options?: PaidPlanRequiredModalOptions) =>\n openModal('paidPlanRequiredModal', options ?? {}),\n closeModal,\n };\n}\n"],"mappings":"AAAA,SAAS,uBAAuB;AAOzB,SAAS,2BAA2B;AACvC,QAAM,EAAE,aAAa,WAAW,WAAW,IAAI,gBAAgB;AAE/D,QAAM,SAAS,gBAAgB;AAE/B,SAAO;AAAA,IACH,MAAM;AAAA,IACN,WAAW,CAAC,YACR,UAAU,yBAAyB,WAAW,CAAC,CAAC;AAAA,IACpD;AAAA,EACJ;AACJ;","names":[]}
|