diff --git a/src/platform/cloud/subscription/components/PricingTable.vue b/src/platform/cloud/subscription/components/PricingTable.vue index 73b7d879e..abbf2c0c6 100644 --- a/src/platform/cloud/subscription/components/PricingTable.vue +++ b/src/platform/cloud/subscription/components/PricingTable.vue @@ -7,7 +7,9 @@ >
- + {{ tier.name }}
- + ${{ tier.price }} - + {{ t('subscription.usdPerMonth') }}
@@ -29,12 +35,16 @@
- + {{ t('subscription.monthlyCreditsLabel') }}
- + {{ tier.credits }}
@@ -44,7 +54,9 @@ {{ t('subscription.maxDurationLabel') }} - + {{ tier.maxDuration }}
@@ -78,13 +90,17 @@ {{ t('subscription.videoEstimateLabel') }}
- + {{ t('subscription.videoEstimateHelp') }}
- + {{ tier.videoEstimate }}
@@ -192,21 +208,26 @@ const { wrapWithErrorHandlingAsync } = useErrorHandling() const isLoading = ref(false) const loadingTier = ref(null) -const currentTierKey = computed(() => +const currentTierKey = computed(() => subscriptionTier.value ? TIER_TO_KEY[subscriptionTier.value] : null ) -const isCurrentPlan = (tierKey: TierKey): boolean => +const isCurrentPlan = (tierKey: TierKey): boolean => currentTierKey.value === tierKey const getButtonLabel = (tier: PricingTierConfig): string => { if (isCurrentPlan(tier.key)) return t('subscription.currentPlan') - if (!isActiveSubscription.value) return t('subscription.subscribeTo', { plan: tier.name }) + if (!isActiveSubscription.value) + return t('subscription.subscribeTo', { plan: tier.name }) return t('subscription.changeTo', { plan: tier.name }) } -const getButtonSeverity = (tier: PricingTierConfig): 'primary' | 'secondary' => - isCurrentPlan(tier.key) ? 'secondary' : tier.key === 'creator' ? 'primary' : 'secondary' +const getButtonSeverity = (tier: PricingTierConfig): 'primary' | 'secondary' => + isCurrentPlan(tier.key) + ? 'secondary' + : tier.key === 'creator' + ? 'primary' + : 'secondary' const initiateCheckout = async (tierKey: TierKey) => { const authHeader = await getAuthHeader() @@ -231,12 +252,13 @@ const initiateCheckout = async (tierKey: TierKey) => { // If JSON parsing fails, try to get text response or use HTTP status try { const errorText = await response.text() - errorMessage = errorText || `HTTP ${response.status} ${response.statusText}` + errorMessage = + errorText || `HTTP ${response.status} ${response.statusText}` } catch { errorMessage = `HTTP ${response.status} ${response.statusText}` } } - + throw new FirebaseAuthStoreError( t('toastMessages.failedToInitiateSubscription', { error: errorMessage @@ -247,27 +269,24 @@ const initiateCheckout = async (tierKey: TierKey) => { return await response.json() } -const handleSubscribe = wrapWithErrorHandlingAsync( - async (tierKey: TierKey) => { - if (!isCloud || isLoading.value || isCurrentPlan(tierKey)) return +const handleSubscribe = wrapWithErrorHandlingAsync(async (tierKey: TierKey) => { + if (!isCloud || isLoading.value || isCurrentPlan(tierKey)) return - isLoading.value = true - loadingTier.value = tierKey + isLoading.value = true + loadingTier.value = tierKey - try { - if (isActiveSubscription.value) { - await accessBillingPortal() - } else { - const response = await initiateCheckout(tierKey) - if (response.checkout_url) { - window.open(response.checkout_url, '_blank') - } + try { + if (isActiveSubscription.value) { + await accessBillingPortal() + } else { + const response = await initiateCheckout(tierKey) + if (response.checkout_url) { + window.open(response.checkout_url, '_blank') } - } finally { - isLoading.value = false - loadingTier.value = null } - }, - reportError -) - \ No newline at end of file + } finally { + isLoading.value = false + loadingTier.value = null + } +}, reportError) +