Commit Graph
16 Commits
Author SHA1 Message Date
Manan GuptaandJoshen Lim 6a0518dd86 fix(studio): forward HA flag to project-creation pre-flight checks (#50902)
## Summary

- Fixes MUL-1678: toggling High Availability on in the project-creation
wizard 400'd for orgs that are HA-entitled but not enrolled in the "V3
rollout ramp" feature flag on the backend, because two pre-flight
endpoints Studio calls before project creation didn't know about HA and
hit the ramp check the real create-project call already bypasses.
- Threads `highAvailability` through
`useOrganizationAvailableRegionsQuery` (`GET
/platform/projects/available-regions`, sent as
`high_availability=true|false` on the query string) and
`useProjectCreationPostgresVersionsQuery` /
`useAvailableOrioleImageVersion` (`POST
/platform/organizations/:slug/available-versions`, sent as
`high_availability` in the body), including their query-key cache keys
so HA and non-HA responses for the same org/provider/size don't collide.
- Wires the (already form-tracked) `highAvailability` value into every
call site: `ProjectCreationForm.tsx`, `RegionSelector.tsx`, and a new
`highAvailability` prop on `PostgresVersionSelector.tsx` passed from
`InternalOnlyConfiguration.tsx`.

## Problem

The project-creation wizard's HA toggle is wired into the actual
project-create request, but two pre-flight calls Studio makes before
that (available regions, available Postgres versions) had no way to
signal HA, so the backend's ramp-flag gate rejected them for HA-entitled
orgs outside the ramp.

## Solution

Add an optional `highAvailability` field end-to-end on the Studio side:
query hook variables, cache keys, request serialization, and the
components that already track the toggle via `useWatch`.


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

* **Bug Fixes**
* Available regions and database versions in project creation now
reflect the selected high-availability setting.
* The Create button remains disabled while available regions are
loading.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: GuptaManan100 <guptamanan100@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-09-29 20:39:01 +05:30
Ignacio Dobronich e6ca2766ff feat: show tax preview for credit top-ups (#45005)
## Summary

- Add tax preview to the credit top-up flow by integrating the new `POST
/organizations/{slug}/billing/credits/preview` endpoint
- Show a price breakdown (credit amount, tax line item, total) in the
top-up dialog before the user confirms payment
- Handle all three `tax_status` states: show tax when `calculated`, hide
the line when `not_applicable`, show an inline warning when `failed`


## Behavior

- Preview fires as soon as a valid amount (300–2000) is entered; address
and tax ID are optional and refine the estimate
- Amount and address changes are debounced at 1s to avoid excessive API
calls

## Test plan

- [ ]  Open credit top-up dialog - verify preview appears with default
$300 amount
- [ ]  Change amount within 300–2000 - verify preview updates after
debounce
- [ ]  Enter amount outside range (e.g. 100 or 3000) - verify preview
hides and validation error shows
- [ ]  Add a new payment method with a billing address in a taxed region
- verify tax line item appears
- [ ]  Add a new payment method with no tax jurisdiction - verify no tax
line, just total
- [ ]  Complete a top-up - verify the charge goes through and dialog
closes


<img width="571" height="551" alt="image"
src="https://github.com/user-attachments/assets/d3357752-f913-4a4a-b84a-f78e2f457c7b"
/>


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

* **New Features**
* Credit top-up preview with charge breakdown (credit, tax or tax note,
total).
* Onboarding survey endpoint and ISO 27001 certificate availability for
organizations.

* **Updates**
* Improved top-up UX: debounced address/tax inputs, enforced min/max
amount validation, preview-driven form state, and submit disabled while
preview is loading/stale.
  * API docs wording changed to “temporary access configuration.”
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-23 12:16:57 -03:00
Ignacio Dobronich 927d399264 feat: show tax in new org creation (#44553)
- Call the new `POST /platform/organizations/preview-creation` endpoint
when creating an organization on a paid plan to show a tax breakdown
before submission
- Preview is triggered reactively when the user completes the billing
address in the Stripe AddressElement (debounced, same pattern as
subscription upgrades)
- Displays plan price, tax line (with percentage), and total due today -
hides the plan price row when there's no tax adjustment

## Test plan

- [ ]  Create a new org on the Free plan - no preview should appear
- [ ]  Create a new org on Pro/Team - fill in billing address with all
fields including name
- [ ]  Verify tax preview appears after address is complete (1s
debounce)
- [ ]  Verify tax line shows for taxable jurisdictions (NY Zip Code
10001), hidden for non-taxable
- [ ]  Verify plan price row is hidden when total equals plan price (no
tax)
- [ ]  Change address country - verify preview updates
- [ ]  Add a tax ID - verify preview updates

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

* **New Features**
* Pricing preview during organization signup that shows plan price
differences, tax details (rate/amount or estimation failure), and “Total
due today.”
* Preview updates reactively based on selected plan and spend cap (PRO
without spend cap treated as PAYG) and appears only for paid plans after
preview initialization.
* Debounced billing address and tax ID input collection for accurate
previews; panel opacity reduced while fetching.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-14 11:48:48 -03:00
Ignacio Dobronich f6eb9a024e feat: refresh tax preview on address change (#44470)
## Summary

- Passes billing address and tax ID from the payment form to the
subscription preview endpoint, so taxes are recalculated live as the
user updates their details
- Debounces address/tax ID changes (1s) in `NewPaymentMethodElement` to
avoid excessive API calls while typing
- Decouples the preview refetch from the payment form's mount state -
uses `keepPreviousData` so the form stays mounted and the breakdown dims
with `opacity-50` instead of unmounting/remounting during refetches.
Shimmer skeleton only shows on initial load.
- Disables the "Confirm upgrade" button while a refetch is in progress
to prevent submitting with stale tax data
- Respects the "Use address as my org's billing address" checkbox: the
preview should mirror what will actually happen - if the checkbox is
unchecked, the address won't be saved to Orb, so it shouldn't be used
for the tax estimate either. Otherwise the user sees one price and gets
charged another. The logic for this lives in `PlanUpdateSidePanel`


``` mermaid
flowchart TD
    A[User opens upgrade dialog] --> B[Fetch subscription preview]
    B --> C[Show payment form + price breakdown]

    C --> D[User edits address or tax ID]
    D -->|1s debounce| E{Use as billing address?}

    E -->|Yes| F[Re-fetch preview with new address]
    E -->|No| G[Re-fetch preview without address override]

    F --> H[Update breakdown — form stays mounted]
    G --> H

    H --> C

```

## Test plan

- [x]  Open the plan upgrade dialog, verify the payment form and
breakdown load normally on first open
- [x]  Change the billing address country - verify the breakdown dims
briefly and updates with new tax amounts without the payment form
unmounting
- [x]  Toggle the tax ID on/off and change its value - verify the
preview refreshes after ~1s debounce
- [x]  Confirm the upgrade button is disabled while the preview is
refetching
- [x]  Uncheck "Use address as my org's billing address" - verify the
preview refetches without address/tax overrides
- [x]  Re-check the checkbox - verify the preview refetches again with
the current form address
- [x] Assert that adding a new billing address in the CreditTopUp form
works and saves the address

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

* **New Features**
* Payment and subscription flows now propagate billing address and tax
ID via new callbacks; subscription preview requests include these values
and preserve prior results while fetching.
* Preview updates are debounced to reduce noise; loading state disables
confirm actions and visually dims charge breakdown.

* **UX**
* Address input emits complete normalized address updates (empty second
line cleared).
  * Tax ID input emits updates and explicit clears (null).
* “Use address as my org's billing address” is now controlled and
reports changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-07 13:02:49 -03:00
Kevin Grüneberg ed01625828 feat: code redemption in billing settings (#42377)
Adds a new code redemption button for the new credit system. Feature
Flag toggled off on production for the time being.
2026-02-04 12:28:54 +05:30
Ignacio Dobronich 9fcabb5cfa chore: invalidate entitlements (#39905)
* Rebased

* Use keys
2025-10-27 13:24:36 -03:00
Joshen Lim 6e2a7feee7 Break down new project page into smaller components (#39812)
* Break down new project page into smaller components

* Fix types

* Address comments

* Add min length check for project name in project settings

* Fix tests
2025-10-27 14:04:56 +08:00
CharisandJoshen Lim 91645ade09 feat(region selector): get region status by desired size (#39631)
* feat(region selector): get region status by desired size

The available-regions endpoint now takes a desired_instance_size query
parameter to return more accurate status data.

* Align call of useOrganizationAvailableRegionsQuery in [slug] with RegionSelector, and rearrange some consts

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-21 11:08:57 -04:00
Alaister YoungandJoshen Lim 29e107af4a [FE-1712] chore: use /available-regions endpoint for project creation (#37371)
* chore: use /available-regions endpoint for project creation

* fix types

* make postgres version selection work

* Small nit refactors

* Feature flag changes + fix icons for flags in various places

* Fix creating projects when selecting a smart region

* Fix sending region selection to create project endpoint

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-19 16:36:59 +08:00
Ivan VasilovandJoshen Lim 586a829828 feat: Project claim (#35992)
* Add another page for claiming a project.

* Fix a misspell.

* Minor fixes.

* Comment some test code.

* Update the design on the confirm step.

* Reorganize the authorize page. Bunch of design fixes for the claim page.

* Fix

* Delete added files my mistake.

* Separate claim-project and authorize pages. Minor design fixes.

* Add more logs to the generate claim button.

* snapshot.

* Add more copy to the three steps.

* Make the claim URL button better.

* Add missing comma.

* Fix unneeded changes.

* Make the header full width.

* Fix all comments by Joshen.

* Clean up extra code.

* Forgotten some things to clean.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-06-10 11:49:23 +03:00
6d09404779 feat: add mfa enforcement toggle (#34307)
* feat: add mfa enforcement toggle

Allows toggling MFA enforcement on an organization level.

Depends on API change #22088

* fix: toggle and disable action for non-owner

* chore: disable for free plans

* chore: disable toggle for org MFA if current user doesn't have MFA enabled

* set initial state

* move org mfa to security page

* use zod resolver

* fix initial values

* useQueryClient in the organization-mfa-mutation

* chore: warn about losing access to mfa orgs

* Some refactors, fixes and improvements

* chore: feature flag mfa enforce page

* Tiny fix

* Leave comment

---------

Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-05-09 16:56:49 +02:00
Joshen LimandPaul Cioanca a4243f438f Add restrictions for orioledb technical preview (#30410)
* Add restrictions for orioledb technical preview

* Add callouts to pgvector and postgis if orioledb

* Restrict restore to new project for orioledb

* Scaffold client side validation for preventing org upgrade if org has oriole db present

* Hook up proper logic for oriole

* Fix

* Remove console log

* Fix type

* Disable version selector if only one version is available

* chore: oriole badges

* UI updates based on requests

* Update copy

* Fix

* Dont open assistant if opt is selected

* Fix

* Fix

* Update badge

* Add feature flag for orioleDB

* Feature flag oriole check in plan update

---------

Co-authored-by: Paul Cioanca <paul.cioanca@supabase.io>
2024-11-30 17:36:15 +08:00
Kevin Grüneberg f541107196 chore: use new tax id endpoints (#27246)
Adapts the tax id view to the new MGMT-API endpoints. Users can now only manage a single tax id instead of adding multiple.

Besides
- Use non-deprecated fetchers
- Use Shadcn components
2024-06-19 12:19:20 +08:00
Kevin Grüneberg 598c1ef866 chore: remove unused billing page/queries (#19412) 2023-12-04 15:54:57 +01:00
Joshen Lim 8ae0c0f9b5 Chore/refactor organization details query to organization members (#19012)
* Refactor organization details query to organization members

* Remove organzation detials key

* Deprecate Member type from dashboard, use api spec as source of truth

* Add mfa enabled support proactively

* Show mfa enabled column proactively

* Add icon
2023-11-20 12:04:07 +08: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