From d7dc5fb5fb7bd07b477470c4941f9fc57d7f08b0 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Wed, 20 Sep 2023 16:06:53 +0200 Subject: [PATCH] :recycle: Remove storage limit related code --- .../billing/api/createCheckoutSession.ts | 13 +--- .../src/features/billing/api/getUsage.ts | 16 +---- .../billing/api/updateSubscription.ts | 24 +------ .../src/features/billing/billing.spec.ts | 4 +- .../billing/components/ChangePlanForm.tsx | 1 - .../billing/components/PreCheckoutModal.tsx | 1 - .../billing/components/ProPlanPricingCard.tsx | 50 +------------- .../components/StarterPlanPricingCard.tsx | 46 ------------- .../billing/helpers/parseSubscriptionItems.ts | 46 ++++--------- .../dashboard/components/DashboardPage.tsx | 4 +- apps/builder/src/pages/api/stripe/webhook.ts | 11 +-- .../builder/src/test/utils/databaseActions.ts | 5 +- apps/docs/openapi/builder/_spec_.json | 30 +------- .../PricingPage/PlanComparisonTables.tsx | 17 ----- .../components/PricingPage/ProPlanCard.tsx | 52 +------------- .../PricingPage/StarterPlanCard.tsx | 54 +-------------- apps/viewer/src/test/fileUpload.spec.ts | 28 +------- apps/viewer/src/test/sendEmail.spec.ts | 2 +- packages/bot-engine/continueBotFlow.ts | 1 - packages/lib/api/getUsage.ts | 17 +---- packages/lib/playwright/databaseActions.ts | 11 +-- packages/lib/pricing.ts | 68 +------------------ packages/schemas/features/telemetry.ts | 3 - packages/scripts/sendTotalResultsDigest.ts | 30 ++------ packages/scripts/tsconfig.json | 3 +- 25 files changed, 44 insertions(+), 493 deletions(-) diff --git a/apps/builder/src/features/billing/api/createCheckoutSession.ts b/apps/builder/src/features/billing/api/createCheckoutSession.ts index 7b8f9958d..ec466b1c0 100644 --- a/apps/builder/src/features/billing/api/createCheckoutSession.ts +++ b/apps/builder/src/features/billing/api/createCheckoutSession.ts @@ -27,7 +27,6 @@ export const createCheckoutSession = authenticatedProcedure plan: z.enum([Plan.STARTER, Plan.PRO]), returnUrl: z.string(), additionalChats: z.number(), - additionalStorage: z.number(), vat: z .object({ type: z.string(), @@ -53,7 +52,6 @@ export const createCheckoutSession = authenticatedProcedure plan, returnUrl, additionalChats, - additionalStorage, isYearly, }, ctx: { user }, @@ -119,7 +117,6 @@ export const createCheckoutSession = authenticatedProcedure plan, returnUrl, additionalChats, - additionalStorage, isYearly, }) @@ -142,7 +139,6 @@ type Props = { plan: 'STARTER' | 'PRO' returnUrl: string additionalChats: number - additionalStorage: number isYearly: boolean userId: string } @@ -156,7 +152,6 @@ export const createCheckoutSessionUrl = plan, returnUrl, additionalChats, - additionalStorage, isYearly, }: Props) => { const session = await stripe.checkout.sessions.create({ @@ -173,17 +168,11 @@ export const createCheckoutSessionUrl = workspaceId, plan, additionalChats, - additionalStorage, }, currency, billing_address_collection: 'required', automatic_tax: { enabled: true }, - line_items: parseSubscriptionItems( - plan, - additionalChats, - additionalStorage, - isYearly - ), + line_items: parseSubscriptionItems(plan, additionalChats, isYearly), }) return session.url diff --git a/apps/builder/src/features/billing/api/getUsage.ts b/apps/builder/src/features/billing/api/getUsage.ts index 0877e35af..56cb51ecb 100644 --- a/apps/builder/src/features/billing/api/getUsage.ts +++ b/apps/builder/src/features/billing/api/getUsage.ts @@ -19,9 +19,7 @@ export const getUsage = authenticatedProcedure workspaceId: z.string(), }) ) - .output( - z.object({ totalChatsUsed: z.number(), totalStorageUsed: z.number() }) - ) + .output(z.object({ totalChatsUsed: z.number() })) .query(async ({ input: { workspaceId }, ctx: { user } }) => { const workspace = await prisma.workspace.findFirst({ where: { @@ -55,20 +53,8 @@ export const getUsage = authenticatedProcedure }, }, }) - const { - _sum: { storageUsed: totalStorageUsed }, - } = await prisma.answer.aggregate({ - where: { - storageUsed: { gt: 0 }, - result: { - typebotId: { in: workspace.typebots.map((typebot) => typebot.id) }, - }, - }, - _sum: { storageUsed: true }, - }) return { totalChatsUsed, - totalStorageUsed: totalStorageUsed ?? 0, } }) diff --git a/apps/builder/src/features/billing/api/updateSubscription.ts b/apps/builder/src/features/billing/api/updateSubscription.ts index 26abfad57..fe31eba07 100644 --- a/apps/builder/src/features/billing/api/updateSubscription.ts +++ b/apps/builder/src/features/billing/api/updateSubscription.ts @@ -7,8 +7,8 @@ import { workspaceSchema } from '@typebot.io/schemas' import Stripe from 'stripe' import { isDefined } from '@typebot.io/lib' import { z } from 'zod' -import { getChatsLimit, getStorageLimit } from '@typebot.io/lib/pricing' -import { chatPriceIds, storagePriceIds } from './getSubscription' +import { getChatsLimit } from '@typebot.io/lib/pricing' +import { chatPriceIds } from './getSubscription' import { createCheckoutSessionUrl } from './createCheckoutSession' import { isAdminWriteWorkspaceForbidden } from '@/features/workspace/helpers/isAdminWriteWorkspaceForbidden' import { getUsage } from '@typebot.io/lib/api/getUsage' @@ -31,7 +31,6 @@ export const updateSubscription = authenticatedProcedure workspaceId: z.string(), plan: z.enum([Plan.STARTER, Plan.PRO]), additionalChats: z.number(), - additionalStorage: z.number(), currency: z.enum(['usd', 'eur']), isYearly: z.boolean(), }) @@ -48,7 +47,6 @@ export const updateSubscription = authenticatedProcedure workspaceId, plan, additionalChats, - additionalStorage, currency, isYearly, returnUrl, @@ -100,9 +98,6 @@ export const updateSubscription = authenticatedProcedure const currentAdditionalChatsItemId = subscription?.items.data.find( (item) => chatPriceIds.includes(item.price.id) )?.id - const currentAdditionalStorageItemId = subscription?.items.data.find( - (item) => storagePriceIds.includes(item.price.id) - )?.id const frequency = isYearly ? 'yearly' : 'monthly' const items = [ @@ -123,18 +118,6 @@ export const updateSubscription = authenticatedProcedure }), deleted: subscription ? additionalChats === 0 : undefined, }, - additionalStorage === 0 && !currentAdditionalStorageItemId - ? undefined - : { - id: currentAdditionalStorageItemId, - price: priceIds[plan].storage[frequency], - quantity: getStorageLimit({ - plan, - additionalStorageIndex: additionalStorage, - customStorageLimit: null, - }), - deleted: subscription ? additionalStorage === 0 : undefined, - }, ].filter(isDefined) if (subscription) { @@ -151,7 +134,6 @@ export const updateSubscription = authenticatedProcedure plan, returnUrl, additionalChats, - additionalStorage, isYearly, }) @@ -175,7 +157,6 @@ export const updateSubscription = authenticatedProcedure data: { plan, additionalChatsIndex: additionalChats, - additionalStorageIndex: additionalStorage, isQuarantined, }, }) @@ -188,7 +169,6 @@ export const updateSubscription = authenticatedProcedure data: { plan, additionalChatsIndex: additionalChats, - additionalStorageIndex: additionalStorage, }, }, ]) diff --git a/apps/builder/src/features/billing/billing.spec.ts b/apps/builder/src/features/billing/billing.spec.ts index e04fb1a0e..6dcaf0393 100644 --- a/apps/builder/src/features/billing/billing.spec.ts +++ b/apps/builder/src/features/billing/billing.spec.ts @@ -85,7 +85,6 @@ test('should display valid usage', async ({ page }) => { await injectFakeResults({ count: 10, typebotId: usageTypebotId, - fakeStorage: 1100 * 1024 * 1024, }) await page.click('text=Free workspace') await page.click('text="Usage Workspace"') @@ -101,7 +100,6 @@ test('should display valid usage', async ({ page }) => { await injectFakeResults({ typebotId: usageTypebotId, count: 1090, - fakeStorage: 1200 * 1024 * 1024, }) await page.click('text="Settings"') await page.click('text="Billing & Usage"') @@ -140,7 +138,7 @@ test('plan changes should work', async ({ page }) => { quantity: 1, }, ], - { plan: Plan.STARTER, additionalChatsIndex: 0, additionalStorageIndex: 0 } + { plan: Plan.STARTER, additionalChatsIndex: 0 } ) // Update plan with additional quotas diff --git a/apps/builder/src/features/billing/components/ChangePlanForm.tsx b/apps/builder/src/features/billing/components/ChangePlanForm.tsx index 5f271b471..2711d2356 100644 --- a/apps/builder/src/features/billing/components/ChangePlanForm.tsx +++ b/apps/builder/src/features/billing/components/ChangePlanForm.tsx @@ -84,7 +84,6 @@ export const ChangePlanForm = ({ workspace }: Props) => { plan, workspaceId: workspace.id, additionalChats: selectedChatsLimitIndex, - additionalStorage: selectedStorageLimitIndex, currency: data?.subscription?.currency ?? (guessIfUserIsEuropean() ? 'eur' : 'usd'), diff --git a/apps/builder/src/features/billing/components/PreCheckoutModal.tsx b/apps/builder/src/features/billing/components/PreCheckoutModal.tsx index 22323647d..4332ad41f 100644 --- a/apps/builder/src/features/billing/components/PreCheckoutModal.tsx +++ b/apps/builder/src/features/billing/components/PreCheckoutModal.tsx @@ -26,7 +26,6 @@ export type PreCheckoutModalProps = { plan: 'STARTER' | 'PRO' workspaceId: string additionalChats: number - additionalStorage: number currency: 'eur' | 'usd' isYearly: boolean } diff --git a/apps/builder/src/features/billing/components/ProPlanPricingCard.tsx b/apps/builder/src/features/billing/components/ProPlanPricingCard.tsx index 6a725d5f9..29bafea25 100644 --- a/apps/builder/src/features/billing/components/ProPlanPricingCard.tsx +++ b/apps/builder/src/features/billing/components/ProPlanPricingCard.tsx @@ -23,8 +23,6 @@ import { computePrice, formatPrice, getChatsLimit, - getStorageLimit, - storageLimit, } from '@typebot.io/lib/pricing' import { FeaturesList } from './FeaturesList' import { MoreInfoTooltip } from '@/components/MoreInfoTooltip' @@ -35,7 +33,6 @@ type Props = { workspace: Pick< Workspace, | 'additionalChatsIndex' - | 'additionalStorageIndex' | 'plan' | 'customChatsLimit' | 'customStorageLimit' @@ -80,25 +77,18 @@ export const ProPlanPricingCard = ({ return } setSelectedChatsLimitIndex(workspace.additionalChatsIndex ?? 0) - setSelectedStorageLimitIndex(workspace.additionalStorageIndex ?? 0) }, [ selectedChatsLimitIndex, selectedStorageLimitIndex, workspace.additionalChatsIndex, - workspace.additionalStorageIndex, workspace?.plan, ]) const workspaceChatsLimit = workspace ? getChatsLimit(workspace) : undefined - const workspaceStorageLimit = workspace - ? getStorageLimit(workspace) - : undefined const isCurrentPlan = chatsLimit[Plan.PRO].graduatedPrice[selectedChatsLimitIndex ?? 0] .totalIncluded === workspaceChatsLimit && - storageLimit[Plan.PRO].graduatedPrice[selectedStorageLimitIndex ?? 0] - .totalIncluded === workspaceStorageLimit && isYearly === currentSubscription?.isYearly const getButtonLabel = () => { @@ -110,10 +100,7 @@ export const ProPlanPricingCard = ({ if (workspace?.plan === Plan.PRO) { if (isCurrentPlan) return scopedT('upgradeButton.current') - if ( - selectedChatsLimitIndex !== workspace.additionalChatsIndex || - selectedStorageLimitIndex !== workspace.additionalStorageIndex - ) + if (selectedChatsLimitIndex !== workspace.additionalChatsIndex) return t('update') } return t('upgrade') @@ -135,7 +122,6 @@ export const ProPlanPricingCard = ({ computePrice( Plan.PRO, selectedChatsLimitIndex ?? 0, - selectedStorageLimitIndex ?? 0, isYearly ? 'yearly' : 'monthly' ) ?? NaN @@ -238,40 +224,6 @@ export const ProPlanPricingCard = ({ {scopedT('chatsTooltip')} , - - - - } - size="sm" - isLoading={selectedStorageLimitIndex === undefined} - > - {selectedStorageLimitIndex !== undefined - ? parseNumberWithCommas( - storageLimit.PRO.graduatedPrice[ - selectedStorageLimitIndex - ].totalIncluded - ) - : undefined} - - - {storageLimit.PRO.graduatedPrice.map((price, index) => ( - setSelectedStorageLimitIndex(index)} - > - {parseNumberWithCommas(price.totalIncluded)} - - ))} - - {' '} - {scopedT('storageLimit')} - - - {scopedT('storageLimitTooltip')} - - , scopedT('pro.customDomains'), scopedT('pro.analytics'), ]} diff --git a/apps/builder/src/features/billing/components/StarterPlanPricingCard.tsx b/apps/builder/src/features/billing/components/StarterPlanPricingCard.tsx index 039a0aad3..f26256fb5 100644 --- a/apps/builder/src/features/billing/components/StarterPlanPricingCard.tsx +++ b/apps/builder/src/features/billing/components/StarterPlanPricingCard.tsx @@ -19,8 +19,6 @@ import { computePrice, formatPrice, getChatsLimit, - getStorageLimit, - storageLimit, } from '@typebot.io/lib/pricing' import { FeaturesList } from './FeaturesList' import { MoreInfoTooltip } from '@/components/MoreInfoTooltip' @@ -31,7 +29,6 @@ type Props = { workspace: Pick< Workspace, | 'additionalChatsIndex' - | 'additionalStorageIndex' | 'plan' | 'customChatsLimit' | 'customStorageLimit' @@ -76,25 +73,18 @@ export const StarterPlanPricingCard = ({ return } setSelectedChatsLimitIndex(workspace.additionalChatsIndex ?? 0) - setSelectedStorageLimitIndex(workspace.additionalStorageIndex ?? 0) }, [ selectedChatsLimitIndex, selectedStorageLimitIndex, workspace.additionalChatsIndex, - workspace.additionalStorageIndex, workspace?.plan, ]) const workspaceChatsLimit = workspace ? getChatsLimit(workspace) : undefined - const workspaceStorageLimit = workspace - ? getStorageLimit(workspace) - : undefined const isCurrentPlan = chatsLimit[Plan.STARTER].graduatedPrice[selectedChatsLimitIndex ?? 0] .totalIncluded === workspaceChatsLimit && - storageLimit[Plan.STARTER].graduatedPrice[selectedStorageLimitIndex ?? 0] - .totalIncluded === workspaceStorageLimit && isYearly === currentSubscription?.isYearly const getButtonLabel = () => { @@ -109,7 +99,6 @@ export const StarterPlanPricingCard = ({ if ( selectedChatsLimitIndex !== workspace.additionalChatsIndex || - selectedStorageLimitIndex !== workspace.additionalStorageIndex || isYearly !== currentSubscription?.isYearly ) return t('update') @@ -133,7 +122,6 @@ export const StarterPlanPricingCard = ({ computePrice( Plan.STARTER, selectedChatsLimitIndex ?? 0, - selectedStorageLimitIndex ?? 0, isYearly ? 'yearly' : 'monthly' ) ?? NaN @@ -185,40 +173,6 @@ export const StarterPlanPricingCard = ({ {scopedT('chatsTooltip')} , - - - - } - size="sm" - isLoading={selectedStorageLimitIndex === undefined} - > - {selectedStorageLimitIndex !== undefined - ? parseNumberWithCommas( - storageLimit.STARTER.graduatedPrice[ - selectedStorageLimitIndex - ].totalIncluded - ) - : undefined} - - - {storageLimit.STARTER.graduatedPrice.map((price, index) => ( - setSelectedStorageLimitIndex(index)} - > - {parseNumberWithCommas(price.totalIncluded)} - - ))} - - {' '} - {scopedT('storageLimit')} - - - {scopedT('storageLimitTooltip')} - - , scopedT('starter.brandingRemoved'), scopedT('starter.fileUploadBlock'), scopedT('starter.createFolders'), diff --git a/apps/builder/src/features/billing/helpers/parseSubscriptionItems.ts b/apps/builder/src/features/billing/helpers/parseSubscriptionItems.ts index ba8911c9e..276460bde 100644 --- a/apps/builder/src/features/billing/helpers/parseSubscriptionItems.ts +++ b/apps/builder/src/features/billing/helpers/parseSubscriptionItems.ts @@ -1,10 +1,9 @@ -import { getChatsLimit, getStorageLimit } from '@typebot.io/lib/pricing' +import { getChatsLimit } from '@typebot.io/lib/pricing' import { priceIds } from '@typebot.io/lib/api/pricing' export const parseSubscriptionItems = ( plan: 'STARTER' | 'PRO', additionalChats: number, - additionalStorage: number, isYearly: boolean ) => { const frequency = isYearly ? 'yearly' : 'monthly' @@ -13,33 +12,18 @@ export const parseSubscriptionItems = ( price: priceIds[plan].base[frequency], quantity: 1, }, - ] - .concat( - additionalChats > 0 - ? [ - { - price: priceIds[plan].chats[frequency], - quantity: getChatsLimit({ - plan, - additionalChatsIndex: additionalChats, - customChatsLimit: null, - }), - }, - ] - : [] - ) - .concat( - additionalStorage > 0 - ? [ - { - price: priceIds[plan].storage[frequency], - quantity: getStorageLimit({ - plan, - additionalStorageIndex: additionalStorage, - customStorageLimit: null, - }), - }, - ] - : [] - ) + ].concat( + additionalChats > 0 + ? [ + { + price: priceIds[plan].chats[frequency], + quantity: getChatsLimit({ + plan, + additionalChatsIndex: additionalChats, + customChatsLimit: null, + }), + }, + ] + : [] + ) } diff --git a/apps/builder/src/features/dashboard/components/DashboardPage.tsx b/apps/builder/src/features/dashboard/components/DashboardPage.tsx index 58417781a..428617b36 100644 --- a/apps/builder/src/features/dashboard/components/DashboardPage.tsx +++ b/apps/builder/src/features/dashboard/components/DashboardPage.tsx @@ -33,11 +33,10 @@ export const DashboardPage = () => { }) useEffect(() => { - const { subscribePlan, chats, storage, isYearly, claimCustomPlan } = + const { subscribePlan, chats, isYearly, claimCustomPlan } = router.query as { subscribePlan: Plan | undefined chats: string | undefined - storage: string | undefined isYearly: string | undefined claimCustomPlan: string | undefined } @@ -55,7 +54,6 @@ export const DashboardPage = () => { plan: subscribePlan as 'PRO' | 'STARTER', workspaceId: workspace.id, additionalChats: chats ? parseInt(chats) : 0, - additionalStorage: storage ? parseInt(storage) : 0, currency: guessIfUserIsEuropean() ? 'eur' : 'usd', isYearly: isYearly === 'false' ? false : true, }) diff --git a/apps/builder/src/pages/api/stripe/webhook.ts b/apps/builder/src/pages/api/stripe/webhook.ts index e27969427..0072c406b 100644 --- a/apps/builder/src/pages/api/stripe/webhook.ts +++ b/apps/builder/src/pages/api/stripe/webhook.ts @@ -47,15 +47,13 @@ const webhookHandler = async (req: NextApiRequest, res: NextApiResponse) => { | { plan: 'STARTER' | 'PRO' additionalChats: string - additionalStorage: string workspaceId: string userId: string } | { claimableCustomPlanId: string; userId: string } if ('plan' in metadata) { - const { workspaceId, plan, additionalChats, additionalStorage } = - metadata - if (!workspaceId || !plan || !additionalChats || !additionalStorage) + const { workspaceId, plan, additionalChats } = metadata + if (!workspaceId || !plan || !additionalChats) return res .status(500) .send({ message: `Couldn't retrieve valid metadata` }) @@ -65,7 +63,6 @@ const webhookHandler = async (req: NextApiRequest, res: NextApiResponse) => { plan, stripeId: session.customer as string, additionalChatsIndex: parseInt(additionalChats), - additionalStorageIndex: parseInt(additionalStorage), isQuarantined: false, }, include: { @@ -88,7 +85,6 @@ const webhookHandler = async (req: NextApiRequest, res: NextApiResponse) => { data: { plan, additionalChatsIndex: parseInt(additionalChats), - additionalStorageIndex: parseInt(additionalStorage), }, }, ]) @@ -124,7 +120,6 @@ const webhookHandler = async (req: NextApiRequest, res: NextApiResponse) => { data: { plan: Plan.CUSTOM, additionalChatsIndex: 0, - additionalStorageIndex: 0, }, }, ]) @@ -154,7 +149,6 @@ const webhookHandler = async (req: NextApiRequest, res: NextApiResponse) => { data: { plan: Plan.FREE, additionalChatsIndex: 0, - additionalStorageIndex: 0, customChatsLimit: null, customStorageLimit: null, customSeatsLimit: null, @@ -179,7 +173,6 @@ const webhookHandler = async (req: NextApiRequest, res: NextApiResponse) => { data: { plan: Plan.FREE, additionalChatsIndex: 0, - additionalStorageIndex: 0, }, }, ]) diff --git a/apps/builder/src/test/utils/databaseActions.ts b/apps/builder/src/test/utils/databaseActions.ts index bf642c697..d3872168d 100644 --- a/apps/builder/src/test/utils/databaseActions.ts +++ b/apps/builder/src/test/utils/databaseActions.ts @@ -18,10 +18,7 @@ const stripe = new Stripe(env.STRIPE_SECRET_KEY ?? '', { export const addSubscriptionToWorkspace = async ( workspaceId: string, items: Stripe.SubscriptionCreateParams.Item[], - metadata: Pick< - Workspace, - 'additionalChatsIndex' | 'additionalStorageIndex' | 'plan' - > + metadata: Pick ) => { const { id: stripeId } = await stripe.customers.create({ email: 'test-user@gmail.com', diff --git a/apps/docs/openapi/builder/_spec_.json b/apps/docs/openapi/builder/_spec_.json index f8c4fa53e..e4cff484d 100644 --- a/apps/docs/openapi/builder/_spec_.json +++ b/apps/docs/openapi/builder/_spec_.json @@ -232,15 +232,11 @@ }, "additionalChatsIndex": { "type": "number" - }, - "additionalStorageIndex": { - "type": "number" } }, "required": [ "plan", - "additionalChatsIndex", - "additionalStorageIndex" + "additionalChatsIndex" ], "additionalProperties": false } @@ -320,21 +316,13 @@ "chatsLimit": { "type": "number" }, - "storageLimit": { - "type": "number" - }, "totalChatsUsed": { "type": "number" - }, - "totalStorageUsed": { - "type": "number" } }, "required": [ "chatsLimit", - "storageLimit", - "totalChatsUsed", - "totalStorageUsed" + "totalChatsUsed" ], "additionalProperties": false } @@ -30391,9 +30379,6 @@ "additionalChats": { "type": "number" }, - "additionalStorage": { - "type": "number" - }, "vat": { "type": "object", "properties": { @@ -30422,7 +30407,6 @@ "plan", "returnUrl", "additionalChats", - "additionalStorage", "isYearly" ], "additionalProperties": false @@ -30492,9 +30476,6 @@ "additionalChats": { "type": "number" }, - "additionalStorage": { - "type": "number" - }, "currency": { "type": "string", "enum": [ @@ -30511,7 +30492,6 @@ "workspaceId", "plan", "additionalChats", - "additionalStorage", "currency", "isYearly" ], @@ -30767,14 +30747,10 @@ "properties": { "totalChatsUsed": { "type": "number" - }, - "totalStorageUsed": { - "type": "number" } }, "required": [ - "totalChatsUsed", - "totalStorageUsed" + "totalChatsUsed" ], "additionalProperties": false } diff --git a/apps/landing-page/components/PricingPage/PlanComparisonTables.tsx b/apps/landing-page/components/PricingPage/PlanComparisonTables.tsx index fe6ec5a05..a6f61cb96 100644 --- a/apps/landing-page/components/PricingPage/PlanComparisonTables.tsx +++ b/apps/landing-page/components/PricingPage/PlanComparisonTables.tsx @@ -24,7 +24,6 @@ import { formatPrice, prices, seatsLimit, - storageLimit, } from '@typebot.io/lib/pricing' import { parseNumberWithCommas } from '@typebot.io/lib' @@ -85,22 +84,6 @@ export const PlanComparisonTables = () => ( 2 GB 10 GB - - Additional Storage - - - {formatPrice(storageLimit.STARTER.graduatedPrice[1].price)} per{' '} - {storageLimit.STARTER.graduatedPrice[1].totalIncluded - - storageLimit.STARTER.graduatedPrice[0].totalIncluded}{' '} - GB - - - {formatPrice(storageLimit.PRO.graduatedPrice[1].price)} per{' '} - {storageLimit.PRO.graduatedPrice[1].totalIncluded - - storageLimit.PRO.graduatedPrice[0].totalIncluded}{' '} - GB - - Members Just you diff --git a/apps/landing-page/components/PricingPage/ProPlanCard.tsx b/apps/landing-page/components/PricingPage/ProPlanCard.tsx index 64ffc00f0..3f95a337f 100644 --- a/apps/landing-page/components/PricingPage/ProPlanCard.tsx +++ b/apps/landing-page/components/PricingPage/ProPlanCard.tsx @@ -15,12 +15,7 @@ import { Plan } from '@typebot.io/prisma' import Link from 'next/link' import React, { useState } from 'react' import { parseNumberWithCommas } from '@typebot.io/lib' -import { - chatsLimit, - computePrice, - seatsLimit, - storageLimit, -} from '@typebot.io/lib/pricing' +import { chatsLimit, computePrice, seatsLimit } from '@typebot.io/lib/pricing' import { PricingCard } from './PricingCard' type Props = { @@ -30,14 +25,11 @@ type Props = { export const ProPlanCard = ({ isYearly }: Props) => { const [selectedChatsLimitIndex, setSelectedChatsLimitIndex] = useState(0) - const [selectedStorageLimitIndex, setSelectedStorageLimitIndex] = - useState(0) const price = computePrice( Plan.PRO, selectedChatsLimitIndex ?? 0, - selectedStorageLimitIndex ?? 0, isYearly ? 'yearly' : 'monthly' ) ?? NaN @@ -93,46 +85,6 @@ export const ProPlanCard = ({ isYearly }: Props) => { , - - - } - size="sm" - variant="outline" - isLoading={selectedStorageLimitIndex === undefined} - > - {selectedStorageLimitIndex !== undefined - ? parseNumberWithCommas( - storageLimit.PRO.graduatedPrice[selectedStorageLimitIndex] - .totalIncluded - ) - : undefined} - - - {storageLimit.PRO.graduatedPrice.map((price, index) => ( - setSelectedStorageLimitIndex(index)} - > - {parseNumberWithCommas(price.totalIncluded)} - - ))} - - {' '} - GB of storage - - - - - - , 'Custom domains', 'In-depth analytics', ], @@ -142,7 +94,7 @@ export const ProPlanCard = ({ isYearly }: Props) => { button={