Commit Graph
42 Commits
Author SHA1 Message Date
Gildas Garcia b30db91d71 chore: cleanup UI patterns exports (#47406)
## Problem

We now export components under a subpath in ui-patterns to avoid barrel
files as they slow down every tools (from IDE to linters, etc.) and may
also affect bundles our users have to download.

## Solution

- Remove the UI patterns index file
- Fix invalid impors
2026-06-30 09:23:17 +02:00
Gildas GarciaandIvan Vasilov 96d43099bb chore: refactor Button API so that it can be used a standard button (#46880)
## Problem

Our `<Button>` component breaks the default `button` contract by
redefining the `type` prop to set its variant (`primary`, `default`,
etc) instead of the button type (`submit`, `button`, etc).
This is confusing and forces to write more code when using it with
shadcn components that expect/inject the standard button props.

## Solution

- rename the `type` prop to `variant`
- rename the `htmlType` prop to `type`
- propagate the changes where necessary
- format code

## How to test

As this is just prop renaming, if it builds it's ok

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-06-16 23:59:58 +02:00
Joshen Lim aab3924eef Refactor Invoice estimate tooltip in plan update confirmation dialog (#45446)
## Context

Main fix is to ensure that the tooltip here is scrollable - but also
adding some refactors
This is the org billing page when downgrading an org

### Before
<img width="400" alt="image"
src="https://github.com/user-attachments/assets/6094c2e6-c1bb-460f-a2d2-347c1d7d2e77"
/>

### After
<img width="400" alt="image"
src="https://github.com/user-attachments/assets/9d0ac9a6-6e89-4758-af14-8144a8a86469"
/>

## Changes involved
- Use HoverCard for invoice estimate in plan confirmation dialog
- Also nudge the UI a little, e.g use a separate column for the compute
prices + adjust text color to improve clarity
- Refactor usage of `any` for some of the TS declarations

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

* **New Features**
* Added an invoice estimate tooltip in subscription settings showing
monthly charges with plan fees, combined compute rows, per-project
compute costs, optional compute credits, and a total monthly estimate.

* **Refactor**
* Simplified the plan update flow by consolidating subscription preview
handling and extracting the invoice UI into the new tooltip component.

* **Chores**
* Improved internal type definitions for subscription preview data and
pricing tier identifiers.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-05 10:54:18 +08:00
Ignacio DobronichandJoshen Lim cf9d88700d fix: top-up loading state and show plan item on downgrade (#45430)
## Summary

- **Subscription downgrade dialog**: The plan name row was being hidden
in the charge breakdown when `changeType === 'downgrade'`, so users
downgrading (e.g. Team → Pro) couldn't see which plan the cost referred
to. Removed the downgrade exclusion so the plan name row renders
consistently across upgrade/downgrade flows.
- **Credit Top Up dialog**: The submit button only
reflected `executingTopUp`/`paymentConfirmationLoading`, but
the `onSubmit` handler runs several async steps first (hCaptcha, billing
profile validation, Stripe `createPaymentMethod`) before the mutation
flips `isPending`. That left a clickable window where users could
trigger multiple top-ups. Added `form.formState.isSubmitting` to
both `loading` and `disabled` so the button is locked for the full
submit lifecycle.

## Test plan

- [ ]  Downgrade from Team → Pro and confirm the Pro plan row appears in
the charge breakdown
- [ ]  Open Credit Top Up, submit, and rapidly click the Top Up button —
verify only one charge is initiated
- [ ]  Verify Top Up button shows a loading state immediately on click
(before the mutation starts)


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

* **Bug Fixes**
* Consistently show subscription plan cost during billing adjustments,
including downgrades.
* Improve Top Up button to reflect form submission state and prevent
duplicate submissions.

* **Style**
* Enhanced text contrast for better readability in billing information
displays.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-04-30 14:40:08 -03:00
Ivan VasilovandJordi Enric 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00
Ignacio Dobronich 4763ac8374 fix: show plan name on empty orgs (#45247)
## Summary

- Show the plan name row in the monthly invoice estimate tooltip even
when the organization has no projects, so the section no longer appears
headerless next to the tax line.

## Test plan

- [ ]  Open an org with no projects → Subscription plan update dialog →
hover the "Monthly invoice estimate" tooltip → verify the plan name +
price row is visible.
- [ ]  Repeat on an org with projects → verify plan, Compute row, and
project breakdown all still render as before.

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

## Summary by CodeRabbit

* **Refactor**
* Improved rendering of the Monthly invoice estimate table in the
subscription plan update dialog, with reorganized display logic for plan
and project billing rows.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-27 14:29:34 -03:00
Ignacio Dobronich 18e21a410b fix: adjust charge breakdown for prorated credits and subtotal calculation (#45075)
Reorders the itemized charge breakdown in the subscription upgrade
preview dialog to: Plan → Tax → Subtotal → Unused Time → Credits. Also
appends a "Includes proportional tax if applicable" note to the unused
time tooltip when tax is being applied, so users understand the prorated
credit already reflects tax.

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

## Summary by CodeRabbit

* **Bug Fixes**
* Reorganized proration breakdown display order in subscription plan
updates for improved clarity.
* Enhanced unused time charge tooltip to conditionally include tax
information.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-21 14:11:57 -03:00
oniani1andGildas Garcia 595061e20c fix(studio): show empty org warning when there are no active projects (#44870)
Closes #44872

The "Empty organization" admonition in the subscription upgrade dialog
checks `.length === 5` instead of `.length === 0`. The warning text says
"This organization has no active projects" but only shows for orgs with
exactly 5 active projects.

Introduced in #44494 (b9e83b25).

The adjacent `.length === 1` check for the single-project note is
correct, confirming this is a count comparison that should be `0`.

Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
2026-04-15 09:45:15 +02:00
Ignacio Dobronich 69e00c6bbc feat: validate and save tax id using the customer endpoint (#44682)
## Summary

Reorder AddPaymentMethodForm and PaymentMethodSelection to use a dry run
validation → Stripe payment setup → real update flow:

- Validate address and tax ID via `dry_run: true` before touching Stripe
- Proceed with Stripe payment method creation / 3DS only if validation
passes
- Persist the customer profile update with dry run disabled after Stripe
succeeds
- Add `dry_run` support
to `useOrganizationCustomerProfileUpdateMutation`
- Add `getFormValues()` to `PaymentMethodElementRef` to read address and
tax ID form state
- Delete the now-unused `organization-tax-id-update-mutation.ts`

## Test plan

### Adding a Payment Method

From the billing dashboard `/org/_/billing`:

- [ ]  Add a payment method with a valid tax ID: should dry-run
validate, then create the payment method via Stripe, then persist the
billing profile
- [ ]  Add a payment method with an invalid tax ID: should show a
validation error from the dry run and not proceed to Stripe payment
setup
- [ ]  Add a payment method with the "primary billing address" checkbox
unchecked: should skip the customer profile update entirely and only
create the payment method
- [ ]  Add a payment method where Stripe 3DS fails: billing profile
should not be persisted (only the dry run ran)

### Credit Top Up

- [ ]  Top up credits with a new payment method and valid tax ID: should
dry-run validate, then create the payment method, then process the
top-up
- [ ]  Top up credits with a new payment method and invalid tax ID:
should show a validation error from the dry run and not proceed to
Stripe payment method creation

### Plan Upgrade

- [ ]  Upgrade plan with a new payment method and valid tax ID: should
dry-run validate before creating the payment method
- [ ]  Upgrade plan with a new payment method and invalid tax ID: should
show a validation error and not proceed to Stripe
- [ ]  Upgrade plan with an existing payment method: should proceed
without dry-run validation
2026-04-14 13:42:34 -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
Ignacio Dobronich 41e6b66d7b feat(billing): show tax in subscription upgrade preview (#44258)
This PR moves the client-side "Charge Today" calculation to the backend
- relying on the `preview` endpoint data to show the `Charge Today`,
`Prorated Credits` and `Customer Balance` in the Subscription Upgrade
Preview.

It also includes fields for displaying Tax information in the preview,
only for enabled orgs. Do note that at the moment the Tax Preview will
not change if the address in the Subscription Preview changes, that will
be tackled in a follow-up PR.

## Changes

- Replace client-side charge calculation with backend data: The upgrade
dialog previously computed the prorated credit and total charge locally
(using subscription period timestamps and plan prices). This PR uses the
`upfront_charge` object returned by the subscription preview API
instead.
- Display itemized tax breakdown: When the backend returns tax data, the
dialog now shows a line-by-line breakdown: plan cost → subtotal (if
different) → tax (with rate %) → total charged today.
- Use `tax_status` from the subscription preview to conditionally show
tax details, and display a warning when tax calculation fails.


## Testing

### No taxes - Upgrade from Free to Paid Plan
- With a Free Org with a billing address in Canada or any other
non-enabled jurisdiction, start the upgrade to the Pro Plan
- Assert that only the Charge Today field is shown in the summary
<img width="410" height="298" alt="image"
src="https://github.com/user-attachments/assets/e8c7e12e-833d-41d5-aec3-00092b12782f"
/>

### Taxes - Upgrade Plan
- Update an Org's Orb Customer on the Free or Pro Plan with the
`automatic_tax_enabled: true` flag.
```
curl --location --request PUT 'https://api.withorb.com/v1/customers/external_customer_id/{ORG_SLUG}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: ••••••' \
--data '{
  "tax_configuration": {
    "tax_exempt": false,
    "tax_provider": "numeral",
    "automatic_tax_enabled": true
  }
}'
```
- Update the Org address to a valid taxable address, like: 
```
  "address": {
    "country": "US",
    "line1": "100 Congress Ave",
    "city": "Austin",
    "state": "TX",
    "postal_code": "78701"
  }
```
- Assert that the tax information is shown in the preview, including Tax
Rate, Prorated credits (if applicable), Customer balance (if applicable)
and the price of the intended plan.

<img width="465" height="470" alt="image"
src="https://github.com/user-attachments/assets/dd6a7e27-1708-48a8-bbf3-5435e6d582c2"
/>






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

## Summary by CodeRabbit

* **New Features**
* Added itemized breakdown of subscription charges, including plan cost,
unused time credits, subtotal, and applicable taxes.
  * Enhanced billing estimates with detailed tax information display.

* **Improvements**
* Updated "Charge today" calculations to reflect real-time preview data
for greater accuracy.
* Improved billing estimate UI layout and clarity with better
organization of charge details.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-06 13:24:59 -03:00
Ignacio Dobronich 4189e76341 fix: round currency value to 2 decimal places in subscription upgrade preview (#44502)
This PR removes the `Math.round` from the `Totals` in the subscription
upgrade preview.

| Before | After |
|--------|-------|
| <img width="388" height="397" alt="image"
src="https://github.com/user-attachments/assets/f0f63ad5-c7c0-44b2-9ebc-59c9e4ad66c0"
/> | <img width="422" height="457" alt="image"
src="https://github.com/user-attachments/assets/98a7f69f-429a-42eb-98ce-20de4974c29e"
/> |
| <img width="563" height="401" alt="image"
src="https://github.com/user-attachments/assets/083942f5-90b2-4c91-b195-4526694e365d"
/> | <img width="766" height="467" alt="image"
src="https://github.com/user-attachments/assets/854e127d-db45-48d4-b3a9-fdb010748f71"
/> |

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

## Summary by CodeRabbit

* **Bug Fixes**
* Improved precision of billing calculations in subscription plans, with
monthly invoice estimates and plan totals now displaying more accurate
currency amounts.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-02 17:22:50 -03:00
4a0bb36ca8 style: require sorted imports in studio/components (#44408)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-04-01 10:22:37 +02:00
Saxon FletcherandJoshen Lim 0d761b0434 Connect sheet final content (#42374)
<img width="2892" height="2342" alt="image"
src="https://github.com/user-attachments/assets/7e08929d-abc3-4397-b89d-99cc52d8190e"
/>

This is the third and final PR to complete the new connect sheet. 

First: https://github.com/supabase/supabase/pull/42367

Second: https://github.com/supabase/supabase/pull/42373

This re-adds the Direct, ORM, MCP tabs and their content, including via
connect.schema.

To test:
- Flag will be enabled on all staging projects
- Click connect and notice new Sheet
- Click all tabs and ensure content is correct

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

* **New Features**
* Multi-mode connection flow with mode selector and icons (framework,
direct DB, ORM, MCP)
* New framework/variant/library selector, richer connection guides and
install steps (Prisma, Drizzle, direct)
* MCP onboarding flows (Cursor, Codex, Claude Code) with server/auth
commands and configuration UIs

* **Refactor**
* Connect schema and state rebuilt to be mode-driven with improved step
resolution and cascading state updates

* **Tests**
* Expanded unit tests covering framework resolution, connect flows, and
mode behaviors

* **Chores**
  * ESLint ignores updated for content files
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-02-11 22:14:18 +08:00
Kevin Grüneberg db2bcc31cf chore: change wording for Pro Plan upgrade (#41718)
Remove unlimited project wording as the projects costs extra
2026-01-06 16:56:14 +08:00
Ivan Vasilov cc47bcfa6d chore: Migrate studio to use ui-patterns/shimmeringLoader (#41405)
* Add shimmering-loader CSS to ui-patterns.

* Import the shimmering-loader classes from the ui-patterns component.

* Remove ShimmeringLoader from studio.

* Migrate studio to use ui-patterns/ShimmeringLoader.

* Migrate away from using default import for ShimmeringLoader.

* Fix the css imports in docs and studio.
2025-12-17 14:54:07 +01:00
Alaister Young 52c0de8394 fix(studio): mobile scroll on subscription update dialog (#41058) 2025-12-04 20:41:31 +08:00
Kevin Grüneberg f9d4bd20b9 chore: compute cost copy on plan change (#40730) 2025-11-24 16:30:03 +08:00
Ivan Vasilov 43cc61818c chore: Migrate all isPending uses in react-query (#40642)
* Bump react-query. Minor type and logic fixes.

* Migrate all use of isLoading to isPending in mutations.

* Fix type errors.
2025-11-20 16:44:53 +01:00
Kevin Grüneberg 7e783dcb0a chore: remove upgrade support notice (#40433)
This no longer applies
2025-11-14 13:56:30 +08:00
Ivan VasilovandAli Waseem 391fdb877c feat: Add a note when upgrading from free to paid plan. (#37631)
Add a note when upgrading from free to paid plan.

Co-authored-by: Ali Waseem <waseema393@gmail.com>
2025-10-30 14:48:12 +00:00
Joshen Lim 6b7c8116f3 Chore/projects pagination part 05 (#39350)
* CmdK OrgProjectSwitcher to swap useProjectsQuery with useProjectsInfiniteQuery

* Remove usage of useProjectsQuery in ProjectDropdown

* Remove usage of useProjectsQuery in NotificationsPopover

* Remove usage of useProjectsQuery in NotificationsFilter

* Remove usage of useProjectsQuery from LoadingState

* Clean

* Remove usage of getProjects from org-ai-details and fix missing key props in AIOnboarding

* Remove useAutoProjectsPrefetch from org/[slug]/index

* Fix TS  + clean up

* Clean

* Remove usage of useProjectsQuery in NewOrgForm

* Remove usage of useProjectsQuery in SupportForm -> AIAssistantOption

* Remove usage of useProjectsQuery in PlanUpdateSidePanel

* Remove usage of useProjectsQuery in NoProjectsOnPaidPlan

* Remove useProjectsQuery in IntegrationPanels

* Remove useProjectsQuery from IntegrationPanels 2

* Remove useProjectsQuery from IntegrationConnection

* Remove console log

* Small change
2025-10-09 12:26:54 +08:00
5f533247e1 Update docs url to env var (#38772)
* Update Supabase docs URLs to use env variable

Co-authored-by: a <a@alaisteryoung.com>

* Refactor: Use DOCS_URL constant for documentation links

This change centralizes documentation links using a new DOCS_URL constant, improving maintainability and consistency.

Co-authored-by: a <a@alaisteryoung.com>

* Refactor: Use DOCS_URL constant for all documentation links

This change replaces hardcoded documentation URLs with a centralized constant, improving maintainability and consistency.

Co-authored-by: a <a@alaisteryoung.com>

* replace more instances

* ci: Autofix updates from GitHub workflow

* remaining instances

* fix duplicate useRouter

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: alaister <10985857+alaister@users.noreply.github.com>
2025-09-26 10:16:33 +00:00
Kevin Grüneberg dfb152ab8c chore: consolidate payment method components / ownership (#38578)
Security approval is required for PCI compliance. This means we need security approval wherever we embed Stripe for payment methods.

Security approval was previously very coarse and most billing changes required security approval unnecessarily.

This PR aims to move all files relevant for payment method display/changes into a single folder and adjusts the ownership to only require security approval for that.
2025-09-10 13:54:36 +08:00
Kevin Grüneberg d60b3e3b9e feat: cached egress rollout (#37827) 2025-08-13 17:36:48 +08:00
Kevin Grüneberg 7eae9ad67a fix: docs links resulting in 404 (#37720) 2025-08-06 15:03:01 +02:00
Saxon FletcherandJoshen Lim c76707012d basic typography classes (#37613)
* basic typography classes

* Clean up classes for where we use h1 tags

* Clean up classes for where we use h2, h3, h4

* Clean up classes for where we use h6

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-04 20:55:34 +10:00
Kevin Grüneberg 740eeb8504 feat: mandatory address input for paying customers (#37337)
- Mandatory address input when adding a new payment method
- Removed the global HCaptcha store that wasn't used consistently and would sometimes block payment method changes
- Remove the custom billing address data & tax id form on org creation and plan upgrades in favour of Stripe's `AddressElement`
- Unify usage of the Stripe payment elements into a single component
- Customers can mark "Purchasing as a business" and will then be able to put down a tax id
- Adjusted billing address form to have better labels + tax id is filtered down to selected country
- Adjusted Stripe Elements styling to use floating labels (otherwise very hard to use with address element) + additional styling changes
- New flag to filter out payment methods that do not have an address for org upgrades and credit top ups, this will be enforced a few days after rolling this out
- Added Google Maps Places API integration for address auto-completion via Stripe AddressElement
- Upgraded Stripe dependencies
- Slight adjustments to styling of plan upgrade modal
2025-07-23 18:16:10 +08:00
Kevin Grüneberg 985b530382 chore: hint for compute costs in upgrade screen (#37094) 2025-07-14 16:31:35 +08:00
Kevin Grüneberg 4984392edd fix: prevent double submission of plan change (#36765)
When changing the plan while also creating a payment method in the same breath, some customers double-clicked the confirm button leading to a double-submission and possibly leading to a state where the customer gets charged, but the plan change is not going through.
2025-06-30 19:03:59 +08:00
Kevin Grüneberg 2c6c5d11e4 chore: cleanup pending subscription flags (#36692) 2025-06-26 18:05:04 +08:00
Kevin Grüneberg ae9ce3d010 fix: payment method selection (#36623) 2025-06-24 03:23:56 +00:00
Kevin Grüneberg 680af04a06 fix: 3ds confirmation / downgrades (#36600)
- Remove captcha for downgrades to Free, it is not needed
- Properly handle 3DS if customer has multiple payment methods
- Move payment method invalidation to react-query
2025-06-23 19:03:27 +08:00
Ignacio Dobronich 692f0b2d94 fix: update Change Plan modal caption and fix broken Compute Confirmation link (#36539)
* Pro Plan heading caption

* Fixed Comput costs docs link

* Revert to premium support

* Email support

* Fixed typing error in PaymentMethodSelection
2025-06-20 13:25:24 -03:00
Kevin Grüneberg dff6074d30 feat: support pending changes for plan upgrades (#36430)
This PR implements the new flow to confirm subscription upgrades using Orb pending changes. This is backwards compatible and based on a flag exposed by the backend (`subscriptionPreview.pending_subscription_flow`).

Just like the organization creation, the entire flow is slightly different - instead of creating a payment method separately, the payment method is added inline while doing the upgrade and then attached to the customer. If payment fails, the upgrade will not go through. If payment requires additional action, the user needs to confirm the payment before allowing the upgrade.

For testing the new flow locally, toggle the flag in `flags.ts` on the backend.

Changes include
- No longer rely on the `changeType` from the plans endpoint as this is regularly out-of-sync and displays wrong up/downgrade info due to race conditions
- `readOnly` mode for Stripe elements if anything is loading/submitting
- Reduced prop drilling for some components
- Hide payment method and address selection on downgrade
2025-06-18 15:11:33 +08:00
Kevin Grüneberg 2cd0f3c84d fix: possibly undefined breakdown in plan update modal (#36155) 2025-06-04 23:37:49 +08:00
Kevin Grüneberg e1bd23d66f fix: do not translate USD prices (#35466)
When translation tools go over prices, they wrongfully convert USD into other currencies without changing the price. $25 becomes Rp25 (Rupiah).

By using `translate='no'` we avoid the translation of pricing info. There are some tooltips left that are not covered yet, but this should be the majority already.

Kept the docs Pricing component as simple as possible, just wrapping in a span to avoid translation, not modifying any formatting.
2025-05-06 12:03:35 +08:00
Saxon Fletcher 3aadc009e6 feat: billing address, name and tax id for org creation/upgrade (#34922)
We currently get support requests about adding or amending invoices due to no billing address being set. Changes in this PR:
- Unify tax id and billing address into a single form
- Add ability to set billing name that diverges from org name
- Add ability to set billing address & tax id during org creation (only paid plans)
- Add ability to set billing address & tax id during plan upgrade
2025-05-02 10:10:41 +08:00
Kevin Grüneberg 5fa5118b35 chore: add warning if upgrade without projects (#34943) 2025-04-14 13:24:04 +08:00
Terry SuttonandJoshen Lim 9f6faa65bb Fix toggling of roles apply to all projects (#34871)
* Store initial state

* fixes

* Minor

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-04-11 10:41:07 +08:00
Pamela Chia 9793cf73ca chore: remove old plan dialog (#34291) 2025-03-19 21:21:39 +01:00
Saxon FletcherandKevin Grüneberg 7c04aadfa9 Feat/plan upgrade improvements (#33804)
* upgrade dialog changes

* plan upgrade modal

* update dialog improvements

* factor in customer balance

* copy

* add PH a/b test

* fix ts

* smol stuff

* fixes

* group compute fees

* smol edits

* Update SubscriptionPlanUpdateDialog.tsx

* Update SubscriptionPlanUpdateDialog.tsx

* partner billing

* downgrade

* margin

* show pricing info + filter out long tweets

* fix tooltip

---------

Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>
2025-02-27 13:31:27 +10:00