import type { CollectionPopulationRequestHandler } from '@payloadcms/live-preview'; /** * This is a React hook to implement {@link https://payloadcms.com/docs/live-preview/overview Payload Live Preview}. * * @example * ```tsx * // Basic usage * const { data, isLoading } = useLivePreview({ * initialData: pageData, * serverURL: 'https://your-payload-server.com', * depth: 2, * }) * ``` * * @example * ```tsx * // Custom request handler (e.g., routing through middleware) * const customHandler: CollectionPopulationRequestHandler = async ({ endpoint, data }) => { * return fetch(`https://api.example.com/preview/${endpoint}`, { * method: 'POST', * body: JSON.stringify(data), * credentials: 'include', * }) * } * * const { data, isLoading } = useLivePreview({ * initialData: pageData, * serverURL: 'https://your-payload-server.com', * requestHandler: customHandler, * }) * ``` * * @link https://payloadcms.com/docs/live-preview/frontend */ export declare const useLivePreview: >(props: { apiRoute?: string; depth?: number; /** * To prevent the flicker of missing data on initial load, * you can pass in the initial page data from the server. */ initialData: T; /** * Custom handler to intercept and modify data fetching. * Useful for routing requests through middleware or applying transformations. */ requestHandler?: CollectionPopulationRequestHandler; serverURL: string; }) => { data: T; /** * To prevent the flicker of stale data while the post message is being sent, * you can conditionally render loading UI based on the `isLoading` state. */ isLoading: boolean; }; //# sourceMappingURL=useLivePreview.d.ts.map