import { ZenskarElementInstance } from '../../types/elements'; import { ElementTypeMap, ZenskarElementType } from '../../types/elements/base.types'; /** * Hook to access and control Zenskar elements * Provides methods to interact with mounted elements * * @returns Object with methods to access and control elements * * @example * ```tsx * const elements = useZenskarElements() * const billingElement = elements.getElement('billing-information') * const allReady = elements.allReady() * ``` */ export declare const useZenskarElements: () => { /** * Get a specific element by type with automatic type narrowing * * @param type - The type of element to retrieve * @returns The element instance (narrowed to specific type) or null if not found * * @example * ```tsx * // Automatically typed as AddPaymentMethodElementInstance | null * const paymentElement = elements.getElement('add-payment-method') * if (paymentElement) { * await paymentElement.submit() // TypeScript knows this method exists * paymentElement.reset() * } * * // Automatically typed as ManageBillingInformationElementInstance | null * const billingElement = elements.getElement('manage-billing-information') * if (billingElement) { * const data = billingElement.getValue() // TypeScript knows this method exists * } * ``` */ getElement: { (type: T): ElementTypeMap[T] | null; (type: T): ElementTypeMap[T] | null; (type: ZenskarElementType): ZenskarElementInstance | null; }; /** * Get all registered elements * * @returns Array of all element instances */ getAllElements: () => ZenskarElementInstance[]; /** * Check if all elements are ready (finished loading and initialization) * * @returns True if all elements are ready, false otherwise */ allReady: () => boolean; /** * Check if all elements have valid data * * @returns True if all elements are valid, false otherwise */ allValid: () => boolean; /** * Check if any elements have validation errors * * @returns True if any element has errors, false otherwise */ hasErrors: () => boolean; } | null;