UNPKG

@sanity/scheduled-publishing

Version:

> [!IMPORTANT] > As of [v3.39.0](https://www.sanity.io/changelog/e6013ee5-8214-4e03-9593-f7b19124b8a3) of Sanity Studio, this plugin has been deprecated and the Scheduled Publishing functionality has been moved into the core studio package. > Read more an

22 lines (18 loc) 692 B
import {useTools} from 'sanity' import {DEFAULT_PLUGIN_OPTIONS, TOOL_NAME} from '../constants' import {PluginOptions} from '../types' /** * Retrieve current tool options, returning default options if the tool is unavailable for any reason. */ export function useToolOptions(): Required<PluginOptions> { const tools = useTools() const currentTool = tools.find((t) => t.name === TOOL_NAME) const options = currentTool?.options if (!options) { console.warn( '[scheduled-publishing] Unable to find tool options and reverting to default values - please ensure that the tool is available in the current studio.' ) return DEFAULT_PLUGIN_OPTIONS } return options }