import React, { PropsWithChildren } from "react";
import { FunctionMap } from "../hooks/useAsyncControl";
type CB = (...args: any[]) => void;
declare class Subscriber {
    private sharedCbs;
    private latest;
    register<C extends CB>(cbId: string, cb: C): (...args: Parameters<C>) => void;
    unregister<C extends CB>(cbId: string, cb: C): void;
    current(cbId: string): any;
}
/**
 * Defines the structure for context control sharing.
 */
export type ContextAsyncControlContextShape = {
    [controlId: string]: Subscriber;
};
/**
 * The context used to share state across components.
 */
export declare const ContextAsyncControlContext: React.Context<ContextAsyncControlContextShape>;
/**
 * Provider component to wrap the application context.
 */
export default function ContextAsyncControlProvider({ children, }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
/**
 * Hook to share state between components.
 */
export declare function useShareState<E>(controlId: string, stateId: string): readonly [E, (value: React.SetStateAction<E>) => void];
/**
 * Hook to control context with error and loading states.
 */
export declare function useContextControl<E, F extends FunctionMap>(controlId: string, functionsToWrap: F): {
    process: (asyncFn: Promise<any> | (() => Promise<any>)) => Promise<any>;
    loading: boolean;
    error: Error | E | undefined;
    setError: React.Dispatch<React.SetStateAction<Error | E | undefined>>;
    setLoading: React.Dispatch<React.SetStateAction<boolean>>;
} & F;
export {};
