import type { ApiConfig, NextUIResponseData, OverlayContent, PageContent } from '../types/builder.type'; import type { NotFrontComponent } from '../types'; export type NotFrontStore = Record; export type PageStore = { page?: PageContent | null; }; export type UserFlow = { apiConfig: ApiConfig; currentPageId: string; entries?: Record; pages: Record; isLoading: boolean; overlay: OverlayContent | null; isModalOpen?: boolean; isDrawerOpen?: boolean; /** `stablePage` only: `id` of the payload the single page was written from. */ stableSourceId?: string; /** `stablePage` only: how many times the single page was written. */ stableRevision?: number; }; export declare const useStore: import("zustand").UseBoundStore>; export declare const setNotFrontStore: (userFlowId: string, apiConfig: ApiConfig, page: PageContent, sessionState?: Record, sessionId?: string) => void | Promise; /** * The one writer of a `stablePage` flow. The flow holds exactly one page, keyed * by `userFlow`, replaced on every call. * * - `'mount'`: a fresh slice (no entries, no overlay, empty api config). * - `'update'`: keeps `entries`, `apiConfig` and the modal/drawer flags. * * `sourceId` is the `id` of the payload the page comes from; the revision * grows on every call so a late answer can tell it was overtaken. */ export declare const replaceStablePage: (userFlow: string, sourceId: string, components: NotFrontComponent[], mode: 'mount' | 'update', apiConfig?: ApiConfig) => void; /** Revision of the `stablePage` of a flow; `0` when it was never written. */ export declare const getStableRevision: (userFlow: string) => number; /** * Clears the overlay for a specific userFlow. * Useful for closing toasts, modals, or other overlay components. * * @param userFlow - The identifier for the current userFlow */ export declare const clearOverlay: (userFlow: string) => void; /** * Gets the current overlay for a specific userFlow. * * @param userFlow - The identifier for the current userFlow * @returns The current overlay content or null if no overlay is active */ export declare const getOverlay: (userFlow: string) => OverlayContent | null; export declare const setPage: (userFlow: string, response: NextUIResponseData) => void | Promise; /** * Updates the `entries` object of a specific userFlow in the store. * * - Merges the provided `partial` object into the existing entries. * - Preserves all other data in the store (immutably). * * @param userFlow - The identifier for the current userFlow (e.g., 'piper-editor'). * @param partial - A key-value map of new form entries to merge into the existing `entries` object. */ export declare const updateEntries: (userFlow: string, partial: Record) => void; /** * Removes a single key from `entries` for a userFlow. */ export declare const removeEntry: (userFlow: string, entryKey: string) => void; /** * Updates the isLoading state for a specific userFlow. * * @param userFlow - The identifier for the current userFlow * @param isLoading - The new loading state */ export declare const setIsLoading: (userFlow: string, isLoading: boolean) => void; /** * Updates the isModalOpen state for a specific userFlow. * * @param userFlow - The identifier for the current userFlow * @param isModalOpen - The new isModalOpen state */ export declare const setModalOpen: (userFlow: string, isModalOpen: boolean) => void; /** * Updates the isDrawerOpen state for a specific userFlow. * * @param userFlow - The identifier for the current userFlow * @param isDrawerOpen - The new isDrawerOpen state */ export declare const setDrawerOpen: (userFlow: string, isDrawerOpen: boolean) => void; /** * Updates the headers in the apiConfig for a specific userFlow. * This is used to update headers after token refresh or other authentication changes. * * @param userFlow - The identifier for the current userFlow * @param headers - The new headers value (can be string, object, or function) */ export declare const updateApiConfigHeaders: (userFlow: string, headers: ApiConfig['headers']) => void;