import { GatedLine } from '../checkout-types'; import { ClaimResult } from '../claimer'; /** The claim lifecycle, for driving buy-button UI (e.g. a spinner). */ export type FanfareClaimState = "idle" | "claiming" | "claimed" | "error"; export interface UseFanfareClaimResult { /** * Claim the spot for a cart you already materialized. In one round-trip this * validates the admission, mints + writes the gate token to the cart, AND * reserves the slot (so it can't be re-drawn mid-checkout). `cartId` is your * Storefront cart's GID: it identifies where the gate token is written, but it * does not by itself validate product/variant/quantity policy. On `{ ok: true * }`, add the gated line to that same cart if it is not already present, then * redirect the shopper to that cart's `checkoutUrl`; `expDate` is the token's * expiry (the reserve route's `reservationId` is handled internally and not * surfaced). On `{ ok: false }`, branch on `result.reason` (a * `ClaimRefusalReason` — `cart_not_materialized` is retryable; * `no_claim_context` means not-yet-ready). Never rejects — every outcome * resolves to a `ClaimResult`. * * Pass `{ cartId, checkoutUrl, purchase }`: the purchase is the * product/variant/quantity the gate validates, and `checkoutUrl`, when given, is * the URL the relayed DPoP proof is signed over. * `useFanfareCheckout().gatedCheckout` is the recommended path that owns the * create→claim→add-line ordering for you. */ claim(input: FanfareClaimInput): Promise; /** `"idle"` → `"claiming"` → `"claimed"` | `"error"`. */ state: FanfareClaimState; } /** The input to `claim`. `purchase` is the intended `GatedLine` the gate validates. */ export interface FanfareClaimInput { cartId: string; checkoutUrl?: string; purchase: GatedLine; } export declare function useFanfareClaim(): UseFanfareClaimResult;