@sisense/sdk-ui 0.14.0 → 0.16.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 (128) hide show
  1. package/dist/ai/api/chat-api-context.d.ts +12 -0
  2. package/dist/ai/api/chat-rest-api.d.ts +28 -0
  3. package/dist/ai/api/hooks.d.ts +74 -0
  4. package/dist/ai/api/types.d.ts +139 -0
  5. package/dist/ai/chat-box.d.ts +6 -0
  6. package/dist/ai/chat-frame.d.ts +8 -0
  7. package/dist/ai/chat-home.d.ts +2 -0
  8. package/dist/ai/chat-input.d.ts +7 -0
  9. package/dist/ai/chatbot-context.d.ts +11 -0
  10. package/dist/ai/chatbot.d.ts +27 -0
  11. package/dist/ai/data-topics/data-topic-item.d.ts +8 -0
  12. package/dist/ai/data-topics/data-topic-list.d.ts +10 -0
  13. package/dist/ai/data-topics/index.d.ts +2 -0
  14. package/dist/ai/icons/arrow-left-icon.d.ts +2 -0
  15. package/dist/ai/icons/clear-chat-icon.d.ts +2 -0
  16. package/dist/ai/icons/close-dialog-icon.d.ts +2 -0
  17. package/dist/ai/icons/expand-icon.d.ts +2 -0
  18. package/dist/ai/icons/info-icon.d.ts +2 -0
  19. package/dist/ai/icons/light-bulb-icon.d.ts +2 -0
  20. package/dist/ai/icons/loading-dots-icon.d.ts +2 -0
  21. package/dist/ai/icons/magic-wand-icon.d.ts +2 -0
  22. package/dist/ai/icons/message-icon.d.ts +2 -0
  23. package/dist/ai/icons/refresh-icon.d.ts +2 -0
  24. package/dist/ai/icons/sisense-logo.d.ts +2 -0
  25. package/dist/ai/icons/three-dots-icon.d.ts +2 -0
  26. package/dist/ai/index.d.ts +4 -0
  27. package/dist/ai/magic-wand-dropdown.d.ts +7 -0
  28. package/dist/ai/messages/chart-message-toolbar.d.ts +8 -0
  29. package/dist/ai/messages/chart-message.d.ts +8 -0
  30. package/dist/ai/messages/clear-history-message.d.ts +6 -0
  31. package/dist/ai/messages/get-widget-options.d.ts +13 -0
  32. package/dist/ai/messages/insights-message.d.ts +10 -0
  33. package/dist/ai/messages/jaql-element.d.ts +25 -0
  34. package/dist/ai/messages/message-list-resolver.d.ts +7 -0
  35. package/dist/ai/messages/message-resolver.d.ts +11 -0
  36. package/dist/ai/messages/text-message.d.ts +8 -0
  37. package/dist/ai/nav-back-button.d.ts +6 -0
  38. package/dist/ai/nlg-query-result.d.ts +20 -0
  39. package/dist/ai/suggestions/index.d.ts +4 -0
  40. package/dist/ai/suggestions/suggestion-dropdown-item.d.ts +7 -0
  41. package/dist/ai/suggestions/suggestion-dropdown-list.d.ts +7 -0
  42. package/dist/ai/suggestions/suggestion-item.d.ts +7 -0
  43. package/dist/ai/suggestions/suggestion-list-skeleton.d.ts +2 -0
  44. package/dist/ai/suggestions/suggestion-list.d.ts +7 -0
  45. package/dist/ai/suggestions/suggestions-with-intro.d.ts +8 -0
  46. package/dist/ai/toolbar.d.ts +8 -0
  47. package/dist/ai/use-chat-session.d.ts +22 -0
  48. package/dist/ai.d.ts +1 -0
  49. package/dist/ai.js +3390 -0
  50. package/dist/api/types/dashboard-dto.d.ts +5 -3
  51. package/dist/chart-data-options/coloring/consts.d.ts +3 -0
  52. package/dist/chart-data-options/coloring/utils.d.ts +6 -0
  53. package/dist/chart-data-options/get-translated-data-options.d.ts +6 -0
  54. package/dist/chart-options-processor/chart-options-service.d.ts +2 -74
  55. package/dist/chart-options-processor/translations/axis-section.d.ts +3 -1
  56. package/dist/chart-options-processor/translations/funnel-series.d.ts +1 -2
  57. package/dist/chart-options-processor/translations/legend-section.d.ts +2 -1
  58. package/dist/chart-options-processor/translations/pie-series.d.ts +1 -2
  59. package/dist/chart-options-processor/translations/translations-to-highcharts.d.ts +6 -2
  60. package/dist/charts/indicator/chart/indicator.d.ts +1 -1
  61. package/dist/charts/indicator/chart/ticker.d.ts +2 -2
  62. package/dist/charts/indicator/indicator-legacy-chart-options/default-options.d.ts +2 -1
  63. package/dist/charts/indicator/types.d.ts +47 -6
  64. package/dist/common/components/loading-indicator.d.ts +33 -0
  65. package/dist/common/icons/loading-icon.d.ts +6 -0
  66. package/dist/dashboard-widget/translate-dashboard-filters.d.ts +2 -2
  67. package/dist/dashboard-widget/translate-panel-color-format.d.ts +2 -2
  68. package/dist/dashboard-widget/translate-widget-data-options.d.ts +6 -6
  69. package/dist/dashboard-widget/translate-widget-filters.d.ts +4 -16
  70. package/dist/dashboard-widget/translate-widget-style-options.d.ts +1 -1
  71. package/dist/dashboard-widget/types.d.ts +21 -71
  72. package/dist/dashboard-widget/use-fetch-widget-dto-model.d.ts +7 -1
  73. package/dist/dashboard-widget/utils.d.ts +3 -3
  74. package/dist/filters/components/common/dropdown.d.ts +8 -0
  75. package/dist/filters/components/common/index.d.ts +4 -1
  76. package/dist/filters/components/common/radio.d.ts +7 -0
  77. package/dist/filters/components/common/triangle-indicator.d.ts +2 -0
  78. package/dist/filters/components/criteria-filter-tile/criteria-filter-display.d.ts +25 -0
  79. package/dist/filters/components/criteria-filter-tile/criteria-filter-menu.d.ts +22 -0
  80. package/dist/filters/components/criteria-filter-tile/criteria-filter-operations.d.ts +76 -0
  81. package/dist/filters/components/criteria-filter-tile/criteria-filter-tile.d.ts +44 -0
  82. package/dist/filters/components/criteria-filter-tile/index.d.ts +2 -0
  83. package/dist/filters/components/date-filter/date-filter/date-filter.d.ts +4 -0
  84. package/dist/filters/components/date-filter/date-range-filter-tile/date-range-filter-tile.d.ts +11 -3
  85. package/dist/filters/components/date-filter/date-range-filter-tile/use-date-limits.d.ts +2 -2
  86. package/dist/filters/components/filter-tile.d.ts +3 -0
  87. package/dist/filters/components/member-filter-tile/basic-member-filter-tile.d.ts +4 -0
  88. package/dist/filters/components/member-filter-tile/member-filter-tile.d.ts +3 -1
  89. package/dist/filters/components/member-filter-tile/members-reducer.d.ts +9 -1
  90. package/dist/filters/components/member-filter-tile/pill-section.d.ts +0 -1
  91. package/dist/filters/index.d.ts +1 -0
  92. package/dist/formulas/fetch-formula.d.ts +16 -0
  93. package/dist/formulas/index.d.ts +1 -0
  94. package/dist/formulas/use-get-shared-formula.d.ts +95 -0
  95. package/dist/highcharts-memorized.d.ts +4 -3
  96. package/dist/index.d.ts +3 -1
  97. package/dist/index.js +8974 -71500
  98. package/dist/models/dashboard/get-dashboard-models.d.ts +1 -1
  99. package/dist/models/dashboard/types.d.ts +1 -1
  100. package/dist/models/dashboard/use-get-dashboard-model.d.ts +1 -1
  101. package/dist/models/widget/get-widget-model.d.ts +4 -0
  102. package/dist/models/widget/index.d.ts +3 -1
  103. package/dist/models/widget/translate-widget.d.ts +1 -1
  104. package/dist/models/widget/use-get-widget-model.d.ts +102 -0
  105. package/dist/models/widget/widget-model.d.ts +122 -0
  106. package/dist/props.d.ts +30 -11
  107. package/dist/query/execute-query.d.ts +2 -0
  108. package/dist/query-execution/csv-query-state-reducer.d.ts +2 -0
  109. package/dist/query-execution/index.d.ts +4 -3
  110. package/dist/query-execution/query-state-reducer.d.ts +1 -58
  111. package/dist/query-execution/types.d.ts +190 -0
  112. package/dist/query-execution/use-execute-csv-query.d.ts +82 -0
  113. package/dist/query-execution/use-execute-query-by-widget-id.d.ts +2 -37
  114. package/dist/query-execution/use-execute-query.d.ts +8 -33
  115. package/dist/table/hooks/use-table-data.d.ts +5 -1
  116. package/dist/table/table.d.ts +3 -0
  117. package/dist/table-widget-5f3b1d03.js +64456 -0
  118. package/dist/themes/colors.d.ts +86 -0
  119. package/dist/translation/resources/en.d.ts +31 -0
  120. package/dist/translation/resources/index.d.ts +62 -0
  121. package/dist/types.d.ts +6 -0
  122. package/dist/utils/utility-types.d.ts +4 -0
  123. package/dist/widgets/common/drilldown-breadcrumbs/drilldown-breadcrumbs-navigation.d.ts +8 -0
  124. package/dist/widgets/common/drilldown-breadcrumbs/styled-buttons.d.ts +11 -0
  125. package/dist/widgets/common/widget-header-info-button.d.ts +8 -0
  126. package/dist/widgets/common/widget-header.d.ts +1 -1
  127. package/package.json +27 -8
  128. package/dist/models/widget/types.d.ts +0 -6
@@ -3,7 +3,7 @@ export interface GetDashboardModelsOptions {
3
3
  /**
4
4
  * Dashboard title to search by
5
5
  *
6
- * The dashboard title is not unique, therefore, the result may return multiple dashboards.
6
+ * Dashboard titles are not necessarily unique, so the result may contain multiple dashboards.
7
7
  */
8
8
  searchByTitle?: string;
9
9
  /**
@@ -1,5 +1,5 @@
1
1
  import { type DataSource } from '@sisense/sdk-data';
2
- import { type WidgetModel } from '../widget/types';
2
+ import { WidgetModel } from '../widget/widget-model';
3
3
  export type DashboardModel = {
4
4
  oid: string;
5
5
  title: string;
@@ -6,7 +6,7 @@ import { HookEnableParam } from '../../common/hooks/types';
6
6
  */
7
7
  export interface GetDashboardModelParams extends GetDashboardModelOptions, HookEnableParam {
8
8
  /**
9
- * Identifier of the dashboard that contains the widget
9
+ * Dashboard identifier
10
10
  */
11
11
  dashboardOid: string;
12
12
  }
@@ -0,0 +1,4 @@
1
+ import { HttpClient } from '@sisense/sdk-rest-client';
2
+ import { WidgetModel } from './widget-model';
3
+ /** @internal */
4
+ export declare function getWidgetModel(httpClient: HttpClient, dashboardOid: string, widgetOid: string): Promise<WidgetModel>;
@@ -1,2 +1,4 @@
1
- export * from './types';
2
1
  export * from './translate-widget';
2
+ export * from './widget-model';
3
+ export * from './get-widget-model';
4
+ export * from './use-get-widget-model';
@@ -1,3 +1,3 @@
1
1
  import { WidgetDto } from '../../dashboard-widget/types';
2
- import { WidgetModel } from './types';
2
+ import { WidgetModel } from './widget-model';
3
3
  export declare function translateWidget(widget: WidgetDto): WidgetModel;
@@ -0,0 +1,102 @@
1
+ import { HookEnableParam } from '../../common/hooks/types';
2
+ import { WidgetModel } from './widget-model';
3
+ /**
4
+ * Parameters for {@link useGetWidgetModel} hook.
5
+ */
6
+ export interface GetWidgetModelParams extends HookEnableParam {
7
+ /**
8
+ * Identifier of the dashboard that contains the widget
9
+ */
10
+ dashboardOid: string;
11
+ /**
12
+ * Identifier of the widget to be retrieved
13
+ */
14
+ widgetOid: string;
15
+ }
16
+ /**
17
+ * States of a widget model load.
18
+ */
19
+ export type WidgetModelState = WidgetModelLoadingState | WidgetModelErrorState | WidgetModelSuccessState;
20
+ /**
21
+ * State of a widget model that is loading.
22
+ */
23
+ export type WidgetModelLoadingState = {
24
+ /** Whether the widget model is loading */
25
+ isLoading: true;
26
+ /** Whether the widget model load has failed */
27
+ isError: false;
28
+ /** Whether the widget model load has succeeded */
29
+ isSuccess: false;
30
+ /** Error, if one occurred */
31
+ error: undefined;
32
+ /** Widget model, if the load succeeded */
33
+ widget: WidgetModel | undefined;
34
+ /** Loading status */
35
+ status: 'loading';
36
+ };
37
+ /**
38
+ * State of a widget model load that has failed.
39
+ */
40
+ export type WidgetModelErrorState = {
41
+ /** Whether the widget model is loading */
42
+ isLoading: false;
43
+ /** Whether the widget model load has failed */
44
+ isError: true;
45
+ /** Whether the widget model load has succeeded */
46
+ isSuccess: false;
47
+ /** Error, if one occurred */
48
+ error: Error;
49
+ /** Widget model, if the load succeeded */
50
+ widget: undefined;
51
+ /** Loading status */
52
+ status: 'error';
53
+ };
54
+ /**
55
+ * State of a widget model load that has succeeded.
56
+ */
57
+ export type WidgetModelSuccessState = {
58
+ /** Whether the widget model is loading */
59
+ isLoading: false;
60
+ /** Whether the widget model load has failed */
61
+ isError: false;
62
+ /** Whether the widget model load has succeeded */
63
+ isSuccess: true;
64
+ /** Error, if one occurred */
65
+ error: undefined;
66
+ /** Widget model, if the load succeeded */
67
+ widget: WidgetModel;
68
+ /** Loading status */
69
+ status: 'success';
70
+ };
71
+ /**
72
+ * React hook that retrieves an existing widget model from the Sisense instance.
73
+ *
74
+ * @example
75
+ * An example of retrieving an existing widget model from the Sisense instance:
76
+ ```tsx
77
+ const { widget, isLoading, isError } = useGetWidgetModel({
78
+ dashboardOid: '6448665edac1920034bce7a8',
79
+ widgetOid: '6448665edac1920034bce7a8',
80
+ });
81
+ if (isLoading) {
82
+ return <div>Loading...</div>;
83
+ }
84
+ if (isError) {
85
+ return <div>Error</div>;
86
+ }
87
+ if (widget) {
88
+ return (
89
+ <Chart {...widget.getChartProps()} />
90
+ );
91
+ }
92
+ return null;
93
+ ```
94
+ * @param params - Parameters of the widget to be retrieved
95
+ * @returns Widget load state that contains the status of the execution, the result widget model, or the error if one has occurred
96
+ */
97
+ export declare const useGetWidgetModel: (params: GetWidgetModelParams) => WidgetModelState;
98
+ /**
99
+ * {@link useGetWidgetModel} without tracking to be used inside other hooks or components in Compose SDK.
100
+ * @internal
101
+ */
102
+ export declare function useGetWidgetModelInternal(params: GetWidgetModelParams): WidgetModelState;
@@ -0,0 +1,122 @@
1
+ import { Filter } from '@sisense/sdk-data';
2
+ import { ChartDataOptions, TableDataOptions } from '../../chart-data-options/types';
3
+ import { WidgetDto, WidgetType } from '../../dashboard-widget/types';
4
+ import { ChartProps, ChartWidgetProps, TableProps, TableWidgetProps } from '../../props';
5
+ import { ExecuteQueryParams } from '../../query-execution';
6
+ import { ChartType, DrilldownOptions, StyleOptions, TableStyleOptions } from '../../types';
7
+ /**
8
+ * Widget data options.
9
+ */
10
+ export type WidgetDataOptions = ChartDataOptions | TableDataOptions;
11
+ /**
12
+ * Model of Sisense widget defined in the abstractions of Compose SDK.
13
+ */
14
+ export declare class WidgetModel {
15
+ /**
16
+ * Unique identifier of the widget.
17
+ */
18
+ oid: string;
19
+ /**
20
+ * Widget title.
21
+ */
22
+ title: string;
23
+ /**
24
+ * Widget description.
25
+ */
26
+ description: string;
27
+ /**
28
+ * Full name of the widget data source.
29
+ */
30
+ dataSource: string;
31
+ /**
32
+ * Widget type.
33
+ */
34
+ widgetType: WidgetType;
35
+ /**
36
+ * Widget data options.
37
+ */
38
+ dataOptions: WidgetDataOptions;
39
+ /**
40
+ * Widget style options.
41
+ */
42
+ styleOptions: StyleOptions | TableStyleOptions;
43
+ /**
44
+ * Widget filters.
45
+ */
46
+ filters: Filter[];
47
+ /**
48
+ * Widget highlights.
49
+ */
50
+ highlights: Filter[];
51
+ /**
52
+ * Widget chart type.
53
+ */
54
+ chartType?: ChartType;
55
+ /**
56
+ * Widget drilldown options.
57
+ */
58
+ drilldownOptions: DrilldownOptions;
59
+ /**
60
+ * Creates a new widget model.
61
+ *
62
+ * @param widgetDto - The widget DTO to be converted to a widget model
63
+ *
64
+ * @internal
65
+ */
66
+ constructor(widgetDto: WidgetDto);
67
+ /**
68
+ * Returns the parameters to be used for executing a query for the widget.
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * const {data, isLoading, isError} = useExecuteQuery(widget.getExecuteQueryParams());
73
+ * ```
74
+ */
75
+ getExecuteQueryParams(): ExecuteQueryParams;
76
+ /**
77
+ * Returns the props to be used for rendering a chart.
78
+
79
+ * @example
80
+ * ```tsx
81
+ * <Chart {...widget.getChartProps()} />
82
+ * ```
83
+ *
84
+ * Note: this method is not supported for tabular widgets.
85
+ * Use {@link getTableProps} instead for getting props for the <Table> component.
86
+ */
87
+ getChartProps(): ChartProps;
88
+ /**
89
+ * Returns the props to be used for rendering a table.
90
+ * @example
91
+ * ```tsx
92
+ * <Table {...widget.getTableProps()} />
93
+ * ```
94
+ *
95
+ * Note: this method is not supported for chart widgets.
96
+ * Use {@link getChartProps} instead for getting props for the <Chart> component.
97
+ */
98
+ getTableProps(): TableProps;
99
+ /**
100
+ * Returns the props to be used for rendering a chart widget.
101
+ * @example
102
+ * ```tsx
103
+ * <ChartWidget {...widget.getChartWidgetProps()} />
104
+ * ```
105
+ *
106
+ * Note: this method is not supported for tabular widgets.
107
+ */
108
+ getChartWidgetProps(): ChartWidgetProps;
109
+ /**
110
+ * Returns the props to be used for rendering a table widget.
111
+ * @example
112
+ * ```tsx
113
+ * <TableWidget {...widget.getTableWidgetProps()} />
114
+ * ```
115
+ *
116
+ * Note: this method is not supported for chart widgets.
117
+ * Use {@link getChartWidgetProps} instead for getting props for the <ChartWidget> component.
118
+ *
119
+ * @internal
120
+ */
121
+ getTableWidgetProps(): TableWidgetProps;
122
+ }
package/dist/props.d.ts CHANGED
@@ -7,6 +7,7 @@ import { DataPointEventHandler, DataPointsEventHandler, ScatterDataPointEventHan
7
7
  import { AppConfig } from './app/client-application';
8
8
  import { ExecuteQueryParams } from './query-execution';
9
9
  import { FiltersMergeStrategy } from './dashboard-widget/types';
10
+ import { HookEnableParam } from './common/hooks/types';
10
11
  export type { ScatterDataPointEventHandler, ScatterDataPointsEventHandler, DataPointEventHandler, DataPointsEventHandler, MenuItemSection, HighchartsOptions, };
11
12
  /**
12
13
  * Configurations for Sisense Context
@@ -613,7 +614,6 @@ export interface ChartWidgetProps extends BaseChartEventProps {
613
614
  /**
614
615
  * List of categories to allow drilldowns on
615
616
  *
616
- * @deprecated Use {@link DrilldownWidget} instead
617
617
  * @category Widget
618
618
  */
619
619
  drilldownOptions?: DrilldownOptions;
@@ -821,21 +821,21 @@ export interface SunburstChartProps extends BaseChartProps, ChartEventProps {
821
821
  /**
822
822
  * Props for {@link ContextMenu} component.
823
823
  */
824
- export type ContextMenuProps = {
824
+ export interface ContextMenuProps {
825
825
  /**
826
- * Position of the context menu
826
+ * Context menu position
827
827
  *
828
828
  * @category Widget
829
829
  */
830
830
  position?: MenuPosition | null;
831
831
  /**
832
- * Callback function that is evaluated when context menu is closed
832
+ * Callback function that is evaluated when the context menu is closed
833
833
  *
834
834
  * @category Widget
835
835
  */
836
836
  closeContextMenu: () => void;
837
837
  /**
838
- * Sections of menu items
838
+ * Menu item sections
839
839
  *
840
840
  * @category Widget
841
841
  */
@@ -846,8 +846,8 @@ export type ContextMenuProps = {
846
846
  * @category Widget
847
847
  */
848
848
  children?: React.ReactNode;
849
- };
850
- export type DrilldownBreadcrumbsProps = {
849
+ }
850
+ export interface DrilldownBreadcrumbsProps {
851
851
  /**
852
852
  * List of drilldown filters formatted to be displayed as breadcrumbs
853
853
  *
@@ -861,7 +861,7 @@ export type DrilldownBreadcrumbsProps = {
861
861
  */
862
862
  currentDimension: Attribute;
863
863
  /**
864
- * Callback function that is evaluated when X button is clicked
864
+ * Callback function that is evaluated when the close (X) button is clicked
865
865
  *
866
866
  * @category Widget
867
867
  */
@@ -872,7 +872,7 @@ export type DrilldownBreadcrumbsProps = {
872
872
  * @category Widget
873
873
  */
874
874
  sliceDrilldownSelections: (i: number) => void;
875
- };
875
+ }
876
876
  /**
877
877
  * An object that allows users to pass advanced configuration options as a prop for the {@link DrilldownWidget} component
878
878
  */
@@ -901,7 +901,7 @@ export type DrilldownWidgetConfig = {
901
901
  /**
902
902
  * Props for the {@link DrilldownWidget} component
903
903
  */
904
- export type DrilldownWidgetProps = {
904
+ export interface DrilldownWidgetProps {
905
905
  /**
906
906
  * List of dimensions to allow drilldowns on
907
907
  *
@@ -928,4 +928,23 @@ export type DrilldownWidgetProps = {
928
928
  * @category Widget
929
929
  */
930
930
  children: (customDrilldownResult: CustomDrilldownResult) => ReactNode;
931
- };
931
+ }
932
+ /**
933
+ * Params of the {@link useGetSharedFormula} hook
934
+ *
935
+ * Can consist either of an oid or a name/dataSource pair
936
+ */
937
+ export interface UseGetSharedFormulaParams extends HookEnableParam {
938
+ /**
939
+ * Formula identifier
940
+ */
941
+ oid?: string;
942
+ /**
943
+ * Formula name
944
+ */
945
+ name?: string;
946
+ /**
947
+ * Data source - e.g. `Sample ECommerce`
948
+ */
949
+ dataSource?: DataSource;
950
+ }
@@ -17,3 +17,5 @@ export declare const QUERY_DEFAULT_LIMIT = 20000;
17
17
  export declare const QUERY_DEFAULT_OFFSET = 0;
18
18
  /** @internal */
19
19
  export declare const executeQuery: (queryDescription: QueryDescription, app: ClientApplication, executionConfig?: QueryExecutionConfig) => Promise<QueryResultData>;
20
+ /** @internal */
21
+ export declare const executeCsvQuery: (queryDescription: QueryDescription, app: ClientApplication, executionConfig?: QueryExecutionConfig) => Promise<Blob>;
@@ -0,0 +1,2 @@
1
+ import { CsvQueryAction, CsvQueryState } from './types.js';
2
+ export declare function downloadCsvQueryStateReducer(state: CsvQueryState, action: CsvQueryAction): CsvQueryState;
@@ -1,5 +1,6 @@
1
1
  export { ExecuteQuery } from './execute-query';
2
- export { useExecuteQuery, type ExecuteQueryParams } from './use-execute-query';
2
+ export { useExecuteQuery } from './use-execute-query';
3
+ export { useExecuteCsvQuery } from './use-execute-csv-query';
3
4
  export { ExecuteQueryByWidgetId } from './execute-query-by-widget-id';
4
- export { useExecuteQueryByWidgetId, type ExecuteQueryByWidgetIdParams, type QueryByWidgetIdState, executeQueryByWidgetId, } from './use-execute-query-by-widget-id';
5
- export type { QueryState, QueryLoadingState, QuerySuccessState, QueryErrorState, } from './query-state-reducer';
5
+ export { useExecuteQueryByWidgetId, executeQueryByWidgetId, } from './use-execute-query-by-widget-id';
6
+ export type { QueryState, QueryLoadingState, QuerySuccessState, QueryErrorState, CsvQueryState, CsvQueryLoadingState, CsvQuerySuccessState, CsvQueryErrorState, ExecuteQueryParams, ExecuteCsvQueryParams, ExecuteQueryByWidgetIdParams, QueryByWidgetIdState, } from './types';
@@ -1,59 +1,2 @@
1
- import { QueryResultData } from '@sisense/sdk-data';
2
- import { DataLoadAction } from '../common/hooks/data-load-state-reducer';
3
- /**
4
- * State of a query execution.
5
- */
6
- export type QueryState = QueryLoadingState | QueryErrorState | QuerySuccessState;
7
- /**
8
- * State of a query execution that is loading.
9
- */
10
- export type QueryLoadingState = {
11
- /** Whether the query is loading */
12
- isLoading: true;
13
- /** Whether the query has failed */
14
- isError: false;
15
- /** Whether the query has succeeded */
16
- isSuccess: false;
17
- /** The error if any occurred */
18
- error: undefined;
19
- /** The result data if the query has succeeded */
20
- data: QueryResultData | undefined;
21
- /** The status of the query execution */
22
- status: 'loading';
23
- };
24
- /**
25
- * State of a query execution that has failed.
26
- */
27
- export type QueryErrorState = {
28
- /** Whether the query is loading */
29
- isLoading: false;
30
- /** Whether the query has failed */
31
- isError: true;
32
- /** Whether the query has succeeded */
33
- isSuccess: false;
34
- /** The error if any occurred */
35
- error: Error;
36
- /** The result data if the query has succeeded */
37
- data: undefined;
38
- /** The status of the query execution */
39
- status: 'error';
40
- };
41
- /**
42
- * State of a query execution that has succeeded.
43
- */
44
- export type QuerySuccessState = {
45
- /** Whether the query is loading */
46
- isLoading: false;
47
- /** Whether the query has failed */
48
- isError: false;
49
- /** Whether the query has succeeded */
50
- isSuccess: true;
51
- /** The error if any occurred */
52
- error: undefined;
53
- /** The result data if the query has succeeded */
54
- data: QueryResultData;
55
- /** The status of the query execution */
56
- status: 'success';
57
- };
58
- export type QueryAction = DataLoadAction<QueryResultData>;
1
+ import { QueryAction, QueryState } from './types';
59
2
  export declare function queryStateReducer(state: QueryState, action: QueryAction): QueryState;
@@ -0,0 +1,190 @@
1
+ import { Attribute, DataSource, Filter, Measure, QueryResultData } from '@sisense/sdk-data';
2
+ import { DataLoadAction } from '../common/hooks/data-load-state-reducer';
3
+ import { FiltersMergeStrategy } from '../dashboard-widget/types';
4
+ /**
5
+ * State of a query execution.
6
+ */
7
+ export type CsvQueryState = CsvQueryLoadingState | CsvQueryErrorState | CsvQuerySuccessState;
8
+ /**
9
+ * State of a query execution that is loading.
10
+ */
11
+ export type CsvQueryLoadingState = {
12
+ /** Whether the query is loading */
13
+ isLoading: true;
14
+ /** Whether the query has failed */
15
+ isError: false;
16
+ /** Whether the query has succeeded */
17
+ isSuccess: false;
18
+ /** The error if any occurred */
19
+ error: undefined;
20
+ /** The result data if the query has succeeded */
21
+ data: Blob | string | undefined;
22
+ /** The status of the query execution */
23
+ status: 'loading';
24
+ };
25
+ /**
26
+ * State of a query execution that has failed.
27
+ */
28
+ export type CsvQueryErrorState = {
29
+ /** Whether the query is loading */
30
+ isLoading: false;
31
+ /** Whether the query has failed */
32
+ isError: true;
33
+ /** Whether the query has succeeded */
34
+ isSuccess: false;
35
+ /** The error if any occurred */
36
+ error: Error;
37
+ /** The result data if the query has succeeded */
38
+ data: undefined;
39
+ /** The status of the query execution */
40
+ status: 'error';
41
+ };
42
+ /**
43
+ * State of a query execution that has succeeded.
44
+ */
45
+ export type CsvQuerySuccessState = {
46
+ /** Whether the query is loading */
47
+ isLoading: false;
48
+ /** Whether the query has failed */
49
+ isError: false;
50
+ /** Whether the query has succeeded */
51
+ isSuccess: true;
52
+ /** The error if any occurred */
53
+ error: undefined;
54
+ /** The result data if the query has succeeded */
55
+ data: Blob | string;
56
+ /** The status of the query execution */
57
+ status: 'success';
58
+ };
59
+ export type CsvQueryAction = DataLoadAction<Blob | string>;
60
+ /**
61
+ * State of a query execution.
62
+ */
63
+ export type QueryState = QueryLoadingState | QueryErrorState | QuerySuccessState;
64
+ /**
65
+ * State of a query execution that is loading.
66
+ */
67
+ export type QueryLoadingState = {
68
+ /** Whether the query is loading */
69
+ isLoading: true;
70
+ /** Whether the query has failed */
71
+ isError: false;
72
+ /** Whether the query has succeeded */
73
+ isSuccess: false;
74
+ /** The error if any occurred */
75
+ error: undefined;
76
+ /** The result data if the query has succeeded */
77
+ data: QueryResultData | undefined;
78
+ /** The status of the query execution */
79
+ status: 'loading';
80
+ };
81
+ /**
82
+ * State of a query execution that has failed.
83
+ */
84
+ export type QueryErrorState = {
85
+ /** Whether the query is loading */
86
+ isLoading: false;
87
+ /** Whether the query has failed */
88
+ isError: true;
89
+ /** Whether the query has succeeded */
90
+ isSuccess: false;
91
+ /** The error if any occurred */
92
+ error: Error;
93
+ /** The result data if the query has succeeded */
94
+ data: undefined;
95
+ /** The status of the query execution */
96
+ status: 'error';
97
+ };
98
+ /**
99
+ * State of a query execution that has succeeded.
100
+ */
101
+ export type QuerySuccessState = {
102
+ /** Whether the query is loading */
103
+ isLoading: false;
104
+ /** Whether the query has failed */
105
+ isError: false;
106
+ /** Whether the query has succeeded */
107
+ isSuccess: true;
108
+ /** The error if any occurred */
109
+ error: undefined;
110
+ /** The result data if the query has succeeded */
111
+ data: QueryResultData;
112
+ /** The status of the query execution */
113
+ status: 'success';
114
+ };
115
+ export type QueryAction = DataLoadAction<QueryResultData>;
116
+ /**
117
+ * Parameters for {@link useExecuteQueryByWidgetId} hook.
118
+ */
119
+ export interface ExecuteQueryByWidgetIdParams {
120
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.widgetOid} */
121
+ widgetOid: string;
122
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.dashboardOid} */
123
+ dashboardOid: string;
124
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.filters} */
125
+ filters?: Filter[];
126
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.highlights} */
127
+ highlights?: Filter[];
128
+ /** {@inheritDoc ExecuteQueryProps.count} */
129
+ count?: number;
130
+ /** {@inheritDoc ExecuteQueryProps.offset} */
131
+ offset?: number;
132
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.filtersMergeStrategy} */
133
+ filtersMergeStrategy?: FiltersMergeStrategy;
134
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.includeDashboardFilters} */
135
+ includeDashboardFilters?: boolean;
136
+ /** {@inheritDoc ExecuteQueryByWidgetIdProps.onBeforeQuery} */
137
+ onBeforeQuery?: (jaql: any) => any | Promise<any>;
138
+ /**
139
+ * Boolean flag to control if query is executed
140
+ *
141
+ * If not specified, the default value is `true`
142
+ */
143
+ enabled?: boolean;
144
+ }
145
+ export type QueryByWidgetIdState = QueryState & {
146
+ /** Query parameters constructed over the widget */
147
+ query: ExecuteQueryParams | undefined;
148
+ };
149
+ /**
150
+ * Parameters for {@link useExecuteQuery} hook.
151
+ */
152
+ export interface ExecuteQueryParams {
153
+ /**
154
+ * Data source the query is run against - e.g. `Sample ECommerce`
155
+ *
156
+ * If not specified, the query will use the `defaultDataSource` specified in the parent Sisense Context.
157
+ */
158
+ dataSource?: DataSource;
159
+ /** Dimensions of the query */
160
+ dimensions?: Attribute[];
161
+ /** Measures of the query */
162
+ measures?: Measure[];
163
+ /** Filters that will slice query results */
164
+ filters?: Filter[];
165
+ /** Highlight filters that will highlight results that pass filter criteria */
166
+ highlights?: Filter[];
167
+ /** {@inheritDoc ExecuteQueryProps.count} */
168
+ count?: number;
169
+ /** {@inheritDoc ExecuteQueryProps.offset} */
170
+ offset?: number;
171
+ /**
172
+ * Boolean flag to control if query is executed
173
+ *
174
+ * If not specified, the default value is `true`
175
+ */
176
+ enabled?: boolean;
177
+ /** {@inheritDoc ExecuteQueryProps.onBeforeQuery} */
178
+ onBeforeQuery?: (jaql: any) => any | Promise<any>;
179
+ }
180
+ /**
181
+ * Parameters for {@link useExecuteCsvQuery} hook.
182
+ */
183
+ export interface ExecuteCsvQueryParams extends ExecuteQueryParams {
184
+ config?: {
185
+ /**
186
+ * If set to true, the data will be returned as a Blob.
187
+ */
188
+ asDataStream?: boolean;
189
+ };
190
+ }