Repository navigation
[backport core/1.55] FE-3018 feat(billing-web): full-page checkout page state and pure transition - #19317
Conversation
…nsition (#19252) ## Why FE-3018 (Milestone 3 full-page checkout, flow and entry) needs one state model for the page before any view lands, per `docs/guidance/state-and-effects.md`. The Pay gate (DES-1014), the element-failure taxonomy and "Try again remounts in place" are all transitions. Putting them in one pure reducer keeps them out of scattered `v-if`s and makes them exhaustively testable. This PR is split out of FE-3018 PR 1 to keep that PR under the size budget; it holds only the data shape. ## Root cause n/a, feature. ## How - `apps/billing-web/src/checkout/checkoutPage.ts`: `CheckoutPage` is `resolving | refused | unavailable | capture`. `capture` carries a `PaymentRail`: `new_card` with the Stripe element `loading | ready | failed`, or `on_file` for a plan change the server charges to the method on file. - Named events: `refused`, `unavailable`, `quoted`, `elementReady`, `elementFailed`, `elementRetried`. `reduceCheckoutPage` is a pure switch; an event that means nothing in the current state returns the same object. - `railAcceptsPay` derives the rail half of the Pay gate. - Later PRs slot in as new kinds (`waiting`, `terminal`) and new rail methods (`saved`), without touching the existing branches. ## Tradeoffs - The quote itself stays in `usePreviewSubscribe`; the union records only that it arrived. Duplicating the preview into the state would be a second copy to keep in sync. - No Vue imports and no XState: a union plus reducer is the repo's stated default below parallel regions. ## Blast Radius None at runtime. Nothing imports the module until the stacked PR above. ## Verification - `pnpm --filter @comfyorg/billing-web test:unit`: 25 files, 258 tests pass (20 new, table-driven over event sequences plus every ignored state/event pair). - `pnpm --filter @comfyorg/billing-web typecheck`, `lint`: clean. `pnpm knip`: clean. ## AS IS / TO BE No visual change: nothing renders from this module until the PR stacked above, which carries the screenshots. ## Where this sits in the plan One linear stack on `main`: each PR is based on the one above it in the table. The former FE-3019/FE-3020 sibling stack now sits on top of FE-3022. | Step | PR | Scope | |---|---|---| | FE-3067 | #19248 (merged) | flag and variant switch | | **FE-3018 PR 0** | **this PR** | **page state union and pure transition** | | FE-3018 PR 1 | #19253 | shell, eyebrow, capture skeleton | | FE-3018 PR 2a | #19263 | saved-method tabs, rail failure taxonomy | | FE-3018 PR 2b | #19264 | inline Pay outcomes, backstop, reactivation | | FE-3018 PR 3a | #19268 | mount reconciliation, placeholders | | FE-3018 PR 3b | #19271 | bfcache and cross-tab re-reconciliation | | FE-3021 PR 1 | #19279 | success, already completed, in progress, received, unconfirmed | | FE-3021 PR 2 | #19280 | refusal, plan not available, couldn't load | | FE-3022 | #19285 | two-phase submit area, 3DS re-open, redirect methods, verification failed | | FE-3019 PR 1 | #19266 | summary ledger model and builder | | FE-3019 PR 2 | #19267 | left-column ledger rendering | | FE-3020 1/3 | #19276 | discount rows, fold rule, Subtotal | | FE-3020 2/3 | #19277 | promo entry state, Pay binding, URL promo | | FE-3020 3/3 | #19278 | promo entry UI, chips, expired card | ```mermaid graph LR M["main (19248 merged)"] --> N19252["19252 page state"] --> N19253["19253 shell"] --> N19263["19263 rails"] --> N19264["19264 outcomes"] --> N19268["19268 mount reconciliation"] --> N19271["19271 bfcache and cross-tab"] --> N19279["19279 money endings"] --> N19280["19280 refusal screens"] --> N19285["19285 payment authentication"] --> N19266["19266 ledger model"] --> N19267["19267 ledger UI"] --> N19276["19276 discount rows"] --> N19277["19277 promo entry state"] --> N19278["19278 promo entry UI"] style N19252 stroke-width:3px ```
🌾 Fallow: ✅ PassedFallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened. No new findings in the changed files. Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since b5f3d2e3dbcf672d12c49cc3483ddc2dfc571442
Full docs: ADR-DEVEX-LINT-0015 🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measureExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight This candidate changes nothing the matrix measures, so every expensive stage was skipped. Reproduce locally# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
npx vitest run --config vitest.matrix.config.mts
Full docs: scripts/registry-census/README.md 📦 Bundle Size
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## core/1.55 #19317 +/- ##
=============================================
+ Coverage 84.63% 84.65% +0.01%
=============================================
Files 2301 2336 +35
Lines 132229 132957 +728
Branches 35416 35602 +186
=============================================
+ Hits 111915 112555 +640
- Misses 19990 20033 +43
- Partials 324 369 +45
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 34 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Backport of #19252 to
core/1.55Automatically created by backport workflow.