import type { RefObject } from 'react'; import { BoltBridgeDispatcher } from '../bridge/BoltBridgeDispatcher'; import { type Styles, type TokenResult, type EventType, type EventCallback } from './types'; import type WebView from 'react-native-webview'; /** * Controller returned by CreditCard.useController(). * Matches the CreditCardInputElement interface from the web embedded SDK. */ export interface CreditCardController { /** Ref to the underlying WebView — used by CreditCard.Component */ webViewRef: RefObject; /** Bridge dispatcher — used by CreditCard.Component */ dispatcher: BoltBridgeDispatcher; /** * Register an event listener for field events. * Matches element.on() from the web SDK. */ on: (eventType: EventType, callback: EventCallback) => void; /** * Tokenize the entered credit card data. * Returns TokenResult on success, Error on failure — never throws. * Matches element.tokenize() from the web SDK. */ tokenize: () => Promise; /** * Update the styles of the credit card input fields. */ setStyles: (styles: Styles) => void; } export interface CreditCardControllerOptions { styles?: Styles; /** * Show the billing ZIP / postal code field inside the PCI-sandboxed WebView. * When true, Storm's iframe renders its built-in CardPostalField and the * collected value is returned as `postal_code` in the TokenResult. * Defaults to false. */ showBillingZIPField?: boolean; } /** * Creates a controller for the credit card input. * * Usage: * const cc = CreditCard.useController() * * cc.on('valid', () => setCanSubmit(true)) * const result = await cc.tokenize() * if (result instanceof Error) { ... } */ export declare const useCreditCardController: (options?: CreditCardControllerOptions) => CreditCardController; //# sourceMappingURL=useCreditCardController.d.ts.map