Files
KomediruzeckiandGitHub 2befca7f53 feat(billing): tiers that differ, with the API and scheduled imports behind them (#546)
* feat(billing): tiers that differ, with the API and scheduled imports behind them

Basic, Advanced and Ultimate carried identical feature flags — only profiles,
receipts and reminders differed — so the pricing page asked for 3x the money
for more of the same and neither upgrade step had anything a person could want
by name.

PlanFeatures gains apiAccess, automatedImports and prioritySupport; PlanLimits
gains apiTokens and receiptMaxMb. Reminders drop from 2000/20000 to
500/2000/unlimited: a household on top of every bill sends about thirty a
month, so the old numbers advertised a cost we would have eaten if anyone had
believed them.

API access was ungated entirely. Minting a token now requires the feature and
counts live tokens against the plan's cap — live only, so revoking frees a slot
and rotating never needs an upgrade. The check also sits in verifyApiToken, on
a column joined into the query it already ran, so a downgrade closes the API
rather than leaving whatever was minted while paying working for ever.

Scheduled imports are Advanced, gated only when a write actually sets a
non-manual schedule. Receipt upload size is per plan, because size is bandwidth
and R2. Manual import stays free: it is the user's own file.

The cards are cumulative — addedRows diffs a tier against the one below and
renders only what changed, under "Everything in X, plus". Four generated
backgrounds sit behind them, scoped to the dark theme because the art measures
4-6% luminance where the text sits and would put dark text on a dark field in
the light one.

Worker fixtures for API tokens, MCP and import sources now seed a paid plan;
they were creating users with no plan, which defaults to Free, and the new
gates were right to refuse them.

* fix(billing): make the tier art actually render

It rendered as nothing. The card sets its background inline, and the
`background` shorthand resets background-image to none at a specificity no
stylesheet rule can reach — getComputedStyle reported 'none', and a screenshot
with the rule on and off differed by exactly zero pixels. The card now sets
background-color instead.

The sources were also landscape, with their light deliberately in the right
40%, while a plan card is a 200px column: `cover` would have cropped to a slice
of the empty left side. Each image is now cropped to the ring cluster and the
scrim is angled so the text keeps flat ground.

On/off difference is 7.2% RMSE now, and the text area moved 11.6% to 12.2%
luminance, so contrast is untouched.
2026-09-08 19:31:08 +02:00

6.8 KiB
560x831px