import { default as React, ReactNode } from 'react'; /** * Library module identifier */ export type LibraryId = 'api' | 'routing' | 'ui' | 'performance' | 'auth' | 'monitoring' | 'state' | 'realtime' | 'theme' | 'config' | 'hydration' | 'streaming' | 'vdom' | 'ux' | string; /** * Flag-to-config field mapping */ export type FlagMapping = { [flagKey: string]: keyof TConfig | ((flagValue: boolean) => Partial); }; /** * Flag value transformer */ export type FlagTransformer = (flagValue: boolean, currentValue: T) => T; /** * Library integration configuration */ export interface LibraryIntegrationConfig> { /** Unique library identifier */ readonly libraryId: LibraryId; /** Default configuration when flags are not set */ readonly defaultConfig: TConfig; /** Mapping from flag keys to config properties */ readonly flagMappings: FlagMapping; /** Optional transformers for complex mappings */ readonly transformers?: Readonly>>; /** Whether to cache configuration */ readonly cacheEnabled?: boolean; /** Cache TTL in milliseconds */ readonly cacheTTL?: number; /** Callback when config changes */ readonly onConfigChange?: (config: TConfig, changedFlags: string[]) => void; /** Priority for evaluation order */ readonly priority?: number; } /** * Library integration instance */ export interface LibraryIntegration> { /** Library identifier */ readonly libraryId: LibraryId; /** Get current configuration based on flags */ getConfig(flags: Record): TConfig; /** Get specific config property */ getConfigValue(key: K, flags: Record): TConfig[K]; /** Check if a flag affects this library */ isAffectedByFlag(flagKey: string): boolean; /** Get all affecting flag keys */ getAffectingFlags(): string[]; /** Subscribe to config changes */ subscribe(callback: (config: TConfig) => void): () => void; /** Update flags and notify subscribers */ updateFlags(flags: Record): void; /** Reset to default config */ reset(): void; /** Get integration metadata */ getMetadata(): IntegrationMetadata; } /** * Integration metadata */ export interface IntegrationMetadata { readonly libraryId: LibraryId; readonly flagCount: number; readonly priority: number; readonly lastUpdated: number; readonly cacheEnabled: boolean; } /** * Global integration registry */ export interface IntegrationRegistry { /** Register a library integration */ register>(integration: LibraryIntegration): void; /** Unregister a library integration */ unregister(libraryId: LibraryId): void; /** Get integration by library ID */ get>(libraryId: LibraryId): LibraryIntegration | undefined; /** Get all registered integrations */ getAll(): LibraryIntegration>[]; /** Update flags across all integrations */ updateFlags(flags: Record): void; /** Get libraries affected by a flag */ getAffectedLibraries(flagKey: string): LibraryId[]; /** Clear all registrations */ clear(): void; } /** * Create a library integration instance */ export declare function createLibraryIntegration>(config: LibraryIntegrationConfig): LibraryIntegration; /** * Global integration registry singleton */ declare class GlobalIntegrationRegistry implements IntegrationRegistry { private integrations; private currentFlags; register>(integration: LibraryIntegration): void; unregister(libraryId: LibraryId): void; get>(libraryId: LibraryId): LibraryIntegration | undefined; getAll(): LibraryIntegration>[]; updateFlags(flags: Record): void; getAffectedLibraries(flagKey: string): LibraryId[]; clear(): void; } /** * Global integration registry instance */ export declare const integrationRegistry: GlobalIntegrationRegistry; /** * Get the global integration registry */ export declare function getIntegrationRegistry(): IntegrationRegistry; /** * Library integration context value */ export interface LibraryIntegrationContextValue { /** Current flags */ readonly flags: Record; /** Get config for a library */ getLibraryConfig>(libraryId: LibraryId): TConfig | null; /** Check if a library is flag-enabled */ isLibraryEnabled(libraryId: LibraryId): boolean; /** Get all registered library IDs */ getRegisteredLibraries(): LibraryId[]; /** Subscribe to library config changes */ subscribeToLibrary>(libraryId: LibraryId, callback: (config: TConfig) => void): () => void; } /** * Props for LibraryIntegrationProvider */ export interface LibraryIntegrationProviderProps { readonly children: ReactNode; /** Flag provider function */ readonly getFlag: (flagKey: string) => boolean; /** All current flags */ readonly flags?: Record; /** Auto-sync with flag changes */ readonly autoSync?: boolean; /** Sync interval in ms */ readonly syncInterval?: number; } /** * Provider component for library integration */ export declare function LibraryIntegrationProvider({ children, getFlag, flags: externalFlags, autoSync, syncInterval, }: LibraryIntegrationProviderProps): React.JSX.Element; /** * Hook to access library integration context */ export declare function useLibraryIntegrationContext(): LibraryIntegrationContextValue; /** * Hook to get configuration for a specific library */ export declare function useLibraryFlags>(libraryId: LibraryId): TConfig | null; /** * Hook to check if a library feature is enabled */ export declare function useLibraryFeature(libraryId: LibraryId, featureKey: string): boolean; /** * Hook to subscribe to multiple library configs */ export declare function useMultiLibraryFlags>>(libraryIds: (keyof TConfigs)[]): Partial; /** * Create a simple flag-to-boolean config integration */ export declare function createSimpleIntegration(libraryId: LibraryId, flagKeys: string[]): LibraryIntegration>; /** * Batch register multiple integrations */ export declare function registerIntegrations(integrations: LibraryIntegration>[]): () => void; /** * Create a flag impact report across all libraries */ export declare function createFlagImpactReport(flagKey: string): { affectedLibraries: LibraryId[]; configChanges: Record>; }; export {};