Repository navigation
fix(billing): render checkout credits from the server preview - #15900
MaanilVerma wants to merge 9 commits into
Conversation
The confirm and success screens showed the tier constant's credits while the card the user picked showed the catalog's. When a preview exists its new_plan.credits_cents (the period grant, same convention as Plan.credits_cents) is the figure shown; team stops keep the stop's credits and the constant remains only for the preview-less fallback. Fixtures now carry the credits they assert.
|
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: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
🎭 Playwright: ✅ 2017 passed, 0 failed · 1 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook📦 Bundle Size
⚡ Performance Report
Absolute values
Raw data{
"timestamp": "2026-08-26T12:58:40.404Z",
"gitSha": "9a66ad6b16aa1a71dc9625d18d1f399476bcceeb",
"branch": "maanil/fe-1600-checkout-credits-from-preview",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2048.8389999999868,
"styleRecalcs": 8,
"styleRecalcDurationMs": 5.804,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 462.44800000000004,
"heapDeltaBytes": 3024792,
"heapUsedBytes": 74344632,
"domNodes": -283,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 8.767000000000003,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 2017.329000000018,
"styleRecalcs": 8,
"styleRecalcDurationMs": 5.823000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 468.50800000000004,
"heapDeltaBytes": -13256048,
"heapUsedBytes": 58989736,
"domNodes": -281,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 8.764,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 2296.7780000000175,
"styleRecalcs": 81,
"styleRecalcDurationMs": 39.956,
"layouts": 12,
"layoutDurationMs": 3.4539999999999997,
"taskDurationMs": 1218.473,
"heapDeltaBytes": 1895908,
"heapUsedBytes": 73208060,
"domNodes": -281,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 132.33199999999997,
"eventListeners": -155,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 2042.0639999999821,
"styleRecalcs": 80,
"styleRecalcDurationMs": 36.553999999999995,
"layouts": 12,
"layoutDurationMs": 3.445,
"taskDurationMs": 1035.282,
"heapDeltaBytes": -519872,
"heapUsedBytes": 70613876,
"domNodes": -280,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 115.64399999999998,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1737.9940000000147,
"styleRecalcs": 32,
"styleRecalcDurationMs": 14.448,
"layouts": 6,
"layoutDurationMs": 0.597,
"taskDurationMs": 349.70599999999996,
"heapDeltaBytes": 4243848,
"heapUsedBytes": 76329460,
"domNodes": 78,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 10.659000000000002,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1732.407999999964,
"styleRecalcs": 32,
"styleRecalcDurationMs": 15.173,
"layouts": 6,
"layoutDurationMs": 0.7240000000000001,
"taskDurationMs": 337.53,
"heapDeltaBytes": 4154564,
"heapUsedBytes": 76334184,
"domNodes": 77,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 10.914,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 874.0950000000112,
"styleRecalcs": 11,
"styleRecalcDurationMs": 4.864,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 588.93,
"heapDeltaBytes": 6772280,
"heapUsedBytes": 78162680,
"domNodes": 14,
"jsHeapTotalBytes": 6291456,
"scriptDurationMs": 123.91600000000001,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "dom-widget-clipping",
"durationMs": 881.2060000000201,
"styleRecalcs": 14,
"styleRecalcDurationMs": 6.596000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 604.4430000000001,
"heapDeltaBytes": 7414116,
"heapUsedBytes": 78959052,
"domNodes": 20,
"jsHeapTotalBytes": 6291456,
"scriptDurationMs": 127.747,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-idle",
"durationMs": 2007.9650000000129,
"styleRecalcs": 4,
"styleRecalcDurationMs": 2.9239999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 499.11400000000003,
"heapDeltaBytes": -1613440,
"heapUsedBytes": 77282492,
"domNodes": -270,
"jsHeapTotalBytes": -1355776,
"scriptDurationMs": 34.884,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2040.691000000038,
"styleRecalcs": 6,
"styleRecalcDurationMs": 6.94,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 534.6929999999999,
"heapDeltaBytes": -3105300,
"heapUsedBytes": 76185464,
"domNodes": -270,
"jsHeapTotalBytes": -2142208,
"scriptDurationMs": 33.839,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 3208.0569999999966,
"styleRecalcs": 66,
"styleRecalcDurationMs": 11.806000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 2238.009,
"heapDeltaBytes": 460452,
"heapUsedBytes": 79653244,
"domNodes": -251,
"jsHeapTotalBytes": 2015232,
"scriptDurationMs": 785.967,
"eventListeners": -181,
"totalBlockingTimeMs": 5,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 3152.107000000001,
"styleRecalcs": 62,
"styleRecalcDurationMs": 8.980000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 2195.3639999999996,
"heapDeltaBytes": 29159464,
"heapUsedBytes": 94578984,
"domNodes": 0,
"jsHeapTotalBytes": 3371008,
"scriptDurationMs": 763.779,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-zoom",
"durationMs": 4119.046000000026,
"styleRecalcs": 66,
"styleRecalcDurationMs": 12.158000000000001,
"layouts": 60,
"layoutDurationMs": 8.344000000000001,
"taskDurationMs": 2197.166,
"heapDeltaBytes": -2592948,
"heapUsedBytes": 67917700,
"domNodes": 24,
"jsHeapTotalBytes": 2097152,
"scriptDurationMs": 728.154,
"eventListeners": 10,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 4119.0350000000535,
"styleRecalcs": 66,
"styleRecalcDurationMs": 12.283999999999999,
"layouts": 60,
"layoutDurationMs": 8.198,
"taskDurationMs": 2136.737,
"heapDeltaBytes": 24415708,
"heapUsedBytes": 91323412,
"domNodes": -254,
"jsHeapTotalBytes": 3407872,
"scriptDurationMs": 698.222,
"eventListeners": 10,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "legacy-node-drag",
"durationMs": 4168.655999999999,
"styleRecalcs": 40,
"styleRecalcDurationMs": 4.979000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 2990.138,
"heapDeltaBytes": 23566164,
"heapUsedBytes": 91360996,
"domNodes": 0,
"jsHeapTotalBytes": 3301376,
"scriptDurationMs": 803.624,
"eventListeners": 190,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.669999999999952,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "legacy-node-drag",
"durationMs": 4438.138999999978,
"styleRecalcs": 40,
"styleRecalcDurationMs": 4.796000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 3101.6119999999996,
"heapDeltaBytes": 19277788,
"heapUsedBytes": 90787248,
"domNodes": 0,
"jsHeapTotalBytes": 1204224,
"scriptDurationMs": 839.4970000000001,
"eventListeners": 190,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333338,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2044.2580000000135,
"styleRecalcs": 4,
"styleRecalcDurationMs": 6.0249999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 541.452,
"heapDeltaBytes": -5694740,
"heapUsedBytes": 75036808,
"domNodes": -277,
"jsHeapTotalBytes": -831488,
"scriptDurationMs": 34.293000000000006,
"eventListeners": -181,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2011.5369999999757,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 447.6859999999999,
"heapDeltaBytes": 13019944,
"heapUsedBytes": 78629900,
"domNodes": 0,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 32.967000000000006,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 645.9470000000351,
"styleRecalcs": 47,
"styleRecalcDurationMs": 8.019,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 449.41299999999995,
"heapDeltaBytes": -7925472,
"heapUsedBytes": 64782128,
"domNodes": 20,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 116.648,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 648.6499999999751,
"styleRecalcs": 46,
"styleRecalcDurationMs": 7.906,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 447.92800000000005,
"heapDeltaBytes": -7945164,
"heapUsedBytes": 64623632,
"domNodes": 18,
"jsHeapTotalBytes": 6029312,
"scriptDurationMs": 113.71300000000001,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 2045.0040000000058,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.893999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 456.613,
"heapDeltaBytes": -11506100,
"heapUsedBytes": 60898636,
"domNodes": -291,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 8.048,
"eventListeners": -199,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 2024.9079999999822,
"styleRecalcs": 9,
"styleRecalcDurationMs": 6.286999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 458.543,
"heapDeltaBytes": -11600464,
"heapUsedBytes": 60184696,
"domNodes": -296,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 7.512000000000001,
"eventListeners": -199,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1758.564999999976,
"styleRecalcs": 76,
"styleRecalcDurationMs": 30.374,
"layouts": 16,
"layoutDurationMs": 4.135,
"taskDurationMs": 976.227,
"heapDeltaBytes": -6230956,
"heapUsedBytes": 66603228,
"domNodes": -297,
"jsHeapTotalBytes": 6021120,
"scriptDurationMs": 86.009,
"eventListeners": -201,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1705.5710000000772,
"styleRecalcs": 74,
"styleRecalcDurationMs": 29.609999999999996,
"layouts": 16,
"layoutDurationMs": 3.952,
"taskDurationMs": 950.462,
"heapDeltaBytes": -4693900,
"heapUsedBytes": 67757580,
"domNodes": -296,
"jsHeapTotalBytes": 6021120,
"scriptDurationMs": 84.69,
"eventListeners": -231,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 1232.6899999999341,
"styleRecalcs": 20,
"styleRecalcDurationMs": 28.115000000000002,
"layouts": 15,
"layoutDurationMs": 10.822,
"taskDurationMs": 814.7740000000001,
"heapDeltaBytes": -3802504,
"heapUsedBytes": 91022152,
"domNodes": 13671,
"jsHeapTotalBytes": 10223616,
"scriptDurationMs": 27.823,
"eventListeners": 2383,
"totalBlockingTimeMs": 126,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "viewport-pan-sweep",
"durationMs": 12159.67999999998,
"styleRecalcs": 246,
"styleRecalcDurationMs": 38.54299999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 7479.284,
"heapDeltaBytes": -11854196,
"heapUsedBytes": 66958620,
"domNodes": -271,
"jsHeapTotalBytes": 479232,
"scriptDurationMs": 2407.784,
"eventListeners": -155,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666607,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 12201.557999999977,
"styleRecalcs": 246,
"styleRecalcDurationMs": 37.242999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 7645.103,
"heapDeltaBytes": -10205456,
"heapUsedBytes": 68843332,
"domNodes": -270,
"jsHeapTotalBytes": 2314240,
"scriptDurationMs": 2479.143,
"eventListeners": -157,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333326,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 14646.240000000034,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 13945.821,
"heapDeltaBytes": -33728312,
"heapUsedBytes": 175861584,
"domNodes": -6548,
"jsHeapTotalBytes": -12288,
"scriptDurationMs": 265.29999999999995,
"eventListeners": -7475,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 14603.025000000001,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 13883.767,
"heapDeltaBytes": -21627876,
"heapUsedBytes": 176414884,
"domNodes": -6552,
"jsHeapTotalBytes": -7102464,
"scriptDurationMs": 264.363,
"eventListeners": -7475,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666763,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-pan",
"durationMs": 17592.22599999998,
"styleRecalcs": 148,
"styleRecalcDurationMs": 17.774999999999984,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 17277.264,
"heapDeltaBytes": -29465556,
"heapUsedBytes": 177189476,
"domNodes": -6548,
"jsHeapTotalBytes": 2387968,
"scriptDurationMs": 846.835,
"eventListeners": -7471,
"totalBlockingTimeMs": 29,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-pan",
"durationMs": 18011.45900000006,
"styleRecalcs": 159,
"styleRecalcDurationMs": 18.946999999999992,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 17661.778000000002,
"heapDeltaBytes": -56971272,
"heapUsedBytes": 167704248,
"domNodes": -6548,
"jsHeapTotalBytes": -3227648,
"scriptDurationMs": 856.6029999999998,
"eventListeners": -7473,
"totalBlockingTimeMs": 14,
"frameDurationMs": 18.333333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 469.03599999996004,
"styleRecalcs": 22,
"styleRecalcDurationMs": 25.39,
"layouts": 3,
"layoutDurationMs": 1.424,
"taskDurationMs": 132.625,
"heapDeltaBytes": 5836716,
"heapUsedBytes": 73943948,
"domNodes": 152,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 7.052999999999998,
"eventListeners": 99,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "workflow-execution",
"durationMs": 432.4459999999135,
"styleRecalcs": 15,
"styleRecalcDurationMs": 18.761,
"layouts": 3,
"layoutDurationMs": 0.636,
"taskDurationMs": 108.022,
"heapDeltaBytes": 5685852,
"heapUsedBytes": 74251260,
"domNodes": 125,
"jsHeapTotalBytes": 524288,
"scriptDurationMs": 6.104999999999998,
"eventListeners": 99,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
}
]
} |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## maanil/fe-1600-s2-subscribe-checkout #15900 +/- ##
========================================================================
+ Coverage 82.64% 82.65% +0.01%
========================================================================
Files 1944 1944
Lines 112042 112044 +2
Branches 33006 32188 -818
========================================================================
+ Hits 92600 92615 +15
+ Misses 19096 19092 -4
+ Partials 346 337 -9
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 15 files with indirect coverage changes 🚀 New features to boost your workflow:
|
QA — checkout confirm/success screens show credits from the server previewThe credits figure on the three reused checkout screens comes from the server preview ( Important This changes three shared cloud money screens and is worth a cloud reviewer's eyes. The change is numerically neutral for today's catalog —
On the success screen, Gates
Not covered here: team-stop credits on add-payment and transition are unchanged by this PR and covered by code-read only; a visual shot with a differing-preview fixture is a nice-to-have follow-up. The transition screen requires a preview and the non-embedded team-change path could mount it without one — that crash is fixed in the plan-change PR, not here. |
…otal The confirm and success screens now read credits_cents per billing period, so an ANNUAL plan fixture must carry the year total, not the monthly figure the old x12 render masked. Aligns the deep-link spec's annual credits with its annual price.
…00-checkout-credits-from-preview # Conflicts: # src/platform/workspace/components/SubscriptionTransitionPreviewWorkspace.vue
…00-checkout-credits-from-preview
This comment has been minimized.
This comment has been minimized.
…kout' into maanil/fe-1600-checkout-credits-from-preview
The success screen read its price from the server preview but its credits from the selected team stop, so a team plan change with a preview could show a server price beside a client credit figure. Both now resolve the team stop first, matching the AddPayment and Transition screens, and the preview-less fallbacks are unchanged. Also aligns the deep-link annual preview fixtures: their credits_today / credits_next_period figures were still the monthly grant next to annual prices, the same inconsistency the credits_cents fields just had fixed.
The success screen's getTierCredits branch was only exercised indirectly, so a regression in it would not have shown up.
…kout' into maanil/fe-1600-checkout-credits-from-preview
dante01yoon
left a comment
There was a problem hiding this comment.
First review of this PR, at head 71c0a30. The direction is right and matches the stack's contract: the confirm/success screens now render previewData.new_plan.credits_cents (the per-period grant, no x12 for annual - consistent with how #15427 treats the catalog's annual rows) with the tier constant kept only as the preview-less fallback, and each screen gained a test proving a preview figure that differs from the constant wins. The pricingTableDeepLink fixture correction to full-year annual grants also matches the real catalog shape.
One question, anchored inline, before I can approve: the success screen now prefers the client-derived team stop total over the server preview's price for team changes - the opposite of the previous priority - and I'd like the backend behavior confirmed before we entrench that. Since these are shared cloud screens, worth the cloud reviewer's eyes you asked for.
| : teamPlan.discountedUsd | ||
| return String(usd) | ||
| } | ||
| if (previewData?.new_plan) { |
There was a problem hiding this comment.
question: Moving the preview branch below teamPlan flips the team-change success price from the server preview's figure to the client-derived discountedUsd * 12 (which round-trips through a rounded whole-percent discount - see my #15428 comment - so it can differ from the API's yearly.price_cents by a dollar at some price points, and your own test now asserts $7560 renders while the server said $7580). I understand the motive: price and credits should describe one plan, and for a per-credit team plan new_plan.price_cents may be the base plan row rather than the stop-adjusted amount, in which case the old priority showed a genuinely wrong price next to stop credits. Could you confirm what the backend actually returns in preview.new_plan.price_cents for a team per-credit preview? If it is stop-aware, the server figure should win for both price and credits; if it is not, keeping the stop as the single source is right, but then the stop's exact API yearly.price_cents should flow here (via the #15428 mapper fix) rather than the lossy percent reconstruction, so the success screen can never show a total the server never stated.
Summary
The subscription confirm and success screens showed credits from a frontend tier constant while the plan the user picked showed the catalog's, so on cloud the two could disagree. This sources the credit figure from the server preview instead, on the same money surface the plan cards already render from the API.
Changes
SubscriptionAddPaymentPreviewWorkspace,SubscriptionTransitionPreviewWorkspace, andSubscriptionSuccessWorkspacerenderpreviewData.new_plan.credits_cents(the per-period grant the API returns) when a preview is present. Team stops keep the stop's own credits; the tier constant remains only for the preview-less fallback. On the success screen, price and credits now resolve from the same source (the selected stop, then the preview), so a team change carrying a preview cannot show a server price beside a client credit figure. Each screen gains a test proving a preview figure that differs from the constant is the one rendered.Review Focus
previewData.new_plan.credits_centsis the full billing-period grant (verified against the backend), so nox12is applied for a yearly personal plan from the preview; the annualPlanalready carries the year total. The team branch still multiplies the monthly stop grant by 12 for a yearly commitment.Screenshots (if applicable)
Not applicable (no visual change on cloud; the figures were already displayed, only their source moved).