From e7f640b43666cf886f1ff34751ff7f3bd798dc97 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Tue, 28 Oct 2025 16:00:27 -0400 Subject: [PATCH] subscription improve (#6339) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Run keyboard shortcut bypasses paywall Top Up button visible before paywall (confusing - hide until subscribed) Question mark icon next to commercial models has no tooltip (hide until added) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6339-subscription-improve-29a6d73d3650818e92c7f60eda01646a) by [Unito](https://www.unito.io) --------- Co-authored-by: bymyself --- .../topbar/CurrentUserPopover.test.ts | 16 ++++++++++ src/components/topbar/CurrentUserPopover.vue | 8 ++++- src/composables/useCoreCommands.ts | 18 +++++++++++ src/locales/en/main.json | 1 + .../components/SubscriptionPanel.vue | 30 +++++++++++-------- .../composables/useSubscription.ts | 21 ++++++++++++- .../tests/composables/useCoreCommands.test.ts | 7 +++++ 7 files changed, 86 insertions(+), 15 deletions(-) diff --git a/src/components/topbar/CurrentUserPopover.test.ts b/src/components/topbar/CurrentUserPopover.test.ts index a7e965b21..37eba212f 100644 --- a/src/components/topbar/CurrentUserPopover.test.ts +++ b/src/components/topbar/CurrentUserPopover.test.ts @@ -69,6 +69,22 @@ vi.mock('@/services/dialogService', () => ({ })) })) +// Mock the firebaseAuthStore +vi.mock('@/stores/firebaseAuthStore', () => ({ + useFirebaseAuthStore: vi.fn(() => ({ + getAuthHeader: vi + .fn() + .mockResolvedValue({ Authorization: 'Bearer mock-token' }) + })) +})) + +// Mock the useSubscription composable +vi.mock('@/platform/cloud/subscription/composables/useSubscription', () => ({ + useSubscription: vi.fn(() => ({ + isActiveSubscription: vi.fn().mockReturnValue(true) + })) +})) + // Mock UserAvatar component vi.mock('@/components/common/UserAvatar.vue', () => ({ default: { diff --git a/src/components/topbar/CurrentUserPopover.vue b/src/components/topbar/CurrentUserPopover.vue index 7fda0fa2f..dce81dffb 100644 --- a/src/components/topbar/CurrentUserPopover.vue +++ b/src/components/topbar/CurrentUserPopover.vue @@ -67,7 +67,11 @@
-
@@ -82,6 +86,7 @@ import UserAvatar from '@/components/common/UserAvatar.vue' import UserCredit from '@/components/common/UserCredit.vue' import { useCurrentUser } from '@/composables/auth/useCurrentUser' import { useFirebaseAuthActions } from '@/composables/auth/useFirebaseAuthActions' +import { useSubscription } from '@/platform/cloud/subscription/composables/useSubscription' import { useDialogService } from '@/services/dialogService' const emit = defineEmits<{ @@ -92,6 +97,7 @@ const { userDisplayName, userEmail, userPhotoUrl, handleSignOut } = useCurrentUser() const authActions = useFirebaseAuthActions() const dialogService = useDialogService() +const { isActiveSubscription } = useSubscription() const handleOpenUserSettings = () => { dialogService.showSettingsDialog('user') diff --git a/src/composables/useCoreCommands.ts b/src/composables/useCoreCommands.ts index 65de98fcc..3bf3e8582 100644 --- a/src/composables/useCoreCommands.ts +++ b/src/composables/useCoreCommands.ts @@ -21,6 +21,7 @@ import { import type { Point } from '@/lib/litegraph/src/litegraph' import { useAssetBrowserDialog } from '@/platform/assets/composables/useAssetBrowserDialog' import { createModelNodeFromAsset } from '@/platform/assets/utils/createModelNodeFromAsset' +import { useSubscription } from '@/platform/cloud/subscription/composables/useSubscription' import { isCloud } from '@/platform/distribution/types' import { useSettingStore } from '@/platform/settings/settingStore' import { SUPPORT_URL } from '@/platform/support/config' @@ -63,6 +64,8 @@ import { ManagerTab } from '@/workbench/extensions/manager/types/comfyManagerTyp import { useWorkflowTemplateSelectorDialog } from './useWorkflowTemplateSelectorDialog' +const { isActiveSubscription, showSubscriptionDialog } = useSubscription() + const moveSelectedNodesVersionAdded = '1.22.2' export function useCoreCommands(): ComfyCommand[] { @@ -453,6 +456,11 @@ export function useCoreCommands(): ComfyCommand[] { versionAdded: '1.3.7', category: 'essentials' as const, function: async () => { + if (!isActiveSubscription.value) { + showSubscriptionDialog() + return + } + const batchCount = useQueueSettingsStore().batchCount if (isCloud) { @@ -469,6 +477,11 @@ export function useCoreCommands(): ComfyCommand[] { versionAdded: '1.3.7', category: 'essentials' as const, function: async () => { + if (!isActiveSubscription.value) { + showSubscriptionDialog() + return + } + const batchCount = useQueueSettingsStore().batchCount if (isCloud) { @@ -484,6 +497,11 @@ export function useCoreCommands(): ComfyCommand[] { label: 'Queue Selected Output Nodes', versionAdded: '1.19.6', function: async () => { + if (!isActiveSubscription.value) { + showSubscriptionDialog() + return + } + const batchCount = useQueueSettingsStore().batchCount const selectedNodes = getSelectedNodes() const selectedOutputNodes = filterOutputNodes(selectedNodes) diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 344125665..c61de2e67 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -1640,6 +1640,7 @@ "beta": "BETA", "perMonth": "USD / month", "renewsDate": "Renews {date}", + "expiresDate": "Expires {date}", "manageSubscription": "Manage subscription", "apiNodesBalance": "\"API Nodes\" Credit Balance", "apiNodesDescription": "For running commercial/proprietary models", diff --git a/src/platform/cloud/subscription/components/SubscriptionPanel.vue b/src/platform/cloud/subscription/components/SubscriptionPanel.vue index fa751d47b..292200fd9 100644 --- a/src/platform/cloud/subscription/components/SubscriptionPanel.vue +++ b/src/platform/cloud/subscription/components/SubscriptionPanel.vue @@ -23,11 +23,20 @@ {{ $t('subscription.perMonth') }}
- {{ - $t('subscription.renewsDate', { - date: formattedRenewalDate - }) - }} + +