feat: replace Stripe pricing table with custom implementation (#7359)

## Summary
- Replace StripePricingTable with CustomPricingTable component
- Add intelligent subscription tier detection and button logic
- Remove Stripe dependencies and feature flags
- Clean up unused Stripe-related files and configurations

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7359-feat-replace-Stripe-pricing-table-with-custom-implementation-2c66d73d365081f684d4ec81c7cc6790)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Christian Byrne
2025-12-11 01:12:17 -08:00
committed by GitHub
parent b6efc52bf8
commit f5f0e20332
8 changed files with 330 additions and 410 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div
v-if="showStripePricingTable"
v-if="showCustomPricingTable"
class="flex flex-col gap-6 rounded-[24px] border border-interface-stroke bg-[var(--p-dialog-background)] p-4 shadow-[0_25px_80px_rgba(5,6,12,0.45)] md:p-6"
>
<div
@@ -32,7 +32,7 @@
/>
</div>
<StripePricingTable class="flex-1" />
<PricingTable class="flex-1" />
<!-- Contact and Enterprise Links -->
<div class="flex flex-col items-center">
@@ -138,9 +138,8 @@ import Button from 'primevue/button'
import { computed, onBeforeUnmount, watch } from 'vue'
import CloudBadge from '@/components/topbar/CloudBadge.vue'
import { useFeatureFlags } from '@/composables/useFeatureFlags'
import { MONTHLY_SUBSCRIPTION_PRICE } from '@/config/subscriptionPricesConfig'
import StripePricingTable from '@/platform/cloud/subscription/components/StripePricingTable.vue'
import PricingTable from '@/platform/cloud/subscription/components/PricingTable.vue'
import SubscribeButton from '@/platform/cloud/subscription/components/SubscribeButton.vue'
import SubscriptionBenefits from '@/platform/cloud/subscription/components/SubscriptionBenefits.vue'
import { useSubscription } from '@/platform/cloud/subscription/composables/useSubscription'
@@ -168,25 +167,18 @@ const formattedMonthlyPrice = new Intl.NumberFormat(
maximumFractionDigits: 0
}
).format(MONTHLY_SUBSCRIPTION_PRICE)
const { featureFlag } = useFeatureFlags()
const subscriptionTiersEnabled = featureFlag(
'subscription_tiers_enabled',
false
)
const commandStore = useCommandStore()
const telemetry = useTelemetry()
const showStripePricingTable = computed(
() =>
subscriptionTiersEnabled.value &&
isCloud &&
window.__CONFIG__?.subscription_required
// Always show custom pricing table for cloud subscriptions
const showCustomPricingTable = computed(
() => isCloud && window.__CONFIG__?.subscription_required
)
const POLL_INTERVAL_MS = 3000
const MAX_POLL_DURATION_MS = 5 * 60 * 1000
const MAX_POLL_ATTEMPTS = 3
let pollInterval: number | null = null
let pollStartTime = 0
let pollAttempts = 0
const stopPolling = () => {
if (pollInterval) {
@@ -197,35 +189,44 @@ const stopPolling = () => {
const startPolling = () => {
stopPolling()
pollStartTime = Date.now()
pollAttempts = 0
const poll = async () => {
try {
await fetchStatus()
pollAttempts++
if (pollAttempts >= MAX_POLL_ATTEMPTS) {
stopPolling()
}
} catch (error) {
console.error(
'[SubscriptionDialog] Failed to poll subscription status',
error
)
stopPolling()
}
}
void poll()
pollInterval = window.setInterval(() => {
if (Date.now() - pollStartTime > MAX_POLL_DURATION_MS) {
stopPolling()
return
}
void poll()
}, POLL_INTERVAL_MS)
}
const handleWindowFocus = () => {
if (showCustomPricingTable.value) {
startPolling()
}
}
watch(
showStripePricingTable,
showCustomPricingTable,
(enabled) => {
if (enabled) {
startPolling()
window.addEventListener('focus', handleWindowFocus)
} else {
window.removeEventListener('focus', handleWindowFocus)
stopPolling()
}
},
@@ -235,7 +236,7 @@ watch(
watch(
() => isActiveSubscription.value,
(isActive) => {
if (isActive && showStripePricingTable.value) {
if (isActive && showCustomPricingTable.value) {
emit('close', true)
}
}
@@ -270,6 +271,7 @@ const handleViewEnterprise = () => {
onBeforeUnmount(() => {
stopPolling()
window.removeEventListener('focus', handleWindowFocus)
})
</script>