import type { PerseusWidgetsMap, UserInputMap } from "@khanacademy/perseus-core"; export type InitializeUserInputCallback = (widgetOptions: PerseusWidgetsMap, problemNum: number) => void; export type HandleUserInputCallback = (widgetId: string, userInput: UserInputMap[keyof UserInputMap], widgetsEmpty: boolean) => void; type FunctionChildParams = { userInput: UserInputMap; handleUserInput: HandleUserInputCallback; initializeUserInput: InitializeUserInputCallback; }; type Props = { widgets: PerseusWidgetsMap; problemNum: number; initialUserInput?: UserInputMap; handleUserInput?: (userInput: UserInputMap, widgetsEmpty: boolean) => void; children: (payload: FunctionChildParams) => JSX.Element | null; }; /** * Initialize the starting UserInput state: * - for static widgets, that's the correct UserInput * - some widgets just like having something to start with * - some widgets use initial UserInput state as the "shuffled state" * (which is why we need problemNum since it's the seed) */ export declare function sharedInitializeUserInput(widgetOptions: PerseusWidgetsMap | undefined, problemNum: number): UserInputMap; /** * Restore user input from serialized state. It's tricky * because there is no definite type for serialized state, * so widgets need to handle it themselves and overall the process * is very fragile. * * @deprecated - do not use in new code. */ export declare function deriveUserInputFromSerializedState(serializedState: unknown, widgetsMap: PerseusWidgetsMap): UserInputMap; /** * UserInputManager is a stateful wrapper for handling and storing user input. * Ideally we'll get to a place where widgets are functional components * (or wrapped in functional components) and we can replace this with a * combination of Context/Hooks so that it can just wrap all of Perseus and * widgets can managing fetching/updating their own state via hooks. */ export default function UserInputManager(props: Props): JSX.Element | null; export {};