Skip to content

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

Tweak add on formatting logic for billing page

Joshen Limfded12fc9f06
diff --git a/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts b/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts
index 9d2e0427979..2befe4d7239 100644
--- a/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts
+++ b/studio/components/interfaces/Billing/AddOns/AddOns.utils.ts
@@ -10,7 +10,7 @@ export const formatComputeSizes = (computeSizes: any[]) => {
description: 'Basic set up to get started',
metadata: {
default_price_id: undefined,
- supabase_prod_id: undefined,
+ supabase_prod_id: 'addon_instance_micro',
features: '2 CPUs • 1GB memory • 2,085Mbps Disk IO',
},
prices: [
@@ -30,9 +30,29 @@ export const formatComputeSizes = (computeSizes: any[]) => {
}
return [microOption]
- .concat(computeSizes.filter((option: any) => option.name.includes('[Small]')))
- .concat(computeSizes.filter((option: any) => option.name.includes('[Medium]')))
- .concat(computeSizes.filter((option: any) => option.name.includes('[Large]')))
- .concat(computeSizes.filter((option: any) => option.name.includes('[XLarge]')))
- .concat(computeSizes.filter((option: any) => option.name.includes('[XXLarge]')))
+ .concat(
+ computeSizes.filter(
+ (option: any) => option.metadata.supabase_prod_id === 'addon_instance_small'
+ )
+ )
+ .concat(
+ computeSizes.filter(
+ (option: any) => option.metadata.supabase_prod_id === 'addon_instance_medium'
+ )
+ )
+ .concat(
+ computeSizes.filter(
+ (option: any) => option.metadata.supabase_prod_id === 'addon_instance_large'
+ )
+ )
+ .concat(
+ computeSizes.filter(
+ (option: any) => option.metadata.supabase_prod_id === 'addon_instance_xlarge'
+ )
+ )
+ .concat(
+ computeSizes.filter(
+ (option: any) => option.metadata.supabase_prod_id === 'addon_instance_xxlarge'
+ )
+ )
}
diff --git a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx
index 8954f2c0dfe..e1ba0a5dae9 100644
--- a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx
+++ b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx
@@ -50,8 +50,6 @@ const PaymentSummaryPanel: FC<Props> = ({
const { ui } = useStore()
const projectRegion = ui.selectedProject?.region
- console.log('PaymentSummaryPanel', currentComputeSize, selectedComputeSize)
-
const isChangingPlan =
(currentPlan.prod_id !== STRIPE_PRODUCT_IDS.PAYG && currentPlan.prod_id !== selectedPlan?.id) ||
(currentPlan.prod_id !== STRIPE_PRODUCT_IDS.PAYG && !isSpendCapEnabled) ||
diff --git a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx
index d167ce8d9c3..0632d0227a9 100644
--- a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx
+++ b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.tsx
@@ -46,9 +46,7 @@ const ProUpgrade: FC<Props> = ({
const currentComputeSize =
computeSizes.find((option: any) => option.id === currentSubscription?.addons[0]?.prod_id) ||
- computeSizes.find((option: any) => option.name.includes('[Micro]'))
- console.log('DEBUG: ProUpgrade 001', currentComputeSize)
- console.log('DEBUG: ProUpgrade 002', computeSizes)
+ computeSizes.find((option: any) => option.metadata.supabase_prod_id === 'addon_instance_micro')
const isManagingProSubscription =
currentSubscription.tier.prod_id === STRIPE_PRODUCT_IDS.PRO ||