import React, { type ReactNode } from 'react';
import type { FlagKey } from '@funkit/utils';
import { flagConfig as offlineConfig } from '../utils/flags/config';
import type { InferFlagType } from '../utils/flags/types';
export type FlagValue<K extends FlagKey> = InferFlagType<(typeof offlineConfig)[K]>;
export type FlagValues = {
    [K in FlagKey]?: FlagValue<K>;
};
export type GetFlagFunction = <K extends FlagKey>(flagKey: K, fallback?: FlagValue<K>) => FlagValue<K>;
export interface FunkitFlagsContextValue {
    /** Error fetching flag config from server */
    error: Error | null;
    /** Loaded flags - each flag may be undefined if configuration from server was missing or invalid */
    flags: FlagValues;
    /** Synchronously reads a single flag (derived for current user) - returns fallback while loading */
    getFlag: GetFlagFunction;
    /** Whether flags are currently loading */
    isLoading: boolean;
}
export declare const FunkitFlagsContext: React.Context<FunkitFlagsContextValue>;
export declare function FunkitFlagsProvider({ children }: {
    children: ReactNode;
}): React.JSX.Element;
export declare function useFlags(): FunkitFlagsContextValue;
export type FlagMiddleware<K extends FlagKey> = (flagValue: FlagValue<K>) => FlagValue<K>;
export declare function useFlag<K extends FlagKey>(flagKey: K, fallback?: FlagValue<K>, middleware?: FlagMiddleware<K>): FlagValue<K>;
