import type { Branding, VerificationManifestEntry } from "../types.js"; import type { ProofEntry } from "./proofs.js"; /** A priced order line — structurally a demo / storefront `PricedCartLine` (and a * `CeremonyOrderLine`, whose name/currency are optional). */ export interface RenderOrderLine { /** Display name; falls back to the product id (or "Item") when absent. */ name?: string; /** Product id — the name fallback when a re-priced line carries no name. */ id?: string; quantity: number; lineTotal: number; /** ISO 4217; falls back to the order currency when the line omits it. */ currency?: string; } /** * The priced order the page summarizes. Structural superset of both the demo's and * the storefront's `Order`, so either feeds the renderer with no mapping. Totals are * the catalog-re-derived ones (Security invariant 2 — never the token's). */ export interface RenderOrder { id: string; lines: RenderOrderLine[]; /** Total item count; defaults to the summed line quantities when absent. */ itemCount?: number; /** Discount in major units; the loyalty row renders only when > 0. */ discount: number; total: number; currency: string; } /** Per-order verification state that drives the live gate status (never global). */ export interface RenderVerification { ageVerified?: boolean; loyaltyApplied?: boolean; /** Custom gate() credentials proven for THIS order, keyed by credential id (007). * Drives the live status of a custom gate the same way `ageVerified` drives age. */ verifiedGates?: Record; } /** A recorded completion for THIS order — a revisit shows the paid state. */ export interface RenderPaid { amount: number; currency: string; method?: string; /** * The settlement backing this order, when one was recorded. The banner DERIVES * everything it shows from this record (never a hardcoded rail): the backend name * from `provider` (falling back to `network`), and the payer / txn / explorer * fragments only when the record carries them. A blockchain settlement (x402 on a * testnet) has a chain `payer.accountId` and a `hashscanUrl`; an external-processor * settlement (e.g. a card processor) has a `txId` but no chain account or explorer — * so those fields are optional and rendered conditionally. */ settlement?: { network: string; /** Human backend name the receipt shows ("x402", "UPay"); falls back to `network`. */ provider?: string; /** The settlement transaction id, when the backend supplies one. */ txId?: string; /** On-chain payer, when the backend settles on a chain. */ payer?: { accountId: string; }; /** Block-explorer link, when the backend settles on a chain. */ hashscanUrl?: string; } | null; /** What was proven for the order (the order proof receipt) — listed under the banner with each * proof's trust level and the Order record link. No Multipaz Tools links: a completed order * never carries the wallet's raw answer (#320). */ proofs?: ProofEntry[]; } /** * One selectable payment method in the locked-until-ready payment group. The host * supplies these so the renderer never hardcodes a route: * • `href` — selecting + paying navigates here (a gate page); OR * • `placeOrder: true` — POSTs the order token to `placeOrderPath` (instant demo). */ export interface PaymentMethod { value: string; name: string; desc: string; /** Gate-page URL the Pay CTA navigates to when this method is chosen. */ href?: string; /** This method completes by POSTing the order token to `placeOrderPath`. */ placeOrder?: boolean; /** Selected by default (first method if none flagged). */ checked?: boolean; } export interface PaymentOptions { /** The selectable methods (rendered as a radio group + one Pay CTA). */ methods: PaymentMethod[]; /** Where a `placeOrder` method POSTs `{ order }`. Default `/checkout/place-order`. */ placeOrderPath?: string; /** The encoded order token the instant-demo method binds + POSTs. */ orderToken?: string; } export interface RenderRequirementsOptions { /** Host-supplied payment affordances. Omitted ⇒ derive a single Pay CTA from the * manifest's `authorize` entry (its `approveUrl`), if any. */ payment?: PaymentOptions; /** A recorded completion for THIS order ⇒ render the paid state, not the methods. */ paid?: RenderPaid | null; /** A host status endpoint for THIS order returning `{ completed: boolean }`. When set * and the order is not yet paid, the page polls it and reloads on completion, so a * standing checkout tab reflects a payment made on another tab / device / rail without * a manual refresh (#63). Route-agnostic — the host owns the URL, same as * `payment.placeOrderPath`. Omitted ⇒ no poll (unchanged for hosts without one). */ statusUrl?: string; /** An opaque signature of THIS order's current verification state, baked into the poll. * When the status endpoint returns a `revision` that differs, the page is stale (a step * was made on another device — age verified, loyalty applied) and reloads to mirror it, * not only on final completion (#73). Route-agnostic — the host decides what the revision * encodes and returns the matching `revision` from `statusUrl`. Omitted ⇒ completion-only * (unchanged; #63). */ statusRevision?: string; /** Host brand for this page (wordmark / accent / logo / demo-pill). Normally threaded from * `new CredentAgent({ branding })` via `orders.serve`. Omitted ⇒ the built-in look, * byte-for-byte. Never affects the honesty trust footer. */ branding?: Branding; } /** * Render the unified checkout page: the order summary, the numbered gates (in policy * order, payment LAST) with live status, and the payment section — locked until every * blocking gate passes. The membership discount is reflected in the displayed total * via `order.discount` (the host re-prices server-side and passes the priced order). */ export declare function renderRequirements(order: RenderOrder, manifest: VerificationManifestEntry[], verification?: RenderVerification, opts?: RenderRequirementsOptions): string;