Repository navigation
Read plan identity from billing and offer plan sizes in Research - #1564
Open
AnthonyRonning wants to merge 1 commit into
Open
AnthonyRonning wants to merge 1 commit into
AnthonyRonning wants to merge 1 commit into
Conversation
Billing can describe each plan with a key, a group (free, individual or team), a rank and a display name. Read those instead of parsing the plan name, and fall back to the name for an older billing server or a product it does not recognize. Paid gating, Team detection, the plan label and the Bitcoin upgrade button all go through one module, `billing/plan.ts`. On the pricing page, match each card to its product by key. When billing lists an individual plan that has no card of its own, the highest-ranked paid card below it offers it as a larger size, with a price switch in the card; the title, description, credits, price and button follow the size. The current plan is matched by product, so a subscriber on a larger size sees it selected. Nothing changes while billing lists the same plans. Bitcoin subscribers are offered an upgrade to any higher individual plan, not only from the first paid plan to the second. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Maple development preview: https://6eb49cad.maple-ca8.pages.dev Commit: Uses development API, billing, flags and PCR configuration. Cloudflare Access applies. |
This branch was successfully deployed
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.
Research decided what plan an account is on by parsing the plan's name in about twenty places, and the pricing page could only show the four plans it has hand-written cards for. This reads the plan from fields billing now sends, and lets the pricing page offer a plan it has no card for.
What changes
One place that knows what a plan is.
billing/plan.tsanswers whether a plan is free, an individual paid plan or a team, its rank, and the name to show. It reads billing'splan_group,plan_rankand display name when they are present and falls back to the name otherwise, exactly as before. That fallback covers an older billing server and a product billing does not recognize. Paid gating (hasApiAccess), Team detection, plan labels and the Bitcoin upgrade button all use it.Plan sizes on the pricing page. Each card is matched to its product by plan key (by name as before when there is no key). When billing lists an individual plan that has no card of its own, the highest-ranked paid card below it offers it as a larger size:
The page still has four cards and the same grid. With today's product list nothing renders differently.
Bitcoin upgrades. The upgrade button was offered only from the first paid plan to the second. It is now offered to any higher individual plan, and names the plan it upgrades to.
Not changed
Validation
bun run test(1,130 pass, 0 fail). New tests cover the plan helpers, card and size placement, and the upgrade targets.Not exercised: a signed-in subscriber on a larger size, checkout or the portal for it, a Bitcoin upgrade, and the Tauri desktop and mobile builds.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.