diff --git a/packages/account-ui/src/billing/tab/BillingBanner.stories.ts b/packages/account-ui/src/billing/tab/BillingBanner.stories.ts index 21a9a3eacb2..75e893ccd3e 100644 --- a/packages/account-ui/src/billing/tab/BillingBanner.stories.ts +++ b/packages/account-ui/src/billing/tab/BillingBanner.stories.ts @@ -77,7 +77,9 @@ export const PlanStatus: Story = { view: { kind: 'planStatus', title: 'Your Team plan ends on November 20, 2026', - body: "You won't be charged again. Members keep full access until then. Resume your plan to keep your team's shared credits." + body: "You won't be charged again. Members keep full access until then. Resume your plan to keep your team's shared credits.", + action: 'resumePlan', + href: null } } } diff --git a/packages/account-ui/src/billing/tab/BillingBanner.test.ts b/packages/account-ui/src/billing/tab/BillingBanner.test.ts index e31c1f4ad57..4357a3a7b96 100644 --- a/packages/account-ui/src/billing/tab/BillingBanner.test.ts +++ b/packages/account-ui/src/billing/tab/BillingBanner.test.ts @@ -104,7 +104,7 @@ describe('BillingBanner', () => { }, { case: 'a plan status', - view: { kind: 'planStatus', ...text }, + view: { kind: 'planStatus', ...text, action: null, href: null }, controls: [], icon: 'text-muted-foreground', shell: ['rounded-2xl', 'p-4'] @@ -168,9 +168,24 @@ describe('BillingBanner', () => { }, role: 'link', name: 'Contact support' + }, + { + view: { kind: 'planStatus', ...text, action: 'resumePlan', href: null }, + role: 'button', + name: 'Resume plan' + }, + { + view: { + kind: 'planStatus', + ...text, + action: 'choosePlan', + href: 'https://platform.test/profile/billing/plans' + }, + role: 'link', + name: 'Choose a plan' } ])( - 'emits the $view.kind action instead of performing it', + 'emits the $view.kind $view.action action instead of performing it', async ({ view, role, name }) => { const { onAction } = renderBanner(view) const control = screen.getByRole(role, { name }) @@ -209,7 +224,10 @@ describe('BillingBanner', () => { }, row: 'sm:flex-row' }, - { view: { kind: 'planStatus', ...text }, row: '@2xl:flex-row' }, + { + view: { kind: 'planStatus', ...text, action: null, href: null }, + row: '@2xl:flex-row' + }, { view: { kind: 'topupCheckout', diff --git a/packages/account-ui/src/billing/tab/__fixtures__/bannerCopy.ts b/packages/account-ui/src/billing/tab/__fixtures__/bannerCopy.ts index e943dca2609..d2679ab757a 100644 --- a/packages/account-ui/src/billing/tab/__fixtures__/bannerCopy.ts +++ b/packages/account-ui/src/billing/tab/__fixtures__/bannerCopy.ts @@ -6,7 +6,10 @@ export const billingBannerCopy: BillingBannerCopy = { addCredits: 'Add credits', updatePayment: 'Update payment', verifyPayment: 'Complete verification', - contactSupport: 'Contact support' + contactSupport: 'Contact support', + resumePlan: 'Resume plan', + choosePlan: 'Choose a plan', + contactSales: 'Contact sales' }, planCheckout: { verifyPayment: { diff --git a/packages/account-ui/src/billing/tab/billingBannerView.test.ts b/packages/account-ui/src/billing/tab/billingBannerView.test.ts index 67b6f5708b2..f51fd271a85 100644 --- a/packages/account-ui/src/billing/tab/billingBannerView.test.ts +++ b/packages/account-ui/src/billing/tab/billingBannerView.test.ts @@ -37,7 +37,7 @@ const views: Record = { action: 'contactSupport', href: 'https://comfy.org/contact/' }, - planStatus: { kind: 'planStatus', ...text }, + planStatus: { kind: 'planStatus', ...text, action: null, href: null }, autoTopUp: { kind: 'autoTopUp', ...text, diff --git a/packages/account-ui/src/billing/tab/billingBannerView.ts b/packages/account-ui/src/billing/tab/billingBannerView.ts index 30ed36c3b28..c71141d7ce8 100644 --- a/packages/account-ui/src/billing/tab/billingBannerView.ts +++ b/packages/account-ui/src/billing/tab/billingBannerView.ts @@ -9,6 +9,9 @@ export type BillingBannerAction = | 'updatePayment' | 'verifyPayment' | 'contactSupport' + | 'resumePlan' + | 'choosePlan' + | 'contactSales' export interface BillingBannerText { readonly title: string @@ -40,7 +43,11 @@ export type BillingBannerView = BillingBannerText & readonly action: 'contactSupport' readonly href: string } - | { readonly kind: 'planStatus' } + | { + readonly kind: 'planStatus' + readonly action: 'resumePlan' | 'choosePlan' | 'contactSales' | null + readonly href: string | null + } | { readonly kind: 'autoTopUp' readonly action: 'updatePayment' @@ -150,7 +157,7 @@ export function billingBannerLook(view: BillingBannerView): BillingBannerLook { windowBreakpoint: true } case 'planStatus': - return look(true, true, null) + return look(true, true, view.action, view.href) case 'autoTopUp': return look(false, false, view.action, view.href) case 'credit': diff --git a/src/platform/account/components/dialogs/settings/BillingTab.test.ts b/src/platform/account/components/dialogs/settings/BillingTab.test.ts index 7320266dc69..2a5a9de8497 100644 --- a/src/platform/account/components/dialogs/settings/BillingTab.test.ts +++ b/src/platform/account/components/dialogs/settings/BillingTab.test.ts @@ -1073,17 +1073,74 @@ 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) + }) + + 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 plansLink = { + variant: 'inverted', + href: expect.stringMatching( + /^https:\/\/platform\.test\/profile\/billing\/plans\?workspace=ws_1&correlation_id=.+$/ + ) + } + expect( + screen + .getAllByRole('link', { name: 'Choose a plan' }) + .map((link) => ({ + variant: link.dataset.variant, + href: link.getAttribute('href') + })) + ).toEqual([plansLink, plansLink]) + 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', () => { @@ -1470,18 +1527,29 @@ describe('BillingTab', () => { isCloud: true, choosePlan: 'inverted', addCredits: 'secondary', - planEndedBanners: 1 + planEndedBanners: 1, + choosePlanLinks: 2, + whiteActions: 2 }, { surface: 'local ComfyUI', isCloud: false, choosePlan: 'secondary', addCredits: 'inverted', - planEndedBanners: 0 + planEndedBanners: 0, + choosePlanLinks: 1, + whiteActions: 1 } ])( - 'keeps one white button on $surface when an ended plan is out of credits', - async ({ isCloud, choosePlan, addCredits, planEndedBanners }) => { + 'keeps one white action on $surface when an ended plan is out of credits', + async ({ + isCloud, + choosePlan, + addCredits, + planEndedBanners, + choosePlanLinks, + whiteActions + }) => { distribution.isCloud = isCloud onTestFinished(() => { distribution.isCloud = false @@ -1493,9 +1561,12 @@ describe('BillingTab', () => { }) await screen.findByTestId('billing-auto-top-up-status') - expect( - screen.getByRole('link', { name: 'Choose a plan' }) - ).toHaveAttribute('data-variant', choosePlan) + const choosePlanVariants = screen + .getAllByRole('link', { name: 'Choose a plan' }) + .map((link) => link.dataset.variant) + expect(choosePlanVariants).toEqual( + Array(choosePlanLinks).fill(choosePlan) + ) expect(addCreditsVariants()).toEqual([addCredits]) expect(screen.queryAllByText(/^Your .*plan has ended$/)).toHaveLength( planEndedBanners @@ -1505,7 +1576,7 @@ describe('BillingTab', () => { ...screen.queryAllByRole('button'), ...screen.queryAllByRole('link') ].filter((el) => el.dataset.variant === 'inverted') - ).toHaveLength(1) + ).toHaveLength(whiteActions) } ) @@ -2037,7 +2108,7 @@ describe('BillingTab banner stack parity with selectBillingBanners', () => { action: 'contactSupport', href: 'https://comfy.org/contact/' }, - planStatus: { kind: 'planStatus', ...text }, + planStatus: { kind: 'planStatus', ...text, action: null, href: null }, autoTopUp: { kind: 'autoTopUp', ...text, diff --git a/src/platform/billing/components/billingTab/BillingBanner.parity.test.ts b/src/platform/billing/components/billingTab/BillingBanner.parity.test.ts index 5a2349d3871..f904f997d59 100644 --- a/src/platform/billing/components/billingTab/BillingBanner.parity.test.ts +++ b/src/platform/billing/components/billingTab/BillingBanner.parity.test.ts @@ -66,7 +66,10 @@ const copy: BillingBannerCopy = { addCredits: t('workspacePanel.billingTab.credits.addCredits'), updatePayment: t(`${bs}.updatePayment`), verifyPayment: t(`${bs}.planCheckout.verifyPayment.action`), - contactSupport: t(`${bs}.parked.contactSupport`) + contactSupport: t(`${bs}.parked.contactSupport`), + resumePlan: t(`${bs}.ending.reactivate`), + choosePlan: t('workspacePanel.billingTab.plan.actions.choosePlan'), + contactSales: t(`${bs}.ending.contactSales`) }, planCheckout: { verifyPayment: { diff --git a/src/platform/billing/components/billingTab/BillingLocalCreditBanner.parity.test.ts b/src/platform/billing/components/billingTab/BillingLocalCreditBanner.parity.test.ts index 704036c0301..8542c5358ba 100644 --- a/src/platform/billing/components/billingTab/BillingLocalCreditBanner.parity.test.ts +++ b/src/platform/billing/components/billingTab/BillingLocalCreditBanner.parity.test.ts @@ -67,7 +67,10 @@ const copy: Pick = { addCredits: t(`${bs}.outOfCredits.addCredits`), updatePayment: t(`${bs}.updatePayment`), verifyPayment: t(`${bs}.planCheckout.verifyPayment.action`), - contactSupport: t(`${bs}.parked.contactSupport`) + contactSupport: t(`${bs}.parked.contactSupport`), + resumePlan: t(`${bs}.ending.reactivate`), + choosePlan: t('workspacePanel.billingTab.plan.actions.choosePlan'), + contactSales: t(`${bs}.ending.contactSales`) } } diff --git a/src/platform/billing/components/settings/BillingStatusBanner.parity.test.ts b/src/platform/billing/components/settings/BillingStatusBanner.parity.test.ts index e775cdd4a9a..6c3ea04adc0 100644 --- a/src/platform/billing/components/settings/BillingStatusBanner.parity.test.ts +++ b/src/platform/billing/components/settings/BillingStatusBanner.parity.test.ts @@ -99,7 +99,10 @@ const copy: Pick = { addCredits: t(`${bs}.outOfCredits.addCredits`), updatePayment: t(`${bs}.updatePayment`), verifyPayment: t(`${bs}.planCheckout.verifyPayment.action`), - contactSupport: t(`${bs}.parked.contactSupport`) + contactSupport: t(`${bs}.parked.contactSupport`), + resumePlan: t(`${bs}.ending.reactivate`), + choosePlan: t('workspacePanel.billingTab.plan.actions.choosePlan'), + contactSales: t(`${bs}.ending.contactSales`) } } @@ -173,12 +176,14 @@ describe('BillingBanner parity with the Billing tab plan status banner', () => { enter: () => void title: () => string body: () => string + action?: 'resumePlan' | 'choosePlan' | 'contactSales' }>([ { case: 'a team plan ending', enter: () => ending(), title: () => t(`${bs}.ending.title`, { date: 'October 28, 2026' }), - body: () => t(`${bs}.ending.body`) + body: () => t(`${bs}.ending.body`), + action: 'resumePlan' }, { case: 'a team plan ending, for a member', @@ -200,7 +205,8 @@ describe('BillingBanner parity with the Billing tab plan status banner', () => { plan: 'Pro', date: 'October 28, 2026' }), - body: () => t(`${bs}.ending.personalBody`) + body: () => t(`${bs}.ending.personalBody`), + action: 'resumePlan' }, { case: 'an Enterprise plan ending inside the notice window', @@ -211,7 +217,8 @@ describe('BillingBanner parity with the Billing tab plan status banner', () => { }, title: () => t(`${bs}.ending.enterpriseTitle`, { date: 'October 28, 2026' }), - body: () => t(`${bs}.ending.enterpriseBody`) + body: () => t(`${bs}.ending.enterpriseBody`), + action: 'contactSales' }, { case: 'a scheduled plan change', @@ -261,7 +268,7 @@ describe('BillingBanner parity with the Billing tab plan status banner', () => { }), body: () => t(`${bs}.planEnded.personalBody`) } - ])('renders $case the same', ({ enter, title, body }) => { + ])('renders $case the same', ({ enter, title, body, action = null }) => { enter() const app = render(BillingStatusBanner, { props: { section: 'billing' }, @@ -272,7 +279,13 @@ describe('BillingBanner parity with the Billing tab plan status banner', () => { const pkg = render(BillingBanner, { props: { - view: { kind: 'planStatus', title: title(), body: body() }, + view: { + kind: 'planStatus', + title: title(), + body: body(), + action, + href: null + }, copy } }) diff --git a/src/platform/billing/components/settings/BillingStatusBanner.stories.ts b/src/platform/billing/components/settings/BillingStatusBanner.stories.ts index e8c35cb8340..47a4d260e79 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' @@ -30,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 @@ -69,17 +76,30 @@ const member: Partial = { function story( billing: Partial, workspace: Partial, - capabilities: { canTopUp?: boolean; canSubscribeSelfServe?: boolean } = {} + capabilities: { + canTopUp?: boolean + canSubscribeSelfServe?: boolean + canOpenPlans?: boolean + } = {} ): Story { + const canManageSubscription = workspace.canManageSubscription ?? true + const served = { + canTopUp: true, + canSubscribeSelfServe: false, + canOpenPlans: canManageSubscription, + ...capabilities + } return { beforeEach() { - // Dates in the copy go through vue-i18n's `d()`, so pin the locale rather - // than inherit the developer's. i18n.global.locale.value = 'en' setBillingContextMock({ isTeamPlan: true, ...billing }) setWorkspaceUIMock(workspace) - setCanTopUpMock(capabilities.canTopUp ?? true) - setCanSubscribeSelfServeMock(capabilities.canSubscribeSelfServe ?? false) + setBillingCapabilitiesMock({ + canManageSubscription, + canOpenPlans: served.canOpenPlans + }) + setCanTopUpMock(served.canTopUp) + setCanSubscribeSelfServeMock(served.canSubscribeSelfServe) } } } diff --git a/src/platform/billing/components/settings/BillingStatusBanner.test.ts b/src/platform/billing/components/settings/BillingStatusBanner.test.ts index 932b6eddb5b..20f93852982 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( @@ -111,12 +111,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, @@ -133,8 +151,8 @@ const i18n = createI18n({ } }, 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' @@ -320,7 +338,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', @@ -328,7 +347,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', @@ -340,7 +360,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', @@ -356,16 +377,24 @@ describe('BillingStatusBanner', () => { tier: 'PRO' } }, - text: 'Your Team plan ended on September 12, 2026' + text: 'Your Team plan ended on September 12, 2026', + buttons: [] } - ])('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([ { @@ -398,6 +427,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 } @@ -984,18 +1030,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() @@ -1006,13 +1067,16 @@ describe('BillingStatusBanner', () => { 'Ask your workspace owner to resubscribe.' ) expect( - screen.queryByRole('button', { name: 'Resubscribe' }) + screen.queryByRole('link', { name: 'Choose a plan' }) ).not.toBeInTheDocument() }) it('sends an Enterprise owner to sales', async () => { endedPlan('ENTERPRISE') state.isTeamPlan = false + useBillingCapabilities().planKind = computed(() => + receiveServerFact('plan_kind', 'sales_managed') + ) const open = vi.spyOn(window, 'open').mockReturnValue(null) renderBanner() @@ -1030,6 +1094,25 @@ describe('BillingStatusBanner', () => { open.mockRestore() }) + it.for(['members', 'billing'] as const)( + 'offers Contact sales instead of Choose a plan on the %s tab when the server serves plan_kind sales_managed', + (section) => { + endedPlan('PRO') + grantOpenPlans(true) + useBillingCapabilities().planKind = computed(() => + receiveServerFact('plan_kind', 'sales_managed') + ) + renderBanner(section) + + expect( + screen.getByRole('button', { name: 'Contact sales' }) + ).toBeInTheDocument() + expect( + screen.queryByRole('link', { name: 'Choose a plan' }) + ).not.toBeInTheDocument() + } + ) + it('dismisses for the session', async () => { endedPlan() renderBanner() @@ -1226,22 +1309,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 5ae5bbe625e..883eb62b023 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') }}