import type { CaptchaFeature, CaptchaProvider } from "./api"; import type { CaptchaExecuteResult } from "./types"; /** * Singleton captcha manager that handles loading and executing captcha providers */ declare class CaptchaManager { private provider; private initPromise; private configLoadingPromise; /** * Get the current captcha configuration from the store */ private get config(); /** * Set the promise that resolves when captcha config loading is complete. * Called by the config component to signal that config fetching is in progress. * This ensures execute() waits for config before checking feature flags. */ setConfigLoadingPromise(promise: Promise): void; /** * Check if captcha is enabled for a specific feature */ isEnabledForFeature(feature: CaptchaFeature): boolean; /** * Check if captcha is configured (has a config from backend) */ isConfigured(): boolean; /** * Check if the current provider requires a visible widget */ requiresWidget(): boolean; /** * Get the current provider type */ getProviderType(): CaptchaProvider | null; /** * Initialize the captcha provider based on the config * Provider classes are lightweight - the external scripts are loaded lazily */ initialize(): Promise; /** * Render the captcha widget in a container (for challenge-based providers) */ render(container: HTMLElement): void; /** * Execute captcha and get a token * @param feature The feature being protected (used as action for reCAPTCHA v3) */ execute(feature: CaptchaFeature): Promise; /** * Reset the captcha widget */ reset(): void; /** * Check if the provider is ready */ isReady(): boolean; /** * Cleanup resources */ destroy(): void; } export declare const captchaManager: CaptchaManager; export {};