-
Notifications
You must be signed in to change notification settings - Fork 502
Fix(cloud)/pricing annual misc #7701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4e1e2e2
be2ec0c
de5edd3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -365,9 +365,9 @@ import { useSubscriptionCredits } from '@/platform/cloud/subscription/composable | |
| import { useSubscriptionDialog } from '@/platform/cloud/subscription/composables/useSubscriptionDialog' | ||
| import { | ||
| DEFAULT_TIER_KEY, | ||
| TIER_FEATURES, | ||
| TIER_TO_KEY, | ||
| getTierCredits, | ||
| getTierFeatures, | ||
| getTierPrice | ||
| } from '@/platform/cloud/subscription/constants/tierPricing' | ||
| import { cn } from '@/utils/tailwindUtil' | ||
|
|
@@ -383,6 +383,7 @@ const { | |
| formattedEndDate, | ||
| subscriptionTier, | ||
| subscriptionTierName, | ||
| isYearlySubscription, | ||
| handleInvoiceHistory | ||
| } = useSubscription() | ||
|
|
||
|
|
@@ -393,7 +394,9 @@ const tierKey = computed(() => { | |
| if (!tier) return DEFAULT_TIER_KEY | ||
| return TIER_TO_KEY[tier] ?? DEFAULT_TIER_KEY | ||
| }) | ||
| const tierPrice = computed(() => getTierPrice(tierKey.value)) | ||
| const tierPrice = computed(() => | ||
| getTierPrice(tierKey.value, isYearlySubscription.value) | ||
| ) | ||
|
|
||
| // Tier benefits for v-for loop | ||
| type BenefitType = 'metric' | 'feature' | ||
|
|
@@ -433,7 +436,7 @@ const tierBenefits = computed((): Benefit[] => { | |
| } | ||
| ] | ||
|
|
||
| if (TIER_FEATURES[key].customLoRAs) { | ||
| if (getTierFeatures(key).customLoRAs) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Consistent use of tier feature accessor. Migrating from 🤖 Prompt for AI Agents |
||
| benefits.push({ | ||
| key: 'customLoRAs', | ||
| type: 'feature', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,8 @@ import { | |
| useFirebaseAuthStore | ||
| } from '@/stores/firebaseAuthStore' | ||
| import { useDialogService } from '@/services/dialogService' | ||
| import type { components, operations } from '@/types/comfyRegistryTypes' | ||
| import { TIER_TO_KEY } from '@/platform/cloud/subscription/constants/tierPricing' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Good refactoring to centralize tier key mapping. Importing 🤖 Prompt for AI Agents |
||
| import type { operations } from '@/types/comfyRegistryTypes' | ||
| import { useSubscriptionCancellationWatcher } from './useSubscriptionCancellationWatcher' | ||
|
|
||
| type CloudSubscriptionCheckoutResponse = NonNullable< | ||
|
|
@@ -24,15 +25,6 @@ export type CloudSubscriptionStatusResponse = NonNullable< | |
| operations['GetCloudSubscriptionStatus']['responses']['200']['content']['application/json'] | ||
| > | ||
|
|
||
| type SubscriptionTier = components['schemas']['SubscriptionTier'] | ||
|
|
||
| const TIER_TO_I18N_KEY: Record<SubscriptionTier, string> = { | ||
| STANDARD: 'standard', | ||
| CREATOR: 'creator', | ||
| PRO: 'pro', | ||
| FOUNDERS_EDITION: 'founder' | ||
| } | ||
|
|
||
| function useSubscriptionInternal() { | ||
| const subscriptionStatus = ref<CloudSubscriptionStatusResponse | null>(null) | ||
| const telemetry = useTelemetry() | ||
|
|
@@ -82,11 +74,22 @@ function useSubscriptionInternal() { | |
| () => subscriptionStatus.value?.subscription_tier ?? null | ||
| ) | ||
|
|
||
| const subscriptionDuration = computed( | ||
| () => subscriptionStatus.value?.subscription_duration ?? null | ||
| ) | ||
|
|
||
| const isYearlySubscription = computed( | ||
| () => subscriptionDuration.value === 'ANNUAL' | ||
| ) | ||
|
|
||
| const subscriptionTierName = computed(() => { | ||
| const tier = subscriptionTier.value | ||
| if (!tier) return '' | ||
| const key = TIER_TO_I18N_KEY[tier] ?? 'standard' | ||
| return t(`subscription.tiers.${key}.name`) | ||
| const key = TIER_TO_KEY[tier] ?? 'standard' | ||
| const baseName = t(`subscription.tiers.${key}.name`) | ||
| return isYearlySubscription.value | ||
| ? t('subscription.tierNameYearly', { name: baseName }) | ||
| : baseName | ||
| }) | ||
|
|
||
| const buildApiUrl = (path: string) => `${getComfyApiBaseUrl()}${path}` | ||
|
|
@@ -241,6 +244,8 @@ function useSubscriptionInternal() { | |
| formattedRenewalDate, | ||
| formattedEndDate, | ||
| subscriptionTier, | ||
| subscriptionDuration, | ||
| isYearlySubscription, | ||
| subscriptionTierName, | ||
| subscriptionStatus, | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.