Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

refactor(pricing): remove A/B experiment logic and consolidate pricing components (#44205)

Mert YEREKAPANf8815aff9b26
diff --git a/apps/www/app/pricing/PricingContent.tsx b/apps/www/app/pricing/PricingContent.tsx
index 9402a4ec3fc..9be45b941f3 100644
--- a/apps/www/app/pricing/PricingContent.tsx
+++ b/apps/www/app/pricing/PricingContent.tsx
@@ -4,20 +4,13 @@ import { ArrowDownIcon } from '@heroicons/react/outline'
import DefaultLayout from '~/components/Layouts/Default'
import PricingPlans from '~/components/Pricing/PricingPlans'
import { useOrganizations } from '~/data/organizations'
-import { hasConsented, posthogClient } from 'common'
import { ArrowUpRight } from 'lucide-react'
import dynamic from 'next/dynamic'
import { usePathname } from 'next/navigation'
-import { useEffect, useState } from 'react'
+import { useEffect } from 'react'
import { Button } from 'ui'
import { InfoTooltip } from 'ui-patterns/info-tooltip'
-const EXPERIMENT_ID = 'pricingCalculatorExperiment' as const
-type PricingCalculatorVariant = 'control' | 'test'
-
-const NewPricingComputeSection = dynamic(
- () => import('~/components/Pricing/NewPricingComputeSection')
-)
const PricingComputeSection = dynamic(() => import('~/components/Pricing/PricingComputeSection'))
const PricingAddons = dynamic(() => import('~/components/Pricing/PricingAddons'))
const PricingComparisonTable = dynamic(() => import('~/components/Pricing/PricingComparisonTable'))
@@ -52,30 +45,6 @@ export default function PricingContent() {
const { isLoading, organizations } = useOrganizations()
const hasExistingOrganizations = !isLoading && organizations.length > 0
- // Pricing calculator A/B experiment
- // Uses client-side PostHog directly — server-side evaluation lacks full person context for www pages.
- // DevToolbar overrides (x-ph-flag-overrides cookie) are respected in local dev via posthogClient.getFeatureFlag.
- const [flagValue, setFlagValue] = useState<PricingCalculatorVariant | false | undefined>(
- () =>
- posthogClient.getFeatureFlag(EXPERIMENT_ID) as PricingCalculatorVariant | false | undefined
- )
-
- useEffect(() => {
- return posthogClient.onFeatureFlags(() => {
- const value = posthogClient.getFeatureFlag(EXPERIMENT_ID)
- setFlagValue(value as PricingCalculatorVariant | false | undefined)
- })
- }, [])
-
- const isTestVariant = flagValue === 'test'
- const isInExperiment = flagValue === 'control' || flagValue === 'test'
-
- useEffect(() => {
- if (!isInExperiment) return
-
- posthogClient.captureExperimentExposure(EXPERIMENT_ID, { variant: flagValue }, hasConsented())
- }, [isInExperiment, flagValue])
-
return (
<DefaultLayout>
<div className="relative z-10 pt-8 pb-4 xl:py-16">
@@ -119,27 +88,25 @@ export default function PricingContent() {
id="addon-compute"
className="container relative mx-auto px-4 lg:px-12 pt-16 md:pt-24 lg:pt-32 lg:pb-16"
>
- {isTestVariant && (
- <div className="text-center mb-8 lg:mb-16">
- <h2 className="text-foreground text-3xl" id="how-compute-pricing-works">
- How compute pricing works
- </h2>
- <p className="text-foreground-light mt-4 text-lg mb-4">
- Choose a plan, add projects, and see your total cost
- </p>
- <div className="flex items-center justify-center gap-1">
- <span className="py-1 px-3 bg-surface-100 flex items-center gap-1 border rounded-full text-xs text-foreground-lighter">
- What is &ldquo;compute&rdquo;?
- <InfoTooltip side="bottom" className="max-w-[280px]">
- Think of compute as the computer your database runs on. As your app grows, you
- scale CPU and memory to handle more traffic and data.
- </InfoTooltip>
- </span>
- </div>
+ <div className="text-center mb-8 lg:mb-16">
+ <h2 className="text-foreground text-3xl" id="how-compute-pricing-works">
+ How compute pricing works
+ </h2>
+ <p className="text-foreground-light mt-4 text-lg mb-4">
+ Choose a plan, add projects, and see your total cost
+ </p>
+ <div className="flex items-center justify-center gap-1">
+ <span className="py-1 px-3 bg-surface-100 flex items-center gap-1 border rounded-full text-xs text-foreground-lighter">
+ What is &ldquo;compute&rdquo;?
+ <InfoTooltip side="bottom" className="max-w-[280px]">
+ Think of compute as the computer your database runs on. As your app grows, you scale
+ CPU and memory to handle more traffic and data.
+ </InfoTooltip>
+ </span>
</div>
- )}
+ </div>
- {isTestVariant ? <NewPricingComputeSection /> : <PricingComputeSection />}
+ <PricingComputeSection />
</div>
<div
diff --git a/apps/www/components/Pricing/ComputePricingCalculator.tsx b/apps/www/components/Pricing/ComputePricingCalculator.tsx
index 9239e75c9f8..f090a93000e 100644
--- a/apps/www/components/Pricing/ComputePricingCalculator.tsx
+++ b/apps/www/components/Pricing/ComputePricingCalculator.tsx
@@ -1,58 +1,60 @@
-'use client'
-
-import { InformationCircleIcon } from '@heroicons/react/outline'
-import { ChevronDown, Plus, Trash2 } from 'lucide-react'
+import pricingAddOn from '~/data/PricingAddOnTable.json'
+import { Plus, Trash2 } from 'lucide-react'
import { useEffect, useState } from 'react'
-import {
- Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- Slider_Shadcn_,
- cn,
-} from 'ui'
+import { plans as allPlans } from 'shared-data/plans'
+import { Button, cn, Slider_Shadcn_ } from 'ui'
import { ComputeBadge } from 'ui-patterns/ComputeBadge'
import { InfoTooltip } from 'ui-patterns/info-tooltip'
-import pricingAddOn from '~/data/PricingAddOnTable.json'
+import { ToggleGroup, ToggleGroupItem } from 'ui/src/components/shadcn/ui/toggle-group'
-const plans = [
- {
- name: 'Pro',
- price: 25,
- },
- {
- name: 'Team',
- price: 599,
- },
-]
+const STANDALONE_PLANS = allPlans
+ .filter((plan) => plan.planId === 'pro' || plan.planId === 'team')
+ .map((plan) => ({ name: plan.name, price: plan.priceMonthly as number }))
-const findIntanceValueByColumn = (instance: any, column: string) =>
+const findInstanceValueByColumn = (instance: any, column: string) =>
instance.columns?.find((col: any) => col.key === column)?.value
-const parsePrice = (price: string) => parseInt(price?.toString().replace('$', '').replace(',', ''))
+const parsePrice = (price: string) => {
+ const n = parseInt(price?.toString().replace('$', '').replace(',', ''), 10)
+ return Number.isNaN(n) ? 0 : n
+}
+
+interface ComputePricingCalculatorProps {
+ activePlan?: {
+ name: string
+ price: number
+ }
+ disableInteractivity?: boolean
+}
+
+const ComputePricingCalculator = ({
+ activePlan,
+ disableInteractivity,
+}: ComputePricingCalculatorProps) => {
+ // When activePlan is not provided, manage plan selection internally
+ const [internalPlan, setInternalPlan] = useState(STANDALONE_PLANS[0])
+ const effectivePlan = activePlan ?? internalPlan
+ const isStandalone = activePlan === undefined
-const ComputePricingCalculator = ({ disableInteractivity }: { disableInteractivity?: boolean }) => {
// Filter out rows with no specific pricing
const computeInstances = pricingAddOn.database.rows.filter((row) =>
row.columns.some((it) => it.key === 'pricing' && it.value !== 'Contact Us')
)
const priceSteps = computeInstances.map((instance) =>
- parsePrice(findIntanceValueByColumn(instance, 'pricing'))
+ parsePrice(findInstanceValueByColumn(instance, 'pricing'))
)
// Base discount credits that come with every paid plan
const COMPUTE_CREDITS = 10
- const [activePlan, setActivePlan] = useState(plans[0])
const [activeInstances, setActiveInstances] = useState([{ ...computeInstances[0], position: 0 }])
// Final calculated price: plan cost + compute aggregate - compute credits
- const [activePrice, setActivePrice] = useState(activePlan.price + priceSteps[0] - COMPUTE_CREDITS)
-
- useEffect(() => {
- setActivePrice(activePlan.price + priceSteps[0] - COMPUTE_CREDITS)
- }, [])
+ const [activePrice, setActivePrice] = useState(
+ effectivePlan.price + priceSteps[0] - COMPUTE_CREDITS
+ )
+ const [hasInteractedWithSlider, setHasInteractedWithSlider] = useState(false)
const handleUpdateInstance = (position: number, value: number[]) => {
+ setHasInteractedWithSlider(true)
const newArray = activeInstances.map((activeInstance) => {
// only update the instance corresponding to the correct slider
if (activeInstance.position === position) {
@@ -66,32 +68,26 @@ const ComputePricingCalculator = ({ disableInteractivity }: { disableInteractivi
}
const calculateComputeAggregate = (price: number) => {
- activeInstances.map(
- (activeInstance: any) =>
- (price += parsePrice(findIntanceValueByColumn(activeInstance, 'pricing')))
+ return activeInstances.reduce(
+ (acc, activeInstance: any) =>
+ acc + parsePrice(findInstanceValueByColumn(activeInstance, 'pricing')),
+ price
)
-
- return price
- }
-
- const calculatePrice = () => {
- let aggregatePrice = 0
- const computeAggregate = calculateComputeAggregate(aggregatePrice)
-
- return setActivePrice(computeAggregate + activePlan.price - COMPUTE_CREDITS)
}
useEffect(() => {
- calculatePrice()
- }, [activeInstances, activePlan])
+ const computeAggregate = activeInstances.reduce(
+ (acc, activeInstance: any) =>
+ acc + parsePrice(findInstanceValueByColumn(activeInstance, 'pricing')),
+ 0
+ )
+ setActivePrice(Math.max(0, computeAggregate + effectivePlan.price - COMPUTE_CREDITS))
+ }, [activeInstances, effectivePlan])
const removeInstance = (position: number) => {
const newArray = activeInstances
.filter((activeInstance) => activeInstance.position !== position)
- .map((instance, index) => {
- instance.position = index
- return instance
- })
+ .map((instance, index) => ({ ...instance, position: index }))
setActiveInstances(newArray)
}
@@ -99,135 +95,71 @@ const ComputePricingCalculator = ({ disableInteractivity }: { disableInteractivi
const findSliderComputeValue = (activeInstance: any) => {
// find index of compute based on active compute name
const selectedCompute = computeInstances
- .map((compute) => findIntanceValueByColumn(compute, 'plan'))
- .indexOf(findIntanceValueByColumn(activeInstance, 'plan'))
+ .map((compute) => findInstanceValueByColumn(compute, 'plan'))
+ .indexOf(findInstanceValueByColumn(activeInstance, 'plan'))
return [selectedCompute + 1]
}
- const PriceSummary = () => (
- <div className="flex flex-col gap-1 text-lighter text-right leading-4 w-full border-b pb-1 mb-1">
- <div className="flex items-center justify-between">
- <span className="text-foreground-muted">Plan</span>
- <span className="text-light font-mono" translate="no">
- ${activePlan.price}
- </span>
- </div>
- <div className="flex items-center justify-between">
- <span className="text-foreground-muted">Total Compute</span>
- <span className="text-light font-mono">${calculateComputeAggregate(0)}</span>
- </div>
- <div className="flex items-center justify-between">
- <span className="text-foreground-muted">Compute Credits</span>
- <span className="text-light font-mono" translate="no">
- - ${COMPUTE_CREDITS}
- </span>
- </div>
- </div>
- )
-
return (
- <div className="flex flex-col lg:grid grid-cols-4 gap-4 h-full mt-4 lg:mt-0 border border-strong rounded-xl p-4">
- <div className="flex justify-between w-full">
- <div className="flex flex-col text-lighter leading-4 text-xs w-full gap-4">
- <div className="h-full w-full flex flex-col justify-between">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- size="tiny"
- type="outline"
- iconRight={<ChevronDown />}
- icon={
- activePlan.name === 'Pro' ? (
- <svg
- width="14"
- height="14"
- viewBox="0 0 14 14"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <rect
- x="3.5"
- y="3.5"
- width="6.77393"
- height="6.77393"
- rx="1.5"
- stroke="hsl(var(--foreground-default))"
- />
- <rect
- x="5.55078"
- y="5.55127"
- width="2.67139"
- height="2.67139"
- rx="1.33569"
- stroke="hsl(var(--foreground-muted))"
- />
- </svg>
- ) : (
- <svg
- width="14"
- height="14"
- viewBox="0 0 13 14"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <rect
- x="3.26953"
- y="3.61279"
- width="6.77393"
- height="6.77393"
- rx="1.5"
- stroke="hsl(var(--foreground-muted))"
- />
- <rect
- x="1.08984"
- y="1.43359"
- width="11.1323"
- height="11.1323"
- rx="3.5"
- stroke="hsl(var(--foreground-default))"
- />
- <rect
- x="5.32031"
- y="5.66406"
- width="2.67139"
- height="2.67139"
- rx="1.33569"
- stroke="hsl(var(--foreground-muted))"
- />
- </svg>
- )
- }
- className="w-full pl-1 py-2"
- >
- <div className="lg:min-w-[80px] flex items-center grow w-full gap-1">
- <span className="text-foreground-light">Plan</span>{' '}
- <span>{activePlan.name}</span>
- </div>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent side="bottom" align="start">
- {plans.map((plan: any) => (
- <DropdownMenuItem key={plan.name} onClick={() => setActivePlan(plan)}>
- {plan.name}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- <div>
- <PriceSummary />
- <div className="flex items-center gap-1 w-full justify-between">
- <span>Total Estimate</span>
- <span className="text-foreground font-mono flex items-center gap-1">
- <InfoTooltip side="top" className="max-w-[250px]">
- This estimate only includes Plan and Compute add-on monthly costs. Other resources
- might concur in the final invoice.
- </InfoTooltip>
- ${activePrice}
+ <div className="flex flex-col lg:grid grid-cols-4 gap-4 border border-strong rounded-xl p-4">
+ <div className="flex flex-col text-lighter leading-4 text-xs w-full gap-4">
+ {isStandalone && (
+ <ToggleGroup
+ type="single"
+ value={internalPlan.name}
+ onValueChange={(value) => {
+ const selected = STANDALONE_PLANS.find((p) => p.name === value)
+ if (selected) setInternalPlan(selected)
+ }}
+ className="grid grid-cols-2 gap-1 w-full bg-surface-200 rounded-md"
+ >
+ {STANDALONE_PLANS.map((plan) => (
+ <ToggleGroupItem
+ key={plan.name}
+ value={plan.name}
+ className={cn(
+ 'w-full h-6 border-transparent',
+ internalPlan.name === plan.name
+ ? 'bg-surface-200 text-foreground data-[state=on]:bg-surface-400 data-[state=on]:text-foreground'
+ : 'hover:bg-surface-200'
+ )}
+ >
+ {plan.name}
+ </ToggleGroupItem>
+ ))}
+ </ToggleGroup>
+ )}
+ <div>
+ <p className="text-foreground-light text-xs mb-2">Monthly estimate:</p>
+ <div className="flex flex-col gap-1 text-lighter text-right leading-4 w-full border-b pb-1 mb-1">
+ <div className="flex items-center justify-between">
+ <span className="text-foreground-muted">Plan subscription</span>
+ <span className="text-light font-mono" translate="no">
+ ${effectivePlan.price}
+ </span>
+ </div>
+ <div className="flex items-center justify-between">
+ <span className="text-foreground-muted">Total Compute</span>
+ <span className="text-light font-mono">${calculateComputeAggregate(0)}</span>
+ </div>
+ <div className="flex items-center justify-between">
+ <span className="text-foreground-muted">Compute Credits</span>
+ <span className="text-light font-mono" translate="no">
+ - ${COMPUTE_CREDITS}
</span>
</div>
</div>
+ <div className="flex items-center gap-1 w-full justify-between">
+ <span>Total</span>
+ <span className="text-foreground font-mono flex items-center gap-1">
+ <InfoTooltip side="top" className="max-w-[250px]">
+ This estimate only includes Plan and Compute add-on monthly costs. Other resources
+ might incur additional costs in the final invoice.
+ </InfoTooltip>
+ ${activePrice}
+ </span>
+ </div>
</div>
</div>
<div className="flex flex-col gap-2 col-span-3 items-start flex-1 w-full lg:w-auto lg:border-l lg:pl-4">
@@ -245,32 +177,42 @@ const ComputePricingCalculator = ({ disableInteractivity }: { disableInteractivi
<div className="w-full flex justify-between items-center">
<div className="flex items-center gap-2">
<ComputeBadge
- infraComputeSize={findIntanceValueByColumn(activeInstance, 'plan')}
+ infraComputeSize={findInstanceValueByColumn(activeInstance, 'plan')}
/>
<p className="text-xs text-foreground-lighter">
Project {activeInstance.position + 1}
</p>
</div>
<span className="leading-3 text-sm" translate="no">
- {findIntanceValueByColumn(activeInstance, 'pricing')}
+ {findInstanceValueByColumn(activeInstance, 'pricing')}
</span>
</div>
- <Slider_Shadcn_
- onValueChange={(value) => handleUpdateInstance(activeInstance.position, value)}
- value={findSliderComputeValue(activeInstance)}
- min={1}
- key={`${index}-${activeInstance.position}`}
- max={priceSteps.length}
- step={1}
- className="w-full mt-1"
- />
+ <div className="w-full relative">
+ {!hasInteractedWithSlider && (
+ <label className="absolute -top-2 left-6 text-xs text-foreground-muted pointer-events-none bg-surface-300 px-1 py-0.5 rounded-md z-10 flex items-center gap-1">
+ Drag to adjust
+ </label>
+ )}
+ <Slider_Shadcn_
+ onValueChange={(value) => handleUpdateInstance(activeInstance.position, value)}
+ value={findSliderComputeValue(activeInstance)}
+ min={1}
+ key={`${index}-${activeInstance.position}`}
+ max={priceSteps.length}
+ step={1}
+ className={cn(
+ 'w-full cursor-grab active:cursor-grabbing',
+ !hasInteractedWithSlider && "[&_[data-slot='slider-thumb']]:animate-pulse"
+ )}
+ />
+ </div>
<div className="flex items-center justify-between text-sm">
<div className="w-full flex items-center gap-2">
<span className="text-lighter text-xs md:text-[13px]">
- {findIntanceValueByColumn(activeInstance, 'memory')} RAM /{' '}
- {findIntanceValueByColumn(activeInstance, 'cpu')} CPU / Connections: Direct{' '}
- {findIntanceValueByColumn(activeInstance, 'directConnections')}, Pooler{' '}
- {findIntanceValueByColumn(activeInstance, 'poolerConnections')}
+ {findInstanceValueByColumn(activeInstance, 'memory')} RAM /{' '}
+ {findInstanceValueByColumn(activeInstance, 'cpu')} CPU / Connections: Direct{' '}
+ {findInstanceValueByColumn(activeInstance, 'directConnections')}, Pooler{' '}
+ {findInstanceValueByColumn(activeInstance, 'poolerConnections')}
</span>
</div>
<div className="flex items-center gap-2">
@@ -289,11 +231,10 @@ const ComputePricingCalculator = ({ disableInteractivity }: { disableInteractivi
</div>
))}
</div>
- <div className="w-full">
+ <div className="text-right w-full">
<Button
size="tiny"
- type="outline"
- block
+ type="primary"
icon={<Plus />}
onClick={() => {
if (disableInteractivity) return
@@ -302,9 +243,8 @@ const ComputePricingCalculator = ({ disableInteractivity }: { disableInteractivi
{ ...computeInstances[0], position: activeInstances.length },
])
}}
- className="w-full border-dashed text-foreground-light hover:text-foreground"
>
- <span className="w-full text-left">Add Project</span>
+ <span className="text-left">Add Project</span>
</Button>
</div>
</div>
diff --git a/apps/www/components/Pricing/NewComputePricingCalculator.tsx b/apps/www/components/Pricing/NewComputePricingCalculator.tsx
deleted file mode 100644
index fc5c30be38a..00000000000
--- a/apps/www/components/Pricing/NewComputePricingCalculator.tsx
+++ /dev/null
@@ -1,209 +0,0 @@
-import pricingAddOn from '~/data/PricingAddOnTable.json'
-import { Plus, Trash2 } from 'lucide-react'
-import { useEffect, useState } from 'react'
-import { Button, cn, Slider_Shadcn_ } from 'ui'
-import { ComputeBadge } from 'ui-patterns/ComputeBadge'
-import { InfoTooltip } from 'ui-patterns/info-tooltip'
-
-const findInstanceValueByColumn = (instance: any, column: string) =>
- instance.columns?.find((col: any) => col.key === column)?.value
-
-const parsePrice = (price: string) => {
- const n = parseInt(price?.toString().replace('$', '').replace(',', ''), 10)
- return Number.isNaN(n) ? 0 : n
-}
-
-interface ComputePricingCalculatorProps {
- activePlan?: {
- name: string
- price: number
- }
-}
-
-const NewComputePricingCalculator = ({
- activePlan = { name: 'Pro', price: 25 },
-}: ComputePricingCalculatorProps) => {
- // Filter out rows with no specific pricing
- const computeInstances = pricingAddOn.database.rows.filter((row) =>
- row.columns.some((it) => it.key === 'pricing' && it.value !== 'Contact Us')
- )
- const priceSteps = computeInstances.map((instance) =>
- parsePrice(findInstanceValueByColumn(instance, 'pricing'))
- )
- // Base discount credits that come with every paid plan
- const COMPUTE_CREDITS = 10
-
- const [activeInstances, setActiveInstances] = useState([{ ...computeInstances[0], position: 0 }])
- // Final calculated price: plan cost + compute aggregate - compute credits
- const [activePrice, setActivePrice] = useState(activePlan.price + priceSteps[0] - COMPUTE_CREDITS)
- const [hasInteractedWithSlider, setHasInteractedWithSlider] = useState(false)
-
- const handleUpdateInstance = (position: number, value: number[]) => {
- setHasInteractedWithSlider(true)
- const newArray = activeInstances.map((activeInstance) => {
- // only update the instance corresponding to the correct slider
- if (activeInstance.position === position) {
- return { ...computeInstances[value[0] - 1], position }
- } else {
- return activeInstance
- }
- })
-
- setActiveInstances(newArray)
- }
-
- const calculateComputeAggregate = (price: number) => {
- return activeInstances.reduce(
- (acc, activeInstance: any) =>
- acc + parsePrice(findInstanceValueByColumn(activeInstance, 'pricing')),
- price
- )
- }
-
- useEffect(() => {
- const computeAggregate = calculateComputeAggregate(0)
- setActivePrice(Math.max(0, computeAggregate + activePlan.price - COMPUTE_CREDITS))
- }, [activeInstances, activePlan])
-
- const removeInstance = (position: number) => {
- const newArray = activeInstances
- .filter((activeInstance) => activeInstance.position !== position)
- .map((instance, index) => ({ ...instance, position: index }))
-
- setActiveInstances(newArray)
- }
-
- const findSliderComputeValue = (activeInstance: any) => {
- // find index of compute based on active compute name
- const selectedCompute = computeInstances
- .map((compute) => findInstanceValueByColumn(compute, 'plan'))
- .indexOf(findInstanceValueByColumn(activeInstance, 'plan'))
-
- return [selectedCompute + 1]
- }
-
- return (
- <div className="flex flex-col lg:grid grid-cols-4 gap-4 border border-strong rounded-xl p-4">
- <div className="flex flex-col text-lighter leading-4 text-xs w-full gap-4">
- <div>
- <p className="text-foreground-light text-xs mb-2">Monthly estimate:</p>
- <div className="flex flex-col gap-1 text-lighter text-right leading-4 w-full border-b pb-1 mb-1">
- <div className="flex items-center justify-between">
- <span className="text-foreground-muted">Plan subscription</span>
- <span className="text-light font-mono" translate="no">
- ${activePlan.price}
- </span>
- </div>
- <div className="flex items-center justify-between">
- <span className="text-foreground-muted">Total Compute</span>
- <span className="text-light font-mono">${calculateComputeAggregate(0)}</span>
- </div>
- <div className="flex items-center justify-between">
- <span className="text-foreground-muted">Compute Credits</span>
- <span className="text-light font-mono" translate="no">
- - ${COMPUTE_CREDITS}
- </span>
- </div>
- </div>
- <div className="flex items-center gap-1 w-full justify-between">
- <span>Total</span>
- <span className="text-foreground font-mono flex items-center gap-1">
- <InfoTooltip side="top" className="max-w-[250px]">
- This estimate only includes Plan and Compute add-on monthly costs. Other resources
- might incur additional costs in the final invoice.
- </InfoTooltip>
- ${activePrice}
- </span>
- </div>
- </div>
- </div>
- <div className="flex flex-col gap-2 col-span-3 items-start flex-1 w-full lg:w-auto lg:border-l lg:pl-4">
- <div
- className={cn(
- 'w-full flex flex-col items-start gap-y-2',
- activeInstances.length === 1 && 'border-none'
- )}
- >
- {activeInstances.map((activeInstance, index) => (
- <div
- className="group w-full flex flex-col gap-3 p-3 bg-surface-200 rounded border"
- key={`instance-${index}`}
- >
- <div className="w-full flex justify-between items-center">
- <div className="flex items-center gap-2">
- <ComputeBadge
- infraComputeSize={findInstanceValueByColumn(activeInstance, 'plan')}
- />
- <p className="text-xs text-foreground-lighter">
- Project {activeInstance.position + 1}
- </p>
- </div>
- <span className="leading-3 text-sm" translate="no">
- {findInstanceValueByColumn(activeInstance, 'pricing')}
- </span>
- </div>
- <div className="w-full relative">
- {!hasInteractedWithSlider && (
- <label className="absolute -top-2 left-6 text-xs text-foreground-muted pointer-events-none bg-surface-300 px-1 py-0.5 rounded-md z-10 flex items-center gap-1">
- Drag to adjust
- </label>
- )}
- <Slider_Shadcn_
- onValueChange={(value) => handleUpdateInstance(activeInstance.position, value)}
- value={findSliderComputeValue(activeInstance)}
- min={1}
- key={`${index}-${activeInstance.position}`}
- max={priceSteps.length}
- step={1}
- className={cn(
- 'w-full cursor-grab active:cursor-grabbing',
- !hasInteractedWithSlider && "[&_[data-slot='slider-thumb']]:animate-pulse"
- )}
- />
- </div>
- <div className="flex items-center justify-between text-sm">
- <div className="w-full flex items-center gap-2">
- <span className="text-lighter text-xs md:text-[13px]">
- {findInstanceValueByColumn(activeInstance, 'memory')} RAM /{' '}
- {findInstanceValueByColumn(activeInstance, 'cpu')} CPU / Connections: Direct{' '}
- {findInstanceValueByColumn(activeInstance, 'directConnections')}, Pooler{' '}
- {findInstanceValueByColumn(activeInstance, 'poolerConnections')}
- </span>
- </div>
- <div className="flex items-center gap-2">
- {activeInstances.length > 1 && (
- <button
- aria-label="Remove item"
- title="Remove item"
- className="p-1 text-lighter hover:text-foreground rounded opacity-0 group-hover:opacity-100 transition-opacity"
- onClick={() => removeInstance(activeInstance.position)}
- >
- <Trash2 className="w-3 h-3" />
- </button>
- )}
- </div>
- </div>
- </div>
- ))}
- </div>
- <div className="text-right w-full">
- <Button
- size="tiny"
- type="primary"
- icon={<Plus />}
- onClick={() => {
- setActiveInstances([
- ...activeInstances,
- { ...computeInstances[0], position: activeInstances.length },
- ])
- }}
- >
- <span className="text-left">Add Project</span>
- </Button>
- </div>
- </div>
- </div>
- )
-}
-
-export default NewComputePricingCalculator
diff --git a/apps/www/components/Pricing/NewPricingComputeSection.tsx b/apps/www/components/Pricing/NewPricingComputeSection.tsx
deleted file mode 100644
index c180ac11a24..00000000000
--- a/apps/www/components/Pricing/NewPricingComputeSection.tsx
+++ /dev/null
@@ -1,205 +0,0 @@
-import { ChevronDownIcon } from '@heroicons/react/outline'
-import Link from 'next/link'
-import React, { useEffect, useRef, useState } from 'react'
-import { useWindowSize } from 'react-use'
-import { plans as allPlans } from 'shared-data/plans'
-import { Button, cn } from 'ui'
-import { InfoTooltip } from 'ui-patterns/info-tooltip'
-import { ToggleGroup, ToggleGroupItem } from 'ui/src/components/shadcn/ui/toggle-group'
-
-import Panel from '../Panel'
-import ComputePricingTable from './ComputePricingTable'
-import NewComputePricingCalculator from './NewComputePricingCalculator'
-import PricingComputeAnimation from './PricingComputeAnimation'
-
-const plans = allPlans
- .filter((plan) => plan.planId === 'pro' || plan.planId === 'team')
- .map((plan) => ({
- name: plan.name,
- price: plan.priceMonthly as number,
- }))
-
-const NewPricingComputeSection = () => {
- const ref = useRef<HTMLDivElement>(null)
- const [showTable, setShowTable] = useState(false)
- const { width } = useWindowSize()
- const [height, setHeight] = useState(ref?.current?.clientHeight)
- const [activePlan, setActivePlan] = useState(plans[0])
-
- useEffect(() => {
- setHeight(ref?.current?.clientHeight)
- }, [width])
-
- return (
- <Panel outerClassName="w-full mx-auto max-w-6xl" innerClassName="flex flex-col">
- <div className="flex flex-col xl:grid xl:grid-cols-3 xl:gap-4">
- <div className="p-4 pb-0 lg:p-8 gap-4 flex flex-col">
- <div className="mb-4 grid gap-1">
- <h3 className="text-foreground-light text-lg">1. Choose your plan</h3>
- </div>
- <ToggleGroup
- type="single"
- value={activePlan.name}
- onValueChange={(value) => {
- const selectedPlan = plans.find((p) => p.name === value)
- if (selectedPlan) setActivePlan(selectedPlan)
- }}
- className="grid grid-cols-2 gap-2 w-full bg-surface-200 rounded-md"
- >
- {plans.map((plan) => (
- <ToggleGroupItem
- key={plan.name}
- value={plan.name}
- className={cn(
- 'w-full h-6 ',
- activePlan.name === plan.name
- ? 'bg-surface-200 text-foreground data-[state=on]:bg-surface-400 data-[state=on]:text-foreground'
- : 'hover:bg-surface-200'
- )}
- >
- {plan.name}
- </ToggleGroupItem>
- ))}
- </ToggleGroup>
-
- <div className="grid gap-3">
- <h3 className="text-foreground text-2xl font-medium">{activePlan.name}</h3>
- <div className="grid gap-1">
- <p className="text-foreground text-lg">
- <span className="font-mono font-bold">${activePlan.price}</span>
- <span className="text-foreground-light text-sm">/month </span>
- </p>
- </div>
- <div className="grid gap-2 text-sm">
- {activePlan.name === 'Pro' && (
- <>
- <p className="text-foreground-light font-medium">
- Everything in the Free Plan, plus:
- </p>
- <p className="text-foreground-light">100K monthly active users</p>
- <p className="text-foreground-light">8 GB disk size per project</p>
- <p className="text-foreground-light">250 GB bandwidth</p>
- <p className="text-foreground-light">Daily backups (7 day retention)</p>
- <p className="text-foreground-light">Email support</p>
- </>
- )}
- {activePlan.name === 'Team' && (
- <>
- <p className="text-foreground-light font-medium">
- Everything in the Pro Plan, plus:
- </p>
- <p className="text-foreground-light">SOC2</p>
- <p className="text-foreground-light">Project-scoped and read-only access</p>
- <p className="text-foreground-light">HIPAA available as paid add-on</p>
- <p className="text-foreground-light">SSO for Supabase Dashboard</p>
- <p className="text-foreground-light">Priority email support & SLAs</p>
- <p className="text-foreground-light">Daily backups (14 day retention)</p>
- </>
- )}
- <p className="text-foreground-lighter text-xs mt-2">
- Paid plans include $10/mo in compute credits, enough to cover one Micro instance.
- </p>
- </div>
- </div>
- </div>
- <div className="relative col-span-2 h-full w-full p-4 lg:p-8">
- <h3 className="text-foreground-light text-lg mb-2">
- 2. Configure compute for your projects
- </h3>
- <p className="text-foreground-lighter text-xs mb-6">
- Add projects and adjust compute to estimate your monthly cost.
- </p>
-
- <NewComputePricingCalculator activePlan={activePlan} />
- </div>
- </div>
- <hr className="border-0 border-t" />
- <div className="flex flex-col">
- <div className="flex gap-2 p-6 justify-between items-center mt-2">
- <div className="grid gap-2">
- <p>
- <span className="border bg-alternative px-3 py-0.5 text-foreground text-sm rounded-full">
- Starts from <span translate="no">$10</span>/month
- </span>
- </p>
- <h3 className="text-foreground text-2xl">
- Scale compute up to
- <br className="hidden sm:block" /> 64 cores and 256 GB RAM
- </h3>
- </div>
-
- <Button asChild size="tiny" type="default">
- <Link href="https://supabase.com/docs/guides/platform/compute-add-ons">
- Learn about Compute add-ons
- </Link>
- </Button>
- </div>
- <div
- className="relative w-full overflow-hidden transition-all !ease-[cubic-bezier(.76,0,.23,1)] duration-300"
- style={{ height: showTable ? `${height}px` : '200px' }}
- >
- <div
- className={cn(
- 'absolute inset-0 top-auto w-full h-40 bg-gradient-to-t from-background-surface-100 z-20 to-transparent transition-opacity pointer-events-none not-sr-only',
- showTable ? 'opacity-0 delay-200' : 'opacity-100'
- )}
- />
- <div ref={ref}>
- <ComputePricingTable />
-
- <div className="grid lg:grid-cols-2 gap-4 md:gap-8 mt-4 md:mt-0 border-t">
- <div className="max-w-4xl prose p-4 md:p-8 relative z-10">
- <h4 className="text-lg">Choose the best compute size for you</h4>
- <p className="text-[13px] text-foreground-lighter">
- Every project on the Supabase Platform comes with its own dedicated Postgres
- instance. Select the compute size that fits your needs.
- </p>
- <p className="text-[13px] text-foreground-lighter">
- Compute instances are billed hourly and you can scale up or down at any time. Paid
- Plans come with <span translate="no">$10</span>/month in compute credits to cover
- one Micro instance or offset the cost of any other instance.
- </p>
- <p className="text-[13px] text-foreground-lighter">
- Read more on{' '}
- <Link
- href="https://supabase.com/docs/guides/platform/manage-your-usage/compute"
- target="_blank"
- className="transition text-brand hover:text-brand-600"
- >
- usage-based billing for compute
- </Link>{' '}
- or{' '}
- <Link
- href="https://supabase.com/docs/guides/platform/compute-add-ons"
- target="_blank"
- className="transition text-brand hover:text-brand-600"
- >
- Compute Add-ons
- </Link>
- .
- </p>
- </div>
- <div className="relative -mt-8 lg:mt-0 z-0">
- <PricingComputeAnimation />
- </div>
- </div>
- </div>
- </div>
- <button
- onClick={() => setShowTable(!showTable)}
- className="w-full p-2 border-t border-muted text-foreground focus-visible:outline-brand-600 focus-visible:rounded-b-xl text-sm bg-alternative flex items-center justify-center gap-2"
- >
- <ChevronDownIcon
- className={cn(
- 'w-4 transition-transform transform origin-center',
- showTable ? 'rotate-180' : 'rotate-0'
- )}
- />{' '}
- {!showTable ? 'Expand' : 'Hide'} Pricing breakdown
- </button>
- </div>
- </Panel>
- )
-}
-
-export default NewPricingComputeSection
diff --git a/apps/www/components/Pricing/PricingComputeSection.tsx b/apps/www/components/Pricing/PricingComputeSection.tsx
index 3b36361e95c..36644ae1b93 100644
--- a/apps/www/components/Pricing/PricingComputeSection.tsx
+++ b/apps/www/components/Pricing/PricingComputeSection.tsx
@@ -1,21 +1,29 @@
-'use client'
-
-import React, { useEffect, useRef, useState } from 'react'
-import Link from 'next/link'
import { ChevronDownIcon } from '@heroicons/react/outline'
+import Link from 'next/link'
+import React, { useEffect, useRef, useState } from 'react'
import { useWindowSize } from 'react-use'
-
+import { plans as allPlans } from 'shared-data/plans'
import { Button, cn } from 'ui'
+import { ToggleGroup, ToggleGroupItem } from 'ui/src/components/shadcn/ui/toggle-group'
+
import Panel from '../Panel'
+import ComputePricingCalculator from './ComputePricingCalculator'
import ComputePricingTable from './ComputePricingTable'
import PricingComputeAnimation from './PricingComputeAnimation'
-import ComputePricingCalculator from './ComputePricingCalculator'
+
+const plans = allPlans
+ .filter((plan) => plan.planId === 'pro' || plan.planId === 'team')
+ .map((plan) => ({
+ name: plan.name,
+ price: plan.priceMonthly as number,
+ }))
const PricingComputeSection = () => {
const ref = useRef<HTMLDivElement>(null)
const [showTable, setShowTable] = useState(false)
const { width } = useWindowSize()
const [height, setHeight] = useState(ref?.current?.clientHeight)
+ const [activePlan, setActivePlan] = useState(plans[0])
useEffect(() => {
setHeight(ref?.current?.clientHeight)
@@ -24,39 +32,107 @@ const PricingComputeSection = () => {
return (
<Panel outerClassName="w-full mx-auto max-w-6xl" innerClassName="flex flex-col">
<div className="flex flex-col xl:grid xl:grid-cols-3 xl:gap-4">
- <div className="p-4 pb-0 lg:p-8 gap-4">
- <div className="flex flex-col gap-2">
- <div className="flex flex-col gap-2">
- <div className="flex items-center gap-1">
- <span className="border bg-alternative px-3 py-0.5 text-foreground text-sm rounded-full">
- Starts from <span translate="no">$10</span>/month
- </span>
- </div>
- <h3 className="text-foreground text-2xl">
- Scale compute up to
- <br className="hidden sm:block" /> 64 cores and 256 GB RAM
- </h3>
- </div>
- <p className="text-foreground-lighter text-[13px]">
- Paid Plans include <span translate="no">$10</span>/month in compute credits.
- Additional compute power is available if you need extra performance when scaling up
- Supabase.
- </p>
+ <div className="p-4 pb-0 lg:p-8 gap-4 flex flex-col">
+ <div className="mb-4 grid gap-1">
+ <h3 className="text-foreground-light text-lg">1. Choose your plan</h3>
</div>
- <div className="flex items-center gap-4 mt-4">
- <Button asChild size="tiny" type="default">
- <Link href="https://supabase.com/docs/guides/platform/compute-add-ons">
- Learn about Compute add-ons
- </Link>
- </Button>
+ <ToggleGroup
+ type="single"
+ value={activePlan.name}
+ onValueChange={(value) => {
+ const selectedPlan = plans.find((p) => p.name === value)
+ if (selectedPlan) setActivePlan(selectedPlan)
+ }}
+ className="grid grid-cols-2 gap-2 w-full bg-surface-200 rounded-md"
+ >
+ {plans.map((plan) => (
+ <ToggleGroupItem
+ key={plan.name}
+ value={plan.name}
+ className={cn(
+ 'w-full h-6 ',
+ activePlan.name === plan.name
+ ? 'bg-surface-200 text-foreground data-[state=on]:bg-surface-400 data-[state=on]:text-foreground'
+ : 'hover:bg-surface-200'
+ )}
+ >
+ {plan.name}
+ </ToggleGroupItem>
+ ))}
+ </ToggleGroup>
+
+ <div className="grid gap-3">
+ <h3 className="text-foreground text-2xl font-medium">{activePlan.name}</h3>
+ <div className="grid gap-1">
+ <p className="text-foreground text-lg">
+ <span className="font-mono font-bold">${activePlan.price}</span>
+ <span className="text-foreground-light text-sm">/month </span>
+ </p>
+ </div>
+ <div className="grid gap-2 text-sm">
+ {activePlan.name === 'Pro' && (
+ <>
+ <p className="text-foreground-light font-medium">
+ Everything in the Free Plan, plus:
+ </p>
+ <p className="text-foreground-light">100K monthly active users</p>
+ <p className="text-foreground-light">8 GB disk size per project</p>
+ <p className="text-foreground-light">250 GB bandwidth</p>
+ <p className="text-foreground-light">Daily backups (7 day retention)</p>
+ <p className="text-foreground-light">Email support</p>
+ </>
+ )}
+ {activePlan.name === 'Team' && (
+ <>
+ <p className="text-foreground-light font-medium">
+ Everything in the Pro Plan, plus:
+ </p>
+ <p className="text-foreground-light">SOC2</p>
+ <p className="text-foreground-light">Project-scoped and read-only access</p>
+ <p className="text-foreground-light">HIPAA available as paid add-on</p>
+ <p className="text-foreground-light">SSO for Supabase Dashboard</p>
+ <p className="text-foreground-light">Priority email support & SLAs</p>
+ <p className="text-foreground-light">Daily backups (14 day retention)</p>
+ </>
+ )}
+ <p className="text-foreground-lighter text-xs mt-2">
+ Paid plans include $10/mo in compute credits, enough to cover one Micro instance.
+ </p>
+ </div>
</div>
</div>
<div className="relative col-span-2 h-full w-full p-4 lg:p-8">
- <ComputePricingCalculator />
+ <h3 className="text-foreground-light text-lg mb-2">
+ 2. Configure compute for your projects
+ </h3>
+ <p className="text-foreground-lighter text-xs mb-6">
+ Add projects and adjust compute to estimate your monthly cost.
+ </p>
+
+ <ComputePricingCalculator activePlan={activePlan} />
</div>
</div>
<hr className="border-0 border-t" />
<div className="flex flex-col">
+ <div className="flex gap-2 p-6 justify-between items-center mt-2">
+ <div className="grid gap-2">
+ <p>
+ <span className="border bg-alternative px-3 py-0.5 text-foreground text-sm rounded-full">
+ Starts from <span translate="no">$10</span>/month
+ </span>
+ </p>
+ <h3 className="text-foreground text-2xl">
+ Scale compute up to
+ <br className="hidden sm:block" /> 64 cores and 256 GB RAM
+ </h3>
+ </div>
+
+ <Button asChild size="tiny" type="default">
+ <Link href="https://supabase.com/docs/guides/platform/compute-add-ons">
+ Learn about Compute add-ons
+ </Link>
+ </Button>
+ </div>
<div
className="relative w-full overflow-hidden transition-all !ease-[cubic-bezier(.76,0,.23,1)] duration-300"
style={{ height: showTable ? `${height}px` : '200px' }}
diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.ts
index 0fe93070fcf..c084bce0802 100644
--- a/packages/common/telemetry-constants.ts
+++ b/packages/common/telemetry-constants.ts
@@ -3018,27 +3018,6 @@ export interface RlsEventTriggerBannerCreateButtonClickedEvent {
groups: TelemetryGroups
}
-/**
- * User was exposed to the pricing calculator experiment on the /pricing page.
- *
- * @group Events
- * @source www
- * @page /pricing
- */
-export interface PricingCalculatorExperimentExposedEvent {
- action: 'pricing_calculator_experiment_exposed'
- properties: {
- /**
- * Experiment identifier for tracking
- */
- experiment_id: 'pricingCalculatorExperiment'
- /**
- * Experiment variant: 'control' (existing compute section) or 'test' (new compute section)
- */
- variant: 'control' | 'test'
- }
-}
-
/**
* User clicked the Run button in the log explorer.
*
@@ -3224,4 +3203,3 @@ export type TelemetryEvent =
| OrgSubmenuOpenedEvent
| OrgMenuBackClickedEvent
| OrgMenuItemClickedEvent
- | PricingCalculatorExperimentExposedEvent