import { ClaimableSettlement, PreAuthSettlement } from '@fanfare-io/fanfare-sdk-core/experiences'; import { GrantedSelection, SelectionChoice, SelectionDraft, SelectionOptions } from '@fanfare-io/fanfare-sdk-core/selections'; import { JSX } from 'solid-js'; import { SelectionCheckoutDetails, SelectionDisplay } from '../../lib/selection-display'; export interface GrantedPanelProps { label: JSX.Element; fallbackMessage: JSX.Element; ctaLabel?: JSX.Element; expiresAt?: Date; /** * A fact the grant settles at — a winning bid, a clearing price — rendered under the countdown * and beside the fallback message. Omitted when the amount is not known: a figure beside a * payment countdown states what the consumer owes, so a synthesised one is worse than none. */ detail?: JSX.Element; /** * Activated by the checkout CTA, carrying the pick the grant settled on and the catalogue * objects behind it whenever this panel has loaded them. */ onCtaClick?: (details?: SelectionCheckoutDetails) => void | Promise; /** * Set when `onCtaClick` consumes the details: the CTA for a recorded pick stays disabled until * the catalogue carrying them has loaded, and a failed load replaces the CTA with a retry, so * the hand-off never runs without them. Unset, the CTA hands off whatever this panel has already * loaded — no details while the catalogue is still in flight. Either way the hand-off runs inside * the click, keeping its user activation. `ExperienceWidget` sets it whenever `onCheckoutClick` * is provided; a direct composition passes it itself. */ awaitCheckoutDetails?: boolean; class?: string; className?: string; /** Granted-state selection: drives the pick, reveal, wait and summary states. */ selection?: GrantedSelection | null; /** * How the win settles. Selects the confirm label and which affordance sits beneath a resolved * summary; absent leaves the CTA exactly as the caller wired it. */ settlement?: ClaimableSettlement | PreAuthSettlement; /** * Parent binds the view's option loader; fetch-on-open only. Must be referentially stable — a * new identity re-fetches the catalogue. */ loadSelectionOptions?: () => Promise; /** * Parent binds the view's selection submit; resolves when the pin is written and rejects on * failure — the panel keys its pick UI on settle and shows the failure through `selectError`. * * The promise must resolve only once the journey atom carries the new selection: the pick * surface collapses on the `selection` prop flip, so a promise that settles ahead of the atom * re-enables the confirm control over a pick that has already been taken. */ onConfirmSelection?: (choice: SelectionChoice) => Promise; /** * Reports every local pick-surface transition, product-only drafts included, so the widget can * emit the page-bridge selection-change event; `onConfirmSelection` stays the only settled-pair * channel. */ onDraftChange?: (draft: SelectionDraft) => void; /** Heading copy for the pick state; the generic selection title stands when absent. */ selectionTitle?: JSX.Element; /** Helper copy under the pick heading; a reveal supplies its own prompt when absent. */ selectionDescription?: JSX.Element; /** * Display strings for the resolved summary. Absent on a consumer-chosen resolution renders no * summary at all: a locked line with no item detail states less than nothing. */ selectionDisplay?: SelectionDisplay | null; /** * Locked copy for a resolved summary; modules pass "checkout" once checkout has started. Passing * it also freezes the pick: the summary reads out locked with this reason and offers no change. */ selectionLockedReason?: "checkout" | "final"; /** Inline error from the parent's selection submit. */ selectError?: string | null; /** * Opens straight onto a re-pick of the resolved pair, for a caller that offered the change * itself. Has no effect where the pick could not be changed from this panel. */ repickOnOpen?: boolean; /** * Told when an open re-pick ends because the consumer confirmed a new pair or backed out. A * refused re-pick does not end here: the panel returns to the pick the server still holds. */ onRepickEnd?: () => void; } export declare function GrantedPanel(props: GrantedPanelProps): JSX.Element; export declare namespace GrantedPanel { var displayName: string; }