import { WidgetProps } from '../../../domains/widgets/components/widget/types'; import type { NarrativeRequest } from '../../../infra/api/narrative/narrative-api-types.js'; import type { HookEnableParam } from '../../../shared/hooks/types'; /** * 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; } & HookEnableParam; export type UseWidgetNarrativeStateResult = WidgetNarrativeQueryState & { supported: boolean; /** * Effective value after applying {@link HookEnableParam} defaults (always `true` or `false`). * When `false`, 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 narrative request and runs `getNarrative` via TanStack Query. * Depends on {@link useSisenseContext} (`httpClient`, narrative settings) and a `QueryClientProvider`. * Not exported from `@sisenseInternal` public API. * * @internal */ export declare function useWidgetNarrativeState({ widgetProps, enabled, }: UseWidgetNarrativeStateParams): UseWidgetNarrativeStateResult;