@sisense/sdk-ui 1.3.0 → 1.4.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 +32 -0
- package/dist/ai/api/chat-api-provider.d.ts +17 -0
- package/dist/ai/api/chat-rest-api.d.ts +3 -1
- package/dist/ai/api/errors.d.ts +1 -0
- package/dist/ai/api/hooks.d.ts +10 -49
- package/dist/ai/api/types.d.ts +16 -27
- package/dist/ai/buttons/thumbs-down-button.d.ts +6 -0
- package/dist/ai/buttons/thumbs-up-button.d.ts +6 -0
- package/dist/ai/chat-box.d.ts +3 -3
- package/dist/ai/chat-config.d.ts +28 -0
- package/dist/ai/chat-home.d.ts +5 -1
- package/dist/ai/chat-router.d.ts +2 -0
- package/dist/ai/chatbot.d.ts +26 -4
- package/dist/ai/common/tooltip.d.ts +5 -0
- package/dist/ai/error-page.d.ts +10 -0
- package/dist/ai/get-nlg-query-result.d.ts +78 -0
- package/dist/ai/icons/thumbs-down-hovered-icon.d.ts +2 -0
- package/dist/ai/icons/thumbs-down-icon.d.ts +2 -0
- package/dist/ai/icons/thumbs-up-hovered-icon.d.ts +2 -0
- package/dist/ai/icons/thumbs-up-icon.d.ts +2 -0
- package/dist/ai/index.d.ts +6 -3
- package/dist/ai/loading-page.d.ts +2 -0
- package/dist/ai/messages/clear-history-success-message.d.ts +2 -0
- package/dist/ai/messages/feedback-wrapper.d.ts +9 -0
- package/dist/ai/messages/get-widget-options.d.ts +2 -1
- package/dist/ai/messages/message-resolver.d.ts +1 -2
- package/dist/ai/messages/text-message.d.ts +1 -1
- package/dist/ai/toolbar.d.ts +2 -2
- package/dist/ai/use-chat-session.d.ts +1 -1
- package/dist/ai/use-get-nlg-query-result.d.ts +103 -0
- package/dist/ai/use-get-query-recommendations.d.ts +67 -0
- package/dist/ai.js +1866 -1518
- package/dist/{chart.d.ts → chart/chart.d.ts} +1 -1
- package/dist/chart/helpers/use-synced-data.d.ts +8 -0
- package/dist/chart/helpers/use-translated-data-options.d.ts +7 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart-data/types.d.ts +1 -0
- package/dist/chart-data-options/translate-data-options.d.ts +5 -1
- package/dist/chart-data-options/types.d.ts +107 -12
- package/dist/chart-options-processor/boxplot-chart-options.d.ts +2 -2
- package/dist/chart-options-processor/category-chart-options.d.ts +1 -1
- package/dist/chart-options-processor/chart-options-service.d.ts +7 -0
- package/dist/chart-options-processor/plot-bands.d.ts +2 -2
- package/dist/chart-options-processor/scatter-chart-options.d.ts +2 -2
- package/dist/chart-options-processor/style-to-design-options-translator/index.d.ts +1 -0
- package/dist/chart-options-processor/style-to-design-options-translator/prepare-design-options.d.ts +4 -0
- package/dist/chart-options-processor/style-to-design-options-translator/translate-style-to-design-options.d.ts +2 -2
- package/dist/chart-options-processor/translations/base-design-options.d.ts +3 -3
- package/dist/chart-options-processor/translations/boxplot/boxplot-plot-options.d.ts +2 -2
- package/dist/chart-options-processor/translations/design-options.d.ts +2 -2
- package/dist/chart-options-processor/translations/number-format-config.d.ts +10 -16
- package/dist/chart-options-processor/translations/translations-to-highcharts.d.ts +4 -4
- package/dist/chart-options-processor/translations/types.d.ts +18 -6
- package/dist/chart-options-processor/translations/value-label-section.d.ts +9 -4
- package/dist/charts/indicator/indicator-legacy-chart-options/prepare-ticker-options.d.ts +2 -0
- package/dist/charts/map-charts/areamap/areamap.d.ts +2 -2
- package/dist/charts/map-charts/scattermap/scattermap.d.ts +9 -3
- package/dist/charts/map-charts/scattermap/utils/location.d.ts +3 -0
- package/dist/charts/table/helpers/calc-column-widths.d.ts +3 -1
- package/dist/common/hooks/data-load-state-reducer.d.ts +10 -0
- package/dist/common/hooks/use-hover.d.ts +8 -0
- package/dist/common/icons/yellow-exclamation-mark-icon.d.ts +2 -0
- package/dist/dashboard-widget/translate-widget-data-options.d.ts +1 -1
- package/dist/decorators/hook-decorators/with-tracking.d.ts +11 -0
- package/dist/formulas/fetch-formula.d.ts +2 -0
- package/dist/formulas/index.d.ts +1 -0
- package/dist/formulas/use-get-shared-formula.d.ts +5 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +34073 -10282
- package/dist/indicator-canvas.d.ts +2 -2
- package/dist/models/dashboard/use-get-dashboard-model.d.ts +8 -0
- package/dist/models/dashboard/use-get-dashboard-models.d.ts +6 -0
- package/dist/pivot-table/index.d.ts +1 -0
- package/dist/pivot-table/pivot-table.d.ts +42 -0
- package/dist/pivot-table/use-get-pivot-table-query.d.ts +14 -0
- package/dist/props.d.ts +62 -4
- package/dist/sisense-chart/sisense-chart.d.ts +2 -2
- package/dist/types.d.ts +74 -9
- package/dist/utils/utility-types.d.ts +12 -0
- package/dist/widgets/common/drilldown-breadcrumbs/styled-buttons.d.ts +2 -2
- package/dist/widgets/common/drilldown.d.ts +1 -1
- package/dist/{table-widget-b467cc86.js → with-tracking-b583e949.js} +38407 -38268
- package/package.json +13 -13
- package/dist/ai/api/chat-api-context.d.ts +0 -12
- package/dist/ai/chatbot-context.d.ts +0 -11
- package/dist/ai/nlg-query-result.d.ts +0 -20
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ChatConfig } from './chat-config';
|
|
3
|
+
export type AiContextProviderProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** @internal */
|
|
6
|
+
config?: Partial<ChatConfig>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* React component that wraps all generative AI components and hooks.
|
|
10
|
+
*
|
|
11
|
+
* ::: warning Note
|
|
12
|
+
* This component is currently under private beta for selected customers and is subject to change as we make fixes and improvements.
|
|
13
|
+
* :::
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { SisenseContextProvider } from '@sisense/sdk-ui';
|
|
18
|
+
* import { AiContextProvider, Chatbot } from '@sisense/sdk-ui/ai';
|
|
19
|
+
*
|
|
20
|
+
* function App() {
|
|
21
|
+
* return (
|
|
22
|
+
* <SisenseContextProvider {...sisenseContextProps}>
|
|
23
|
+
* <AiContextProvider>
|
|
24
|
+
* <Chatbot />
|
|
25
|
+
* </AiContextProvider>
|
|
26
|
+
* </SisenseContextProvider>
|
|
27
|
+
* );
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
* @beta
|
|
31
|
+
*/
|
|
32
|
+
export default function AiContextProvider({ children, config }: AiContextProviderProps): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ChatRestApi } from './chat-rest-api';
|
|
3
|
+
/**
|
|
4
|
+
* Exported for testing purposes only.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const ChatApiContext: import("react").Context<ChatRestApi | undefined>;
|
|
9
|
+
export declare const useChatApi: () => ChatRestApi | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* React component
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const ChatApiProvider: ({ children }: {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from '@sisense/sdk-rest-client';
|
|
2
|
-
import type { Chat, ChatRequest, ChatResponse, ChatWithoutHistory, DataModel, GetNlgQueryResultRequest, GetNlgQueryResultResponse, LlmConfig, Perspective, QueryRecommendationConfig, QueryRecommendationResponse } from './types';
|
|
2
|
+
import type { Chat, ChatRequest, ChatResponse, ChatWithoutHistory, DataModel, GetNlgQueryResultRequest, GetNlgQueryResultResponse, LlmConfig, Perspective, QueryRecommendationConfig, QueryRecommendationResponse, SendFeedbackRequest } from './types';
|
|
3
3
|
export declare class ChatRestApi {
|
|
4
4
|
private httpClient;
|
|
5
5
|
constructor(httpClient: HttpClient);
|
|
@@ -13,10 +13,12 @@ export declare class ChatRestApi {
|
|
|
13
13
|
private createChat;
|
|
14
14
|
private postChat;
|
|
15
15
|
private deleteChatHistory;
|
|
16
|
+
private sendFeedback;
|
|
16
17
|
ai: {
|
|
17
18
|
getNlgQueryResult: (request: GetNlgQueryResultRequest) => Promise<GetNlgQueryResultResponse>;
|
|
18
19
|
getQueryRecommendations: (contextTitle: string, config: QueryRecommendationConfig) => Promise<QueryRecommendationResponse>;
|
|
19
20
|
setLlmConfig: (config: LlmConfig) => Promise<unknown>;
|
|
21
|
+
sendFeedback: (request: SendFeedbackRequest) => Promise<unknown>;
|
|
20
22
|
chat: {
|
|
21
23
|
getAll: () => Promise<ChatWithoutHistory[]>;
|
|
22
24
|
getById: (chatId: string) => Promise<Chat>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const UNKNOWN_ERROR = "Oh snap, something went wrong. Please try again later or try asking a different question.";
|
package/dist/ai/api/hooks.d.ts
CHANGED
|
@@ -1,74 +1,35 @@
|
|
|
1
|
-
import type { ChatContext } from './types';
|
|
1
|
+
import type { ChatContext, ChatMessage, ChatResponse } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const useGetDataTopics: () => {
|
|
6
6
|
data: ChatContext[] | undefined;
|
|
7
7
|
isLoading: boolean;
|
|
8
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
8
9
|
};
|
|
9
10
|
/**
|
|
10
11
|
* @internal
|
|
11
12
|
*/
|
|
12
|
-
export declare const
|
|
13
|
+
export declare const useGetAllChats: () => {
|
|
13
14
|
data: import("./types").ChatWithoutHistory[];
|
|
14
15
|
isLoading: boolean;
|
|
15
|
-
refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("./types").ChatWithoutHistory[] | undefined, unknown>>;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* @internal
|
|
19
19
|
*/
|
|
20
|
-
export declare const
|
|
21
|
-
data: import("./types").Chat | undefined;
|
|
22
|
-
isLoading: boolean;
|
|
23
|
-
refetch: () => void;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Parameters for {@link useQueryRecommendations} hook.
|
|
27
|
-
*
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
30
|
-
export interface UseGetQueryRecommendationsParams {
|
|
31
|
-
/** Data model title or perspective title */
|
|
32
|
-
contextTitle: string;
|
|
33
|
-
}
|
|
20
|
+
export declare const useMaybeCreateChat: (contextId: string | undefined, shouldCreate: boolean) => void;
|
|
34
21
|
/**
|
|
35
|
-
* Fetch recommended questions for a data model or perspective.
|
|
36
|
-
*
|
|
37
|
-
* @param params - {@link UseQueryRecommendationsParams}
|
|
38
|
-
* @returns An array of questions
|
|
39
22
|
* @internal
|
|
40
23
|
*/
|
|
41
|
-
export declare
|
|
42
|
-
data:
|
|
24
|
+
export declare const useGetChatHistory: (id: string | undefined) => {
|
|
25
|
+
data: ChatMessage[] | undefined;
|
|
43
26
|
isLoading: boolean;
|
|
44
27
|
};
|
|
45
28
|
/**
|
|
46
|
-
* Parameters for {@link useNlgQueryResult} hook.
|
|
47
|
-
*
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
export interface UseGetNlgQueryResultParams {
|
|
51
|
-
/** The data source that the JAQL metadata targets - e.g. `Sample ECommerce` */
|
|
52
|
-
dataSource: string;
|
|
53
|
-
/** The metadata that composes the JAQL to be analyzed */
|
|
54
|
-
metadata: unknown[];
|
|
55
|
-
/**
|
|
56
|
-
* Boolean flag to enable/disable API call by default
|
|
57
|
-
*
|
|
58
|
-
* If not specified, the default value is `true`
|
|
59
|
-
*/
|
|
60
|
-
enabled?: boolean;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Fetch an analysis of the provided JAQL.
|
|
64
|
-
*
|
|
65
|
-
* @param params - {@link UseNlgQueryResultParams}
|
|
66
|
-
* @returns A response object containing a text summary
|
|
67
29
|
* @internal
|
|
68
30
|
*/
|
|
69
|
-
export declare const
|
|
70
|
-
|
|
71
|
-
|
|
31
|
+
export declare const useClearChatHistory: (chatId: string | undefined) => import("@tanstack/react-query").UseMutationResult<void, unknown, void, unknown>;
|
|
32
|
+
export declare const useSendChatMessage: (chatId: string | undefined) => {
|
|
33
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<ChatResponse | undefined, unknown, string, void>;
|
|
72
34
|
isLoading: boolean;
|
|
73
|
-
refetch: () => void;
|
|
74
35
|
};
|
package/dist/ai/api/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface ChatContext {
|
|
|
6
6
|
type: ChatContextType;
|
|
7
7
|
description: string;
|
|
8
8
|
}
|
|
9
|
-
export type ChatContextType = '
|
|
9
|
+
export type ChatContextType = 'datamodel' | 'perspective';
|
|
10
10
|
interface TextMessage {
|
|
11
11
|
role: 'assistant';
|
|
12
12
|
content: string;
|
|
@@ -56,9 +56,9 @@ interface TextResponse {
|
|
|
56
56
|
chatId: string;
|
|
57
57
|
responseType: 'Text';
|
|
58
58
|
}
|
|
59
|
-
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
60
|
-
type AllPossibleChartOptionKeys = KeysOfUnion<ChartDataOptions>;
|
|
61
|
-
type AxesMappingKey = Exclude<AllPossibleChartOptionKeys, 'seriesToColorMap'>;
|
|
59
|
+
export type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
60
|
+
export type AllPossibleChartOptionKeys = KeysOfUnion<ChartDataOptions>;
|
|
61
|
+
export type AxesMappingKey = Exclude<AllPossibleChartOptionKeys, 'seriesToColorMap'>;
|
|
62
62
|
export type AxesMapping = Partial<Record<AxesMappingKey, Array<{
|
|
63
63
|
name: string;
|
|
64
64
|
type: string;
|
|
@@ -72,9 +72,9 @@ export interface NlqResponseData {
|
|
|
72
72
|
detailedDescription: string;
|
|
73
73
|
followupQuestions: string[];
|
|
74
74
|
nlqPrompt: string;
|
|
75
|
-
chartRecommendations: ChartRecommendations;
|
|
75
|
+
chartRecommendations: ChartRecommendations | {};
|
|
76
76
|
jaql: {
|
|
77
|
-
datasource
|
|
77
|
+
datasource: {
|
|
78
78
|
title: string;
|
|
79
79
|
};
|
|
80
80
|
metadata: MetadataItem[];
|
|
@@ -90,43 +90,26 @@ export type ChatResponse = NlqResponse | TextResponse;
|
|
|
90
90
|
export interface QueryRecommendationConfig {
|
|
91
91
|
numOfRecommendations: number;
|
|
92
92
|
}
|
|
93
|
-
export
|
|
94
|
-
nlqPrompt: string;
|
|
95
|
-
chartRecommendations: ChartRecommendations;
|
|
96
|
-
jaql: {
|
|
97
|
-
datasource?: {
|
|
98
|
-
title: string;
|
|
99
|
-
};
|
|
100
|
-
metadata: MetadataItem[];
|
|
101
|
-
};
|
|
102
|
-
queryTitle: string;
|
|
103
|
-
detailedDescription: string;
|
|
104
|
-
}
|
|
93
|
+
export type QueryRecommendation = Omit<NlqResponseData, 'followupQuestions'>;
|
|
105
94
|
export type QueryRecommendationResponse = QueryRecommendation[];
|
|
106
95
|
export interface DataModel {
|
|
107
96
|
oid: string;
|
|
108
97
|
title: string;
|
|
109
98
|
}
|
|
110
99
|
export interface Perspective {
|
|
111
|
-
_id: string;
|
|
112
100
|
oid: string;
|
|
113
|
-
datamodelOid: string;
|
|
114
|
-
description: string;
|
|
115
|
-
tables: any[];
|
|
116
|
-
lastUpdated: string;
|
|
117
|
-
createdTime: string;
|
|
118
|
-
parentOid: string | null;
|
|
119
101
|
name: string;
|
|
120
|
-
|
|
102
|
+
description: string;
|
|
121
103
|
isDefault: boolean;
|
|
122
|
-
tenantId: string;
|
|
123
104
|
}
|
|
124
105
|
export interface GetNlgQueryResultRequest {
|
|
125
106
|
style: 'Small' | 'Medium' | 'Large';
|
|
126
107
|
jaql: {
|
|
108
|
+
/** The data source that the JAQL metadata targets - e.g. `Sample ECommerce` */
|
|
127
109
|
datasource: {
|
|
128
110
|
title: string;
|
|
129
111
|
};
|
|
112
|
+
/** The metadata that composes the JAQL to be analyzed */
|
|
130
113
|
metadata: unknown[];
|
|
131
114
|
};
|
|
132
115
|
}
|
|
@@ -136,4 +119,10 @@ export interface GetNlgQueryResultResponse {
|
|
|
136
119
|
};
|
|
137
120
|
responseType: 'Text';
|
|
138
121
|
}
|
|
122
|
+
export interface SendFeedbackRequest {
|
|
123
|
+
type: string;
|
|
124
|
+
data: object;
|
|
125
|
+
sourceId: string;
|
|
126
|
+
rating: -1 | 1;
|
|
127
|
+
}
|
|
139
128
|
export {};
|
package/dist/ai/chat-box.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ChatContext } from './api/types';
|
|
3
2
|
export type ChatBoxProps = {
|
|
4
|
-
|
|
3
|
+
contextTitle: string;
|
|
4
|
+
onGoBack?: () => void;
|
|
5
5
|
};
|
|
6
|
-
export default function ChatBox({
|
|
6
|
+
export default function ChatBox({ contextTitle, onGoBack }: ChatBoxProps): JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ChatConfig {
|
|
3
|
+
/**
|
|
4
|
+
* Boolean flag to show or hide suggested questions following a chat response
|
|
5
|
+
*
|
|
6
|
+
* If not specified, the default value is `false`
|
|
7
|
+
*/
|
|
8
|
+
enableFollowupQuestions: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Number of recommended queries that should be shown in a chat session
|
|
11
|
+
*
|
|
12
|
+
* If not specified, the default value is `4`
|
|
13
|
+
*/
|
|
14
|
+
numOfRecommendations: number;
|
|
15
|
+
/**
|
|
16
|
+
* The default context (data model or perspective) title to use for a chat session
|
|
17
|
+
*
|
|
18
|
+
* If specified, the data topic selector screen will not be shown.
|
|
19
|
+
*/
|
|
20
|
+
defaultContextTitle?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const DEFAULTS: Readonly<ChatConfig>;
|
|
23
|
+
export type ChatConfigProviderProps = {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
value: Partial<ChatConfig>;
|
|
26
|
+
};
|
|
27
|
+
export declare const useChatConfig: () => ChatConfig;
|
|
28
|
+
export declare const ChatConfigProvider: ({ children, value }: ChatConfigProviderProps) => JSX.Element;
|
package/dist/ai/chat-home.d.ts
CHANGED
package/dist/ai/chatbot.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
+
import { ChatConfig } from './chat-config';
|
|
2
3
|
/**
|
|
3
4
|
* Props for {@link Chatbot} component.
|
|
4
|
-
*
|
|
5
|
-
* @internal
|
|
6
5
|
*/
|
|
7
6
|
export type ChatbotProps = {
|
|
8
7
|
/**
|
|
@@ -17,11 +16,34 @@ export type ChatbotProps = {
|
|
|
17
16
|
* If not specified, a default height of 500px will be used
|
|
18
17
|
*/
|
|
19
18
|
height?: CSSProperties['height'];
|
|
19
|
+
/**
|
|
20
|
+
* Various configuration options for the chatbot
|
|
21
|
+
*/
|
|
22
|
+
config?: Partial<ChatConfig>;
|
|
20
23
|
};
|
|
21
24
|
/**
|
|
22
|
-
* React component that renders a chatbot with data topic selection.
|
|
25
|
+
* React component that renders a chatbot with data topic selection. You can optionally provide `width` and/or `height`.
|
|
26
|
+
*
|
|
27
|
+
* ::: warning Note
|
|
28
|
+
* This component is currently under private beta for selected customers and is subject to change as we make fixes and improvements.
|
|
29
|
+
* :::
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* import { SisenseContextProvider } from '@sisense/sdk-ui';
|
|
34
|
+
* import { AiContextProvider, Chatbot } from '@sisense/sdk-ui/ai';
|
|
23
35
|
*
|
|
36
|
+
* function App() {
|
|
37
|
+
* return (
|
|
38
|
+
* <SisenseContextProvider {...sisenseContextProps}>
|
|
39
|
+
* <AiContextProvider>
|
|
40
|
+
* <Chatbot width={1000} height={800} />
|
|
41
|
+
* </AiContextProvider>
|
|
42
|
+
* </SisenseContextProvider>
|
|
43
|
+
* );
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
24
46
|
* @param props - {@link ChatbotProps}
|
|
25
|
-
* @
|
|
47
|
+
* @beta
|
|
26
48
|
*/
|
|
27
49
|
export declare const Chatbot: import("react").FunctionComponent<ChatbotProps>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { GetNlgQueryResultRequest } from './api/types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for {@link GetNlgQueryResult} component.
|
|
5
|
+
*/
|
|
6
|
+
export type GetNlgQueryResultProps = GetNlgQueryResultRequest;
|
|
7
|
+
/**
|
|
8
|
+
* React component that fetches and displays a collapsible analysis of the provided JAQL using natural language generation (NLG).
|
|
9
|
+
*
|
|
10
|
+
* This takes the same props as {@link useGetNlgQueryResult} and makes the same API call but presents the result in a collapsible container.
|
|
11
|
+
*
|
|
12
|
+
* ::: warning Note
|
|
13
|
+
* This component is currently under private beta for selected customers and is subject to change as we make fixes and improvements.
|
|
14
|
+
* :::
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import { SisenseContextProvider } from '@sisense/sdk-ui';
|
|
19
|
+
* import { AiContextProvider, GetNlgQueryResult } from '@sisense/sdk-ui/ai';
|
|
20
|
+
*
|
|
21
|
+
* function Page() {
|
|
22
|
+
* return (
|
|
23
|
+
* <GetNlgQueryResult
|
|
24
|
+
* dataSource="Sample ECommerce"
|
|
25
|
+
* metadata={[
|
|
26
|
+
* {
|
|
27
|
+
* jaql: {
|
|
28
|
+
* column: 'Date',
|
|
29
|
+
* datatype: 'datetime',
|
|
30
|
+
* dim: '[Commerce.Date]',
|
|
31
|
+
* firstday: 'mon',
|
|
32
|
+
* level: 'years',
|
|
33
|
+
* table: 'Commerce',
|
|
34
|
+
* title: 'Date',
|
|
35
|
+
* },
|
|
36
|
+
* format: {
|
|
37
|
+
* mask: {
|
|
38
|
+
* days: 'shortDate',
|
|
39
|
+
* isdefault: true,
|
|
40
|
+
* minutes: 'HH:mm',
|
|
41
|
+
* months: 'MM/yyyy',
|
|
42
|
+
* quarters: 'yyyy Q',
|
|
43
|
+
* weeks: 'ww yyyy',
|
|
44
|
+
* years: 'yyyy',
|
|
45
|
+
* },
|
|
46
|
+
* },
|
|
47
|
+
* },
|
|
48
|
+
* {
|
|
49
|
+
* jaql: {
|
|
50
|
+
* agg: 'sum',
|
|
51
|
+
* column: 'Revenue',
|
|
52
|
+
* datatype: 'numeric',
|
|
53
|
+
* dim: '[Commerce.Revenue]',
|
|
54
|
+
* table: 'Commerce',
|
|
55
|
+
* title: 'total of Revenue',
|
|
56
|
+
* },
|
|
57
|
+
* },
|
|
58
|
+
* ]}
|
|
59
|
+
* />
|
|
60
|
+
* );
|
|
61
|
+
* }
|
|
62
|
+
*
|
|
63
|
+
* function App() {
|
|
64
|
+
* return (
|
|
65
|
+
* <SisenseContextProvider {...sisenseContextProps}>
|
|
66
|
+
* <AiContextProvider>
|
|
67
|
+
* <Page />
|
|
68
|
+
* </AiContextProvider>
|
|
69
|
+
* </SisenseContextProvider>
|
|
70
|
+
* );
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
* @param props - {@link GetNlgQueryResultProps}
|
|
74
|
+
* @returns Collapsible container wrapping a text summary
|
|
75
|
+
* @beta
|
|
76
|
+
*/
|
|
77
|
+
declare const _default: import("react").FunctionComponent<GetNlgQueryResultRequest>;
|
|
78
|
+
export default _default;
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { default as AiContextProvider, type AiContextProviderProps } from './ai-context-provider';
|
|
2
|
+
export { type ChatConfig } from './chat-config';
|
|
3
|
+
export { useGetNlgQueryResult, type UseGetNlgQueryResultParams } from './use-get-nlg-query-result';
|
|
4
|
+
export { useGetQueryRecommendations, type UseGetQueryRecommendationsParams, } from './use-get-query-recommendations';
|
|
5
|
+
export type { GetNlgQueryResultRequest, QueryRecommendationResponse, QueryRecommendation, NlqResponseData, ChartRecommendations, AxesMapping, AxesMappingKey, AllPossibleChartOptionKeys, KeysOfUnion, } from './api/types';
|
|
3
6
|
export { Chatbot, type ChatbotProps } from './chatbot';
|
|
4
|
-
export { default as
|
|
7
|
+
export { default as GetNlgQueryResult, type GetNlgQueryResultProps } from './get-nlg-query-result';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type FeedbackWrapperProps = {
|
|
3
|
+
sourceId: string;
|
|
4
|
+
data: object;
|
|
5
|
+
type: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export default function FeedbackWrapper({ sourceId, data, type, children }: FeedbackWrapperProps): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MetadataItem } from '@sisense/sdk-query-client';
|
|
2
2
|
import { ChartDataOptions, ChartStyleOptions } from '../../types';
|
|
3
|
-
import { ChartRecommendations } from '../api/types';
|
|
3
|
+
import { ChartRecommendations, NlqResponseData } from '../api/types';
|
|
4
|
+
export declare const getChartRecommendationsOrDefault: (response: NlqResponseData) => ChartRecommendations;
|
|
4
5
|
export declare const getTableOptions: (jaql: MetadataItem[]) => {
|
|
5
6
|
dataOptions: {
|
|
6
7
|
columns: import("./jaql-element").JaqlElement[];
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
import { ChatMessage } from '../api/types';
|
|
3
3
|
type MessageResolverProps = {
|
|
4
4
|
message: ChatMessage;
|
|
5
|
-
dataSource: string;
|
|
6
5
|
sendMessage?: (message: string) => void;
|
|
7
6
|
allowFollowupQuestions?: boolean;
|
|
8
7
|
};
|
|
9
|
-
declare function MessageResolver({ message,
|
|
8
|
+
declare function MessageResolver({ message, allowFollowupQuestions, sendMessage, }: MessageResolverProps): JSX.Element;
|
|
10
9
|
declare const _default: import("react").MemoExoticComponent<typeof MessageResolver>;
|
|
11
10
|
export default _default;
|
package/dist/ai/toolbar.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
export interface Props {
|
|
3
3
|
title: string;
|
|
4
|
-
leftNav:
|
|
4
|
+
leftNav: ReactNode;
|
|
5
5
|
rightNav?: JSX.Element;
|
|
6
6
|
}
|
|
7
7
|
declare const _default: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
|