@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.
Files changed (119) hide show
  1. package/dist/ai/ai-context-provider.d.ts +1 -0
  2. package/dist/ai/api/chat-api-provider.d.ts +1 -1
  3. package/dist/ai/api/chat-history.d.ts +18 -0
  4. package/dist/ai/api/chat-rest-api.d.ts +3 -0
  5. package/dist/ai/api/errors.d.ts +4 -1
  6. package/dist/ai/api/hooks.d.ts +2 -13
  7. package/dist/ai/api/types.d.ts +21 -19
  8. package/dist/ai/chat-config.d.ts +10 -3
  9. package/dist/ai/chat-intro-blurb.d.ts +4 -0
  10. package/dist/ai/chat-style-provider.d.ts +15 -0
  11. package/dist/ai/chatbot.d.ts +8 -0
  12. package/dist/ai/{error-page.d.ts → common/error-container.d.ts} +1 -1
  13. package/dist/ai/get-nlg-query-result.d.ts +3 -3
  14. package/dist/ai/index.d.ts +2 -0
  15. package/dist/ai/messages/feedback-wrapper.d.ts +2 -1
  16. package/dist/ai/messages/insights-message.d.ts +6 -1
  17. package/dist/ai/messages/message-list-resolver.d.ts +1 -2
  18. package/dist/ai/messages/message-resolver.d.ts +1 -3
  19. package/dist/ai/messages/nlq-message-group.d.ts +10 -0
  20. package/dist/ai/suggestions/index.d.ts +1 -1
  21. package/dist/ai/suggestions/suggestion-item.d.ts +1 -2
  22. package/dist/ai/suggestions/suggestion-list.d.ts +1 -1
  23. package/dist/ai/suggestions/suggestions-with-intro.d.ts +2 -2
  24. package/dist/ai/translators/code-templates.d.ts +11 -0
  25. package/dist/ai/translators/generate-code.d.ts +9 -0
  26. package/dist/ai/translators/index.d.ts +4 -0
  27. package/dist/ai/translators/model-translator.d.ts +50 -0
  28. package/dist/ai/translators/query-translator.d.ts +122 -0
  29. package/dist/ai/translators/translate-props-to-code.d.ts +8 -0
  30. package/dist/ai/translators/types.d.ts +105 -0
  31. package/dist/ai/translators/use-get-data-source.d.ts +12 -0
  32. package/dist/ai/translators/utils.d.ts +2 -0
  33. package/dist/ai/use-chat-session.d.ts +10 -3
  34. package/dist/ai/use-get-nlg-query-result.d.ts +6 -6
  35. package/dist/ai/use-get-query-recommendations.d.ts +1 -0
  36. package/dist/ai.js +7037 -3332
  37. package/dist/alert-box/alert-box.d.ts +1 -1
  38. package/dist/app/client-application.d.ts +27 -0
  39. package/dist/app/settings/settings.d.ts +1 -1
  40. package/dist/area-chart.d.ts +1 -0
  41. package/dist/areamap-chart.d.ts +1 -0
  42. package/dist/bar-chart.d.ts +3 -0
  43. package/dist/boxplot-chart.d.ts +1 -0
  44. package/dist/boxplot-utils.d.ts +3 -1
  45. package/dist/chart/chart.d.ts +1 -0
  46. package/dist/chart-options-processor/translations/base-design-options.d.ts +1 -0
  47. package/dist/chart-options-processor/translations/tooltip-utils.d.ts +1 -0
  48. package/dist/charts/indicator/indicator-legacy-chart-options/legacy-chart-options-to-theme-settings-dictionary.d.ts +2 -0
  49. package/dist/charts/indicator/indicator-legacy-chart-options/override-with-value-color.d.ts +1 -2
  50. package/dist/column-chart.d.ts +4 -0
  51. package/dist/common/components/loading-indicator.d.ts +2 -0
  52. package/dist/common/hooks/use-fetch.d.ts +42 -0
  53. package/dist/const.d.ts +1 -0
  54. package/dist/dashboard-widget/dashboard-widget.d.ts +2 -0
  55. package/dist/dashboard-widget/translate-widget-data-options.d.ts +5 -0
  56. package/dist/dashboard-widget/translate-widget-filters.d.ts +1 -0
  57. package/dist/dashboard-widget/types.d.ts +3 -2
  58. package/dist/dynamic-size-container/dynamic-size-container.d.ts +4 -3
  59. package/dist/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +1 -0
  60. package/dist/filters/components/date-filter/date-range-filter-tile/date-range-filter-tile.d.ts +1 -0
  61. package/dist/filters/components/date-filter/relative-date-filter-tile/relative-date-filter-tile.d.ts +1 -0
  62. package/dist/filters/components/member-filter-tile/member-filter-tile.d.ts +1 -0
  63. package/dist/formulas/use-get-shared-formula.d.ts +2 -0
  64. package/dist/funnel-chart.d.ts +1 -0
  65. package/dist/index.d.ts +5 -0
  66. package/dist/index.js +6680 -37439
  67. package/dist/indicator-chart.d.ts +1 -0
  68. package/dist/line-chart.d.ts +1 -0
  69. package/dist/models/dashboard/get-dashboard-models.d.ts +1 -3
  70. package/dist/models/dashboard/translate-dashboard.d.ts +1 -1
  71. package/dist/models/dashboard/types.d.ts +17 -0
  72. package/dist/models/dashboard/use-get-dashboard-model.d.ts +2 -0
  73. package/dist/models/dashboard/use-get-dashboard-models.d.ts +2 -0
  74. package/dist/models/widget/use-get-widget-model.d.ts +2 -0
  75. package/dist/models/widget/widget-model.d.ts +11 -1
  76. package/dist/pie-chart.d.ts +1 -0
  77. package/dist/pivot-table/formatters/data-cell-formatters/data-cell-value-formatter.d.ts +3 -0
  78. package/dist/pivot-table/formatters/data-cell-formatters/index.d.ts +1 -0
  79. package/dist/pivot-table/formatters/header-cell-formatters/header-cell-value-formatter.d.ts +3 -0
  80. package/dist/pivot-table/formatters/header-cell-formatters/index.d.ts +1 -0
  81. package/dist/pivot-table/formatters/index.d.ts +2 -0
  82. package/dist/pivot-table/formatters/types.d.ts +4 -0
  83. package/dist/pivot-table/formatters/utils.d.ts +5 -0
  84. package/dist/pivot-table/pivot-table.d.ts +1 -0
  85. package/dist/pivot-table/sorting-utils.d.ts +56 -0
  86. package/dist/pivot-table/use-apply-pivot-table-formatting.d.ts +11 -0
  87. package/dist/pivot-table/use-get-pivot-table-query.d.ts +1 -1
  88. package/dist/polar-chart.d.ts +1 -0
  89. package/dist/props.d.ts +5 -4
  90. package/dist/query/execute-query.d.ts +5 -5
  91. package/dist/query-execution/execute-query-by-widget-id.d.ts +2 -0
  92. package/dist/query-execution/execute-query.d.ts +1 -0
  93. package/dist/query-execution/index.d.ts +2 -1
  94. package/dist/query-execution/query-params-comparator.d.ts +8 -0
  95. package/dist/query-execution/types.d.ts +7 -0
  96. package/dist/query-execution/use-execute-csv-query.d.ts +1 -0
  97. package/dist/query-execution/use-execute-pivot-query.d.ts +1 -0
  98. package/dist/query-execution/use-execute-query-by-widget-id.d.ts +2 -0
  99. package/dist/query-execution/use-execute-query.d.ts +4 -10
  100. package/dist/query-execution/use-query-cache.d.ts +10 -0
  101. package/dist/scatter-chart.d.ts +1 -0
  102. package/dist/scattermap-chart.d.ts +1 -0
  103. package/dist/sisense-context/sisense-context-provider.d.ts +1 -0
  104. package/dist/sisense-context/sisense-query-client-provider.d.ts +2 -0
  105. package/dist/sunburst-chart.d.ts +1 -0
  106. package/dist/table/table.d.ts +1 -0
  107. package/dist/theme-provider/theme-provider.d.ts +7 -0
  108. package/dist/treemap-chart.d.ts +1 -0
  109. package/dist/types.d.ts +2 -2
  110. package/dist/useQuery-aa258c0d.js +121301 -0
  111. package/dist/utils/create-cache.d.ts +33 -0
  112. package/dist/widgets/chart-widget.d.ts +1 -0
  113. package/dist/widgets/common/context-menu.d.ts +5 -0
  114. package/dist/widgets/common/drilldown-breadcrumbs/drilldown-breadcrumbs.d.ts +5 -0
  115. package/dist/widgets/drilldown-widget.d.ts +1 -0
  116. package/package.json +14 -9
  117. package/dist/chart-data-processor/utils.d.ts +0 -10
  118. package/dist/utils/not-available-value.d.ts +0 -3
  119. package/dist/with-tracking-0799ec25.js +0 -78081
@@ -27,6 +27,7 @@ export type AiContextProviderProps = {
27
27
  * );
28
28
  * }
29
29
  * ```
30
+ * @group Generative AI
30
31
  * @beta
31
32
  */
32
33
  export default function AiContextProvider({ children, config }: AiContextProviderProps): JSX.Element;
@@ -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>;
@@ -1 +1,4 @@
1
- export declare const UNKNOWN_ERROR = "Oh snap, something went wrong. Please try again later or try asking a different question.";
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.";
@@ -1,4 +1,4 @@
1
- import type { ChatContext, ChatMessage, ChatResponse } from './types';
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;
@@ -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 SystemMessage = NlqMessage | TextMessage;
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: 'Text';
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: string;
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 {};
@@ -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
- * If not specified, the default value is `false`
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,4 @@
1
+ /// <reference types="react" />
2
+ export default function ChatIntroBlurb(props: {
3
+ title: string;
4
+ }): JSX.Element;
@@ -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;
@@ -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,5 +6,5 @@ type ErrorPageProps = {
6
6
  onClick: () => void;
7
7
  };
8
8
  };
9
- export default function ErrorPage({ text, action }: ErrorPageProps): JSX.Element;
9
+ export default function ErrorContainer({ text, action }: ErrorPageProps): JSX.Element;
10
10
  export {};
@@ -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 JAQL using natural language generation (NLG).
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>;
@@ -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, sendMessage, }: MessageListResolverProps): JSX.Element;
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, allowFollowupQuestions, sendMessage, }: MessageResolverProps): JSX.Element;
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
- declare const SuggestionItem: React.FC<SuggestedItemProps>;
7
- export default SuggestionItem;
6
+ export default function SuggestionItem({ question, onClick }: SuggestedItemProps): JSX.Element;
@@ -3,5 +3,5 @@ type Props = {
3
3
  questions: string[];
4
4
  onSelection: (question: string) => void;
5
5
  };
6
- export default function SuggestionList(props: Props): JSX.Element;
6
+ export default function SuggestionList({ questions, onSelection }: Props): JSX.Element;
7
7
  export {};
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  type Props = {
3
3
  questions: string[];
4
- title: string;
4
+ isLoading: boolean;
5
5
  onSelection: (question: string) => void;
6
6
  };
7
- export default function SuggestionsWithIntro(props: Props): JSX.Element;
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,4 @@
1
+ export * from './types';
2
+ export { useGetDataSource } from './use-get-data-source';
3
+ export { ModelTranslator } from './model-translator';
4
+ export { QueryTranslator } from './query-translator';
@@ -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;