@sisense/sdk-ui 1.4.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/ai/ai-context-provider.d.ts +1 -0
  2. package/dist/ai/api/chat-rest-api.d.ts +3 -0
  3. package/dist/ai/api/errors.d.ts +2 -1
  4. package/dist/ai/api/types.d.ts +10 -11
  5. package/dist/ai/chat-config.d.ts +10 -3
  6. package/dist/ai/chat-intro-blurb.d.ts +4 -0
  7. package/dist/ai/chatbot.d.ts +3 -2
  8. package/dist/ai/common/collapsible.d.ts +11 -0
  9. package/dist/ai/get-nlg-query-result.d.ts +12 -52
  10. package/dist/ai/icons/loading-dots-gif-base64.d.ts +2 -0
  11. package/dist/ai/index.d.ts +4 -2
  12. package/dist/ai/messages/feedback-wrapper.d.ts +2 -1
  13. package/dist/ai/messages/insights-message.d.ts +6 -4
  14. package/dist/ai/messages/message-list-resolver.d.ts +1 -2
  15. package/dist/ai/messages/message-resolver.d.ts +1 -3
  16. package/dist/ai/messages/nlq-message-group.d.ts +10 -0
  17. package/dist/ai/suggestions/index.d.ts +1 -1
  18. package/dist/ai/suggestions/suggestion-list.d.ts +1 -1
  19. package/dist/ai/suggestions/suggestions-with-intro.d.ts +2 -2
  20. package/dist/ai/translators/code-templates.d.ts +11 -0
  21. package/dist/ai/translators/generate-code.d.ts +9 -0
  22. package/dist/ai/translators/index.d.ts +4 -0
  23. package/dist/ai/translators/model-translator.d.ts +50 -0
  24. package/dist/ai/translators/query-translator.d.ts +122 -0
  25. package/dist/ai/translators/translate-props-to-code.d.ts +8 -0
  26. package/dist/ai/translators/types.d.ts +105 -0
  27. package/dist/ai/translators/use-get-data-source.d.ts +12 -0
  28. package/dist/ai/translators/utils.d.ts +2 -0
  29. package/dist/ai/use-chat-session.d.ts +9 -3
  30. package/dist/ai/use-get-nlg-query-result.d.ts +42 -66
  31. package/dist/ai/use-get-query-recommendations.d.ts +32 -34
  32. package/dist/ai.js +7101 -1729
  33. package/dist/area-chart.d.ts +1 -0
  34. package/dist/areamap-chart.d.ts +1 -0
  35. package/dist/bar-chart.d.ts +3 -0
  36. package/dist/boxplot-chart.d.ts +1 -0
  37. package/dist/boxplot-utils.d.ts +2 -1
  38. package/dist/chart/chart.d.ts +1 -0
  39. package/dist/chart-data-options/types.d.ts +3 -3
  40. package/dist/chart-options-processor/subtype-to-design-options.d.ts +6 -6
  41. package/dist/chart-options-processor/translations/tooltip-utils.d.ts +1 -0
  42. package/dist/charts/table/helpers/calc-column-widths.d.ts +1 -1
  43. package/dist/charts/table/styles/style-constants.d.ts +2 -2
  44. package/dist/column-chart.d.ts +4 -0
  45. package/dist/common/components/loading-indicator.d.ts +2 -0
  46. package/dist/common/components/loading-spinner.d.ts +5 -0
  47. package/dist/dashboard-widget/dashboard-widget.d.ts +5 -1
  48. package/dist/dashboard-widget/translate-widget-data-options.d.ts +5 -0
  49. package/dist/dashboard-widget/translate-widget-filters.d.ts +1 -0
  50. package/dist/dashboard-widget/types.d.ts +4 -3
  51. package/dist/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +1 -0
  52. package/dist/filters/components/date-filter/date-range-filter-tile/date-range-filter-tile.d.ts +1 -0
  53. package/dist/filters/components/date-filter/relative-date-filter-tile/relative-date-filter-tile.d.ts +1 -0
  54. package/dist/filters/components/member-filter-tile/member-filter-tile.d.ts +1 -0
  55. package/dist/formulas/fetch-formula.d.ts +2 -2
  56. package/dist/formulas/use-get-shared-formula.d.ts +1 -0
  57. package/dist/funnel-chart.d.ts +1 -0
  58. package/dist/index.d.ts +4 -0
  59. package/dist/index.js +6728 -37696
  60. package/dist/indicator-chart.d.ts +1 -0
  61. package/dist/line-chart.d.ts +1 -0
  62. package/dist/models/dashboard/get-dashboard-models.d.ts +1 -3
  63. package/dist/models/dashboard/translate-dashboard.d.ts +1 -1
  64. package/dist/models/dashboard/types.d.ts +17 -0
  65. package/dist/models/dashboard/use-get-dashboard-model.d.ts +1 -0
  66. package/dist/models/dashboard/use-get-dashboard-models.d.ts +1 -0
  67. package/dist/models/widget/use-get-widget-model.d.ts +1 -0
  68. package/dist/models/widget/widget-model.d.ts +10 -1
  69. package/dist/pie-chart.d.ts +1 -0
  70. package/dist/pivot-table/pivot-table.d.ts +1 -0
  71. package/dist/polar-chart.d.ts +1 -0
  72. package/dist/props.d.ts +197 -120
  73. package/dist/query-execution/execute-query-by-widget-id.d.ts +1 -0
  74. package/dist/query-execution/execute-query.d.ts +1 -0
  75. package/dist/query-execution/types.d.ts +46 -16
  76. package/dist/query-execution/use-execute-csv-query.d.ts +1 -0
  77. package/dist/query-execution/use-execute-pivot-query.d.ts +1 -0
  78. package/dist/query-execution/use-execute-query-by-widget-id.d.ts +1 -0
  79. package/dist/query-execution/use-execute-query.d.ts +1 -0
  80. package/dist/scatter-chart.d.ts +1 -0
  81. package/dist/scattermap-chart.d.ts +1 -0
  82. package/dist/sisense-context/sisense-context-provider.d.ts +1 -0
  83. package/dist/sisense-context/sisense-context.d.ts +4 -1
  84. package/dist/sunburst-chart.d.ts +1 -0
  85. package/dist/table/table.d.ts +1 -0
  86. package/dist/theme-provider/theme-provider.d.ts +8 -1
  87. package/dist/treemap-chart.d.ts +1 -0
  88. package/dist/types.d.ts +32 -32
  89. package/dist/widgets/chart-widget.d.ts +1 -0
  90. package/dist/widgets/common/context-menu.d.ts +5 -0
  91. package/dist/widgets/common/drilldown-breadcrumbs/drilldown-breadcrumbs.d.ts +5 -0
  92. package/dist/widgets/drilldown-widget.d.ts +1 -0
  93. package/dist/widgets/table-widget.d.ts +1 -1
  94. package/dist/with-tracking-e2a077f9.js +109112 -0
  95. package/package.json +19 -14
  96. package/dist/ai/loading-page.d.ts +0 -2
  97. package/dist/with-tracking-d12a4632.js +0 -78010
@@ -0,0 +1,122 @@
1
+ import { ExpandedQueryModel, SimpleQueryModel, SimpleChartRecommendations } from '../../ai/translators/types';
2
+ import { DataSourceField, MetadataItem, MetadataItemJaql } from '@sisense/sdk-query-client';
3
+ import { ChartRecommendations } from '../../ai';
4
+ /**
5
+ * A class that translates ExpandedQueryModel (Raw JAQL+Chart Recommendations)
6
+ * to SimpleQueryModel (Simple JAQL+Simple Chart Options) and vice versa.
7
+ *
8
+ * It also provides methods to stringify query models to YAML strings
9
+ * and parse YAML strings to query models.
10
+ *
11
+ * @internal
12
+ */
13
+ export declare class QueryTranslator {
14
+ private readonly contextTitle;
15
+ private indexedFields;
16
+ /**
17
+ * Constructor for QueryTranslator.
18
+ *
19
+ * @param contextTitle - The context title
20
+ * @param fields - The data source fields
21
+ */
22
+ constructor(contextTitle: string, fields: DataSourceField[]);
23
+ /**
24
+ * Concatenates Aggregation Types.
25
+ */
26
+ private concatAggTypes;
27
+ /**
28
+ * Simplifies Aggregation Formula defined in MetadataItemJaql returned from chat response.
29
+ *
30
+ * @param aggFormula - The Aggregation Formula to simplify
31
+ * @returns The equivalent measure
32
+ * @privateRemarks
33
+ * See unit tests for examples of aggregation formulas and their equivalent measures.
34
+ */
35
+ simplifyAggFormula(aggFormula: MetadataItemJaql): MetadataItemJaql;
36
+ /**
37
+ * Simplifies MetadataItemJaql.
38
+ *
39
+ * @param item - The MetadataItemJaql to simplify
40
+ * @returns The simplified MetadataItemJaql
41
+ */
42
+ simplifyMetadataItemJaql(item: MetadataItemJaql): MetadataItemJaql;
43
+ /**
44
+ * Simplifies MetadataItem.
45
+ *
46
+ * @param item - The MetadataItem to simplify
47
+ * @returns The simplified MetadataItem
48
+ */
49
+ simplifyMetadataItem(item: MetadataItem): MetadataItem;
50
+ /**
51
+ * Simplifies Chart Recommendations.
52
+ *
53
+ * @param chartRecommendations - The Chart Recommendations to simplify
54
+ * @returns The simplified chart data options
55
+ */
56
+ simplifyChartRecommendations(chartRecommendations: ChartRecommendations | {}): SimpleChartRecommendations | {};
57
+ /**
58
+ * Returns the query title with the chart type.
59
+ *
60
+ * @param queryTitle - The query title
61
+ * @param chartRecommendations - The chart recommendations
62
+ * @returns The query title with the chart type
63
+ */
64
+ getQueryTitleWithChartType(queryTitle: string, chartRecommendations: {} | ChartRecommendations): string;
65
+ /**
66
+ * Takes a ExpandedQueryModel (e.g., from chat response) and translates it to SimpleQueryModel.
67
+ *
68
+ * @param expandedQueryModel - The Expanded Query model to simplify
69
+ * @returns The simplified query model
70
+ */
71
+ translateToSimple(expandedQueryModel: ExpandedQueryModel): SimpleQueryModel;
72
+ /**
73
+ * Stringifies a simple query model to YAML string.
74
+ *
75
+ * @param simpleQueryModel - The Simple Query model to convert
76
+ * @returns The YAML string representing the simple query model
77
+ */
78
+ stringifySimple(simpleQueryModel: SimpleQueryModel): string;
79
+ /**
80
+ * Parses a YAML string to Simple Query Model.
81
+ *
82
+ * @param simpleQueryYaml - The YAML string to parse
83
+ * @returns The Simple Query Model
84
+ */
85
+ parseSimple(simpleQueryYaml: string): SimpleQueryModel;
86
+ /**
87
+ * Derives chart family from chart type.
88
+ *
89
+ * @param chartType - chart type
90
+ * @returns chart family
91
+ */
92
+ private deriveChartFamily;
93
+ /**
94
+ * Expands Chart Recommendations.
95
+ *
96
+ * @param chartRecommendations - The Chart Recommendations to expand
97
+ * @returns The expanded chart recommendations
98
+ */
99
+ expandChartRecommendations(chartRecommendations: SimpleChartRecommendations | {}): ChartRecommendations | {};
100
+ /**
101
+ * Expands MetadataItemJaql by adding table, column, datatype, and title
102
+ * if they are missing from the item.
103
+ *
104
+ * @param item - The MetadataItemJaql to expand
105
+ * @returns The expanded MetadataItemJaql
106
+ */
107
+ expandMetadataItemJaql(item: MetadataItemJaql): MetadataItemJaql;
108
+ /**
109
+ * Expands MetadataItem
110
+ *
111
+ * @param item - The MetadataItem to expand
112
+ * @returns The expanded MetadataItem
113
+ */
114
+ expandMetadataItem(item: MetadataItem): MetadataItem;
115
+ /**
116
+ * Translates a Simple Query Model to Expanded Query Model.
117
+ *
118
+ * @param simpleQueryModel - The Simple Query model to convert
119
+ * @returns The Expanded Query Model
120
+ */
121
+ translateToExpanded(simpleQueryModel: SimpleQueryModel): ExpandedQueryModel;
122
+ }
@@ -0,0 +1,8 @@
1
+ export type MembersFilterJaql = {
2
+ members: string[];
3
+ };
4
+ export type FromNotEqualFilterJaql = {
5
+ fromNotEqual: number;
6
+ };
7
+ export type FilterJaql = MembersFilterJaql | FromNotEqualFilterJaql;
8
+ export declare const stringifyProps: (props: object, indent?: number, wrapInQuotes?: boolean) => string;
@@ -0,0 +1,105 @@
1
+ import { MetadataItem } from '@sisense/sdk-query-client';
2
+ import { AxesMapping, NlqResponseData } from '../../ai';
3
+ import { ChartType, TableType } from '../../types';
4
+ import { WidgetModel } from '../../models';
5
+ /**
6
+ * Expanded Query Model that is based on NlqResponseData.
7
+ * It contains expanded JAQL and chart recommendations returned from the chat response.
8
+ *
9
+ * @internal
10
+ */
11
+ export type ExpandedQueryModel = Pick<NlqResponseData, 'jaql' | 'chartRecommendations' | 'queryTitle'>;
12
+ /**
13
+ * Expanded Query Model
14
+ *
15
+ * Used as a default value for ExpandedQueryModel
16
+ *
17
+ * @internal
18
+ */
19
+ export declare const EMPTY_EXPANDED_QUERY_MODEL: ExpandedQueryModel;
20
+ /**
21
+ * Simple Chart Recommendations
22
+ *
23
+ * @internal
24
+ */
25
+ export interface SimpleChartRecommendations {
26
+ chartType: string;
27
+ dataOptions: AxesMapping;
28
+ }
29
+ /**
30
+ * Simple Query Model that is a simplified version of ExpandedQueryModel.
31
+ *
32
+ * It removes any JAQL syntax or information that already exists in the schema.
33
+ * Also, any parameters that have a default do not need to be specified.
34
+ *
35
+ * Users manipulates this model via the query in YAML format.
36
+ *
37
+ * ModelTranslator is responsible for translating this query model to SimpleWidgetModel.
38
+ *
39
+ * @internal
40
+ */
41
+ export interface SimpleQueryModel {
42
+ /**
43
+ * The data model or perspective title.
44
+ */
45
+ model: string;
46
+ metadata: MetadataItem[];
47
+ chart: SimpleChartRecommendations | {};
48
+ /**
49
+ * Title of the query
50
+ */
51
+ queryTitle: string;
52
+ }
53
+ /**
54
+ * Empty Simple Query Model
55
+ *
56
+ * Used as a default value for SimpleQueryModel
57
+ *
58
+ * @internal
59
+ */
60
+ export declare const EMPTY_SIMPLE_QUERY_MODEL: SimpleQueryModel;
61
+ /**
62
+ * All Chart Types including Table
63
+ * Note: Table will be re-united with ChartType in a future MR
64
+ *
65
+ * @internal
66
+ */
67
+ export type AllChartType = ChartType | TableType;
68
+ /**
69
+ * Chart Widget Model
70
+ *
71
+ * This model serves two purposes:
72
+ *
73
+ * (1) For rendering a chart or table widget in the Query Composer.
74
+ * (2) For reverse engineered (translated) to CSDK code
75
+ *
76
+ * Naming TBD
77
+ *
78
+ * @internal
79
+ */
80
+ export type ChartWidgetModel = Pick<WidgetModel, 'getChartWidgetProps' | 'getTableWidgetProps'> & {
81
+ chartType: AllChartType;
82
+ queryTitle: string;
83
+ };
84
+ /**
85
+ * UI Framework
86
+ *
87
+ * @internal
88
+ */
89
+ export type UiFramework = 'react' | 'vue' | 'angular';
90
+ /**
91
+ * Code Template Key
92
+ *
93
+ * @internal
94
+ */
95
+ export type CodeTemplateKey = 'baseChartTmpl' | 'chartTmpl' | 'chartWidgetTmpl' | 'tableWidgetTmpl';
96
+ /**
97
+ * Code Templates
98
+ *
99
+ * @internal
100
+ */
101
+ export type CodeTemplates = {
102
+ [key in UiFramework]: {
103
+ [key in CodeTemplateKey]: string;
104
+ };
105
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Gets the fields of a data source.
3
+ *
4
+ * Alternative hook implementation of QueryApiDispatcher.getDataSourceFields
5
+ *
6
+ * @param dataSource - The data source to get the fields for
7
+ * @internal
8
+ */
9
+ export declare const useGetDataSource: (dataSource: string | undefined) => {
10
+ data: import("@sisense/sdk-query-client").DataSourceField[] | undefined;
11
+ isLoading: boolean;
12
+ };
@@ -0,0 +1,2 @@
1
+ export declare function toKebabCase(str: string): string;
2
+ export declare function capitalizeFirstLetter(str: string): string;
@@ -1,11 +1,18 @@
1
- import type { ChatMessage } from './api/types';
2
- interface UseChatSessionResult {
1
+ import type { ChatMessage, NlqMessage, NlqResponseData } from './api/types';
2
+ /**
3
+ * Result of the useChatSession hook.
4
+ *
5
+ * @internal
6
+ */
7
+ export interface UseChatSessionResult {
3
8
  chatId: string | undefined;
4
9
  history: ChatMessage[];
10
+ lastNlqResponse: NlqResponseData | null;
5
11
  sendMessage: (message: string) => void;
6
12
  isAwaitingResponse: boolean;
7
13
  isLoading: boolean;
8
14
  }
15
+ export declare const isNlqMessage: (message: ChatMessage | null | undefined) => message is NlqMessage;
9
16
  /**
10
17
  * React hook that returns a chat session object for the given data model or
11
18
  * perspective.
@@ -19,4 +26,3 @@ interface UseChatSessionResult {
19
26
  * @internal
20
27
  */
21
28
  export declare const useChatSession: (contextTitle: string) => UseChatSessionResult;
22
- export {};
@@ -1,9 +1,18 @@
1
- import type { GetNlgQueryResultRequest } from './api/types.js';
1
+ import { Attribute, DataSource, Filter, FilterRelations, Measure } from '@sisense/sdk-data';
2
+ import { GetNlgQueryResultRequest } from './api/types';
3
+ import { GetNlgQueryResultProps } from './get-nlg-query-result';
2
4
  /**
3
5
  * Parameters for {@link useGetNlgQueryResult} hook.
4
- *
5
6
  */
6
- export interface UseGetNlgQueryResultParams extends GetNlgQueryResultRequest {
7
+ export interface UseGetNlgQueryResultParams {
8
+ /** The data source that the query targets - e.g. `Sample ECommerce` */
9
+ dataSource: DataSource;
10
+ /** Dimensions of the query */
11
+ dimensions?: Attribute[];
12
+ /** Measures of the query */
13
+ measures?: Measure[];
14
+ /** Filters of the query */
15
+ filters?: Filter[] | FilterRelations;
7
16
  /**
8
17
  * Boolean flag to enable/disable API call by default
9
18
  *
@@ -11,18 +20,30 @@ export interface UseGetNlgQueryResultParams extends GetNlgQueryResultRequest {
11
20
  */
12
21
  enabled?: boolean;
13
22
  }
14
- export declare const useGetNlgQueryResultInternal: (params: UseGetNlgQueryResultParams) => {
15
- data: string | undefined;
16
- isError: boolean;
23
+ /**
24
+ * State for {@link useGetNlgQueryResult} hook.
25
+ */
26
+ export interface UseGetNlgQueryResultState {
27
+ /** Whether the data fetching is loading */
17
28
  isLoading: boolean;
29
+ /** Whether the data fetching has failed */
30
+ isError: boolean;
31
+ /** Whether the data fetching has succeeded */
18
32
  isSuccess: boolean;
19
- fetchStatus: import("@tanstack/react-query").FetchStatus;
33
+ /** The result data */
34
+ data: string | undefined;
35
+ /** The error if any occurred */
36
+ error: unknown;
37
+ /** Callback to trigger a refetch of the data */
20
38
  refetch: () => void;
21
- };
39
+ }
22
40
  /**
23
- * React hook that fetches an analysis of the provided JAQL using natural language generation (NLG).
24
- *
25
- * Note that in the example below, this hook expects `metadata` to be in standard JAQL syntax.
41
+ * @internal
42
+ */
43
+ export declare const useGetNlgQueryResultInternal: (params: GetNlgQueryResultProps | GetNlgQueryResultRequest, enabled?: boolean) => UseGetNlgQueryResultState;
44
+ /**
45
+ * React hook that fetches an analysis of the provided query using natural language generation (NLG).
46
+ * Specifying a query is similar to providing parameters to a {@link useExecuteQuery} hook, using dimensions, measures, and filters.
26
47
  *
27
48
  * ::: warning Note
28
49
  * This hook is currently under private beta for selected customers and is subject to change as we make fixes and improvements.
@@ -30,66 +51,21 @@ export declare const useGetNlgQueryResultInternal: (params: UseGetNlgQueryResult
30
51
  *
31
52
  * @example
32
53
  * ```tsx
33
- * import { SisenseContextProvider } from '@sisense/sdk-ui';
34
- * import { AiContextProvider, useGetNlgQueryResult } from '@sisense/sdk-ui/ai';
54
+ * const { data, isLoading } = useGetNlgQueryResult({
55
+ * dataSource: 'Sample ECommerce',
56
+ * dimensions: [DM.Commerce.Date.Years],
57
+ * measures: [measureFactory.sum(DM.Commerce.Revenue)],
58
+ * });
35
59
  *
36
- * function Page() {
37
- * const { data } = useGetNlgQueryResult({
38
- * jaql: {
39
- * datasource: { title: 'Sample ECommerce' },
40
- * metadata: [
41
- * {
42
- * jaql: {
43
- * column: 'Date',
44
- * datatype: 'datetime',
45
- * dim: '[Commerce.Date]',
46
- * firstday: 'mon',
47
- * level: 'years',
48
- * table: 'Commerce',
49
- * title: 'Date',
50
- * },
51
- * },
52
- * {
53
- * jaql: {
54
- * agg: 'sum',
55
- * column: 'Revenue',
56
- * datatype: 'numeric',
57
- * dim: '[Commerce.Revenue]',
58
- * table: 'Commerce',
59
- * title: 'total of Revenue',
60
- * },
61
- * },
62
- * ],
63
- * },
64
- * style: 'Large',
65
- * });
66
- * return (
67
- * <>
68
- * <h1>Summary</h1>
69
- * <p>{data}</p>
70
- * </>
71
- * );
60
+ * if (isLoading) {
61
+ * return <div>Loading...</div>;
72
62
  * }
73
63
  *
74
- * function App() {
75
- * return (
76
- * <SisenseContextProvider {...sisenseContextProps}>
77
- * <AiContextProvider>
78
- * <Page />
79
- * </AiContextProvider>
80
- * </SisenseContextProvider>
81
- * );
82
- * }
64
+ * return <p>{data}</p>;
83
65
  * ```
84
66
  * @param params - {@link UseGetNlgQueryResultParams}
85
67
  * @returns Response object containing a text summary
68
+ * @group Generative AI
86
69
  * @beta
87
70
  */
88
- export declare const useGetNlgQueryResult: (params: UseGetNlgQueryResultParams) => {
89
- data: string | undefined;
90
- isError: boolean;
91
- isLoading: boolean;
92
- isSuccess: boolean;
93
- fetchStatus: import("@tanstack/react-query").FetchStatus;
94
- refetch: () => void;
95
- };
71
+ export declare const useGetNlgQueryResult: (params: UseGetNlgQueryResultParams) => UseGetNlgQueryResultState;
@@ -1,3 +1,4 @@
1
+ import { QueryRecommendation } from './api/types';
1
2
  /**
2
3
  * Parameters for {@link useGetQueryRecommendations} hook.
3
4
  */
@@ -11,10 +12,24 @@ export interface UseGetQueryRecommendationsParams {
11
12
  */
12
13
  count?: number;
13
14
  }
14
- export declare const useGetQueryRecommendationsInternal: (params: UseGetQueryRecommendationsParams) => {
15
- data: import(".").QueryRecommendationResponse;
15
+ /**
16
+ * State for {@link useGetQueryRecommendations} hook.
17
+ */
18
+ export interface UseGetQueryRecommendationsState {
19
+ /** Whether the data fetching is loading */
16
20
  isLoading: boolean;
17
- };
21
+ /** Whether the data fetching has failed */
22
+ isError: boolean;
23
+ /** Whether the data fetching has succeeded */
24
+ isSuccess: boolean;
25
+ /** The result data */
26
+ data: QueryRecommendation[];
27
+ /** The error if any occurred */
28
+ error: unknown;
29
+ /** Callback to trigger a refetch of the data */
30
+ refetch: () => void;
31
+ }
32
+ export declare const useGetQueryRecommendationsInternal: (params: UseGetQueryRecommendationsParams) => UseGetQueryRecommendationsState;
18
33
  /**
19
34
  * React hook that fetches recommended questions for a data model or perspective.
20
35
  *
@@ -26,42 +41,25 @@ export declare const useGetQueryRecommendationsInternal: (params: UseGetQueryRec
26
41
  *
27
42
  * @example
28
43
  * ```tsx
29
- * import { SisenseContextProvider } from '@sisense/sdk-ui';
30
- * import { AiContextProvider, useGetQueryRecommendations } from '@sisense/sdk-ui/ai';
31
- *
32
- * function Page() {
33
- * const { data } = useGetQueryRecommendations({
34
- * contextTitle: 'Sample ECommerce',
35
- * });
44
+ * const { data, isLoading } = useGetQueryRecommendations({
45
+ * contextTitle: 'Sample ECommerce',
46
+ * });
36
47
  *
37
- * if (!data) {
38
- * return <div>Loading recommendations</div>;
39
- * }
40
- *
41
- * return (
42
- * <ul>
43
- * {data.map((item, index) => (
44
- * <li key={index}>{item.nlqPrompt}</li>
45
- * ))}
46
- * </ul>
47
- * );
48
+ * if (isLoading) {
49
+ * return <div>Loading recommendations</div>;
48
50
  * }
49
51
  *
50
- * function App() {
51
- * return (
52
- * <SisenseContextProvider {...sisenseContextProps}>
53
- * <AiContextProvider>
54
- * <Page />
55
- * </AiContextProvider>
56
- * </SisenseContextProvider>
57
- * );
58
- * }
52
+ * return (
53
+ * <ul>
54
+ * {data.map((item, index) => (
55
+ * <li key={index}>{item.nlqPrompt}</li>
56
+ * ))}
57
+ * </ul>
58
+ * );
59
59
  * ```
60
60
  * @param params - {@link UseGetQueryRecommendationsParams}
61
61
  * @returns An array of objects, each containing recommended question text and its corresponding JAQL
62
+ * @group Generative AI
62
63
  * @beta
63
64
  */
64
- export declare const useGetQueryRecommendations: (params: UseGetQueryRecommendationsParams) => {
65
- data: import(".").QueryRecommendationResponse;
66
- isLoading: boolean;
67
- };
65
+ export declare const useGetQueryRecommendations: (params: UseGetQueryRecommendationsParams) => UseGetQueryRecommendationsState;