import { prepareGetNlgInsightsPayload, type UseGetNlgInsightsParams } from '../../domains/narrative/core/build-narrative-request.js'; import type { GetNlgInsightsRequest } from '../../infra/api/narrative/narrative-api-types.js'; import type { GetNlgInsightsProps } from './get-nlg-insights.js'; export { prepareGetNlgInsightsPayload, type UseGetNlgInsightsParams }; /** * State for {@link useGetNlgInsights} hook. */ export interface UseGetNlgInsightsState { /** Whether the data fetching is loading */ isLoading: boolean; /** Whether the data fetching has failed */ isError: boolean; /** Whether the data fetching has succeeded */ isSuccess: boolean; /** The result data */ data: string | undefined; /** The error if any occurred */ error: unknown; /** Callback to trigger a refetch of the data */ refetch: () => void; } /** * * @param params - {@link UseGetNlgInsightsParams} * @param enabled - boolean flag to enable/disable this hook * @internal */ export declare const useGetNlgInsightsInternal: (params: GetNlgInsightsProps | GetNlgInsightsRequest, enabled?: boolean) => UseGetNlgInsightsState; /** * React hook that fetches an analysis of the provided query using natural language generation (NLG). * Specifying a query is similar to providing parameters to a {@link useExecuteQuery} hook, using dimensions, measures, and filters. * * @example * ```tsx * const { data, isLoading } = useGetNlgInsights({ * dataSource: 'Sample ECommerce', * dimensions: [DM.Commerce.Date.Years], * measures: [measureFactory.sum(DM.Commerce.Revenue)], * }); * * if (isLoading) { * return
{data}
; * ``` * @returns Response object containing a text summary * @group Generative AI */ export declare const useGetNlgInsights: (params: UseGetNlgInsightsParams) => UseGetNlgInsightsState;