/** * useVersions Hook * * Provides document version history and comparison functionality. */ import type { DocumentLiveState, DocumentVersion } from '@pantheon-systems/css-client'; import type { P1Client } from '@pantheon-systems/css-client'; import type { ComponentDiff } from '../core/types.js'; export interface UseVersionsParams { client: P1Client; siteId: string; branchId: string; documentId: string | null; } export interface UseVersionsReturn { /** * List of versions for the current document. */ versions: DocumentVersion[]; /** * Whether the document is live, and when it was unpublished from live. Main branch only. */ liveState?: DocumentLiveState; /** * Loading state. */ loading: boolean; /** * Error state. */ error: Error | null; /** * Refresh the versions list. */ refresh: () => Promise; /** * Get the latest version. */ latestVersion: DocumentVersion | null; /** * Compare two versions. */ compareVersions: (beforeId: string, afterId: string) => Promise; /** * Get version by ID. */ getVersion: (versionId: string) => DocumentVersion | undefined; /** * Currently selected version for comparison. */ selectedVersion: DocumentVersion | null; /** * Set selected version for comparison. */ setSelectedVersion: (version: DocumentVersion | null) => void; /** * Comparison result. */ comparisonDiffs: ComponentDiff[] | null; /** * Whether comparison is loading. */ isComparing: boolean; } /** * Hook for managing document versions and comparisons. * * @param params - Configuration for version management * @returns Version state and operations * * @example * ```tsx * const { versions, compareVersions, latestVersion } = useVersions({ * client, * siteId, * branchId, * documentId, * }); * * // Compare versions * const diffs = await compareVersions(oldVersionId, newVersionId); * ``` */ export declare function useVersions({ client, siteId, branchId, documentId, }: UseVersionsParams): UseVersionsReturn;