The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Show support plan add on in billing/update page if project has a support plan add on
Joshen Lim75bca4844524
diff --git a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsxindex 23b452b0e7a..65364ded9ad 100644--- a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx+++ b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx@@ -75,7 +75,9 @@ const ComputeSizeSelection: FC<Props> = ({label="Need a larger add on?"description="Reach out to us - we've got you covered!"optionalLabel={- <Link href={`/support/new?ref=${projectRef}&category=sales`}>+ <Link+ href={`/support/new?ref=${projectRef}&category=sales&subject=Enquiry%20for%20larger%20compute%20size`}+ ><a><Button>Contact us</Button></a>diff --git a/studio/components/interfaces/Billing/AddOns/SupportPlan.tsx b/studio/components/interfaces/Billing/AddOns/SupportPlan.tsxnew file mode 100644index 00000000000..48f66b7fc97--- /dev/null+++ b/studio/components/interfaces/Billing/AddOns/SupportPlan.tsx@@ -0,0 +1,48 @@+import { FC } from 'react'+import Link from 'next/link'+import { Button } from 'ui'+import { useParams } from 'hooks'++interface Props {+ currentOption?: any+}++const SupportPlan: FC<Props> = ({ currentOption }) => {+ const { ref } = useParams()+ return (+ <div className="space-y-4">+ <div>+ <div className="flex items-center space-x-2">+ <h4 className="text-lg">Support Plan</h4>+ </div>+ <p className="text-sm text-scale-1100">Designated support with guaranteed response times</p>+ </div>+ {currentOption !== undefined && (+ <div+ className={[+ 'flex items-center justify-between block w-full rounded px-4 py-3',+ 'border border-scale-600 bg-scale-100 dark:border-scale-500 dark:bg-scale-400',+ ].join(' ')}+ >+ <div className="space-y-3">+ <h5 className="text-sm text-scale-1200">+ Your project is currently on {currentOption.name}+ </h5>+ <p className="text-sm text-scale-1100">+ If you would like to change your support plan, do reach out to us+ </p>+ </div>+ <div className="">+ <Link href={`/support/new?ref=${ref}&category=sales&subject=Change%20support%20plan`}>+ <a>+ <Button>Contact us</Button>+ </a>+ </Link>+ </div>+ </div>+ )}+ </div>+ )+}++export default SupportPlandiff --git a/studio/components/interfaces/Billing/Billing.utils.ts b/studio/components/interfaces/Billing/Billing.utils.tsindex d6d21a9652f..c8cc3762084 100644--- a/studio/components/interfaces/Billing/Billing.utils.ts+++ b/studio/components/interfaces/Billing/Billing.utils.ts@@ -61,11 +61,18 @@ export const formSubscriptionUpdatePayload = (export const getCurrentAddons = (currentSubscription: StripeSubscription,addons: DatabaseAddon[]-) => {+): {+ computeSize: DatabaseAddon+ pitrDuration: DatabaseAddon+ customDomains: DatabaseAddon+ supportPlan?: DatabaseAddon+} => {const computeSizes = formatComputeSizes(addons)const pitrDurationOptions = formatPITROptions(addons)const customDomainOptions = formatCustomDomainOptions(addons)+ console.log({ currentSubscription })+const computeSize =computeSizes.find((option: any) => {const subscriptionComputeSize = currentSubscription?.addons.find((addon) =>@@ -79,10 +86,10 @@ export const getCurrentAddons = (const pitrDuration =pitrDurationOptions.find((option: any) => {- const subscriptionComputeSize = currentSubscription?.addons.find((addon) =>+ const subscriptionPitrDuration = currentSubscription?.addons.find((addon) =>addon.supabase_prod_id.includes('_pitr_'))- return option.id === subscriptionComputeSize?.prod_id+ return option.id === subscriptionPitrDuration?.prod_id}) ||(pitrDurationOptions.find((option: any) => option.metadata.supabase_prod_id === 'addon_pitr_0days'@@ -90,14 +97,21 @@ export const getCurrentAddons = (const customDomains =customDomainOptions.find((option: any) => {- const subscriptionComputeSize = currentSubscription?.addons.find((addon) =>+ const subscriptionCustomDomain = currentSubscription?.addons.find((addon) =>addon.supabase_prod_id.includes('_custom_domains'))- return option.id === subscriptionComputeSize?.prod_id+ return option.id === subscriptionCustomDomain?.prod_id}) ||(customDomainOptions.find(- (option: any) => option.metadata.supabase_prod_id === 'addon__custom_domains_disabled'+ (option: any) => option.metadata.supabase_prod_id === 'addon_custom_domains_disabled') as DatabaseAddon)- return { computeSize, pitrDuration, customDomains }+ const supportPlan = addons.find((option: any) => {+ const subscriptionSupportPlan = currentSubscription?.addons.find((addon) =>+ addon.supabase_prod_id.includes('_support_')+ )+ return option.id === subscriptionSupportPlan?.prod_id+ })++ return { computeSize, pitrDuration, customDomains, supportPlan }}diff --git a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx b/studio/components/interfaces/Billing/EnterpriseUpdate.tsxindex 504d5931f8a..f5e1df50f67 100644--- a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx+++ b/studio/components/interfaces/Billing/EnterpriseUpdate.tsx@@ -25,6 +25,7 @@ import {} from './'import { PaymentMethod, SubscriptionPreview } from './Billing.types'import { formSubscriptionUpdatePayload, getCurrentAddons } from './Billing.utils'+import SupportPlan from './AddOns/SupportPlan'interface Props {products: { tiers: any[]; addons: DatabaseAddon[] }@@ -54,6 +55,8 @@ const EnterpriseUpdate: FC<Props> = ({const customDomainOptions = formatCustomDomainOptions(addons)const currentAddons = getCurrentAddons(currentSubscription, addons)+ console.log({ currentAddons })+// [Joshen TODO] Ideally we just have a state to hold all the add ons selection, rather than individual// Even better if we can just use the <Form> component to handle all of these. Mainly to reduce the amount// of unnecessary state management on this complex page.@@ -199,6 +202,12 @@ const EnterpriseUpdate: FC<Props> = ({</div>{projectRegion !== 'af-south-1' && (<>+ {currentAddons.supportPlan !== undefined && (+ <>+ <Divider light />+ <SupportPlan currentOption={currentAddons.supportPlan} />+ </>+ )}{isCustomDomainsEnabled && customDomainOptions.length > 0 && (<><Divider light />