From 4cc5022e35a0ad7afd5095f87d411c4c1228e7a3 Mon Sep 17 00:00:00 2001 From: dante01yoon <6510430+dante01yoon@users.noreply.github.com> Date: Mon, 3 Aug 2026 17:02:02 +0000 Subject: [PATCH 01/10] feat(billing): unify billing and invoice portal action Co-authored-by: Amp Amp-Thread-ID: https://ampcode.com/threads/T-019fc87c-d73e-7635-83db-1f7c0e65e42d --- src/locales/en/main.json | 2 - .../SubscriptionFooterLinks.test.ts | 38 +++++-------------- .../components/SubscriptionFooterLinks.vue | 22 ----------- .../SubscriptionPanelContentWorkspace.test.ts | 32 +++++++--------- .../SubscriptionPanelContentWorkspace.vue | 20 ++++++---- 5 files changed, 36 insertions(+), 78 deletions(-) diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 5a7e77d75b3..ebe9b1dee28 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -2655,7 +2655,6 @@ "changesToPlanOnDate": "Changes to {plan} on {date}", "manageSubscription": "Manage subscription", "billingAndInvoices": "Billing & invoices", - "manageBilling": "Manage billing", "changePlan": "Change plan", "cancelPlan": "Cancel plan", "canceled": "Canceled", @@ -2762,7 +2761,6 @@ "saveYearly": "Save 20%", "tierNameYearly": "{name} Yearly", "messageSupport": "Message support", - "invoiceHistory": "Invoice history", "refreshCredits": "Refresh credits", "benefits": { "benefit1": "Monthly credits for Partner Nodes — top up when needed", diff --git a/src/platform/cloud/subscription/components/SubscriptionFooterLinks.test.ts b/src/platform/cloud/subscription/components/SubscriptionFooterLinks.test.ts index 80af44467aa..25e267092ad 100644 --- a/src/platform/cloud/subscription/components/SubscriptionFooterLinks.test.ts +++ b/src/platform/cloud/subscription/components/SubscriptionFooterLinks.test.ts @@ -1,23 +1,15 @@ import { render, screen } from '@testing-library/vue' -import userEvent from '@testing-library/user-event' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { ref } from 'vue' import { createI18n } from 'vue-i18n' import SubscriptionFooterLinks from './SubscriptionFooterLinks.vue' const state = vi.hoisted(() => ({ - manageSubscription: vi.fn(), handleLearnMoreClick: vi.fn(), handleMessageSupport: vi.fn() })) -vi.mock('@/composables/billing/useBillingContext', () => ({ - useBillingContext: () => ({ - manageSubscription: state.manageSubscription - }) -})) - vi.mock('@/composables/useExternalLink', () => ({ useExternalLink: () => ({ buildDocsUrl: vi.fn(() => 'https://docs.comfy.org/partner-nodes'), @@ -44,16 +36,14 @@ const i18n = createI18n({ subscription: { learnMore: 'Learn more', partnerNodesPricingTable: 'Partner Nodes pricing', - messageSupport: 'Message support', - invoiceHistory: 'Invoice history' + messageSupport: 'Message support' } } } }) -function renderComponent(showInvoiceHistory?: boolean) { +function renderComponent() { return render(SubscriptionFooterLinks, { - props: showInvoiceHistory === undefined ? {} : { showInvoiceHistory }, global: { plugins: [i18n], stubs: { @@ -68,28 +58,20 @@ function renderComponent(showInvoiceHistory?: boolean) { } describe('SubscriptionFooterLinks', () => { - beforeEach(() => { - vi.clearAllMocks() - }) - - it('keeps Invoice history visible by default for legacy billing', async () => { - const user = userEvent.setup() + it('renders support links without a duplicate invoice action', () => { renderComponent() - await user.click(screen.getByRole('button', { name: 'Invoice history' })) - - expect(state.manageSubscription).toHaveBeenCalledOnce() - }) - - it('hides Invoice history without opening the payment portal', () => { - renderComponent(false) - expect( screen.queryByRole('button', { name: 'Invoice history' }) ).not.toBeInTheDocument() expect( screen.getByRole('button', { name: 'Learn more' }) ).toBeInTheDocument() - expect(state.manageSubscription).not.toHaveBeenCalled() + expect( + screen.getByRole('button', { name: 'Partner Nodes pricing' }) + ).toBeInTheDocument() + expect( + screen.getByRole('button', { name: 'Message support' }) + ).toBeInTheDocument() }) }) diff --git a/src/platform/cloud/subscription/components/SubscriptionFooterLinks.vue b/src/platform/cloud/subscription/components/SubscriptionFooterLinks.vue index d9f08c0ff10..d1e104ecb92 100644 --- a/src/platform/cloud/subscription/components/SubscriptionFooterLinks.vue +++ b/src/platform/cloud/subscription/components/SubscriptionFooterLinks.vue @@ -29,41 +29,19 @@ {{ $t('subscription.messageSupport') }} - -