@sisense/sdk-ui 1.25.0 → 1.26.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 (27) hide show
  1. package/dist/ai.cjs +53 -52
  2. package/dist/ai.js +934 -787
  3. package/dist/analytics-composer.cjs +38 -38
  4. package/dist/analytics-composer.js +475 -464
  5. package/dist/{derive-chart-family-C_c2ZQQd.cjs → derive-chart-family-DOmv279l.cjs} +19 -19
  6. package/dist/{derive-chart-family-BlFbAr2V.js → derive-chart-family-ZvvF5lty.js} +255 -246
  7. package/dist/index.cjs +42 -42
  8. package/dist/index.js +1817 -1767
  9. package/dist/packages/sdk-ui/src/ai/api/types.d.ts +6 -1
  10. package/dist/packages/sdk-ui/src/ai/icons/close-dialog-icon.d.ts +3 -1
  11. package/dist/packages/sdk-ui/src/ai/icons/sisense-logo.d.ts +2 -4
  12. package/dist/packages/sdk-ui/src/ai/use-chat-session.d.ts +2 -1
  13. package/dist/packages/sdk-ui/src/analytics-composer/common/utils.d.ts +1 -1
  14. package/dist/packages/sdk-ui/src/analytics-composer/execute-query/execute-query-composer.d.ts +8 -1
  15. package/dist/packages/sdk-ui/src/analytics-composer/execute-query/to-execute-query-code.d.ts +2 -1
  16. package/dist/packages/sdk-ui/src/analytics-composer/types.d.ts +8 -2
  17. package/dist/packages/sdk-ui/src/api/rest-api.d.ts +13 -1
  18. package/dist/packages/sdk-ui/src/chart/helpers/use-synced-data.d.ts +14 -1
  19. package/dist/packages/sdk-ui/src/models/dashboard/translate-dashboard-utils.d.ts +9 -1
  20. package/dist/packages/sdk-ui/src/widget-by-id/types.d.ts +14 -2
  21. package/dist/useQuery-9lk4MNnb.cjs +889 -0
  22. package/dist/{useQuery-P9b5LtGq.js → useQuery-BtpTzoxI.js} +21289 -20599
  23. package/dist/widget-composer-DbpSzSub.cjs +298 -0
  24. package/dist/{widget-composer-DXM5t9rq.js → widget-composer-ygehKLLR.js} +229 -150
  25. package/package.json +7 -7
  26. package/dist/useQuery-BYxzPyc5.cjs +0 -870
  27. package/dist/widget-composer-DPsDPrFM.cjs +0 -237
@@ -4,6 +4,11 @@ export interface ChatContext {
4
4
  title: string;
5
5
  live: boolean;
6
6
  }
7
+ export interface TextMessage {
8
+ role: 'assistant';
9
+ content: string;
10
+ type: 'text';
11
+ }
7
12
  export interface NlqMessage {
8
13
  role: 'assistant';
9
14
  content: string;
@@ -13,7 +18,7 @@ interface RegularMessage {
13
18
  role: 'user' | 'assistant';
14
19
  content: string;
15
20
  }
16
- export type ChatMessage = RegularMessage | NlqMessage;
21
+ export type ChatMessage = RegularMessage | NlqMessage | TextMessage;
17
22
  export interface Chat {
18
23
  chatId: string;
19
24
  contextId: string;
@@ -1 +1,3 @@
1
- export default function CloseDialogIcon(): import("react/jsx-runtime").JSX.Element;
1
+ export default function CloseDialogIcon({ fillColor }: {
2
+ fillColor?: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,3 @@
1
- type ColorSchema = 'yellow-white' | 'yellow-black';
2
- export default function SisenseLogo({ colorSchema }: {
3
- colorSchema: ColorSchema;
1
+ export default function SisenseLogo({ isDarkBackground }: {
2
+ isDarkBackground: boolean;
4
3
  }): import("react/jsx-runtime").JSX.Element;
5
- export {};
@@ -1,4 +1,4 @@
1
- import type { ChatMessage, NlqMessage, NlqResponseData } from './api/types';
1
+ import { ChatMessage, NlqMessage, NlqResponseData, TextMessage } from './api/types';
2
2
  /**
3
3
  * Result of the useChatSession hook.
4
4
  *
@@ -14,6 +14,7 @@ export interface UseChatSessionResult {
14
14
  lastError: Error | null;
15
15
  }
16
16
  export declare const isNlqMessage: (message: ChatMessage | null | undefined) => message is NlqMessage;
17
+ export declare const isTextMessage: (message: ChatMessage | null | undefined) => message is TextMessage;
17
18
  /**
18
19
  * React hook that returns a chat session object for the given data model or
19
20
  * perspective.
@@ -12,4 +12,4 @@ export declare function sanitizeDimensionId(str: string): string;
12
12
  export declare function validateQueryModel(model: any): SimpleQueryModel;
13
13
  export declare function isEmptyQueryModel(queryModel: ExpandedQueryModel | undefined | null): boolean;
14
14
  export declare function escapeSingleQuotes(str?: string): string | undefined;
15
- export declare function validateChartType(chartType: DynamicChartType): void;
15
+ export declare function validateChartType(chartType: DynamicChartType | 'pivot' | 'pivot2'): void;
@@ -1,4 +1,4 @@
1
- import { ExecuteQueryCodeParams } from '../types.js';
1
+ import { ExecuteQueryCodeParams, ExecutePivotQueryCodeParams } from '../types.js';
2
2
  /**
3
3
  * Converts query params to CSDK code.
4
4
  *
@@ -6,3 +6,10 @@ import { ExecuteQueryCodeParams } from '../types.js';
6
6
  * @returns CSDK code string
7
7
  */
8
8
  export declare const toExecuteQueryCode: (executeQueryCodeParams: ExecuteQueryCodeParams) => string;
9
+ /**
10
+ * Converts pivot query params to CSDK code.
11
+ *
12
+ * @param executePivotQueryCodeParams - pivotQuery params
13
+ * @returns CSDK code string
14
+ */
15
+ export declare const toExecutePivotQueryCode: (executePivotQueryCodeParams: ExecutePivotQueryCodeParams) => string;
@@ -1,2 +1,3 @@
1
- import { ExecuteQueryCodeParams } from '../types.js';
1
+ import { ExecuteQueryCodeParams, ExecutePivotQueryCodeParams } from '../types.js';
2
2
  export declare const toExecuteQueryCode: ({ queryParams, uiFramework, }: ExecuteQueryCodeParams) => string;
3
+ export declare const toExecutePivotQueryCode: ({ pivotQueryParams, uiFramework, }: ExecutePivotQueryCodeParams) => string;
@@ -1,6 +1,6 @@
1
1
  import { WidgetProps } from '../props';
2
2
  import { ChartDataOptions } from '../types';
3
- import { ExecuteQueryParams } from '../query-execution';
3
+ import { ExecuteQueryParams, ExecutePivotQueryParams } from '../query-execution';
4
4
  import { MetadataItem } from '@sisense/sdk-data';
5
5
  import { DynamicChartType } from '../chart-options-processor/translations/types.js';
6
6
  export type KeysOfUnion<T> = T extends T ? keyof T : never;
@@ -86,7 +86,7 @@ export type UiFramework = 'react' | 'vue' | 'angular';
86
86
  * Code Template Key
87
87
  * @internal
88
88
  */
89
- export type CodeTemplateKey = 'baseChartTmpl' | 'chartTmpl' | 'chartWidgetTmpl' | 'widgetByIdTmpl' | 'executeQueryByWidgetIdTmpl' | 'executeQueryTmpl';
89
+ export type CodeTemplateKey = 'baseChartTmpl' | 'chartTmpl' | 'chartWidgetTmpl' | 'widgetByIdTmpl' | 'executeQueryByWidgetIdTmpl' | 'executeQueryTmpl' | 'executePivotQueryTmpl' | 'pivotTableWidgetTmpl';
90
90
  /**
91
91
  * Code Templates
92
92
  * @internal
@@ -158,3 +158,9 @@ export type WidgetPropsConfig = {
158
158
  export type ExecuteQueryCodeParams = BaseCodeConfig & {
159
159
  queryParams: ExecuteQueryParams;
160
160
  };
161
+ /**
162
+ * @internal
163
+ */
164
+ export type ExecutePivotQueryCodeParams = BaseCodeConfig & {
165
+ pivotQueryParams: ExecutePivotQueryParams;
166
+ };
@@ -1,7 +1,7 @@
1
1
  import { HttpClient } from '@sisense/sdk-rest-client';
2
2
  import { FeatureCollection as GeoJsonFeatureCollection } from 'geojson';
3
3
  import { type DataSource } from '@sisense/sdk-data';
4
- import { HierarchyDto, WidgetDto } from '../widget-by-id/types';
4
+ import { HierarchyDto, SharedFormulaDto, WidgetDto } from '../widget-by-id/types';
5
5
  import type { DashboardDto } from './types/dashboard-dto';
6
6
  import { TranslatableError } from '../translation/translatable-error';
7
7
  import { PaletteDto } from '../api/types/palette-dto';
@@ -70,6 +70,18 @@ export declare class RestApi {
70
70
  * Add widget to a dashboard
71
71
  */
72
72
  addWidgetToDashboard: (dashboardOid: string, widgetDto: WidgetDto) => Promise<WidgetDto | undefined>;
73
+ /**
74
+ * Get shared formulas by ids
75
+ * @param sharedFormulasIds - An array of shared formulas ids
76
+ * @returns A dictionary of shared formulas
77
+ */
78
+ getSharedFormulas: (sharedFormulasIds: string[]) => Promise<Record<string, SharedFormulaDto>>;
79
+ /**
80
+ * Get a shared formula by id
81
+ * @param sharedFormulaId - A shared formula id
82
+ * @returns A shared formula
83
+ */
84
+ getSharedFormula: (sharedFormulaId: string) => Promise<SharedFormulaDto | undefined>;
73
85
  }
74
86
  export declare const useRestApi: () => {
75
87
  restApi: RestApi | undefined;
@@ -4,5 +4,18 @@ import { ChartDataOptionsInternal } from '../../chart-data-options/types';
4
4
  import { ChartType } from '../../types';
5
5
  import { DataColumnNamesMapping } from '../../chart-data-options/validate-data-options';
6
6
  type DataSet = DataSource | Data | undefined;
7
- export declare const useSyncedData: (dataSet: DataSet, chartDataOptions: ChartDataOptionsInternal, chartType: ChartType, attributes: Attribute[], measures: Measure[], dataColumnNamesMapping: DataColumnNamesMapping, filters?: Filter[] | FilterRelations, highlights?: Filter[], refreshCounter?: number, setIsLoading?: Dispatch<SetStateAction<boolean>>) => [Data, ChartDataOptionsInternal];
7
+ type UseSyncedDataProps = {
8
+ dataSet: DataSet;
9
+ chartDataOptions: ChartDataOptionsInternal;
10
+ chartType: ChartType;
11
+ attributes: Attribute[];
12
+ measures: Measure[];
13
+ dataColumnNamesMapping: DataColumnNamesMapping;
14
+ filters?: Filter[] | FilterRelations;
15
+ highlights?: Filter[];
16
+ refreshCounter?: number;
17
+ setIsLoading?: Dispatch<SetStateAction<boolean>>;
18
+ enabled?: boolean;
19
+ };
20
+ export declare const useSyncedData: ({ dataSet, chartDataOptions, chartType, attributes, measures, dataColumnNamesMapping, filters, highlights, refreshCounter, setIsLoading, enabled, }: UseSyncedDataProps) => [Data, ChartDataOptionsInternal];
8
21
  export {};
@@ -1,7 +1,15 @@
1
- import { type LayoutDto, type FilterDto, type CascadingFilterDto } from '../../api/types/dashboard-dto';
1
+ import { type LayoutDto, type FilterDto, type CascadingFilterDto, DashboardDto } from '../../api/types/dashboard-dto';
2
2
  import type { WidgetsPanelColumnLayout, WidgetsOptions } from './types';
3
3
  import { Filter, FilterRelations, FilterRelationsModel, FilterRelationsModelNode } from '@sisense/sdk-data';
4
4
  import { WidgetDto } from '../../widget-by-id/types';
5
+ import { RestApi } from '../../api/rest-api';
5
6
  export declare const translateLayout: (layout: LayoutDto) => WidgetsPanelColumnLayout;
6
7
  export declare function extractDashboardFilters(dashboardFilters: Array<FilterDto | CascadingFilterDto>, filterRelationsModel?: FilterRelationsModel | FilterRelationsModelNode): Filter[] | FilterRelations;
7
8
  export declare function translateWidgetsOptions(widgets?: WidgetDto[]): WidgetsOptions;
9
+ /**
10
+ * Replace all shared formulas, which defined by id references, in the dashboard with their actual values.
11
+ * @param dashboard - The dashboard DTO to replace shared formulas in
12
+ * @param api - The REST API instance
13
+ * @returns The dashboard DTO with shared formulas, defined by id references, replaced
14
+ */
15
+ export declare function withSharedFormulas(dashboard: DashboardDto, api: RestApi): Promise<DashboardDto>;
@@ -1,6 +1,6 @@
1
1
  import { WidgetContainerStyleOptions } from '../types';
2
2
  import { LEGACY_DESIGN_TYPES } from '../themes/legacy-design-settings';
3
- import { BaseJaql, Jaql, JaqlDataSource, JaqlSortDirection } from '@sisense/sdk-data';
3
+ import { BaseJaql, FormulaContext, FormulaJaql, Jaql, JaqlDataSource, JaqlSortDirection } from '@sisense/sdk-data';
4
4
  import { HierarchyId } from '../models/hierarchy';
5
5
  /**
6
6
  * The type of a widget on a dashboard that is a variant of Cartesian widget.
@@ -221,7 +221,7 @@ export type PanelItem = {
221
221
  width?: number;
222
222
  colorIndex?: number;
223
223
  };
224
- jaql: Jaql;
224
+ jaql: WidgetJaql;
225
225
  disabled?: boolean;
226
226
  y2?: boolean;
227
227
  parent?: PanelItem;
@@ -238,6 +238,18 @@ export type PanelItem = {
238
238
  panel?: string;
239
239
  hierarchies?: HierarchyId[];
240
240
  };
241
+ type WidgetJaql = Jaql | SharedFormulaJaql;
242
+ export declare function isJaqlWithFormula(jaql: WidgetJaql): jaql is FormulaJaql | SharedFormulaJaql;
243
+ type SharedFormulaJaql = FormulaJaql & {
244
+ context?: Record<string, FormulaContext | SharedFormulaReferenceContext> | undefined;
245
+ };
246
+ export type SharedFormulaDto = FormulaJaql & {
247
+ oid: string;
248
+ };
249
+ export type SharedFormulaReferenceContext = {
250
+ formulaRef: string;
251
+ };
252
+ export declare function isSharedFormulaReferenceContext(context: FormulaContext | SharedFormulaReferenceContext): context is SharedFormulaReferenceContext;
241
253
  export type PanelColorFormat = PanelColorFormatSingle | PanelColorFormatRange | PanelColorFormatConditional;
242
254
  export type PanelMembersFormat = Record<string, {
243
255
  color: string;