The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: subscription/addons links (#18663)
Kevin Grüneberg0ba347ba0083
diff --git a/apps/docs/pages/guides/platform/custom-domains.mdx b/apps/docs/pages/guides/platform/custom-domains.mdxindex 9d751bca152..9a7d6504f3a 100644--- a/apps/docs/pages/guides/platform/custom-domains.mdx+++ b/apps/docs/pages/guides/platform/custom-domains.mdx@@ -7,7 +7,7 @@ export const meta = {video: 'https://www.youtube.com/v/6rcGnW_Mh-0',}-Custom domains allow you to present a branded experience to your users. Custom domains are available as a [add-on for projects on a paid plan](https://supabase.com/dashboard/project/_/settings/billing/subscription?panel=customDomain). Setting up a custom domain requires [Owner or Admin permissions](/docs/guides/platform/access-control#manage-team-members) for the project. Currently, you must use a subdomain (e.g., `api.example.com`, rather than `example.com`) for the purposes of this guide.+Custom domains allow you to present a branded experience to your users. Custom domains are available as a [add-on for projects on a paid plan](https://supabase.com/dashboard/project/_/settings/addons?panel=customDomain). Setting up a custom domain requires [Owner or Admin permissions](/docs/guides/platform/access-control#manage-team-members) for the project. Currently, you must use a subdomain (e.g., `api.example.com`, rather than `example.com`) for the purposes of this guide.<div className="video-container"><iframe@@ -108,7 +108,8 @@ To get started:1. [Install](/docs/guides/resources/supabase-cli) the Supabase CLI 1.22.0+.1. [Log in](/docs/guides/resources/supabase-getting-started/local-development#log-in-to-the-supabase-cli) to your Supabase account using the CLI.1. Ensure that you have [Owner or Admin permissions](/docs/guides/platform/access-control#manage-team-members) for the project you'd like to set up a vanity subdomain for.-1. Ensure that your project has a paid subscription (Pro/Pay as you go/Enterprise plan) in the [Billing page of the Dashboard](https://supabase.com/dashboard/project/_/settings/billing/subscription).+1. Ensure that your organization is on a paid plan (Pro/Team/Enterprise plan) in the [Billing page of the Dashboard](https://supabase.com/dashboard/org/_/billing).+1. Ensure that your project has the custom domain add on in the [Add ons page of the Dashboard](https://supabase.com/dashboard/project/_/settings/addons).## Configure a Vanity Subdomaindiff --git a/apps/docs/pages/guides/platform/database-size.mdx b/apps/docs/pages/guides/platform/database-size.mdxindex b72cf655e7e..28869a78507 100644--- a/apps/docs/pages/guides/platform/database-size.mdx+++ b/apps/docs/pages/guides/platform/database-size.mdx@@ -6,7 +6,7 @@ export const meta = {description: 'Understanding how database size applies to your subscription.',}-Database size refers to the _monthly average storage usage_, as reported by Postgres. This metric is reported in your project's [billing usage](https://supabase.com/dashboard/project/_/settings/billing/usage) and is updated daily. As you read this document we will refer to "database size" and "disk size":+Database size refers to the _monthly average storage usage_, as reported by Postgres. This metric is reported in your organization's [billing usage](https://supabase.com/dashboard/org/_/usage) and is updated daily. As you read this document we will refer to "database size" and "disk size":- "Database size" is the total size of used storage from your database.- "Disk Storage size" describes the size of the underlying available storage.@@ -77,7 +77,7 @@ The maximum Disk Storage Size for the Pro plan is 16TB. If you need more than thFree Plan projects enter [read-only](#read-only-mode) mode when you exceed the 500MB limit. Once in read-only mode, you have several options:-- [Upgrade to the Pro plan](https://supabase.com/dashboard/project/_/settings/billing/subscription) to increase the limit to 8GB. [Disable the Spend Cap](https://app.supabase.com/project/_/settings/billing/subscription?panel=costControl) if you want your Pro instance to auto-scale and expand beyond the 8GB database size limit.+- [Upgrade to the Pro plan](https://supabase.com/dashboard/org/_/billing) to increase the limit to 8GB. [Disable the Spend Cap](https://app.supabase.com/org/_/billing?panel=costControl) if you want your Pro instance to auto-scale and expand beyond the 8GB database size limit.- [Disable read-only mode](#disabling-read-only-mode) and reduce your database size.### Read-only modediff --git a/apps/docs/pages/guides/platform/exhaust-cpu.mdx b/apps/docs/pages/guides/platform/exhaust-cpu.mdxindex 95fe2a00d9f..96d25fef3a0 100644--- a/apps/docs/pages/guides/platform/exhaust-cpu.mdx+++ b/apps/docs/pages/guides/platform/exhaust-cpu.mdx@@ -42,7 +42,7 @@ Everything you do with your Supabase project requires compute. Hence, there canThere are two ways to solve high CPU:1. **Optimize performance:** Get more out of your instance's resources by optimizing your usage. Have a look at our [performance tuning guide](https://supabase.com/docs/guides/platform/performance#examining-query-performance) and our [production readiness guide](https://supabase.com/docs/guides/platform/going-into-prod#performance).-2. **Upgrade your compute:** You can get a Compute Add-on for your project. Follow [this link](https://supabase.com/dashboard/project/_/settings/billing/subscription?panel=computeInstance) and select your project to see your upgrade options.+2. **Upgrade your compute:** You can get a Compute Add-on for your project. Follow [this link](https://supabase.com/dashboard/project/_/settings/addons?panel=computeInstance) and select your project to see your upgrade options.export const Page = ({ children }) => <Layout meta={meta} children={children} />diff --git a/apps/docs/pages/guides/platform/exhaust-disk-io.mdx b/apps/docs/pages/guides/platform/exhaust-disk-io.mdxindex 23ff66a844d..8801f28cc5b 100644--- a/apps/docs/pages/guides/platform/exhaust-disk-io.mdx+++ b/apps/docs/pages/guides/platform/exhaust-disk-io.mdx@@ -40,7 +40,7 @@ Most operations on your Supabase project require the disk in some form. Hence, t## How to fix-1. **Upgrade your compute:** You can get a Compute Add-on for your project. See your [upgrade options](https://supabase.com/dashboard/project/_/settings/billing/subscription?panel=computeInstance) by selecting your project. Do reference the [different baseline performances](https://supabase.com/docs/guides/platform/compute-add-ons#disk-io) that come with larger Compute Add-ons.+1. **Upgrade your compute:** You can get a Compute Add-on for your project. See your [upgrade options](https://supabase.com/dashboard/project/_/settings/addons?panel=computeInstance) by selecting your project. Do reference the [different baseline performances](https://supabase.com/docs/guides/platform/compute-add-ons#disk-io) that come with larger Compute Add-ons.2. **Optimize performance:** Get more out of your instance's resources by optimizing your usage. Have a look at our [performance tuning guide](https://supabase.com/docs/guides/platform/performance#examining-query-performance) and our [production readiness guide](https://supabase.com/docs/guides/platform/going-into-prod#performance).export const Page = ({ children }) => <Layout meta={meta} children={children} />diff --git a/apps/docs/pages/guides/platform/exhaust-ram.mdx b/apps/docs/pages/guides/platform/exhaust-ram.mdxindex 2e5a68e3c96..69139f07646 100644--- a/apps/docs/pages/guides/platform/exhaust-ram.mdx+++ b/apps/docs/pages/guides/platform/exhaust-ram.mdx@@ -47,7 +47,7 @@ Everything you do with your Supabase project requires memory in some form. Hence## How to fix your memory issues-1. **Upgrade your compute:** You can get a Compute Add-on for your project. See your [upgrade options](https://supabase.com/dashboard/project/_/settings/billing/subscription?panel=computeInstance) by selecting your project.+1. **Upgrade your compute:** You can get a Compute Add-on for your project. See your [upgrade options](https://supabase.com/dashboard/project/_/settings/addons?panel=computeInstance) by selecting your project.2. **Optimize performance:** Get more out of your instance's resources by optimizing your usage. Have a look at our [performance tuning guide](https://supabase.com/docs/guides/platform/performance#examining-query-performance) and our [production readiness guide](https://supabase.com/docs/guides/platform/going-into-prod#performance).export const Page = ({ children }) => <Layout meta={meta} children={children} />diff --git a/apps/docs/pages/guides/platform/going-into-prod.mdx b/apps/docs/pages/guides/platform/going-into-prod.mdxindex 27a69928d19..6c2f4974d0c 100644--- a/apps/docs/pages/guides/platform/going-into-prod.mdx+++ b/apps/docs/pages/guides/platform/going-into-prod.mdx@@ -37,7 +37,7 @@ After developing your project and deciding it's Production Ready, you should run- Tools like [k6](https://k6.io/) can simulate traffic from many different users.- Upgrade your database if you require more resources. If you need anything beyond what is listed, contact [email protected].- If you are expecting a surge in traffic (for a big launch) and are on a teams or enterprise plan, [contact support](https://supabase.com/dashboard/support/new) with more details about your launch and we'll help keep an eye on your project.-- If you expect your database size to be > 4 GB, [enable](https://supabase.com/dashboard/project/_/settings/billing/subscription?panel=pitr) the Point in Time Recovery (PITR) addon. Daily backups can take up resources from your database when the backup is in progress. PITR is more resource efficient, since only the changes to the database are backed up.+- If you expect your database size to be > 4 GB, [enable](https://supabase.com/dashboard/project/_/settings/addons?panel=pitr) the Point in Time Recovery (PITR) addon. Daily backups can take up resources from your database when the backup is in progress. PITR is more resource efficient, since only the changes to the database are backed up.## Availabilitydiff --git a/apps/docs/pages/guides/platform/performance.mdx b/apps/docs/pages/guides/platform/performance.mdxindex 906618c9513..6eb1e9a66cc 100644--- a/apps/docs/pages/guides/platform/performance.mdx+++ b/apps/docs/pages/guides/platform/performance.mdx@@ -142,7 +142,7 @@ from pg_statio_user_tables;This shows the ratio of data blocks fetched from the Postgres [shared_buffers](https://www.postgresql.org/docs/15/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-MEMORY) cache against the data blocks that were read from disk/OS cache.-If either of your index or table hit rate are < 99% then this can indicate your compute plan is too small for your current workload and you would benefit from more memory. [Upgrading your compute](./compute-add-ons) is easy and can be done from your [project dashboard](https://supabase.com/dashboard/project/_/settings/billing/subscription).+If either of your index or table hit rate are < 99% then this can indicate your compute plan is too small for your current workload and you would benefit from more memory. [Upgrading your compute](./compute-add-ons) is easy and can be done from your [project dashboard](https://supabase.com/dashboard/project/_/settings/addons?panel=computeInstance).### Optimizing poor performing queries@@ -191,7 +191,7 @@ FATAL: remaining connection slots are reserved for non-replication superuser conIn such a scenario, you can consider:-- [upgrading to a larger compute add-on](https://supabase.com/dashboard/project/_/settings/billing)+- [upgrading to a larger compute add-on](https://supabase.com/dashboard/project/_/settings/addons?panel=computeInstance)- configuring your clients to use fewer connections- manually configuring the database for a higher number of connectionsdiff --git a/apps/docs/pages/guides/platform/spend-cap.mdx b/apps/docs/pages/guides/platform/spend-cap.mdxindex 9af1f00f458..713fcd80ec9 100644--- a/apps/docs/pages/guides/platform/spend-cap.mdx+++ b/apps/docs/pages/guides/platform/spend-cap.mdx@@ -26,12 +26,12 @@ Supabase charges for certain usage line items in your project. Those line itemsYou can view the pricing, and free quota allowance of each line item on the [pricing page](/pricing).-You can monitor your usage and costs using the [Usage section of your project](https://supabase.com/dashboard/project/_/settings/billing/usage) in the dashboard.+You can monitor your usage and costs using the [Usage section of your organization](https://supabase.com/dashboard/org/_/usage) in the dashboard.This will show you how much you have spent so far in the current billing cycle, as well as an estimate of your expected total cost for the cycle based on your current usage.## How can I turn the Spend Cap on or off?-To set up a Spend Cap in your project, navigate to the [Subscription section](https://supabase.com/dashboard/project/_/settings/billing/subscription) of your project.+To set up a Spend Cap in your project, navigate to the [Subscription section](https://supabase.com/dashboard/org/_/billing) of your organization.From there, you can click on "Change subscription" to select the plan you want to use and, at the same time, turn on or off the Spend Cap.## What happens when the Spend Cap is on?@@ -47,7 +47,7 @@ This additional usage will be charged based on the line item's cost per unit out<Admonition type="note">-When your Spend Cap is **off**, we recommend monitoring your consumption and costs using the [Usage section of your project](https://supabase.com/dashboard/project/_/settings/billing/usage) in the dashboard.+When your Spend Cap is **off**, we recommend monitoring your consumption and costs using the [Usage section of your organization](https://supabase.com/dashboard/org/_/usage) in the dashboard.</Admonition>diff --git a/apps/docs/pages/guides/platform/troubleshooting.mdx b/apps/docs/pages/guides/platform/troubleshooting.mdxindex 001b78510a0..81cf8856d8e 100644--- a/apps/docs/pages/guides/platform/troubleshooting.mdx+++ b/apps/docs/pages/guides/platform/troubleshooting.mdx@@ -26,7 +26,7 @@ You can view the resource utilization of your Supabase Project using the [reportSome common solutions for this issue are:-- [Upgrading](https://supabase.com/dashboard/project/_/settings/billing/subscription) to a [larger compute add-on](../platform/compute-add-ons) in order to serve higher volumes of traffic.+- [Upgrading](https://supabase.com/dashboard/project/_/settings/addons?panel=computeInstance) to a [larger compute add-on](../platform/compute-add-ons) in order to serve higher volumes of traffic.- [Optimizing the queries](../platform/performance#examining-query-performance) being executed.- [Using fewer Postgres connections](../platform/performance#configuring-clients-to-use-fewer-connections) can reduce the amount of resources needed on the project.- [Restarting](https://supabase.com/dashboard/project/_/settings/general) the database. This only temporarily solves the issue by terminating any ongoing workloads that might be tying up your compute resources.@@ -43,7 +43,7 @@ Errors about too many open connections can be _temporarily_ resolved by [restart- If you're receiving a `No more connections allowed (max_client_conn)` error:- Configure your applications and services to [use fewer connections](../platform/performance#configuring-clients-to-use-fewer-connections).- - [Upgrade](https://supabase.com/dashboard/project/_/settings/billing/subscription) to a [larger compute add-on](../platform/compute-add-ons) to increase the number of available connections.+ - [Upgrade](https://supabase.com/dashboard/project/_/settings/addons?panel=computeInstance) to a [larger compute add-on](../platform/compute-add-ons) to increase the number of available connections.- If you're receiving a `sorry, too many clients already` or `remaining connection slots are reserved for non-replication superuser connections` error message in addition to the above suggestions, switch to using the [connection pooler](/docs/guides/database/connecting-to-postgres#connection-pool) instead.### Connection refuseddiff --git a/apps/www/_blog/2022-12-16-postgres-point-in-time-recovery.mdx b/apps/www/_blog/2022-12-16-postgres-point-in-time-recovery.mdxindex b963e69bc3d..16d0697fc0a 100644--- a/apps/www/_blog/2022-12-16-postgres-point-in-time-recovery.mdx+++ b/apps/www/_blog/2022-12-16-postgres-point-in-time-recovery.mdx@@ -41,7 +41,7 @@ While all Pro-plan projects and above are backed up on a daily basis, this means## Getting started-Enabling Point in Time Recovery can be done [in the Dashboard](https://supabase.com/dashboard/project/_/settings/billing/subscription?panel=pitr). Retention for backups used by PITR is set to up to 7 days by default but could be increased to up to 28 days via self-serve.+Enabling Point in Time Recovery can be done [in the Dashboard](https://supabase.com/dashboard/project/_/settings/addons?panel=pitr). Retention for backups used by PITR is set to up to 7 days by default but could be increased to up to 28 days via self-serve.## More Launch Week 6diff --git a/apps/www/_blog/2023-07-06-supabase-beta-update-june-2023.mdx b/apps/www/_blog/2023-07-06-supabase-beta-update-june-2023.mdxindex 01d02c3b895..a155970ff15 100644--- a/apps/www/_blog/2023-07-06-supabase-beta-update-june-2023.mdx+++ b/apps/www/_blog/2023-07-06-supabase-beta-update-june-2023.mdx@@ -53,7 +53,7 @@ We have made huge improvements to the billing tooling inside Supabase Studio, in- Detailed usage billing breakdowns and compute instance specifications.- And more!-[New subscription page](https://app.supabase.com/project/_/settings/billing/subscription) | [New usage page](https://app.supabase.com/project/_/settings/billing/usage)+[New subscription page](https://app.supabase.com/org/_/billing) | [New usage page](https://app.supabase.com/org/_/usage)## Login with Kakaodiff --git a/packages/ui/src/components/Command/utils/shared-nav-items.json b/packages/ui/src/components/Command/utils/shared-nav-items.jsonindex 2e6faf98096..c211351dc87 100644--- a/packages/ui/src/components/Command/utils/shared-nav-items.json+++ b/packages/ui/src/components/Command/utils/shared-nav-items.json@@ -152,18 +152,6 @@"label": "Storage settings","url": "/project/_/settings/storage"},- {- "label": "Subscription settings",- "url": "/project/_/settings/billing/subscription"- },- {- "label": "Project Usage",- "url": "/project/_/settings/billing/usage"- },- {- "label": "Project Invoices",- "url": "/project/_/settings/billing/invoices"- },{"label": "Custom Domains","url": "/project/_/settings/general#custom-domains"diff --git a/studio/components/interfaces/Billing/NoProjectsOnPaidOrgInfo.tsx b/studio/components/interfaces/Billing/NoProjectsOnPaidOrgInfo.tsxindex 866cb166d76..235cc69c305 100644--- a/studio/components/interfaces/Billing/NoProjectsOnPaidOrgInfo.tsx+++ b/studio/components/interfaces/Billing/NoProjectsOnPaidOrgInfo.tsx@@ -11,16 +11,11 @@ interface NoProjectsOnPaidOrgInfoProps {}const NoProjectsOnPaidOrgInfo = ({ organization }: NoProjectsOnPaidOrgInfoProps) => {- const { data: allProjects } = useProjectsQuery({- enabled: organization?.subscription_id != undefined,- })+ const { data: allProjects } = useProjectsQuery({})const projectCount =allProjects?.filter((project) => project.organization_id === organization?.id).length ?? 0- const { data: orgSubscription } = useOrgSubscriptionQuery(- { orgSlug: organization?.slug },- { enabled: organization?.subscription_id != undefined }- )+ const { data: orgSubscription } = useOrgSubscriptionQuery({ orgSlug: organization?.slug })if (projectCount > 0 || orgSubscription?.plan === undefined || orgSubscription.plan.id === 'free')return nulldiff --git a/studio/components/interfaces/BillingV2/Subscription/AddOns/AddOns.tsx b/studio/components/interfaces/BillingV2/Subscription/AddOns/AddOns.tsxdeleted file mode 100644index f9278b26338..00000000000--- a/studio/components/interfaces/BillingV2/Subscription/AddOns/AddOns.tsx+++ /dev/null@@ -1,418 +0,0 @@-import { useParams } from 'common'-import { useTheme } from 'next-themes'-import dayjs from 'dayjs'-import Link from 'next/link'-import { useMemo } from 'react'-import {- Alert,- AlertDescription_Shadcn_,- AlertTitle_Shadcn_,- Alert_Shadcn_,- Button,- IconChevronRight,- IconExternalLink,-} from 'ui'--import ProjectUpdateDisabledTooltip from 'components/interfaces/Organization/BillingSettings/ProjectUpdateDisabledTooltip'-import {- useIsProjectActive,- useProjectContext,-} from 'components/layouts/ProjectLayout/ProjectContext'-import ShimmeringLoader from 'components/ui/ShimmeringLoader'-import { useInfraMonitoringQuery } from 'data/analytics/infra-monitoring-query'-import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'-import { useFlag } from 'hooks'-import { getCloudProviderArchitecture } from 'lib/cloudprovider-utils'-import { BASE_PATH } from 'lib/constants'-import { getSemanticVersion } from 'lib/helpers'-import { useSubscriptionPageStateSnapshot } from 'state/subscription-page'-import Image from 'next/image'-import { getAddons } from 'components/interfaces/Billing/Subscription/Subscription.utils'-import ComputeInstanceSidePanel from 'components/interfaces/Settings/Addons/ComputeInstanceSidePanel'-import PITRSidePanel from 'components/interfaces/Settings/Addons/PITRSidePanel'-import CustomDomainSidePanel from 'components/interfaces/Settings/Addons/CustomDomainSidePanel'--const AddOns = () => {- const { resolvedTheme } = useTheme()- const { ref: projectRef } = useParams()- const snap = useSubscriptionPageStateSnapshot()- const projectUpdateDisabled = useFlag('disableProjectCreationAndUpdate')-- const { project: selectedProject } = useProjectContext()- const isProjectActive = useIsProjectActive()- const cpuArchitecture = getCloudProviderArchitecture(selectedProject?.cloud_provider)-- // Only projects of version greater than supabase-postgrest-14.1.0.44 can use PITR- const sufficientPgVersion = getSemanticVersion(selectedProject?.dbVersion ?? '') >= 141044-- // [Joshen] We could possibly look into reducing the interval to be more "realtime"- // I tried setting the interval to 1m but no data was returned, may need to experiment- const startDate = useMemo(() => dayjs().subtract(15, 'minutes').millisecond(0).toISOString(), [])- const endDate = useMemo(() => dayjs().millisecond(0).toISOString(), [])- const { data: ioBudgetData } = useInfraMonitoringQuery({- projectRef,- attribute: 'disk_io_budget',- interval: '5m',- startDate,- endDate,- })- const [mostRecentRemainingIOBudget] = (ioBudgetData?.data ?? []).slice(-1)-- const { data: addons, isLoading } = useProjectAddonsQuery({ projectRef })- const selectedAddons = addons?.selected_addons ?? []-- const { computeInstance, pitr, customDomain } = getAddons(selectedAddons)-- return (- <>- <div className="grid grid-cols-12 gap-6" id="addons">- <div className="col-span-12 lg:col-span-5">- <div className="sticky top-16">- <div className="space-y-6">- <div>- <p className="text-base">Add ons</p>- <p className="text-sm text-foreground-light">Level up your project with add-ons</p>- </div>- <div className="space-y-2">- <p className="text-sm text-foreground-light">More information</p>- <div>- <Link- href="https://supabase.com/docs/guides/platform/compute-add-ons"- target="_blank"- rel="noreferrer"- >- <div className="flex items-center space-x-2 opacity-50 hover:opacity-100 transition">- <p className="text-sm">Compute add-ons</p>- <IconExternalLink size={16} strokeWidth={1.5} />- </div>- </Link>- </div>- <div>- <Link- href="https://supabase.com/docs/guides/platform/backups#point-in-time-recovery"- target="_blank"- rel="noreferrer"- >- <div className="flex items-center space-x-2 opacity-50 hover:opacity-100 transition">- <p className="text-sm">PITR backups</p>- <IconExternalLink size={16} strokeWidth={1.5} />- </div>- </Link>- </div>- <div>- <Link- href="https://supabase.com/docs/guides/platform/custom-domains"- target="_blank"- rel="noreferrer"- >- <div className="flex items-center space-x-2 opacity-50 hover:opacity-100 transition">- <p className="text-sm">Custom domains</p>- <IconExternalLink size={16} strokeWidth={1.5} />- </div>- </Link>- </div>- <div>- <Link- href="https://supabase.com/docs/guides/database/connecting-to-postgres#connection-pooler"- target="_blank"- rel="noreferrer"- >- <div className="flex items-center space-x-2 opacity-50 hover:opacity-100 transition">- <p className="text-sm">Connection Pooler</p>- <IconExternalLink size={16} strokeWidth={1.5} />- </div>- </Link>- </div>- </div>- </div>- </div>- </div>- {isLoading ? (- <div className="col-span-12 lg:col-span-7 space-y-2">- <ShimmeringLoader />- <ShimmeringLoader className="w-3/4" />- <ShimmeringLoader className="w-1/2" />- </div>- ) : (- <div className="col-span-12 lg:col-span-7 space-y-6">- <div className="py-2 space-y-6">- {/* Compute add on selection */}- <div className="flex space-x-6">- <div>- <div className="rounded-md bg-scale-100 dark:bg-scale-400 w-[160px] h-[96px] shadow">- <img- alt="Optimized Compute"- width={160}- height={96}- src={- computeInstance !== undefined- ? `${BASE_PATH}/img/optimized-compute-on${- resolvedTheme === 'dark' ? '' : '--light'- }.png`- : `${BASE_PATH}/img/optimized-compute-off${- resolvedTheme === 'dark' ? '' : '--light'- }.png`- }- />- </div>- </div>- <div className="flex-grow">- <p className="text-sm text-foreground-light">Optimized compute</p>- <p className="">{computeInstance?.variant.name ?? 'Micro'}</p>- <ProjectUpdateDisabledTooltip- projectUpdateDisabled={projectUpdateDisabled}- projectNotActive={!isProjectActive}- >- <Button- type="default"- className="mt-2 pointer-events-auto"- onClick={() => snap.setPanelKey('computeInstance')}- disabled={!isProjectActive || projectUpdateDisabled}- >- Change compute size- </Button>- </ProjectUpdateDisabledTooltip>-- {Number(mostRecentRemainingIOBudget?.disk_io_budget) === 0 ? (- <Alert- withIcon- className="mt-4"- variant="danger"- title="Your disk IO budget has run out for today"- >- <p>- Your workload is currently running at the baseline disk IO bandwidth at{' '}- {computeInstance?.variant?.meta?.baseline_disk_io_mbs?.toLocaleString() ??- 87}{' '}- Mbps and may suffer degradation in performance.- </p>- <p className="mt-1">- Consider upgrading to a larger compute instance for a higher baseline- throughput.- </p>- </Alert>- ) : Number(mostRecentRemainingIOBudget?.disk_io_budget) <= 10 ? (- <Alert- withIcon- className="mt-4"- variant="warning"- title="Your disk IO budget is running out for today"- >- <p>- If the disk IO budget drops to zero, your workload will run at the baseline- disk IO bandwidth at{' '}- {computeInstance?.variant?.meta?.baseline_disk_io_mbs?.toLocaleString() ??- 87}{' '}- Mbps and may suffer degradation in performance.- </p>- <p className="mt-1">- Consider upgrading to a larger compute instance for a higher baseline- throughput.- </p>- </Alert>- ) : null}-- <div className="mt-2 w-full flex items-center justify-between border-b py-2">- <Link href={`/project/${projectRef}/settings/billing/usage#ram`}>- <div className="group flex items-center space-x-2">- <p className="text-sm text-foreground-light group-hover:text-foreground transition cursor-pointer">- Memory- </p>- <IconChevronRight- strokeWidth={1.5}- size={16}- className="transition opacity-0 -translate-x-2 group-hover:opacity-100 group-hover:translate-x-0"- />- </div>- </Link>- <p className="text-sm">{computeInstance?.variant?.meta?.memory_gb ?? 1} GB</p>- </div>- <div className="w-full flex items-center justify-between border-b py-2">- <Link href={`/project/${projectRef}/settings/billing/usage#cpu`}>- <div className="group flex items-center space-x-2">- <p className="text-sm text-foreground-light group-hover:text-foreground transition cursor-pointer">- CPU- </p>- <IconChevronRight- strokeWidth={1.5}- size={16}- className="transition opacity-0 -translate-x-2 group-hover:opacity-100 group-hover:translate-x-0"- />- </div>- </Link>- <p className="text-sm">- {computeInstance?.variant?.meta?.cpu_cores ?? 2}-core {cpuArchitecture}{' '}- {computeInstance?.variant?.meta?.cpu_dedicated ? '(Dedicated)' : '(Shared)'}- </p>- </div>- <div className="w-full flex items-center justify-between border-b py-2">- <p className="text-sm text-foreground-light">No. of direct connections</p>- <p className="text-sm">- {computeInstance?.variant?.meta?.connections_direct ?? 60}- </p>- </div>- <div className="w-full flex items-center justify-between border-b py-2">- <p className="text-sm text-foreground-light">No. of pooler connections</p>- <p className="text-sm">- {computeInstance?.variant?.meta?.connections_pooler ?? 200}- </p>- </div>- <div className="w-full flex items-center justify-between border-b py-2">- <Link href={`/project/${projectRef}/settings/billing/usage#disk_io`}>- <div className="group flex items-center space-x-2">- <p className="text-sm text-foreground-light group-hover:text-foreground transition cursor-pointer">- Max Disk Throughput- </p>- <IconChevronRight- strokeWidth={1.5}- size={16}- className="transition opacity-0 -translate-x-2 group-hover:opacity-100 group-hover:translate-x-0"- />- </div>- </Link>- <p className="text-sm">- {computeInstance?.variant?.meta?.max_disk_io_mbs?.toLocaleString() ?? '2,085'}{' '}- Mbps- </p>- </div>- <div className="w-full flex items-center justify-between py-2">- <Link href={`/project/${projectRef}/settings/billing/usage#disk_io`}>- <div className="group flex items-center space-x-2">- <p className="text-sm text-foreground-light group-hover:text-foreground transition cursor-pointer">- Baseline Disk Throughput- </p>- <IconChevronRight- strokeWidth={1.5}- size={16}- className="transition opacity-0 -translate-x-2 group-hover:opacity-100 group-hover:translate-x-0"- />- </div>- </Link>- <p className="text-sm">- {computeInstance?.variant?.meta?.baseline_disk_io_mbs?.toLocaleString() ?? 87}{' '}- Mbps- </p>- </div>- </div>- </div>-- <div className="w-full border-t" />-- {/* PITR selection */}- <div className="flex space-x-6">- <div>- <div className="rounded-md bg-scale-100 dark:bg-scale-400 w-[160px] h-[96px] shadow">- <img- alt="Point-In-Time-Recovery"- width={160}- height={96}- src={- pitr !== undefined- ? `${BASE_PATH}/img/pitr-on${- resolvedTheme === 'dark' ? '' : '--light'- }.png?v=2`- : `${BASE_PATH}/img/pitr-off${- resolvedTheme === 'dark' ? '' : '--light'- }.png?v=2`- }- />- </div>- </div>- <div>- <p className="text-sm text-foreground-light">Point in time recovery</p>- <p className="">- {pitr !== undefined- ? `Point in time recovery of ${pitr.variant.meta?.backup_duration_days} days is enabled`- : 'Point in time recovery is not enabled'}- </p>- {!sufficientPgVersion ? (- <Alert_Shadcn_ className="mt-2">- <AlertTitle_Shadcn_>Your project is too old enable PITR</AlertTitle_Shadcn_>- <AlertDescription_Shadcn_>- <p className="text-sm leading-normal mb-2">- Reach out to us via support if you're interested- </p>- <Button asChild type="default">- <Link- href={`/support/new?ref=${projectRef}&category=sales&subject=Project%20too%20old%20old%20for%20PITR`}- >- Contact support- </Link>- </Button>- </AlertDescription_Shadcn_>- </Alert_Shadcn_>- ) : (- <ProjectUpdateDisabledTooltip- projectUpdateDisabled={projectUpdateDisabled}- projectNotActive={!isProjectActive}- >- <Button- type="default"- className="mt-2 pointer-events-auto"- onClick={() => snap.setPanelKey('pitr')}- disabled={!isProjectActive || projectUpdateDisabled || !sufficientPgVersion}- >- Change point in time recovery- </Button>- </ProjectUpdateDisabledTooltip>- )}- </div>- </div>-- <div className="w-full border-t" />-- {/* Custom domain selection */}- <div className="flex space-x-6">- <div>- <div className="rounded-md bg-scale-100 dark:bg-scale-400 w-[160px] h-[96px] shadow">- <Image- alt="Custom Domain"- width={160}- height={96}- src={- customDomain !== undefined- ? `${BASE_PATH}/img/custom-domain-on${- resolvedTheme === 'dark' ? '' : '--light'- }.png`- : `${BASE_PATH}/img/custom-domain-off${- resolvedTheme === 'dark' ? '' : '--light'- }.png`- }- />- </div>- </div>- <div>- <p className="text-sm text-foreground-light">Custom domain</p>- <p className="">- {customDomain !== undefined- ? 'Custom domain is enabled'- : 'Custom domain is not enabled'}- </p>- <ProjectUpdateDisabledTooltip- projectUpdateDisabled={projectUpdateDisabled}- projectNotActive={!isProjectActive}- >- <Button- type="default"- className="mt-2 pointer-events-auto"- onClick={() => snap.setPanelKey('customDomain')}- disabled={!isProjectActive || projectUpdateDisabled}- >- Change custom domain- </Button>- </ProjectUpdateDisabledTooltip>- </div>- </div>- </div>- </div>- )}- </div>-- <ComputeInstanceSidePanel />- <PITRSidePanel />- <CustomDomainSidePanel />- </>- )-}--export default AddOnsdiff --git a/studio/components/interfaces/Database/Backups/PITR/PITRNotice.tsx b/studio/components/interfaces/Database/Backups/PITR/PITRNotice.tsxindex a58f427551c..f8106117fb9 100644--- a/studio/components/interfaces/Database/Backups/PITR/PITRNotice.tsx+++ b/studio/components/interfaces/Database/Backups/PITR/PITRNotice.tsx@@ -30,7 +30,7 @@ const PITRNotice = ({}) => {<Tooltip.Root delayDuration={0}><Tooltip.Trigger asChild><Button asChild disabled={canUpdateSubscription} type="default">- <Link href={`/project/${projectRef}/settings/billing/subscription?panel=pitr`}>+ <Link href={`/project/${projectRef}/settings/addons?panel=pitr`}>Increase retention period</Link></Button>diff --git a/studio/components/interfaces/Organization/BillingSettings/Subscription/PaymentMethodSelection.tsx b/studio/components/interfaces/Organization/BillingSettings/Subscription/PaymentMethodSelection.tsxindex e21e18613b6..2b827ea5c6a 100644--- a/studio/components/interfaces/Organization/BillingSettings/Subscription/PaymentMethodSelection.tsx+++ b/studio/components/interfaces/Organization/BillingSettings/Subscription/PaymentMethodSelection.tsx@@ -163,7 +163,7 @@ const PaymentMethodSelection = ({<AddNewPaymentMethodModalvisible={showAddNewPaymentMethodModal}- returnUrl={`${getURL()}/project/${projectRef}/settings/billing/subscription?panel=subscriptionPlan`}+ returnUrl={`${getURL()}/org/${selectedOrganization?.slug}/billing?panel=subscriptionPlan`}onCancel={() => setShowAddNewPaymentMethodModal(false)}onConfirm={async () => {setShowAddNewPaymentMethodModal(false)diff --git a/studio/components/interfaces/Organization/NewProject/FreeProjectLimitWarning.tsx b/studio/components/interfaces/Organization/NewProject/FreeProjectLimitWarning.tsxindex 7e98d388c7c..b3b1101188e 100644--- a/studio/components/interfaces/Organization/NewProject/FreeProjectLimitWarning.tsx+++ b/studio/components/interfaces/Organization/NewProject/FreeProjectLimitWarning.tsx@@ -6,13 +6,11 @@ import { MemberWithFreeProjectLimit } from 'data/organizations/free-project-limiinterface FreeProjectLimitWarningProps {membersExceededLimit: MemberWithFreeProjectLimit[]- orgLevelBilling: booleanorgSlug: string}const FreeProjectLimitWarning = ({membersExceededLimit,- orgLevelBilling,orgSlug,}: FreeProjectLimitWarningProps) => {return (@@ -41,13 +39,11 @@ const FreeProjectLimitWarning = ({projects before you're able to create a free project within this organization.</p>- {orgLevelBilling && (- <div>- <Button asChild type="primary">- <Link href={`/org/${orgSlug}/billing?panel=subscriptionPlan`}>Upgrade plan</Link>- </Button>- </div>- )}+ <div>+ <Button asChild type="primary">+ <Link href={`/org/${orgSlug}/billing?panel=subscriptionPlan`}>Upgrade plan</Link>+ </Button>+ </div></div>}/>diff --git a/studio/components/interfaces/Settings/Database/DiskSizeConfiguration.tsx b/studio/components/interfaces/Settings/Database/DiskSizeConfiguration.tsxindex f6ccac95a20..b94c349ad33 100644--- a/studio/components/interfaces/Settings/Database/DiskSizeConfiguration.tsx+++ b/studio/components/interfaces/Settings/Database/DiskSizeConfiguration.tsx@@ -161,7 +161,7 @@ const DiskSizeConfiguration = ({ disabled = false }: DiskSizeConfigurationProps)title={'Disk size configuration is not available for projects on the Free plan'}actions={<Button asChild type="default">- <Link href={`/project/${projectRef}/settings/billing/subscription`}>+ <Link href={`/org/${organization?.slug}/billing?panel=subscriptionPlan`}>Upgrade subscription</Link></Button>diff --git a/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx b/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsxindex 003e5c265d4..4740e8915c0 100644--- a/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx+++ b/studio/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectButton.tsx@@ -29,10 +29,7 @@ const TransferProjectButton = () => {const { data: allOrganizations } = useOrganizationsQuery()const disableProjectTransfer = useFlag('disableProjectTransfer')- const organizations = (allOrganizations || [])- .filter((it) => it.id !== projectOrgId)- // Only orgs with org-based subscription- .filter((it) => it.subscription_id)+ const organizations = (allOrganizations || []).filter((it) => it.id !== projectOrgId)const [isOpen, setIsOpen] = useState(false)const [selectedOrg, setSelectedOrg] = useState()diff --git a/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx b/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsxindex b06be1ba654..9c985f50de8 100644--- a/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx+++ b/studio/components/interfaces/Settings/Logs/UpgradePrompt.tsx@@ -3,6 +3,7 @@ import { Button, Modal } from 'ui'import Link from 'next/link'import { useRouter } from 'next/router'import { TIER_QUERY_LIMITS } from '.'+import { useSelectedOrganization } from 'hooks'interface Props {show: boolean@@ -10,8 +11,7 @@ interface Props {}const UpgradePrompt: React.FC<Props> = ({ show, setShowUpgradePrompt }) => {- const router = useRouter()- const { ref } = router.query+ const organization = useSelectedOrganization()return (<Modal@@ -62,7 +62,9 @@ const UpgradePrompt: React.FC<Props> = ({ show, setShowUpgradePrompt }) => {Close</Button><Button asChild size="tiny">- <Link href={`/project/${ref}/settings/billing/subscription`}>Upgrade</Link>+ <Link href={`/org/${organization?.slug}/billing?panel=subscriptionPlan`}>+ Upgrade+ </Link></Button></div></Modal.Content>diff --git a/studio/components/interfaces/Support/DisabledStateForFreeTier.tsx b/studio/components/interfaces/Support/DisabledStateForFreeTier.tsxindex c4a22e72d49..3bb2262b6a9 100644--- a/studio/components/interfaces/Support/DisabledStateForFreeTier.tsx+++ b/studio/components/interfaces/Support/DisabledStateForFreeTier.tsx@@ -4,11 +4,14 @@ import { Button, IconAlertCircle, IconExternalLink } from 'ui'import InformationBox from 'components/ui/InformationBox'interface DisabledStateForFreeTierProps {- projectRef: string+ organizationSlug: stringcategory: string}-const DisabledStateForFreeTier = ({ projectRef, category }: DisabledStateForFreeTierProps) => {+const DisabledStateForFreeTier = ({+ organizationSlug,+ category,+}: DisabledStateForFreeTierProps) => {return (<div className="px-6"><InformationBox@@ -21,9 +24,7 @@ const DisabledStateForFreeTier = ({ projectRef, category }: DisabledStateForFree<p>Upgrade your project to the Pro plan for support in this area</p><div className="flex items-center space-x-2"><Button asChild>- <Link- href={`/project/${projectRef}/settings/billing/subscription?panel=subscriptionPlan`}- >+ <Link href={`/org/${organizationSlug}/billing?panel=subscriptionPlan`}>Upgrade project</Link></Button>diff --git a/studio/components/interfaces/Support/SupportForm.tsx b/studio/components/interfaces/Support/SupportForm.tsxindex d80aa255198..a45c39f5181 100644--- a/studio/components/interfaces/Support/SupportForm.tsx+++ b/studio/components/interfaces/Support/SupportForm.tsx@@ -445,7 +445,7 @@ const SupportForm = ({ setSentCategory }: SupportFormProps) => {<div className="flex items-center space-x-2"><Button asChild><Link- href={`/project/${values.projectRef}/settings/billing/subscription?panel=subscriptionPlan`}+ href={`/org/${values.organizationSlug}/billing?panel=subscriptionPlan`}>Upgrade project</Link>@@ -473,7 +473,7 @@ const SupportForm = ({ setSentCategory }: SupportFormProps) => {{['Performance'].includes(values.category) && isFreeProject ? (<DisabledStateForFreeTiercategory={selectedCategory?.label ?? ''}- projectRef={values.projectRef}+ organizationSlug={selectedOrganizationSlug ?? ''}/>) : (<>diff --git a/studio/components/layouts/BillingLayout.tsx b/studio/components/layouts/BillingLayout.tsxindex 8f9c31c67cd..29019c6f295 100644--- a/studio/components/layouts/BillingLayout.tsx+++ b/studio/components/layouts/BillingLayout.tsx@@ -17,7 +17,7 @@ const BillingLayout = ({ children }: PropsWithChildren<BillingLayoutProps>) => {{/* Header */}<div className="flex items-center space-x-4 border-b py-4 px-5 dark:border-dark"><Link- href={`/project/${selectedProject?.ref}/settings/billing/subscription`}+ href={`/org/${selectedOrganization?.slug}/billing`}className="text-foreground-lighter transition-colors hover:text-foreground"><IconX size={16} strokeWidth={1.5} />diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsxindex c37b8bf5a83..9bf3ebcc7af 100644--- a/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx@@ -82,13 +82,7 @@ const LayoutHeader = ({ customHeaderComponents, breadcrumbs = [], headerBorder ={showOverUsageBadge && (<div className="ml-2">- <Link- href={- selectedOrganization?.subscription_id- ? `/org/${selectedOrganization.slug}/usage`- : `/project/${projectRef}/settings/billing/usage`- }- >+ <Link href={`/org/${selectedOrganization?.slug}/usage`}><Badge color="red">Exceeding usage limits</Badge></Link></div>diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationActions.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationActions.tsxindex 5a83ecc303f..83695319557 100644--- a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationActions.tsx+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationActions.tsx@@ -4,10 +4,11 @@ import { useRouter } from 'next/router'import { Fragment } from 'react'import { Button, IconExternalLink } from 'ui'-import { Project } from 'types'+import { Organization, Project } from 'types'interface NotificationActionsProps {project: Project+ organization: OrganizationchangelogLink?: stringavailableActions: Action[]onSelectRestartProject: () => void@@ -17,6 +18,7 @@ interface NotificationActionsProps {const NotificationActions = ({project,+ organization,changelogLink,availableActions,onSelectRestartProject,@@ -25,18 +27,16 @@ const NotificationActions = ({}: NotificationActionsProps) => {const router = useRouter()- const onSelectUpgradeProject = () => {- return router.push(- `/project/${project.ref}/settings/billing/subscription?panel=subscriptionPlan`- )+ const onSelectUpgradePlan = () => {+ return router.push(`/org/${organization.slug}/billing?panel=subscriptionPlan`)}const renderActionButton = (action: Action) => {switch (action.action_type) {case ActionType.UpgradeProjectToPro:return (- <Button type="default" onClick={onSelectUpgradeProject}>- Upgrade project+ <Button type="default" onClick={onSelectUpgradePlan}>+ Upgrade plan</Button>)case ActionType.SchedulePostgresRestart:diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsxindex 53f6d1b42f8..eda6d9dc5fe 100644--- a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx@@ -8,6 +8,7 @@ import { useStore } from 'hooks'import { Project } from 'types'import NotificationActions from './NotificationActions'import { formatNotificationCTAText, formatNotificationText } from './NotificationRows.utils'+import { useOrganizationsQuery } from 'data/organizations/organizations-query'export interface NotificationRowProps {notification: Notification@@ -24,7 +25,9 @@ const NotificationRow = ({}: NotificationRowProps) => {const { ui } = useStore()const { data: projects } = useProjectsQuery()+ const { data: organizations } = useOrganizationsQuery()const project = projects?.find((project) => project.id === notification.project_id)+ const organization = organizations?.find((org) => org.id === project?.organization_id)const insertedAt = dayjs(notification.inserted_at).format('DD MMM YYYY, HH:mma')const changelogLink = (notification.data as any).changelog_link@@ -48,7 +51,7 @@ const NotificationRow = ({dismissNotifications({ ids: [notificationId] })}- if (!project) return null+ if (!project || !organization) return nullreturn (<div className="flex py-2">@@ -86,6 +89,7 @@ const NotificationRow = ({<div className="flex items-center"><NotificationActionsproject={project}+ organization={organization}changelogLink={changelogLink}availableActions={availableActions}onSelectRestartProject={() => onSelectRestartProject(project, notification)}diff --git a/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/studio/components/layouts/ProjectLayout/ProjectLayout.tsxindex be8f1817046..83a17a081de 100644--- a/studio/components/layouts/ProjectLayout/ProjectLayout.tsx+++ b/studio/components/layouts/ProjectLayout/ProjectLayout.tsx@@ -28,9 +28,6 @@ const routesToIgnoreProjectDetailsRequest = ['/project/[ref]/settings/database','/project/[ref]/settings/storage','/project/[ref]/settings/infrastructure',- '/project/[ref]/settings/billing/subscription',- '/project/[ref]/settings/billing/usage',- '/project/[ref]/settings/billing/invoices',]const routesToIgnoreDBConnection = ['/project/[ref]/branches']@@ -40,9 +37,6 @@ const routesToIgnorePostgrestConnection = ['/project/[ref]/settings/general','/project/[ref]/settings/database','/project/[ref]/settings/infrastructure',- '/project/[ref]/settings/billing/subscription',- '/project/[ref]/settings/billing/usage',- '/project/[ref]/settings/billing/invoices',]export interface ProjectLayoutProps {diff --git a/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx b/studio/components/layouts/ProjectLayout/ProjectPausedState.tsxindex dfaf94f1f66..0c98998cf96 100644--- a/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx+++ b/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx@@ -29,7 +29,6 @@ const ProjectPausedState = ({ product }: ProjectPausedStateProps) => {const { data: subscription } = useOrgSubscriptionQuery({ orgSlug })const isFreePlan = subscription?.plan?.id === 'free'- const billedViaOrg = Boolean(selectedOrganization?.subscription_id)const { data: membersExceededLimit } = useFreeProjectLimitCheckQuery({ slug: orgSlug })const hasMembersExceedingFreeTierLimit = (membersExceededLimit || []).length > 0@@ -150,13 +149,7 @@ const ProjectPausedState = ({ product }: ProjectPausedStateProps) => {</Tooltip.Root>{isFreePlan ? (<Button asChild type="default">- <Link- href={- billedViaOrg- ? `/org/${orgSlug}/billing?panel=subscriptionPlan`- : `/project/${ref}/settings/billing/subscription?panel=subscriptionPlan`- }- >+ <Link href={`/org/${orgSlug}/billing?panel=subscriptionPlan`}>Upgrade to Pro</Link></Button>diff --git a/studio/lib/constants/infrastructure.ts b/studio/lib/constants/infrastructure.tsindex e6d02193b3d..c6392782d12 100644--- a/studio/lib/constants/infrastructure.ts+++ b/studio/lib/constants/infrastructure.ts@@ -32,11 +32,6 @@ export const AWS_REGIONS_DEFAULT =// TO DO, change default to US region for prodexport const FLY_REGIONS_DEFAULT = FLY_REGIONS.SOUTHEAST_ASIA-export const PRICING_TIER_LABELS = {- FREE: 'Free',- PRO: 'Pro',-}-export const PRICING_TIER_LABELS_ORG = {FREE: 'Free - $0/month',PRO: 'Pro - $25/month',@@ -51,9 +46,6 @@ export const PRICING_TIER_PRODUCT_IDS = {ENTERPRISE: 'tier_enterprise',}-export const PRICING_TIER_FREE_KEY = 'FREE'-export const PRICING_TIER_DEFAULT_KEY = 'FREE'-export const DEFAULT_PROVIDER: CloudProvider =process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod' ? 'FLY' : 'AWS'diff --git a/studio/next.config.js b/studio/next.config.jsindex 3fc6472ea59..71d9256f78d 100644--- a/studio/next.config.js+++ b/studio/next.config.js@@ -85,8 +85,56 @@ const nextConfig = {permanent: true,},{- source: '/project/:ref/settings/billing',- destination: '/project/:ref/settings/billing/subscription',+ source: '/project/:ref/settings/billing/subscription',+ has: [+ {+ type: 'query',+ key: 'panel',+ value: 'subscriptionPlan',+ },+ ],+ destination: '/org/_/billing?panel=subscriptionPlan',+ permanent: true,+ },+ {+ source: '/project/:ref/settings/billing/subscription',+ has: [+ {+ type: 'query',+ key: 'panel',+ value: 'pitr',+ },+ ],+ destination: '/project/:ref/settings/addons?panel=pitr',+ permanent: true,+ },+ {+ source: '/project/:ref/settings/billing/subscription',+ has: [+ {+ type: 'query',+ key: 'panel',+ value: 'computeInstance',+ },+ ],+ destination: '/project/:ref/settings/addons?panel=computeInstance',+ permanent: true,+ },+ {+ source: '/project/:ref/settings/billing/subscription',+ has: [+ {+ type: 'query',+ key: 'panel',+ value: 'customDomain',+ },+ ],+ destination: '/project/:ref/settings/addons?panel=customDomain',+ permanent: true,+ },+ {+ source: '/project/:ref/settings/billing/subscription',+ destination: '/org/_/billing',permanent: true,},{@@ -146,27 +194,27 @@ const nextConfig = {},{source: '/project/:ref/settings/billing/update',- destination: '/project/:ref/settings/billing/subscription',+ destination: '/org/_/billing',permanent: true,},{source: '/project/:ref/settings/billing/update/free',- destination: '/project/:ref/settings/billing/subscription',+ destination: '/org/_/billing',permanent: true,},{source: '/project/:ref/settings/billing/update/pro',- destination: '/project/:ref/settings/billing/subscription',+ destination: '/org/_/billing',permanent: true,},{source: '/project/:ref/settings/billing/update/team',- destination: '/project/:ref/settings/billing/subscription',+ destination: '/org/_/billing',permanent: true,},{source: '/project/:ref/settings/billing/update/enterprise',- destination: '/project/:ref/settings/billing/subscription',+ destination: '/org/_/billing',permanent: true,},{diff --git a/studio/pages/new/[slug].tsx b/studio/pages/new/[slug].tsxindex b8ad25a2ea7..a9becae5169 100644--- a/studio/pages/new/[slug].tsx+++ b/studio/pages/new/[slug].tsx@@ -8,7 +8,6 @@ import { useRouter } from 'next/router'import { PropsWithChildren, useEffect, useRef, useState } from 'react'import {- EmptyPaymentMethodWarning,FreeProjectLimitWarning,NotOrganizationOwnerWarning,} from 'components/interfaces/Organization/NewProject'@@ -18,7 +17,6 @@ import InformationBox from 'components/ui/InformationBox'import Panel from 'components/ui/Panel'import PasswordStrengthBar from 'components/ui/PasswordStrengthBar'import { useFreeProjectLimitCheckQuery } from 'data/organizations/free-project-limit-check-query'-import { useOrganizationPaymentMethodsQuery } from 'data/organizations/organization-payment-methods-query'import { useOrganizationsQuery } from 'data/organizations/organizations-query'import {ProjectCreateVariables,@@ -33,27 +31,12 @@ import {DEFAULT_MINIMUM_PASSWORD_STRENGTH,DEFAULT_PROVIDER,FLY_REGIONS,- PRICING_TIER_DEFAULT_KEY,- PRICING_TIER_FREE_KEY,- PRICING_TIER_LABELS,- PRICING_TIER_PRODUCT_IDS,PROVIDERS,Region,} from 'lib/constants'import { passwordStrength, pluckObjectFields } from 'lib/helpers'import { NextPageWithLayout } from 'types'-import {- Alert,- Button,- IconExternalLink,- IconHelpCircle,- IconInfo,- IconUsers,- Input,- Listbox,- Toggle,-} from 'ui'-import SpendCapModal from 'components/interfaces/Billing/SpendCapModal'+import { Button, IconExternalLink, IconInfo, IconUsers, Input, Listbox } from 'ui'const Wizard: NextPageWithLayout = () => {const router = useRouter()@@ -71,28 +54,16 @@ const Wizard: NextPageWithLayout = () => {const [dbPass, setDbPass] = useState('')const [dbRegion, setDbRegion] = useState(PROVIDERS[cloudProvider].default_region)- const [dbPricingTierKey, setDbPricingTierKey] = useState(PRICING_TIER_DEFAULT_KEY)const [passwordStrengthMessage, setPasswordStrengthMessage] = useState('')const [passwordStrengthWarning, setPasswordStrengthWarning] = useState('')const [passwordStrengthScore, setPasswordStrengthScore] = useState(0)- const [showSpendCapHelperModal, setShowSpendCapHelperModal] = useState(false)- const [isSpendCapEnabled, setIsSpendCapEnabled] = useState(true)const { data: organizations, isSuccess: isOrganizationsSuccess } = useOrganizationsQuery()const currentOrg = organizations?.find((o: any) => o.slug === slug)- const billedViaOrg = Boolean(currentOrg?.subscription_id)- const { data: paymentMethods, refetch: refetchPaymentMethods } =- useOrganizationPaymentMethodsQuery({ slug })+ const { data: orgSubscription } = useOrgSubscriptionQuery({ orgSlug: slug })- const { data: orgSubscription } = useOrgSubscriptionQuery(- { orgSlug: slug },- { enabled: billedViaOrg }- )-- const { data: allProjects } = useProjectsQuery({- enabled: currentOrg?.subscription_id != undefined,- })+ const { data: allProjects } = useProjectsQuery({})const {mutate: createProject,@@ -115,23 +86,19 @@ const Wizard: NextPageWithLayout = () => {const isAdmin = useCheckPermissions(PermissionAction.CREATE, 'projects')const isInvalidSlug = isUndefined(currentOrg)const isEmptyOrganizations = (organizations?.length ?? 0) <= 0 && isOrganizationsSuccess- const isEmptyPaymentMethod = paymentMethods ? !paymentMethods.length : false- const isSelectFreeTier = dbPricingTierKey === PRICING_TIER_FREE_KEYconst hasMembersExceedingFreeTierLimit = (membersExceededLimit || []).length > 0const showNonProdFields = process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod'const freePlanWithExceedingLimits =- ((isSelectFreeTier && !billedViaOrg) || orgSubscription?.plan?.id === 'free') &&- hasMembersExceedingFreeTierLimit+ orgSubscription?.plan?.id === 'free' && hasMembersExceedingFreeTierLimitconst canCreateProject = isAdmin && !freePlanWithExceedingLimitsconst canSubmit =projectName !== '' &&passwordStrengthScore >= DEFAULT_MINIMUM_PASSWORD_STRENGTH &&- dbRegion !== undefined &&- dbPricingTierKey !== ''+ dbRegion !== undefinedconst delayedCheckPasswordStrength = useRef(debounce((value) => checkPasswordStrength(value), 300)@@ -185,10 +152,6 @@ const Wizard: NextPageWithLayout = () => {}}- function onDbPricingPlanChange(value: string) {- setDbPricingTierKey(value)- }-async function checkPasswordStrength(value: any) {const { message, warning, strength } = await passwordStrength(value)setPasswordStrengthScore(strength)@@ -199,14 +162,13 @@ const Wizard: NextPageWithLayout = () => {const onClickNext = async () => {if (!currentOrg) return console.error('Unable to retrieve current organization')- const dbTier = dbPricingTierKey === 'PRO' && !isSpendCapEnabled ? 'PAYG' : dbPricingTierKeyconst data: ProjectCreateVariables = {cloudProvider,organizationId: currentOrg.id,name: projectName.trim(),dbPass: dbPass,dbRegion: dbRegion,- dbPricingTierId: (PRICING_TIER_PRODUCT_IDS as any)[dbTier],+ dbPricingTierId: 'tier_free', // gets ignored due to org billing subscription anyway}if (postgresVersion) {if (!postgresVersion.match(/1[2-9]\..*/)) {@@ -462,233 +424,78 @@ const Wizard: NextPageWithLayout = () => {</>)}- {billedViaOrg && (- <Panel.Content>- <InformationBox- icon={<IconInfo size="large" strokeWidth={1.5} />}- defaultVisibility={true}- hideCollapse- title="Billed via organization"- description={- <div className="space-y-3">- <p className="text-sm leading-normal">- This organization uses the new organization-based billing and is on the{' '}- <span className="text-brand">{orgSubscription?.plan?.name} plan</span>.- </p>-- {/* Show info when launching a new project in a paid org that has no project yet */}- {orgSubscription?.plan?.id !== 'free' && orgProjectCount === 0 && (- <div>- <p>- As this is the first project you're launching in this organization, it- comes with no additional compute costs.- </p>- </div>- )}-- {/* Show info when launching a new project in a paid org that already has at least one project */}- {orgSubscription?.plan?.id !== 'free' && orgProjectCount > 0 && (- <div>- <p>- Launching another project incurs additional compute costs, starting at- $0.01344 per hour (~$10/month). You can also create a new organization- under the free plan in case you have not exceeded your 2 free project- limit.- </p>- </div>- )}-- <div className="space-x-3">- <Button- asChild- type="default"- icon={<IconExternalLink strokeWidth={1.5} />}- >- <Link- href="https://supabase.com/blog/organization-based-billing"- target="_blank"- rel="noreferrer"- >- Announcement- </Link>- </Button>- <Button- asChild- type="default"- icon={<IconExternalLink strokeWidth={1.5} />}- >- <Link- href="https://supabase.com/docs/guides/platform/org-based-billing"- target="_blank"- rel="noreferrer"- >- Documentation- </Link>- </Button>+ <Panel.Content>+ <InformationBox+ icon={<IconInfo size="large" strokeWidth={1.5} />}+ defaultVisibility={true}+ hideCollapse+ title="Billed via organization"+ description={+ <div className="space-y-3">+ <p className="text-sm leading-normal">+ This organization uses the new organization-based billing and is on the{' '}+ <span className="text-brand">{orgSubscription?.plan?.name} plan</span>.+ </p>++ {/* Show info when launching a new project in a paid org that has no project yet */}+ {orgSubscription?.plan?.id !== 'free' && orgProjectCount === 0 && (+ <div>+ <p>+ As this is the first project you're launching in this organization, it+ comes with no additional compute costs.+ </p></div>- </div>- }- />- </Panel.Content>- )}+ )}- {isAdmin && (- <Panel.Content>- {!billedViaOrg && (- <Listbox- label="Pricing Plan"- layout="horizontal"- value={dbPricingTierKey}- onChange={onDbPricingPlanChange}- descriptionText={- <>- Select a plan that suits your needs. - <a- className="underline"+ {/* Show info when launching a new project in a paid org that already has at least one project */}+ {orgSubscription?.plan?.id !== 'free' && orgProjectCount > 0 && (+ <div>+ <p>+ Launching another project incurs additional compute costs, starting at+ $0.01344 per hour (~$10/month). You can also create a new organization+ under the free plan in case you have not exceeded your 2 free project+ limit.+ </p>+ </div>+ )}++ <div className="space-x-3">+ <Button asChild type="default" icon={<IconExternalLink strokeWidth={1.5} />}>+ <Link+ href="https://supabase.com/blog/organization-based-billing"target="_blank"rel="noreferrer"- href="https://supabase.com/pricing">- More details- </a>- {!isSelectFreeTier && !isEmptyPaymentMethod && (- <Alert- title="Your payment method will be charged"- variant="warning"- withIcon- className="mt-3"- >- <p>- By creating a new Pro Project, there will be an immediate charge of- $25 once the project has been created.- </p>- </Alert>- )}- </>- }- >- {Object.entries(PRICING_TIER_LABELS).map(([k, v]) => {- const label = `${v}${k === 'PRO' ? ' - $25/month' : ' - $0/month'}`- return (- <Listbox.Option key={k} label={label} value={k}>- {label}- </Listbox.Option>- )- })}- </Listbox>- )}+ Announcement+ </Link>+ </Button>+ <Button asChild type="default" icon={<IconExternalLink strokeWidth={1.5} />}>+ <Link+ href="https://supabase.com/docs/guides/platform/org-based-billing"+ target="_blank"+ rel="noreferrer"+ >+ Documentation+ </Link>+ </Button>+ </div>+ </div>+ }+ />+ </Panel.Content>+ {isAdmin && (+ <Panel.Content>{freePlanWithExceedingLimits && slug && (- <div className={billedViaOrg ? '' : 'mt-4'}>+ <div className="mt-4"><FreeProjectLimitWarningmembersExceededLimit={membersExceededLimit || []}- orgLevelBilling={billedViaOrg}orgSlug={slug}/></div>)}-- {!billedViaOrg && !isSelectFreeTier && isEmptyPaymentMethod && (- <EmptyPaymentMethodWarning onPaymentMethodAdded={() => refetchPaymentMethods()} />- )}- </Panel.Content>- )}-- {!billedViaOrg && (- <Panel.Content>- <InformationBox- icon={<IconInfo size="large" strokeWidth={1.5} />}- defaultVisibility={true}- hideCollapse- title="We're upgrading our billing system"- description={- <div className="space-y-3">- <p className="text-sm leading-normal">- This organization uses the legacy project-based billing. We’ve recently made- some big improvements to our billing system. To migrate to the new- organization-based billing, head over to your{' '}- <Link- href={`/org/${slug}/billing`}- className="text-sm text-green-900 transition hover:text-green-1000"- >- organization billing settings- </Link>- .- </p>-- <div className="space-x-3">- <Button- asChild- type="default"- icon={<IconExternalLink strokeWidth={1.5} />}- >- <Link- href="https://supabase.com/blog/organization-based-billing"- target="_blank"- rel="noreferrer"- >- Announcement- </Link>- </Button>- <Button- asChild- type="default"- icon={<IconExternalLink strokeWidth={1.5} />}- >- <Link- href="https://supabase.com/docs/guides/platform/org-based-billing"- target="_blank"- rel="noreferrer"- >- Documentation- </Link>- </Button>- </div>- </div>- }- /></Panel.Content>)}-- {!billedViaOrg && !isSelectFreeTier && (- <>- <Panel.Content className="border-b border-panel-border-interior-light dark:border-panel-border-interior-dark">- <Toggle- id="project-name"- layout="horizontal"- label={- <div className="flex space-x-4">- <span>Spend Cap</span>- <IconHelpCircle- size={16}- strokeWidth={1.5}- className="transition opacity-50 cursor-pointer hover:opacity-100"- onClick={() => setShowSpendCapHelperModal(true)}- />- </div>- }- placeholder="Project name"- checked={isSpendCapEnabled}- onChange={() => setIsSpendCapEnabled(!isSpendCapEnabled)}- descriptionText={- <div>- <p>- By default, Pro projects have spend caps to control costs. When enabled,- usage is limited to the plan's quota, with restrictions when limits are- exceeded. To scale beyond Pro limits without restrictions, disable the- spend cap and pay for over-usage beyond the quota.- </p>- </div>- }- />- </Panel.Content>-- <SpendCapModal- visible={showSpendCapHelperModal}- onHide={() => setShowSpendCapHelperModal(false)}- />- </>- )}</>)}</>diff --git a/studio/pages/project/[ref]/settings/billing/usage.tsx b/studio/pages/project/[ref]/settings/billing/usage.tsxnew file mode 100644index 00000000000..77a4e9b1624--- /dev/null+++ b/studio/pages/project/[ref]/settings/billing/usage.tsx@@ -0,0 +1,36 @@+import { SettingsLayout } from 'components/layouts'+import { NextPageWithLayout } from 'types'+import { useRouter } from 'next/router'+import { useEffect } from 'react'+import { useSelectedOrganization } from 'hooks'+import { useParams } from 'common'++const ProjectBillingUsage: NextPageWithLayout = () => {+ // This component is only used for redirects, as nextjs cant redirect based on hash+ const router = useRouter()+ const { ref } = useParams()+ const organization = useSelectedOrganization()++ const hash = router.asPath.split('#')[1]+ const route = router.route++ useEffect(() => {+ if (!organization) return++ let redirectUrl++ if (['cpu', 'ram', 'disk_io'].includes(hash)) {+ redirectUrl = `/project/${ref}/settings/infrastructure#${hash}`+ } else {+ redirectUrl = `/org/${organization.slug}/usage?projectRef=${ref}`+ }++ router.push(redirectUrl)+ }, [hash, route, organization, ref, router])++ return null+}++ProjectBillingUsage.getLayout = (page) => <SettingsLayout title="Usage">{page}</SettingsLayout>++export default ProjectBillingUsagediff --git a/studio/tests/components/ProjectDropdown.test.ts b/studio/tests/components/ProjectDropdown.test.tsindex a438473c1b3..9b1bc77d991 100644--- a/studio/tests/components/ProjectDropdown.test.ts+++ b/studio/tests/components/ProjectDropdown.test.ts@@ -6,9 +6,6 @@ test('Should sanitize project routes correctly when switching projects by removiexpect(sanitizeRoute('/project/[ref]/storage/buckets', { ref: 'abc' })).toBe('/project/[ref]/storage/buckets')- expect(sanitizeRoute('/project/[ref]/settings/billing/subscription', { ref: 'abc' })).toBe(- '/project/[ref]/settings/billing/subscription'- )expect(sanitizeRoute('/project/[ref]/editor/[tableId]', { ref: 'abc', tableId: '10' })).toBe('/project/[ref]/editor'