import { DatasetsResponse, DatasetsResponse as DatasetsResponse$1, SanityProjectMember } from "@sanity/client";
import { AccessResourceType, ActionsResult, Application, ApplicationInclude, ApplicationsOptions, ApplicationsResponse, AuthState, ClientOptions, Comment, CommentThread, CommentsOptions, CreateCommentOptions, CurrentUser, DatasetHandle, DocumentAction, DocumentEvent, DocumentHandle as DocumentHandle$1, DocumentOptions, DocumentPermissionsResult, DocumentPresence, DocumentResource, DocumentTypeHandle as DocumentTypeHandle$1, FavoriteStatusResponse, GetUserOptions, GetUsersOptions, Installation, InstallationInclude, InstallationsOptions, InstallationsResponse, JsonMatch, OAuthTokens, Organization, OrganizationOptions, Organizations, OrganizationsOptions, PresenceSelection, PreviewValue, Project, ProjectHandle, ProjectOptions, ProjectsOptions, QueryOptions, ReleaseAction, ReleaseDocument, RemoveCommentOptions, ReplyToCommentOptions, ResolveDocument, ResolveProjectionResult, ResolveQueryResult, SanityConfig, SanityInstance, SanityUser, SetCommentStatusOptions, TokenSource, UpdateCommentOptions, UserPresence } from "@sanity/sdk";
import "@sanity/sdk/_internal";
import React$1, { PropsWithChildren, ReactElement, ReactNode } from "react";
import { FallbackProps } from "react-error-boundary";
import { CanvasResource, MediaResource, StudioResource } from "@sanity/message-protocol";
import { FrameMessage, WindowMessage } from "@sanity/sdk/comlink";
import { AgentGenerateOptions, AgentPatchOptions, AgentPatchResult, AgentPromptOptions, AgentPromptResult, AgentTransformOptions, AgentTranslateOptions } from "@sanity/sdk/agent";
import { Path, SanityDocument, SortOrderingItem, SortOrderingItem as SortOrderingItem$1 } from "@sanity/types";
export * from "@sanity/sdk";
/**
 * @alpha
 */
type LoginErrorProps = FallbackProps;
/**
 * @internal
 */
interface AuthBoundaryProps {
  /**
   * Custom component to render the login screen.
   * Receives all props. Defaults to {@link Login}.
   */
  LoginComponent?: React.ComponentType<{
    header?: React.ReactNode;
    footer?: React.ReactNode;
  }>;
  /**
   * Custom component to render during OAuth callback processing.
   * Receives all props. Defaults to {@link LoginCallback}.
   */
  CallbackComponent?: React.ComponentType<{
    header?: React.ReactNode;
    footer?: React.ReactNode;
  }>;
  /**
   * Custom component to render when authentication errors occur.
   * Receives error boundary props and layout props. Defaults to
   * {@link LoginError}
   */
  LoginErrorComponent?: React.ComponentType<LoginErrorProps>;
  /** Header content to display */
  header?: React.ReactNode;
  /**
   * The project IDs to use for organization verification.
   */
  projectIds?: string[];
  /** Footer content to display */
  footer?: React.ReactNode;
  /** Protected content to render when authenticated */
  children?: React.ReactNode;
  /**
   * Whether to verify that the project belongs to the organization specified in the dashboard context.
   * By default, organization verification is enabled when running in a dashboard context.
   *
   * WARNING: Disabling organization verification is NOT RECOMMENDED and may cause your application
   * to break in the future. This should never be disabled in production environments.
   */
  verifyOrganization?: boolean;
}
/**
 * A component that handles authentication flow and error boundaries for a
 * protected section of the application.
 *
 * @remarks
 * This component manages different authentication states and renders the
 * appropriate components based on that state.
 *
 * @example
 * ```tsx
 * function App() {
 *   return (
 *     <AuthBoundary header={<MyLogo />}>
 *       <ProtectedContent />
 *     </AuthBoundary>
 *   )
 * }
 * ```
 *
 * @internal
 */
export declare function AuthBoundary({ LoginErrorComponent, ...props }: AuthBoundaryProps): React.ReactNode;
/**
 * @public
 * @category Types
 * @category Components
 */
interface SanityAppProps {
  /**
   * One or more SanityConfig objects providing a project ID and dataset name.
   * Optional when `SanityApp` is rendered inside an `SDKStudioContext` provider
   * (e.g. inside Sanity Studio) — the config is derived from the workspace
   * automatically.
   */
  config?: SanityConfig | SanityConfig[];
  resources?: Record<string, DocumentResource>;
  children: React.ReactNode;
  fallback: React.ReactNode;
  /**
   * Set this to automatically fetch and register the organization's media library and canvas as named resources.
   * These resources will be available to hooks as `media-library` and `canvas`.
   *
   * The SDK App must be running in the organization's Dashboard to use this feature.
   *
   * @example
   * ```tsx
   *
   * const MyApp = () => {
   *   // should "just work" because of inferMediaLibraryAndCanvas.
   *   const {data: assets} = useDocuments({
   *     documentType: 'sanity.asset',
   *     resourceName: 'media-library',
   *   })
   *   return (
   *     <div>
   *       {assets.map((asset) => (
   *         <div key={asset._id}>{asset.originalFilename}</div>
   *       ))}
   *     </div>
   *   )
   * }
   * <SanityApp inferMediaLibraryAndCanvas>
   *   <MyApp />
   * </SanityApp>
   * ```
   */
  inferMediaLibraryAndCanvas?: boolean;
}
/**
 * @public
 *
 * The SanityApp component provides your Sanity application with access to your Sanity configuration,
 * as well as application context and state which is used by the Sanity React hooks. Your application
 * must be wrapped with the SanityApp component to function properly.
 *
 * The `config` prop on the SanityApp component accepts either a single {@link SanityConfig} object, or an array of them.
 * This allows your app to work with one or more of your organization's datasets.
 *
 * When rendered inside a Sanity Studio that provides `SDKStudioContext`, the `config` prop is
 * optional — `SanityApp` will automatically derive `projectId`, `dataset`, and auth from the
 * Studio workspace.
 *
 * @remarks
 * When passing multiple SanityConfig objects to the `config` prop, the first configuration in the array becomes the default
 * configuration used by the App SDK Hooks.
 *
 * When both `config` and `SDKStudioContext` are available, the explicit `config` takes precedence.
 *
 * @category Components
 * @param props - Your Sanity configuration and the React children to render
 * @returns Your Sanity application, integrated with your Sanity configuration and application context
 *
 * @example
 * ```tsx
 * import { SanityApp, type SanityConfig } from '@sanity/sdk-react'
 *
 * import MyAppRoot from './Root'
 *
 * // Single project configuration
 * const mySanityConfig: SanityConfig = {
 *   projectId: 'my-project-id',
 *   dataset: 'production',
 * }
 *
 * // Or multiple project configurations
 * const multipleConfigs: SanityConfig[] = [
 *   // Configuration for your main project. This will be used as the default project for hooks.
 *   {
 *     projectId: 'marketing-website-project',
 *     dataset: 'production',
 *   },
 *   // Configuration for a separate blog project
 *   {
 *     projectId: 'blog-project',
 *     dataset: 'production',
 *   },
 *   // Configuration for a separate ecommerce project
 *   {
 *     projectId: 'ecommerce-project',
 *     dataset: 'production',
 *   }
 * ]
 *
 * export default function MyApp() {
 *   return (
 *     <SanityApp config={mySanityConfig} fallback={<div>Loading…</div>}>
 *       <MyAppRoot />
 *     </SanityApp>
 *   )
 * }
 * ```
 */
export declare function SanityApp({ children, fallback, config: configProp, ...props }: SanityAppProps): ReactElement;
/**
 * @internal
 */
interface SDKProviderProps extends AuthBoundaryProps {
  children: ReactNode;
  config: SanityConfig | SanityConfig[];
  fallback: ReactNode;
  resources?: Record<string, DocumentResource>;
  /** When set, automatically fetches and registers the organization's media library and canvas as named resources. */
  inferMediaLibraryAndCanvas?: boolean;
}
/**
 * @internal
 *
 * Top-level context provider that provides access to the Sanity SDK.
 */
export declare function SDKProvider({ children, config, fallback, inferMediaLibraryAndCanvas, ...props }: SDKProviderProps): ReactElement;
/**
 * React SDK resource handle — extends the core DatasetHandle with `resourceName`
 * for context-based resource resolution.
 *
 * Use this (or its subtypes) as the options type for custom hooks that need to
 * accept a resource. It accepts a `resource` object, a `resourceName` registered
 * via the `resources` prop on `<SanityApp>`, or a bare `projectId`/`dataset` pair
 * for backward compatibility.
 *
 * @public
 * @category Types
 * @category Platform
 */
interface ResourceHandle<TDataset extends string = string, TProjectId extends string = string> extends DatasetHandle<TDataset, TProjectId> {
  /**
   * Name of a resource registered via the `resources` prop on `<SanityApp>`.
   * Resolved to a `DocumentResource` at the React layer.
   */
  resourceName?: string;
}
/**
 * React SDK document-type handle. Adds `resourceName` to the core `DocumentTypeHandle`.
 * @public
 * @category Types
 * @category Platform
 */
interface DocumentTypeHandle<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentTypeHandle$1<TDocumentType, TDataset, TProjectId> {
  resourceName?: string;
}
/**
 * React SDK document handle. Adds `resourceName` to the core `DocumentHandle`.
 *
 * Import from `@sanity/sdk-react` (not `@sanity/sdk`) when writing option types
 * for hooks — this version understands `resourceName` resolution.
 *
 * @public
 * @category Types
 * @category Platform
 */
interface DocumentHandle<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle$1<TDocumentType, TDataset, TProjectId> {
  resourceName?: string;
}
/**
 * This provider is used to provide the Comlink token refresh feature.
 * It is used to automatically request a new token on 401 error if enabled.
 * @public
 * @category Components
 */
export declare const ComlinkTokenRefreshProvider: React$1.FC<PropsWithChildren>;
interface RenderSanitySDKAppOptions {
  reactStrictMode?: boolean;
}
/** In-flight CLI PR is using named sources since it's aspirational.
 *  We can transform the shape in this function until it's finalized.
 */
interface NamedSources {
  [key: string]: SanityConfig;
}
/** @internal */
export declare function renderSanityApp(rootElement: HTMLElement | null, namedSources: NamedSources, options: RenderSanitySDKAppOptions, children: React.ReactNode): () => void;
/**
 * Props for the ResourceProvider component
 * @internal
 */
interface ResourceProviderProps extends SanityConfig {
  /**
   * The document resource (project/dataset, media library, or canvas)
   * for this subtree. Hooks that don't specify an explicit resource will
   * use this value.
   */
  resource?: DocumentResource;
  /**
   * React node to show while content is loading.
   * Used as the fallback for the internal Suspense boundary.
   */
  fallback: React.ReactNode;
  children: React.ReactNode;
}
/**
 * Provides Sanity configuration to child components through React Context.
 *
 * The instance it creates lives as long as the page and is never disposed, because React also runs
 * effect cleanups when `<Activity>` hides a tree, and a hidden app must come back with a live instance.
 *
 * @internal
 *
 * @example
 * ```tsx
 * <ResourceProvider
 *   resource={{ projectId: 'your-project-id', dataset: 'production' }}
 *   fallback={<LoadingSpinner />}
 * >
 *   <YourApp />
 * </ResourceProvider>
 * ```
 */
export declare function ResourceProvider({ children, fallback, resource, ...config }: ResourceProviderProps): React.ReactNode;
/**
 * Props for the SanityInstanceProvider component
 * @public
 * @category Types
 * @category Components
 */
interface SanityInstanceProviderProps {
  /**
   * A pre-created SanityInstance to provide to child components.
   * The caller owns the instance lifecycle — SanityInstanceProvider
   * will not dispose it on unmount.
   */
  instance: SanityInstance;
  /**
   * React node to show while content is loading.
   * Used as the fallback for the internal Suspense boundary.
   */
  fallback: React.ReactNode;
  children: React.ReactNode;
}
/**
 * Provides an externally-created Sanity instance to child components through React Context.
 *
 * @internal
 *
 * @remarks
 * Unlike {@link ResourceProvider}, this component does not create a SanityInstance.
 * The caller is responsible for creating the instance via `createSanityInstance` and disposing
 * it when appropriate. This is useful when a non-React system layer (e.g. a state machine)
 * owns the instance and the React tree should consume it without managing its lifecycle.
 *
 * All SDK hooks (`useSanityInstance`, `useDocuments`, etc.) will read from the provided instance.
 *
 * @example Providing a pre-created instance
 * ```tsx
 * import { createSanityInstance, type SanityConfig } from '@sanity/sdk'
 * import { SanityInstanceProvider } from '@sanity/sdk-react'
 *
 * const config: SanityConfig = {
 *   projectId: 'my-project-id',
 *   dataset: 'production',
 * }
 *
 * const instance = createSanityInstance(config)
 *
 * function App() {
 *   return (
 *     <SanityInstanceProvider instance={instance} fallback={<div>Loading...</div>}>
 *       <MyApp />
 *     </SanityInstanceProvider>
 *   )
 * }
 * ```
 *
 * @category Components
 */
export declare function SanityInstanceProvider({ instance, fallback, children }: SanityInstanceProviderProps): React.ReactNode;
/**
 * Minimal duck-typed interface representing a Sanity Studio workspace.
 * The Studio's `Workspace` type satisfies this naturally — no import
 * dependency on the `sanity` package is required.
 *
 * @public
 * @category Types
 * @category Components
 */
interface StudioWorkspaceHandle {
  /** The Sanity project ID for this workspace. */
  projectId: string;
  /** The dataset name for this workspace. */
  dataset: string;
  /**
   * Whether the Studio has determined the user is authenticated.
   * When `true` and the token source emits `null`, the SDK infers
   * cookie-based auth is in use and skips the logged-out state.
   */
  authenticated?: boolean;
  /** Authentication state for this workspace. */
  auth: {
    /**
     * Reactive token source from the Studio's auth store.
     * When present, the SDK subscribes for ongoing token sync — the Studio
     * is the single authority for auth and handles token refresh.
     *
     * Optional because Studios before Aug 2022 may not expose it. When
     * absent, the SDK falls back to localStorage/cookie discovery.
     */
    token?: TokenSource;
  };
}
/**
 * React context that allows the SDK to auto-detect when it is running
 * inside a Sanity Studio. The Studio provides a workspace handle via this
 * context, and `SanityApp` reads it to derive `projectId`, `dataset`, and
 * a reactive auth token — eliminating the need for manual configuration.
 *
 * @remarks
 * This context is defined in `@sanity/sdk-react` and provided by the Studio.
 * The Studio imports it from this package and wraps its component tree:
 *
 * ```tsx
 * import {SDKStudioContext} from '@sanity/sdk-react'
 *
 * function StudioRoot({children}) {
 *   const workspace = useWorkspace()
 *   return (
 *     <SDKStudioContext.Provider value={workspace}>
 *       {children}
 *     </SDKStudioContext.Provider>
 *   )
 * }
 * ```
 *
 * When `SanityApp` is rendered inside this provider, it auto-configures
 * without any `config` prop:
 *
 * ```tsx
 * <SanityApp fallback={<Loading />}>
 *   <MyComponent />
 * </SanityApp>
 * ```
 *
 * @public
 * @category Components
 */
export declare const SDKStudioContext: import("react").Context<StudioWorkspaceHandle | null>;
/**
 * The value returned by a fetcher-backed hook. The hook suspends until the
 * first fetch succeeds, so `data` is always present once your component renders.
 *
 * @public
 * @category Types
 * @category Platform
 */
interface FetcherHookResult<TData> {
  /** The resolved data. Guaranteed present — the hook suspends until the first fetch succeeds. */
  data: TData;
  /** A fetch for this entry is in flight (background revalidation or a `refetch()`). */
  isFetching: boolean;
  /** The most recent background-fetch failure while data still renders; cleared by the next success. */
  error: unknown;
  /** Imperatively refetch, bypassing staleness. Resolves with the refreshed data. */
  refetch: () => Promise<TData>;
}
/**
 * Checks whether the current user holds the given permissions on a resource.
 *
 * The hook suspends until the first fetch succeeds, so `data` is always present.
 * `data` maps each requested permission to whether the user has it — keyed by
 * exactly the permission strings you passed.
 *
 * @public
 * @param resourceType - The type of resource (e.g. `'project'`, `'organization'`).
 * @param resourceId - The resource id.
 * @param permissions - The permission names to check.
 * @returns The result envelope `{data, isFetching, error, refetch}`.
 * @category Permissions
 */
export declare const useCheckPermissions: <Permission extends string>(resourceType: AccessResourceType, resourceId: string, permissions: Permission[]) => FetcherHookResult<Record<Permission, boolean>>;
interface Subscription {
  unsubscribe(): void;
}
interface Observer<T> {
  next?: (value: T) => void;
  error?: (err: unknown) => void;
  complete?: () => void;
}
interface Subscribable<T> {
  subscribe(observer: Observer<T>): Subscription;
  subscribe(next: (value: T) => void, error?: (err: unknown) => void, complete?: () => void): Subscription;
}
/**
 * @alpha
 * Generates content for a document (or specific fields) via Sanity Agent Actions.
 *
 * @remarks
 * This hook provides a stable callback to trigger AI-powered content generation for documents.
 *
 * Features:
 * - Uses instruction templates with `$variables` and supports `instructionParams` (constants, fields, documents, GROQ queries).
 * - Can target specific paths/fields; supports image generation when targeting image fields.
 * - Supports optional `temperature`, `async`, `noWrite`, and `conditionalPaths`.
 * - Returns a Subscribable stream for tracking generation progress.
 *
 * @returns A stable callback that triggers the action and yields a Subscribable stream.
 *
 * @example Basic content generation
 * ```tsx
 * import {useAgentGenerate} from '@sanity/sdk-react'
 *
 * function GenerateDescription({documentId}: {documentId: string}) {
 *   const generate = useAgentGenerate()
 *
 *   const handleGenerate = () => {
 *     generate({
 *       documentId,
 *       instruction: 'Write a compelling product description based on the title: $title',
 *       instructionParams: {
 *         title: {type: 'field', path: 'title'},
 *       },
 *       targetPaths: ['description'],
 *     }).subscribe({
 *       next: (result) => console.log('Generation progress:', result),
 *       complete: () => console.log('Generation complete'),
 *       error: (err) => console.error('Generation failed:', err),
 *     })
 *   }
 *
 *   return <button onClick={handleGenerate}>Generate Description</button>
 * }
 * ```
 *
 * @example Image generation
 * ```tsx
 * import {useAgentGenerate} from '@sanity/sdk-react'
 *
 * function GenerateProductImage({documentId}: {documentId: string}) {
 *   const generate = useAgentGenerate()
 *
 *   const handleGenerateImage = () => {
 *     generate({
 *       documentId,
 *       instruction: 'Generate a product photo for: $productName',
 *       instructionParams: {
 *         productName: {type: 'field', path: 'name'},
 *       },
 *       targetPaths: ['mainImage'],
 *     }).subscribe({
 *       complete: () => console.log('Image generated'),
 *     })
 *   }
 *
 *   return <button onClick={handleGenerateImage}>Generate Image</button>
 * }
 * ```
 *
 * @category Agent Actions
 */
export declare function useAgentGenerate(resourceHandle?: ResourceHandle): (options: AgentGenerateOptions) => Subscribable<unknown>;
/**
 * @alpha
 * Transforms an existing document or selected fields using Sanity Agent Actions.
 *
 * @remarks
 * This hook provides a stable callback to apply AI-powered transformations to document content.
 *
 * Features:
 * - Accepts `instruction` and `instructionParams` (constants, fields, documents, GROQ queries).
 * - Can write to the same or a different `targetDocument` (create/edit), and target specific paths.
 * - Supports per-path image transform instructions and image description operations.
 * - Optional `temperature`, `async`, `noWrite`, `conditionalPaths`.
 *
 * @returns A stable callback that triggers the action and yields a Subscribable stream.
 *
 * @example Transform text content
 * ```tsx
 * import {useAgentTransform} from '@sanity/sdk-react'
 *
 * function SummarizeArticle({documentId}: {documentId: string}) {
 *   const transform = useAgentTransform()
 *
 *   const handleSummarize = () => {
 *     transform({
 *       documentId,
 *       instruction: 'Summarize the following content into 2-3 sentences: $body',
 *       instructionParams: {
 *         body: {type: 'field', path: 'body'},
 *       },
 *       targetPaths: ['summary'],
 *     }).subscribe({
 *       complete: () => console.log('Summary generated'),
 *       error: (err) => console.error('Transform failed:', err),
 *     })
 *   }
 *
 *   return <button onClick={handleSummarize}>Generate Summary</button>
 * }
 * ```
 *
 * @example Transform and write to a different document
 * ```tsx
 * import {useAgentTransform} from '@sanity/sdk-react'
 *
 * function CreateVariant({sourceDocumentId}: {sourceDocumentId: string}) {
 *   const transform = useAgentTransform()
 *
 *   const handleCreateVariant = () => {
 *     transform({
 *       documentId: sourceDocumentId,
 *       instruction: 'Rewrite this product description for a younger audience: $description',
 *       instructionParams: {
 *         description: {type: 'field', path: 'description'},
 *       },
 *       targetDocument: {
 *         operation: 'create',
 *         _type: 'product',
 *       },
 *       targetPaths: ['description'],
 *     }).subscribe({
 *       next: (result) => console.log('New document:', result),
 *       complete: () => console.log('Variant created'),
 *     })
 *   }
 *
 *   return <button onClick={handleCreateVariant}>Create Youth Variant</button>
 * }
 * ```
 *
 * @category Agent Actions
 */
export declare function useAgentTransform(resourceHandle?: ResourceHandle): (options: AgentTransformOptions) => Subscribable<unknown>;
/**
 * @alpha
 * Translates documents or fields using Sanity Agent Actions.
 *
 * @remarks
 * This hook provides a stable callback to translate document content between languages using AI.
 *
 * Features:
 * - Configure `fromLanguage`/`toLanguage`, optional `styleGuide`, and `protectedPhrases`.
 * - Can write into a different `targetDocument`, and/or store language in a field.
 * - Optional `temperature`, `async`, `noWrite`, `conditionalPaths`.
 *
 * @returns A stable callback that triggers the action and yields a Subscribable stream.
 *
 * @example Basic translation
 * ```tsx
 * import {useAgentTranslate} from '@sanity/sdk-react'
 *
 * function TranslateArticle({documentId}: {documentId: string}) {
 *   const translate = useAgentTranslate()
 *
 *   const handleTranslate = () => {
 *     translate({
 *       documentId,
 *       fromLanguage: 'en',
 *       toLanguage: 'es',
 *       targetPaths: ['title', 'body'],
 *     }).subscribe({
 *       complete: () => console.log('Translation complete'),
 *       error: (err) => console.error('Translation failed:', err),
 *     })
 *   }
 *
 *   return <button onClick={handleTranslate}>Translate to Spanish</button>
 * }
 * ```
 *
 * @example Translation with style guide and protected phrases
 * ```tsx
 * import {useAgentTranslate} from '@sanity/sdk-react'
 *
 * function TranslateWithBrandTerms({documentId}: {documentId: string}) {
 *   const translate = useAgentTranslate()
 *
 *   const handleTranslate = () => {
 *     translate({
 *       documentId,
 *       fromLanguage: 'en',
 *       toLanguage: 'fr',
 *       styleGuide: 'Use formal French appropriate for business communication.',
 *       protectedPhrases: ['Acme Corp', 'PowerWidget Pro'],
 *       targetPaths: ['title', 'description'],
 *     }).subscribe({
 *       complete: () => console.log('Translation complete'),
 *     })
 *   }
 *
 *   return <button onClick={handleTranslate}>Translate to French</button>
 * }
 * ```
 *
 * @example Translate to a new document
 * ```tsx
 * import {useAgentTranslate} from '@sanity/sdk-react'
 *
 * function CreateTranslatedCopy({documentId}: {documentId: string}) {
 *   const translate = useAgentTranslate()
 *
 *   const handleCreateTranslation = () => {
 *     translate({
 *       documentId,
 *       fromLanguage: 'en',
 *       toLanguage: 'de',
 *       targetDocument: {
 *         operation: 'create',
 *         _type: 'article',
 *       },
 *       languageFieldPath: 'language',
 *     }).subscribe({
 *       next: (result) => console.log('New translated document:', result),
 *       complete: () => console.log('Translated copy created'),
 *     })
 *   }
 *
 *   return <button onClick={handleCreateTranslation}>Create German Copy</button>
 * }
 * ```
 *
 * @category Agent Actions
 */
export declare function useAgentTranslate(resourceHandle?: ResourceHandle): (options: AgentTranslateOptions) => Subscribable<unknown>;
/**
 * @alpha
 * Prompts the Content Agent using the same instruction template format as other agent actions.
 *
 * @remarks
 * This hook provides a stable callback to send prompts to the Content Agent and receive responses.
 * Unlike the other agent action hooks, this one does not modify documents—it simply
 * returns the AI's response.
 *
 * Features:
 * - Uses the same instruction template format with `$variables` as other actions.
 * - `format`: 'string' or 'json' (instruction must contain the word "json" for JSON responses).
 * - Supports `instructionParams` for dynamic content (constants, fields, documents, GROQ queries).
 * - Optional `temperature` for controlling response creativity.
 *
 * @returns A stable callback that triggers the action and resolves a Promise with the prompt result.
 *
 * @example Basic string prompt
 * ```tsx
 * import {useState} from 'react'
 * import {useAgentPrompt} from '@sanity/sdk-react'
 *
 * function AskQuestion() {
 *   const prompt = useAgentPrompt()
 *   const [answer, setAnswer] = useState<string>('')
 *
 *   const handleAsk = async () => {
 *     const result = await prompt({
 *       instruction: 'What are the top 3 benefits of content modeling?',
 *       format: 'string',
 *     })
 *     setAnswer(result.output)
 *   }
 *
 *   return (
 *     <div>
 *       <button onClick={handleAsk}>Ask AI</button>
 *       {answer && <p>{answer}</p>}
 *     </div>
 *   )
 * }
 * ```
 *
 * @example JSON response with instruction params
 * ```tsx
 * import {useState} from 'react'
 * import {useAgentPrompt} from '@sanity/sdk-react'
 *
 * interface TagSuggestions {
 *   tags: string[]
 *   reasoning: string
 * }
 *
 * function SuggestTags({documentId}: {documentId: string}) {
 *   const prompt = useAgentPrompt()
 *   const [suggestions, setSuggestions] = useState<TagSuggestions | null>(null)
 *
 *   const handleSuggest = async () => {
 *     const result = await prompt({
 *       instruction: `
 *         Based on the following article title and content, suggest relevant tags.
 *         Return as json with "tags" (array of strings) and "reasoning" (string).
 *         Title: $title
 *         Content: $body
 *       `,
 *       instructionParams: {
 *         title: {type: 'field', path: 'title', documentId},
 *         body: {type: 'field', path: 'body', documentId},
 *       },
 *       format: 'json',
 *     })
 *     setSuggestions(result.output as TagSuggestions)
 *   }
 *
 *   return (
 *     <div>
 *       <button onClick={handleSuggest}>Suggest Tags</button>
 *       {suggestions && (
 *         <div>
 *           <p>Reasoning: {suggestions.reasoning}</p>
 *           <ul>
 *             {suggestions.tags.map((tag) => (
 *               <li key={tag}>{tag}</li>
 *             ))}
 *           </ul>
 *         </div>
 *       )}
 *     </div>
 *   )
 * }
 * ```
 *
 * @category Agent Actions
 */
export declare function useAgentPrompt(resourceHandle?: ResourceHandle): (options: AgentPromptOptions) => Promise<AgentPromptResult>;
/**
 * @alpha
 * Schema-aware patching with Sanity Agent Actions.
 *
 * @remarks
 * This hook provides a stable callback to apply schema-validated patches to documents.
 * Unlike {@link useEditDocument}, this uses the Agent Actions API which provides
 * additional schema validation and safe merging capabilities.
 *
 * Features:
 * - Validates provided paths/values against the document schema and merges object values safely.
 * - Prevents duplicate keys and supports array appends (including after a specific keyed item).
 * - Accepts `documentId` or `targetDocument` (mutually exclusive).
 * - Requires `schemaId` (e.g., `'_.schemas.default'`) and `target` to specify patch operations.
 * - Optional `async`, `noWrite`, `conditionalPaths`.
 *
 * Each entry in `target` specifies a `path`, an `operation` (`'set'`, `'append'`, `'mixed'`, or `'unset'`),
 * and a `value` (required for all operations except `'unset'`).
 *
 * @returns A stable callback that triggers the action and resolves a Promise with the patch result.
 *
 * @example Basic field update
 * ```tsx
 * import {useAgentPatch} from '@sanity/sdk-react'
 *
 * function UpdateTitle({documentId}: {documentId: string}) {
 *   const patch = useAgentPatch()
 *
 *   const handleUpdate = async () => {
 *     const result = await patch({
 *       documentId,
 *       schemaId: '_.schemas.default',
 *       target: [
 *         {
 *           path: 'title',
 *           operation: 'set',
 *           value: 'Updated Title',
 *         },
 *         {
 *           path: 'lastModified',
 *           operation: 'set',
 *           value: new Date().toISOString(),
 *         },
 *       ],
 *     })
 *     console.log('Patch result:', result)
 *   }
 *
 *   return <button onClick={handleUpdate}>Update Title</button>
 * }
 * ```
 *
 * @example Append items to an array
 * ```tsx
 * import {useAgentPatch} from '@sanity/sdk-react'
 *
 * function AddTag({documentId}: {documentId: string}) {
 *   const patch = useAgentPatch()
 *
 *   const handleAddTag = async (newTag: string) => {
 *     await patch({
 *       documentId,
 *       schemaId: '_.schemas.default',
 *       target: {
 *         path: 'tags',
 *         operation: 'append',
 *         value: [newTag],
 *       },
 *     })
 *   }
 *
 *   return (
 *     <button onClick={() => handleAddTag('featured')}>
 *       Add Featured Tag
 *     </button>
 *   )
 * }
 * ```
 *
 * @example Insert array item after a specific key
 * ```tsx
 * import {useAgentPatch} from '@sanity/sdk-react'
 *
 * function InsertContentBlock({
 *   documentId,
 *   afterKey,
 * }: {
 *   documentId: string
 *   afterKey: string
 * }) {
 *   const patch = useAgentPatch()
 *
 *   const handleInsert = async () => {
 *     await patch({
 *       documentId,
 *       schemaId: '_.schemas.default',
 *       target: {
 *         path: ['content', {_key: afterKey}],
 *         operation: 'append',
 *         value: [{_type: 'block', text: 'New paragraph inserted here.'}],
 *       },
 *     })
 *   }
 *
 *   return <button onClick={handleInsert}>Insert Block</button>
 * }
 * ```
 *
 * @example Create a new document with targetDocument
 * ```tsx
 * import {useAgentPatch} from '@sanity/sdk-react'
 *
 * function CreateProduct() {
 *   const patch = useAgentPatch()
 *
 *   const handleCreate = async () => {
 *     const result = await patch({
 *       targetDocument: {
 *         operation: 'create',
 *         _type: 'product',
 *       },
 *       schemaId: '_.schemas.default',
 *       target: [
 *         {
 *           path: 'title',
 *           operation: 'set',
 *           value: 'New Product',
 *         },
 *         {
 *           path: 'price',
 *           operation: 'set',
 *           value: 29.99,
 *         },
 *         {
 *           path: 'inStock',
 *           operation: 'set',
 *           value: true,
 *         },
 *       ],
 *     })
 *     console.log('Created document:', result.documentId)
 *   }
 *
 *   return <button onClick={handleCreate}>Create Product</button>
 * }
 * ```
 *
 * @category Agent Actions
 */
export declare function useAgentPatch(resourceHandle?: ResourceHandle): (options: AgentPatchOptions) => Promise<AgentPatchResult>;
/**
 * Returns a single application by id.
 *
 * The hook suspends until the first fetch succeeds, so `data` is always present.
 * The `include` tokens you pass shape `data`: each requested token adds its
 * field, and omitted ones are absent from the type.
 *
 * @public
 * @param applicationId - The application id.
 * @param options - Optional `include` list to expand related resources.
 * @returns The result envelope `{data, isFetching, error, refetch}`.
 * @category Applications
 */
export declare const useApplication: <Include extends ApplicationInclude = never>(applicationId: string, options?: {
  include?: Include[];
}) => FetcherHookResult<Application<Include>>;
/**
 * Returns the applications matching the given options.
 *
 * The hook suspends until the first fetch succeeds, so `data` is always present.
 * The `include` tokens you pass shape `data.data`: each requested token adds its
 * field, and omitted ones are absent from the type.
 *
 * @public
 * @param options - Filter and include options for the applications list.
 * @returns The result envelope `{data, isFetching, error, refetch}`.
 * @category Applications
 */
export declare const useApplications: <Include extends ApplicationInclude = never>(options: ApplicationsOptions<Include>) => FetcherHookResult<ApplicationsResponse<Include>>;
/**
 * The value returned by a mutation-backed hook. The write-side counterpart to
 * {@link FetcherHookResult}: local `{mutate, isPending, error, data, reset}`
 * state around a core mutation action.
 *
 * @public
 * @category Types
 * @category Platform
 */
interface MutationHookResult<TInput, TResult> {
  /**
   * Runs the mutation. Resolves with the server response; rejects on failure
   * (the failure is also captured in {@link MutationHookResult.error}, so a
   * fire-and-forget caller should read `error` and an `await`ing caller should
   * `try`/`catch`).
   */
  mutate: (input: TInput) => Promise<TResult>;
  /** A mutation is currently in flight. */
  isPending: boolean;
  /** The most recent failure; cleared by the next `mutate` or `reset`. */
  error: unknown;
  /** The last successful server response, or `undefined` before the first success. */
  data: TResult | undefined;
  /** Clears state back to idle and abandons any in-flight result. */
  reset: () => void;
}
/**
 * Soft-deletes an application.
 *
 * @internal
 * @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
 */
export declare const useDeleteApplication: () => MutationHookResult<import("@sanity/sdk").DeleteApplicationInput, import("@sanity/sdk").DeletedResult>;
/**
 * Updates an application's mutable properties (title, icon, visibility).
 *
 * @internal
 * @returns The mutation envelope `{mutate, isPending, error, data, reset}`.
 */
export declare const useUpdateApplication: () => MutationHookResult<import("@sanity/sdk").UpdateApplicationInput, import("@sanity/sdk").ApplicationBase>;
/**
 * @internal
 * A React hook that subscribes to authentication state changes.
 *
 * This hook provides access to the current authentication state type from the Sanity auth store.
 * It automatically re-renders when the authentication state changes.
 *
 * @remarks
 * The hook uses `useSyncExternalStore` to safely subscribe to auth state changes
 * and ensure consistency between server and client rendering.
 *
 * @returns The current authentication state type
 *
 * @example
 * ```tsx
 * function AuthStatus() {
 *   const authState = useAuthState()
 *   return <div>Current auth state: {authState}</div>
 * }
 * ```
 */
export declare const useAuthState: () => AuthState;
/**
 * Hook to get the currently logged in user
 * @internal
 * @returns The current user or null if not authenticated
 */
export declare const useAuthToken: () => string | null;
type UseCurrentUser = {
  /**
   * @public
   *
   * Provides the currently authenticated user’s profile information.
   *
   * @category Users
   * @returns The current user data
   *
   * @example Rendering a basic user profile
   * ```
   * const user = useCurrentUser()
   *
   * return (
   *   <figure>
   *     <img src={user?.profileImage} alt=`Profile image for ${user?.name}` />
   *     <h2>{user?.name}</h2>
   *   </figure>
   * )
   * ```
   */
  (): CurrentUser | null;
};
/**
 * @public
 * @function
 * @TODO This should not return null — users of a custom app will always be authenticated via Core
 */
export declare const useCurrentUser: UseCurrentUser;
/**
 * @internal
 * A React hook that returns a function for handling authentication callbacks.
 *
 * @remarks
 * This hook provides access to the authentication store's callback handler,
 * which processes auth redirects by extracting the session ID and fetching the
 * authentication token. If fetching the long-lived token is successful,
 * `handleAuthCallback` will return a Promise that resolves a new location that
 * removes the short-lived token from the URL. Use this in combination with
 * `history.replaceState` or your own router's `replace` function to update the
 * current location without triggering a reload.
 *
 * @example
 * ```tsx
 * function AuthCallback() {
 *   const handleAuthCallback = useHandleAuthCallback()
 *   const router = useRouter() // Example router
 *
 *   useEffect(() => {
 *     async function processCallback() {
 *       // Handle the callback and get the cleaned URL
 *       const newUrl = await handleAuthCallback(window.location.href)
 *
 *       if (newUrl) {
 *         // Replace URL without triggering navigation
 *         router.replace(newUrl, {shallow: true})
 *       }
 *     }
 *
 *     processCallback().catch(console.error)
 *   }, [handleAuthCallback, router])
 *
 *   return <div>Completing login...</div>
 * }
 * ```
 *
 * @returns A callback handler function that processes OAuth redirects
 * @public
 */
export declare const useHandleAuthCallback: () => (locationHref?: string | undefined) => Promise<string | false>;
/**
 * A React hook that returns a function for handling the OAuth redirect callback.
 *
 * @remarks
 * This is the OAuth counterpart to `useHandleAuthCallback`. The returned
 * function invokes core's `handleOAuthCallback`, which validates the `state`
 * parameter, surfaces `?error=` redirects, exchanges the authorization `code`
 * for tokens, persists them, and transitions the auth state to `LOGGED_IN` —
 * all in core. On success it resolves the same-origin location the user was on
 * when the flow started (so deep links survive login), otherwise the callback
 * URL cleaned of the OAuth params (`code`, `state`, `error`,
 * `error_description`). It resolves `false` when there was nothing to handle.
 * The resolved URL may be a different route, so navigate to it rather than
 * only calling `history.replaceState`.
 *
 * `AuthBoundary` runs this for you when the app lands on the OAuth redirect
 * URI. Reach for this hook only when building a custom callback component.
 *
 * Concurrent calls are single-flight in core, so React StrictMode's double
 * invocation will not trigger a second code exchange, and a repeated call with
 * a stale callback URL is ignored once a session is established.
 *
 * @example
 * ```tsx
 * function OAuthCallback() {
 *   const handleCallback = useHandleOAuthCallback()
 *   const navigate = useNavigate() // your router's navigation
 *
 *   useEffect(() => {
 *     handleCallback(window.location.href)
 *       .then((nextUrl) => {
 *         // Returns the user to where they started, with OAuth params removed
 *         if (nextUrl) navigate(nextUrl, {replace: true})
 *       })
 *       .catch(console.error)
 *   }, [handleCallback, navigate])
 *
 *   return <div>Completing sign-in…</div>
 * }
 * ```
 *
 * @returns A callback handler that processes the OAuth redirect
 * @public
 * @category Authentication
 */
export declare const useHandleOAuthCallback: () => (locationHref?: string | undefined) => Promise<string | false>;
/**
 * @internal
 */
export declare function useLoginUrl(): string;
/**
 * Hook to log out of the current session
 * @internal
 * @returns A function to log out of the current session
 */
export declare const useLogOut: () => () => Promise<void>;
/**
 * A React hook that returns a function for starting the OAuth authorization-code + PKCE flow.
 *
 * @remarks
 * The returned function invokes core's `startOAuthAuthorization`, which generates
 * the PKCE `code_verifier`, `code_challenge` and `state`, persists the verifier and
 * state to `sessionStorage`, and navigates the browser to the authorize endpoint.
 * `clientId`, `redirectUri` and `organizationId` are read from the instance's
 * `auth.oauth` config. The returned promise rejects if the instance has no `auth.oauth` config.
 *
 * Pair with {@link useHandleOAuthCallback} on the redirect URI to complete the flow.
 *
 * @example
 * ```tsx
 * function LoginButton() {
 *   const authorize = useOAuthAuthorize()
 *   return <button onClick={() => authorize().catch(console.error)}>Sign in</button>
 * }
 * ```
 *
 * @returns A function that starts the OAuth flow by navigating to the authorization URL
 * @public
 * @category Authentication
 */
export declare const useOAuthAuthorize: () => () => Promise<void>;
/**
 * The current OAuth token state, plus actions to refresh and revoke it.
 *
 * @public
 * @category Types
 * @category Authentication
 */
interface UseOAuthTokensResult {
  /**
   * The stored OAuth tokens, or `null` when not logged in via OAuth. The
   * refresh token is omitted — core retains it internally for `refresh`.
   */
  tokens: Omit<OAuthTokens, 'refreshToken'> | null;
  /**
   * Returns whether the access token has expired, comparing the latest stored
   * `expiresAt` against the current time at the moment it is called. Both the
   * tokens and the clock are read at call time, so a reference captured in an
   * earlier render stays accurate after a `refresh`. Reading the clock does not
   * trigger a re-render, so call this in an event handler or effect rather than
   * during render. Returns `false` when there are no tokens.
   */
  isExpired: () => boolean;
  /**
   * Refresh via the OAuth `refresh_token` grant. When there is no refresh token,
   * core clears the stored tokens, logs the user out, and this resolves `null`.
   * Rejects on transient failures (network, 5xx, 408, 429), leaving tokens
   * unchanged so the call can be retried. Also rejects when the server rejects
   * the refresh token itself (other 4xx); core clears the tokens and logs out
   * first, so check `tokens` before retrying.
   */
  refresh: () => Promise<Omit<OAuthTokens, 'refreshToken'> | null>;
  /** Revoke the tokens at the OAuth server, clear them locally, and log out. */
  revoke: () => Promise<void>;
}
/**
 * A React hook that exposes the stored OAuth token state along with `refresh`
 * and `revoke` actions.
 *
 * @remarks
 * The token view is a synchronous read over core's token state source, so the
 * hook re-renders whenever tokens change — including changes made in another
 * tab, which core propagates via `storage` events.
 *
 * @returns The current {@link UseOAuthTokensResult}
 *
 * @example
 * ```tsx
 * function TokenStatus() {
 *   const {tokens, isExpired, refresh, revoke} = useOAuthTokens()
 *
 *   if (!tokens) return <div>Not signed in</div>
 *
 *   const handleRefresh = async () => {
 *     if (!isExpired()) return
 *     try {
 *       await refresh()
 *     } catch {
 *       // Transient failure (tokens unchanged, retry later) or the refresh
 *       // token was rejected (tokens now null, user is logged out).
 *     }
 *   }
 *
 *   return (
 *     <div>
 *       <p>Expires at {tokens.expiresAt.toLocaleTimeString()}</p>
 *       <button onClick={handleRefresh}>Refresh if expired</button>
 *       <button onClick={() => revoke()}>Revoke tokens</button>
 *     </div>
 *   )
 * }
 * ```
 *
 * @public
 * @category Authentication
 */
export declare function useOAuthTokens(): UseOAuthTokensResult;
/**
 * Hook that verifies the current projects belongs to the organization ID specified in the dashboard context.
 *
 * @public
 * @param disabled - When true, disables verification and skips project verification API calls
 * @returns Error message if the project doesn't match the organization ID, or null if all match or verification isn't needed
 * @category Projects
 * @example
 * ```tsx
 * function OrgVerifier() {
 *   const error = useVerifyOrgProjects()
 *
 *   if (error) {
 *     return <div className="error">{error}</div>
 *   }
 *
 *   return <div>Organization projects verified!</div>
 * }
 * ```
 */
export declare function useVerifyOrgProjects(disabled?: boolean, projectIds?: string[]): string | null;
/**
 * A React hook that provides a client that subscribes to changes in your application,
 *
 * @remarks
 * This hook is intended for advanced use cases and special API calls that the React SDK
 * does not yet provide hooks for. We welcome you to get in touch with us to let us know
 * your use cases for this!
 *
 * @category Platform
 * @returns A Sanity client
 *
 * @example
 * ```tsx
 * function MyComponent() {
 *   const client = useClient({apiVersion: '2024-11-12'})
 *   const [document, setDocument] = useState(null)
 *   useEffect(async () => {
 *     const doc = client.fetch('*[_id == "myDocumentId"]')
 *     setDocument(doc)
 *   }, [])
 *  return <div>{JSON.stringify(document) ?? 'Loading...'}</div>
 * }
 * ```
 *
 * @public
 * @function
 */
export declare const useClient: (options: ClientOptions) => import("@sanity/client").SanityClient;
declare global {
  interface SymbolConstructor {
    readonly observable: symbol;
  }
}
/**
 * @public
 */
type Status = 'idle' | 'handshaking' | 'connected' | 'disconnected';
/**
 * @public
 */
type MessageData = Record<string, unknown> | undefined;
/**
 * @internal
 */
type FrameMessageHandler<TWindowMessage extends WindowMessage> = (event: TWindowMessage['data']) => TWindowMessage['response'] | Promise<TWindowMessage['response']>;
/**
 * @internal
 */
interface UseFrameConnectionOptions<TWindowMessage extends WindowMessage> {
  name: string;
  connectTo: string;
  targetOrigin: string;
  onMessage?: { [K in TWindowMessage['type']]: (data: Extract<TWindowMessage, {
    type: K;
  }>['data']) => void; };
  heartbeat?: boolean;
  onStatus?: (status: Status) => void;
}
/**
 * @internal
 */
interface FrameConnection<TFrameMessage extends FrameMessage> {
  connect: (frameWindow: Window) => () => void;
  sendMessage: <T extends TFrameMessage['type']>(...params: Extract<TFrameMessage, {
    type: T;
  }>['data'] extends undefined ? [type: T] : [type: T, data: Extract<TFrameMessage, {
    type: T;
  }>['data']]) => void;
}
/**
 * @internal
 */
export declare function useFrameConnection<TFrameMessage extends FrameMessage, TWindowMessage extends WindowMessage>(options: UseFrameConnectionOptions<TWindowMessage>): FrameConnection<TFrameMessage>;
/**
 * @internal
 */
type WindowMessageHandler<TFrameMessage extends FrameMessage> = (event: TFrameMessage['data']) => TFrameMessage['response'];
/**
 * @internal
 */
interface UseWindowConnectionOptions<TMessage extends FrameMessage> {
  name: string;
  connectTo: string;
  onMessage?: Record<TMessage['type'], WindowMessageHandler<TMessage>>;
}
/**
 * @internal
 */
interface WindowConnection<TMessage extends WindowMessage> {
  sendMessage: <TType extends TMessage['type']>(type: TType, data?: Extract<TMessage, {
    type: TType;
  }>['data']) => void;
  fetch: <TResponse>(type: string, data?: MessageData, options?: {
    signal?: AbortSignal;
    suppressWarnings?: boolean;
    responseTimeout?: number;
  }) => Promise<TResponse>;
}
/**
 * @internal
 * Hook to wrap a Comlink node in a React hook.
 * Our store functionality takes care of the lifecycle of the node,
 * as well as sharing a single node between invocations if they share the same name.
 *
 * Generally not to be used directly, but to be used as a dependency of
 * Comlink-powered hooks like `useStudioWorkspacesByProjectIdDataset`.
 */
export declare function useWindowConnection<TWindowMessage extends WindowMessage, TFrameMessage extends FrameMessage>({ name, connectTo, onMessage }: UseWindowConnectionOptions<TFrameMessage>): WindowConnection<TWindowMessage>;
/**
 * Adds React hook support (resourceName resolution) to core types.
 * Prefer using the React-layer handle types (ResourceHandle, DocumentHandle)
 * from `@sanity/sdk-react` — this wrapper is kept for cases where overloads
 * don't fit (e.g. non-handle options objects).
 *
 * @typeParam T - The core type to extend (must have optional `resource` field)
 * @beta
 */
type WithResourceNameSupport<T extends {
  resource?: DocumentResource;
}> = T & {
  /**
   * Optional name of a resource to resolve from context.
   * If provided, will be resolved to a `DocumentResource` via `ResourcesContext`.
   * @beta
   */
  resourceName?: string;
};
/**
 * @public
 * @category Types
 * @category Comments
 */
interface CommentActions {
  /** Starts a thread on a document, or on one of its fields. */
  createComment: (options: WithResourceNameSupport<CreateCommentOptions>) => Promise<Comment>;
  /** Adds a reply to an existing thread. */
  replyToComment: (options: WithResourceNameSupport<ReplyToCommentOptions>) => Promise<Comment>;
  /** Rewrites a comment's message. */
  updateComment: (options: WithResourceNameSupport<UpdateCommentOptions>) => Promise<void>;
  /** Resolves or reopens a thread. Pass the thread's first comment. */
  setCommentStatus: (options: WithResourceNameSupport<SetCommentStatusOptions>) => Promise<void>;
  /** Deletes a comment, and its replies when it starts a thread. */
  removeComment: (options: WithResourceNameSupport<RemoveCommentOptions>) => Promise<void>;
}
/**
 * Returns the five comment write actions, bound to the current instance.
 *
 * Each writes optimistically: the change shows immediately and is rolled back
 * if the server rejects it, so an app can render straight from
 * {@link useComments} without tracking pending state itself.
 *
 * Creating is the exception, and `replyToComment` counts as creating. A comment
 * that fails to post stays on screen carrying `_state.createError` rather than
 * disappearing, so passing the same `commentId` again retries it instead of
 * losing what someone typed.
 *
 * The resource is resolved when an action is called rather than when the hook
 * runs, so one set of callbacks works across several resources. Pass `resource`
 * or `resourceName` per call to choose; otherwise the surrounding
 * `ResourceProvider` decides.
 *
 * @category Comments
 * @function
 * @returns The five write actions
 *
 * @example Resolve a thread
 * ```tsx
 * function ResolveButton({commentId}: {commentId: string}) {
 *   const {setCommentStatus} = useCommentActions()
 *
 *   return (
 *     <button onClick={() => setCommentStatus({commentId, status: 'resolved'})}>
 *       Resolve
 *     </button>
 *   )
 * }
 * ```
 *
 * @public
 */
export declare function useCommentActions(): CommentActions;
/**
 * @public
 * @category Types
 * @category Comments
 */
interface UseCommentsResult {
  /** Every matching comment, newest first, replies included. */
  comments: Comment[];
  /** True while switching to a different document or filter. */
  isPending: boolean;
}
/**
 * Reads a document's comments and keeps them up to date.
 *
 * Comments are shared with the Studio: they live in the project's comments
 * dataset, so a thread started here shows up there and the other way round. The
 * list is flat, replies included; reach for {@link useCommentThreads} to read it
 * grouped.
 *
 * Suspends until the comments have loaded. Switching document or filter is a
 * transition, so the previous list stays on screen and `isPending` goes true
 * rather than the component suspending again.
 *
 * @category Comments
 * @function
 * @param options - The document to read, optionally narrowed by `fieldPath` or `status`
 * @returns The matching comments, and whether a switch is in flight
 *
 * @example Count the open threads on a field
 * ```tsx
 * function TitleCommentCount({documentId}: {documentId: string}) {
 *   const {comments} = useComments({
 *     documentId,
 *     documentType: 'article',
 *     fieldPath: 'title',
 *     status: 'open',
 *   })
 *
 *   return <span>{comments.length}</span>
 * }
 * ```
 *
 * @public
 */
export declare function useComments(options: WithResourceNameSupport<CommentsOptions>): UseCommentsResult;
/**
 * @public
 * @category Types
 * @category Comments
 */
interface UseCommentThreadsResult {
  /** Newest thread first, each with its replies oldest first. */
  threads: CommentThread[];
  /** True while switching to a different document or filter. */
  isPending: boolean;
}
/**
 * Reads a document's comments grouped into threads.
 *
 * A thread is one comment plus its replies. Its `status` and `fieldPath` come
 * from the first comment, so filtering by either selects whole threads rather
 * than stray replies.
 *
 * Unlike the Studio, every thread is returned. The Studio hides threads whose
 * field has left the schema or is hidden by a conditional, which it can do
 * because it has the schema to check against. Inspect `fieldPath` yourself if
 * your app needs to do the same.
 *
 * @category Comments
 * @function
 * @param options - The document to read, optionally narrowed by `fieldPath` or `status`
 * @returns The matching threads, and whether a switch is in flight
 *
 * @example Render the open threads on a document
 * ```tsx
 * function Threads({documentId}: {documentId: string}) {
 *   const {threads} = useCommentThreads({
 *     documentId,
 *     documentType: 'article',
 *     status: 'open',
 *   })
 *
 *   return (
 *     <ul>
 *       {threads.map((thread) => (
 *         <li key={thread.threadId}>
 *           {thread.fieldPath || 'Document'} — {thread.commentsCount} comments
 *         </li>
 *       ))}
 *     </ul>
 *   )
 * }
 * ```
 *
 * @public
 */
export declare function useCommentThreads(options: WithResourceNameSupport<CommentsOptions>): UseCommentThreadsResult;
/**
 * Returns the currently active `DocumentResource` for the nearest resource context.
 *
 * Resolves in priority order:
 * 1. A `resource` prop on the nearest `<ResourceProvider>`
 * 2. The `projectId`/`dataset` from the current `SanityInstance` config
 * 3. `undefined` when neither is available
 *
 * @public
 * @category Platform
 *
 * @example
 * ```tsx
 * const resource = useResource()
 * console.log(resource?.projectId, resource?.dataset)
 * ```
 */
export declare function useResource(): DocumentResource | undefined;
/**
 * Retrieves the current Sanity instance from context
 *
 * @public
 *
 * @category Platform
 * @returns The current Sanity instance
 *
 * @remarks
 * This hook accesses the nearest Sanity instance from the React context.
 * The hook must be used within a component wrapped by a `ResourceProvider` or `SanityApp`.
 *
 * @example Get the current instance
 * ```tsx
 * const instance = useSanityInstance()
 * console.log(instance.config.projectId)
 * ```
 *
 * @throws Error if no SanityInstance is found in context
 */
export declare const useSanityInstance: () => SanityInstance;
/**
 * Props shared by {@link useFavorite} and {@link useUpdateFavorite}: a document
 * handle plus the resource it lives in.
 *
 * @internal
 */
interface UseFavoriteProps extends DocumentHandle$1 {
  resourceId?: string;
  resourceType: StudioResource['type'] | MediaResource['type'] | CanvasResource['type'];
  /**
   * The name of the schema collection this document belongs to.
   * Typically is the name of the workspace when used in the context of a studio.
   */
  schemaName?: string;
}
/**
 * @internal
 *
 * Reads whether a document is currently favorited. The write-side counterpart is
 * {@link useUpdateFavorite}.
 *
 * It works in both Dashboard runtimes and picks the transport for the current one:
 *
 * | Runtime | Transport | Suspends until | Returns `false` without throwing when |
 * | --- | --- | --- | --- |
 * | iframe | Comlink | the first status resolves | the status query fails |
 * | federated | message bus | capabilities publish, then `favorites.documents` while the host provides `favorites` | the host does not provide `favorites`, refuses `favorites.documents`, or does not publish it before the query deadline; a later publish shows once the hook renders again, like Comlink's cached status |
 *
 * Dashboard always provides favorites, a message bus host may not. There
 * {@link useUpdateFavorite} rejects, so hide the control unless `useCapabilities().favorites`
 * from `@sanity/sdk-react/dashboard` is `true`.
 *
 * Wrap the component in a `<Suspense>` boundary. A favorite is identified by its published
 * document ID, type, resource and `schemaName` (workspace), like in Dashboard, so draft and
 * version IDs read the favorite of their document.
 *
 * @param props - The document handle plus the resource it lives in.
 * @returns `true` when the document is favorited, otherwise `false`.
 *
 * @example
 * ```tsx
 * function FavoriteLabel(props: DocumentActionProps) {
 *   const {documentId, documentType} = props
 *   const isFavorited = useFavorite({documentId, documentType, resourceType: 'studio'})
 *
 *   return <span>{isFavorited ? 'Favorited' : 'Not favorited'}</span>
 * }
 * ```
 */
export declare function useFavorite(props: UseFavoriteProps): boolean;
interface DocumentInteractionHistory {
  recordEvent: (eventType: 'viewed' | 'edited' | 'created' | 'deleted') => void;
}
/**
 * @internal
 */
interface UseRecordDocumentHistoryEventProps extends DocumentHandle$1 {
  resourceType: StudioResource['type'] | MediaResource['type'] | CanvasResource['type'];
  /**
   * The resource the document lives in. Optional for studios over Comlink, where the iframe
   * host fills it from context; always required under the message bus, which has no such
   * context and throws when it is missing.
   */
  resourceId?: string;
  /**
   * The name of the schema collection this document belongs to.
   * Typically is the name of the workspace when used in the context of a studio.
   */
  schemaName?: string;
}
/**
 * @internal
 * Hook for recording document interaction history in a Dashboard application.
 * This hook provides functionality to record document interactions.
 *
 * It works in both Dashboard runtimes and picks the transport for the current one:
 *
 * | Runtime | Transport | `resourceId` | Suspends until |
 * | --- | --- | --- | --- |
 * | iframe | Comlink | optional for studios | the node connects |
 * | federated | message bus | required | capabilities publish |
 *
 * Under the message bus the hook always suspends until the host publishes its capabilities;
 * only once they resolve does `recordEvent` run, and it then no-ops on every call when the
 * host does not provide the `history` capability. There is no synchronous no-op path.
 *
 * @category History
 * @param documentHandle - The document handle containing document ID and type, like `{_id: '123', _type: 'book'}`
 * @returns An object containing:
 * - `recordEvent` - Function to record document interactions
 *
 * @example
 * ```tsx
 * import {useRecordDocumentHistoryEvent} from '@sanity/sdk-react'
 * import {Button} from '@sanity/ui'
 * import {Suspense} from 'react'
 *
 * function RecordEventButton(props: DocumentActionProps) {
 *   const {documentId, documentType, resourceType, resourceId} = props
 *   const {recordEvent} = useRecordDocumentHistoryEvent({
 *     documentId,
 *     documentType,
 *     resourceType,
 *     resourceId,
 *   })
 *   return (
 *     <Button
 *       onClick={() => recordEvent('viewed')}
 *       text="Viewed"
 *     />
 *   )
 * }
 *
 * // Wrap the component with Suspense since the hook may suspend
 * function MyDocumentAction(props: DocumentActionProps) {
 *   return (
 *     <Suspense fallback={<Button text="Loading..." disabled />}>
 *       <RecordEventButton {...props} />
 *     </Suspense>
 *   )
 * }
 * ```
 */
export declare function useRecordDocumentHistoryEvent(props: UseRecordDocumentHistoryEventProps): DocumentInteractionHistory;
interface DashboardResource {
  id: string;
  name: string;
  title: string;
  basePath: string;
  projectId: string;
  dataset: string;
  type: string;
  userApplicationId: string;
  url: string;
}
interface WorkspacesByProjectIdDataset {
  [key: `${string}:${string}`]: DashboardResource[];
}
interface StudioWorkspacesResult {
  workspacesByProjectIdAndDataset: WorkspacesByProjectIdDataset;
  error: string | null;
}
/**
 * Hook that fetches studio workspaces and organizes them by projectId:dataset
 *
 * Works in both Dashboard runtimes: it derives workspaces from the `applications.list` message
 * bus topic when a host has installed the bus, and falls back to the Comlink connection otherwise.
 * @internal
 *
 * @example
 * ```tsx
 * import {useStudioWorkspacesByProjectIdDataset} from '@sanity/sdk-react'
 * import {Card, Code, Button} from '@sanity/ui'
 * import {Suspense} from 'react'
 *
 * function WorkspacesCard() {
 *   const {workspacesByProjectIdAndDataset, error} = useStudioWorkspacesByProjectIdDataset()
 *   if (error) {
 *     return <div>Error: {error}</div>
 *   }
 *   return (
 *     <Card padding={4} radius={2} shadow={1}>
 *       <Code language="json">
 *         {JSON.stringify(workspacesByProjectIdAndDataset, null, 2)}
 *       </Code>
 *     </Card>
 *   )
 * }
 *
 * // Wrap the component with Suspense since the hook may suspend
 * function DashboardWorkspaces() {
 *   return (
 *     <Suspense fallback={<Button text="Loading..." disabled />}>
 *       <WorkspacesCard />
 *     </Suspense>
 *   )
 * }
 * ```
 */
export declare function useStudioWorkspacesByProjectIdDataset(): StudioWorkspacesResult;
/**
 * The value returned by {@link useUpdateFavorite}.
 *
 * @internal
 */
interface UpdateFavorite {
  /** Adds the document to favorites. */
  favorite: () => Promise<FavoriteStatusResponse>;
  /** Removes the document from favorites. */
  unfavorite: () => Promise<FavoriteStatusResponse>;
  /** A favorite or unfavorite mutation is currently in flight. */
  isPending: boolean;
  /** The most recent failure; cleared by the next call or `reset`. */
  error: unknown;
  /** Clears error and pending state back to idle. */
  reset: () => void;
}
/**
 * @internal
 *
 * Adds or removes a document from favorites. The read-side counterpart is {@link useFavorite}.
 * Under Comlink it shows the new state as soon as the write is sent and rolls back if the write
 * fails. Under the message bus it follows the host's `favorites.documents`.
 *
 * Unlike {@link useFavorite}, this hook does not suspend. It picks the transport for the current
 * Dashboard runtime:
 *
 * | Runtime | Transport | `favorite`/`unfavorite` resolve | They reject when |
 * | --- | --- | --- | --- |
 * | iframe | Comlink | once Dashboard confirms the write | Dashboard reports a failure or does not reply within 10 seconds |
 * | federated | message bus | once `favorites.documents` reflects the change | no host answers, the host refuses, or it does not reply within 10 seconds |
 *
 * A rejection also lands in `error`, so catch the returned promise or render `error`. A timed-out
 * write may still apply.
 *
 * Dashboard always provides favorites, a message bus host may not. There `favorite`/`unfavorite`
 * reject with `NO_RESPONDER` while {@link useFavorite} returns `false`, so hide the control unless
 * `useCapabilities().favorites` from `@sanity/sdk-react/dashboard` is `true`.
 *
 * @param props - The document handle plus the resource it lives in.
 * @returns `favorite`/`unfavorite` actions and the `{isPending, error, reset}`
 *   mutation state.
 *
 * @example
 * ```tsx
 * function FavoriteButton(props: DocumentActionProps) {
 *   const {documentId, documentType} = props
 *   const handle = {documentId, documentType, resourceType: 'studio'} as const
 *   const isFavorited = useFavorite(handle)
 *   const {favorite, unfavorite, isPending} = useUpdateFavorite(handle)
 *
 *   return (
 *     <Button
 *       disabled={isPending}
 *       onClick={() => (isFavorited ? unfavorite() : favorite())}
 *       text={isFavorited ? 'Remove from favorites' : 'Add to favorites'}
 *     />
 *   )
 * }
 *
 * // Wrap the component with Suspense since useFavorite suspends
 * function MyDocumentAction(props: DocumentActionProps) {
 *   return (
 *     <Suspense fallback={<Button text="Loading..." disabled />}>
 *       <FavoriteButton {...props} />
 *     </Suspense>
 *   )
 * }
 * ```
 */
export declare function useUpdateFavorite(props: UseFavoriteProps): UpdateFavorite;
/**
 * Returns metadata for each dataset the current user has access to.
 *
 * @category Datasets
 * @param options - Optional project/resource to read datasets for. Defaults to
 *   the resource named in `ResourceProvider`/`SDKProvider`.
 * @returns A {@link FetcherHookResult} whose `data` is the metadata for the
 *   datasets.
 *
 * @example
 * ```tsx
 * const {data: datasets} = useDatasets()
 *
 * return (
 *   <select>
 *     {datasets.map((dataset) => (
 *       <option key={dataset.name}>{dataset.name}</option>
 *     ))}
 *   </select>
 * )
 * ```
 *
 * @remarks
 * The `projectId` is resolved in order from:
 * 1. an explicit `projectId` option
 * 2. A legacy ProjectContext (e.g. a `<ResourceProvider projectId="…">` with no dataset), then
 * 3. The active resource (`ResourceProvider`/`SDKProvider`)
 * 4. `instance.config`.
 * @public
 */
export declare function useDatasets(options?: ProjectHandle): FetcherHookResult<DatasetsResponse$1>;
/**
 * @public
 */
interface UseApplyDocumentActions {
  (): <TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(action: DocumentAction<TDocumentType, TDataset, TProjectId> | DocumentAction<TDocumentType, TDataset, TProjectId>[], options?: ResourceHandle) => Promise<ActionsResult<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>>>;
}
/**
 * @public
 *
 * Provides a stable callback function for applying one or more document actions.
 *
 * This hook wraps the core `applyDocumentActions` functionality from `@sanity/sdk`,
 * integrating it with the React component lifecycle and {@link SanityInstance}.
 * It allows you to apply actions generated by functions like `createDocument`,
 * `editDocument`, `deleteDocument`, `publishDocument`, `unpublishDocument`,
 * and `discardDocument` to documents.
 *
 * Features:
 * - Applies one or multiple `DocumentAction` objects.
 * - Supports optimistic updates: Local state reflects changes immediately.
 * - Handles batching: Multiple actions passed together are sent as a single atomic transaction.
 * - Integrates with the collaborative editing engine for conflict resolution and state synchronization.
 *
 * @category Documents
 * @returns A stable callback function. When called with a single `DocumentAction` or an array of `DocumentAction`s,
 * it returns a promise that resolves to an {@link ActionsResult}. The `ActionsResult` contains information about the
 * outcome, including optimistic results if applicable.
 *
 * @remarks
 * This hook is a fundamental part of interacting with document state programmatically.
 * It operates within the same unified pipeline as other document hooks like `useDocument` (for reading state)
 * and {@link useEditDocument} (a higher-level hook specifically for edits).
 *
 * When multiple actions are provided in a single call, they are guaranteed to be submitted
 * as a single transaction to Content Lake. This ensures atomicity for related operations (e.g., creating and publishing a document).
 *
 * @function
 *
 * @example Publish or unpublish a document
 * ```tsx
 * import {
 *   publishDocument,
 *   unpublishDocument,
 *   useApplyDocumentActions,
 *   type DocumentHandle
 * } from '@sanity/sdk-react'
 *
 * // Define props using the DocumentHandle type
 * interface PublishControlsProps {
 *   doc: DocumentHandle
 * }
 *
 * function PublishControls({doc}: PublishControlsProps) {
 *   const apply = useApplyDocumentActions()
 *
 *   const handlePublish = () =>  apply(publishDocument(doc))
 *   const handleUnpublish = () => apply(unpublishDocument(doc))
 *
 *   return (
 *     <>
 *       <button onClick={handlePublish}>Publish</button>
 *       <button onClick={handleUnpublish}>Unpublish</button>
 *     </>
 *   )
 * }
 * ```
 *
 * @example Create and publish a new document
 * ```tsx
 * import {
 *   createDocument,
 *   publishDocument,
 *   createDocumentHandle,
 *   useApplyDocumentActions
 * } from '@sanity/sdk-react'
 *
 * function CreateAndPublishButton({documentType}: {documentType: string}) {
 *   const apply = useApplyDocumentActions()
 *
 *   const handleCreateAndPublish = () => {
 *     // Create a new handle inside the handler
 *     const newDocHandle = createDocumentHandle({ documentId: crypto.randomUUID(), documentType })
 *
 *     // Apply multiple actions for the new handle as a single transaction
 *     apply([
 *       createDocument(newDocHandle),
 *       publishDocument(newDocHandle),
 *     ])
 *   }
 *
 *   return (
 *     <button onClick={handleCreateAndPublish}>
 *       I'm feeling lucky
 *     </button>
 *   )
 * }
 * ```
 *
 * @example Create a document with initial field values
 * ```tsx
 * import {
 *   createDocument,
 *   createDocumentHandle,
 *   useApplyDocumentActions
 * } from '@sanity/sdk-react'
 *
 * function CreateArticleButton() {
 *   const apply = useApplyDocumentActions()
 *
 *   const handleCreateArticle = () => {
 *     const newDocHandle = createDocumentHandle({
 *       documentId: crypto.randomUUID(),
 *       documentType: 'article'
 *     })
 *
 *     // Create document with initial values in one action
 *     apply(
 *       createDocument(newDocHandle, {
 *         title: 'New Article',
 *         author: 'John Doe',
 *         publishedAt: new Date().toISOString(),
 *       })
 *     )
 *   }
 *
 *   return <button onClick={handleCreateArticle}>Create Article</button>
 * }
 * ```
 *
 * @example Create a new document in a release
 * ```tsx
 * import {
 *   createDocument,
 *   createDocumentHandle,
 *   useApplyDocumentActions
 * } from '@sanity/sdk-react'
 *
 * function CreateArticleButton() {
 *   const apply = useApplyDocumentActions()
 *
 *   const handleCreateArticle = () => {
 *     // Use any valid document ID — not the internal `versions.<releaseName>.<id>` format or "drafts.<id>" format.
 *     // New documents must be explicitly created with `createDocument` to become part of a release.
 *     const newDocHandle = createDocumentHandle({
 *       documentId: crypto.randomUUID(), // or the existing document ID you want to make a release version of
 *       documentType: 'article',
 *       perspective: {releaseName: 'summer-drop'},
 *     })
 *
 *     apply(
 *       createDocument(newDocHandle, {
 *         title: 'New Article',
 *         author: 'John Doe',
 *         publishedAt: new Date().toISOString(),
 *       })
 *     )
 *   }
 *
 *   return <button onClick={handleCreateArticle}>Create Article</button>
 * }
 * ```
 *
 * @example Edit an existing document in a release
 * ```tsx
 * import {
 *   editDocument,
 *   createDocumentHandle,
 *   useApplyDocumentActions
 * } from '@sanity/sdk-react'
 *
 * function EditArticleInReleaseButton({documentId}: {documentId: string}) {
 *   const apply = useApplyDocumentActions()
 *
 *   const handleEdit = () => {
 *     // Pass the document's regular ID — not `versions.<releaseName>.<id>`.
 *     // Documents that already have a version in the release can be edited directly with `editDocument`.
 *     const docHandle = createDocumentHandle({
 *       documentId,
 *       documentType: 'article',
 *       perspective: {releaseName: 'summer-drop'},
 *     })
 *
 *     apply(editDocument(docHandle, {set: {title: 'Updated for release'}}))
 *   }
 *
 *   return <button onClick={handleEdit}>Edit in Release</button>
 * }
 * ```
 */
export declare const useApplyDocumentActions: UseApplyDocumentActions;
type IgnoredKey = '_id' | '_type' | '_rev' | '_createdAt' | '_updatedAt';
/**
 * Optional per-call overrides for {@link useCreateDocument}'s create function.
 * @public
 * @category Types
 * @category Documents
 */
interface CreateDocumentOverrides {
  /**
   * Use this document ID instead of generating one. Overrides any `documentId`
   * supplied on the handle passed to `useCreateDocument`.
   */
  documentId?: string;
}
/**
 * @public
 * Create a new document, relying on Typegen for the initial-value type.
 *
 * @param options - A document-type handle including `documentType`, an optional `documentId`, and optionally `projectId`/`dataset`/`perspective`.
 * @returns A function that creates the document. It accepts optional initial field values and an optional `{documentId}` override,
 *          and resolves to the {@link DocumentHandle} of the created document (carrying the generated or supplied id).
 */
export declare function useCreateDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: DocumentTypeHandle<TDocumentType, TDataset, TProjectId>): (initialValue?: Partial<Omit<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>, IgnoredKey>>, overrides?: CreateDocumentOverrides) => Promise<DocumentHandle<TDocumentType, TDataset, TProjectId>>;
/**
 * @public
 * Create a new document with an explicit type `TData`.
 *
 * @param options - A document-type handle including `documentType` and optionally `projectId`/`dataset`/`perspective`.
 * @returns A function that creates the document. It accepts optional initial field values (typed against `TData`) and an
 *          optional `{documentId}` override, and resolves to the {@link DocumentHandle} of the created document.
 */
export declare function useCreateDocument<TData extends Record<string, unknown>>(options: DocumentTypeHandle): (initialValue?: Partial<Omit<TData, IgnoredKey>>, overrides?: CreateDocumentOverrides) => Promise<DocumentHandle>;
type UseDocumentOptions<TPath extends string | undefined = undefined, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> = DocumentHandle<TDocumentType, TDataset, TProjectId> & {
  path?: TPath;
};
interface UseDocument {
  /** @internal */
  <TDocumentType extends string, TDataset extends string, TProjectId extends string = string>(options: UseDocumentOptions<undefined, TDocumentType, TDataset, TProjectId>): {
    data: ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`> | null;
  };
  /** @internal */
  <TPath extends string, TDocumentType extends string, TDataset extends string = string, TProjectId extends string = string>(options: UseDocumentOptions<TPath, TDocumentType, TDataset, TProjectId>): {
    data: JsonMatch<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>, TPath> | undefined;
  };
  /** @internal */
  <TData>(options: DocumentOptions<undefined>): {
    data: TData | null;
  };
  /** @internal */
  <TData>(options: DocumentOptions<string>): {
    data: TData | undefined;
  };
  /**
   * ## useDocument via Type Inference (Recommended)
   *
   * @public
   *
   * The preferred way to use this hook when working with Sanity Typegen.
   *
   * Features:
   * - Automatically infers document types from your schema
   * - Provides type-safe access to documents and nested fields
   * - Supports project/dataset-specific type inference
   * - Works seamlessly with Typegen-generated types
   *
   * This hook will suspend while the document data is being fetched and loaded.
   *
   * When fetching a full document:
   * - Returns the complete document object if it exists
   * - Returns `null` if the document doesn't exist
   *
   * When fetching with a path:
   * - Returns the value at the specified path if both the document and path exist
   * - Returns `undefined` if either the document doesn't exist or the path doesn't exist in the document
   *
   * @category Documents
   * @param options - Configuration including `documentId`, `documentType`, and optionally:
   *   - `path`: To select a nested value (returns typed value at path)
   *   - `projectId`/`dataset`: For multi-project/dataset setups
   * @returns The document state (or nested value if path provided).
   *
   * @example Basic document fetch
   * ```tsx
   * import {useDocument, type DocumentHandle} from '@sanity/sdk-react'
   *
   * interface ProductViewProps {
   *   doc: DocumentHandle<'product'> // Typegen infers product type
   * }
   *
   * function ProductView({doc}: ProductViewProps) {
   *   const {data: product} = useDocument({...doc}) // Fully typed product
   *   return <h1>{product.title ?? 'Untitled'}</h1>
   * }
   * ```
   *
   * @example Fetching a specific field
   * ```tsx
   * import {useDocument, type DocumentHandle} from '@sanity/sdk-react'
   *
   * interface ProductTitleProps {
   *   doc: DocumentHandle<'product'>
   * }
   *
   * function ProductTitle({doc}: ProductTitleProps) {
   *   const {data: title} = useDocument({
   *     ...doc,
   *     path: 'title' // Returns just the title field
   *   })
   *   return <h1>{title ?? 'Untitled'}</h1>
   * }
   * ```
   *
   * @inlineType DocumentOptions
   */
  <TPath extends string | undefined = undefined, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: UseDocumentOptions<TPath, TDocumentType, TDataset, TProjectId>): TPath extends string ? {
    data: JsonMatch<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>, TPath> | undefined;
  } : {
    data: ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`> | null;
  };
  /**
   * @public
   *
   * ## useDocument via Explicit Types
   *
   * Use this version when:
   * - You're not using Sanity Typegen
   * - You need to manually specify document types
   * - You're working with dynamic document types
   *
   * Key differences from Typegen version:
   * - Requires manual type specification via `TData`
   * - Returns `TData | null` for full documents
   * - Returns `TData | undefined` for nested values
   *
   * This hook will suspend while the document data is being fetched.
   *
   * @typeParam TData - The explicit type for the document or field
   * @typeParam TPath - Optional path to a nested value
   * @param options - Configuration including `documentId` and optionally:
   *   - `path`: To select a nested value
   *   - `projectId`/`dataset`: For multi-project/dataset setups
   * @returns The document state (or nested value if path provided)
   *
   * @example Basic document fetch with explicit type
   * ```tsx
   * import {useDocument, type DocumentHandle, type SanityDocument} from '@sanity/sdk-react'
   *
   * interface Book extends SanityDocument {
   *   _type: 'book'
   *   title: string
   *   author: string
   * }
   *
   * interface BookViewProps {
   *   doc: DocumentHandle
   * }
   *
   * function BookView({doc}: BookViewProps) {
   *   const {data: book} = useDocument<Book>({...doc})
   *   return <h1>{book?.title ?? 'Untitled'} by {book?.author ?? 'Unknown'}</h1>
   * }
   * ```
   *
   * @example Fetching a specific field with explicit type
   * ```tsx
   * import {useDocument, type DocumentHandle} from '@sanity/sdk-react'
   *
   * interface BookTitleProps {
   *   doc: DocumentHandle
   * }
   *
   * function BookTitle({doc}: BookTitleProps) {
   *   const {data: title} = useDocument<string>({...doc, path: 'title'})
   *   return <h1>{title ?? 'Untitled'}</h1>
   * }
   * ```
   *
   * @inlineType DocumentOptions
   */
  <TData, TPath extends string>(options: UseDocumentOptions<TPath>): TPath extends string ? {
    data: TData | undefined;
  } : {
    data: TData | null;
  };
  /**
   * @internal
   */
  (options: UseDocumentOptions): {
    data: unknown;
  };
}
/**
 * @public
 * Reads and subscribes to a document's realtime state, incorporating both local and remote changes.
 *
 * This hook comes in two main flavors to suit your needs:
 *
 * 1. **[Type Inference](#usedocument-via-type-inference-recommended)** (Recommended) - Automatically gets types from your Sanity schema
 * 2. **[Explicit Types](#usedocument-via-explicit-types)** - Manually specify types when needed
 *
 * @remarks
 * `useDocument` is ideal for realtime editing interfaces where you need immediate feedback on changes.
 * However, it can be resource-intensive since it maintains a realtime connection.
 *
 * For simpler cases where:
 * - You only need to display content
 * - Realtime updates aren't critical
 * - You want better performance
 *
 * …consider using {@link useDocumentProjection} or {@link useQuery} instead. These hooks are more efficient
 * for read-heavy applications.
 *
 * @function
 */
export declare const useDocument: UseDocument;
/**
 * @public
 */
interface UseDocumentEventOptions<TDataset extends string = string, TProjectId extends string = string> extends ResourceHandle<TDataset, TProjectId> {
  onEvent: (documentEvent: DocumentEvent) => void;
}
/**
 *
 * @public
 *
 * Subscribes an event handler to events in your application's document store.
 *
 * @category Documents
 * @param options - An object containing the event handler (`onEvent`) and optionally a `DatasetHandle` (projectId and dataset). If the handle is not provided, the nearest Sanity instance from context will be used.
 * @example Creating a custom hook for document event toasts
 * ```tsx
 * import {createDatasetHandle, type DatasetHandle, type DocumentEvent, useDocumentEvent} from '@sanity/sdk-react'
 * import {useToast} from './my-ui-library'
 *
 * // Define options for the custom hook, extending DatasetHandle
 * interface DocumentToastsOptions extends DatasetHandle {
 *   // Could add more options, e.g., { includeEvents: DocumentEvent['type'][] }
 * }
 *
 * // Define the custom hook
 * function useDocumentToasts({...datasetHandle}: DocumentToastsOptions = {}) {
 *   const showToast = useToast() // Get the toast function
 *
 *   // Define the event handler logic to show toasts on specific events
 *   const handleEvent = (event: DocumentEvent) => {
 *     if (event.type === 'published') {
 *       showToast(`Document ${event.documentId} published.`)
 *     } else if (event.type === 'unpublished') {
 *       showToast(`Document ${event.documentId} unpublished.`)
 *     } else if (event.type === 'deleted') {
 *       showToast(`Document ${event.documentId} deleted.`)
 *     } else {
 *       // Optionally log other events for debugging
 *       console.log('Document Event:', event.type, event.documentId)
 *     }
 *   }
 *
 *   // Call the original hook, spreading the handle properties
 *   useDocumentEvent({
 *     ...datasetHandle, // Spread the dataset handle (projectId, dataset)
 *     onEvent: handleEvent,
 *   })
 * }
 *
 * function MyComponentWithToasts() {
 *   // Use the custom hook, passing specific handle info
 *   const specificHandle = createDatasetHandle({ projectId: 'p1', dataset: 'ds1' })
 *   useDocumentToasts(specificHandle)
 *
 *   // // Or use it relying on context for the handle
 *   // useDocumentToasts()
 *
 *   return <div>...</div>
 * }
 * ```
 */
export declare function useDocumentEvent<TDataset extends string = string, TProjectId extends string = string>(options: UseDocumentEventOptions<TDataset, TProjectId>): void;
/**
 *
 * @public
 *
 * Check if the current user has the specified permissions for the given document actions.
 *
 * @category Permissions
 * @param actionOrActions - One or more document action functions (e.g., `publishDocument(handle)`).
 * @returns An object that specifies whether the action is allowed; if the action is not allowed, an explanatory message and list of reasons is also provided.
 *
 * @remarks
 * When passing multiple actions, all actions must belong to the same project and dataset.
 * Note, however, that you can check permissions on multiple documents from the same project and dataset (as in the second example below).
 *
 * @example Checking for permission to publish a document
 * ```tsx
 * import {
 *   useDocumentPermissions,
 *   useApplyDocumentActions,
 *   publishDocument,
 *   createDocumentHandle,
 *   type DocumentHandle
 * } from '@sanity/sdk-react'
 *
 * // Define props using the DocumentHandle type
 * interface PublishButtonProps {
 *   doc: DocumentHandle
 * }
 *
 * function PublishButton({doc}: PublishButtonProps) {
 *   const publishAction = publishDocument(doc)
 *
 *   // Pass the same action call to check permissions
 *   const publishPermissions = useDocumentPermissions(publishAction)
 *   const apply = useApplyDocumentActions()
 *
 *   return (
 *     <>
 *       <button
 *         disabled={!publishPermissions.allowed}
 *         // Pass the same action call to apply the action
 *         onClick={() => apply(publishAction)}
 *         popoverTarget={`${publishPermissions.allowed ? undefined : 'publishButtonPopover'}`}
 *       >
 *         Publish
 *       </button>
 *       {!publishPermissions.allowed && (
 *         <div popover id="publishButtonPopover">
 *           {publishPermissions.message}
 *         </div>
 *       )}
 *     </>
 *   )
 * }
 *
 * // Usage:
 * // const doc = createDocumentHandle({ documentId: 'doc1', documentType: 'myType' })
 * // <PublishButton doc={doc} />
 * ```
 *
 * @example Checking for permissions to edit multiple documents
 * ```tsx
 * import {
 *   useDocumentPermissions,
 *   editDocument,
 *   type DocumentHandle
 * } from '@sanity/sdk-react'
 *
 * export default function canEditMultiple(docHandles: DocumentHandle[]) {
 *   // Create an array containing an editDocument action for each of the document handles
 *   const editActions = docHandles.map(doc => editDocument(doc))
 *
 *   // Return the result of checking for edit permissions on all of the document handles
 *   return useDocumentPermissions(editActions)
 * }
 * ```
 */
export declare function useDocumentPermissions(actionOrActions: WithResourceNameSupport<DocumentAction> | WithResourceNameSupport<DocumentAction>[]): DocumentPermissionsResult;
type UseDocumentSyncStatus = {
  /**
   * Exposes the document's sync status between local and remote document states.
   *
   * @category Documents
   * @param doc - The document handle to get sync status for. If you pass a `DocumentHandle` with specified `projectId` and `dataset`,
   * the document will be read from the specified Sanity project and dataset that is included in the handle. If no `projectId` or `dataset` is provided,
   * the document will use the nearest instance from context.
   * @returns `true` if local changes are synced with remote, `false` if changes are pending. Note: Suspense handles loading states.
   * @example Show sync status indicator
   * ```tsx
   * import {useDocumentSyncStatus, createDocumentHandle, type DocumentHandle} from '@sanity/sdk-react'
   *
   * // Define props including the DocumentHandle type
   * interface SyncIndicatorProps {
   *   doc: DocumentHandle
   * }
   *
   * function SyncIndicator({doc}: SyncIndicatorProps) {
   *   const isSynced = useDocumentSyncStatus(doc)
   *
   *   return (
   *     <div className={`sync-status ${isSynced ? 'synced' : 'pending'}`}>
   *       {isSynced ? '✓ Synced' : 'Saving changes...'}
   *     </div>
   *   )
   * }
   *
   * // Usage:
   * // const doc = createDocumentHandle({ documentId: 'doc1', documentType: 'myType' })
   * // <SyncIndicator doc={doc} />
   * ```
   */
  (doc: DocumentHandle$1): boolean;
};
/**
 * @public
 * @function
 */
export declare const useDocumentSyncStatus: UseDocumentSyncStatus;
type Updater<TValue> = TValue | ((currentValue: TValue) => TValue);
/**
 * @public
 * Edit an entire document, relying on Typegen for the type.
 *
 * @param options - Document options including `documentId`, `documentType`, and optionally `projectId`/`dataset`.
 * @returns A stable function to update the document state. Accepts either the new document state or an updater function `(currentValue) => nextValue`.
 *          Returns a promise resolving to the {@link ActionsResult}.
 */
export declare function useEditDocument<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: DocumentOptions<undefined, TDocumentType, TDataset, TProjectId>): (nextValue: Updater<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>>) => Promise<ActionsResult<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>>>;
/**
 * @public
 * Edit a specific path within a document, relying on Typegen for the type.
 *
 * @param options - Document options including `documentId`, `documentType`, `path`, and optionally `projectId`/`dataset`.
 * @returns A stable function to update the value at the specified path. Accepts either the new value or an updater function `(currentValue) => nextValue`.
 *          Returns a promise resolving to the {@link ActionsResult}.
 */
export declare function useEditDocument<TPath extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: DocumentOptions<TPath, TDocumentType, TDataset, TProjectId>): (nextValue: Updater<JsonMatch<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>, TPath>>) => Promise<ActionsResult<ResolveDocument<TDocumentType, `${TProjectId}.${TDataset}`>>>;
/**
 * @public
 * Edit an entire document with an explicit type `TData`.
 *
 * @param options - Document options including `documentId` and optionally `projectId`/`dataset`.
 * @returns A stable function to update the document state. Accepts either the new document state (`TData`) or an updater function `(currentValue: TData) => nextValue: TData`.
 *          Returns a promise resolving to the {@link ActionsResult}.
 */
export declare function useEditDocument<TData>(options: DocumentOptions<undefined>): (nextValue: Updater<TData>) => Promise<ActionsResult>;
/**
 * @public
 * Edit a specific path within a document with an explicit type `TData`.
 *
 * @param options - Document options including `documentId`, `path`, and optionally `projectId`/`dataset`.
 * @returns A stable function to update the value at the specified path. Accepts either the new value (`TData`) or an updater function `(currentValue: TData) => nextValue: TData`.
 *          Returns a promise resolving to the {@link ActionsResult}.
 */
export declare function useEditDocument<TData>(options: DocumentOptions<string>): (nextValue: Updater<TData>) => Promise<ActionsResult>;
/**
 * Configuration options for the useDocuments hook
 *
 * @public
 * @category Types
 * @category Documents
 */
interface DocumentsOptions<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends ResourceHandle<TDataset, TProjectId>, Pick<QueryOptions, 'perspective' | 'params'> {
  /**
   * Filter documents by their `_type`. Can be a single type or an array of types.
   */
  documentType?: TDocumentType | TDocumentType[];
  /**
   * GROQ filter expression to apply to the query
   */
  filter?: string;
  /**
   * Number of items to load per batch (defaults to 25)
   */
  batchSize?: number;
  /**
   * Sorting configuration for the results
   * @beta
   */
  orderings?: SortOrderingItem$1[];
  /**
   * Text search query to filter results
   */
  search?: string;
}
/**
 * Return value from the useDocuments hook
 *
 * @public
 * @category Types
 * @category Documents
 */
interface DocumentsResponse<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> {
  /**
   * Array of document handles for the current batch
   */
  data: DocumentHandle$1<TDocumentType, TDataset, TProjectId>[];
  /**
   * Whether there are more items available to load
   */
  hasMore: boolean;
  /**
   * Total count of items matching the query
   */
  count: number;
  /**
   * Whether a query is currently in progress
   */
  isPending: boolean;
  /**
   * Function to load the next batch of results
   */
  loadMore: () => void;
}
/**
 * Retrieves batches of {@link DocumentHandle}s, narrowed by optional filters, text searches, and custom ordering,
 * with infinite scrolling support. The number of document handles returned per batch is customizable,
 * and additional batches can be loaded using the supplied `loadMore` function.
 *
 * @public
 * @category Documents
 * @param options - Configuration options for the infinite list
 * @returns An object containing the list of document handles, the loading state, the total count of retrieved document handles, and a function to load more
 *
 * @remarks
 * - The returned document handles include projectId and dataset information from the current Sanity instance
 * - This makes them ready to use with document operations and other document hooks
 * - The hook automatically uses the correct Sanity instance based on the projectId and dataset in the options
 *
 * @example Basic infinite list with loading more
 * ```tsx
 * import {
 *   useDocuments,
 *   createDatasetHandle,
 *   type DatasetHandle,
 *   type DocumentHandle,
 *   type SortOrderingItem
 * } from '@sanity/sdk-react'
 * import {Suspense} from 'react'
 *
 * // Define a component to display a single document (using useDocumentProjection for efficiency)
 * function MyDocumentComponent({doc}: {doc: DocumentHandle}) {
 *   const {data} = useDocumentProjection<{title?: string}>({
 *     ...doc, // Pass the full handle
 *     projection: '{title}'
 *   })
 *
 *   return <>{data?.title || 'Untitled'}</>
 * }
 *
 * // Define props for the list component
 * interface DocumentListProps {
 *   dataset: DatasetHandle
 *   documentType: string
 *   search?: string
 * }
 *
 * function DocumentList({dataset, documentType, search}: DocumentListProps) {
 *   const { data, hasMore, isPending, loadMore, count } = useDocuments({
 *     ...dataset,
 *     documentType,
 *     search,
 *     batchSize: 10,
 *     orderings: [{field: '_createdAt', direction: 'desc'}],
 *   })
 *
 *   return (
 *     <div>
 *       <p>Total documents: {count}</p>
 *       <ol>
 *         {data.map((docHandle) => (
 *           <li key={docHandle.documentId}>
 *            <Suspense fallback="Loading…">
 *              <MyDocumentComponent docHandle={docHandle} />
 *            </Suspense>
 *           </li>
 *         ))}
 *       </ol>
 *       {hasMore && (
 *         <button onClick={loadMore}>
 *           {isPending ? 'Loading...' : 'Load More'}
 *         </button>
 *       )}
 *     </div>
 *   )
 * }
 *
 * // Usage:
 * // const myDatasetHandle = createDatasetHandle({ projectId: 'p1', dataset: 'production' })
 * // <DocumentList dataset={myDatasetHandle} documentType="post" search="Sanity" />
 * ```
 *
 * @example Using `filter` and `params` options for narrowing a collection
 * ```tsx
 * import {useState} from 'react'
 * import {useDocuments} from '@sanity/sdk-react'
 *
 * export default function FilteredAuthors() {
 *   const [max, setMax] = useState(2)
 *   const {data} = useDocuments({
 *     documentType: 'author',
 *     filter: 'length(books) <= $max',
 *     params: {max},
 *   })
 *
 *   return (
 *     <>
 *       <input
 *         id="maxBooks"
 *         type="number"
 *         value={max}
 *         onChange={e => setMax(e.currentTarget.value)}
 *       />
 *       {data.map(author => (
 *         <Suspense key={author.documentId}>
 *           <MyAuthorComponent documentHandle={author} />
 *         </Suspense>
 *       ))}
 *     </>
 *   )
 * }
 * ```
 */
export declare function useDocuments<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>({ batchSize, params, search, filter, orderings, documentType, ...rawOptions }: DocumentsOptions<TDocumentType, TDataset, TProjectId>): DocumentsResponse<TDocumentType, TDataset, TProjectId>;
/**
 * Returns a single installation by id.
 *
 * The hook suspends until the first fetch succeeds, so `data` is always present.
 * The `include` tokens you pass shape `data`: each requested token adds its
 * field, and omitted ones are absent from the type.
 *
 * @public
 * @param installationId - The installation id.
 * @param options - Optional `include` list to expand related resources.
 * @returns The result envelope `{data, isFetching, error, refetch}`.
 * @category Applications
 */
export declare const useInstallation: <Include extends InstallationInclude = never>(installationId: string, options?: {
  include?: Include[];
}) => FetcherHookResult<Installation<Include>>;
/**
 * Returns the installations matching the given options.
 *
 * The hook suspends until the first fetch succeeds, so `data` is always present.
 * The `include` tokens you pass shape `data.data`: each requested token adds its
 * field, and omitted ones are absent from the type.
 *
 * @public
 * @param options - Filter and include options for the installations list.
 * @returns The result envelope `{data, isFetching, error, refetch}`.
 * @category Applications
 */
export declare const useInstallations: <Include extends InstallationInclude = never>(options: InstallationsOptions<Include>) => FetcherHookResult<InstallationsResponse<Include>>;
/**
 * Returns metadata for a given organisation.
 *
 * @category Organizations
 * @param options - Configuration options
 * @returns A {@link FetcherHookResult} whose `data` is the metadata for the
 *   organisation. `members` is included only when `includeMembers: true`;
 *   `features` is included only when `includeFeatures: true`.
 * @example
 * ```tsx
 * function OrganizationName({organizationId}: {organizationId: string}) {
 *   const {data: organization} = useOrganization({organizationId})
 *
 *   return <h1>{organization.name}</h1>
 * }
 * ```
 * @example
 * ```tsx
 * const {data: organizationWithMembers} = useOrganization({organizationId, includeMembers: true})
 * const {data: organizationWithFeatures} = useOrganization({organizationId, includeFeatures: true})
 * ```
 * @public
 * @function
 */
export declare const useOrganization: <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(options: OrganizationOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Organization<IncludeMembers, IncludeFeatures>>;
/**
 * Returns metadata for each organisation the current user has access to.
 *
 * @category Organizations
 * @param options - Configuration options
 * @returns A {@link FetcherHookResult} whose `data` is an array of organisation
 *   metadata. `members` is included only when `includeMembers: true`; `features`
 *   is included only when `includeFeatures: true`.
 * @example
 * ```tsx
 * const {data: organizations} = useOrganizations()
 *
 * return (
 *   <select>
 *     {organizations.map((organization) => (
 *       <option key={organization.id}>{organization.name}</option>
 *     ))}
 *   </select>
 * )
 * ```
 * @example
 * ```tsx
 * const {data: organizationsWithMembers} = useOrganizations({includeMembers: true})
 * const {data: organizationsWithFeatures} = useOrganizations({includeFeatures: true})
 * const {data: organizationsIncludingImplicit} = useOrganizations({includeImplicitMemberships: true})
 * ```
 * @public
 * @function
 */
export declare const useOrganizations: <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = false>(options?: OrganizationsOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Organizations<IncludeMembers, IncludeFeatures>>;
/**
 * Configuration options for the usePaginatedDocuments hook
 *
 * @public
 * @category Types
 * @category Documents
 */
interface PaginatedDocumentsOptions<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends WithResourceNameSupport<Omit<QueryOptions<TDocumentType, TDataset, TProjectId>, 'query'>> {
  documentType?: TDocumentType | TDocumentType[];
  /**
   * GROQ filter expression to apply to the query
   */
  filter?: string;
  /**
   * Number of items to display per page (defaults to 25)
   */
  pageSize?: number;
  /**
   * Sorting configuration for the results
   * @beta
   */
  orderings?: SortOrderingItem$1[];
  /**
   * Text search query to filter results
   */
  search?: string;
}
/**
 * Return value from the usePaginatedDocuments hook
 *
 * @public
 * @category Types
 * @category Documents
 */
interface PaginatedDocumentsResponse<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> {
  /**
   * Array of document handles for the current page
   */
  data: DocumentHandle$1<TDocumentType, TDataset, TProjectId>[];
  /**
   * Whether a query is currently in progress
   */
  isPending: boolean;
  /**
   * Number of items displayed per page
   */
  pageSize: number;
  /**
   * Current page number (1-indexed)
   */
  currentPage: number;
  /**
   * Total number of pages available
   */
  totalPages: number;
  /**
   * Starting index of the current page (0-indexed)
   */
  startIndex: number;
  /**
   * Ending index of the current page (exclusive, 0-indexed)
   */
  endIndex: number;
  /**
   * Total count of items matching the query
   */
  count: number;
  /**
   * Navigate to the first page
   */
  firstPage: () => void;
  /**
   * Whether there is a first page available to navigate to
   */
  hasFirstPage: boolean;
  /**
   * Navigate to the previous page
   */
  previousPage: () => void;
  /**
   * Whether there is a previous page available to navigate to
   */
  hasPreviousPage: boolean;
  /**
   * Navigate to the next page
   */
  nextPage: () => void;
  /**
   * Whether there is a next page available to navigate to
   */
  hasNextPage: boolean;
  /**
   * Navigate to the last page
   */
  lastPage: () => void;
  /**
   * Whether there is a last page available to navigate to
   */
  hasLastPage: boolean;
  /**
   * Navigate to a specific page number
   * @param pageNumber - The page number to navigate to (1-indexed)
   */
  goToPage: (pageNumber: number) => void;
}
/**
 * Retrieves pages of {@link DocumentHandle}s, narrowed by optional filters, text searches, and custom ordering,
 * with support for traditional paginated interfaces. The number of document handles returned per page is customizable,
 * while page navigation is handled via the included navigation functions.
 *
 * @public
 * @category Documents
 * @param options - Configuration options for the paginated list
 * @returns An object containing the list of document handles, pagination details, and functions to navigate between pages
 *
 * @remarks
 * - The returned document handles include projectId and dataset information from the current Sanity instance
 * - This makes them ready to use with document operations and other document hooks
 * - The hook automatically uses the correct Sanity instance based on the projectId and dataset in the options
 *
 * @example Paginated list of documents with navigation
 * ```tsx
 * import {
 *   usePaginatedDocuments,
 *   createDatasetHandle,
 *   type DatasetHandle,
 *   type DocumentHandle,
 *   type SortOrderingItem,
 *   useDocumentProjection
 * } from '@sanity/sdk-react'
 * import {Suspense} from 'react'
 * import {ErrorBoundary} from 'react-error-boundary'
 *
 * // Define a component to display a single document row
 * function MyTableRowComponent({doc}: {doc: DocumentHandle}) {
 *   const {data} = useDocumentProjection<{title?: string}>({
 *     ...doc,
 *     projection: '{title}',
 *   })
 *
 *   return (
 *     <tr>
 *       <td>{data?.title ?? 'Untitled'}</td>
 *     </tr>
 *   )
 * }
 *
 * // Define props for the list component
 * interface PaginatedDocumentListProps {
 *   documentType: string
 *   dataset?: DatasetHandle
 * }
 *
 * function PaginatedDocumentList({documentType, dataset}: PaginatedDocumentListProps) {
 *   const {
 *     data,
 *     isPending,
 *     currentPage,
 *     totalPages,
 *     nextPage,
 *     previousPage,
 *     hasNextPage,
 *     hasPreviousPage
 *   } = usePaginatedDocuments({
 *     ...dataset,
 *     documentType,
 *     pageSize: 10,
 *     orderings: [{field: '_createdAt', direction: 'desc'}],
 *   })
 *
 *   return (
 *     <div>
 *       <table>
 *         <thead>
 *           <tr><th>Title</th></tr>
 *         </thead>
 *         <tbody>
 *           {data.map(doc => (
 *             <ErrorBoundary key={doc.documentId} fallback={<tr><td>Error loading document</td></tr>}>
 *               <Suspense fallback={<tr><td>Loading...</td></tr>}>
 *                 <MyTableRowComponent doc={doc} />
 *               </Suspense>
 *             </ErrorBoundary>
 *           ))}
 *         </tbody>
 *       </table>
 *       <div style={{opacity: isPending ? 0.5 : 1}}>
 *         <button onClick={previousPage} disabled={!hasPreviousPage || isPending}>Previous</button>
 *         <span>Page {currentPage} / {totalPages}</span>
 *         <button onClick={nextPage} disabled={!hasNextPage || isPending}>Next</button>
 *       </div>
 *     </div>
 *   )
 * }
 *
 * // Usage:
 * // const myDatasetHandle = createDatasetHandle({ projectId: 'p1', dataset: 'production' })
 * // <PaginatedDocumentList dataset={myDatasetHandle} documentType="post" />
 * ```
 */
export declare function usePaginatedDocuments<TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>({ documentType, filter, pageSize, params, orderings, search, ...rawOptions }: PaginatedDocumentsOptions<TDocumentType, TDataset, TProjectId>): PaginatedDocumentsResponse<TDocumentType, TDataset, TProjectId>;
/**
 * Every participant in the current project and dataset, or Canvas.
 *
 * Reading presence never announces anything. Call `useReportPresence` to make the
 * current user visible to others, including to the Studio, which shares the same
 * presence room.
 *
 * This returns everyone in the whole resource and leaves the filtering to you.
 * Prefer `usePresenceForDocument` when you care about one document: it scopes and
 * flattens the result for rendering. Note that participants are counted by session,
 * so one person in two tabs appears twice.
 *
 * Presence is scoped to a single project and dataset. It is not a list of everyone
 * signed in to your organization.
 *
 * @public
 * @category Presence
 */
export declare function usePresence(options?: ResourceHandle): {
  locations: UserPresence[];
};
/**
 * @beta
 * @category Types
 * @category Presence
 */
interface UsePresenceForDocumentOptions extends DocumentHandle {
  /**
   * Narrows to participants at or below this field path, which is what a field
   * indicator wants. Omit it for everyone in the document.
   */
  path?: Path;
  /**
   * By default a draft, its published version, and any release versions count as
   * the same document, which is what document lists want. Set this to compare ids
   * exactly, so that a draft and a release version do not bleed into each other.
   */
  excludeVersions?: boolean;
}
/**
 * Who else is in a document, flattened to one entry per participant per location
 * so it can be rendered straight against a field.
 *
 * Reading presence never announces anything. Use `useReportPresence` to make the
 * current user visible to others.
 *
 * Prefer this over `usePresence` when you care about one document: `usePresence`
 * returns every participant in the whole project and dataset, leaving the filtering
 * to you.
 *
 * Resolves the document through its perspective exactly as `useReportPresence` does,
 * so reads match writes. Participants are counted by session, so one person in two
 * tabs appears twice.
 *
 * @example Avatars on a document
 * ```tsx
 * const {presence} = usePresenceForDocument({documentId, documentType})
 * return presence.map((p) => <Avatar key={p.sessionId} user={p.user} />)
 * ```
 *
 * @example Avatars on a single field
 * ```tsx
 * const {presence} = usePresenceForDocument({
 *   documentId,
 *   documentType,
 *   path: ['title'],
 *   excludeVersions: true,
 * })
 * ```
 *
 * @beta
 * @category Presence
 */
export declare function usePresenceForDocument(options: UsePresenceForDocumentOptions): {
  presence: DocumentPresence[];
};
/**
 * @beta
 * @category Types
 * @category Presence
 */
interface UseReportPresenceOptions extends DocumentHandle {
  /**
   * The focused field path. Omit it for document-level presence. Keyed and numeric
   * segments are supported, so array items and Portable Text spans can be
   * addressed.
   */
  path?: Path;
  /** The Portable Text caret, when the focused field is a Portable Text field. */
  selection?: PresenceSelection;
  /** Overrides the throttle interval. Mainly useful in tests. */
  throttleMs?: number;
}
/**
 * Announces that the current user is in a document, so that other clients in the
 * same project and dataset can show them.
 *
 * Writing presence is opt-in. Reading it with `usePresenceForDocument` or
 * `usePresence` never announces anything, and this hook is the only thing that
 * makes an app visible to others. That includes the Studio, which shares the same
 * presence room and will show these users in its navbar and field indicators.
 *
 * Announcements are throttled, collapsed over a short window, and then repeated
 * every 30 seconds while the user is idle. That repeat is what tells peers the
 * session is still alive, so the intended usage is to mount this hook for as long
 * as the user is in the document. On unmount the location is cleared, leaving the
 * user present in the app but not in any particular document. About a second
 * after nothing reports or reads presence, including while the app is hidden, the
 * connection closes and peers stop seeing the user.
 *
 * The perspective decides which specific document is reported: the draft under
 * `drafts`, the published document under `published`, a version under a release.
 * It is taken from `ResourceProvider` unless you pass one on the handle. That
 * matters for interoperability, because the Studio's field indicators compare the
 * exact id its form is on, so a mismatch shows your user at document level while
 * never lighting up a field.
 *
 * Presence is scoped to a single project and dataset. It is not a list of everyone
 * signed in to your organization.
 *
 * @example Document-level presence
 * ```tsx
 * function DocumentEditor({documentId, documentType}: DocumentHandle) {
 *   useReportPresence({documentId, documentType})
 *   return <Editor />
 * }
 * ```
 *
 * @example Presence in a release version
 * ```tsx
 * // The document id stays plain; the perspective selects the version.
 * useReportPresence({documentId, documentType, perspective: {releaseName: 'autumn'}})
 * ```
 *
 * @example Field-level presence
 * ```tsx
 * function TitleField({documentId, documentType}: DocumentHandle) {
 *   const [focused, setFocused] = useState(false)
 *   useReportPresence({documentId, documentType, path: focused ? ['title'] : undefined})
 *   return <input onFocus={() => setFocused(true)} onBlur={() => setFocused(false)} />
 * }
 * ```
 *
 * @beta
 * @category Presence
 */
export declare function useReportPresence(options: UseReportPresenceOptions): void;
/**
 * @public
 * @category Types
 * @category Documents
 */
interface useDocumentPreviewOptions extends DocumentHandle {
  /**
   * Optional ref object to track visibility. When provided, preview resolution
   * only occurs when the referenced element is visible in the viewport.
   */
  ref?: React.RefObject<unknown>;
}
/**
 * @public
 * @category Types
 * @category Documents
 */
interface useDocumentPreviewResults {
  /** The results of inferring the document's preview values */
  data: PreviewValue;
  /** True when inferred preview values are being refreshed */
  isPending: boolean;
}
/**
 * @public
 *
 * Attempts to infer preview values of a document (specified via a `DocumentHandle`),
 * including the document's `title`, `subtitle`, `media`, and `status`. These values are live and will update in realtime.
 * To reduce unnecessary network requests for resolving the preview values, an optional `ref` can be passed to the hook so that preview
 * resolution will only occur if the `ref` is intersecting the current viewport.
 *
 * See remarks below for futher information.
 *
 * @remarks
 * Values returned by this hook may not be as expected. It is currently unable to read preview values as defined in your schema;
 * instead, it attempts to infer these preview values by checking against a basic set of potential fields on your document.
 * We are anticipating being able to significantly improve this hook's functionality and output in a future release.
 * For now, we recommend using {@link useDocumentProjection} for rendering individual document fields (or projections of those fields).
 *
 * Internally, this hook is implemented as a specialized projection with post-processing logic.
 * It uses a fixed GROQ projection to fetch common preview fields (title, subtitle, media) and
 * transforms the results into the PreviewValue format.
 *
 * @category Documents
 * @param options - The document handle for the document you want to infer preview values for, and an optional ref
 * @returns The inferred values for the given document and a boolean to indicate whether the resolution is pending
 *
 * @example Combining with useDocuments to render a collection of document previews
 * ```
 * // PreviewComponent.jsx
 * export default function PreviewComponent({ document }) {
 *   const { data: { title, subtitle, media }, isPending } = useDocumentPreview({ document })
 *   return (
 *     <article style={{ opacity: isPending ? 0.5 : 1}}>
 *       {media?.type === 'image-asset' ? <img src={media.url} alt='' /> : ''}
 *       <h2>{title}</h2>
 *       <p>{subtitle}</p>
 *     </article>
 *   )
 * }
 *
 * // DocumentList.jsx
 * const { data } = useDocuments({ filter: '_type == "movie"' })
 * return (
 *   <div>
 *     <h1>Movies</h1>
 *     <ul>
 *       {data.map(movie => (
 *         <li key={movie._id}>
 *           <Suspense fallback='Loading…'>
 *             <PreviewComponent document={movie} />
 *           </Suspense>
 *         </li>
 *       ))}
 *     </ul>
 *   </div>
 * )
 * ```
 */
export declare function useDocumentPreview({ ref, ...docHandle }: useDocumentPreviewOptions): useDocumentPreviewResults;
/**
 * @public
 * @category Types
 * @category Documents
 */
interface useDocumentProjectionOptions<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string> extends DocumentHandle<TDocumentType, TDataset, TProjectId> {
  /** The GROQ projection string */
  projection: TProjection;
  /** Optional parameters for the projection query */
  params?: Record<string, unknown>;
  /** Optional ref to track viewport intersection for lazy loading */
  ref?: React.RefObject<unknown>;
}
/**
 * @public
 * @category Types
 * @category Documents
 */
interface useDocumentProjectionResults<TData> {
  /** The projected data */
  data: TData;
  /** True if the projection is currently being resolved */
  isPending: boolean;
}
/**
 * @public
 *
 * Returns the projected values of a document based on the provided projection string.
 * These values are live and will update in realtime.
 * To optimize network requests, an optional `ref` can be passed to only resolve the projection
 * when the referenced element is intersecting the viewport.
 *
 * @category Documents
 * @remarks
 * This hook has multiple signatures allowing for fine-grained control over type inference:
 * - Using Typegen: Infers the return type based on the `documentType`, `dataset`, `projectId`, and `projection`.
 * - Using explicit type parameter: Allows specifying a custom return type `TData`.
 *
 * @param options - An object containing the `DocumentHandle` properties (`documentId`, `documentType`, etc.), the `projection` string, optional `params`, and an optional `ref`.
 * @returns An object containing the projection results (`data`) and a boolean indicating whether the resolution is pending (`isPending`). Note: Suspense handles initial loading states; `data` being `undefined` after initial loading means the document doesn't exist or the projection yielded no result.
 */
/**
 * @public
 * Fetch a projection, relying on Typegen for the return type based on the handle and projection.
 *
 * @category Documents
 * @param options - Options including the document handle properties (`documentId`, `documentType`, etc.) and the `projection`.
 * @returns The projected data, typed based on Typegen.
 *
 * @example Using an existing experimental Typegen file for a book preview
 * ```tsx
 * // ProjectionComponent.tsx
 * import {defineProjection, useDocumentProjection, type DocumentHandle} from '@sanity/sdk-react'
 * import {useRef} from 'react'
 *
 * // Define props using DocumentHandle with the specific document type
 * type ProjectionComponentProps = {
 *   doc: DocumentHandle<'book'> // Typegen knows 'book'
 * }
 *
 * // Keep the projection string identical to its entry in the existing generated file.
 * // Typegen also scans defineProjection imported from the SDK. See defineProjection for
 * // passing the document type first.
 * const myProjection = defineProjection(`{
 *   title,
 *   'coverImage': cover.asset->url,
 *   'authors': array::join(authors[]->{'name': firstName + ' ' + lastName}.name, ', ')
 * }`)
 *
 * export default function ProjectionComponent({ doc }: ProjectionComponentProps) {
 *   const ref = useRef(null) // Optional ref to track viewport intersection for lazy loading
 *
 *   // Spread the doc handle into the options
 *   // Typegen infers the return type based on 'book' and the projection
 *   const { data } = useDocumentProjection({
 *     ...doc, // Pass the handle properties
 *     ref,
 *     projection: myProjection,
 *   })
 *
 *   // Suspense handles initial load, check for data existence after
 *   return (
 *     <article ref={ref}>
 *       <h2>{data.title ?? 'Untitled'}</h2>
 *       {data.coverImage && <img src={data.coverImage} alt={data.title} />}
 *       <p>{data.authors ?? 'Unknown authors'}</p>
 *     </article>
 *   )
 * }
 *
 * // Usage:
 * // import {createDocumentHandle} from '@sanity/sdk-react'
 * // const myDocHandle = createDocumentHandle({ documentId: 'book123', documentType: 'book' })
 * // <Suspense fallback='Loading preview...'>
 * //   <ProjectionComponent doc={myDocHandle} />
 * // </Suspense>
 * ```
 */
export declare function useDocumentProjection<TProjection extends string = string, TDocumentType extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: useDocumentProjectionOptions<TProjection, TDocumentType, TDataset, TProjectId>): useDocumentProjectionResults<ResolveProjectionResult<TProjection, TDocumentType, `${TProjectId}.${TDataset}`>>;
/**
 * @public
 * Fetch a projection with an explicitly defined return type `TData`.
 *
 * @param options - Options including the document handle properties (`documentId`, etc.) and the `projection`.
 * @returns The projected data, cast to the explicit type `TData`.
 *
 * @example Explicitly typing the projection result
 * ```tsx
 * import {useDocumentProjection, type DocumentHandle} from '@sanity/sdk-react'
 * import {useRef} from 'react'
 *
 * interface SimpleBookPreview {
 *   title?: string;
 *   authorName?: string;
 * }
 *
 * type BookPreviewProps = {
 *   doc: DocumentHandle
 * }
 *
 * function BookPreview({ doc }: BookPreviewProps) {
 *   const ref = useRef(null)
 *   const { data } = useDocumentProjection<SimpleBookPreview>({
 *     ...doc,
 *     ref,
 *     projection: `{ title, 'authorName': author->name }`
 *   })
 *
 *   return (
 *     <div ref={ref}>
 *       <h3>{data.title ?? 'No Title'}</h3>
 *       <p>By: {data.authorName ?? 'Unknown'}</p>
 *     </div>
 *   )
 * }
 *
 * // Usage:
 * // import {createDocumentHandle} from '@sanity/sdk-react'
 * // const doc = createDocumentHandle({ documentId: 'abc', documentType: 'book' })
 * // <Suspense fallback='Loading...'>
 * //   <BookPreview doc={doc} />
 * // </Suspense>
 * ```
 */
export declare function useDocumentProjection<TData extends object>(options: useDocumentProjectionOptions): useDocumentProjectionResults<TData>;
/**
 * Returns metadata for a given project.
 *
 * @category Projects
 * @param options - Configuration options
 * @returns A {@link FetcherHookResult} whose `data` is the metadata for the
 *   project. `members` is included only when `includeMembers: true`; `features`
 *   is included unless `includeFeatures: false`.
 * @example
 * ```tsx
 * function ProjectMetadata({projectId}: {projectId: string}) {
 *   const {data: project} = useProject({projectId})
 *
 *   return (
 *     <figure style={{backgroundColor: project.metadata.color || 'lavender'}}>
 *       <h1>{project.displayName}</h1>
 *     </figure>
 *   )
 * }
 * ```
 * @example
 * ```tsx
 * const {data: projectWithMembersAndFeatures} = useProject({projectId})
 * const {data: projectWithMembers} = useProject({projectId, includeMembers: true})
 * const {data: projectWithoutMembers} = useProject({projectId, includeMembers: false})
 * const {data: projectWithoutFeatures} = useProject({projectId, includeFeatures: false})
 * ```
 * @remarks
 * The `projectId` is resolved in order from:
 * 1. an explicit `projectId` option
 * 2. A legacy ProjectContext (e.g. a `<ResourceProvider projectId="…">` with no dataset), then
 * 3. The active resource (`ResourceProvider`/`SDKProvider`)
 * 4. `instance.config`.
 * @public
 * @function
 */
export declare const useProject: <IncludeMembers extends boolean = true, IncludeFeatures extends boolean = true>(options?: ProjectOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Project<IncludeMembers, IncludeFeatures>>;
/**
 * Returns metadata for each project you have access to.
 *
 * @category Projects
 * @param options - Configuration options
 * @returns A {@link FetcherHookResult} whose `data` is an array of project
 *   metadata. `members` is included only when `includeMembers: true`; `features`
 *   is included unless `includeFeatures: false`.
 * @example
 * ```tsx
 * const {data: projects} = useProjects()
 *
 * return (
 *   <select>
 *     {projects.map((project) => (
 *       <option key={project.id}>{project.displayName}</option>
 *     ))}
 *   </select>
 * )
 * ```
 * @example
 * ```tsx
 * const {data: projects} = useProjects()
 * const {data: projectsWithFeatures} = useProjects()
 * const {data: projectsWithMembers} = useProjects({includeMembers: true})
 * const {data: projectsWithoutMembers} = useProjects({includeMembers: false})
 * const {data: projectsWithoutFeatures} = useProjects({includeFeatures: false})
 * ```
 * @public
 * @function
 */
export declare const useProjects: <IncludeMembers extends boolean = false, IncludeFeatures extends boolean = true>(options?: ProjectsOptions<IncludeMembers, IncludeFeatures>) => FetcherHookResult<Project<IncludeMembers, IncludeFeatures>[]>;
/**
 * Hook options for useQuery, supporting both direct resource and resourceName.
 * @beta
 */
type UseQueryOptions<TQuery extends string = string, TDataset extends string = string, TProjectId extends string = string> = WithResourceNameSupport<QueryOptions<TQuery, TDataset, TProjectId>>;
/**
 * @public
 * Executes a GROQ query, inferring the result type from the query string and options.
 * Leverages Sanity Typegen if configured for enhanced type safety.
 *
 * @param options - Configuration for the query, including `query`, optional `params`, `projectId`, `dataset`, etc.
 * @returns An object containing `data` (typed based on the query) and `isPending` (for transitions).
 *
 * @example Basic usage (Inferred Type)
 * ```tsx
 * import {useQuery} from '@sanity/sdk-react'
 * import {defineQuery} from 'groq'
 *
 * const myQuery = defineQuery(`*[_type == "movie"]{_id, title}`)
 *
 * function MovieList() {
 *   // Typegen infers the return type for data
 *   const {data} = useQuery({ query: myQuery })
 *
 *   return (
 *     <div>
 *       <h2>Movies</h2>
 *       <ul>
 *         {data.map(movie => <li key={movie._id}>{movie.title}</li>)}
 *       </ul>
 *     </div>
 *   )
 * }
 * // Suspense boundary should wrap <MovieList /> for initial load
 * ```
 *
 * @example Using parameters (Inferred Type)
 * ```tsx
 * import {useQuery} from '@sanity/sdk-react'
 * import {defineQuery} from 'groq'
 *
 * const myQuery = defineQuery(`*[_type == "movie" && _id == $id][0]`)
 *
 * function MovieDetails({movieId}: {movieId: string}) {
 *   // Typegen infers the return type based on query and params
 *   const {data, isPending} = useQuery({
 *     query: myQuery,
 *     params: { id: movieId }
 *   })
 *
 *   return (
 *     // utilize `isPending` to signal to users that new data is coming in
 *     // (e.g. the `movieId` changed and we're loading in the new one)
 *     <div style={{ opacity: isPending ? 0.5 : 1 }}>
 *       {data ? <h1>{data.title}</h1> : <p>Movie not found</p>}
 *     </div>
 *   )
 * }
 * ```
 */
export declare function useQuery<TQuery extends string = string, TDataset extends string = string, TProjectId extends string = string>(options: UseQueryOptions<TQuery, TDataset, TProjectId>): {
  /** The query result, typed based on the GROQ query string */
  data: ResolveQueryResult<TQuery, `${TProjectId}.${TDataset}`>;
  /** True if a query transition is in progress */
  isPending: boolean;
};
/**
 * @public
 * Executes a GROQ query with an explicitly provided result type `TData`.
 *
 * @param options - Configuration for the query, including `query`, optional `params`, `projectId`, `dataset`, etc.
 * @returns An object containing `data` (cast to `TData`) and `isPending` (indicates whether a query resolution is pending; note that Suspense handles initial loading states). *
 * @example Manually typed query result
 * ```tsx
 * import {useQuery} from '@sanity/sdk-react'
 *
 * interface CustomMovieTitle {
 *   movieTitle?: string
 * }
 *
 * function FirstMovieTitle() {
 *   // Provide the explicit type TData
 *   const {data, isPending} = useQuery<CustomMovieTitle>({
 *     query: '*[_type == "movie"][0]{ "movieTitle": title }'
 *   })
 *
 *   return (
 *     <h1 style={{ opacity: isPending ? 0.5 : 1 }}>
 *       {data?.movieTitle ?? 'No title found'}
 *     </h1>
 *   )
 * }
 * ```
 */
export declare function useQuery<TData>(options: WithResourceNameSupport<QueryOptions>): {
  /** The query result, cast to the provided type TData */
  data: TData;
  /** True if another query is resolving in the background (suspense handles the initial loading state) */
  isPending: boolean;
};
/**
 * @public
 * @function
 *
 * Returns the active releases for the current project,
 * represented as a list of release documents.
 *
 * @returns The active releases for the current project.
 * @category Releases
 * @example
 * ```tsx
 * import {useActiveReleases} from '@sanity/sdk-react'
 *
 * const activeReleases = useActiveReleases()
 * ```
 */
export declare function useActiveReleases(options?: WithResourceNameSupport<DatasetHandle> | undefined): ReleaseDocument[];
/**
 * @public
 * @function
 *
 * Returns every release the dataset has — including `archived`, `published`,
 * and mid-transition states (`archiving`, `unarchiving`, `publishing`,
 * `scheduling`).
 *
 * Use this hook when you're building a release-management UI (listing
 * releases, surfacing lifecycle controls, etc.) so a release stays visible
 * across its full lifecycle — including after it's been published or
 * archived. For perspective / content queries, prefer
 * {@link useActiveReleases}, which filters to releases that still affect
 * what's queryable.
 *
 * @returns Every release for the current project, sorted to match the order
 * used by {@link useActiveReleases}.
 * @category Releases
 * @example
 * ```tsx
 * import {useAllReleases} from '@sanity/sdk-react'
 *
 * const releases = useAllReleases()
 * ```
 */
export declare function useAllReleases(options?: WithResourceNameSupport<DatasetHandle> | undefined): ReleaseDocument[];
/**
 * @public
 */
interface UseApplyReleaseActions {
  (): (action: ReleaseAction | ReleaseAction[], options?: ResourceHandle) => Promise<ActionsResult>;
}
/**
 * @public
 *
 * Provides a stable callback function for applying one or more release actions.
 *
 * This hook wraps the core `applyDocumentActions` functionality from `@sanity/sdk`,
 * integrating it with the React component lifecycle and {@link SanityInstance}.
 * It accepts release-lifecycle actions generated by {@link createRelease},
 * {@link editRelease}, {@link publishRelease}, {@link scheduleRelease},
 * {@link unscheduleRelease}, {@link archiveRelease}, {@link unarchiveRelease},
 * and {@link deleteRelease}.
 *
 * Note that actions submitted via this hook will cascade to the documents in the release.
 * For example, if you create a release and then publish it, the documents in the release will be published.
 * If you delete a published release, the version documents will be deleted.
 *
 * Features:
 * - Applies one or multiple `ReleaseAction` objects.
 * - Supports optimistic updates for create/edit/delete: local release state
 *   reflects changes immediately while in-flight.
 * - Handles batching: multiple actions passed together are submitted as a
 *   single atomic transaction.
 *
 * Release actions cannot be combined with `liveEdit` document actions in the
 * same transaction. Submit them as separate transactions if you need both.
 *
 * @category Releases
 * @returns A stable callback. When called with a single `ReleaseAction` or an
 * array of `ReleaseAction`s, it returns a promise that resolves to an
 * {@link ActionsResult}.
 *
 * @example Create and schedule a release
 * ```tsx
 * import {
 *   createRelease,
 *   scheduleRelease,
 *   useApplyReleaseActions,
 *   type ReleaseHandle,
 * } from '@sanity/sdk-react'
 *
 * function ScheduleReleaseButton({release}: {release: ReleaseHandle}) {
 *   const applyRelease = useApplyReleaseActions()
 *
 *   const handleSchedule = () =>
 *     applyRelease([
 *       createRelease(release, {title: 'Summer drop', releaseType: 'asap'}),
 *       scheduleRelease(release, '2026-06-01T00:00:00Z'),
 *     ])
 *
 *   return <button onClick={handleSchedule}>Schedule</button>
 * }
 * ```
 *
 * @example Publish a release
 * ```tsx
 * import {publishRelease, useApplyReleaseActions} from '@sanity/sdk-react'
 *
 * function PublishButton({releaseId}: {releaseId: string}) {
 *   const applyRelease = useApplyReleaseActions()
 *   return (
 *     <button onClick={() => applyRelease(publishRelease({releaseId}))}>
 *       Publish all documents in the release
 *     </button>
 *   )
 * }
 * ```
 */
export declare const useApplyReleaseActions: UseApplyReleaseActions;
/**
 * Returns a single or stack of perspectives for the given perspective handle,
 * which can then be used to correctly query the documents
 * via the `perspective` parameter in the client.
 *
 * @public
 * @param perspectiveHandle - The perspective handle to get the perspective for.
 * @category Documents
 * @example
 * ```tsx
 * import {usePerspective, useQuery} from '@sanity/sdk-react'
 *
 * const perspective = usePerspective({perspective: 'rxg1346', projectId: 'abc123', dataset: 'production'})
 * const {data} = useQuery<Movie[]>('*[_type == "movie"]', {
 *   perspective: perspective,
 * })
 * ```
 *
 * @returns The perspective for the given perspective handle.
 */
export declare function usePerspective(perspectiveHandle?: ResourceHandle): string | string[];
/**
 * @public
 * @category Types
 * @category Users
 */
interface UserResult {
  /**
   * The user data fetched, or undefined if not found.
   */
  data: SanityUser | undefined;
  /**
   * Whether a user request is currently in progress
   */
  isPending: boolean;
}
/**
 *
 * @public
 *
 * Retrieves a single user by ID for a given resource (either a project or an organization).
 *
 * @category Users
 * @param options - The user ID, resource type, project ID, or organization ID
 * @returns The user data and loading state
 *
 * @example
 * ```
 * const { data, isPending } = useUser({
 *   userId: 'gabc123',
 *   resourceType: 'project',
 *   projectId: 'my-project-id',
 * })
 *
 * return (
 *   <div>
 *     {isPending && <p>Loading...</p>}
 *     {data && (
 *       <figure>
 *         <img src={data.profile.imageUrl} alt='' />
 *         <figcaption>{data.profile.displayName}</figcaption>
 *         <address>{data.profile.email}</address>
 *       </figure>
 *     )}
 *   </div>
 * )
 * ```
 */
export declare function useUser(options: GetUserOptions): UserResult;
/**
 * @public
 * @category Types
 * @category Users
 */
interface UsersResult {
  /**
   * The users fetched.
   */
  data: SanityUser[];
  /**
   * How many users the resource has, including those not fetched yet.
   */
  totalCount: number;
  /**
   * Whether there are more users to fetch.
   */
  hasMore: boolean;
  /**
   * Whether a users request is currently in progress
   */
  isPending: boolean;
  /**
   * Load more users.
   */
  loadMore: () => void;
}
/**
 *
 * @public
 *
 * Retrieves the users for a given resource (either a project or an organization).
 *
 * @category Users
 * @param params - The resource type, project ID, and the limit of users to fetch
 * @returns A list of users, how many users the resource has in total, a boolean indicating whether there are more users to fetch, and a function to load more users
 *
 * @example
 * ```
 * const { data, totalCount, hasMore, loadMore, isPending } = useUsers({
 *   resourceType: 'organization',
 *   organizationId: 'my-org-id',
 *   batchSize: 10,
 * })
 *
 * return (
 *   <div>
 *     {data.map(user => (
 *       <figure key={user.sanityUserId}>
 *         <img src={user.profile.imageUrl} alt='' />
 *         <figcaption>{user.profile.displayName}</figcaption>
 *         <address>{user.profile.email}</address>
 *       </figure>
 *     ))}
 *     <p>Showing {data.length} of {totalCount}</p>
 *     {hasMore && <button onClick={loadMore}>{isPending ? 'Loading...' : 'Load More'}</button>}
 *   </div>
 * )
 * ```
 * @remarks
 * For project-scoped queries the `projectId` is resolved in order from:
 * 1. an explicit `projectId` option
 * 2. A legacy ProjectContext (e.g. a `<ResourceProvider projectId="…">` with no dataset), then
 * 3. The active resource (`ResourceProvider`/`SDKProvider`)
 * 4. `instance.config`.
 */
export declare function useUsers(options?: GetUsersOptions): UsersResult;
/**
 * This version is provided by pkg-utils at build time
 * @internal
 */
export declare const REACT_SDK_VERSION: {};
export type { AuthBoundaryProps, Status as ComlinkStatus, CommentActions, CreateDocumentOverrides, DatasetsResponse, DocumentHandle, DocumentTypeHandle, DocumentsOptions, DocumentsResponse, FetcherHookResult, FrameConnection, FrameMessageHandler as MessageHandler, MutationHookResult, PaginatedDocumentsOptions, PaginatedDocumentsResponse, ResourceHandle, ResourceProviderProps, SDKProviderProps, SanityAppProps, SanityDocument, SanityInstanceProviderProps, SanityProjectMember, SortOrderingItem, StudioWorkspaceHandle, UseCommentThreadsResult, UseCommentsResult, UseFrameConnectionOptions, UseOAuthTokensResult, UsePresenceForDocumentOptions, UseReportPresenceOptions, UseWindowConnectionOptions, UserResult, UsersResult, WindowConnection, WindowMessageHandler, useDocumentPreviewOptions, useDocumentPreviewResults, useDocumentProjectionOptions, useDocumentProjectionResults };
//# sourceMappingURL=index.d.ts.map