import type { TokenResult, EventType, EventCallback, EventListeners } from './types'; import type { NativeCardFieldStyles } from './NativeCardFieldStyles'; /** * Controller returned by NativeCreditCard.useController(). * * This is a distinct interface from CreditCardController — they share * on() and tokenize() signatures but differ on setStyles() type (ADR-5). */ export interface NativeCreditCardController { /** * Ref to the native view — used by NativeCreditCard.Component. * Consumers should not access this directly. */ nativeRef: React.RefObject; /** @internal Listeners ref — used by NativeCreditCardComponent for event forwarding. */ _listenersRef: React.RefObject>; /** @internal Styles ref — used by NativeCreditCardComponent for style props. */ _stylesRef: React.RefObject; /** * @internal Last terminal validation state — written by * NativeCreditCardComponent when onCardValid/onCardError fire and read by * `on()` to replay state to late subscribers. */ _lastStateRef: React.RefObject<'valid' | { error: string; } | null>; /** * Register an event listener for field events. */ on: (eventType: EventType, callback: EventCallback) => void; /** * Tokenize the entered credit card data. * Returns TokenResult on success, Error on failure — never throws. * * Implemented via the companion BoltCardFieldModule TurboModule (ADR-1). */ tokenize: () => Promise; /** * Update the styles of the native card input fields. */ setStyles: (styles: NativeCardFieldStyles) => void; } export interface NativeCreditCardControllerOptions { styles?: NativeCardFieldStyles; showPostalCode?: boolean; } /** * Creates a controller for the native credit card input. * * Usage: * const cc = NativeCreditCard.useController() * * cc.on('valid', () => setCanSubmit(true)) * const result = await cc.tokenize() * if (result instanceof Error) { ... } */ export declare const useNativeCreditCardController: (_options?: NativeCreditCardControllerOptions) => NativeCreditCardController; //# sourceMappingURL=useNativeCreditCardController.d.ts.map