diff --git a/src/platform/workspace/components/dialogs/settings/billing/BillingPlanRow.vue b/src/platform/workspace/components/dialogs/settings/billing/BillingPlanRow.vue
index 738b8e65917..075960856dd 100644
--- a/src/platform/workspace/components/dialogs/settings/billing/BillingPlanRow.vue
+++ b/src/platform/workspace/components/dialogs/settings/billing/BillingPlanRow.vue
@@ -19,16 +19,11 @@
@@ -45,7 +40,6 @@ import type {
PlanRowAction,
PlanRowState
} from '@/platform/workspace/components/dialogs/settings/billing/planRow'
-import { usePlatformHandoff } from '@/platform/workspace/composables/usePlatformHandoff'
const { state, action, canManageSubscription } = defineProps<{
state: PlanRowState
@@ -53,11 +47,11 @@ const { state, action, canManageSubscription } = defineProps<{
canManageSubscription: boolean
}>()
-const { t, locale } = useI18n()
+const emit = defineEmits<{
+ openPlan: []
+}>()
-const { href, track } = usePlatformHandoff('/profile/billing/plans', {
- target: 'plans'
-})
+const { t, locale } = useI18n()
const title = computed(() => {
if (state.kind === 'noPlan') {
diff --git a/src/platform/workspace/components/dialogs/settings/billing/BillingTab.test.ts b/src/platform/workspace/components/dialogs/settings/billing/BillingTab.test.ts
index 45a2f2b88da..5a7c93c1323 100644
--- a/src/platform/workspace/components/dialogs/settings/billing/BillingTab.test.ts
+++ b/src/platform/workspace/components/dialogs/settings/billing/BillingTab.test.ts
@@ -10,6 +10,7 @@ import type { SubscriptionState } from '@comfyorg/ingest-types'
import enMessages from '@/locales/en/main.json'
import { useBillingContext } from '@/composables/billing/useBillingContext'
import { useBillingDialogs } from '@/composables/billing/useBillingDialogs'
+import { useSubscriptionPaywall } from '@/composables/billing/useSubscriptionPaywall'
import type { BalanceInfo, SubscriptionInfo } from '@/composables/billing/types'
import { useFeatureFlags } from '@/composables/useFeatureFlags'
import { receiveServerFact } from '@/platform/serverFacts/serverFact'
@@ -31,6 +32,7 @@ vi.mock(import('@/platform/workspace/composables/usePausedBanner'), {
})
vi.mock(import('@/composables/billing/useBillingContext'))
vi.mock(import('@/composables/billing/useBillingDialogs'))
+vi.mock(import('@/composables/billing/useSubscriptionPaywall'))
vi.mock(import('@/composables/useFeatureFlags'))
vi.mock(import('@/platform/workspace/composables/useBillingCapabilities'))
vi.mock(import('@/platform/workspace/composables/useWorkspaceUI'))
@@ -271,7 +273,7 @@ describe('BillingTab', () => {
expect(screen.getByTestId('billing-plan-line')).toHaveTextContent(
'Activating your Pro plan…'
)
- expect(screen.getByRole('link', { name: 'Manage' })).toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'Manage' })).toBeInTheDocument()
})
it('returns to the served status when subscription_state is no longer activating', () => {
@@ -283,19 +285,17 @@ describe('BillingTab', () => {
expect(screen.queryByText(/Activating your/)).not.toBeInTheDocument()
})
- it('renders an active plan with Manage and the owner handoff linked to the billing site', () => {
+ it('opens plan management on Cloud instead of a platform plans page', async () => {
arrange()
- expect(screen.getByRole('heading', { name: 'Pro' })).toBeInTheDocument()
- expect(screen.getByTestId('billing-plan-line')).toHaveTextContent(
- 'Billed monthly. Next invoice November 15.'
- )
- expect(screen.getByRole('link', { name: 'Manage' })).toHaveAttribute(
- 'href',
- expect.stringMatching(
- /^https:\/\/platform\.test\/profile\/billing\/plans\?workspace=ws_1&correlation_id=.+$/
- )
- )
+ expect(
+ screen.queryByRole('link', { name: 'Manage' })
+ ).not.toBeInTheDocument()
+ await userEvent.click(screen.getByRole('button', { name: 'Manage' }))
+
+ expect(
+ useSubscriptionPaywall().showSubscriptionDialog
+ ).toHaveBeenCalledWith({ reason: 'settings_billing_panel' })
expect(screen.getByRole('link', { name: 'Open billing' })).toHaveAttribute(
'href',
expect.stringMatching(
@@ -304,11 +304,24 @@ describe('BillingTab', () => {
)
})
+ it('opens Subscribe on Cloud for a workspace with no plan', async () => {
+ arrange({ subscription: null, subscriptionStatus: null })
+
+ expect(
+ screen.queryByRole('link', { name: 'Subscribe' })
+ ).not.toBeInTheDocument()
+ await userEvent.click(screen.getByRole('button', { name: 'Subscribe' }))
+
+ expect(
+ useSubscriptionPaywall().showSubscriptionDialog
+ ).toHaveBeenCalledWith({ reason: 'settings_billing_panel' })
+ })
+
it('hides the plan action when the server does not grant it', () => {
arrange({ canSubscribeSelfServe: false })
expect(
- screen.queryByRole('link', { name: 'Manage' })
+ screen.queryByRole('button', { name: 'Manage' })
).not.toBeInTheDocument()
})
@@ -369,12 +382,6 @@ describe('BillingTab', () => {
)
it.for([
- {
- name: 'the plan action',
- scenario: { canManageBilling: true },
- link: 'Manage',
- destination: { target: 'plans' }
- },
{
name: 'the owner handoff',
scenario: { canManageBilling: true },
diff --git a/src/platform/workspace/components/dialogs/settings/billing/BillingTab.vue b/src/platform/workspace/components/dialogs/settings/billing/BillingTab.vue
index 271e9b544da..903d900e184 100644
--- a/src/platform/workspace/components/dialogs/settings/billing/BillingTab.vue
+++ b/src/platform/workspace/components/dialogs/settings/billing/BillingTab.vue
@@ -31,6 +31,7 @@
:state="planRow"
:action="action"
:can-manage-subscription="capabilities.canManageSubscription.value"
+ @open-plan="openPlan"
/>
undefined)
}
+function openPlan() {
+ showSubscriptionDialog({ reason: 'settings_billing_panel' })
+}
+
function addCredits() {
telemetry?.trackAddApiCreditButtonClicked({ source: 'credits_panel' })
void showTopUpCreditsDialog({