From 5dd379be807f0fe1fd8f14b208b5730de2736713 Mon Sep 17 00:00:00 2001 From: Dante Date: Wed, 2 Sep 2026 20:13:21 +0000 Subject: [PATCH] fix(billing): give the confirm step a single header and back action (#16648) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary With embedded checkout off, the subscription dialog drew "Choose a Plan" and a back arrow on top of a confirm step that already renders both — two stacked headers on every legacy confirmation, and two back arrows on plan changes. Found on staging during 1.52 QA (Denys). ## Root cause The shell suppressed its own chrome only for the embedded steps: ```ts const isEmbeddedPaymentStep = computed(() => … && stripePaymentElementEnabled && …) const isEmbeddedConfirmStep = computed(() => … && stripePaymentElementEnabled && …) ``` Both require `stripePaymentElementEnabled`, so with the flag off they are false and the header and back arrow render on every step. The comment above the header already described this exact failure ("stacking 'Choose a Plan' above it doubled the header") — the guard written for it just never covered the flag-off path. The arrow count differed by step for a second reason: `SubscriptionAddPaymentPreviewWorkspace` hid its back button behind `v-if="usePaymentElement"`, so a new subscription showed one arrow (the shell's), while `SubscriptionTransitionPreviewWorkspace` renders its own unconditionally and showed two. Both arrows call `handleBackToPricing`, which is why they behaved identically. ## Changes - **What**: the shell header is now bound to the pricing step — the confirm and success steps title themselves, so no flag is involved. The back action moves to the step that owns the header: the confirmation renders it in both modes, and neither dialog shell renders one. `isEmbedded*` are still used for the container sizing and transitions; only the chrome stopped consulting them. `SubscriptionRequiredDialogContentWorkspace` (the legacy per-member team dialog) is touched because it shares the confirm component. It had the same duplication on plan changes and is fixed by the same ownership rule. Its two back-button tests now assert the child owns the action rather than the shell. ## Review Focus The back arrow moves from the shell's absolute top-left to inline beside the confirm title in the flag-off path. That is the position it already occupies with embedded checkout on, so the two modes now match rather than diverge — worth a designer's eye if the old placement was deliberate. Behaviour deliberately unchanged: `isPolling`/loading still disable the action, since the confirm components already gate their button on the `isLoading` prop the shell passes. ## Screenshots (if applicable) Captured against a cloud-distribution dev server with embedded checkout off, driving the real flow: Settings → Plan & Credits → Change plan → pick a different Team credit stop → Change plan. Both shots are taken on top of #16647 so the confirm body renders — on current `main` this step is empty, which hides the chrome problem rather than fixing it. ### AS IS ![AS IS: "Choose a Plan" stacked over "Confirm your upgrade", with two back arrows](https://raw.githubusercontent.com/dante01yoon/ComfyUI_frontend/assets/pr-16648-screenshots/docs-assets/pr-16648/asis-doubled-chrome.png) Two titles and two back arrows. The shell draws its own header and arrow because every `isEmbedded*` guard requires `stripePaymentElementEnabled`, which is false with the flag off, and the confirm step renders its own on top. ### TO BE — this PR ![TO BE: a single "Confirm your upgrade" header and one back action](https://raw.githubusercontent.com/dante01yoon/ComfyUI_frontend/assets/pr-16648-screenshots/docs-assets/pr-16648/tobe-single-chrome.png) One header, one back action. The shell header now belongs to the pricing step, and the back action to the step that owns the header. --- ...criptionAddPaymentPreviewWorkspace.test.ts | 26 ++++++++++++------- ...SubscriptionAddPaymentPreviewWorkspace.vue | 1 - ...iptionRequiredDialogContentUnified.test.ts | 22 +++++++++++++++- ...bscriptionRequiredDialogContentUnified.vue | 26 ++----------------- ...tionRequiredDialogContentWorkspace.test.ts | 7 ++--- ...criptionRequiredDialogContentWorkspace.vue | 12 --------- 6 files changed, 44 insertions(+), 50 deletions(-) diff --git a/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.test.ts b/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.test.ts index 05c0e573cb7..528b97b2e02 100644 --- a/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.test.ts +++ b/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.test.ts @@ -398,17 +398,25 @@ describe('SubscriptionAddPaymentPreviewWorkspace', () => { expect(screen.getByText('op-reconcile-123')).toBeTruthy() }) - it('does not render a back action on the payment confirmation', () => { - render(SubscriptionAddPaymentPreviewWorkspace, { - props: { tierKey: 'creator', isLoading: true }, - global: globalOptions + it('owns a back action whether or not the payment element is embedded', async () => { + const { emitted } = render(SubscriptionAddPaymentPreviewWorkspace, { + props: { tierKey: 'creator' }, + global: { + ...globalOptions, + stubs: { + ...globalOptions.stubs, + Button: { + props: ['ariaLabel'], + template: + '' + } + } + } }) - expect( - screen.queryByRole('button', { - name: 'subscription.preview.backToAllPlans' - }) - ).toBeNull() + await userEvent.click(screen.getByRole('button', { name: 'g.back' })) + + expect(emitted().back).toBeTruthy() }) it('prices a legacy preview from the server costs instead of rendering a blank total', () => { diff --git a/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.vue b/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.vue index 24acd5eb452..e82bb75cb06 100644 --- a/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.vue +++ b/src/platform/workspace/components/SubscriptionAddPaymentPreviewWorkspace.vue @@ -27,7 +27,6 @@ :class="cn('mb-8 flex items-center gap-3', captureMode && 'xl:mb-10')" > + ` }, SubscriptionTransitionPreviewWorkspace: { template: '
' }, @@ -248,4 +250,22 @@ describe('SubscriptionRequiredDialogContentUnified team-plan subscribe', () => { }) expect(mockHandleSubscribeClick).not.toHaveBeenCalled() }) + + it.for([true, false])( + 'leaves the confirm step its own header and back action (embedded: %s)', + async (embeddedCheckoutEnabled) => { + mockCheckoutStep.value = 'preview' + mockPreviewVariant.value = 'team-new' + mockSelectedTeamStop.value = TEAM_PAYLOAD.stop + + renderComponent({ embeddedCheckoutEnabled }) + + expect(screen.queryByText('Choose your plan')).toBeNull() + expect(screen.getAllByRole('button', { name: 'Back' })).toHaveLength(1) + + await userEvent.click(screen.getByRole('button', { name: 'Back' })) + + expect(mockHandleBackToPricing).toHaveBeenCalled() + } + ) }) diff --git a/src/platform/workspace/components/SubscriptionRequiredDialogContentUnified.vue b/src/platform/workspace/components/SubscriptionRequiredDialogContentUnified.vue index bb75978af34..77d8fbc2d2d 100644 --- a/src/platform/workspace/components/SubscriptionRequiredDialogContentUnified.vue +++ b/src/platform/workspace/components/SubscriptionRequiredDialogContentUnified.vue @@ -28,22 +28,6 @@ ) " > - - - +

diff --git a/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.test.ts b/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.test.ts index a11b43911bf..5ab17c57843 100644 --- a/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.test.ts +++ b/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.test.ts @@ -63,6 +63,7 @@ const AddPaymentPreviewStub = { +

` } @@ -209,11 +210,11 @@ describe('SubscriptionRequiredDialogContentWorkspace', () => { expect(onClose).toHaveBeenCalledOnce() }) - it('shows back button on preview step', () => { + it('leaves the back action to the preview step that renders its own', () => { mockCheckoutStep.value = 'preview' mockPreviewData.value = { transition_type: 'new_subscription' } renderComponent() - expect(screen.getByLabelText('Back')).toBeInTheDocument() + expect(screen.getAllByRole('button', { name: 'Back' })).toHaveLength(1) }) it('shows insufficient credits message when reason is out_of_credits', () => { @@ -283,7 +284,7 @@ describe('SubscriptionRequiredDialogContentWorkspace', () => { mockPreviewData.value = { transition_type: 'new_subscription' } renderComponent() - await user.click(screen.getByLabelText('Back')) + await user.click(screen.getByRole('button', { name: 'Back' })) expect(mockHandleBackToPricing).toHaveBeenCalled() }) diff --git a/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.vue b/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.vue index 9be5f65c6af..770cd410d32 100644 --- a/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.vue +++ b/src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.vue @@ -2,18 +2,6 @@
- -