feat(webapp): hide self-serve billing UI for managed-billing orgs#3898
feat(webapp): hide self-serve billing UI for managed-billing orgs#3898kathiekiwi wants to merge 1 commit into
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (12)
WalkthroughThis PR implements self-serve billing UI gating for organizations that do not have self-serve subscriptions enabled. A new useShowSelfServe hook checks whether an organization's plan allows self-serve, defaulting to true. The hook is used across billing pages, settings navigation, project pages (alerts, limits, schedules), branches and team purchase flows, and modals to either show upgrade/pricing UI when allowed or replace those CTAs with Feedback/contact prompts when disabled. Routes and server actions block or redirect purchase/alerts access for managed-billing orgs. 🚥 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. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fa3c3e5 to
6abeffd
Compare
c9e3470 to
1d82c4b
Compare
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
175ca93 to
3162d60
Compare
Self-serve billing UI is now hidden for managed-billing organizations. Uses the new `showSelfServe` subscription flag, defaulting to `true` for existing self-serve organizations.
3162d60 to
aff5beb
Compare
There was a problem hiding this comment.
🔴 Schedules action missing server-side self-serve purchase guard
The branches action (routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route.tsx:161-174) and team action (routes/_app.orgs.$organizationSlug.settings.team/route.tsx:216-229) both added getSelfServePurchaseBlockReason checks to block managed-billing orgs from purchasing add-ons server-side. However, the schedules action at routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.schedules/route.tsx:144-187 does not have this guard. While the UI is hidden (the PurchaseSchedulesModal returns a Feedback component when !showSelfServe), a direct POST request to the schedules endpoint would bypass the UI and allow a managed-billing org to purchase extra schedules through the SetSchedulesAddOnService.
(Refers to lines 160-165)
Prompt for agents
The schedules action function (around line 144-187) is missing the server-side guard that was added to the branches action and team action. After finding the project and before parsing the PurchaseSchema submission, add a getCurrentPlan + getSelfServePurchaseBlockReason check, returning a 403 JSON response for managed_billing and a 503 for plan_unavailable. Import getCurrentPlan and getSelfServePurchaseBlockReason from ~/services/platform.v3.server. The pattern to follow is identical to what was done in the branches route action (lines 161-174 of that file).
Was this helpful? React with 👍 or 👎 to provide feedback.
| apply. The not-supported empty state below makes the | ||
| absence of role infrastructure clear instead. */} | ||
| {isUsingPlugin && !isEnterprise ? <CreateRoleUpsell /> : null} | ||
| {isUsingPlugin && showSelfServe ? <CreateRoleUpsell /> : null} |
There was a problem hiding this comment.
🟡 CreateRoleUpsell shown for self-serve Enterprise orgs due to changed condition semantics
The old condition was {isUsingPlugin && !isEnterprise ? <CreateRoleUpsell /> : null} — it hid the upsell for Enterprise-plan orgs since they already have access to custom roles. The new condition {isUsingPlugin && showSelfServe ? <CreateRoleUpsell /> : null} shows the upsell whenever showSelfServe is true, which includes self-serve Enterprise orgs. These orgs will now incorrectly see a "Create role" button that opens a dialog saying "Custom roles are an Enterprise feature" and prompts them to contact sales — even though they're already on Enterprise.
| {isUsingPlugin && showSelfServe ? <CreateRoleUpsell /> : null} | |
| {isUsingPlugin && showSelfServe && !assignableRoleIds.length ? <CreateRoleUpsell /> : null} | |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Self-serve billing UI is now hidden for managed-billing organizations.
Plan pickers, upgrade actions, billing alerts, and related upgrade prompts are replaced with a "Contact us" option where appropriate.
Uses the new showSelfServe subscription flag, defaulting to true for existing self-serve organizations.
Testing
Changelog
Hide self-serve billing flows for managed-billing organizations behind the new showSelfServe subscription flag.