next-sanity
Version:
Sanity.io toolkit for Next.js
29 lines • 1.52 kB
TypeScript
import { n as PUBLISHED_SYNC_TAG_PREFIX, t as DRAFT_SYNC_TAG_PREFIX } from "../../constants.js";
import { ClientPerspective, InitializedClientConfig, LiveEventGoAway, SyncTag } from "@sanity/client";
interface SanityClientConfig extends Pick<InitializedClientConfig, "projectId" | "dataset" | "apiHost" | "apiVersion" | "useProjectHostname" | "token" | "requestTagPrefix"> {}
/**
* @alpha CAUTION: This API does not follow semver and could have breaking changes in future minor releases.
*/
interface SanityLiveProps {
config: SanityClientConfig;
draftModeEnabled: boolean;
refreshOnMount?: boolean;
refreshOnFocus?: boolean;
refreshOnReconnect?: boolean;
requestTag: string | undefined;
/**
* Handle errors from the Live Events subscription.
* By default it's reported using `console.error`, you can override this prop to handle it in your own way.
*/
onError?: (error: unknown) => void;
intervalOnGoAway?: number | false;
onGoAway?: (event: LiveEventGoAway, intervalOnGoAway: number | false) => void;
revalidateSyncTags: (tags: `${typeof PUBLISHED_SYNC_TAG_PREFIX | typeof DRAFT_SYNC_TAG_PREFIX}${SyncTag}`[]) => Promise<void | "refresh">;
resolveDraftModePerspective: () => Promise<ClientPerspective>;
}
/**
* @alpha CAUTION: This API does not follow semver and could have breaking changes in future minor releases.
*/
declare function SanityLive(props: SanityLiveProps): React.JSX.Element | null;
export { SanityLiveProps, SanityLive as default };
//# sourceMappingURL=live.d.ts.map