import type { Surface, SurfaceResult } from '@funkit/connect-core'; import type { ReactNode } from 'react'; /** * Who operates the control. * * `EMBEDDED` — the provider draws it in place (Transak's Apple Pay button is * a WebView), so the screen covers it until the widget reports ready. * `HANDOFF` — payment happens outside the app, so the surface owns the canvas * and there is no readiness to wait for. */ export type SurfaceControlModel = 'EMBEDDED' | 'HANDOFF'; /** What the screen lends a surface for as long as it runs. */ export interface SurfaceContext { placement: 'INLINE' | 'SCREEN'; /** Uncovers an `EMBEDDED` widget; a handoff has nothing to announce. */ onReady: () => void; /** * The provider gave up on this attempt; its machine will not recover. * * `detail` is one sentence the user can act on. Only the adapter can write * it: the codes are the provider's vocabulary, and a screen that mapped * them would carry every provider's. */ onFailed: (code: string, detail?: string) => void; /** Leaves the flow — a handoff draws its own chrome, close included. */ onClose: () => void; /** * The provider's own page says the crypto is sent. Optional both ways: only * a rail that watches its transfer can say it, and only a screen that can * act on the news asks for it. */ onSettled?: () => void; report: (result: SurfaceResult) => void; } export interface ClaimedSurface { control: SurfaceControlModel; render: (context: SurfaceContext) => ReactNode; } /** * Claims a surface, or declines it. * * Each adapter narrows `params` itself: the contract says `provider` never * narrows their shape, so one vendor can carry two vocabularies and the pair * `(kind, provider)` plus a shape check is the whole match. Binding the * renderer to the narrowed params keeps that type inside the adapter rather * than in a union the registry would have to carry. */ export type SurfaceAdapter = (surface: Surface) => ClaimedSurface | undefined; //# sourceMappingURL=adapter.d.ts.map