"use client"; import { useState } from "react"; import { initPaddle } from "@/lib/paddle"; /* Opens the Paddle overlay with the resolved line items and custom_data. The * items come from the configurator via catalogue pricing; custom_data is what * lets the webhook route without a lookup table. */ export function CheckoutButton({ items, customData, disabled, label = "Continue to payment", }: { items: { priceId: string; quantity: number }[]; customData: { account_id: string; instance_id: string }; disabled?: boolean; label?: string; }) { const [busy, setBusy] = useState(false); async function open() { setBusy(true); const paddle = await initPaddle(); setBusy(false); paddle?.Checkout.open({ items: items.map((i) => ({ priceId: i.priceId, quantity: i.quantity })), customData, }); } return ( ); }