import { ThemeId, VaultCardThemeColors, SavedCardDisplay, FloPayError, FloPayErrorType } from '@flopay/shared'; import React from 'react'; /** Verified terminal result from a no-charge card setup. */ interface FloPayCardSetupCompleteEvent { status: 'succeeded'; sessionId: string; /** Present when the backend terminal message includes the saved-card display DTO. */ paymentMethod?: SavedCardDisplay; } /** Provider-neutral terminal decline from card verification. */ interface FloPayCardSetupDeclineEvent { status: 'declined'; sessionId: string; reason?: string; message?: string; } /** Abandoned setup result emitted when the component unmounts pre-terminally. */ interface FloPayCardSetupCancelEvent { status: 'cancelled'; sessionId: string; } /** Structured technical/validation failure from the card-setup surface. */ declare class FloPayCardSetupError extends FloPayError { readonly retryable: boolean; constructor(message: string, type: FloPayErrorType, options: { code: string; retryable: boolean; param?: string; statusCode?: number; }); } /** Props for the browser-only secure card-setup surface. */ interface FloPayCardSetupProps { /** Opaque id returned by the merchant-authenticated setup-session endpoint. */ sessionId: string; /** Session-bound token returned alongside {@link FloPayCardSetupProps.sessionId}. */ nonce: string; /** Billing API base URL. Defaults to the configured FloPay environment URL. */ billingApiUrl?: string; /** Flo-owned privacy-safe telemetry is enabled by default; set false to opt out. */ telemetry?: boolean; /** * Theme for FloPay's hosted, PCI-compliant card widget. Accepts the same * high-level {@link ThemeId} as `FloPayCheckout` (resolved through the same * bundle, so one value styles both surfaces identically) or raw * {@link VaultCardThemeColors} for full manual control. Defaults to * `'modern-light'`; pass `'classic'` for the historic FloPay look. */ theme?: ThemeId | VaultCardThemeColors; /** * Inline styles for the hosted-widget container. A named preset first gives * that container the same complete surface as the checkout's credit-card * pane (background, border, radius, shadow, padding); each `containerStyle` * property then wins over the preset's for the same property, a longhand * refines a preset shorthand (`borderColor` recolors the preset border), and * any `background*` member replaces the preset background entirely. * `'classic'` and raw colors add no surface, so `containerStyle` applies alone. */ containerStyle?: React.CSSProperties; /** Optional content shown while the session and hosted widget are loading. */ loading?: React.ReactNode; /** Fired once the hosted widget has mounted and can accept card input. */ onReady?: () => void; /** Fired only after the backend reports that the card is verified and usable. */ onComplete?: (event: FloPayCardSetupCompleteEvent) => void; /** Fired when verification terminally declines; never paired with `onComplete`. */ onDecline?: (event: FloPayCardSetupDeclineEvent) => void; /** Fired exactly once if the setup surface unmounts before a terminal outcome. */ onCancel?: (event: FloPayCardSetupCancelEvent) => void; /** Live hosted-field validation message, or `null` when validation clears. */ onValidation?: (message: string | null) => void; /** Fired for setup-session validation, transport, or hosted-widget failures. */ onError?: (error: FloPayCardSetupError) => void; } /** * Mounts FloPay's hosted card capture for a setup session created by the * merchant's server. It has no customer-id, list, delete, purchase, or Stripe * Elements surface. */ declare function FloPayCardSetup({ sessionId, nonce, billingApiUrl, telemetry, theme, containerStyle, loading, onReady, onComplete, onDecline, onCancel, onValidation, onError, }: FloPayCardSetupProps): React.ReactElement; export { FloPayCardSetup, type FloPayCardSetupCancelEvent, type FloPayCardSetupCompleteEvent, type FloPayCardSetupDeclineEvent, FloPayCardSetupError, type FloPayCardSetupProps };