Commit Graph

11 Commits

Author SHA1 Message Date
Danny White 1ab7251060 chore(studio): clarify partnered orgs and projects (#44328)
## What kind of change does this PR introduce?

UI improvements.

- Resolves DEPR-401
- Resolves DEPR-424
- Resolves DEPR-425

## What is the current behaviour?

Studio currently blurs two different concepts together:

- `billing_partner` / `billing_via_partner`, which represent real
billing ownership for marketplace-managed organisations such as AWS and
Vercel
- Stripe connection state, which is not actually partner billing in the
same sense, but was previously being mocked through the same UI paths

That made the Stripe work harder to reason about and left some local
behaviour dependent on temporary overrides rather than the API shape we
want to ship.

## What is the new behaviour?

This PR separates those concerns while keeping the existing AWS and
Vercel marketplace experience intact.

- AWS and Vercel continue to use `billing_partner` /
`billing_via_partner` for billing ownership, lockouts, and manage CTAs
- Stripe display state now comes from `integration_source`, which lets
Studio show Stripe-specific badges and alerts without treating Stripe as
a billing partner
- organisation-level partner UI is unified across AWS, Vercel, and
Stripe, including the org banner, navbar icon treatment, and
organisation cards
- project-level Stripe UI now appears only when the project itself is
marked as Stripe-connected, including the project switcher, project list
surfaces, and a project-level banner
- Stripe-connected organisations are no longer incorrectly blocked
behind the AWS/Vercel-style billing management alerts for invoices,
billing address, payment methods, or plan changes
- banner dismissal is scoped to the relevant org/project and
partner/integration state

## Review order

Most of the diff size here is regression tests and generated types. The
behavioural changes are concentrated in a smaller set of files.

Recommended review order:

1. `integration_source` vs `billing_partner` data-model split and
org/project query mapping
2. org-level UI: partner icon, org banner, org dropdown/card treatment
3. billing gating updates for Stripe vs AWS/Vercel
4. project-level Stripe UI: dropdown, list surfaces, banner
5. tests and generated types

| Stripe Org(s) |
| --- |
| <img width="1024" height="759" alt="Organizations Supabase"
src="https://github.com/user-attachments/assets/d0ef338c-3b41-4c6d-b3bd-f21a2c182840"
/> |

| Vercel Org(s) |
| --- |
| <img width="1024" height="759" alt="Organizations Supabase"
src="https://github.com/user-attachments/assets/1dc57770-3f24-45ac-840f-34680555cde8"
/> |

| AWS Org(s) |
| --- |
| <img width="1024" height="759" alt="Organizations Supabase"
src="https://github.com/user-attachments/assets/7847dad0-ee30-4a65-ab0b-b3b16af0d34f"
/> |

| Stripe Org, Non-Stripe Project |
| --- |
| <img width="1152" height="885" alt="Mallet Toolshed
Supabase-1673E019-792C-462C-B6F8-C5DDB810B331"
src="https://github.com/user-attachments/assets/556fbea3-b5ae-4f2f-96b9-6f66c6654e4a"
/> |

| Stripe Org, Stripe Project |
| --- |
| <img width="1152" height="885" alt="Hammer Toolshed
Supabase-7E86C17C-561F-4221-BD16-EAFF7D41AAE0"
src="https://github.com/user-attachments/assets/94f8daf6-0320-413e-8d56-59f9acaaea15"
/> |

| Vercel Org |
| --- |
| <img width="1024" height="759" alt="Projects Toolshed
Supabase-A7891653-9366-4B99-89DD-789D70CD52E3"
src="https://github.com/user-attachments/assets/c87ee6e8-4451-4866-a905-23a38b2593e3"
/> |

| AWS Org |
| --- |
| <img width="1024" height="759" alt="Projects Toolshed
Supabase-58A43ECE-569E-4541-9463-346A90B02CFF"
src="https://github.com/user-attachments/assets/9350a180-4d58-42a1-ad1a-95893c2e8b12"
/> |

This also removes the old Stripe mock override path in Studio so the
frontend matches the intended API model more closely.

## ~~Dependencies~~ (merged!)

This work depends on the private platform change that exposes
`integration_source` on the relevant organisation and project payloads:

- https://github.com/supabase/platform/pull/31874

_Update: now merged._

## Local testing

### Stripe

If you have the private `platform` repo checked out locally, make sure
your local API returns `integration_source: 'stripe_projects'`
consistently for the Stripe-linked org/project you are testing.

Important responses:

- `/platform/organizations`
- `/platform/organizations/:slug/projects`
- `/platform/projects/:ref`

Verify:

- org banner and org icon show the Stripe connected state
- unopened and opened project switcher both show Stripe only for
Stripe-linked projects
- project cards / table rows show the Stripe chip only for Stripe-linked
projects
- the project-level Stripe banner appears across project surfaces
- billing address, tax ID, invoices, payment methods, and plan changes
remain editable in Studio for Stripe orgs

### Vercel

Use a Vercel Marketplace org with real `billing_partner` /
`billing_via_partner` values.

Important org-level endpoints for local mocking in `platform`:

- `/platform/organizations`
- `/platform/organizations/:slug`
- `/platform/organizations/:slug/billing/subscription`

Project-level Vercel indicators still come from
`/platform/integrations/:slug`, not `integration_source`.

### AWS

Use an AWS Marketplace org with real `billing_partner` /
`billing_via_partner` values.

Important org-level endpoints for local mocking in `platform`:

- `/platform/organizations`
- `/platform/organizations/:slug`
- `/platform/organizations/:slug/billing/subscription`

AWS does not currently have a Stripe-like project-level indicator in
these org/project payloads.

## Notes

- `billing_partner` is no longer the right abstraction for the
Stripe-connected case in this PR. It remains the source of truth for
marketplace billing ownership, while Stripe currently uses
`integration_source` as a connection/display signal.
- I re-ran `pnpm api:codegen` while tightening this PR and kept only the
generated type changes this branch actually depends on, to avoid
unrelated API drift in the review.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
  * Stripe Projects integration added for billing and project flows
* Partner icons/badges shown across org and project lists, dropdowns,
and rows
* Dismissible, partner-specific marketplace/integration banners with
contextual CTA behavior
* Improved partner-billing detection to drive billing UI and
invoice/plan availability

* **Tests**
* Extensive new test coverage for billing UI, partner-managed fallbacks,
banners, icons, and related flows
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-04-23 12:17:24 +10:00
Ivan Vasilov 4fdab665a8 chore: Fix vulnerable packages (#43634)
Fix bunch of vulnerable dependencies:
- https://github.com/supabase/supabase/security/dependabot/3027
- https://github.com/supabase/supabase/security/dependabot/3038
- https://github.com/supabase/supabase/security/dependabot/3058
- https://github.com/supabase/supabase/security/dependabot/3064
- https://github.com/supabase/supabase/security/dependabot/3065
- https://github.com/supabase/supabase/security/dependabot/3085
- https://github.com/supabase/supabase/security/dependabot/3095
2026-03-11 14:10:59 +01:00
Ivan Vasilov 637b6fb792 chore: update react-resizable-panels to v4 to support pixel width (#42990)
This pull request standardizes the usage of props and value types for
the `ResizablePanelGroup` and `ResizablePanel` components across
multiple files in the codebase. Specifically, it replaces the deprecated
`direction` prop with `orientation`, and updates numeric prop values
(such as `defaultSize`, `minSize`, and `maxSize`) to be passed as
strings. This ensures consistency with the updated component API and
improves type safety.

**Component API Updates:**

* Replaced the `direction` prop with `orientation` for all usages of
`ResizablePanelGroup`
* Updated all `ResizablePanel` props (`defaultSize`, `minSize`,
`maxSize`) to be passed as strings instead of numbers, ensuring
compatibility with the latest API requirements.
* Removed deprecated or unnecessary props such as `order` from
`ResizablePanel` components, and ensured all size-related props are
consistently formatted as strings.
2026-02-23 19:48:19 +01:00
Drake Costa d6fe8476f3 Refactor EditSecretModal to use shadcn components (#37258)
* chore: Refactor `NewAccessTokenButton` to use shadcn components

This brings `NewAccessTokenButton` into conformance with the latest UI patterns of using shadcn based components, zod schemas, and react-hook-form for form submission.

I based this refactor on the implementation of `CreateSecretAPIKeyDialog`, which already made use of the above.

* add success and failure toasts

* add smoke test for `NewAccessTokenButton`, fix vitest config

This adds a minimal test for `NewAccessTokenButton` but more importantly fixes a critical bug in the vitest configuration for `studio`.

Because `restoreMocks: true` was set in the config, this meant that the mock implementation for `window.matchMedia` defined in the `tests/vitestSetup.ts` file was being **reset** to an empty function before each test suite was run. While this didn't appear to be a problem before, that appears to be because none of the existing tests had `motion.div` in their component trees. Since `motion.div` calls `addListener` on a media query as part of it's lifecycle, that meant that any test which included it would fail as `addListener` would be undefined in this situation. Removing `restoreMocks: true` from the config results in the desired mocking behavior.

This change is necessary in order to test any component that has the `FormItemLayout` component, as it uses `framer-motion` to animate in error messages for input elements.

* add warning comment in case of future config regression

* update test cases, reset form on dialog close, testing setup fixes

This fixes an issue with the polyfills for the testing environment, where a call to `useMutation` would fail as a result of `TransformStream` being set to `null`.

Basic tests for access token creation and form resetting added. Adds `@faker-js/faker` to the studio app devDependencies to generate mock data for `msw` endpoint response.

Adds `shx` to the docs app devDependencies to ensure that the `codegen:examples` script runs cross-platform.

* ensure mocked date is a string

* update testing setup, pollyfills and add rich type support to addAPIMock

* add missing changes

* Move `EditSecretModal` to be child of `SecretRow`

In the accompanying PR for `DeleteSecretModal`, that one will also be moved over to `SecretRow`

* Update studio testing setup files

Improves API mocking type safety and polyfills browser APIs necessary to run tests with framer-motion components

* chore: Refactor `NewAccessTokenButton` to use shadcn components

This brings `NewAccessTokenButton` into conformance with the latest UI patterns of using shadcn based components, zod schemas, and react-hook-form for form submission.

I based this refactor on the implementation of `CreateSecretAPIKeyDialog`, which already made use of the above.

* add success and failure toasts

* add smoke test for `NewAccessTokenButton`, fix vitest config

This adds a minimal test for `NewAccessTokenButton` but more importantly fixes a critical bug in the vitest configuration for `studio`.

Because `restoreMocks: true` was set in the config, this meant that the mock implementation for `window.matchMedia` defined in the `tests/vitestSetup.ts` file was being **reset** to an empty function before each test suite was run. While this didn't appear to be a problem before, that appears to be because none of the existing tests had `motion.div` in their component trees. Since `motion.div` calls `addListener` on a media query as part of it's lifecycle, that meant that any test which included it would fail as `addListener` would be undefined in this situation. Removing `restoreMocks: true` from the config results in the desired mocking behavior.

This change is necessary in order to test any component that has the `FormItemLayout` component, as it uses `framer-motion` to animate in error messages for input elements.

* update test cases, reset form on dialog close, testing setup fixes

This fixes an issue with the polyfills for the testing environment, where a call to `useMutation` would fail as a result of `TransformStream` being set to `null`.

Basic tests for access token creation and form resetting added. Adds `@faker-js/faker` to the studio app devDependencies to generate mock data for `msw` endpoint response.

Adds `shx` to the docs app devDependencies to ensure that the `codegen:examples` script runs cross-platform.

* ensure mocked date is a string

* update testing setup, pollyfills and add rich type support to addAPIMock

* add missing changes

* Move `EditSecretModal` to be child of `SecretRow`

In the accompanying PR for `DeleteSecretModal`, that one will also be moved over to `SecretRow`

* fix imports

* Update test, fix rebase errors

* remove unnecessary code

* resolve type errors

* fix missing listen call for msw, resolve test type error

* fix imports

* Update studio testing setup files

Improves API mocking type safety and polyfills browser APIs necessary to run tests with framer-motion components

* fix missing listen call for msw, resolve test type error

* fix imports

* remove duplicate test

* update testing setup

* implement requested changes

* cleanup unnecessary conditional logic for undefined `secret` prop

* remove unused import

* remove unnecessary code

* cleanup, replace lodash import with JS

* add required router mock

* fix broken lockfile

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
2025-08-08 15:42:06 -02:30
Drake Costa 57cd26ac77 Move non-layout Storage components to components/interfaces (#37381)
* Update studio testing setup files

Improves API mocking type safety and polyfills browser APIs necessary to run tests with framer-motion components

* fix missing listen call for msw, resolve test type error

* fix imports

* Update studio testing setup files

Improves API mocking type safety and polyfills browser APIs necessary to run tests with framer-motion components

* fix missing listen call for msw, resolve test type error

* fix imports

* Move non-layout Storage related components to `components/interfaces`

* Fix paths

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-07-22 23:48:20 +08:00
Alaister Young c26a1a7e63 chore(studio): remove unused files (#32623) 2025-01-08 12:39:00 +08:00
Ivan Vasilov 06aa80e9f0 chore: Bump next to non-vulnerable version (#31277)
* Add next to pnpm catalog and use that next version from all apps and packages.

* Remove vite direct dependency.

* Set the @types/node to version 20.

* Stabilize supports-color by adding it in the main package.json. This will make it appear in all packages that have it as optional.

* Use built-in matchers for vitest in @testing-library/jest-dom.

* Add libpg-query as a dependency to docs.

* Remove nextjs-node-loader for the built-in external packages feature on nextjs.

* Clean up extra comment.
2025-01-03 13:25:00 +01:00
Jordi Enric 764d10986d vitest & msw integration (#26303)
* Fix tests in tests/unit, tests/components and files under tests, looking into tests/pages

* Fix tests under pages/projects root

* Fix

* Comment out broken tests that im stuck with

* Fix api-report.test

* Fix storage-report-test

* chore: fix some tests

* chore: remove logging

* Fix LogsPreviewer.test.js

* Fix most of logs-query-test

* Skip broken tests instead of false positiving them

* Replace jest with vitest

* Rename all *.test.js to *.test.ts

* Configure vitest to work with jsx

* fix vitest issues, fix tests, skip broken tests, add msw, add next-router-mock

* uncomment file

* add tests for msw and nrm

* Fix failing tests

* fix tests in RowEditor

* fix datepicker tests

* fix type errors and comment out tests that need some refactoring

* leave 1 test so test script works

* rm clog and aaaaa

* rename script

* move msw to studio

* add pckg json which i forgot in last commit

* rm consolelog

* move vitest ui dep

* Move next-router-mock to studio.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: TzeYiing <ty@tzeyiing.com>
Co-authored-by: Kamil Ogórek <kamil.ogorek@gmail.com>
Co-authored-by: Terry Sutton <saltcod@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2024-05-29 17:31:20 +02:00
Greg Richardson 3f1df65bba SQL to REST translator (#25978)
* feat: sql-to-rest poc

* feat: sql-to-supabase-js poc

* chore: upgrade to libpg-query@15

* feat: sql-to-rest docs tool

* docs(sql-to-rest): add introduction

* docs: wording improvements

* fix: theme

* chore: tailwind placeholder

* feat(sql-to-rest): limit, offset, and range

* feat(sql-to-rest): sort by

* fix(sql-to-rest): ui theme

* feat(sql-to-rest): casts

* feat(sql-to-rest): dynamic faqs in ui

* feat(sql-to-rest): improve ui responsiveness

* feat(sql-to-rest): more advanced faqs in ui

* feat(sql-to-rest): http and curl syntax highlighting

* feat(sql-to-rest): baseUrl in http/curl rendering

* docs(sql-to-rest): clarification on curl flags

* feat(sql-to-rest): more faqs

* refactor(sql-to-rest): split faqs into own file

* refactor(sql-to-rest): move formatters to sql-to-rest package

* docs(sql-to-rest): move page to new tools section

* feat(sql-to-rest): joins and resource embeddings

* chore(sql-to-rest): rename 'convert' to 'translate'

* feat(sql-to-rest): add faqs

* feat(sql-to-rest): ui improvements

* feat(sql-to-rest): faq title adjustment

* feat(sql-to-rest): link to client lib docs

* feat(sql-to-rest): assumptions

* feat(sql-to-rest): friendly 'not supported yet' errors

* feat(sql-to-rest): json columns

* feat(sql-to-rest): remove curl -G flag if unused

* feat(sql-to-rest): better error handling

* chore: revert accidental rls ai work

* fix: build errors

* fix(sql-to-rest): theme

* feat(sql-to-rest): change base url

* feat(sql-to-rest): basic aggregate poc

* feat(sql-to-rest): group by

* feat(sql-to-rest): more group by checks

* feat(sql-to-rest): count(*) special case

* fix(sql-to-rest): tests

* feat(sql-to-rest): faq on 'and' operator

* fix(sql-to-rest): error messages

* fix(sql-to-rest): multiple filters on same column

* refactor(sql-to-rest): error hints

* feat(sql-to-rest): match and imatch

* feat(sql-to-rest): in operator

* feat(sql-to-rest): parsing error hints

* feat(sql-to-rest): default language to curl

* feat(sql-to-rest): format on cmd+s

* feat(sql-to-rest): format initial value

* fix(sql-to-rest): turn off tab query group

* feat(sql-to-rest): improve wording in error messages

* feat(sql-to-rest): animated code blocks

* feat(sql-to-rest): more error hints

* fix(sql-to-rest): strip primary relation prefix from columns

* feat(sql-to-rest): json column in order by clause

* feat(sql-to-rest): validate all referenced relations exist in from clause

* refactor(sql-to-rest): split core sql-to-rest lib into separate repo

* feat(sql-to-rest): upgrade to v0.1.1

* feat(sql-to-rest): upgrade to v0.1.2

* feat(sql-to-rest): upgrade to v0.1.4

* chore: upgrade libpg-query

* feat: update 'create a pr' link

* fix: app builds

* fix: prettier

* fix: typecheck

* fix: studio tests

* chore: remove console.log

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* docs(sql-to-rest): remove broken link to client libraries

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
2024-05-22 12:37:01 -06:00
Joshen Lim d025e0f739 chore/fix studio jest tests (#25872)
* Fix tests in tests/unit, tests/components and files under tests, looking into tests/pages

* Fix tests under pages/projects root

* Fix

* Comment out broken tests that im stuck with

* Fix api-report.test

* Fix storage-report-test

* chore: fix some tests

* chore: remove logging

* Fix LogsPreviewer.test.js

* Fix most of logs-query-test

* Skip broken tests instead of false positiving them

---------

Co-authored-by: TzeYiing <ty@tzeyiing.com>
2024-05-11 12:05:25 +02:00
Ivan Vasilov 436bdb10ae chore: Move the studio app to apps/studio (#18915)
* Move all studio files from /studio to /apps/studio.

* Move studio specific prettier ignores.

* Fix the ui references from studio.

* Fix the css imports.

* Fix all package.json issues.

* Fix the prettier setup for the studio app.

* Add .turbo folder to prettierignore.

* Fix the github workflows.
2023-11-15 12:38:55 +01:00