From 1a2267202a675dfbfe507abe4903e054e5ba0027 Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Sat, 7 Nov 2026 17:15:15 -0500 Subject: [PATCH 1/2] refactor(billing): render the Billing tab auto top-up card and member block from account-ui BillingTab renders BillingAutoTopUpCard and BillingAutoTopUpMemberBlock from @comfyorg/account-ui/billing. The card's served read, saved payment method read, viewed telemetry and Platform link move into useAutoTopUpCardSection, gated on the card being shown. account-ui's card gains an actionHref prop so the action is the same new-tab link the app rendered, and its status dots use the theme classes the app uses. --- .../billing/tab/BillingAutoTopUpCard.test.ts | 27 ++ .../src/billing/tab/BillingAutoTopUpCard.vue | 30 +- .../billing/tab/BillingBannerActionButton.vue | 16 +- .../src/billing/tab}/BillingInfoTip.test.ts | 3 +- .../dialogs/settings/BillingTab.vue | 35 +- .../BillingAutoTopUpCard.parity.test.ts | 397 ---------------- .../billingTab/BillingAutoTopUpCard.vue | 431 ------------------ .../BillingAutoTopUpMemberCard.parity.test.ts | 144 ------ .../billingTab/BillingAutoTopUpMemberCard.vue | 99 ---- .../components/billingTab/BillingInfoTip.vue | 27 -- .../useAutoTopUpCardSection.test.ts} | 47 +- .../composables/useAutoTopUpCardSection.ts | 108 +++++ .../billing/composables/useAutoTopUpCopy.ts | 75 +++ 13 files changed, 319 insertions(+), 1120 deletions(-) rename {src/platform/billing/components/billingTab => packages/account-ui/src/billing/tab}/BillingInfoTip.test.ts (95%) delete mode 100644 src/platform/billing/components/billingTab/BillingAutoTopUpCard.parity.test.ts delete mode 100644 src/platform/billing/components/billingTab/BillingAutoTopUpCard.vue delete mode 100644 src/platform/billing/components/billingTab/BillingAutoTopUpMemberCard.parity.test.ts delete mode 100644 src/platform/billing/components/billingTab/BillingAutoTopUpMemberCard.vue delete mode 100644 src/platform/billing/components/billingTab/BillingInfoTip.vue rename src/platform/billing/{components/billingTab/BillingAutoTopUpCard.test.ts => composables/useAutoTopUpCardSection.test.ts} (95%) create mode 100644 src/platform/billing/composables/useAutoTopUpCardSection.ts create mode 100644 src/platform/billing/composables/useAutoTopUpCopy.ts diff --git a/packages/account-ui/src/billing/tab/BillingAutoTopUpCard.test.ts b/packages/account-ui/src/billing/tab/BillingAutoTopUpCard.test.ts index 436e39dc638..14177028302 100644 --- a/packages/account-ui/src/billing/tab/BillingAutoTopUpCard.test.ts +++ b/packages/account-ui/src/billing/tab/BillingAutoTopUpCard.test.ts @@ -285,6 +285,33 @@ describe('BillingAutoTopUpCard', () => { ) }) + it('opens the host link in a new tab and reports the action', async () => { + const onAction = vi.fn() + render(BillingAutoTopUpCard, { + props: { + state: loaded({ status: 'failed' }), + offView: 'off', + setup: null, + copy: autoTopUpCardCopy, + locale: 'en', + actionHref: 'https://billing.test/profile/billing', + onAction + } + }) + + const link = screen.getByRole('link', { name: 'Update payment' }) + link.addEventListener('click', (event) => event.preventDefault()) + await userEvent.click(link) + + expect(link.getAttribute('href')).toBe( + 'https://billing.test/profile/billing' + ) + expect(link.getAttribute('target')).toBe('_blank') + expect(link.dataset.variant).toBe('inverted') + expect(screen.queryByRole('button', { name: 'Update payment' })).toBeNull() + expect(onAction).toHaveBeenCalledWith('update_payment') + }) + it('lets the host replace the retry control', () => { render(BillingAutoTopUpCard, { props: { diff --git a/packages/account-ui/src/billing/tab/BillingAutoTopUpCard.vue b/packages/account-ui/src/billing/tab/BillingAutoTopUpCard.vue index c67c8213426..dccaeb6cf3b 100644 --- a/packages/account-ui/src/billing/tab/BillingAutoTopUpCard.vue +++ b/packages/account-ui/src/billing/tab/BillingAutoTopUpCard.vue @@ -90,15 +90,16 @@ :variant="actionVariant" :icon="OPEN" > - - {{ copy.actions[view.actionLabel] }}