import { default as React, ReactNode, ComponentType, ReactElement } from 'react'; import { FlagKey } from '../flag-keys'; /** * Flag metadata exposed to children */ export interface FlagMetadata { /** The feature flag key */ readonly flagKey: string; /** Whether the flag is enabled */ readonly isEnabled: boolean; /** Source of the flag value */ readonly source: 'flag' | 'override' | 'default'; /** Timestamp when flag was evaluated */ readonly evaluatedAt: number; /** Variant name if applicable */ readonly variant?: string; } /** * Render props function type */ export type FlagRenderProps = { /** Whether the flag is enabled */ isEnabled: boolean; /** The feature flag key */ flagKey: string; /** Additional metadata */ metadata: FlagMetadata; /** Toggle function (if available) */ toggle?: () => void; }; /** * Props for FlagConfigurable component */ export interface FlagConfigurableProps { /** Feature flag key to check */ readonly flagKey: FlagKey | string; /** Content to render when flag is enabled (or render function) */ readonly children: ReactNode | ((props: FlagRenderProps) => ReactNode); /** Content to render when flag is disabled */ readonly fallback?: ReactNode; /** Invert the flag check (show children when disabled) */ readonly invert?: boolean; /** Custom flag getter function */ readonly getFlag?: (flagKey: string) => boolean; /** Callback when flag is evaluated */ readonly onEvaluation?: (metadata: FlagMetadata) => void; /** Callback when component is exposed (rendered) */ readonly onExposure?: (metadata: FlagMetadata) => void; /** Track exposure for analytics */ readonly trackExposure?: boolean; /** Variant identifier for A/B testing */ readonly variant?: string; /** Loading component while flag is being evaluated */ readonly loading?: ReactNode; /** Wrapper element type */ readonly as?: keyof React.JSX.IntrinsicElements; /** Additional wrapper props */ readonly wrapperProps?: Record; /** Debug mode - logs flag evaluation */ readonly debug?: boolean; /** Minimum display time to prevent flashing (ms) */ readonly minDisplayTime?: number; } /** * Context for nested flag access */ export interface FlagConfigurableContextValue { /** Parent flag key */ readonly parentFlagKey: string | null; /** Parent flag enabled state */ readonly parentEnabled: boolean; /** Depth of nesting */ readonly depth: number; /** Get configuration value */ readonly getConfig: (flagKey: string) => import('../../contexts/FlagConfigurableContext').ConfigurableValue | undefined; /** Set configuration value */ readonly setConfig: (flagKey: string, value: import('../../contexts/FlagConfigurableContext').ConfigurableValue) => void; /** Check if configuration exists */ readonly hasConfig: (flagKey: string) => boolean; /** Get all configurations */ readonly getAllConfigs: () => import('../../contexts/FlagConfigurableContext').FlagConfiguration[]; /** Render variant */ readonly renderVariant: (flagKey: string, variants: Record) => ReactNode; } /** * Hook to access parent flag context */ export declare function useFlagConfigurableContext(): FlagConfigurableContextValue; /** * Universal flag-configurable wrapper component */ export declare function FlagConfigurable({ flagKey, children, fallback, invert, getFlag, onEvaluation, onExposure, trackExposure, variant, as: WrapperElement, wrapperProps, }: FlagConfigurableProps): ReactElement | null; /** * Options for withFlagConfigurable HOC */ export interface WithFlagConfigurableOptions { /** Feature flag key */ readonly flagKey: FlagKey | string; /** Fallback component when flag is disabled */ readonly fallback?: ComponentType; /** Invert the flag check */ readonly invert?: boolean; /** Custom flag getter */ readonly getFlag?: (flagKey: string) => boolean; /** Track exposure */ readonly trackExposure?: boolean; } /** * HOC to wrap a component with flag configuration */ export declare function withFlagConfigurable

(Component: ComponentType

, options: WithFlagConfigurableOptions): ComponentType

; /** * Props for FlagConfigurableAB (A/B testing variant) */ export interface FlagConfigurableABProps { /** Feature flag key */ readonly flagKey: FlagKey | string; /** Variant A content (flag disabled) */ readonly variantA: ReactNode; /** Variant B content (flag enabled) */ readonly variantB: ReactNode; /** Track exposure for both variants */ readonly trackExposure?: boolean; /** Custom flag getter */ readonly getFlag?: (flagKey: string) => boolean; /** Callback on variant selection */ readonly onVariantSelected?: (variant: 'A' | 'B', metadata: FlagMetadata) => void; } /** * A/B testing variant of FlagConfigurable */ export declare function FlagConfigurableAB({ flagKey, variantA, variantB, trackExposure, getFlag, onVariantSelected, }: FlagConfigurableABProps): ReactElement; /** * Props for FlagConfigurableMulti (multi-variant) */ export interface FlagConfigurableMultiProps { /** Flag keys to check */ readonly flagKeys: (FlagKey | string)[]; /** Variants to render based on flag states */ readonly variants: Record; /** Default variant key if no match */ readonly defaultVariant?: string; /** Strategy for combining flags */ readonly strategy?: 'first' | 'all'; /** Custom flag getter */ readonly getFlag?: (flagKey: string) => boolean; } /** * Multi-variant flag configurable */ export declare function FlagConfigurableMulti({ flagKeys, variants, defaultVariant, strategy, getFlag: customGetFlag, }: FlagConfigurableMultiProps): ReactElement | null; /** * Props for FlagConfigurableGated (gate with redirect) */ export interface FlagConfigurableGatedProps { /** Feature flag key */ readonly flagKey: FlagKey | string; /** Content to render when flag is enabled */ readonly children: ReactNode; /** Redirect path when flag is disabled */ readonly redirectTo?: string; /** Fallback content when not redirecting */ readonly fallback?: ReactNode; /** Custom flag getter */ readonly getFlag?: (flagKey: string) => boolean; /** Custom redirect handler */ readonly onRedirect?: (path: string) => void; } /** * Gated access variant with redirect support */ export declare function FlagConfigurableGated({ flagKey, children, redirectTo, fallback, getFlag, onRedirect, }: FlagConfigurableGatedProps): ReactElement | null; /** * Debug component to show flag state */ export declare function FlagConfigurableDebug({ flagKey, getFlag, }: { flagKey: FlagKey | string; getFlag?: (flagKey: string) => boolean; }): ReactElement; /** * Component to list all flags and their states */ export declare function FlagConfigurableList({ flagKeys, getFlag, }: { flagKeys: (FlagKey | string)[]; getFlag?: (flagKey: string) => boolean; }): ReactElement;