diff --git a/.env_example b/.env_example index b77b87bc0e..d8624b1ec1 100644 --- a/.env_example +++ b/.env_example @@ -42,3 +42,7 @@ ALGOLIA_API_KEY=684d998c36b67a9a9fce8fc2d8860579 # SENTRY_AUTH_TOKEN=private-token # get from sentry # SENTRY_ORG=comfy-org # SENTRY_PROJECT=cloud-frontend-staging + +# Stripe pricing table configuration (used by feature-flagged subscription tiers UI) +# VITE_STRIPE_PUBLISHABLE_KEY=pk_test_123 +# VITE_STRIPE_PRICING_TABLE_ID=prctbl_123 diff --git a/global.d.ts b/global.d.ts index 7f7dd832f8..d24c7c40b5 100644 --- a/global.d.ts +++ b/global.d.ts @@ -13,6 +13,8 @@ interface Window { max_upload_size?: number comfy_api_base_url?: string comfy_platform_base_url?: string + stripe_publishable_key?: string + stripe_pricing_table_id?: string firebase_config?: { apiKey: string authDomain: string diff --git a/src/config/stripePricingTableConfig.ts b/src/config/stripePricingTableConfig.ts new file mode 100644 index 0000000000..6c1f0e0cf1 --- /dev/null +++ b/src/config/stripePricingTableConfig.ts @@ -0,0 +1,34 @@ +import { remoteConfig } from '@/platform/remoteConfig/remoteConfig' + +export const STRIPE_PRICING_TABLE_SCRIPT_SRC = + 'https://js.stripe.com/v3/pricing-table.js' + +interface StripePricingTableConfig { + publishableKey: string + pricingTableId: string +} + +function getEnvValue( + key: 'VITE_STRIPE_PUBLISHABLE_KEY' | 'VITE_STRIPE_PRICING_TABLE_ID' +) { + return import.meta.env[key] +} + +export function getStripePricingTableConfig(): StripePricingTableConfig { + const publishableKey = + remoteConfig.value.stripe_publishable_key || + window.__CONFIG__?.stripe_publishable_key || + getEnvValue('VITE_STRIPE_PUBLISHABLE_KEY') || + '' + + const pricingTableId = + remoteConfig.value.stripe_pricing_table_id || + window.__CONFIG__?.stripe_pricing_table_id || + getEnvValue('VITE_STRIPE_PRICING_TABLE_ID') || + '' + + return { + publishableKey, + pricingTableId + } +} diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 73908a3767..f7cbee358e 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -97,6 +97,7 @@ "no": "No", "cancel": "Cancel", "close": "Close", + "or": "or", "pressKeysForNewBinding": "Press keys for new binding", "defaultBanner": "default banner", "enableOrDisablePack": "Enable or disable pack", @@ -1894,10 +1895,20 @@ "waitingForSubscription": "Complete your subscription in the new tab. We'll automatically detect when you're done!", "subscribe": "Subscribe" }, + "pricingTable": { + "description": "Access cloud-powered ComfyUI workflows with straightforward, usage-based pricing.", + "loading": "Loading pricing options...", + "loadError": "We couldn't load the pricing table. Please refresh and try again.", + "missingConfig": "Stripe pricing table configuration missing. Provide the publishable key and pricing table ID via remote config or .env." + }, "subscribeToRun": "Subscribe", "subscribeToRunFull": "Subscribe to Run", "subscribeNow": "Subscribe Now", "subscribeToComfyCloud": "Subscribe to Comfy Cloud", + "description": "Choose the best plan for you", + "haveQuestions": "Have questions or wondering about enterprise?", + "contactUs": "Contact us", + "viewEnterprise": "view enterprise", "partnerNodesCredits": "Partner Nodes pricing table" }, "userSettings": { diff --git a/src/platform/cloud/subscription/components/StripePricingTable.vue b/src/platform/cloud/subscription/components/StripePricingTable.vue new file mode 100644 index 0000000000..8efa7c21ed --- /dev/null +++ b/src/platform/cloud/subscription/components/StripePricingTable.vue @@ -0,0 +1,117 @@ + + + diff --git a/src/platform/cloud/subscription/components/SubscribeButton.vue b/src/platform/cloud/subscription/components/SubscribeButton.vue index be57d3dada..670fb48b0c 100644 --- a/src/platform/cloud/subscription/components/SubscribeButton.vue +++ b/src/platform/cloud/subscription/components/SubscribeButton.vue @@ -24,8 +24,9 @@ diff --git a/src/platform/cloud/subscription/components/SubscriptionRequiredDialogContent.vue b/src/platform/cloud/subscription/components/SubscriptionRequiredDialogContent.vue index 54f32c0a8b..2dd4ae548c 100644 --- a/src/platform/cloud/subscription/components/SubscriptionRequiredDialogContent.vue +++ b/src/platform/cloud/subscription/components/SubscriptionRequiredDialogContent.vue @@ -1,5 +1,68 @@