Skip to content

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

feat(studio): notify users about the Terms of Service update (#51302)

Danny Whiteb5c865521fa2
diff --git a/apps/studio/components/interfaces/App/AppBannerWrapper.tsx b/apps/studio/components/interfaces/App/AppBannerWrapper.tsx
index 53c893b5dbd..5185f28c35e 100644
--- a/apps/studio/components/interfaces/App/AppBannerWrapper.tsx
+++ b/apps/studio/components/interfaces/App/AppBannerWrapper.tsx
@@ -4,12 +4,13 @@ import { usePathname } from 'next/navigation'
import { PropsWithChildren, useEffect, useRef, useState } from 'react'
import { OrganizationResourceBanner } from '../Organization/HeaderBanner'
-import { isLogsOrObservabilityPath } from './AppBannerWrapper.utils'
+import { isLogsOrObservabilityPath, isOrganizationLandingPath } from './AppBannerWrapper.utils'
import { ClockSkewBanner } from '@/components/layouts/AppLayout/ClockSkewBanner'
import { NoticeBanner } from '@/components/layouts/AppLayout/NoticeBanner'
import { StatusBanner } from '@/components/layouts/AppLayout/StatusBanner'
import { StatusPageBanner } from '@/components/layouts/AppLayout/StatusPageBanner'
import { BannerLogsAllDeprecation } from '@/components/ui/BannerStack/Banners/BannerLogsAllDeprecation'
+import { BannerTermsOfServiceUpdate } from '@/components/ui/BannerStack/Banners/BannerTermsOfServiceUpdate'
import { BANNER_ID, useBannerStack } from '@/components/ui/BannerStack/BannerStackProvider'
import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
import { useTrack } from '@/lib/telemetry/track'
@@ -33,6 +34,26 @@ export const AppBannerWrapper = ({
const pathname = usePathname()
const track = useTrack()
+ const [isTermsUpdateAcknowledged, , { isSuccess: isTermsDismissalLoaded }] = useLocalStorageQuery(
+ LOCAL_STORAGE_KEYS.TERMS_OF_SERVICE_UPDATE,
+ false
+ )
+
+ useEffect(() => {
+ if (!isTermsDismissalLoaded || pathname == null) return
+
+ if (IS_PLATFORM && isOrganizationLandingPath(pathname) && !isTermsUpdateAcknowledged) {
+ addBanner({
+ id: BANNER_ID.TERMS_OF_SERVICE_UPDATE,
+ isDismissed: false,
+ content: <BannerTermsOfServiceUpdate />,
+ priority: 3,
+ })
+ } else {
+ dismissBanner(BANNER_ID.TERMS_OF_SERVICE_UPDATE)
+ }
+ }, [pathname, isTermsDismissalLoaded, isTermsUpdateAcknowledged, addBanner, dismissBanner])
+
const [isLogsAllDeprecationDismissed, , { isSuccess: isLogsAllDeprecationLoaded }] =
useLocalStorageQuery(LOCAL_STORAGE_KEYS.LOGS_ALL_DEPRECATION_2026_09_23, false)
diff --git a/apps/studio/components/interfaces/App/AppBannerWrapper.utils.ts b/apps/studio/components/interfaces/App/AppBannerWrapper.utils.ts
index 2035a8d9bad..b7ec1d8844b 100644
--- a/apps/studio/components/interfaces/App/AppBannerWrapper.utils.ts
+++ b/apps/studio/components/interfaces/App/AppBannerWrapper.utils.ts
@@ -6,3 +6,12 @@ export function isLogsOrObservabilityPath(pathname: string | null | undefined):
if (!pathname) return false
return LOGS_SECTION_PATH.test(pathname)
}
+
+const ORGANIZATION_HOME_PATH = /^\/org\/[^/]+\/?$/
+
+export function isOrganizationLandingPath(pathname: string | null | undefined): boolean {
+ if (!pathname) return false
+ return (
+ pathname === '/org' || pathname === '/organizations' || ORGANIZATION_HOME_PATH.test(pathname)
+ )
+}
diff --git a/apps/studio/components/ui/BannerStack/BannerStackProvider.tsx b/apps/studio/components/ui/BannerStack/BannerStackProvider.tsx
index 2ecdcd95600..e36f2d9fb6e 100644
--- a/apps/studio/components/ui/BannerStack/BannerStackProvider.tsx
+++ b/apps/studio/components/ui/BannerStack/BannerStackProvider.tsx
@@ -6,6 +6,7 @@ export const BANNER_ID = {
RLS_EVENT_TRIGGER: 'rls-event-trigger-banner',
FREE_MICRO_UPGRADE: 'free-micro-upgrade-banner',
LOGS_ALL_DEPRECATION: 'logs-all-deprecation-banner',
+ TERMS_OF_SERVICE_UPDATE: 'terms-of-service-update-banner',
EXPLORER: 'explorer-banner',
} as const
diff --git a/apps/studio/components/ui/BannerStack/Banners/BannerTermsOfServiceUpdate.test.tsx b/apps/studio/components/ui/BannerStack/Banners/BannerTermsOfServiceUpdate.test.tsx
new file mode 100644
index 00000000000..6cbc788c083
--- /dev/null
+++ b/apps/studio/components/ui/BannerStack/Banners/BannerTermsOfServiceUpdate.test.tsx
@@ -0,0 +1,60 @@
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
+import { render, screen, waitFor } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import { LOCAL_STORAGE_KEYS } from 'common'
+import { beforeEach, describe, expect, it } from 'vitest'
+
+import { BannerStackProvider } from '../BannerStackProvider'
+import { BannerTermsOfServiceUpdate } from './BannerTermsOfServiceUpdate'
+
+const renderNotice = () =>
+ render(
+ <QueryClientProvider
+ client={new QueryClient({ defaultOptions: { queries: { retry: false } } })}
+ >
+ <BannerStackProvider>
+ <BannerTermsOfServiceUpdate />
+ </BannerStackProvider>
+ </QueryClientProvider>
+ )
+
+describe('BannerTermsOfServiceUpdate', () => {
+ beforeEach(() => localStorage.clear())
+
+ it('reveals the explanation and agreement link only after Learn more', async () => {
+ const user = userEvent.setup()
+ renderNotice()
+ expect(screen.getByText('We’ve updated our Terms of Service')).toBeInTheDocument()
+ expect(screen.queryByText(/Clarify which Supabase entity/)).not.toBeInTheDocument()
+ await user.click(screen.getByRole('button', { name: 'Learn more' }))
+ expect(screen.getByRole('dialog')).toBeInTheDocument()
+ expect(screen.getByText(/Clarify which Supabase entity/)).toBeInTheDocument()
+ expect(screen.getByRole('link', { name: 'Terms of Service' })).toHaveAttribute(
+ 'href',
+ 'https://supabase.com/terms'
+ )
+ expect(localStorage.getItem(LOCAL_STORAGE_KEYS.TERMS_OF_SERVICE_UPDATE)).toBeNull()
+ await user.click(screen.getByRole('button', { name: 'Got it' }))
+ await waitFor(() =>
+ expect(localStorage.getItem(LOCAL_STORAGE_KEYS.TERMS_OF_SERVICE_UPDATE)).toBe('true')
+ )
+ })
+
+ it('remembers dismissal from the compact notice', async () => {
+ const user = userEvent.setup()
+ renderNotice()
+ await user.click(screen.getByRole('button', { name: 'Close banner' }))
+ await waitFor(() =>
+ expect(localStorage.getItem(LOCAL_STORAGE_KEYS.TERMS_OF_SERVICE_UPDATE)).toBe('true')
+ )
+ })
+
+ it('does not acknowledge the notice when the dialog is closed', async () => {
+ const user = userEvent.setup()
+ renderNotice()
+ await user.click(screen.getByRole('button', { name: 'Learn more' }))
+ await user.keyboard('{Escape}')
+ await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument())
+ expect(localStorage.getItem(LOCAL_STORAGE_KEYS.TERMS_OF_SERVICE_UPDATE)).toBeNull()
+ })
+})
diff --git a/apps/studio/components/ui/BannerStack/Banners/BannerTermsOfServiceUpdate.tsx b/apps/studio/components/ui/BannerStack/Banners/BannerTermsOfServiceUpdate.tsx
new file mode 100644
index 00000000000..082f2d9ac71
--- /dev/null
+++ b/apps/studio/components/ui/BannerStack/Banners/BannerTermsOfServiceUpdate.tsx
@@ -0,0 +1,84 @@
+import { LOCAL_STORAGE_KEYS } from 'common'
+import {
+ Badge,
+ Button,
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogSection,
+ DialogSectionSeparator,
+ DialogTitle,
+ DialogTrigger,
+} from 'ui'
+
+import { BannerCard } from '../BannerCard'
+import { BANNER_ID, useBannerStack } from '../BannerStackProvider'
+import { InlineLink } from '@/components/ui/InlineLink'
+import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
+
+export const BannerTermsOfServiceUpdate = () => {
+ const { dismissBanner } = useBannerStack()
+ const [, setIsAcknowledged] = useLocalStorageQuery(
+ LOCAL_STORAGE_KEYS.TERMS_OF_SERVICE_UPDATE,
+ false
+ )
+
+ const acknowledgeUpdate = () => {
+ setIsAcknowledged(true)
+ dismissBanner(BANNER_ID.TERMS_OF_SERVICE_UPDATE)
+ }
+
+ return (
+ <BannerCard onDismiss={acknowledgeUpdate}>
+ <div className="flex flex-col gap-y-2">
+ <Badge variant="default" className="w-min -ml-0.5 uppercase inline-flex items-center mb-2">
+ Notice
+ </Badge>
+ <div className="flex flex-col gap-y-1 mb-2">
+ <p className="text-sm font-medium">We’ve updated our Terms of Service</p>
+ <p className="text-xs text-foreground-lighter text-balance">
+ The new terms cover who you contract with, alpha and beta features, and cloud
+ marketplace purchases.
+ </p>
+ </div>
+ <Dialog>
+ <DialogTrigger asChild>
+ <Button size="tiny" className="w-min">
+ Learn more
+ </Button>
+ </DialogTrigger>
+ <DialogContent aria-describedby={undefined}>
+ <DialogHeader>
+ <DialogTitle>Terms of Service update</DialogTitle>
+ </DialogHeader>
+ <DialogSectionSeparator />
+ <DialogSection className="text-sm flex flex-col gap-y-2">
+ <p>We’ve updated our Terms of Service.</p>
+ <p>The updated terms:</p>
+ <ul className="list-disc pl-5 space-y-1">
+ <li>Clarify which Supabase entity you contract with.</li>
+ <li>
+ Add Supplemental Terms for certain features we may release or to comply with local
+ laws.
+ </li>
+ <li>Set new terms for alpha and beta features.</li>
+ <li>Make accommodations for purchases through cloud marketplaces.</li>
+ </ul>
+ <p>
+ Read the updated{' '}
+ <InlineLink href="https://supabase.com/terms">Terms of Service</InlineLink>.
+ </p>
+ </DialogSection>
+ <DialogFooter>
+ <DialogClose asChild>
+ <Button onClick={acknowledgeUpdate}>Got it</Button>
+ </DialogClose>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ </div>
+ </BannerCard>
+ )
+}
diff --git a/apps/studio/tests/components/interfaces/App/AppBannerWrapper.utils.test.ts b/apps/studio/tests/components/interfaces/App/AppBannerWrapper.utils.test.ts
index 12716cda236..ca6ea3667a2 100644
--- a/apps/studio/tests/components/interfaces/App/AppBannerWrapper.utils.test.ts
+++ b/apps/studio/tests/components/interfaces/App/AppBannerWrapper.utils.test.ts
@@ -1,6 +1,9 @@
import { describe, expect, test } from 'vitest'
-import { isLogsOrObservabilityPath } from '@/components/interfaces/App/AppBannerWrapper.utils'
+import {
+ isLogsOrObservabilityPath,
+ isOrganizationLandingPath,
+} from '@/components/interfaces/App/AppBannerWrapper.utils'
describe('isLogsOrObservabilityPath', () => {
test.each([
@@ -26,3 +29,22 @@ describe('isLogsOrObservabilityPath', () => {
expect(isLogsOrObservabilityPath(pathname)).toBe(false)
})
})
+
+describe('isOrganizationLandingPath', () => {
+ test.each(['/org', '/organizations', '/org/my-org', '/org/my-org/'])('matches %s', (pathname) => {
+ expect(isOrganizationLandingPath(pathname)).toBe(true)
+ })
+
+ test.each([
+ undefined,
+ null,
+ '',
+ '/',
+ '/sign-in',
+ '/project/abc',
+ '/org/abc/general',
+ '/organizations/new',
+ ])('does not match %s', (pathname) => {
+ expect(isOrganizationLandingPath(pathname)).toBe(false)
+ })
+})
diff --git a/packages/common/constants/local-storage.ts b/packages/common/constants/local-storage.ts
index f987589efcc..ba04a924d93 100644
--- a/packages/common/constants/local-storage.ts
+++ b/packages/common/constants/local-storage.ts
@@ -79,6 +79,7 @@ export const LOCAL_STORAGE_KEYS = {
EXPAND_NAVIGATION_PANEL: 'supabase-expand-navigation-panel',
GITHUB_AUTHORIZATION_STATE: 'supabase-github-authorization-state',
// Notice banner keys
+ TERMS_OF_SERVICE_UPDATE: 'terms-of-service-update-v4-dismissed',
API_KEYS_FEEDBACK_DISMISSED: (ref: string) => `supabase-api-keys-feedback-dismissed-${ref}`,
SUPAVISOR_MAINTENANCE: (ref: string) => `supavisor-maintenance-2026-06-09-${ref}`,
REPORT_DATERANGE: 'supabase-report-daterange',