Skip to content

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

Update to use single flag for disabling of project creation and subscription updates, and update to disabled subscription update flow entirely if flag is true

Joshen Lim4f3b225f7557
diff --git a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx
index 393fc4d615d..87ff3d91372 100644
--- a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx
+++ b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx
@@ -15,7 +15,7 @@ interface Props {
const ComputeSizeSelection: FC<Props> = ({ computeSizes, selectedComputeSize, onSelectOption }) => {
const { ui } = useStore()
const projectRef = ui.selectedProjectRef
- const addonUpdateDisabled = useFlag('disableProjectAddonUpdates')
+ const addonUpdateDisabled = useFlag('disableProjectCreationAndUpdate')
return (
<div className="space-y-4">
diff --git a/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx b/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx
index 268a2196f28..443b7ec98ff 100644
--- a/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx
+++ b/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx
@@ -1,8 +1,10 @@
import { FC } from 'react'
import { Button, IconLoader } from '@supabase/ui'
+import * as Tooltip from '@radix-ui/react-tooltip'
+import { useFlag } from 'hooks'
import { STRIPE_PRODUCT_IDS } from 'lib/constants'
-import { StripeProduct } from '../..'
+import { StripeProduct } from 'components/interfaces/Billing'
import Link from 'next/link'
interface Props {
@@ -12,6 +14,8 @@ interface Props {
}
const PlanCTAButton: FC<Props> = ({ plan, currentPlan, onSelectPlan }) => {
+ const projectUpdateDisabled = useFlag('disableProjectCreationAndUpdate')
+
const getButtonType = (plan: any) => {
if (plan.name === 'Enterprise' || plan.id === STRIPE_PRODUCT_IDS.FREE) {
return 'default'
@@ -71,9 +75,9 @@ const PlanCTAButton: FC<Props> = ({ plan, currentPlan, onSelectPlan }) => {
}
return (
- <div className="flex items-center justify-center">
+ <div className="flex flex-col items-center justify-center space-y-2">
<Button
- disabled={disabled}
+ disabled={disabled || projectUpdateDisabled}
type={type}
onClick={() => onSelectPlan(plan)}
block
@@ -81,6 +85,11 @@ const PlanCTAButton: FC<Props> = ({ plan, currentPlan, onSelectPlan }) => {
>
{ctaText}
</Button>
+ {!disabled && projectUpdateDisabled && (
+ <p className="text-scale-1100 text-sm">
+ Subscription changes are currently disabled, our engineers are working on a fix
+ </p>
+ )}
</div>
)
}
diff --git a/studio/components/interfaces/Billing/PlanSelection/Plans/Plans.tsx b/studio/components/interfaces/Billing/PlanSelection/Plans/Plans.tsx
index ec9151ccf62..8ddc8587913 100644
--- a/studio/components/interfaces/Billing/PlanSelection/Plans/Plans.tsx
+++ b/studio/components/interfaces/Billing/PlanSelection/Plans/Plans.tsx
@@ -1,7 +1,8 @@
+import { FC } from 'react'
import { IconCheck } from '@supabase/ui'
+
import { STRIPE_PRODUCT_IDS } from 'lib/constants'
-import { FC } from 'react'
-import { StripeProduct } from '../..'
+import { StripeProduct } from 'components/interfaces/Billing'
import PlanCTAButton from './PlanCTAButton'
import { PRICING_META } from './Plans.Constants'
@@ -14,8 +15,8 @@ interface Props {
const AnimatedGradientBackground = () => (
<div
className={[
- 'absolute top-0 left-0 w-full h-full animate-sway',
- 'bg-gradient-to-b from-transparent to-green-800 via-transparent',
+ 'animate-sway absolute top-0 left-0 h-full w-full',
+ 'bg-gradient-to-b from-transparent via-transparent to-green-800',
].join(' ')}
/>
)
@@ -23,10 +24,10 @@ const AnimatedGradientBackground = () => (
const CurrentSubscriptionBanner = () => (
<div
className={[
- 'absolute h-8 -top-7 left-0 w-full',
+ 'absolute -top-7 left-0 h-8 w-full',
'flex items-center justify-center',
'bg-brand-400 text-brand-900',
- 'rounded-t-md border-t border-l border-r border border-b-0',
+ 'rounded-t-md border border-t border-l border-r border-b-0',
].join(' ')}
>
<p className="text-xs">Current plan</p>
@@ -52,30 +53,30 @@ const Plans: FC<Props> = ({ plans, currentPlan, onSelectPlan }) => {
return (
<div key={PRICING_META[plan.id].name} className="relative h-full">
{plan.id === STRIPE_PRODUCT_IDS.PRO && (
- <div className="absolute overflow-hidden w-full h-full left-0 bottom-0 opacity-50">
+ <div className="absolute left-0 bottom-0 h-full w-full overflow-hidden opacity-50">
<AnimatedGradientBackground />
</div>
)}
- <div className="flex flex-col rounded border overflow-hidden h-full">
+ <div className="flex h-full flex-col overflow-hidden rounded border">
{isCurrentPlan && <CurrentSubscriptionBanner />}
- <div className="px-8 py-6 bg-white dark:bg-scale-300">
+ <div className="dark:bg-scale-300 bg-white px-8 py-6">
<span
- className="inline-flex text-cd font-normal tracking-wide rounded-full text-base text-scale-1200"
+ className="text-cd text-scale-1200 inline-flex rounded-full text-base font-normal tracking-wide"
id="tier-standard"
>
{PRICING_META[plan.id].name}
</span>
- <div className="flex items-baseline mt-2">
+ <div className="mt-2 flex items-baseline">
<div className="flex space-x-2">
{PRICING_META[plan.id].priceMonthly !== undefined ? (
<>
<div className="flex items-end gap-1">
{PRICING_META[plan.id].from && (
- <span className="text-base font-medium text-scale-1200">From</span>
+ <span className="text-scale-1200 text-base font-medium">From</span>
)}
<div>
<span className="text-2xl">${PRICING_META[plan.id].priceMonthly}</span>
- <span className="ml-1 text-xl font-medium text-scale-900">/mo</span>
+ <span className="text-scale-900 ml-1 text-xl font-medium">/mo</span>
</div>
</div>
</>
@@ -84,7 +85,7 @@ const Plans: FC<Props> = ({ plans, currentPlan, onSelectPlan }) => {
)}
<div className="flex h-8">
{PRICING_META[plan.id].warning && (
- <div className="px-2 py-1 mt-2 text-xs rounded-md bg-brand-300 bg-opacity-30 text-brand-1000">
+ <div className="bg-brand-300 text-brand-1000 mt-2 rounded-md bg-opacity-30 px-2 py-1 text-xs">
{PRICING_META[plan.id].warning}
</div>
)}
@@ -98,28 +99,28 @@ const Plans: FC<Props> = ({ plans, currentPlan, onSelectPlan }) => {
onSelectPlan={onSelectPlan}
/>
</div>
- <p className="text-sm text-scale-1100">{PRICING_META[plan.id].description}</p>
+ <p className="text-scale-1100 text-sm">{PRICING_META[plan.id].description}</p>
</div>
<div
className={[
- 'flex-col justify-between flex-1',
- 'space-y-6 border-t dark:border-scale-400',
+ 'flex-1 flex-col justify-between',
+ 'dark:border-scale-400 space-y-6 border-t',
'bg-scale-100 dark:bg-scale-300',
- 'px-8 py-6 h-full hidden lg:flex',
+ 'hidden h-full px-8 py-6 lg:flex',
].join(' ')}
>
{PRICING_META[plan.id].preface && (
- <p className="text-sm text-scale-1200">{PRICING_META[plan.id].preface}</p>
+ <p className="text-scale-1200 text-sm">{PRICING_META[plan.id].preface}</p>
)}
- <ul role="list" className="divide-y dark:divide-scale-400">
+ <ul role="list" className="dark:divide-scale-400 divide-y">
{PRICING_META[plan.id].features.map((feature) => (
<li key={feature} className="flex items-center py-2">
<IconCheck
- className="w-3 h-3 text-brand-900 "
+ className="text-brand-900 h-3 w-3 "
aria-hidden="true"
strokeWidth={3}
/>
- <p className="mb-0 ml-3 text-xs text-scale-1100 dark:text-scale-1200">
+ <p className="text-scale-1100 dark:text-scale-1200 mb-0 ml-3 text-xs">
{feature}
</p>
</li>
@@ -128,13 +129,13 @@ const Plans: FC<Props> = ({ plans, currentPlan, onSelectPlan }) => {
<div className="flex flex-col gap-6">
<div className="space-y-2">
{PRICING_META[plan.id].additional && (
- <p className="text-sm text-scale-1200">{PRICING_META[plan.id].additional}</p>
+ <p className="text-scale-1200 text-sm">{PRICING_META[plan.id].additional}</p>
)}
{PRICING_META[plan.id].scale && (
- <p className="text-xs text-scale-900">{PRICING_META[plan.id].scale}</p>
+ <p className="text-scale-900 text-xs">{PRICING_META[plan.id].scale}</p>
)}
{PRICING_META[plan.id].shutdown && (
- <p className="text-xs text-scale-900">{PRICING_META[plan.id].shutdown}</p>
+ <p className="text-scale-900 text-xs">{PRICING_META[plan.id].shutdown}</p>
)}
</div>
</div>
diff --git a/studio/components/interfaces/Billing/Subscription/Subscription.tsx b/studio/components/interfaces/Billing/Subscription/Subscription.tsx
index c56b86c5677..a6e7486aa73 100644
--- a/studio/components/interfaces/Billing/Subscription/Subscription.tsx
+++ b/studio/components/interfaces/Billing/Subscription/Subscription.tsx
@@ -3,9 +3,10 @@ import dayjs from 'dayjs'
import { sum } from 'lodash'
import { useRouter } from 'next/router'
import { Loading, Button } from '@supabase/ui'
+
import { formatBytes } from 'lib/helpers'
import { STRIPE_PRODUCT_IDS } from 'lib/constants'
-import { useStore } from 'hooks'
+import { useStore, useFlag } from 'hooks'
import CostBreakdownRow from './CostBreakdownRow'
import { StripeSubscription } from './Subscription.types'
import { deriveFeatureCost, deriveProductCost } from '../PAYGUsage/PAYGUsage.utils'
@@ -34,6 +35,7 @@ const Subscription: FC<Props> = ({
const router = useRouter()
const { ui } = useStore()
const isOrgOwner = ui.selectedOrganization?.is_owner
+ const projectUpdateDisabled = useFlag('disableProjectCreationAndUpdate')
const isPayg = subscription?.tier.prod_id === STRIPE_PRODUCT_IDS.PAYG
const addOns = subscription?.addons ?? []
@@ -62,16 +64,24 @@ const Subscription: FC<Props> = ({
</div>
<div className="flex flex-col items-end space-y-2">
<Button
- disabled={!isOrgOwner}
+ disabled={!isOrgOwner || projectUpdateDisabled}
onClick={() => router.push(`/project/${project.ref}/settings/billing/update`)}
type="primary"
>
Change subscription
</Button>
- {!isOrgOwner && (
- <p className="text-scale-1100 text-sm">
+ {!isOrgOwner ? (
+ <p className="text-scale-1100 text-xs">
Only the organization owner can amend subscriptions
</p>
+ ) : projectUpdateDisabled ? (
+ <p className="text-scale-1100 text-right text-xs">
+ Subscription changes are currently disabled
+ <br />
+ Our engineers are working on a fix
+ </p>
+ ) : (
+ <div />
)}
</div>
</div>
diff --git a/studio/components/ui/DisabledWarningDueToIncident.tsx b/studio/components/ui/DisabledWarningDueToIncident.tsx
index 503ab65ce4c..1c01977100e 100644
--- a/studio/components/ui/DisabledWarningDueToIncident.tsx
+++ b/studio/components/ui/DisabledWarningDueToIncident.tsx
@@ -9,7 +9,7 @@ interface Props {
const DisabledWarningDueToIncident: FC<Props> = ({ title }) => {
return (
<InformationBox
- icon={<IconAlertCircle className="text-white" size="large" strokeWidth={1.5} />}
+ icon={<IconAlertCircle size={20} strokeWidth={1.5} />}
defaultVisibility={true}
hideCollapse
title={title}
diff --git a/studio/pages/new/[slug].tsx b/studio/pages/new/[slug].tsx
index fdeff18dffb..19b842c5b85 100644
--- a/studio/pages/new/[slug].tsx
+++ b/studio/pages/new/[slug].tsx
@@ -60,7 +60,7 @@ const Wizard: NextPageWithLayout = () => {
const { app, ui } = useStore()
const subscriptionStats = useSubscriptionStats()
- const projectCreationDisabled = useFlag('disableProjectCreation')
+ const projectCreationDisabled = useFlag('disableProjectCreationAndUpdate')
const [projectName, setProjectName] = useState('')
const [dbPass, setDbPass] = useState('')
@@ -208,7 +208,9 @@ const Wizard: NextPageWithLayout = () => {
Cancel
</Button>
<div className="items-center space-x-3">
- <span className="text-scale-900 text-xs">You can rename your project later</span>
+ {!projectCreationDisabled && (
+ <span className="text-scale-900 text-xs">You can rename your project later</span>
+ )}
<Button
onClick={onClickNext}
loading={newProjectedLoading}
diff --git a/studio/pages/project/[ref]/settings/billing/index.tsx b/studio/pages/project/[ref]/settings/billing/index.tsx
index 5348166d10d..7218dcf1eff 100644
--- a/studio/pages/project/[ref]/settings/billing/index.tsx
+++ b/studio/pages/project/[ref]/settings/billing/index.tsx
@@ -14,8 +14,7 @@ import DateRangePicker from 'components/to-be-cleaned/DateRangePicker'
import { PaygStats } from 'components/interfaces/Billing/PAYGUsage/PAYGUsage.types'
import { NextPageWithLayout } from 'types'
-type ProjectBillingProps = {} & any
-const ProjectBilling: NextPageWithLayout = ({ store }: ProjectBillingProps) => {
+const ProjectBilling: NextPageWithLayout = () => {
const { ui } = useStore()
const project = ui.selectedProject
diff --git a/studio/pages/project/[ref]/settings/billing/update/free.tsx b/studio/pages/project/[ref]/settings/billing/update/free.tsx
index a92446b703f..b48a04e6ce8 100644
--- a/studio/pages/project/[ref]/settings/billing/update/free.tsx
+++ b/studio/pages/project/[ref]/settings/billing/update/free.tsx
@@ -2,25 +2,29 @@ import { useState, useEffect } from 'react'
import { observer } from 'mobx-react-lite'
import { useRouter } from 'next/router'
-import { useStore } from 'hooks'
+import { NextPageWithLayout } from 'types'
+import { useStore, useFlag } from 'hooks'
import { get } from 'lib/common/fetch'
import { API_URL, STRIPE_PRODUCT_IDS } from 'lib/constants'
import { BillingLayout } from 'components/layouts'
import { ExitSurvey, StripeSubscription } from 'components/interfaces/Billing'
-import { NextPageWithLayout } from 'types'
const BillingUpdateFree: NextPageWithLayout = () => {
const { ui } = useStore()
const router = useRouter()
const projectRef = ui.selectedProject?.ref
+ const projectUpdateDisabled = useFlag('disableProjectCreationAndUpdate')
+
const [products, setProducts] = useState<{ tiers: any[]; addons: any[] }>()
const [subscription, setSubscription] = useState<StripeSubscription>()
const [isLoadingProducts, setIsLoadingProducts] = useState(false)
useEffect(() => {
- if (projectRef) {
+ if (projectUpdateDisabled) {
+ router.push(`/project/${projectRef}/settings/billing/update`)
+ } else if (projectRef) {
getStripeProducts()
getSubscription()
}
diff --git a/studio/pages/project/[ref]/settings/billing/update/pro.tsx b/studio/pages/project/[ref]/settings/billing/update/pro.tsx
index 34beb43cd76..288f739c43a 100644
--- a/studio/pages/project/[ref]/settings/billing/update/pro.tsx
+++ b/studio/pages/project/[ref]/settings/billing/update/pro.tsx
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'
import { observer } from 'mobx-react-lite'
import { useRouter } from 'next/router'
-import { useStore } from 'hooks'
+import { useStore, useFlag } from 'hooks'
import { get } from 'lib/common/fetch'
import { API_URL } from 'lib/constants'
@@ -19,6 +19,8 @@ const BillingUpdatePro: NextPageWithLayout = () => {
const projectRef = ui.selectedProject?.ref
const orgSlug = ui.selectedOrganization?.slug
+ const projectUpdateDisabled = useFlag('disableProjectCreationAndUpdate')
+
const [isLoadingProducts, setIsLoadingProducts] = useState(false)
const [isLoadingPaymentMethods, setIsLoadingPaymentMethods] = useState(false)
@@ -34,7 +36,9 @@ const BillingUpdatePro: NextPageWithLayout = () => {
}, [])
useEffect(() => {
- if (projectRef) {
+ if (projectUpdateDisabled) {
+ router.push(`/project/${projectRef}/settings/billing/update`)
+ } else if (projectRef) {
getStripeProducts()
getSubscription()
}