Skip to content

Conversation

@a-lider
Copy link
Contributor

@a-lider a-lider commented Oct 7, 2025

Problem

Building on top of #39131.
Subscription updates involve non-trivial calculations, so it's important to add a confirmation flow with clear communication about how much will be charged and when.

Changes

2025-10-07 20 39 37

Confirmation Modals

  • Added Downgrade and Upgrade modals within the billing (not globally as they're not triggered elsewhere)
  • Implemented as separate modals rather than a single modal because they have different content, and this seems more readable.
  • Removed the existing unused ConfirmUpgradeModal to not confuse anyone.

Prorated Amount Refactor

  • Refactored prorated amount calculation, moved it to the billingProductLogic selector.
    • Previously used useMemo with getProration() utility function, which was verbose and difficult to reuse.
  • Created separate selectors for proratedAmount and unusedPlatformAddonAmount, so it's easier to show them in the modals.

How did you test this code?

Locally

  • Make sure switch-subscription-plan feature flag (release toggle) is enabled
  • Open the billing page and add any of the platform addons
  • Click Downgrade on the lower-tier addon or Upgrade on the higher-tier addon

@a-lider a-lider changed the title Reuse existing upgrade modal feat: upgrade and downgrade confirmation modals Oct 7, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2025

Size Change: -2.19 kB (-0.07%)

Total Size: 3.05 MB

Filename Size Change
frontend/dist/toolbar.js 3.05 MB -2.19 kB (-0.07%)

compressed-size-action

@a-lider a-lider requested a review from a team October 7, 2025 19:04
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

<CreateProjectModal isVisible={isCreateProjectModalShown} onClose={hideCreateProjectModal} />
<CreateEnvironmentModal isVisible={isCreateEnvironmentModalShown} onClose={hideCreateEnvironmentModal} />
<UpgradeModal />
<ConfirmUpgradeModal />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you can remove this because it may be used in onboarding so it needs to be mounted here. You should confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-checked, the global ConfirmUpgradeModal is not used anymore.
Upgrade flow in the onboarding goes like this:

  • OnboardingUpgradeStep renders PlanCards
  • "Unlock all features"click on PlanCards calls startPaymentEntryFlow (payment modal)

Base automatically changed from alex/feat/plan-switch/without-confirmation to master October 9, 2025 13:24
@a-lider a-lider force-pushed the alex/feat/plan-switch/confirm-modal branch 2 times, most recently from 09156b9 to 8a62a70 Compare October 9, 2025 15:32
@a-lider
Copy link
Contributor Author

a-lider commented Oct 9, 2025

  • Added a border around the active add-on card. The "Subscribed" label felt too subtle with multiple "Upgrade" buttons.
  • Also added pricing info below the "Upgrade" button.

Final version:
Screenshot 2025-10-09 at 21 26 05

@a-lider
Copy link
Contributor Author

a-lider commented Oct 9, 2025

And added events for downgrade/upgrade clicks to calculate the funnel

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

8 snapshot changes in total. 0 added, 8 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially changed the formatting of proratedAmount to make it more readable, but in this case, users are charged without confirmation, might be better to show the exact amount. I'll revert that.

@a-lider a-lider force-pushed the alex/feat/plan-switch/confirm-modal branch from 56b4054 to 7fa8880 Compare October 9, 2025 20:08
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

8 snapshot changes in total. 0 added, 8 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor Author

@a-lider a-lider Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, the border doesn't feel better when there's just one addon card. I'll revert and polish it later

@a-lider a-lider force-pushed the alex/feat/plan-switch/confirm-modal branch from 7ffa596 to 4ed22fa Compare October 9, 2025 20:43
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@a-lider a-lider merged commit 17c1fe2 into master Oct 9, 2025
125 of 126 checks passed
@a-lider a-lider deleted the alex/feat/plan-switch/confirm-modal branch October 9, 2025 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants