This commit is contained in:
2026-08-16 11:37:42 +02:00
parent dc9ea628c1
commit 52f27e30fc
26 changed files with 1137 additions and 56 deletions
+10 -1
View File
@@ -37,6 +37,7 @@
startCheckout,
startCreditPackCheckout,
redirectToCheckout,
canSelfServePurchase,
type StripeStatus
} from "$lib/stripe-billing";
import { CREDIT_PACKS } from "$lib/components/pricing/credit-packs";
@@ -255,8 +256,12 @@
);
const atProductLimit = $derived(Boolean(credits?.at_product_limit) && !enterprise);
const nextUpgradePlan = $derived(nextSelfServeUpgradePlan(planName));
const purchasesEnabled = $derived(
canSelfServePurchase(stripe, { isPlatformAdmin })
);
const showQuickUpgrade = $derived(
canManageBilling &&
purchasesEnabled &&
!enterprise &&
!payg &&
!isLegacyPlan(plan) &&
@@ -450,6 +455,10 @@
<Alert message={error} />
<Alert tone="success" message={success} />
{#if canManageBilling && !purchasesEnabled}
<Alert tone="info" message={i18n.t("billing.checkoutUnavailable")} />
{/if}
{#if recovery}
<UpgradeBanner
tone={recovery.tone}
@@ -615,7 +624,7 @@
</section>
{/if}
{#if canManageBilling && !enterprise && planAssigned}
{#if canManageBilling && purchasesEnabled && !enterprise && planAssigned}
<section class="space-y-3 rounded-lg border border-border bg-card px-4 py-4">
<div>
<h2 class="text-base font-semibold tracking-tight">{i18n.t("billing.buyCreditPacks")}</h2>