import { Accessor } from 'solid-js'; import { StripeClientConfig } from './stripe-client'; /** `idle` covers both "no challenge yet" and "this attempt has settled". */ export type PaymentChallengePhase = "idle" | "challenging" | "resuming"; /** * How the last attempt ended, when it ended badly — the fact a panel needs to offer the right way * out, which the error copy alone cannot carry. * * - `cancelled` — the prompt ended without the card being refused: the consumer dismissed it, or the * authentication behind it failed. Reopening that same prompt is the recovery. * - `declined` — the card was refused, or the prompt could not be opened at all. That secret is * spent; only a fresh submission can produce another. * - `resume_failed` — the prompt succeeded and the operation behind it did not. The challenge is * answered, so the recovery is to run that operation again, never to reopen the prompt. */ export type PaymentChallengeRecovery = "cancelled" | "declined" | "resume_failed"; export interface PaymentChallenge { phase: Accessor; /** Localized copy for the attempt that produced it; terminal until another attempt starts. */ error: Accessor; /** Set together with `error`, and cleared when the next attempt starts. */ recovery: Accessor; /** * Open the bank prompt for `clientSecret`. Once per secret per instance: a repeat call carrying a * secret this instance already launched is a no-op, and a genuinely new secret launches again. */ launch: (clientSecret: string, resume: () => Promise) => void; /** Reopen the same prompt on the consumer's own instruction, then run the same resume. */ retry: (clientSecret: string, resume: () => Promise) => void; } /** Test-only seam. Never exported from the adapter's public entry. */ export declare function resetPaymentChallengeState(): void; export declare function createPaymentChallenge(config: Accessor): PaymentChallenge;