The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Vercel marketplace (#28786)
Jonathan Summers-Muir790c7ce3696e
diff --git a/apps/studio/.env b/apps/studio/.envindex 4de7d26d76e..5c8eb9662c2 100644--- a/apps/studio/.env+++ b/apps/studio/.env@@ -6,7 +6,6 @@ DEFAULT_PROJECT_NAME=Default ProjectDASHBOARD_USERNAME=supabaseDASHBOARD_PASSWORD=this_password_is_insecure_and_should_be_updated-SUPABASE_URL=http://localhost:8000SUPABASE_PUBLIC_URL=http://localhost:8000SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE@@ -24,4 +23,4 @@ NEXT_PUBLIC_HCAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhndWloeHV6cWlid3hqbmlteGV2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2NzUwOTQ4MzUsImV4cCI6MTk5MDY3MDgzNX0.0PMlOxtKL4O9GGZuAP_Xl4f-Tut1qOnW4bNEmAtoB8wNEXT_PUBLIC_SUPABASE_URL=https://xguihxuzqibwxjnimxev.supabase.co-DOCKER_SOCKET_LOCATION=/var/run/docker.sock\ No newline at end of file+DOCKER_SOCKET_LOCATION=/var/run/docker.sockdiff --git a/apps/studio/components/interfaces/Home/ProjectList/ProjectList.tsx b/apps/studio/components/interfaces/Home/ProjectList/ProjectList.tsxindex 29ee738b473..b3f598d9b0a 100644--- a/apps/studio/components/interfaces/Home/ProjectList/ProjectList.tsx+++ b/apps/studio/components/interfaces/Home/ProjectList/ProjectList.tsx@@ -1,8 +1,10 @@import { groupBy } from 'lodash'+import { Plus } from 'lucide-react'import Link from 'next/link'import AlertError from 'components/ui/AlertError'import NoSearchResults from 'components/ui/NoSearchResults'+import PartnerIcon from 'components/ui/PartnerIcon'import { useGitHubConnectionsQuery } from 'data/integrations/github-connections-query'import { useOrgIntegrationsQuery } from 'data/integrations/integrations-query-org-only'import {@@ -16,7 +18,6 @@ import { ResourceWarning, useResourceWarningsQuery } from 'data/usage/resource-wimport { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'import { makeRandomString } from 'lib/helpers'-import { Plus } from 'lucide-react'import type { Organization, ResponseError } from 'types'import { Button, cn } from 'ui'import ProjectCard from './ProjectCard'@@ -222,8 +223,10 @@ const OrganizationProjects = ({return (<div className="space-y-3" key={organization.slug}><div className="flex space-x-4 items-center">- <h4 className="text-lg flex items-center">{organization.name}</h4>-+ <div className="flex items-center gap-2">+ <h4 className="text-lg flex items-center">{organization.name}</h4>{' '}+ <PartnerIcon organization={organization} />+ </div>{!!overdueInvoices.length && (<div><Button asChild type="danger">diff --git a/apps/studio/components/interfaces/Integrations/OrganizationPicker.tsx b/apps/studio/components/interfaces/Integrations/OrganizationPicker.tsxindex 1953efb56ad..aa382a3ae2a 100644--- a/apps/studio/components/interfaces/Integrations/OrganizationPicker.tsx+++ b/apps/studio/components/interfaces/Integrations/OrganizationPicker.tsx@@ -1,9 +1,10 @@+import { useMemo, useRef, useState } from 'react'+import { getHasInstalledObject } from 'components/layouts/IntegrationsLayout/Integrations.utils'+import PartnerIcon from 'components/ui/PartnerIcon'import { useIntegrationsQuery } from 'data/integrations/integrations-query'import type { IntegrationName } from 'data/integrations/integrations.types'import { useOrganizationsQuery } from 'data/organizations/organizations-query'-import { useMemo, useRef, useState } from 'react'-import type { Organization } from 'types'import {Badge,@@ -111,6 +112,7 @@ const OrganizationPicker = ({setOpen(false)}}>+ <PartnerIcon organization={org} /><span className="truncate">{org.name}</span>{' '}{configurationId && installed[org.slug] && (<Badge className="!flex-none">Integration Installed</Badge>diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingAddress/BillingAddress.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingAddress/BillingAddress.tsxindex 420594ce534..b7a8e29a42e 100644--- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingAddress/BillingAddress.tsx+++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingAddress/BillingAddress.tsx@@ -13,15 +13,18 @@ import { FormActions } from 'components/ui/Forms/FormActions'import { FormPanel } from 'components/ui/Forms/FormPanel'import { FormSection, FormSectionContent } from 'components/ui/Forms/FormSection'import NoPermission from 'components/ui/NoPermission'+import PartnerManagedResource from 'components/ui/PartnerManagedResource'import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { useOrganizationCustomerProfileQuery } from 'data/organizations/organization-customer-profile-query'import { useOrganizationCustomerProfileUpdateMutation } from 'data/organizations/organization-customer-profile-update-mutation'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'+import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'import { Form, Input, Listbox } from 'ui'import { COUNTRIES } from './BillingAddress.constants'const BillingAddress = () => {const { slug } = useParams()+ const selectedOrganization = useSelectedOrganization()const canReadBillingAddress = useCheckPermissions(PermissionAction.BILLING_READ,@@ -87,7 +90,16 @@ const BillingAddress = () => {</div></ScaffoldSectionDetail><ScaffoldSectionContent>- {!canReadBillingAddress ? (+ {selectedOrganization?.managed_by !== undefined &&+ selectedOrganization?.managed_by !== 'supabase' ? (+ <PartnerManagedResource+ partner={selectedOrganization?.managed_by}+ resource="Billing Addresses"+ cta={{+ installationId: selectedOrganization?.partner_id,+ }}+ />+ ) : !canReadBillingAddress ? (<NoPermission resourceText="view this organization's billing address" />) : (<>diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/PaymentMethods/PaymentMethods.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/PaymentMethods/PaymentMethods.tsxindex c495058ddd5..bbc4d550150 100644--- a/apps/studio/components/interfaces/Organization/BillingSettings/PaymentMethods/PaymentMethods.tsx+++ b/apps/studio/components/interfaces/Organization/BillingSettings/PaymentMethods/PaymentMethods.tsx@@ -15,11 +15,13 @@ import AlertError from 'components/ui/AlertError'import { FormPanel } from 'components/ui/Forms/FormPanel'import { FormSection, FormSectionContent } from 'components/ui/Forms/FormSection'import NoPermission from 'components/ui/NoPermission'+import PartnerManagedResource from 'components/ui/PartnerManagedResource'import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { organizationKeys } from 'data/organizations/keys'import { useOrganizationPaymentMethodsQuery } from 'data/organizations/organization-payment-methods-query'import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'+import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'import { BASE_PATH } from 'lib/constants'import { getURL } from 'lib/helpers'import {@@ -40,6 +42,7 @@ import DeletePaymentMethodModal from './DeletePaymentMethodModal'const PaymentMethods = () => {const { slug } = useParams()+ const selectedOrganization = useSelectedOrganization()const queryClient = useQueryClient()const [selectedMethodForUse, setSelectedMethodForUse] = useState<any>()const [selectedMethodToDelete, setSelectedMethodToDelete] = useState<any>()@@ -76,7 +79,16 @@ const PaymentMethods = () => {</div></ScaffoldSectionDetail><ScaffoldSectionContent>- {!canReadPaymentMethods ? (+ {selectedOrganization?.managed_by !== undefined &&+ selectedOrganization?.managed_by !== 'supabase' ? (+ <PartnerManagedResource+ partner={selectedOrganization?.managed_by}+ resource="Payment Methods"+ cta={{+ installationId: selectedOrganization?.partner_id,+ }}+ />+ ) : !canReadPaymentMethods ? (<NoPermission resourceText="view this organization's payment methods" />) : (<>diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/EnterpriseCard.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/EnterpriseCard.tsxindex d85e884eae3..30e804702ca 100644--- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/EnterpriseCard.tsx+++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/EnterpriseCard.tsx@@ -6,7 +6,7 @@ import { pickFeatures } from 'shared-data/plans'export interface EnterpriseCardProps {plan: PricingInformationisCurrentPlan: boolean- billingPartner: 'fly' | 'aws' | undefined+ billingPartner: 'fly' | 'aws' | 'vercel_marketplace' | undefined}const EnterpriseCard = ({ plan, isCurrentPlan, billingPartner }: EnterpriseCardProps) => {diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsxindex 84bf3dd4bfa..36df82b6e89 100644--- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx+++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx@@ -25,13 +25,24 @@ import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'import { formatCurrency } from 'lib/helpers'import { pickFeatures, pickFooter, plans as subscriptionsPlans } from 'shared-data/plans'import { useOrgSettingsPageStateSnapshot } from 'state/organization-settings'-import { Button, IconCheck, IconInfo, Modal, SidePanel, cn } from 'ui'+import {+ AlertDescription_Shadcn_,+ AlertTitle_Shadcn_,+ Alert_Shadcn_,+ Button,+ IconCheck,+ IconInfo,+ Modal,+ SidePanel,+ cn,+} from 'ui'import DowngradeModal from './DowngradeModal'import EnterpriseCard from './EnterpriseCard'import ExitSurveyModal from './ExitSurveyModal'import MembersExceedLimitModal from './MembersExceedLimitModal'import PaymentMethodSelection from './PaymentMethodSelection'import UpgradeSurveyModal from './UpgradeModal'+import PartnerIcon from 'components/ui/PartnerIcon'const PlanUpdateSidePanel = () => {const router = useRouter()@@ -231,7 +242,12 @@ const PlanUpdateSidePanel = () => {<ButtonTooltipblocktype={isDowngradeOption ? 'default' : 'primary'}- disabled={subscription?.plan?.id === 'enterprise' || !canUpdateSubscription}+ disabled={+ subscription?.plan?.id === 'enterprise' ||+ !canUpdateSubscription ||+ (plan.id === 'tier_team' &&+ selectedOrganization?.managed_by === 'vercel-marketplace')+ }onClick={() => setSelectedTier(plan.id as any)}tooltip={{content: {@@ -241,7 +257,10 @@ const PlanUpdateSidePanel = () => {? 'Reach out to us via support to update your plan from Enterprise': !canUpdateSubscription? 'You do not have permission to change the subscription plan'- : undefined,+ : plan.id === 'tier_team' &&+ selectedOrganization?.managed_by === 'vercel-marketplace'+ ? 'The Team plan is currently unavailable for Vercel Marketplace managed organizations'+ : undefined,},}}>diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsxindex dd9867b448f..ef0a0670fe6 100644--- a/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsx+++ b/apps/studio/components/interfaces/Organization/BillingSettings/TaxID/TaxID.tsx@@ -16,10 +16,12 @@ import AlertError from 'components/ui/AlertError'import { FormActions } from 'components/ui/Forms/FormActions'import NoPermission from 'components/ui/NoPermission'import Panel from 'components/ui/Panel'+import PartnerManagedResource from 'components/ui/PartnerManagedResource'import ShimmeringLoader from 'components/ui/ShimmeringLoader'import { useOrganizationTaxIdQuery } from 'data/organizations/organization-tax-id-query'import { useOrganizationTaxIdUpdateMutation } from 'data/organizations/organization-tax-id-update-mutation'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'+import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'import {Button,FormControl_Shadcn_,@@ -39,6 +41,8 @@ import { checkTaxIdEqual, sanitizeTaxIdValue } from './TaxID.utils'const TaxID = () => {const { slug } = useParams()+ const selectedOrganization = useSelectedOrganization()+const { data: taxId, error, isLoading, isSuccess, isError } = useOrganizationTaxIdQuery({ slug })const { mutate: updateTaxId, isLoading: isUpdating } = useOrganizationTaxIdUpdateMutation({onSuccess: () => {@@ -137,7 +141,16 @@ const TaxID = () => {</div></ScaffoldSectionDetail><ScaffoldSectionContent>- {!canReadTaxId ? (+ {selectedOrganization?.managed_by !== undefined &&+ selectedOrganization?.managed_by !== 'supabase' ? (+ <PartnerManagedResource+ partner={selectedOrganization?.managed_by}+ resource="Tax IDs"+ cta={{+ installationId: selectedOrganization?.partner_id,+ }}+ />+ ) : !canReadTaxId ? (<NoPermission resourceText="view this organization's tax ID" />) : (<>diff --git a/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx b/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsxindex 3f5e7d0b5d7..c9f057bce11 100644--- a/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx+++ b/apps/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx@@ -18,6 +18,7 @@ import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'import { formatCurrency } from 'lib/helpers'import { Button, IconChevronLeft, IconChevronRight, IconDownload, IconFileText } from 'ui'+import PartnerManagedResource from 'components/ui/PartnerManagedResource'const PAGE_LIMIT = 10@@ -30,14 +31,20 @@ const InvoicesSettings = () => {const canReadInvoices = useCheckPermissions(PermissionAction.READ, 'invoices')- const { data: count, isError: isErrorCount } = useInvoicesCountQuery({- slug,- })- const { data, error, isLoading, isError, isSuccess } = useInvoicesQuery({- slug,- offset,- limit: PAGE_LIMIT,- })+ const { data: count, isError: isErrorCount } = useInvoicesCountQuery(+ {+ slug,+ },+ { enabled: selectedOrganization?.managed_by === 'supabase' }+ )+ const { data, error, isLoading, isError, isSuccess } = useInvoicesQuery(+ {+ slug,+ offset,+ limit: PAGE_LIMIT,+ },+ { enabled: selectedOrganization?.managed_by === 'supabase' }+ )const invoices = data || []useEffect(() => {@@ -61,6 +68,25 @@ const InvoicesSettings = () => {)}+ if (+ selectedOrganization?.managed_by !== undefined &&+ selectedOrganization?.managed_by !== 'supabase'+ ) {+ return (+ <ScaffoldContainerLegacy>+ <PartnerManagedResource+ partner={selectedOrganization?.managed_by}+ resource="Invoices"+ cta={{+ installationId: selectedOrganization?.partner_id,+ path: '/invoices',+ }}+ // TODO: support AWS marketplace here: `https://us-east-1.console.aws.amazon.com/billing/home#/bills`+ />+ </ScaffoldContainerLegacy>+ )+ }+return (<ScaffoldContainerLegacy>{isLoading && <GenericSkeletonLoader />}diff --git a/apps/studio/components/interfaces/Organization/TeamSettings/MemberRow.tsx b/apps/studio/components/interfaces/Organization/TeamSettings/MemberRow.tsxindex 6ac7b40a40e..45332ef9e69 100644--- a/apps/studio/components/interfaces/Organization/TeamSettings/MemberRow.tsx+++ b/apps/studio/components/interfaces/Organization/TeamSettings/MemberRow.tsx@@ -14,11 +14,16 @@ import { Badge, TooltipContent_Shadcn_, TooltipTrigger_Shadcn_, Tooltip_Shadcn_import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'import { getUserDisplayName, isInviteExpired } from '../Organization.utils'import { MemberActions } from './MemberActions'+import PartnerIcon from 'components/ui/PartnerIcon'interface MemberRowProps {member: OrganizationMember}+const MEMBER_ORIGIN_TO_MANAGED_BY = {+ vercel: 'vercel-marketplace',+} as const+export const MemberRow = ({ member }: MemberRowProps) => {const { slug } = useParams()const { profile } = useProfile()@@ -85,6 +90,18 @@ export const MemberRow = ({ member }: MemberRowProps) => {)}{member.primary_email === profile?.primary_email && <Badge color="scale">You</Badge>}</div>++ {(member.metadata as any)?.origin && (+ <PartnerIcon+ organization={{+ managed_by:+ MEMBER_ORIGIN_TO_MANAGED_BY[+ (member.metadata as any).origin as keyof typeof MEMBER_ORIGIN_TO_MANAGED_BY+ ] ?? 'supabase',+ }}+ tooltipText="This user is managed by Vercel Marketplace."+ />+ )}</div></Table.td>diff --git a/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx b/apps/studio/components/layouts/AccountLayout/AccountLayout.tsxindex f08bd1d89b8..79062d6548b 100644--- a/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx+++ b/apps/studio/components/layouts/AccountLayout/AccountLayout.tsx@@ -2,6 +2,7 @@ import Head from 'next/head'import { useRouter } from 'next/router'import { PropsWithChildren, useEffect } from 'react'+import PartnerIcon from 'components/ui/PartnerIcon'import { useOrganizationsQuery } from 'data/organizations/organizations-query'import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'import { withAuth } from 'hooks/misc/withAuth'@@ -46,6 +47,7 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accoulabel: organization.name,href: `/org/${organization.slug}/general`,key: organization.slug,+ icon: <PartnerIcon organization={organization} />,})).sort((a, b) => a.label.localeCompare(b.label))@@ -79,14 +81,12 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accoulinks: [{isActive: router.pathname === `/account/me`,- icon: `${router.basePath}/img/user.svg`,label: 'Preferences',href: `/account/me`,key: `/account/me`,},{isActive: router.pathname === `/account/tokens`,- icon: `${router.basePath}/img/user.svg`,label: 'Access Tokens',href: `/account/tokens`,key: `/account/tokens`,@@ -94,14 +94,12 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accou{isActive: router.pathname === `/account/security`,- icon: `${router.basePath}/img/user.svg`,label: 'Security',href: `/account/security`,key: `/account/security`,},{isActive: router.pathname === `/account/audit`,- icon: `${router.basePath}/img/user.svg`,label: 'Audit Logs',href: `/account/audit`,key: `/account/audit`,@@ -116,14 +114,12 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accoulinks: [{key: 'ext-guides',- icon: `${router.basePath}/img/book.svg`,label: 'Guides',href: 'https://supabase.com/docs',isExternal: true,},{key: 'ext-guides',- icon: `${router.basePath}/img/book-open.svg`,label: 'API Reference',href: 'https://supabase.com/docs/guides/api',isExternal: true,@@ -137,7 +133,6 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accoulinks: [{key: `logout`,- icon: '/icons/feather/power.svg',label: 'Log out',href: undefined,onClick: onClickLogout,diff --git a/apps/studio/components/layouts/AccountLayout/AccountLayout.types.ts b/apps/studio/components/layouts/AccountLayout/AccountLayout.types.tsindex fa7e6bb3059..ebda937625c 100644--- a/apps/studio/components/layouts/AccountLayout/AccountLayout.types.ts+++ b/apps/studio/components/layouts/AccountLayout/AccountLayout.types.ts@@ -2,7 +2,7 @@ export type SidebarLink = {label: stringhref?: stringkey: string- icon?: string+ icon?: React.ReactNodeisExternal?: booleanisActive?: booleansubitemsKey?: string // I dont think this is being used at alldiff --git a/apps/studio/components/layouts/AccountLayout/WithSidebar.tsx b/apps/studio/components/layouts/AccountLayout/WithSidebar.tsxindex 4dafdbb9c76..8c0bd28db36 100644--- a/apps/studio/components/layouts/AccountLayout/WithSidebar.tsx+++ b/apps/studio/components/layouts/AccountLayout/WithSidebar.tsx@@ -6,6 +6,7 @@ import { useFlag } from 'hooks/ui/useFlag'import { Badge, IconArrowUpRight, IconLogOut, Menu } from 'ui'import { LayoutHeader } from '../ProjectLayout/LayoutHeader'import type { SidebarLink, SidebarSection } from './AccountLayout.types'+import PartnerIcon from 'components/ui/PartnerIcon'interface WithSidebarProps {title: string@@ -132,6 +133,7 @@ const SidebarItem = ({ links, subitems, subitemsParentKey }: SidebarItemProps) =href={link.href}onClick={link.onClick}isExternal={link.isExternal || false}+ icon={link.icon}/>)@@ -144,6 +146,7 @@ const SidebarItem = ({ links, subitems, subitemsParentKey }: SidebarItemProps) =label={y.label}onClick={y.onClick}isExternal={link.isExternal || false}+ icon={link.icon}/>))render = [render, ...subItemsRender]@@ -167,6 +170,7 @@ const SidebarLinkItem = ({isSubitem,isExternal,onClick,+ icon,}: SidebarLinkProps) => {if (isUndefined(href)) {let icon@@ -202,12 +206,15 @@ const SidebarLinkItem = ({<IconArrowUpRight size={'tiny'} /></span>)}- <span- title={label}- className="w-full truncate text-sm text-foreground-light transition group-hover:text-foreground"- >- {isSubitem ? <p>{label}</p> : label}- </span>+ <div className="flex items-center gap-1.5 flex-shrink-0">+ <span+ title={label}+ className="w-full truncate text-sm text-foreground-light transition group-hover:text-foreground"+ >+ {isSubitem ? <p>{label}</p> : label}+ </span>+ {icon}+ </div></span></Link>)diff --git a/apps/studio/components/layouts/AppLayout/OrganizationDropdown.tsx b/apps/studio/components/layouts/AppLayout/OrganizationDropdown.tsxindex b5ef61ce270..e870b080122 100644--- a/apps/studio/components/layouts/AppLayout/OrganizationDropdown.tsx+++ b/apps/studio/components/layouts/AppLayout/OrganizationDropdown.tsx@@ -23,6 +23,7 @@ import {Popover_Shadcn_,ScrollArea,} from 'ui'+import PartnerIcon from 'components/ui/PartnerIcon'interface OrganizationDropdownProps {isNewNav?: boolean@@ -83,7 +84,10 @@ const OrganizationDropdown = ({ isNewNav = false }: OrganizationDropdownProps) =onClick={() => setOpen(false)}><Link href={href} className="w-full flex items-center justify-between">- {org.name}+ <div className="flex items-center gap-2">+ <span>{org.name}</span>+ <PartnerIcon organization={org} />+ </div>{org.slug === slug && <Check size={16} />}</Link></CommandItem_Shadcn_>diff --git a/apps/studio/components/layouts/OrganizationLayout.tsx b/apps/studio/components/layouts/OrganizationLayout.tsxindex f6d7e66a8a8..24c7b8f3f2b 100644--- a/apps/studio/components/layouts/OrganizationLayout.tsx+++ b/apps/studio/components/layouts/OrganizationLayout.tsx@@ -1,31 +1,34 @@-import { useRouter } from 'next/router'import type { PropsWithChildren } from 'react'import { useParams } from 'common'+import PartnerIcon from 'components/ui/PartnerIcon'+import { PARTNER_TO_NAME } from 'components/ui/PartnerManagedResource'+import { useVercelRedirectQuery } from 'data/integrations/vercel-redirect-query'import { useCurrentPath } from 'hooks/misc/useCurrentPath'import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'import { useFlag } from 'hooks/ui/useFlag'+import { ExternalLink } from 'lucide-react'import Link from 'next/link'-import { NavMenu, NavMenuItem } from 'ui'-import { useOrgSubscriptionQuery } from '../../data/subscriptions/org-subscription-query'+import { Alert_Shadcn_, AlertTitle_Shadcn_, Button, NavMenu, NavMenuItem } from 'ui'import AccountLayout from './AccountLayout/AccountLayout'import { ScaffoldContainer, ScaffoldDivider, ScaffoldHeader, ScaffoldTitle } from './Scaffold'import SettingsLayout from './SettingsLayout/SettingsLayout'const OrganizationLayout = ({ children }: PropsWithChildren<{}>) => {const selectedOrganization = useSelectedOrganization()- const router = useRouter()const currentPath = useCurrentPath()const { slug } = useParams()const invoicesEnabledOnProfileLevel = useIsFeatureEnabled('billing:invoices')- const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: slug })- const isNotOrgWithPartnerBilling = !(subscription?.billing_via_partner ?? true)- const invoicesEnabled = invoicesEnabledOnProfileLevel && isNotOrgWithPartnerBilling+ const invoicesEnabled = invoicesEnabledOnProfileLevelconst navLayoutV2 = useFlag('navigationLayoutV2')+ const { data, isSuccess } = useVercelRedirectQuery({+ installationId: selectedOrganization?.partner_id,+ })+if (navLayoutV2) {return <SettingsLayout>{children}</SettingsLayout>}@@ -91,7 +94,25 @@ const OrganizationLayout = ({ children }: PropsWithChildren<{}>) => {</NavMenu></ScaffoldContainer></ScaffoldHeader>+<ScaffoldDivider />++ {selectedOrganization && selectedOrganization?.managed_by !== 'supabase' && (+ <ScaffoldContainer className="mt-8">+ <Alert_Shadcn_ variant="default" className="flex items-center gap-4">+ <PartnerIcon organization={selectedOrganization} showTooltip={false} size="medium" />+ <AlertTitle_Shadcn_ className="flex-1">+ This organization is managed by {PARTNER_TO_NAME[selectedOrganization.managed_by]}.+ </AlertTitle_Shadcn_>+ <Button type="default" iconRight={<ExternalLink />} asChild disabled={!isSuccess}>+ <a href={data?.url} target="_blank" rel="noopener noreferrer">+ Manage+ </a>+ </Button>+ </Alert_Shadcn_>+ </ScaffoldContainer>+ )}+{children}</AccountLayout>)diff --git a/apps/studio/components/ui/PartnerIcon.tsx b/apps/studio/components/ui/PartnerIcon.tsxnew file mode 100644index 00000000000..37752401a7f--- /dev/null+++ b/apps/studio/components/ui/PartnerIcon.tsx@@ -0,0 +1,70 @@+import { Organization } from 'types'+import { cn, Tooltip_Shadcn_, TooltipContent_Shadcn_, TooltipTrigger_Shadcn_ } from 'ui'++interface PartnerIconProps {+ organization: Pick<Organization, 'managed_by'>+ showTooltip?: boolean+ tooltipText?: string+ size?: 'small' | 'medium' | 'large'+}++function PartnerIcon({+ organization,+ showTooltip = true,+ tooltipText = 'This organization is managed by Vercel Marketplace.',+ size = 'small',+}: PartnerIconProps) {+ if (organization.managed_by === 'vercel-marketplace') {+ const icon = (+ <svg+ className={cn(+ size === 'small' && 'w-2.5 h-2.5',+ size === 'medium' && 'w-3.5 h-3.5',+ size === 'large' && 'w-5 h-5'+ )}+ viewBox="0 0 76 65"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ <path d="M37.5274 0L75.0548 65H0L37.5274 0Z" fill="hsl(var(--foreground-default) / 1)" />+ </svg>+ )++ if (!showTooltip) {+ return (+ <div+ className={cn(+ 'bg-surface-100 dark:bg-surface-200 border rounded flex items-center justify-center flex-shrink-0',+ size === 'small' && 'h-5 w-5',+ size === 'medium' && 'w-7 h-7',+ size === 'large' && 'w-10 h-10'+ )}+ >+ {icon}+ </div>+ )+ }++ return (+ <Tooltip_Shadcn_>+ <TooltipTrigger_Shadcn_ asChild>+ <div+ className={cn(+ 'bg-surface-100 dark:bg-surface-200 border rounded flex items-center justify-center hover:bg-surface-400 dark:hover:bg-surface-400 hover:border-stronger flex-shrink-0',+ size === 'small' && 'h-5 w-5',+ size === 'medium' && 'w-7 h-7',+ size === 'large' && 'w-10 h-10'+ )}+ >+ {icon}+ </div>+ </TooltipTrigger_Shadcn_>+ <TooltipContent_Shadcn_>{tooltipText}</TooltipContent_Shadcn_>+ </Tooltip_Shadcn_>+ )+ }++ return null+}++export default PartnerIcondiff --git a/apps/studio/components/ui/PartnerManagedResource.tsx b/apps/studio/components/ui/PartnerManagedResource.tsxnew file mode 100644index 00000000000..48bc4fbcc75--- /dev/null+++ b/apps/studio/components/ui/PartnerManagedResource.tsx@@ -0,0 +1,54 @@+import { ExternalLink } from 'lucide-react'++import { useVercelRedirectQuery } from 'data/integrations/vercel-redirect-query'+import { Alert_Shadcn_, AlertTitle_Shadcn_, Button } from 'ui'+import PartnerIcon from './PartnerIcon'++interface PartnerManagedResourceProps {+ partner: 'vercel-marketplace' | 'aws-marketplace'+ resource: string+ cta?: {+ installationId?: string+ path?: string+ }+}++export const PARTNER_TO_NAME = {+ 'vercel-marketplace': 'Vercel Marketplace',+ 'aws-marketplace': 'AWS Marketplace',+} as const++function PartnerManagedResource({ partner, resource, cta }: PartnerManagedResourceProps) {+ const ctaEnabled = cta !== undefined++ const { data, isLoading, isError } = useVercelRedirectQuery(+ {+ installationId: cta?.installationId,+ },+ {+ enabled: ctaEnabled,+ }+ )++ const ctaUrl = (data?.url ?? '') + (cta?.path ?? '')++ return (+ <Alert_Shadcn_ className="flex flex-col items-center gap-4">+ <PartnerIcon organization={{ managed_by: partner }} showTooltip={false} size="large" />++ <AlertTitle_Shadcn_ className="text-lg">+ {resource} are managed by {PARTNER_TO_NAME[partner]}.+ </AlertTitle_Shadcn_>++ {ctaEnabled && (+ <Button asChild iconRight={<ExternalLink />} disabled={isLoading || isError}>+ <a href={ctaUrl} target="_blank" rel="noopener noreferrer">+ View {resource} on {PARTNER_TO_NAME[partner]}+ </a>+ </Button>+ )}+ </Alert_Shadcn_>+ )+}++export default PartnerManagedResourcediff --git a/apps/studio/data/integrations/keys.ts b/apps/studio/data/integrations/keys.tsindex 71ac8bea3ad..1a86cfdfa40 100644--- a/apps/studio/data/integrations/keys.ts+++ b/apps/studio/data/integrations/keys.ts@@ -24,4 +24,5 @@ export const integrationKeys = {githubBranchesList: (connectionId: number | undefined) => ['github-branches', connectionId],githubConnectionsList: (organizationId: number | undefined) =>['organizations', organizationId, 'github-connections'] as const,+ vercelRedirect: (installationId?: string) => ['vercel-redirect', installationId] as const,}diff --git a/apps/studio/data/integrations/vercel-redirect-query.ts b/apps/studio/data/integrations/vercel-redirect-query.tsnew file mode 100644index 00000000000..3b25224fb0d--- /dev/null+++ b/apps/studio/data/integrations/vercel-redirect-query.ts@@ -0,0 +1,42 @@+import { useQuery, UseQueryOptions } from '@tanstack/react-query'++import { get, handleError } from 'data/fetchers'+import type { ResponseError } from 'types'+import { integrationKeys } from './keys'++export type VercelRedirectVariables = {+ installationId?: string+}++export async function getVercelRedirect(+ { installationId }: VercelRedirectVariables,+ signal?: AbortSignal+) {+ if (!installationId) throw new Error('installationId is required')++ const { data, error } = await get(`/platform/vercel/redirect/{installation_id}`, {+ params: { path: { installation_id: installationId } },+ signal,+ })+ if (error) handleError(error)+ return data+}++export type VercelRedirectData = Awaited<ReturnType<typeof getVercelRedirect>>+export type VercelRedirectError = ResponseError++export const useVercelRedirectQuery = <TData = VercelRedirectData>(+ { installationId }: VercelRedirectVariables,+ {+ enabled = true,+ ...options+ }: UseQueryOptions<VercelRedirectData, VercelRedirectError, TData> = {}+) =>+ useQuery<VercelRedirectData, VercelRedirectError, TData>(+ integrationKeys.vercelRedirect(installationId),+ ({ signal }) => getVercelRedirect({ installationId }, signal),+ {+ enabled: enabled && typeof installationId !== 'undefined',+ ...options,+ }+ )diff --git a/apps/studio/data/organizations/organizations-query.ts b/apps/studio/data/organizations/organizations-query.tsindex afed1dde457..0c1fc04fe35 100644--- a/apps/studio/data/organizations/organizations-query.ts+++ b/apps/studio/data/organizations/organizations-query.ts@@ -1,16 +1,30 @@import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query'++import { components } from 'api-types'import { get, handleError } from 'data/fetchers'import type { Organization, ResponseError } from 'types'import { organizationKeys } from './keys'+function castOrganizationResponseToOrganization(+ org: components['schemas']['OrganizationResponse']+): Organization {+ return {+ ...org,+ billing_email: org.billing_email ?? 'Unknown',+ managed_by: org.slug.startsWith('vercel_icfg_') ? 'vercel-marketplace' : 'supabase',+ partner_id: org.slug.startsWith('vercel_') ? org.slug.replace('vercel_', '') : undefined,+ }+}+export async function getOrganizations(signal?: AbortSignal): Promise<Organization[]> {const { data, error } = await get('/platform/organizations', { signal })if (error) handleError(error)if (!Array.isArray(data)) return []- const sorted = (data as Organization[]).sort((a, b) => a.name.localeCompare(b.name))- return sorted+ return data+ .map(castOrganizationResponseToOrganization)+ .sort((a, b) => a.name.localeCompare(b.name))}export type OrganizationsData = Awaited<ReturnType<typeof getOrganizations>>diff --git a/apps/studio/types/base.ts b/apps/studio/types/base.tsindex 83db1c8fe0a..e593dcf2d2c 100644--- a/apps/studio/types/base.ts+++ b/apps/studio/types/base.ts@@ -11,6 +11,8 @@ export interface Organization {subscription_id?: string | nullrestriction_status: 'grace_period' | 'grace_period_over' | 'restricted' | nullrestriction_data: Record<string, never>+ managed_by: 'supabase' | 'vercel-marketplace' | 'aws-marketplace'+ partner_id?: string}/**diff --git a/packages/api-types/package.json b/packages/api-types/package.jsonindex a71266edcba..69ea1dacb6f 100644--- a/packages/api-types/package.json+++ b/packages/api-types/package.json@@ -5,7 +5,7 @@"main": "./index.ts","types": "./index.ts","scripts": {- "codegen": "openapi-typescript http://localhost:8080/api-json -o types/api.d.ts --alphabetize && prettier --write types/api.d.ts"+ "codegen": "openapi-typescript http://localhost:8080/api.json -o types/api.d.ts --alphabetize && prettier --write types/api.d.ts"},"author": "","license": "MIT",diff --git a/packages/api-types/types/api.d.ts b/packages/api-types/types/api.d.tsindex 24fa6823934..0bb2e311027 100644--- a/packages/api-types/types/api.d.ts+++ b/packages/api-types/types/api.d.ts@@ -55,6 +55,58 @@ export interface paths {/** Updates organization subscription linked to the provided Fly organization id */put: operations['FlyOrganizationsController_updateOrganization']}+ '/partners/vercel/callback': {+ /** Redirects to Supabase dashboard after completing Vercel sso flow */+ get: operations['CallbackController_redirectToDashboardFlyioExtensionScreen']+ }+ '/partners/vercel/mock-usage': {+ /** Fake it till you make it */+ get: operations['MockBillingController_mockUsage']+ }+ '/partners/vercel/mock-usage/invoice': {+ /** Fake it till you make it */+ get: operations['MockBillingController_sendInvoice']+ }+ '/partners/vercel/v1/installations/{installation_id}': {+ /** Gets the set of billing plans available to a specific Installation */+ get: operations['InstallationsController_getInstallation']+ /** Upserts an installation for the account with installation_id */+ put: operations['InstallationsController_createInstallation']+ /** Deletes the installation with provided installation_id */+ delete: operations['InstallationsController_deleteInstallation']+ /** Updates an installation for the account with installation_id */+ patch: operations['InstallationsController_updateInstallation']+ }+ '/partners/vercel/v1/installations/{installation_id}/plans': {+ /** Gets the set of billing plans available to a specific Installation */+ get: operations['InstallationsController_getInstallationBillingPlans']+ }+ '/partners/vercel/v1/installations/{installation_id}/resources': {+ /** Lists all resources */+ get: operations['ResourcesController_listResources']+ /** Provisions a resource */+ post: operations['ResourcesController_createResource']+ }+ '/partners/vercel/v1/installations/{installation_id}/resources/{resource_id}': {+ /** Fetches a resource by resource_id */+ get: operations['ResourcesController_getResource']+ /** Uninstalls and de-provisions a resource */+ delete: operations['ResourcesController_deleteResource']+ /** Updates a resource */+ patch: operations['ResourcesController_updateResource']+ }+ '/partners/vercel/v1/installations/{installation_id}/resources/{resource_id}/plans': {+ /** Returns the set of billing plans available to a specific resource */+ get: operations['ResourcesController_getResourcePlans']+ }+ '/partners/vercel/v1/products/{product_id}/plans': {+ /** Return quotes for different billing plans for a specific product */+ get: operations['ProductsController_listResources']+ }+ '/partners/vercel/webhooks': {+ /** Webhooks endpoint */+ post: operations['WebhooksController_processWebhook']+ }'/platform/auth/{ref}/config': {/** Gets GoTrue config */get: operations['GoTrueConfigController_getGoTrueConfig']@@ -1029,6 +1081,10 @@ export interface paths {/** Creates the environment variable for the given project ID on behalf of the given team ID */post: operations['VercelEnvironmentVariablesController_createEnvironmentVariable']}+ '/platform/vercel/redirect/{installation_id}': {+ /** Gets the Vercel redirect url */+ get: operations['VercelRedirectController_getRedirectUrl']+ }'/platform/vercel/token': {/** Gets the Vercel access token for the given code */get: operations['VercelAccessTokenController_getAccessToken']@@ -2132,6 +2188,7 @@ export interface components {| 'pitr_28'| 'ipv4_default'| 'auth_mfa_phone_default'+ | 'log_drain_default'AmiSearchOptions: {search_tags?: Record<string, never>}@@ -2550,7 +2607,9 @@ export interface components {}CreateBranchBody: {branch_name: string+ desired_instance_size?: components['schemas']['DesiredInstanceSize']git_branch?: string+ persistent?: booleanregion?: string}CreateCliLoginSessionBody: {@@ -3262,7 +3321,7 @@ export interface components {addons: components['schemas']['BillingSubscriptionAddon'][]billing_cycle_anchor: number/** @enum {string} */- billing_partner: 'fly' | 'aws'+ billing_partner: 'fly' | 'aws' | 'vercel_marketplace'billing_via_partner: booleancurrent_period_end: numbercurrent_period_start: number@@ -3760,6 +3819,7 @@ export interface components {Member: {gotrue_id: stringis_sso_user: boolean | null+ metadata: unknownmfa_enabled: booleanprimary_email: string | nullrole_ids: number[]@@ -4362,7 +4422,13 @@ export interface components {selected_addons: components['schemas']['SelectedAddonResponse'][]}/** @enum {string} */- ProjectAddonType: 'custom_domain' | 'compute_instance' | 'pitr' | 'ipv4' | 'auth_mfa_phone'+ ProjectAddonType:+ | 'custom_domain'+ | 'compute_instance'+ | 'pitr'+ | 'ipv4'+ | 'auth_mfa_phone'+ | 'log_drain'/** @enum {string} */ProjectAddonVariantPricingType: 'fixed' | 'usage'ProjectAddonVariantResponse: {@@ -5014,6 +5080,7 @@ export interface components {*/read_replica_region:| 'us-east-1'+ | 'us-east-2'| 'us-west-1'| 'us-west-2'| 'ap-east-1'@@ -5024,7 +5091,9 @@ export interface components {| 'eu-west-1'| 'eu-west-2'| 'eu-west-3'+ | 'eu-north-1'| 'eu-central-1'+ | 'eu-central-2'| 'ca-central-1'| 'ap-south-1'| 'sa-east-1'@@ -5208,6 +5277,7 @@ export interface components {*/region:| 'us-east-1'+ | 'us-east-2'| 'us-west-1'| 'us-west-2'| 'ap-east-1'@@ -5218,7 +5288,9 @@ export interface components {| 'eu-west-1'| 'eu-west-2'| 'eu-west-3'+ | 'eu-north-1'| 'eu-central-1'+ | 'eu-central-2'| 'ca-central-1'| 'ap-south-1'| 'sa-east-1'@@ -5524,6 +5596,14 @@ export interface components {git_branch?: stringpersistent?: booleanreset_on_push?: boolean+ /** @enum {string} */+ status?:+ | 'CREATING_PROJECT'+ | 'RUNNING_MIGRATIONS'+ | 'MIGRATIONS_PASSED'+ | 'MIGRATIONS_FAILED'+ | 'FUNCTIONS_DEPLOYED'+ | 'FUNCTIONS_FAILED'}UpdateColumnBody: {check?: string@@ -6151,6 +6231,7 @@ export interface components {*/region:| 'us-east-1'+ | 'us-east-2'| 'us-west-1'| 'us-west-2'| 'ap-east-1'@@ -6161,7 +6242,9 @@ export interface components {| 'eu-west-1'| 'eu-west-2'| 'eu-west-3'+ | 'eu-north-1'| 'eu-central-1'+ | 'eu-central-2'| 'ca-central-1'| 'ap-south-1'| 'sa-east-1'@@ -6313,6 +6396,9 @@ export interface components {productionBranch?: stringtype?: string}+ VercelRedirectResponse: {+ url: string+ }}responses: neverparameters: never@@ -6326,7 +6412,7 @@ export type $defs = Record<string, never>export type external = Record<string, never>export interface operations {- /** Redirects to Supabase dashboard after completing Fly sso */+ /** Redirects to Supabase dashboard after completing Vercel sso flow */CallbackController_redirectToDashboardFlyioExtensionScreen: {responses: {200: {@@ -6481,6 +6567,159 @@ export interface operations {}}}+ /** Fake it till you make it */+ MockBillingController_mockUsage: {+ responses: {+ 200: {+ content: never+ }+ }+ }+ /** Fake it till you make it */+ MockBillingController_sendInvoice: {+ responses: {+ 200: {+ content: never+ }+ }+ }+ /** Gets the set of billing plans available to a specific Installation */+ InstallationsController_getInstallation: {+ responses: {+ 200: {+ content: never+ }+ }+ }+ /** Upserts an installation for the account with installation_id */+ InstallationsController_createInstallation: {+ responses: {+ 201: {+ content: never+ }+ }+ }+ /** Deletes the installation with provided installation_id */+ InstallationsController_deleteInstallation: {+ responses: {+ 204: {+ content: never+ }+ }+ }+ /** Updates an installation for the account with installation_id */+ InstallationsController_updateInstallation: {+ responses: {+ 204: {+ content: never+ }+ }+ }+ /** Gets the set of billing plans available to a specific Installation */+ InstallationsController_getInstallationBillingPlans: {+ responses: {+ 200: {+ content: never+ }+ }+ }+ /** Lists all resources */+ ResourcesController_listResources: {+ responses: {+ 200: {+ content: {+ 'application/json': Record<string, never>+ }+ }+ }+ }+ /** Provisions a resource */+ ResourcesController_createResource: {+ responses: {+ 201: {+ content: {+ 'application/json': Record<string, never>+ }+ }+ }+ }+ /** Fetches a resource by resource_id */+ ResourcesController_getResource: {+ parameters: {+ path: {+ resource_id: string+ }+ }+ responses: {+ 200: {+ content: {+ 'application/json': Record<string, never>+ }+ }+ }+ }+ /** Uninstalls and de-provisions a resource */+ ResourcesController_deleteResource: {+ parameters: {+ path: {+ resource_id: string+ }+ }+ responses: {+ 204: {+ content: never+ }+ }+ }+ /** Updates a resource */+ ResourcesController_updateResource: {+ parameters: {+ path: {+ resource_id: string+ }+ }+ responses: {+ 200: {+ content: {+ 'application/json': Record<string, never>+ }+ }+ }+ }+ /** Returns the set of billing plans available to a specific resource */+ ResourcesController_getResourcePlans: {+ responses: {+ 200: {+ content: never+ }+ }+ }+ /** Return quotes for different billing plans for a specific product */+ ProductsController_listResources: {+ parameters: {+ path: {+ product_id: string+ }+ }+ responses: {+ 200: {+ content: never+ }+ }+ }+ /** Webhooks endpoint */+ WebhooksController_processWebhook: {+ parameters: {+ header: {+ 'x-vercel-signature': string+ }+ }+ responses: {+ 201: {+ content: never+ }+ }+ }/** Gets GoTrue config */GoTrueConfigController_getGoTrueConfig: {parameters: {@@ -13060,6 +13299,25 @@ export interface operations {}}}+ /** Gets the Vercel redirect url */+ VercelRedirectController_getRedirectUrl: {+ parameters: {+ path: {+ installation_id: string+ }+ }+ responses: {+ 200: {+ content: {+ 'application/json': components['schemas']['VercelRedirectResponse']+ }+ }+ /** @description Failed to get Vercel redirect url */+ 500: {+ content: never+ }+ }+ }/** Gets the Vercel access token for the given code */VercelAccessTokenController_getAccessToken: {parameters: {