feat(ui): show management button for plans without base fee#8375
Conversation
🦋 Changeset detectedLatest commit: 81ea3f0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughA new utility, isManageableSubscriptionItem(subscriptionItem), is added and exported from packages/ui/src/utils/billingSubscription.ts; it defines manageability as !subscriptionItem.plan.isDefault. The SubscriptionDetails and SubscriptionsList components now use this helper to decide whether management actions (manage/switch/cancel/re-subscribe) and the manage-subscription button are shown, replacing prior local checks that relied on plan base-fee and free-plan heuristics. A changeset documenting the UI behavior update was added. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/ui/src/utils/billingSubscription.ts`:
- Around line 15-16: Add regression tests for the new predicate
isManageableSubscriptionItem(BillingSubscriptionItemResource) covering at least:
(1) a default-plan item where plan.isDefault === true and the predicate returns
false, and (2) paid seat-based and paid no-base-fee items where plan.isDefault
=== false and the predicate returns true. Also add integration-level assertions
that the UI paths which rely on this helper (the action visibility
logic/components that call isManageableSubscriptionItem) show or hide the
management actions appropriately. Ensure tests exercise the helper directly and
via the consuming UI visibility logic so future changes to
isManageableSubscriptionItem are caught.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 22136a0a-d6e8-4522-9cfc-d9ccf9a95a08
📒 Files selected for processing (4)
.changeset/billing-manage-subscription-seat-based.mdpackages/ui/src/components/SubscriptionDetails/index.tsxpackages/ui/src/components/Subscriptions/SubscriptionsList.tsxpackages/ui/src/utils/billingSubscription.ts
d6aff18 to
7654711
Compare
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
Today, the Manage Subscription button in <UserProfile /> / <OrganizationProfile />, and the Cancel / Re-subscribe actions inside <SubscriptionDetails />, are gated by !plan.hasBaseFee. That predicate was originally shorthand for "this is the free fallback plan, there's nothing the user can do with it". with seat-based billing, however, a plan can have no base fee and still be a real paid subscription (the cost comes entirely from the seat unit prices), so the UI was hiding actions users need
7654711 to
81ea3f0
Compare
Today, the Manage Subscription button in / , and the Cancel / Re-subscribe actions inside , are gated by !plan.hasBaseFee. That predicate was originally shorthand for "this is the free fallback plan, there's nothing the user can do with it". with seat-based billing, however, a plan can have no base fee and still be a real paid subscription (the cost comes entirely from the seat unit prices), so the UI was hiding actions users need
Description
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change