feat(web/billing): show all tiers + quotas from the sidecar catalog (SSOT)#340
Open
jiashuoz wants to merge 3 commits into
Open
feat(web/billing): show all tiers + quotas from the sidecar catalog (SSOT)#340jiashuoz wants to merge 3 commits into
jiashuoz wants to merge 3 commits into
Conversation
… (SSOT) The billing page hardcoded a 2-tier catalog (Pro + Scale only, Free omitted) that could drift from plans.go. Replace it with a per-tier quota comparison sourced from GET /api/billing/plan — the billing sidecar's single source of truth — so the dashboard can never lag the caps the webhook actually provisions. - Fetch the plan catalog (gated on NEXT_PUBLIC_BILLING_API; self-host with no sidecar skips it and shows usage only). - Render every tier (Free/Pro/Scale) with agents/domains/messages/ storage + price; highlight the current tier with a badge. - CTAs: free users upgrade via Checkout; active subscribers switch or downgrade via the Stripe Billing Portal. - Degrade gracefully when the catalog fetch fails (retry notice, usage still renders). - Drop the hardcoded PLAN_CATALOG and its drift-warning comment. Tests: new page.catalog.test.tsx covers catalog render, current-tier marking, upgrade→Checkout (with plan body), switch/downgrade→portal, and catalog-fetch degradation; existing page.test.tsx extended to assert the Plans section stays hidden on self-host. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
#339 deleted the duplicate plugins/e2a/.mcp.json (the e2a server is declared inline in .claude-plugin/plugin.json) but left the validator's section 5 reading the file unconditionally. readJSON() turns the ENOENT into a validation failure, so the "Plugin manifests" job has been red on main since that commit. Guard the read with existsSync so the standalone manifest is validated only when present. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Review follow-ups: - PlanCTA.onClick is now required (every non-null CTA always supplies one); drop the now-dead `|| !cta.onClick` button guard. - ctaFor: when the current plan can't be determined (both sidecar current.code and OSS plan_code empty), render no plan-change buttons rather than risk offering Checkout for a plan the user may hold. Adds a regression test for the fail-safe. - Document that max_storage_bytes is an int64 server-side but safe as a JS number (largest cap ~100 GiB << 2^53). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Reworks the in-app billing page (
web/src/app/(app)/billing/page.tsx) to show every plan tier and its quota clearly, sourced from the billing sidecar's single source of truth instead of a hardcoded list.Before
e2a-ops/billing/internal/plans/plans.go.After
GET /api/billing/plan(the sidecar SSOT) and renders all tiers (Free/Pro/Scale) with agents / domains / messages-per-month / storage + price.NEXT_PUBLIC_BILLING_API): plan comparison + upgrade affordances hidden; usage still renders.PLAN_CATALOGand its "keep both files in sync" drift hazard.Scope / non-goals
e2a-opsmigration + webhook field) is deferred to a follow-up.Tests
page.catalog.test.tsx: all-tier render + quota/price formatting, current-tier marking, upgrade→Checkout (asserts plan in POST body), switch/downgrade→portal routing, catalog-fetch-failure degradation.page.test.tsx: Plans section stays hidden on self-host.eslint+tsc --noEmitclean, productionnext buildprerenders/billing.🤖 Generated with Claude Code