Repository navigation
FE-2331 / FE-2218 feat(billing-web): v1 entry routing, subscription and payment-method surfaces - #17809
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 2017 passed, 0 failed · 1 flaky📊 Browser Reports
🌐 Website E2ETip All tests passed.
📦 Bundle Size
⚡ Performance Report
Absolute values
Raw data{
"timestamp": "2026-09-16T04:54:38.075Z",
"gitSha": "b447cb6bb73436d60d6bf335bd38198b35ee3b7d",
"branch": "jaewon/fe-2331-billing-web-hosted-views",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 1999.9350000000504,
"styleRecalcs": 8,
"styleRecalcDurationMs": 6.957999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 441.651,
"heapDeltaBytes": 4601504,
"heapUsedBytes": 67075308,
"domNodes": -264,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 7.199000000000001,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 2017.7080000000274,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.388999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 441.60900000000004,
"heapDeltaBytes": -6388340,
"heapUsedBytes": 55958048,
"domNodes": -264,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 7.166000000000002,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1771.7719999999986,
"styleRecalcs": 74,
"styleRecalcDurationMs": 24.386,
"layouts": 14,
"layoutDurationMs": 3.6700000000000004,
"taskDurationMs": 799.581,
"heapDeltaBytes": -4622692,
"heapUsedBytes": 57898832,
"domNodes": -261,
"jsHeapTotalBytes": 6545408,
"scriptDurationMs": 153.35,
"eventListeners": -186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1812.6140000000532,
"styleRecalcs": 75,
"styleRecalcDurationMs": 25.740000000000002,
"layouts": 14,
"layoutDurationMs": 4,
"taskDurationMs": 833.675,
"heapDeltaBytes": 8659580,
"heapUsedBytes": 70714032,
"domNodes": -261,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 165.093,
"eventListeners": -156,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1724.2789999999673,
"styleRecalcs": 31,
"styleRecalcDurationMs": 17.922,
"layouts": 6,
"layoutDurationMs": 1.271,
"taskDurationMs": 358.159,
"heapDeltaBytes": 2076436,
"heapUsedBytes": 64692852,
"domNodes": 76,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 11.576000000000002,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1736.786000000052,
"styleRecalcs": 32,
"styleRecalcDurationMs": 14.732999999999999,
"layouts": 6,
"layoutDurationMs": 1.1089999999999998,
"taskDurationMs": 320.859,
"heapDeltaBytes": 2174108,
"heapUsedBytes": 64716276,
"domNodes": 77,
"jsHeapTotalBytes": 4456448,
"scriptDurationMs": 9.332999999999998,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "dom-widget-clipping",
"durationMs": 737.5349999999798,
"styleRecalcs": 9,
"styleRecalcDurationMs": 6.204999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 469.408,
"heapDeltaBytes": 17626520,
"heapUsedBytes": 79970252,
"domNodes": 14,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 175.326,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "dom-widget-clipping",
"durationMs": 628.5110000000032,
"styleRecalcs": 11,
"styleRecalcDurationMs": 7.488999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 441.06500000000005,
"heapDeltaBytes": 17911504,
"heapUsedBytes": 80352164,
"domNodes": 18,
"jsHeapTotalBytes": 6029312,
"scriptDurationMs": 166.865,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2025.5460000000198,
"styleRecalcs": 6,
"styleRecalcDurationMs": 5.389000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 585.5319999999999,
"heapDeltaBytes": 2568452,
"heapUsedBytes": 82762240,
"domNodes": -245,
"jsHeapTotalBytes": -794624,
"scriptDurationMs": 33.025,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2035.1030000000492,
"styleRecalcs": 5,
"styleRecalcDurationMs": 4.245000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 556.149,
"heapDeltaBytes": 4203780,
"heapUsedBytes": 83597540,
"domNodes": -249,
"jsHeapTotalBytes": -1056768,
"scriptDurationMs": 32.35700000000001,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2360.892999999976,
"styleRecalcs": 66,
"styleRecalcDurationMs": 11.200000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1700.587,
"heapDeltaBytes": -1314288,
"heapUsedBytes": 79681272,
"domNodes": -252,
"jsHeapTotalBytes": 1003520,
"scriptDurationMs": 869.106,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2244.521999999961,
"styleRecalcs": 67,
"styleRecalcDurationMs": 11.732,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1515.4279999999999,
"heapDeltaBytes": 16553436,
"heapUsedBytes": 97113628,
"domNodes": -225,
"jsHeapTotalBytes": 1265664,
"scriptDurationMs": 881.1289999999999,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3586.856999999952,
"styleRecalcs": 63,
"styleRecalcDurationMs": 13.416,
"layouts": 60,
"layoutDurationMs": 13.315,
"taskDurationMs": 1769.9180000000001,
"heapDeltaBytes": -13997600,
"heapUsedBytes": 68298864,
"domNodes": -268,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 805.785,
"eventListeners": -186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 3533.3140000000185,
"styleRecalcs": 62,
"styleRecalcDurationMs": 10.287999999999998,
"layouts": 60,
"layoutDurationMs": 12.355,
"taskDurationMs": 1706.515,
"heapDeltaBytes": 9424660,
"heapUsedBytes": 75857420,
"domNodes": 4,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 834.802,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "legacy-node-drag",
"durationMs": 3131.473000000028,
"styleRecalcs": 40,
"styleRecalcDurationMs": 4.926,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1944.1680000000001,
"heapDeltaBytes": 22738392,
"heapUsedBytes": 89010424,
"domNodes": 0,
"jsHeapTotalBytes": 417792,
"scriptDurationMs": 987.667,
"eventListeners": 188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "legacy-node-drag",
"durationMs": 3153.628000000026,
"styleRecalcs": 43,
"styleRecalcDurationMs": 8.048,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1994.5089999999998,
"heapDeltaBytes": -1260644,
"heapUsedBytes": 82357604,
"domNodes": -266,
"jsHeapTotalBytes": 1458176,
"scriptDurationMs": 1026.346,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2024.9310000000378,
"styleRecalcs": 4,
"styleRecalcDurationMs": 3.4870000000000005,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 555.006,
"heapDeltaBytes": -3671072,
"heapUsedBytes": 83877676,
"domNodes": -254,
"jsHeapTotalBytes": -1019904,
"scriptDurationMs": 34.452,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "minimap-idle",
"durationMs": 2010.2749999999787,
"styleRecalcs": 5,
"styleRecalcDurationMs": 4.036999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 523.377,
"heapDeltaBytes": 20099296,
"heapUsedBytes": 84677480,
"domNodes": -249,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 33.10399999999999,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 607.2769999999537,
"styleRecalcs": 46,
"styleRecalcDurationMs": 9.569999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 408.526,
"heapDeltaBytes": 13357396,
"heapUsedBytes": 76865444,
"domNodes": 18,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 143.262,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 597.6930000000493,
"styleRecalcs": 47,
"styleRecalcDurationMs": 11.075999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 397.56600000000003,
"heapDeltaBytes": 13473332,
"heapUsedBytes": 76917812,
"domNodes": 20,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 143.43,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-idle",
"durationMs": 1996.5380000000437,
"styleRecalcs": 8,
"styleRecalcDurationMs": 5.9559999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 399.92900000000003,
"heapDeltaBytes": -1812192,
"heapUsedBytes": 61307004,
"domNodes": 16,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 6.700000000000001,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2004.6939999999722,
"styleRecalcs": 10,
"styleRecalcDurationMs": 7.993000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 457.03499999999997,
"heapDeltaBytes": 5497860,
"heapUsedBytes": 69249968,
"domNodes": -274,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 6.6480000000000015,
"eventListeners": -200,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1688.5879999999815,
"styleRecalcs": 77,
"styleRecalcDurationMs": 28.223,
"layouts": 18,
"layoutDurationMs": 5.558000000000001,
"taskDurationMs": 804.2320000000001,
"heapDeltaBytes": 4662356,
"heapUsedBytes": 68392328,
"domNodes": -274,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 117.19900000000001,
"eventListeners": -202,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1708.9000000000851,
"styleRecalcs": 77,
"styleRecalcDurationMs": 25.245,
"layouts": 18,
"layoutDurationMs": 5.286,
"taskDurationMs": 750.418,
"heapDeltaBytes": 5188900,
"heapUsedBytes": 68782136,
"domNodes": -277,
"jsHeapTotalBytes": 6283264,
"scriptDurationMs": 107.49000000000001,
"eventListeners": -202,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 1401.2749999999983,
"styleRecalcs": 16,
"styleRecalcDurationMs": 29.358999999999995,
"layouts": 5,
"layoutDurationMs": 13.139000000000001,
"taskDurationMs": 885.3269999999998,
"heapDeltaBytes": -6399304,
"heapUsedBytes": 80710948,
"domNodes": 13587,
"jsHeapTotalBytes": 10747904,
"scriptDurationMs": 30.275000000000002,
"eventListeners": 2385,
"totalBlockingTimeMs": 142,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8473.144999999988,
"styleRecalcs": 248,
"styleRecalcDurationMs": 36.687,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6001.929999999999,
"heapDeltaBytes": 13565336,
"heapUsedBytes": 92421272,
"domNodes": -224,
"jsHeapTotalBytes": 1265664,
"scriptDurationMs": 2860.073,
"eventListeners": -168,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333338,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "viewport-pan-sweep",
"durationMs": 8285.582999999973,
"styleRecalcs": 247,
"styleRecalcDurationMs": 32.580999999999996,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5621.891,
"heapDeltaBytes": 384640,
"heapUsedBytes": 79702272,
"domNodes": -247,
"jsHeapTotalBytes": -45056,
"scriptDurationMs": 2744.4729999999995,
"eventListeners": -138,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 17422.61100000002,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16880.486,
"heapDeltaBytes": -13677408,
"heapUsedBytes": 180188520,
"domNodes": -6542,
"jsHeapTotalBytes": 3350528,
"scriptDurationMs": 276.822,
"eventListeners": -7478,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.77333333333336,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 16245.719000000008,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15307.365000000002,
"heapDeltaBytes": -52424672,
"heapUsedBytes": 161134900,
"domNodes": -6542,
"jsHeapTotalBytes": 2056192,
"scriptDurationMs": 264.30800000000005,
"eventListeners": -7478,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.780000000000047,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 20499.603999999978,
"styleRecalcs": 170,
"styleRecalcDurationMs": 17.455000000000027,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 20118.628,
"heapDeltaBytes": -27716172,
"heapUsedBytes": 167320180,
"domNodes": -6542,
"jsHeapTotalBytes": 3350528,
"scriptDurationMs": 874.121,
"eventListeners": -7474,
"totalBlockingTimeMs": 155,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 20332.764999999996,
"styleRecalcs": 173,
"styleRecalcDurationMs": 17.181,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 19945.883,
"heapDeltaBytes": -18085784,
"heapUsedBytes": 176802240,
"domNodes": -6542,
"jsHeapTotalBytes": -319488,
"scriptDurationMs": 879.592,
"eventListeners": -7474,
"totalBlockingTimeMs": 51,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-node-resize-workload",
"durationMs": 6066.849999999988,
"styleRecalcs": 20,
"styleRecalcDurationMs": 81.68099999999997,
"layouts": 20,
"layoutDurationMs": 23.817000000000004,
"taskDurationMs": 5946.905999999999,
"heapDeltaBytes": -30203384,
"heapUsedBytes": 172730588,
"domNodes": -6542,
"jsHeapTotalBytes": 9850880,
"scriptDurationMs": 117.174,
"eventListeners": -7474,
"totalBlockingTimeMs": 380,
"frameDurationMs": 17.776666666666703,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-node-resize-workload",
"durationMs": 5755.935000000022,
"styleRecalcs": 20,
"styleRecalcDurationMs": 76.55999999999999,
"layouts": 20,
"layoutDurationMs": 21.15600000000001,
"taskDurationMs": 5643.695999999999,
"heapDeltaBytes": -15783472,
"heapUsedBytes": 178649644,
"domNodes": -6542,
"jsHeapTotalBytes": 16982016,
"scriptDurationMs": 99.66699999999999,
"eventListeners": -7476,
"totalBlockingTimeMs": 327,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "vue-zoom-out-idle",
"durationMs": 8277.606999999989,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 7832.934,
"heapDeltaBytes": -7719972,
"heapUsedBytes": 167229076,
"domNodes": -1,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 114.59900000000006,
"eventListeners": -12,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.773333333333238,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-zoom-out-idle",
"durationMs": 8386.955000000056,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 8156.373000000002,
"heapDeltaBytes": -18258612,
"heapUsedBytes": 179431096,
"domNodes": 0,
"jsHeapTotalBytes": -7864320,
"scriptDurationMs": 130.616,
"eventListeners": -12,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 121.98899999998503,
"styleRecalcs": 9,
"styleRecalcDurationMs": 20.378,
"layouts": 4,
"layoutDurationMs": 1.8190000000000002,
"taskDurationMs": 95.607,
"heapDeltaBytes": 3260780,
"heapUsedBytes": 65155000,
"domNodes": 137,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 8.281,
"eventListeners": 35,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "workflow-execution",
"durationMs": 458.77199999995355,
"styleRecalcs": 20,
"styleRecalcDurationMs": 21.911000000000005,
"layouts": 4,
"layoutDurationMs": 1.6460000000000001,
"taskDurationMs": 115.30699999999999,
"heapDeltaBytes": 4998332,
"heapUsedBytes": 67071372,
"domNodes": 146,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 9.013,
"eventListeners": 83,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
}
]
}🔬 E2E Coverage
Top 10 files by uncovered lines
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## jaewon/fe-2218-billing-web-session #17809 +/- ##
===================================================================
Coverage 82.51% 82.52%
===================================================================
Files 2828 2836 +8
Lines 141647 141737 +90
Branches 38282 38308 +26
===================================================================
+ Hits 116885 116967 +82
- Misses 23554 23562 +8
Partials 1208 1208
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 13 files with indirect coverage changes 🚀 New features to boost your workflow:
|
CodeJuggernaut
left a comment
There was a problem hiding this comment.
Contract, routing and both surfaces hold under the probes; one Minor inline: a saved method without brand and last4 renders its raw server type, which the body says never happens.
|
|
||
| function describe(method: SavedPaymentMethod): string { | ||
| if (method.brand === undefined || method.last4 === undefined) | ||
| return method.type |
There was a problem hiding this comment.
Severity: Minor
What: describe() returns method.type raw whenever brand or last4 is absent, and type is an open z.string() in the generated contract (packages/ingest-types/src/zod.gen.ts:706).
Why this is an issue: a non-card method shows whatever string the server sent, contradicting the body's rule that no server text is rendered, which every other server value in this diff follows through coded(); no test pins the fallback since every fixture row carries brand and last4.
Proposed Fix: coded('paymentMethodType', method.type) with an unknown line, a fixture row without brand and last4, and the body naming brand and last4 as the one interpolated pair.
There was a problem hiding this comment.
Fixed in 51760e2. describe() now falls back to coded('paymentMethodType', method.type), with hosted.paymentMethodType.unknown ("Saved payment method") and a card line, so an open type names our copy instead of reaching the screen.
Fixture: PaymentMethodsView.test.ts gains { id: 'pm_3', is_default: false, type: 'us_bank_account' }, and names a method with no brand or last four in our own copy asserts the coded line renders and us_bank_account does not. Verified red against the old return method.type.
PR body updated: the bullet now names the card brand and last four as the one server-supplied pair the UI interpolates, rather than claiming no server text at all.
…2331) describe() returned method.type raw whenever brand or last4 was absent, and type is an open z.string() in the generated contract, so a non-card method put server-chosen text on screen. Every other server value in this surface goes through coded(); this one now does too, with brand and last4 left as the one pair the panel interpolates.
cce907e
into
jaewon/fe-2218-billing-web-session
…nd payment-method surfaces (#17809) Linear FE-2331 / FE-2218. Stacked on #17807 (session); carries a cherry-pick of #17795 (billing-contract). ## Why `billing.comfy.org` currently serves one static page: a hard-coded checkout mockup at `/`. Nothing reads the entry URL a product hands it, and nothing renders over the billing SDK. This PR gives the hosted app its `/v1` entry routing plus the first two surfaces that project real SDK state — the subscription catalog with a plan-change quote, and saved payment methods with the provider portal round trip. The entry URL is untrusted routing input. `parseBillingEntry` decides whether it describes a request the contract knows, and a failed parse renders a coded explanation rather than a redirect, so a misdirected link stays visible instead of silently landing the customer somewhere else. ## How - `router.ts` generates a route per `BILLING_INTENTS` entry — `subscription` and `pricing` to `SubscriptionView`, `payment-methods` to `PaymentMethodsView`, `checkout` to the existing `BillingHomeView` (unchanged), `invoices` and `result` to `ComingSoonView`. `/` keeps the scaffold checkout page and stays outside the contract. - A `beforeEach` parses `to.fullPath` and publishes the result into a tab-local module ref (`useBillingEntry`); `App.vue` renders the entry-error surface whenever that parse failed, whatever route matched. No navigation happens on an error. - The entry is read before the session guard from #17807 runs, so a link we cannot read explains itself even to a visitor the guard sends to `/sign-in`: signing in would not repair it. `/` and `/sign-in` carry no product request and leave the entry alone. - `HostedSurface.vue` is the shared shell: the dark full-screen layout, the surface title, the `Return to <product>` link built with `buildReturnUrl` against the resolved `BILLING_WEB_ENV` (default and fail-closed value `test`), and the choice between the entry-error section and the surface itself. Views stay pure projections of composable state, and a surface only ever renders behind the guard and the shell, which always provide a client. - `SubscriptionPanel` reads `usePlans()`, renders each plan as a card (tier + duration, price, monthly credits, seats), disables an unavailable plan with its availability reason as our own copy, and on selection calls `usePreviewSubscribe().quote({ planSlug })` and renders the quote. Confirm is present and disabled behind the scaffold's existing `checkout.sdkPending` line. - `PaymentMethodsPanel` reads `usePaymentMethods()`, marks the default card, and opens the provider portal through `commands.openPaymentPortal` with this page's own href plus a `portal=return` marker. On the way back it invalidates and re-reads once, then strips the marker with `router.replace`. - Every server-chosen value reaches the screen as a coded lookup with a generic fallback: availability reasons, transition types, billing failure codes, entry error codes, saved payment method types. The card brand and its last four digits are the one server-supplied pair the UI interpolates; no other server text is rendered. - `bigint` money fields convert with `Number()` only at the `n()`/`d()` formatting boundary. ## AS-IS / TO-BE AS-IS: a `/v1/subscription` link has no surface of its own — the catch-all redirects it to `/`, the scaffold's static checkout mockup, and the product's entry parameters are dropped on the way. TO-BE: `/v1/subscription` renders the catalog with the current plan marked and an unavailable plan explained, selecting a plan adds the server's plan-change quote with an inert confirm, `/v1/payment-methods` lists saved cards with the default marked beside the provider-portal button, and a link the contract cannot read gets a coded explanation instead of a redirect. | AS-IS | TO-BE | | --- | --- | | `/v1/subscription?product=comfyui&return_to=comfyui_workspace` redirects to the static checkout page<br><img width="420" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17809-screenshots/asis-v1-subscription.png"> | The same link renders the subscription surface<br><img width="420" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17809-screenshots/tobe-subscription.png"> | | TO-BE — plan-change quote after selecting Pro · Monthly<br><img width="420" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17809-screenshots/tobe-subscription-quote.png"> | TO-BE — `/v1/payment-methods` with the default card marked<br><img width="420" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17809-screenshots/tobe-payment-methods.png"> | | — | TO-BE — a link the contract cannot read (`/v1/subscription?product=nope`)<br><img width="420" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17809-screenshots/tobe-entry-error.png"> | ## Testing `apps/billing-web` unit tests (`@testing-library/vue`, happy-dom): the app suite is 85 passing, 44 of them in the four files this PR touches: - `router.test.ts` — each intent opens its surface, the parsed entry is published, every entry-error code renders its own copy (including on the checkout route, proving the error surface wins over the matched route), an unrecognised path stays where it is, and `/` remains outside the contract. The guard rows from #17807 join the same file: a signed-out visitor is sent to `/sign-in` with the surface to come back to, and an unreadable link keeps its error through that redirect. - `SubscriptionView.test.ts` — current plan named, catalog priced, an unavailable plan disabled with its reason, selecting a plan calls `previewSubscribe` with `{ planSlug }` and renders the formatted quote with confirm disabled, a refused quote and a failed catalog read both render coded copy. - `PaymentMethodsView.test.ts` — cards listed with the default marked, the portal button navigates to the returned URL, and `portal=return` triggers exactly one invalidate plus one read before the marker is stripped. - `HostedSurface.test.ts` — the arriving intent's content renders, return link href from `buildReturnUrl`, no link when the entry named no destination. Gates: `pnpm typecheck`, `pnpm lint`, `pnpm format`, `pnpm knip`, `pnpm --filter @comfyorg/billing-web build`, `fallow audit` all pass. ## Not in this PR - Subscribing through the SDK — the confirm button is deliberately inert. - Invoices, which wait on the backend. - Putting `apps/billing-web` unit tests in the CI loop: `ci-tests-unit.yaml` runs `packages/*` only, so this suite runs locally but not on a PR. Follow-up. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (#17662, #17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | open (#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after #17782 and #17783 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | open (#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | open (#17793) | | 8 core | `previewSubscribe` command | FE-2331 | open (#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | open (#17799) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | open (#17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | **this PR** | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the #17665 review) | FE-2216 | open (#17792) | | follow-up | Opaque `BillingServerCode` (from the #17656 review) | FE-2227 | open (#17794) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style BWV stroke:#0366d6,stroke-width:4px ```
…own-origin session and v1 surfaces (#17799) Linear FE-2331. Stacked on #17798 (readers); carries #17797 (previewSubscribe, now on main) until #17798 lands. #17807 (billing-web own-origin session + sign-in) and #17809 (billing-web /v1 surfaces) were squash-merged into this branch, so this PR is the whole Phase 8 view layer: account-ui composables, the billing-web session/sign-in, and the subscription / payment-method surfaces. ## Why The plans catalog, the saved cards and the subscription quote are the three reads the hosted billing surfaces are built on, and the core now exposes all three. Nothing in the view layer could reach them: `BillingClient` carried only the balance, capability and status readers, so a host wanting a price had to call the core directly and invent its own loading, failure and cancellation handling per screen. ## How - `BillingClient` gains `plans` and `paymentMethods`; `disposeBillingClient` disposes both, so a sign-out or workspace switch cannot leave a catalog or a card list serving the previous scope. - `usePlans` and `usePaymentMethods` follow `useCredits`: seeded from the reader's snapshot, `immediate` by default, and a failed refresh keeps the last good value beside the failure rather than blanking the screen. `usePaymentMethods` also exposes `defaultMethod` and `invalidateAndRefresh`, for a host coming back from the payment portal where a card was added or removed. - `usePreviewSubscribe` is on-demand and single-flight: each `quote` aborts the one before it through an `AbortController`, and only the latest settles into `preview`/`failure`, so a slow price for a plan the user has moved off never lands on screen. - The app composition root builds both readers and adds them to `dispose()`, keeping the two scope-holder lists in step. Commands stay unwired here. ## AS-IS / TO-BE No UI change. These are headless composables; nothing renders them yet. ## Testing `usePlans`, `usePaymentMethods` and `usePreviewSubscribe` tests run against the real core over the shared billing harness. Both the abort guard and the payment-methods invalidation were verified to fail when removed. A table in `createBillingSdk.test.ts` asserts every reader stops serving the disposed scope. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (#17662, #17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after #17783 and #17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | **this PR** | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | **this PR** (was #17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | **this PR** (was #17809) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the #17665 review) | FE-2216 | merged (#17792) | | follow-up | Opaque `BillingServerCode` (from the #17656 review) | FE-2227 | open (#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the #17799 review) | FE-2215 | open (#17824) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style P8 stroke:#0366d6,stroke-width:4px style BWS stroke:#0366d6,stroke-width:4px style BWV stroke:#0366d6,stroke-width:4px ```
…own-origin session and v1 surfaces (#17799) Linear FE-2331. Stacked on #17798 (readers); carries #17797 (previewSubscribe, now on main) until #17798 lands. #17807 (billing-web own-origin session + sign-in) and #17809 (billing-web /v1 surfaces) were squash-merged into this branch, so this PR is the whole Phase 8 view layer: account-ui composables, the billing-web session/sign-in, and the subscription / payment-method surfaces. The plans catalog, the saved cards and the subscription quote are the three reads the hosted billing surfaces are built on, and the core now exposes all three. Nothing in the view layer could reach them: `BillingClient` carried only the balance, capability and status readers, so a host wanting a price had to call the core directly and invent its own loading, failure and cancellation handling per screen. - `BillingClient` gains `plans` and `paymentMethods`; `disposeBillingClient` disposes both, so a sign-out or workspace switch cannot leave a catalog or a card list serving the previous scope. - `usePlans` and `usePaymentMethods` follow `useCredits`: seeded from the reader's snapshot, `immediate` by default, and a failed refresh keeps the last good value beside the failure rather than blanking the screen. `usePaymentMethods` also exposes `defaultMethod` and `invalidateAndRefresh`, for a host coming back from the payment portal where a card was added or removed. - `usePreviewSubscribe` is on-demand and single-flight: each `quote` aborts the one before it through an `AbortController`, and only the latest settles into `preview`/`failure`, so a slow price for a plan the user has moved off never lands on screen. - The app composition root builds both readers and adds them to `dispose()`, keeping the two scope-holder lists in step. Commands stay unwired here. No UI change. These are headless composables; nothing renders them yet. `usePlans`, `usePaymentMethods` and `usePreviewSubscribe` tests run against the real core over the shared billing harness. Both the abort guard and the payment-methods invalidation were verified to fail when removed. A table in `createBillingSdk.test.ts` asserts every reader stops serving the disposed scope. Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (#17662, #17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after #17783 and #17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | **this PR** | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | **this PR** (was #17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | **this PR** (was #17809) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the #17665 review) | FE-2216 | merged (#17792) | | follow-up | Opaque `BillingServerCode` (from the #17656 review) | FE-2227 | open (#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the #17799 review) | FE-2215 | open (#17824) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style P8 stroke:#0366d6,stroke-width:4px style BWS stroke:#0366d6,stroke-width:4px style BWV stroke:#0366d6,stroke-width:4px ```
…g the previous scope's (Comfy-Org#17824) Linear FE-2215. Follow-up from the Comfy-Org#17799 review. ## Why The exposure this SDK track started from was a reader serving the previous account's balance. The core closed it: a read that settles after the host moved to another workspace is refused with `SUPERSEDED` rather than published. `useCredits` then reopened it in the view layer — it treated that refusal as an ordinary failure, kept `balance` untouched, and went on rendering the credits of the workspace the user had just left. ## Root cause `useCredits.refresh` had two branches: publish on `ok`, keep the previous balance and surface the failure on anything else. A scope change is neither. It is not something the user did, there is nothing to retry, and the value being kept belongs to an account that is no longer on screen. The three composables added in Comfy-Org#17799 already split that branch out; the five older ones never mentioned `SUPERSEDED`. ## How `useCredits` clears both `balance` and `failure` on a `SUPERSEDED` read, the same three lines as `usePaymentMethods`, and its docstring keeps the "a failed refresh keeps the previous balance" promise only for ordinary failures. The other four pre-existing composables are unchanged: - `useBillingOperation` — the lifecycle dispatches `superseded` to every operation on a scope change and republishes it, so the state this composable holds is already the truthful new one rather than a stale one. - `usePaymentAttempt` — its visible surface is `projection`, and `projectPaymentStep` maps a superseded operation back to `select`. - `useCheckout` / `useTopUp` — `result` is the outcome handed back to the caller of a command, carries no scope-bound data, and the step the shipped `CheckoutSteps` renders comes from the projection above. The test fixture's fake session can now move to another workspace, so the real credits reader produces `SUPERSEDED` the way the workspace switcher does. ## AS-IS / TO-BE No UI change. AS-IS: after a workspace switch, a host bound to `useCredits` keeps showing the previous workspace's balance until something else clears it. TO-BE: the balance goes undefined and the host renders its empty state until the read for the new workspace settles, with no error shown for a switch the user did not make. ## Testing `useCredits.test.ts` gains a row that moves the harness to another workspace mid-refresh and asserts the balance is dropped with no failure reported; it fails on pre-fix code. The existing row proving that an ordinary failed refresh keeps the previous balance stays. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (Comfy-Org#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after Comfy-Org#17783 and Comfy-Org#17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (Comfy-Org#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (Comfy-Org#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (Comfy-Org#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (Comfy-Org#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | open (Comfy-Org#17799) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | open (Comfy-Org#17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | open (Comfy-Org#17809) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | merged (Comfy-Org#17792) | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | open (Comfy-Org#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the Comfy-Org#17799 review) | FE-2215 | **this PR** | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style FU12 stroke:#0366d6,stroke-width:4px ```
…own-origin session and v1 surfaces (#17799) Linear FE-2331. Stacked on #17798 (readers); carries #17797 (previewSubscribe, now on main) until #17798 lands. #17807 (billing-web own-origin session + sign-in) and #17809 (billing-web /v1 surfaces) were squash-merged into this branch, so this PR is the whole Phase 8 view layer: account-ui composables, the billing-web session/sign-in, and the subscription / payment-method surfaces. The plans catalog, the saved cards and the subscription quote are the three reads the hosted billing surfaces are built on, and the core now exposes all three. Nothing in the view layer could reach them: `BillingClient` carried only the balance, capability and status readers, so a host wanting a price had to call the core directly and invent its own loading, failure and cancellation handling per screen. - `BillingClient` gains `plans` and `paymentMethods`; `disposeBillingClient` disposes both, so a sign-out or workspace switch cannot leave a catalog or a card list serving the previous scope. - `usePlans` and `usePaymentMethods` follow `useCredits`: seeded from the reader's snapshot, `immediate` by default, and a failed refresh keeps the last good value beside the failure rather than blanking the screen. `usePaymentMethods` also exposes `defaultMethod` and `invalidateAndRefresh`, for a host coming back from the payment portal where a card was added or removed. - `usePreviewSubscribe` is on-demand and single-flight: each `quote` aborts the one before it through an `AbortController`, and only the latest settles into `preview`/`failure`, so a slow price for a plan the user has moved off never lands on screen. - The app composition root builds both readers and adds them to `dispose()`, keeping the two scope-holder lists in step. Commands stay unwired here. No UI change. These are headless composables; nothing renders them yet. `usePlans`, `usePaymentMethods` and `usePreviewSubscribe` tests run against the real core over the shared billing harness. Both the abort guard and the payment-methods invalidation were verified to fail when removed. A table in `createBillingSdk.test.ts` asserts every reader stops serving the disposed scope. Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (#17662, #17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after #17783 and #17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | **this PR** | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | **this PR** (was #17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | **this PR** (was #17809) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the #17665 review) | FE-2216 | merged (#17792) | | follow-up | Opaque `BillingServerCode` (from the #17656 review) | FE-2227 | open (#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the #17799 review) | FE-2215 | open (#17824) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style P8 stroke:#0366d6,stroke-width:4px style BWS stroke:#0366d6,stroke-width:4px style BWV stroke:#0366d6,stroke-width:4px ```
…ders, hosted composables, own-origin session and v1 surfaces (Comfy-Org#17798) Linear FE-2331 / FE-2218. This PR is the whole Phase 8 view layer after the stack was consolidated: Comfy-Org#17799 (account-ui `usePlans` / `usePaymentMethods` / `usePreviewSubscribe` + app-root readers), Comfy-Org#17807 (billing-web own-origin session, sign-in, SDK composition) and Comfy-Org#17809 (billing-web `/v1` entry routing, subscription and payment-method surfaces) were squash-merged into this branch; their bodies, decisions and screenshots remain on those PRs. Rebased onto main after Comfy-Org#17782 (scopeSource), Comfy-Org#17795 (billing-contract) and Comfy-Org#17797 (previewSubscribe) landed, so none of that content is in this diff. ## Why Phase 8's hosted billing surfaces render plan management and saved payment methods, and both reads have to go through the billing SDK so they inherit the scope tracking, deduplication, and coded failures the other readers already have. The generated schemas for both routes exist, so nothing has to be hand-declared. ## How - `plans.ts`: `createPlansReader` over `GET /billing/plans`, decoded with `zGetBillingPlansResponse`. No freshness window — the catalog carries no declared lifetime, so the host decides when to re-read. - `paymentMethods.ts`: `createPaymentMethodsReader` over `GET /billing/payment-methods`, decoded with `zListSavedPaymentMethodsResponse`, plus `invalidate()` so a host returning from the payment portal can drop the list it holds without a scope change. - Both follow the existing reader shape exactly: `createBillingScopeTracker` drops the snapshot and any in-flight read on a scope change, concurrent reads for one scope share a single request, a 2xx that fails the schema is `MALFORMED_RESPONSE`, and HTTP failures map through `codeForHttpStatus`. - Exported from `@comfyorg/account/billing` alongside the credits, status, and capabilities readers. The four readers now share the same request/publish body, which `fallow audit` reports as a duplication warning. Factoring it out would touch `credits.ts` and `status.ts`, which two open PRs already modify, so it is left for a follow-up. ## AS-IS / TO-BE No UI change. The cloud app still calls `workspaceApi.getBillingPlans` and `workspaceApi.listSavedPaymentMethods`; the composables and host wiring that move it onto these readers land in separate PRs. ## Testing `plans.test.ts` and `paymentMethods.test.ts` cover the decode and scope of a successful read, the caller timeout reaching the request, deduplication of concurrent reads, a scope change in flight reporting `SUPERSEDED` with nothing cached, a signed-out reader reporting `NOT_AUTHENTICATED` without a request, the HTTP status table (401 replayed and unreplayed, 403, 404, 500), a malformed 2xx, and `dispose`. Payment methods additionally cover the empty list and `invalidate` dropping the snapshot so the next read refetches. `pnpm typecheck`, `pnpm lint`, `pnpm format`, `pnpm knip`, and `fallow audit --changed-since origin/main` pass. Follow-up, not in this PR: the four readers now share a 32-line scope/in-flight skeleton (`credits.ts`, `status.ts`, `plans.ts`, `paymentMethods.ts`; fallow reports it as one clone family). Comfy-Org#17782 has landed, but extracting it still touches files Comfy-Org#17794 is changing, so it waits for that to land. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (Comfy-Org#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after Comfy-Org#17783 and Comfy-Org#17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (Comfy-Org#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (Comfy-Org#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (Comfy-Org#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | **this PR** | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | **this PR** (was Comfy-Org#17799) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | **this PR** (was Comfy-Org#17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | **this PR** (was Comfy-Org#17809) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | merged (Comfy-Org#17792) | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | open (Comfy-Org#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the Comfy-Org#17799 review) | FE-2215 | open (Comfy-Org#17824) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style P8RD stroke:#0366d6,stroke-width:4px style P8 stroke:#0366d6,stroke-width:4px style BWS stroke:#0366d6,stroke-width:4px style BWV stroke:#0366d6,stroke-width:4px ```
…portal (Comfy-Org#22398) ## Why The app's Manage / Billing & invoices button opens `billing.comfy.org/v1/payment-methods` for every prod user since `hosted_billing_destination` went to 100% on Oct 22. That page was built in FE-2331 (Comfy-Org#17809) without a design. Alex confirmed there is no Figma for it, and it falls short of the Stripe portal it replaced: - Every non-card saved method (Link, bank accounts, …) shows as the same "Saved payment method" row, so customers see what look like duplicates (Robin's report in #proj-billing). - There is no way to change the default payment method. Alex asked to route people back to Stripe's billing portal. ## Root cause `PaymentMethodsPanel` renders its own list of `GET /billing/payment-methods` and only names cards. The server lists every attached method and fills `brand` / `last4` only for cards, so any other type falls back to the generic label. Managing methods (add, remove, set default) only exists in the Stripe portal. ## How - The page opens the provider portal as soon as it loads, through the existing `usePaymentPortal` (`commands.openPaymentPortal`, telemetry unchanged). - When the portal sends the visitor back (`portal=return`), the page drops the marker and does not reopen the portal, so there is no loop. It shows only "Manage payment methods" to open the portal again, next to the existing "Return to ComfyUI" link. - If the portal cannot be opened, the coded refusal shows with the same button to try again. - The saved-methods list and its copy are removed from this page. `usePaymentMethods` stays in use by checkout. billing-web deploys on its own, so this ships without an app release. The app keeps sending Manage to billing-web; dropping that hop in the app can follow separately. ## AS IS / TO BE All API responses below come from the billing-web e2e mocks (`apps/billing-web/e2e/fixtures/cloud.ts`); no real Cloud or Stripe backend. | AS IS | TO BE (arrival) | TO BE (after `portal=return`) | | --- | --- | --- | | <img src="https://gist.githubusercontent.com/dante01yoon/2b4da2706a33775db0e482a22d2da31c/raw/fa470cc8fa79b1869e622631304cf70ea77339f3/asis-list.png" width="320"> | <img src="https://gist.githubusercontent.com/dante01yoon/2b4da2706a33775db0e482a22d2da31c/raw/fa470cc8fa79b1869e622631304cf70ea77339f3/tobe-arrival.png" width="320"> | <img src="https://gist.githubusercontent.com/dante01yoon/2b4da2706a33775db0e482a22d2da31c/raw/fa470cc8fa79b1869e622631304cf70ea77339f3/tobe-return.png" width="320"> | | `origin/main`, mocked `GET /billing/payment-methods` returns two cards plus a `type: 'link'` method with no brand/last4; the Link method renders as "Saved payment method". | Opening `/v1/payment-methods` goes straight to the portal URL from the mocked `POST /billing/payment-portal` (`https://billing-portal.test/session/e2e`, the e2e stub page). | Returning with `?portal=return` stays on the page and shows only "Manage payment methods" plus "Return to ComfyUI". | ## Testing - `PaymentMethodsView.test.ts`: opens the portal on arrival without reading the list, stays on the page after a return, reopens from the button, shows the retry on a refused portal, plus the existing portal telemetry rows. - `e2e/payment-methods.spec.ts`: arrival lands on the portal URL; a return keeps the page and the button opens the portal. - Full billing-web unit suite passes (59 files, 1579 tests).
Linear FE-2331 / FE-2218.
Stacked on #17807 (session); carries a cherry-pick of #17795 (billing-contract).
Why
billing.comfy.orgcurrently serves one static page: a hard-coded checkout mockup at/. Nothing reads the entry URL a product hands it, and nothing renders over the billing SDK. This PR gives the hosted app its/v1entry routing plus the first two surfaces that project real SDK state — the subscription catalog with a plan-change quote, and saved payment methods with the provider portal round trip.The entry URL is untrusted routing input.
parseBillingEntrydecides whether it describes a request the contract knows, and a failed parse renders a coded explanation rather than a redirect, so a misdirected link stays visible instead of silently landing the customer somewhere else.How
router.tsgenerates a route perBILLING_INTENTSentry —subscriptionandpricingtoSubscriptionView,payment-methodstoPaymentMethodsView,checkoutto the existingBillingHomeView(unchanged),invoicesandresulttoComingSoonView./keeps the scaffold checkout page and stays outside the contract.beforeEachparsesto.fullPathand publishes the result into a tab-local module ref (useBillingEntry);App.vuerenders the entry-error surface whenever that parse failed, whatever route matched. No navigation happens on an error./sign-in: signing in would not repair it./and/sign-incarry no product request and leave the entry alone.HostedSurface.vueis the shared shell: the dark full-screen layout, the surface title, theReturn to <product>link built withbuildReturnUrlagainst the resolvedBILLING_WEB_ENV(default and fail-closed valuetest), and the choice between the entry-error section and the surface itself. Views stay pure projections of composable state, and a surface only ever renders behind the guard and the shell, which always provide a client.SubscriptionPanelreadsusePlans(), renders each plan as a card (tier + duration, price, monthly credits, seats), disables an unavailable plan with its availability reason as our own copy, and on selection callsusePreviewSubscribe().quote({ planSlug })and renders the quote. Confirm is present and disabled behind the scaffold's existingcheckout.sdkPendingline.PaymentMethodsPanelreadsusePaymentMethods(), marks the default card, and opens the provider portal throughcommands.openPaymentPortalwith this page's own href plus aportal=returnmarker. On the way back it invalidates and re-reads once, then strips the marker withrouter.replace.bigintmoney fields convert withNumber()only at then()/d()formatting boundary.AS-IS / TO-BE
AS-IS: a
/v1/subscriptionlink has no surface of its own — the catch-all redirects it to/, the scaffold's static checkout mockup, and the product's entry parameters are dropped on the way.TO-BE:
/v1/subscriptionrenders the catalog with the current plan marked and an unavailable plan explained, selecting a plan adds the server's plan-change quote with an inert confirm,/v1/payment-methodslists saved cards with the default marked beside the provider-portal button, and a link the contract cannot read gets a coded explanation instead of a redirect./v1/subscription?product=comfyui&return_to=comfyui_workspaceredirects to the static checkout page/v1/payment-methodswith the default card marked/v1/subscription?product=nope)Testing
apps/billing-webunit tests (@testing-library/vue, happy-dom): the app suite is 85 passing, 44 of them in the four files this PR touches:router.test.ts— each intent opens its surface, the parsed entry is published, every entry-error code renders its own copy (including on the checkout route, proving the error surface wins over the matched route), an unrecognised path stays where it is, and/remains outside the contract. The guard rows from FE-2218 feat(billing-web): own-origin session, sign-in and the billing SDK composition #17807 join the same file: a signed-out visitor is sent to/sign-inwith the surface to come back to, and an unreadable link keeps its error through that redirect.SubscriptionView.test.ts— current plan named, catalog priced, an unavailable plan disabled with its reason, selecting a plan callspreviewSubscribewith{ planSlug }and renders the formatted quote with confirm disabled, a refused quote and a failed catalog read both render coded copy.PaymentMethodsView.test.ts— cards listed with the default marked, the portal button navigates to the returned URL, andportal=returntriggers exactly one invalidate plus one read before the marker is stripped.HostedSurface.test.ts— the arriving intent's content renders, return link href frombuildReturnUrl, no link when the entry named no destination.Gates:
pnpm typecheck,pnpm lint,pnpm format,pnpm knip,pnpm --filter @comfyorg/billing-web build,fallow auditall pass.Not in this PR
apps/billing-webunit tests in the CI loop:ci-tests-unit.yamlrunspackages/*only, so this suite runs locally but not on a PR. Follow-up.Where this sits in the plan
Billing SDK track FE-2210 (implementation plan V2). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app.
@comfyorg/account-uicomposables +CheckoutStepsbilling_sdk_topup_enabledhosted_billing_destinationserver flag read by the hosthostedDestinationport on the lifecycle, value on operation state@comfyorg/account→@comfyorg/account-corerenamebilling-contractroute builder +return_toregistrycreateHostedTopupCheckoutpreviewSubscribecommandusePlans,usePaymentMethods,usePreviewSubscribe)/v1entry routing + subscription / payment-method surfacesingest-types,account-core,billing-contract), Platform install, billing-web live top-upneedsCustomerAttentionpredicate (from the #17665 review)BillingServerCode(from the #17656 review)