import { components } from '@amos.com/node'; export type PlaidCredentials = components["schemas"]["PlaidCredentialsInput"]; export type PlaidLinkAccount = { id?: string; mask?: string; name?: string; subtype?: string | null; type?: string; }; export type PlaidLinkOnSuccessMetadata = { institution?: { name?: string; } | null; accounts?: Array; account?: PlaidLinkAccount; account_id?: string; }; type PlaidEmbeddedHandler = { destroy: () => void; }; type PlaidCreateConfig = { token: string; onSuccess: (publicToken: string, metadata: PlaidLinkOnSuccessMetadata) => void; onLoad?: () => void; onExit?: (error: { error_code?: string; error_message?: string; } | null, metadata: unknown) => void; }; declare global { interface Window { Plaid?: { createEmbedded: (config: PlaidCreateConfig, target: HTMLElement) => PlaidEmbeddedHandler; }; } } /** * Whether this render token collects Plaid / ACH verification. * * Omitted `verification` means enabled. `false` disables it so surfaces * like a virtual terminal can take routing and account numbers. */ export declare function isBankVerificationEnabled(renderToken: string): boolean; /** * Whether the bank form should show Plaid Embedded Link instead of * routing/account fields. * * - Render token `verification: false`: never Plaid. * - `intent: "setup"`: always Plaid (when verification is enabled). * - Otherwise: host `requireAchVerification`. */ export declare function shouldShowPlaidLink({ renderToken, intent, requireAchVerification, }: { renderToken: string; intent?: "payment" | "setup"; requireAchVerification?: boolean; }): boolean; /** * Whether the charge meets a merchant ACH verification threshold. * * - No `achThreshold`: always manual ACH (backward compatible). * - Otherwise: Plaid when `amount >= achThreshold`. * - Omitted `amount` is treated as `0` (typically under the threshold). * * `amount` and `achThreshold` are integer minor units (cents). Hosts can * use this to compute {@link shouldShowPlaidLink}'s * `requireAchVerification`. */ export declare function requiresAchVerification({ amount, achThreshold, }: { amount?: number; achThreshold?: number; }): boolean; /** * Convert a major-currency decimal string (e.g. `"50.00"`) to integer * cents. Empty / invalid values are omitted. */ export declare function majorAmountToMinorUnits(amount?: string): number | undefined; export declare function plaidAccountIdFromMetadata(metadata: PlaidLinkOnSuccessMetadata): string | undefined; export declare function linkedBankLabelFromMetadata(metadata: PlaidLinkOnSuccessMetadata): { bankName: string; last4: string; }; export declare function loadPlaidScript(): Promise; export type MountPlaidEmbeddedLinkInput = { token: string; target: HTMLElement; onSuccess: (publicToken: string, metadata: PlaidLinkOnSuccessMetadata) => void; onLoad?: () => void; onExit?: (error: { error_code?: string; } | null) => void; /** * When aborted (e.g. the bank form was unmounted), skip mounting * Embedded Link and destroy the handler if it was already created. */ signal?: AbortSignal; }; /** * Load Plaid Link (if needed) and mount Embedded Institution Search * into `target`. Returns a destroy function for the Link handler. */ export declare function mountPlaidEmbeddedLink({ token, target, onSuccess, onLoad, onExit, signal, }: MountPlaidEmbeddedLinkInput): Promise<() => void>; export {};