import { WidgetProps } from '../../../domains/widgets/components/widget/types'; import type { NarrativeRequest } from '../../../infra/api/narrative/narrative-api-types.js'; import type { WidgetNarrativeOptions } from '../core/widget-narrative-options.js'; /** * Hook state aligned with legacy {@link UseGetNlgInsightsState}; used by {@link useGetWidgetNarrative}. * * @internal */ export type WidgetNarrativeQueryState = { isLoading: boolean; isError: boolean; isSuccess: boolean; data: string | undefined; error: unknown; refetch: () => void; }; export type UseWidgetNarrativeStateParams = { widgetProps: WidgetProps; enabled?: boolean; } & WidgetNarrativeOptions; export type UseWidgetNarrativeStateResult = WidgetNarrativeQueryState & { supported: boolean; /** * Mirrors the `enabled` param. When `false`, the narrative is opted out: `data` is cleared (no * cached fallback), `narrativeRequest` is undefined, and loading/error flags reflect a disabled * query rather than “no insights.” */ enabled: boolean; /** Present when `supported` and `enabled`; used by {@link WidgetNarrative} for feedback payload only. */ narrativeRequest: NarrativeRequest | undefined; }; /** * Resolves chart or pivot widget props to a narration request and runs `getNarrative` via TanStack Query. * Depends on {@link useSisenseContext} (`httpClient`, narration settings) and a `QueryClientProvider`. * Not exported from `@sisenseInternal` public API. * * @internal */ export declare function useWidgetNarrativeState({ widgetProps, defaultDataSource, verbosity, enabled, ignoreTrendAndForecast, isUnifiedNarrationEnabled: optionsUnified, isSisenseAiEnabled: optionsSisenseAi, }: UseWidgetNarrativeStateParams): UseWidgetNarrativeStateResult;