import type { AsyncDataOptions, NuxtError } from '#app'; import { type ISbResult, type ISbStoriesParams, type StoryblokBridgeConfigV2 } from '@storyblok/vue'; import { type ComputedRef, type MaybeRefOrGetter, type Ref } from 'vue'; /** * Options for the useAsyncStoryblok composable. * Extends Nuxt's AsyncDataOptions with Storyblok-specific configuration. */ export interface UseAsyncStoryblokOptions extends AsyncDataOptions { /** * Storyblok API parameters for fetching stories. * * Accepts a plain object, a ref, a computed, or a getter. The current value * is read (via `toValue`) on every fetch, so reactive params stay in sync. * Note that changing a reactive value does not auto-refetch on its own — * trigger a re-fetch by calling `refresh()` or by passing a `watch` option * (e.g. `watch: [version]`), which Nuxt's `useAsyncData` re-runs on. */ api: MaybeRefOrGetter; /** Storyblok Bridge configuration for live preview */ bridge: StoryblokBridgeConfigV2; } interface AsyncDataExecuteOptions { dedupe?: 'cancel' | 'defer'; } export interface UseAsyncStoryblokResult { story: ComputedRef; /** In Nuxt 3: null when not loaded. In Nuxt 4: undefined when not loaded. */ data: Ref; pending: Ref; /** In Nuxt 3: null when no error. In Nuxt 4: undefined when no error. */ error: Ref | null | undefined>; refresh: (opts?: AsyncDataExecuteOptions) => Promise; execute: (opts?: AsyncDataExecuteOptions) => Promise; clear: () => void; } /** * Composable for fetching Storyblok stories with async data handling and live preview support. * * This composable combines Nuxt's useAsyncData with Storyblok's bridge functionality to provide: * - Async data fetching with loading and error states * - Automatic caching based on URL and API parameters * - Live preview updates when editing in Storyblok * - SSR/SSG compatibility * * @param url - The story URL path (e.g., 'home', 'blog/my-post') * @param options - Configuration options for AsyncData, API calls and bridge setup * @returns An object containing the async data result with additional story computed property * * @example * ```vue * * * * ``` * * @example * Reactive params: pass a getter/computed and refetch when it changes. * ```vue * * ``` */ export declare function useAsyncStoryblok(url: string, options: UseAsyncStoryblokOptions): Promise; export {};