From fbee1832d7e4fa5cfe5ab407887205a88365c993 Mon Sep 17 00:00:00 2001 From: comfydesigner Date: Fri, 30 Oct 2026 00:29:54 -0700 Subject: [PATCH 1/7] fix(billing): show the plan action on the Billing tab's lifecycle banners The Billing tab showed Plan ending and Plan ended without their buttons (1.59, decided 2026-10-28). They now carry Resume plan / Resubscribe, gated by the same served facts as on the Members tab (can_reactivate on Cloud), matching the Figma Billing tab frames. Dismiss stays off on this tab: its banner ignores dismissals, so a Dismiss button would do nothing. --- .../dialogs/settings/BillingTab.test.ts | 12 +++-- .../settings/BillingStatusBanner.stories.ts | 16 ++++++ .../settings/BillingStatusBanner.test.ts | 52 ++++++++++++++----- .../settings/BillingStatusBanner.vue | 4 +- src/storybook/mocks/useBillingCapabilities.ts | 3 ++ 5 files changed, 68 insertions(+), 19 deletions(-) diff --git a/src/platform/account/components/dialogs/settings/BillingTab.test.ts b/src/platform/account/components/dialogs/settings/BillingTab.test.ts index 1516ca16a07..243d8e22b79 100644 --- a/src/platform/account/components/dialogs/settings/BillingTab.test.ts +++ b/src/platform/account/components/dialogs/settings/BillingTab.test.ts @@ -1029,17 +1029,21 @@ describe('BillingTab', () => { arrange(scenario) } - it('shows Plan ending with the plan row keeping the actions', () => { + it('shows Plan ending with Resume plan on both the banner and the plan row', () => { arrangeOnCloud(ending) const banner = screen.getByRole('status') expect(banner).toHaveTextContent( 'Your Pro plan ends on October 28, 2026' ) - expect(within(banner).queryAllByRole('button')).toEqual([]) expect( - screen.getByRole('button', { name: 'Resume plan' }) - ).toBeInTheDocument() + within(banner) + .queryAllByRole('button') + .map((button) => button.textContent.trim()) + ).toEqual(['Resume plan']) + expect( + screen.getAllByRole('button', { name: 'Resume plan' }) + ).toHaveLength(2) }) it('shows no lifecycle banner on an active plan', () => { diff --git a/src/platform/billing/components/settings/BillingStatusBanner.stories.ts b/src/platform/billing/components/settings/BillingStatusBanner.stories.ts index e8c35cb8340..2599d8bb1fa 100644 --- a/src/platform/billing/components/settings/BillingStatusBanner.stories.ts +++ b/src/platform/billing/components/settings/BillingStatusBanner.stories.ts @@ -305,3 +305,19 @@ export const PlanEndedPersonal: Story = story( }), personalOwner ) + +/** On the Billing tab the plan banners keep their action but never Dismiss. */ +export const BillingTabEndingOwner: Story = { + ...EndingOwner, + args: { section: 'billing' } +} + +export const BillingTabPlanEndedOwner: Story = { + ...PlanEndedOwner, + args: { section: 'billing' } +} + +export const BillingTabPlanChangeOwner: Story = { + ...PlanChangeOwner, + args: { section: 'billing' } +} diff --git a/src/platform/billing/components/settings/BillingStatusBanner.test.ts b/src/platform/billing/components/settings/BillingStatusBanner.test.ts index 642fd18bce9..a684e17f729 100644 --- a/src/platform/billing/components/settings/BillingStatusBanner.test.ts +++ b/src/platform/billing/components/settings/BillingStatusBanner.test.ts @@ -300,7 +300,8 @@ describe('BillingStatusBanner', () => { endDate: '2026-10-28T00:00:00Z' } }, - text: 'Your Team plan ends on' + text: 'Your Team plan ends on', + buttons: ['Resume plan'] }, { name: 'a scheduled change while out of credits', @@ -308,7 +309,8 @@ describe('BillingStatusBanner', () => { scheduledFor('pro-annual') state.subscription = { ...state.subscription!, hasFunds: false } }, - text: 'Your plan changes to' + text: 'Your plan changes to', + buttons: [] }, { name: 'plan ending while out of credits', @@ -320,7 +322,8 @@ describe('BillingStatusBanner', () => { endDate: '2026-10-28T00:00:00Z' } }, - text: 'Your Team plan ends on' + text: 'Your Team plan ends on', + buttons: ['Resume plan'] }, { name: 'plan ended', @@ -336,16 +339,24 @@ describe('BillingStatusBanner', () => { tier: 'PRO' } }, - text: 'Your Team plan ended on September 12, 2026' + text: 'Your Team plan ended on September 12, 2026', + buttons: ['Resubscribe'] } - ])('shows $name with no buttons', ({ enter, text }) => { - enter() - renderBanner('billing') - - const banner = screen.getByRole('status') - expect(banner).toHaveTextContent(text) - expect(within(banner).queryAllByRole('button')).toEqual([]) - }) + ])( + 'shows $name with its plan action and no Dismiss', + ({ enter, text, buttons }) => { + enter() + renderBanner('billing') + + const banner = screen.getByRole('status') + expect(banner).toHaveTextContent(text) + expect( + within(banner) + .queryAllByRole('button') + .map((button) => button.textContent.trim()) + ).toEqual(buttons) + } + ) it.for([ { @@ -378,6 +389,23 @@ describe('BillingStatusBanner', () => { expect(screen.getByRole('status')).toBeInTheDocument() }) + it('hides Resume plan when the server withholds it', () => { + state.subscription = { + ...state.subscription!, + isCancelled: true, + endDate: '2026-10-28T00:00:00Z' + } + state.canReactivatePlan = false + renderBanner('billing') + + expect(screen.getByRole('status')).toHaveTextContent( + 'Your Team plan ends on' + ) + expect( + screen.queryByRole('button', { name: 'Resume plan' }) + ).not.toBeInTheDocument() + }) + it.for([ { name: 'out of credits', enter: exhausted }, { name: 'paused', enter: pausedState } diff --git a/src/platform/billing/components/settings/BillingStatusBanner.vue b/src/platform/billing/components/settings/BillingStatusBanner.vue index 827b9b7c754..8236ddfe505 100644 --- a/src/platform/billing/components/settings/BillingStatusBanner.vue +++ b/src/platform/billing/components/settings/BillingStatusBanner.vue @@ -369,9 +369,7 @@ const bannerViews: Record BannerView | null> = { const banner = computed(() => { if (!kind.value || isHiddenOnSection.value) return null const view = bannerViews[kind.value]() - return view && section === 'billing' - ? { ...view, action: null, dismissible: false } - : view + return view && section === 'billing' ? { ...view, dismissible: false } : view }) function handleAddCredits() { diff --git a/src/storybook/mocks/useBillingCapabilities.ts b/src/storybook/mocks/useBillingCapabilities.ts index 30e4de94e43..e387267af73 100644 --- a/src/storybook/mocks/useBillingCapabilities.ts +++ b/src/storybook/mocks/useBillingCapabilities.ts @@ -74,6 +74,9 @@ export function useBillingCapabilities() { canDowngradeToPersonal: computed( () => capabilityState.canDowngradeToPersonal ), + topUpDenial: computed(() => undefined), + canManageBilling: computed(() => capabilityState.canManageSubscription), + runDeniedPaymentPastDue: computed(() => false), isReady: computed(() => true), snapshotAuthoritative: computed(() => true), initialize: () => undefined, From 43f8372328c6f91c6f7931c767c82510b168d01d Mon Sep 17 00:00:00 2001 From: comfydesigner Date: Fri, 30 Oct 2026 13:29:07 -0700 Subject: [PATCH 2/7] fix(billing): keep Resubscribe off the Billing tab's Plan ended banner Resubscribe checks can_manage_subscription and opens the old pricing dialog, while the plan row's Choose a plan follows can_open_plans and opens the Plans page. Plan ended stays without a banner button on this tab until the banner gets Choose a plan. The banner stories also take billing management from the story's workspace state, so PausedMember renders member copy. --- .../components/settings/BillingStatusBanner.stories.ts | 5 ++++- .../components/settings/BillingStatusBanner.test.ts | 2 +- .../components/settings/BillingStatusBanner.vue | 10 +++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/platform/billing/components/settings/BillingStatusBanner.stories.ts b/src/platform/billing/components/settings/BillingStatusBanner.stories.ts index 2599d8bb1fa..f54dab119e4 100644 --- a/src/platform/billing/components/settings/BillingStatusBanner.stories.ts +++ b/src/platform/billing/components/settings/BillingStatusBanner.stories.ts @@ -5,6 +5,7 @@ import { i18n } from '@/i18n' import type { BillingContextMockState } from '@/storybook/mocks/useBillingContext' import { setBillingContextMock } from '@/storybook/mocks/useBillingContext' import { + setBillingCapabilitiesMock, setCanSubscribeSelfServeMock, setCanTopUpMock } from '@/storybook/mocks/useBillingCapabilities' @@ -78,6 +79,9 @@ function story( i18n.global.locale.value = 'en' setBillingContextMock({ isTeamPlan: true, ...billing }) setWorkspaceUIMock(workspace) + setBillingCapabilitiesMock({ + canManageSubscription: workspace.canManageSubscription ?? true + }) setCanTopUpMock(capabilities.canTopUp ?? true) setCanSubscribeSelfServeMock(capabilities.canSubscribeSelfServe ?? false) } @@ -306,7 +310,6 @@ export const PlanEndedPersonal: Story = story( personalOwner ) -/** On the Billing tab the plan banners keep their action but never Dismiss. */ export const BillingTabEndingOwner: Story = { ...EndingOwner, args: { section: 'billing' } diff --git a/src/platform/billing/components/settings/BillingStatusBanner.test.ts b/src/platform/billing/components/settings/BillingStatusBanner.test.ts index a684e17f729..b86b9703baa 100644 --- a/src/platform/billing/components/settings/BillingStatusBanner.test.ts +++ b/src/platform/billing/components/settings/BillingStatusBanner.test.ts @@ -340,7 +340,7 @@ describe('BillingStatusBanner', () => { } }, text: 'Your Team plan ended on September 12, 2026', - buttons: ['Resubscribe'] + buttons: [] } ])( 'shows $name with its plan action and no Dismiss', diff --git a/src/platform/billing/components/settings/BillingStatusBanner.vue b/src/platform/billing/components/settings/BillingStatusBanner.vue index 8236ddfe505..c5e040a570d 100644 --- a/src/platform/billing/components/settings/BillingStatusBanner.vue +++ b/src/platform/billing/components/settings/BillingStatusBanner.vue @@ -366,10 +366,18 @@ const bannerViews: Record BannerView | null> = { planChange: planChangeView } +function forBillingTab(view: BannerView): BannerView { + return { + ...view, + action: view.action === 'resubscribe' ? null : view.action, + dismissible: false + } +} + const banner = computed(() => { if (!kind.value || isHiddenOnSection.value) return null const view = bannerViews[kind.value]() - return view && section === 'billing' ? { ...view, dismissible: false } : view + return view && section === 'billing' ? forBillingTab(view) : view }) function handleAddCredits() { From 3897b7ca9b5ef343fe5877227778d5baf5abb230 Mon Sep 17 00:00:00 2001 From: comfydesigner Date: Mon, 2 Nov 2026 00:17:45 -0800 Subject: [PATCH 3/7] test(billing): drive the banner's section from a Storybook control Replaces the three Billing tab stories, which only set section: 'billing', with a section select on the banner's meta. --- .../settings/BillingStatusBanner.stories.ts | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/platform/billing/components/settings/BillingStatusBanner.stories.ts b/src/platform/billing/components/settings/BillingStatusBanner.stories.ts index f54dab119e4..40e807c0db2 100644 --- a/src/platform/billing/components/settings/BillingStatusBanner.stories.ts +++ b/src/platform/billing/components/settings/BillingStatusBanner.stories.ts @@ -31,7 +31,13 @@ import BillingStatusBanner from './BillingStatusBanner.vue' const meta: Meta = { title: 'Platform/Workspace/BillingStatusBanner', component: BillingStatusBanner, - parameters: { layout: 'fullscreen' } + parameters: { layout: 'fullscreen' }, + argTypes: { + section: { + control: 'select', + options: ['planCredits', 'members', 'allowlist', 'billing'] + } + } } export default meta @@ -309,18 +315,3 @@ export const PlanEndedPersonal: Story = story( }), personalOwner ) - -export const BillingTabEndingOwner: Story = { - ...EndingOwner, - args: { section: 'billing' } -} - -export const BillingTabPlanEndedOwner: Story = { - ...PlanEndedOwner, - args: { section: 'billing' } -} - -export const BillingTabPlanChangeOwner: Story = { - ...PlanChangeOwner, - args: { section: 'billing' } -} From 42c507fccf34e1003473eb803ae87b4727028a17 Mon Sep 17 00:00:00 2001 From: Dante Date: Tue, 3 Nov 2026 12:54:05 -0500 Subject: [PATCH 4/7] feat(billing): offer Choose a plan on the Plan ended banner (#22404) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit M4 follow-up (main only, 1.60, no backport labels). Stacked on #22372; retarget to main after it merges. ## Why Alex's design request. #22372 removed Resubscribe from the Billing tab's Plan ended banner because it checked `can_manage_subscription` and opened the old pricing dialog, so that banner had no button. On the Members tab the same banner still opened the old pricing dialog. ## How - `BillingStatusBanner.vue`: the Plan ended banner's self-serve action is now **Choose a plan ↗**, shown when the served `can_open_plans` is true (read as served from `useBillingCapabilities`, no role/tier/`isCloud` derivation, ADR API-SERVER-FACTS-0042). It opens the billing site's Plans page through the same `usePlatformHandoff('/profile/billing/plans', { target: 'plans' })` the plan row uses, so it gets the same link and `platform_handoff` telemetry. This applies on both the Billing tab and the Members tab; the old pricing dialog path and the Billing-tab-only strip of Resubscribe are removed. - Sales-managed ended plans keep Contact sales for owners, unchanged. - One white button: on the Billing tab, the plan row's Choose a plan is already `inverted` and `addCreditsVariant` already turns Add credits grey when the plan action is Choose a plan. The banner's Choose a plan uses `inverted` too (the same action, as with both Add credits buttons turning white together), so Add credits stays grey. On the Members tab it is also `inverted`. - Storybook capabilities mock gains `canOpenPlans` (follows the story's owner state) so the Plan ended stories render. Not in this PR: the Members tab's footer link under the member list ("Resubscribe", `MembersPanelContent.vue`) still opens the old pricing dialog. ## AS IS / TO BE Captured in the running app, not Storybook: Vite dev server built from each ref (`DISTRIBUTION=cloud`, proxied to testcloud), opened in Ego Lite with jaewon's real signed-in testcloud session as owner of a Team workspace, dark theme, 1280px. AS IS = the base branch (`comfydesigner/billing-tab-banner-actions`), TO BE = this branch, same state and viewport. `unified_billing_settings` is on through the dev `ff:` override. The plan-ended state comes only from stubbed API response bodies in the page: `GET /api/billing/status` (`subscription_state: ended`, `ended_at`/`cancel_at` October 28) and `/api/billing/capabilities` (`can_open_plans` true as served). Balance and the member list are the real testcloud responses. | | AS IS | TO BE | |---|---|---| | Billing tab, Plan ended (owner), stubbed `/api/billing/status` + `/api/billing/capabilities` in the running app | AS IS: Plan ended banner with no button; plan row Choose a plan
white | TO BE: banner Choose a plan white; plan row
Choose a plan white; Add credits grey | | Members tab, Plan ended (owner), stubbed `/api/billing/status` + `/api/billing/capabilities` in the running app | AS IS: Dismiss and grey Resubscribe | TO BE: Dismiss and white Choose a plan with
arrow | ## Design reference - Figma, Cloud Billing tab, ended plan (owner): [Ended — Owner](https://www.figma.com/design/C1fxz3akrW7Pl22zM2b301/?node-id=2024-23354): banner with a white Choose a plan, plan row with a white Choose a plan ↗, Add credits grey. - Figma, banner matrix, Plan ended: [Row — Plan ended](https://www.figma.com/design/C1fxz3akrW7Pl22zM2b301/?node-id=2052-32932), [Banner — Team plan ended · owner · all workspace tabs](https://www.figma.com/design/C1fxz3akrW7Pl22zM2b301/?node-id=2052-32940), [Banner — Team plan ended · member](https://www.figma.com/design/C1fxz3akrW7Pl22zM2b301/?node-id=2052-32958) (no button for members), [Personal](https://www.figma.com/design/C1fxz3akrW7Pl22zM2b301/?node-id=2052-32976). Notes: "Choose a plan opens the Plans page"; on the Billing tab no Dismiss ([node 3006-13155](https://www.figma.com/design/C1fxz3akrW7Pl22zM2b301/?node-id=3006-13155)). - Written decisions in #proj-billing (Alex): - [Request, Oct 30](https://comfy-organization.slack.com/archives/C0BNGQG2LCW/p1793392377861289): add "Choose a plan ↗" to the Plan ended banner from `can_open_plans`, on both the Billing and Members tabs; Members tab keeps Dismiss, Billing tab has none. - [F6 answer, Oct 30](https://comfy-organization.slack.com/archives/C0BNGQG2LCW/p1793344068770879?thread_ts=1793313374.311129&cid=C0BNGQG2LCW): "one white button per page, banner included"; on Cloud the Plan ended banner keeps a white Choose a plan and Add credits is grey. ## Open design questions - Billing tab (Cloud): the banner's Choose a plan and the plan row's Choose a plan are both white. Figma [2024-23354](https://www.figma.com/design/C1fxz3akrW7Pl22zM2b301/?node-id=2024-23354) draws both white, but F6 says one white button per page, banner included. Should the plan row's Choose a plan go grey while the banner shows it? - Members tab: TO BE paints the banner's Choose a plan white, following F6 ("the Plan ended banner keeps white Choose a plan"). The banner matrix frame [2052-32940](https://www.figma.com/design/C1fxz3akrW7Pl22zM2b301/?node-id=2052-32940) shows it grey. Which one is current? - Icon and size: the banner frames show "Choose a plan" without ↗; this PR adds ↗ as requested in Slack. The banner button is `lg` while the plan row's is `md`, so on the Billing tab the two read at different sizes; Figma 2024-23354 draws them about the same size. ## Tests - `BillingStatusBanner.test.ts`: Choose a plan shows on the Members and Billing tabs when `can_open_plans` is true and links to `/profile/billing/plans` in a new tab as the white button; hidden when false; personal ended plans offer it too. - `BillingTab.test.ts` (Cloud): Plan ended shows Choose a plan on both the banner and the plan row, both white, and clicking the banner's one reports the `plans` handoff; hidden when `can_open_plans` is false. - `pnpm exec vitest run src/platform/billing src/platform/account src/platform/workspace`: 5048 passed. oxfmt, oxlint --type-aware, eslint, typecheck clean on changed files. --- .../dialogs/settings/BillingTab.test.ts | 50 +++++++++++ .../settings/BillingStatusBanner.test.ts | 85 +++++++++++++------ .../settings/BillingStatusBanner.vue | 56 ++++++------ src/storybook/mocks/useBillingCapabilities.ts | 1 + 4 files changed, 139 insertions(+), 53 deletions(-) diff --git a/src/platform/account/components/dialogs/settings/BillingTab.test.ts b/src/platform/account/components/dialogs/settings/BillingTab.test.ts index 243d8e22b79..9fd09246dc2 100644 --- a/src/platform/account/components/dialogs/settings/BillingTab.test.ts +++ b/src/platform/account/components/dialogs/settings/BillingTab.test.ts @@ -1046,6 +1046,56 @@ describe('BillingTab', () => { ).toHaveLength(2) }) + const ended: Scenario = { + subscription: { + ...activeSubscription, + isActive: false, + endDate: '2026-09-01T00:00:00Z' + }, + subscriptionStatus: 'ended' + } + + it('shows Plan ended with Choose a plan as the white button on both the banner and the plan row', async () => { + arrangeOnCloud(ended) + + const bannerLink = within(screen.getByRole('status')).getByRole( + 'link', + { name: 'Choose a plan' } + ) + const links = screen.getAllByRole('link', { name: 'Choose a plan' }) + expect(links).toHaveLength(2) + for (const link of links) { + expect(link).toHaveAttribute('data-variant', 'inverted') + expect(link).toHaveAttribute( + 'href', + expect.stringMatching( + /^https:\/\/platform\.test\/profile\/billing\/plans\?workspace=ws_1&correlation_id=.+$/ + ) + ) + } + bannerLink.addEventListener('click', (event) => event.preventDefault()) + + await userEvent.click(bannerLink) + + expect( + vi.mocked(useTelemetry)()?.trackBillingEvent + ).toHaveBeenCalledWith( + expect.objectContaining({ + operation: 'platform_handoff', + target: 'plans' + }) + ) + }) + + it('shows Plan ended without Choose a plan when the server withholds can_open_plans', () => { + arrangeOnCloud({ ...ended, canOpenPlans: false }) + + expect(screen.getByRole('status')).toBeInTheDocument() + expect( + screen.queryByRole('link', { name: 'Choose a plan' }) + ).not.toBeInTheDocument() + }) + it('shows no lifecycle banner on an active plan', () => { arrangeOnCloud({}) diff --git a/src/platform/billing/components/settings/BillingStatusBanner.test.ts b/src/platform/billing/components/settings/BillingStatusBanner.test.ts index b86b9703baa..8f88ff7de6d 100644 --- a/src/platform/billing/components/settings/BillingStatusBanner.test.ts +++ b/src/platform/billing/components/settings/BillingStatusBanner.test.ts @@ -5,6 +5,7 @@ import { canManageBillingFact, runDeniedPaymentPastDueFact } from '@/platform/billing/composables/__mocks__/useBillingCapabilities' +import { receiveServerFact } from '@/platform/serverFacts/serverFact' import userEvent from '@testing-library/user-event' import { render, screen, within } from '@testing-library/vue' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -47,8 +48,7 @@ const state = vi.hoisted(() => ({ manageSubscription: vi.fn( async (): Promise => ({ ok: true }) ), - handleResubscribe: vi.fn(), - showSubscriptionDialog: vi.fn() + handleResubscribe: vi.fn() })) vi.mock( @@ -110,12 +110,30 @@ vi.mock(import('@/platform/billing/composables/useResubscribe'), () => ({ vi.mock(import('@/platform/billing/composables/useBillingDialogs')) -vi.mock( - import('@/platform/billing/subscription/composables/useSubscriptionDialog'), - () => ({ - useSubscriptionDialog: () => ({ show: state.showSubscriptionDialog }) +vi.mock(import('@/platform/workspace/utils/platformLink'), () => ({ + platformLink: (path: string, correlationId?: string) => + `https://platform.test${path}?correlation_id=${correlationId}` +})) + +function grantOpenPlans(granted: boolean) { + useBillingCapabilities().canOpenPlans = computed(() => + receiveServerFact('can_open_plans', granted) + ) +} + +function expectChoosePlanLink() { + const link = within(screen.getByRole('status')).getByRole('link', { + name: 'Choose a plan' }) -) + expect(link).toHaveAttribute( + 'href', + expect.stringMatching( + /^https:\/\/platform\.test\/profile\/billing\/plans\?correlation_id=.+$/ + ) + ) + expect(link).toHaveAttribute('target', '_blank') + expect(link).toHaveAttribute('data-variant', 'inverted') +} const i18n = createI18n({ legacy: false, @@ -123,8 +141,8 @@ const i18n = createI18n({ messages: { en: { workspacePanel: { + billingTab: { plan: { actions: { choosePlan: 'Choose a plan' } } }, members: { - resubscribe: 'Resubscribe', endedTeamTitle: 'Your Team plan has ended', endedEnterpriseTitle: 'Your Enterprise plan has ended', endedPlanTitle: 'Your plan has ended' @@ -855,18 +873,33 @@ describe('BillingStatusBanner', () => { } } - it('lets a team owner resubscribe through the pricing table', async () => { - endedPlan() - renderBanner() + it.for(['members', 'billing'] as const)( + 'offers Choose a plan on the %s tab when the server grants can_open_plans', + (section) => { + endedPlan() + grantOpenPlans(true) + renderBanner(section) - expect(screen.getByRole('status')).toHaveTextContent( - 'Your Team plan ended on September 12, 2026' - ) - await userEvent.click(screen.getByRole('button', { name: 'Resubscribe' })) - expect(state.showSubscriptionDialog).toHaveBeenCalledWith( - expect.objectContaining({ planMode: 'team' }) - ) - }) + expect(screen.getByRole('status')).toHaveTextContent( + 'Your Team plan ended on September 12, 2026' + ) + expectChoosePlanLink() + } + ) + + it.for(['members', 'billing'] as const)( + 'offers no Choose a plan on the %s tab when the server withholds can_open_plans', + (section) => { + endedPlan() + grantOpenPlans(false) + renderBanner(section) + + expect(screen.getByRole('status')).toBeInTheDocument() + expect( + screen.queryByRole('link', { name: 'Choose a plan' }) + ).not.toBeInTheDocument() + } + ) it('points a team member to the owner', () => { endedPlan() @@ -877,7 +910,7 @@ describe('BillingStatusBanner', () => { 'Ask your workspace owner to resubscribe.' ) expect( - screen.queryByRole('button', { name: 'Resubscribe' }) + screen.queryByRole('link', { name: 'Choose a plan' }) ).not.toBeInTheDocument() }) @@ -1097,22 +1130,18 @@ describe('BillingStatusBanner', () => { }, { endDate: null, title: 'Your Creator plan has ended' } ])( - 'tells an ended personal plan "$title" and resubscribes on Personal plans', - async ({ endDate, title }) => { + 'tells an ended personal plan "$title" and offers Choose a plan', + ({ endDate, title }) => { personalPlan('CREATOR') endedPlan(endDate) + grantOpenPlans(true) renderBanner() expect(screen.getByRole('status')).toHaveTextContent(title) expect(screen.getByRole('status')).toHaveTextContent( 'Resubscribe to run workflows and get monthly credits again.' ) - await userEvent.click( - screen.getByRole('button', { name: 'Resubscribe' }) - ) - expect(state.showSubscriptionDialog).toHaveBeenCalledWith( - expect.objectContaining({ planMode: 'personal' }) - ) + expectChoosePlanLink() } ) diff --git a/src/platform/billing/components/settings/BillingStatusBanner.vue b/src/platform/billing/components/settings/BillingStatusBanner.vue index c5e040a570d..8ca137f8b33 100644 --- a/src/platform/billing/components/settings/BillingStatusBanner.vue +++ b/src/platform/billing/components/settings/BillingStatusBanner.vue @@ -48,12 +48,18 @@ {{ $t('workspacePanel.billingStatus.ending.reactivate') }}