@sisense/sdk-ui 1.5.0 → 1.7.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.
- package/dist/ai/ai-context-provider.d.ts +1 -0
- package/dist/ai/api/chat-api-provider.d.ts +1 -1
- package/dist/ai/api/chat-history.d.ts +18 -0
- package/dist/ai/api/chat-rest-api.d.ts +3 -0
- package/dist/ai/api/errors.d.ts +4 -1
- package/dist/ai/api/hooks.d.ts +2 -13
- package/dist/ai/api/types.d.ts +21 -19
- package/dist/ai/chat-config.d.ts +10 -3
- package/dist/ai/chat-intro-blurb.d.ts +4 -0
- package/dist/ai/chat-style-provider.d.ts +15 -0
- package/dist/ai/chatbot.d.ts +8 -0
- package/dist/ai/{error-page.d.ts → common/error-container.d.ts} +1 -1
- package/dist/ai/get-nlg-query-result.d.ts +3 -3
- package/dist/ai/index.d.ts +2 -0
- package/dist/ai/messages/feedback-wrapper.d.ts +2 -1
- package/dist/ai/messages/insights-message.d.ts +6 -1
- package/dist/ai/messages/message-list-resolver.d.ts +1 -2
- package/dist/ai/messages/message-resolver.d.ts +1 -3
- package/dist/ai/messages/nlq-message-group.d.ts +10 -0
- package/dist/ai/suggestions/index.d.ts +1 -1
- package/dist/ai/suggestions/suggestion-item.d.ts +1 -2
- package/dist/ai/suggestions/suggestion-list.d.ts +1 -1
- package/dist/ai/suggestions/suggestions-with-intro.d.ts +2 -2
- package/dist/ai/translators/code-templates.d.ts +11 -0
- package/dist/ai/translators/generate-code.d.ts +9 -0
- package/dist/ai/translators/index.d.ts +4 -0
- package/dist/ai/translators/model-translator.d.ts +50 -0
- package/dist/ai/translators/query-translator.d.ts +122 -0
- package/dist/ai/translators/translate-props-to-code.d.ts +8 -0
- package/dist/ai/translators/types.d.ts +105 -0
- package/dist/ai/translators/use-get-data-source.d.ts +12 -0
- package/dist/ai/translators/utils.d.ts +2 -0
- package/dist/ai/use-chat-session.d.ts +10 -3
- package/dist/ai/use-get-nlg-query-result.d.ts +6 -6
- package/dist/ai/use-get-query-recommendations.d.ts +1 -0
- package/dist/ai.js +7037 -3332
- package/dist/alert-box/alert-box.d.ts +1 -1
- package/dist/app/client-application.d.ts +27 -0
- package/dist/app/settings/settings.d.ts +1 -1
- package/dist/area-chart.d.ts +1 -0
- package/dist/areamap-chart.d.ts +1 -0
- package/dist/bar-chart.d.ts +3 -0
- package/dist/boxplot-chart.d.ts +1 -0
- package/dist/boxplot-utils.d.ts +3 -1
- package/dist/chart/chart.d.ts +1 -0
- package/dist/chart-options-processor/translations/base-design-options.d.ts +1 -0
- package/dist/chart-options-processor/translations/tooltip-utils.d.ts +1 -0
- package/dist/charts/indicator/indicator-legacy-chart-options/legacy-chart-options-to-theme-settings-dictionary.d.ts +2 -0
- package/dist/charts/indicator/indicator-legacy-chart-options/override-with-value-color.d.ts +1 -2
- package/dist/column-chart.d.ts +4 -0
- package/dist/common/components/loading-indicator.d.ts +2 -0
- package/dist/common/hooks/use-fetch.d.ts +42 -0
- package/dist/const.d.ts +1 -0
- package/dist/dashboard-widget/dashboard-widget.d.ts +2 -0
- package/dist/dashboard-widget/translate-widget-data-options.d.ts +5 -0
- package/dist/dashboard-widget/translate-widget-filters.d.ts +1 -0
- package/dist/dashboard-widget/types.d.ts +3 -2
- package/dist/dynamic-size-container/dynamic-size-container.d.ts +4 -3
- package/dist/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +1 -0
- package/dist/filters/components/date-filter/date-range-filter-tile/date-range-filter-tile.d.ts +1 -0
- package/dist/filters/components/date-filter/relative-date-filter-tile/relative-date-filter-tile.d.ts +1 -0
- package/dist/filters/components/member-filter-tile/member-filter-tile.d.ts +1 -0
- package/dist/formulas/use-get-shared-formula.d.ts +2 -0
- package/dist/funnel-chart.d.ts +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6680 -37439
- package/dist/indicator-chart.d.ts +1 -0
- package/dist/line-chart.d.ts +1 -0
- package/dist/models/dashboard/get-dashboard-models.d.ts +1 -3
- package/dist/models/dashboard/translate-dashboard.d.ts +1 -1
- package/dist/models/dashboard/types.d.ts +17 -0
- package/dist/models/dashboard/use-get-dashboard-model.d.ts +2 -0
- package/dist/models/dashboard/use-get-dashboard-models.d.ts +2 -0
- package/dist/models/widget/use-get-widget-model.d.ts +2 -0
- package/dist/models/widget/widget-model.d.ts +11 -1
- package/dist/pie-chart.d.ts +1 -0
- package/dist/pivot-table/formatters/data-cell-formatters/data-cell-value-formatter.d.ts +3 -0
- package/dist/pivot-table/formatters/data-cell-formatters/index.d.ts +1 -0
- package/dist/pivot-table/formatters/header-cell-formatters/header-cell-value-formatter.d.ts +3 -0
- package/dist/pivot-table/formatters/header-cell-formatters/index.d.ts +1 -0
- package/dist/pivot-table/formatters/index.d.ts +2 -0
- package/dist/pivot-table/formatters/types.d.ts +4 -0
- package/dist/pivot-table/formatters/utils.d.ts +5 -0
- package/dist/pivot-table/pivot-table.d.ts +1 -0
- package/dist/pivot-table/sorting-utils.d.ts +56 -0
- package/dist/pivot-table/use-apply-pivot-table-formatting.d.ts +11 -0
- package/dist/pivot-table/use-get-pivot-table-query.d.ts +1 -1
- package/dist/polar-chart.d.ts +1 -0
- package/dist/props.d.ts +5 -4
- package/dist/query/execute-query.d.ts +5 -5
- package/dist/query-execution/execute-query-by-widget-id.d.ts +2 -0
- package/dist/query-execution/execute-query.d.ts +1 -0
- package/dist/query-execution/index.d.ts +2 -1
- package/dist/query-execution/query-params-comparator.d.ts +8 -0
- package/dist/query-execution/types.d.ts +7 -0
- package/dist/query-execution/use-execute-csv-query.d.ts +1 -0
- package/dist/query-execution/use-execute-pivot-query.d.ts +1 -0
- package/dist/query-execution/use-execute-query-by-widget-id.d.ts +2 -0
- package/dist/query-execution/use-execute-query.d.ts +4 -10
- package/dist/query-execution/use-query-cache.d.ts +10 -0
- package/dist/scatter-chart.d.ts +1 -0
- package/dist/scattermap-chart.d.ts +1 -0
- package/dist/sisense-context/sisense-context-provider.d.ts +1 -0
- package/dist/sisense-context/sisense-query-client-provider.d.ts +2 -0
- package/dist/sunburst-chart.d.ts +1 -0
- package/dist/table/table.d.ts +1 -0
- package/dist/theme-provider/theme-provider.d.ts +7 -0
- package/dist/treemap-chart.d.ts +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/useQuery-aa258c0d.js +121301 -0
- package/dist/utils/create-cache.d.ts +33 -0
- package/dist/widgets/chart-widget.d.ts +1 -0
- package/dist/widgets/common/context-menu.d.ts +5 -0
- package/dist/widgets/common/drilldown-breadcrumbs/drilldown-breadcrumbs.d.ts +5 -0
- package/dist/widgets/drilldown-widget.d.ts +1 -0
- package/package.json +14 -9
- package/dist/chart-data-processor/utils.d.ts +0 -10
- package/dist/utils/not-available-value.d.ts +0 -3
- package/dist/with-tracking-0799ec25.js +0 -78081
|
@@ -8,7 +8,7 @@ import { ChatRestApi } from './chat-rest-api';
|
|
|
8
8
|
export declare const ChatApiContext: import("react").Context<ChatRestApi | undefined>;
|
|
9
9
|
export declare const useChatApi: () => ChatRestApi | undefined;
|
|
10
10
|
/**
|
|
11
|
-
* React component
|
|
11
|
+
* React component that initializes the necessary wrappers to enable API calls and caching.
|
|
12
12
|
*
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ChatMessage } from './types';
|
|
2
|
+
export declare const CHAT_HISTORY_QUERY_KEY = "chatHistory";
|
|
3
|
+
/**
|
|
4
|
+
* Hook that calls the clear history API and updates the cache.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const useClearChatHistory: (chatId: string | undefined) => import("@tanstack/react-query").UseMutationResult<void, unknown, void, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Hook that calls the get chat API and handles errors by clearing the history.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const useChatHistory: (chatId: string | undefined) => {
|
|
15
|
+
history: ChatMessage[] | undefined;
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
isError: boolean;
|
|
18
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
2
2
|
import type { Chat, ChatRequest, ChatResponse, ChatWithoutHistory, DataModel, GetNlgQueryResultRequest, GetNlgQueryResultResponse, LlmConfig, Perspective, QueryRecommendationConfig, QueryRecommendationResponse, SendFeedbackRequest } from './types';
|
|
3
|
+
import { DataSourceField } from '@sisense/sdk-query-client';
|
|
3
4
|
export declare class ChatRestApi {
|
|
4
5
|
private httpClient;
|
|
5
6
|
constructor(httpClient: HttpClient);
|
|
@@ -14,11 +15,13 @@ export declare class ChatRestApi {
|
|
|
14
15
|
private postChat;
|
|
15
16
|
private deleteChatHistory;
|
|
16
17
|
private sendFeedback;
|
|
18
|
+
private getDataSourceFields;
|
|
17
19
|
ai: {
|
|
18
20
|
getNlgQueryResult: (request: GetNlgQueryResultRequest) => Promise<GetNlgQueryResultResponse>;
|
|
19
21
|
getQueryRecommendations: (contextTitle: string, config: QueryRecommendationConfig) => Promise<QueryRecommendationResponse>;
|
|
20
22
|
setLlmConfig: (config: LlmConfig) => Promise<unknown>;
|
|
21
23
|
sendFeedback: (request: SendFeedbackRequest) => Promise<unknown>;
|
|
24
|
+
getDataSourceFields: (dataSource: string) => Promise<DataSourceField[]>;
|
|
22
25
|
chat: {
|
|
23
26
|
getAll: () => Promise<ChatWithoutHistory[]>;
|
|
24
27
|
getById: (chatId: string) => Promise<Chat>;
|
package/dist/ai/api/errors.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const UNEXPECTED_ERROR = "Oh snap, something went wrong. Please try again later.";
|
|
2
|
+
export declare const UNEXPECTED_CHAT_RESPONSE_ERROR = "Oh snap, something went wrong. Please try again later or try asking a different question.";
|
|
3
|
+
export declare const FETCH_HISTORY_ERROR = "Something went wrong and we were unable to retrieve the chat thread. Let's start over!";
|
|
4
|
+
export declare const CHAT_UNAVAILABLE_ERROR = "Chat unavailable. Please try again later.";
|
package/dist/ai/api/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatContext,
|
|
1
|
+
import type { ChatContext, ChatResponse } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
@@ -17,18 +17,7 @@ export declare const useGetAllChats: () => {
|
|
|
17
17
|
/**
|
|
18
18
|
* @internal
|
|
19
19
|
*/
|
|
20
|
-
export declare const useMaybeCreateChat: (contextId: string | undefined, shouldCreate: boolean) => void
|
|
21
|
-
/**
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export declare const useGetChatHistory: (id: string | undefined) => {
|
|
25
|
-
data: ChatMessage[] | undefined;
|
|
26
|
-
isLoading: boolean;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
export declare const useClearChatHistory: (chatId: string | undefined) => import("@tanstack/react-query").UseMutationResult<void, unknown, void, unknown>;
|
|
20
|
+
export declare const useMaybeCreateChat: (contextId: string | undefined, shouldCreate: boolean) => import("@tanstack/react-query").UseMutationResult<import("./types").Chat | undefined, unknown, void, unknown>;
|
|
32
21
|
export declare const useSendChatMessage: (chatId: string | undefined) => {
|
|
33
22
|
mutate: import("@tanstack/react-query").UseMutateFunction<ChatResponse | undefined, unknown, string, void>;
|
|
34
23
|
isLoading: boolean;
|
package/dist/ai/api/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MetadataItem } from '@sisense/sdk-query-client';
|
|
1
|
+
import { JaqlQueryPayload, MetadataItem } from '@sisense/sdk-query-client';
|
|
2
2
|
import { ChartDataOptions } from '../../types';
|
|
3
3
|
export interface ChatContext {
|
|
4
4
|
id: string;
|
|
@@ -7,11 +7,6 @@ export interface ChatContext {
|
|
|
7
7
|
description: string;
|
|
8
8
|
}
|
|
9
9
|
export type ChatContextType = 'datamodel' | 'perspective';
|
|
10
|
-
interface TextMessage {
|
|
11
|
-
role: 'assistant';
|
|
12
|
-
content: string;
|
|
13
|
-
type: 'Text';
|
|
14
|
-
}
|
|
15
10
|
export interface NlqMessage {
|
|
16
11
|
role: 'assistant';
|
|
17
12
|
content: string;
|
|
@@ -21,8 +16,7 @@ interface RegularMessage {
|
|
|
21
16
|
role: 'user' | 'assistant';
|
|
22
17
|
content: string;
|
|
23
18
|
}
|
|
24
|
-
type
|
|
25
|
-
export type ChatMessage = RegularMessage | SystemMessage;
|
|
19
|
+
export type ChatMessage = RegularMessage | NlqMessage;
|
|
26
20
|
export interface Chat {
|
|
27
21
|
chatId: string;
|
|
28
22
|
contextId: string;
|
|
@@ -54,14 +48,22 @@ interface TextResponse {
|
|
|
54
48
|
answer: string;
|
|
55
49
|
};
|
|
56
50
|
chatId: string;
|
|
57
|
-
responseType: '
|
|
51
|
+
responseType: 'text';
|
|
52
|
+
}
|
|
53
|
+
interface ErrorResponse {
|
|
54
|
+
data: {
|
|
55
|
+
message: string;
|
|
56
|
+
code: string;
|
|
57
|
+
answer: string;
|
|
58
|
+
};
|
|
59
|
+
responseType: 'error';
|
|
58
60
|
}
|
|
59
61
|
export type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
60
62
|
export type AllPossibleChartOptionKeys = KeysOfUnion<ChartDataOptions>;
|
|
61
63
|
export type AxesMappingKey = Exclude<AllPossibleChartOptionKeys, 'seriesToColorMap'>;
|
|
62
64
|
export type AxesMapping = Partial<Record<AxesMappingKey, Array<{
|
|
63
65
|
name: string;
|
|
64
|
-
type
|
|
66
|
+
type?: string;
|
|
65
67
|
}>>>;
|
|
66
68
|
export interface ChartRecommendations {
|
|
67
69
|
chartFamily: string;
|
|
@@ -86,7 +88,7 @@ export interface NlqResponse {
|
|
|
86
88
|
timestamp: string;
|
|
87
89
|
responseType: 'nlq';
|
|
88
90
|
}
|
|
89
|
-
export type ChatResponse = NlqResponse | TextResponse;
|
|
91
|
+
export type ChatResponse = NlqResponse | TextResponse | ErrorResponse;
|
|
90
92
|
export interface QueryRecommendationConfig {
|
|
91
93
|
numOfRecommendations: number;
|
|
92
94
|
}
|
|
@@ -103,14 +105,7 @@ export interface Perspective {
|
|
|
103
105
|
isDefault: boolean;
|
|
104
106
|
}
|
|
105
107
|
export interface GetNlgQueryResultRequest {
|
|
106
|
-
jaql:
|
|
107
|
-
/** The data source that the JAQL metadata targets - e.g. `Sample ECommerce` */
|
|
108
|
-
datasource: {
|
|
109
|
-
title: string;
|
|
110
|
-
};
|
|
111
|
-
/** The metadata that composes the JAQL to be analyzed */
|
|
112
|
-
metadata: object[];
|
|
113
|
-
};
|
|
108
|
+
jaql: Pick<JaqlQueryPayload, 'datasource' | 'metadata' | 'filterRelations'>;
|
|
114
109
|
}
|
|
115
110
|
export interface GetNlgQueryResultResponse {
|
|
116
111
|
data?: {
|
|
@@ -124,4 +119,11 @@ export interface SendFeedbackRequest {
|
|
|
124
119
|
sourceId: string;
|
|
125
120
|
rating: -1 | 1;
|
|
126
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* The chat mode to use for a chat session
|
|
124
|
+
*
|
|
125
|
+
* analyze: Enable business users to uncover data insights
|
|
126
|
+
* develop: Enable developers to build queries and charts for embedded analytics
|
|
127
|
+
*/
|
|
128
|
+
export type ChatMode = 'analyze' | 'develop';
|
|
127
129
|
export {};
|
package/dist/ai/chat-config.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { ChatMode } from '../ai/api/types';
|
|
2
3
|
export interface ChatConfig {
|
|
3
4
|
/**
|
|
4
|
-
* Boolean flag to show or hide suggested questions following a chat response
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Boolean flag to show or hide suggested questions following a chat response. Currently
|
|
6
|
+
* follow-up questions are still under development and are not validated. Therefore, follow-up
|
|
7
|
+
* questions are disabled by default.
|
|
7
8
|
*/
|
|
8
9
|
enableFollowupQuestions: boolean;
|
|
9
10
|
/**
|
|
@@ -18,6 +19,12 @@ export interface ChatConfig {
|
|
|
18
19
|
* If specified, the data topic selector screen will not be shown.
|
|
19
20
|
*/
|
|
20
21
|
defaultContextTitle?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The chat mode to use for a chat session.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
chatMode?: ChatMode;
|
|
21
28
|
}
|
|
22
29
|
export declare const DEFAULTS: Readonly<ChatConfig>;
|
|
23
30
|
export type ChatConfigProviderProps = {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ChatStyle {
|
|
3
|
+
backgroundColor?: string;
|
|
4
|
+
primaryTextColor?: string;
|
|
5
|
+
secondaryTextColor?: string;
|
|
6
|
+
messageBackgroundColor?: string;
|
|
7
|
+
inputBackgroundColor?: string;
|
|
8
|
+
border?: false | string;
|
|
9
|
+
}
|
|
10
|
+
export type ChatStyleProviderProps = {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
value: ChatStyle;
|
|
13
|
+
};
|
|
14
|
+
export declare const useChatStyle: () => ChatStyle;
|
|
15
|
+
export declare const ChatStyleProvider: ({ children, value }: ChatStyleProviderProps) => JSX.Element;
|
package/dist/ai/chatbot.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { ChatConfig } from './chat-config';
|
|
3
|
+
import { ChatStyle } from './chat-style-provider';
|
|
3
4
|
/**
|
|
4
5
|
* Props for {@link Chatbot} component.
|
|
5
6
|
*/
|
|
@@ -16,6 +17,12 @@ export type ChatbotProps = {
|
|
|
16
17
|
* If not specified, a default height of `900px` will be used.
|
|
17
18
|
*/
|
|
18
19
|
height?: CSSProperties['height'];
|
|
20
|
+
/**
|
|
21
|
+
* Style settings for the chatbot
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
style?: ChatStyle;
|
|
19
26
|
/**
|
|
20
27
|
* Various configuration options for the chatbot
|
|
21
28
|
*/
|
|
@@ -44,6 +51,7 @@ export type ChatbotProps = {
|
|
|
44
51
|
* }
|
|
45
52
|
* ```
|
|
46
53
|
* @param props - {@link ChatbotProps}
|
|
54
|
+
* @group Generative AI
|
|
47
55
|
* @beta
|
|
48
56
|
*/
|
|
49
57
|
export declare const Chatbot: import("react").FunctionComponent<ChatbotProps>;
|
|
@@ -6,9 +6,8 @@ import { UseGetNlgQueryResultParams } from './use-get-nlg-query-result';
|
|
|
6
6
|
export interface GetNlgQueryResultProps extends Omit<UseGetNlgQueryResultParams, 'enabled'> {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* React component that fetches and displays a collapsible analysis of the provided
|
|
10
|
-
*
|
|
11
|
-
* This takes the same props as {@link useGetNlgQueryResult} and makes the same API call but presents the result in a collapsible container.
|
|
9
|
+
* React component that fetches and displays a collapsible analysis of the provided query using natural language generation (NLG).
|
|
10
|
+
* Specifying a query is similar to providing parameters to a {@link useExecuteQuery} hook, using dimensions, measures, and filters.
|
|
12
11
|
*
|
|
13
12
|
* ::: warning Note
|
|
14
13
|
* This component is currently under private beta for selected customers and is subject to change as we make fixes and improvements.
|
|
@@ -24,6 +23,7 @@ export interface GetNlgQueryResultProps extends Omit<UseGetNlgQueryResultParams,
|
|
|
24
23
|
* ```
|
|
25
24
|
* @param props - {@link GetNlgQueryResultProps}
|
|
26
25
|
* @returns Collapsible container wrapping a text summary
|
|
26
|
+
* @group Generative AI
|
|
27
27
|
* @beta
|
|
28
28
|
*/
|
|
29
29
|
declare const _default: import("react").FunctionComponent<GetNlgQueryResultProps>;
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export { default as AiContextProvider, type AiContextProviderProps } from './ai-
|
|
|
2
2
|
export { type ChatConfig } from './chat-config';
|
|
3
3
|
export { useGetNlgQueryResult, type UseGetNlgQueryResultParams, type UseGetNlgQueryResultState, } from './use-get-nlg-query-result';
|
|
4
4
|
export { useGetQueryRecommendations, type UseGetQueryRecommendationsParams, type UseGetQueryRecommendationsState, } from './use-get-query-recommendations';
|
|
5
|
+
export { useChatSession, type UseChatSessionResult } from './use-chat-session';
|
|
5
6
|
export type { GetNlgQueryResultRequest, QueryRecommendationResponse, QueryRecommendation, NlqResponseData, ChartRecommendations, AxesMapping, AxesMappingKey, AllPossibleChartOptionKeys, KeysOfUnion, } from './api/types';
|
|
6
7
|
export { Chatbot, type ChatbotProps } from './chatbot';
|
|
7
8
|
export { default as GetNlgQueryResult, type GetNlgQueryResultProps } from './get-nlg-query-result';
|
|
9
|
+
export * from './translators';
|
|
@@ -3,7 +3,8 @@ type FeedbackWrapperProps = {
|
|
|
3
3
|
sourceId: string;
|
|
4
4
|
data: object;
|
|
5
5
|
type: string;
|
|
6
|
+
rightFooter?: ReactNode;
|
|
6
7
|
children: ReactNode;
|
|
7
8
|
};
|
|
8
|
-
export default function FeedbackWrapper({ sourceId, data, type, children }: FeedbackWrapperProps): JSX.Element;
|
|
9
|
+
export default function FeedbackWrapper({ sourceId, data, type, rightFooter, children, }: FeedbackWrapperProps): JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
export declare function InsightsButton({ onClick, disabled, }: {
|
|
3
|
+
onClick?: () => void;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}): JSX.Element;
|
|
2
6
|
type InsightsMessageProps = {
|
|
3
7
|
dataSource: string;
|
|
4
8
|
metadata: object[];
|
|
9
|
+
visible?: boolean;
|
|
5
10
|
};
|
|
6
|
-
export default function InsightsMessage({ dataSource, metadata }: InsightsMessageProps): JSX.Element;
|
|
11
|
+
export default function InsightsMessage({ dataSource, metadata, visible, }: InsightsMessageProps): JSX.Element | null;
|
|
7
12
|
export {};
|
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
import { ChatMessage } from '../api/types';
|
|
3
3
|
export type MessageListResolverProps = {
|
|
4
4
|
messages: ChatMessage[];
|
|
5
|
-
sendMessage?: (message: string) => void;
|
|
6
5
|
};
|
|
7
|
-
export default function MessageListResolver({ messages
|
|
6
|
+
export default function MessageListResolver({ messages }: MessageListResolverProps): JSX.Element;
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
import { ChatMessage } from '../api/types';
|
|
3
3
|
type MessageResolverProps = {
|
|
4
4
|
message: ChatMessage;
|
|
5
|
-
sendMessage?: (message: string) => void;
|
|
6
|
-
allowFollowupQuestions?: boolean;
|
|
7
5
|
};
|
|
8
|
-
declare function MessageResolver({ message
|
|
6
|
+
declare function MessageResolver({ message }: MessageResolverProps): JSX.Element;
|
|
9
7
|
declare const _default: import("react").MemoExoticComponent<typeof MessageResolver>;
|
|
10
8
|
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NlqResponseData } from '../api/types';
|
|
3
|
+
/**
|
|
4
|
+
* Renders a NLQ response as a series of chat messages/buttons.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export default function NlqMessageGroup({ data }: {
|
|
9
|
+
data: NlqResponseData;
|
|
10
|
+
}): JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as SuggestionItem } from './suggestion-item';
|
|
2
2
|
export { default as SuggestionList } from './suggestion-list';
|
|
3
|
-
export { default as SuggestionListWithIntro } from './suggestions-with-intro';
|
|
4
3
|
export { default as SuggestionListSkeleton } from './suggestion-list-skeleton';
|
|
4
|
+
export { default as SuggestionsWithIntro } from './suggestions-with-intro';
|
|
@@ -3,5 +3,4 @@ export interface SuggestedItemProps {
|
|
|
3
3
|
question: string;
|
|
4
4
|
onClick: () => void;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
export default SuggestionItem;
|
|
6
|
+
export default function SuggestionItem({ question, onClick }: SuggestedItemProps): JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
type Props = {
|
|
3
3
|
questions: string[];
|
|
4
|
-
|
|
4
|
+
isLoading: boolean;
|
|
5
5
|
onSelection: (question: string) => void;
|
|
6
6
|
};
|
|
7
|
-
export default function SuggestionsWithIntro(
|
|
7
|
+
export default function SuggestionsWithIntro({ questions, isLoading, onSelection }: Props): JSX.Element | null;
|
|
8
8
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CodeTemplates } from '../../ai/translators/types';
|
|
2
|
+
/**
|
|
3
|
+
* Code templates for different UI frameworks.
|
|
4
|
+
*
|
|
5
|
+
* A code template is made up of other code templates and placeholders.
|
|
6
|
+
* This allows a code template to be reused in other code templates.
|
|
7
|
+
* For example, a chart widget template can be reused in a dashboard template.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare const CODE_TEMPLATES: CodeTemplates;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CodeTemplateKey, UiFramework } from '../../ai/translators/types';
|
|
2
|
+
/**
|
|
3
|
+
* Generates code from a template with the given data and UI framework.
|
|
4
|
+
*
|
|
5
|
+
* @param templateKey - the key of the template to use
|
|
6
|
+
* @param data - the data to populate the template with
|
|
7
|
+
* @param uiFramework - the UI framework for the generated code
|
|
8
|
+
*/
|
|
9
|
+
export declare const generateCode: (templateKey: CodeTemplateKey, data: Record<string, string>, uiFramework?: UiFramework) => string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ExpandedQueryModel, ChartWidgetModel, UiFramework } from '../../ai/translators/types';
|
|
2
|
+
/**
|
|
3
|
+
* A class that translates expanded query model to CSDK chart model and code.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class ModelTranslator {
|
|
8
|
+
queryModel: ExpandedQueryModel;
|
|
9
|
+
constructor(queryModel: ExpandedQueryModel);
|
|
10
|
+
/**
|
|
11
|
+
* Gets chart recommendations or default to table.
|
|
12
|
+
*
|
|
13
|
+
* @param chart - chart recommendations
|
|
14
|
+
* @returns chart recommendations or default to table
|
|
15
|
+
*/
|
|
16
|
+
private getChartRecommendationsOrDefault;
|
|
17
|
+
/**
|
|
18
|
+
* Gets filters from metadata.
|
|
19
|
+
*
|
|
20
|
+
* @param metadata - metadata items
|
|
21
|
+
*/
|
|
22
|
+
private getFilters;
|
|
23
|
+
/**
|
|
24
|
+
* Splits metadata into columns and filters.
|
|
25
|
+
*
|
|
26
|
+
* @param metadata - metadata items
|
|
27
|
+
*/
|
|
28
|
+
private splitMetadata;
|
|
29
|
+
/**
|
|
30
|
+
* Converts query model to chart.
|
|
31
|
+
*
|
|
32
|
+
* TODO Refactor Chatbot to use this method to render the chart
|
|
33
|
+
*/
|
|
34
|
+
toChart(): ChartWidgetModel | undefined;
|
|
35
|
+
private stringifyDataSource;
|
|
36
|
+
private stringifyChartType;
|
|
37
|
+
private stringifyFilters;
|
|
38
|
+
private stringifyDataOptions;
|
|
39
|
+
private stringifyExtraImports;
|
|
40
|
+
private getChartWidgetCode;
|
|
41
|
+
private getTableWidgetCode;
|
|
42
|
+
/**
|
|
43
|
+
* Converts chart widget model to CSDK code.
|
|
44
|
+
*
|
|
45
|
+
* @param chartWidgetModel - chart widget model
|
|
46
|
+
* @param uiFramework - UI framework
|
|
47
|
+
* @returns CSDK code string of the UI framework
|
|
48
|
+
*/
|
|
49
|
+
toCode(chartWidgetModel: ChartWidgetModel, uiFramework?: UiFramework): string;
|
|
50
|
+
}
|
|
@@ -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;
|