Skip to content

Commit 0badb4f

Browse files
committed
subscription page
1 parent 8cc5b52 commit 0badb4f

File tree

16 files changed

+1143
-8
lines changed

16 files changed

+1143
-8
lines changed
64.8 KB
Binary file not shown.

src/components/actionbar/ComfyActionbar.vue

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
)
1515
"
1616
/>
17-
<ComfyQueueButton />
17+
<SubscribeToRun v-if="!activeSubscription" />
18+
<ComfyQueueButton v-else />
1819
</div>
1920
</Panel>
2021
</template>
@@ -30,14 +31,48 @@ import {
3031
} from '@vueuse/core'
3132
import { clamp } from 'es-toolkit/compat'
3233
import Panel from 'primevue/panel'
33-
import type { Ref } from 'vue'
34-
import { computed, inject, nextTick, onMounted, ref, watch } from 'vue'
34+
import type { Component, Ref } from 'vue'
35+
import {
36+
computed,
37+
defineAsyncComponent,
38+
inject,
39+
nextTick,
40+
onMounted,
41+
ref,
42+
watch
43+
} from 'vue'
3544
45+
import { isCloud } from '@/platform/distribution/types'
3646
import { useSettingStore } from '@/platform/settings/settingStore'
3747
import { cn } from '@/utils/tailwindUtil'
3848
3949
import ComfyQueueButton from './ComfyQueueButton.vue'
4050
51+
const activeSubscription = ref(false)
52+
const SubscribeToRun: Component | null = isCloud
53+
? defineAsyncComponent(
54+
() =>
55+
import(
56+
'../../platform/cloud/subscription/components/SubscribeToRun.vue'
57+
)
58+
)
59+
: null
60+
61+
if (isCloud) {
62+
void import('@/platform/cloud/subscription/composables/useSubscription').then(
63+
({ useSubscription }) => {
64+
const { isActiveSubscription } = useSubscription()
65+
watch(
66+
isActiveSubscription,
67+
(value) => {
68+
activeSubscription.value = value
69+
},
70+
{ immediate: true }
71+
)
72+
}
73+
)
74+
}
75+
4176
const settingsStore = useSettingStore()
4277
4378
const position = computed(() => settingsStore.get('Comfy.UseNewMenu'))

src/composables/auth/useFirebaseAuthActions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export const useFirebaseAuthActions = () => {
157157
signUpWithEmail,
158158
updatePassword,
159159
deleteAccount,
160-
accessError
160+
accessError,
161+
reportError
161162
}
162163
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { watch } from 'vue'
2+
3+
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
4+
import { useSubscription } from '@/platform/cloud/subscription/composables/useSubscription'
5+
import { isCloud } from '@/platform/distribution/types'
6+
import { useExtensionService } from '@/services/extensionService'
7+
8+
useExtensionService().registerExtension({
9+
name: 'Comfy.CloudSubscription',
10+
11+
setup: isCloud
12+
? async () => {
13+
const { isLoggedIn } = useCurrentUser()
14+
const { requireActiveSubscription } = useSubscription()
15+
16+
const checkSubscriptionStatus = () => {
17+
if (!isLoggedIn.value) return
18+
19+
void requireActiveSubscription()
20+
}
21+
22+
watch(() => isLoggedIn.value, checkSubscriptionStatus, {
23+
immediate: true
24+
})
25+
}
26+
: undefined
27+
})

src/extensions/core/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ import './widgetInputs'
2626

2727
if (isCloud) {
2828
import('./cloudBadge')
29+
import('./cloudSubscription')
2930
}

src/locales/en/main.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,6 +1772,8 @@
17721772
"failedToInitiateCreditPurchase": "Failed to initiate credit purchase: {error}",
17731773
"failedToAccessBillingPortal": "Failed to access billing portal: {error}",
17741774
"failedToPurchaseCredits": "Failed to purchase credits: {error}",
1775+
"failedToFetchSubscription": "Failed to fetch subscription status: {error}",
1776+
"failedToInitiateSubscription": "Failed to initiate subscription: {error}",
17751777
"unauthorizedDomain": "Your domain {domain} is not authorized to use this service. Please contact {email} to add your domain to the whitelist.",
17761778
"useApiKeyTip": "Tip: Can't access normal login? Use the Comfy API Key option.",
17771779
"nothingSelected": "Nothing selected",
@@ -1908,6 +1910,34 @@
19081910
"added": "Added",
19091911
"accountInitialized": "Account initialized"
19101912
},
1913+
"subscription": {
1914+
"title": "Subscription",
1915+
"comfyCloud": "Comfy Cloud",
1916+
"beta": "BETA",
1917+
"perMonth": "/ month",
1918+
"renewsDate": "Renews {date}",
1919+
"manageSubscription": "Manage subscription",
1920+
"apiNodesBalance": "\"API Nodes\" Credit Balance",
1921+
"apiNodesDescription": "For running commercial/proprietary models",
1922+
"totalCredits": "Total credits",
1923+
"viewUsageHistory": "View usage history",
1924+
"addApiCredits": "Add API credits",
1925+
"yourPlanIncludes": "Your plan includes:",
1926+
"viewMoreDetails": "View more details",
1927+
"learnMore": "Learn more",
1928+
"messageSupport": "Message support",
1929+
"invoiceHistory": "Invoice history",
1930+
"benefits": {
1931+
"benefit1": "$10 in monthly credits for API models — top up when needed",
1932+
"benefit2": "Up to 30 min runtime per job"
1933+
},
1934+
"required": {
1935+
"title": "Subscribe to",
1936+
"waitingForSubscription": "Complete your subscription in the new tab. We'll automatically detect when you're done!",
1937+
"subscribe": "Subscribe"
1938+
},
1939+
"subscribeToRun": "Subscribe to Run"
1940+
},
19111941
"userSettings": {
19121942
"title": "User Settings",
19131943
"name": "Name",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<Button
3+
v-tooltip.bottom="{
4+
value: $t('subscription.subscribeToRun'),
5+
showDelay: 600
6+
}"
7+
class="subscribe-to-run-button"
8+
:label="$t('subscription.subscribeToRun')"
9+
icon="pi pi-lock"
10+
severity="primary"
11+
size="small"
12+
data-testid="subscribe-to-run-button"
13+
@click="showSubscriptionDialog"
14+
/>
15+
</template>
16+
17+
<script setup lang="ts">
18+
import Button from 'primevue/button'
19+
20+
import { useSubscription } from '@/platform/cloud/subscription/composables/useSubscription'
21+
22+
const { showSubscriptionDialog } = useSubscription()
23+
</script>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<template>
2+
<div class="flex flex-col gap-3">
3+
<div class="flex items-center gap-2">
4+
<i class="pi pi-check text-sm" />
5+
<span class="text-sm">
6+
{{ $t('subscription.benefits.benefit1') }}
7+
</span>
8+
</div>
9+
10+
<div class="flex items-center gap-2">
11+
<i class="pi pi-check text-sm" />
12+
<span class="text-sm">
13+
{{ $t('subscription.benefits.benefit2') }}
14+
</span>
15+
</div>
16+
17+
<Button
18+
:label="$t('subscription.viewMoreDetails')"
19+
text
20+
icon="pi pi-external-link"
21+
icon-pos="left"
22+
size="small"
23+
class="self-start !p-0 text-sm hover:!bg-transparent [&]:!text-[inherit]"
24+
@click="handleViewMoreDetails"
25+
/>
26+
</div>
27+
</template>
28+
29+
<script setup lang="ts">
30+
import Button from 'primevue/button'
31+
32+
const handleViewMoreDetails = () => {
33+
window.open('https://www.comfy.org/cloud', '_blank')
34+
}
35+
</script>

0 commit comments

Comments
 (0)