diff --git a/packages/stage-pages/src/pages/settings/flux.vue b/packages/stage-pages/src/pages/settings/flux.vue index 8c9a83a3c..ac3c5b7bc 100644 --- a/packages/stage-pages/src/pages/settings/flux.vue +++ b/packages/stage-pages/src/pages/settings/flux.vue @@ -36,14 +36,14 @@ if (isStageTamagotchi()) useEventListener(window, 'focus', () => authStore.updateCredits()) interface FluxPackage { - packKey: string + stripePriceId: string label: string defaultCurrency: string currencies: Record recommended?: boolean } -const loadingPackKey = ref(null) +const loadingPriceId = ref(null) const message = ref<{ type: 'success' | 'error', text: string } | null>(null) const checkoutReturnMessageActive = ref(false) const packages = ref([]) @@ -304,8 +304,8 @@ onMounted(async () => { } }) -async function handleBuy(packKey: string) { - loadingPackKey.value = packKey +async function handleBuy(stripePriceId: string) { + loadingPriceId.value = stripePriceId checkoutReturnMessageActive.value = false message.value = null // OpenPanel funnel step 2: user picked a plan. price_minor_unit lives on @@ -317,12 +317,12 @@ async function handleBuy(packKey: string) { current_plan: 'flux', trigger: 'manual_topup', }) - trackPlanSelected(packKey, { + trackPlanSelected(stripePriceId, { currency: selectedCurrency.value, entry_surface: 'settings_flux', }) try { - const res = await client.api.v1.stripe.checkout.$post({ json: { packKey, currency: selectedCurrency.value } }) + const res = await client.api.v1.stripe.checkout.$post({ json: { stripePriceId, currency: selectedCurrency.value } }) if (!res.ok) { const data = await res.json() as { error?: string, message?: string } message.value = { type: 'error', text: data.message || t('settings.pages.flux.checkout.error') } @@ -332,7 +332,7 @@ async function handleBuy(packKey: string) { if (data.url) { // Start capture before redirecting to Stripe so fetch keepalive can // finish delivery after the page unloads. - trackCheckoutStarted(packKey, { + trackCheckoutStarted(stripePriceId, { currency: selectedCurrency.value, entry_surface: 'settings_flux', }) @@ -350,7 +350,7 @@ async function handleBuy(packKey: string) { message.value = { type: 'error', text: t('settings.pages.flux.checkout.error') } } finally { - loadingPackKey.value = null + loadingPriceId.value = null } } @@ -401,8 +401,8 @@ async function handleBuy(packKey: string) {