@sisense/sdk-ui 2.24.0 → 2.25.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 (123) hide show
  1. package/dist/ai.cjs +59 -59
  2. package/dist/ai.js +919 -980
  3. package/dist/analytics-composer/node.cjs +1 -1
  4. package/dist/analytics-composer/node.js +856 -1030
  5. package/dist/analytics-composer.cjs +1 -1
  6. package/dist/analytics-composer.js +6 -6
  7. package/dist/{execute-query-b9oy2Egy.js → apply-styled-options-to-query-BsBTwL6W.js} +1518 -1446
  8. package/dist/apply-styled-options-to-query-mFJvsssw.cjs +1 -0
  9. package/dist/{index-Ck-0gJC9.cjs → index-BX9p-XrU.cjs} +1 -1
  10. package/dist/{index-r66Tjiqj.js → index-D7mHzfx0.js} +9 -0
  11. package/dist/index.cjs +467 -452
  12. package/dist/index.js +25112 -32394
  13. package/dist/index.umd.js +708 -685
  14. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/types.d.ts +1 -1
  15. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/persist-dashboard-model-middleware.d.ts +17 -5
  16. package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/types.d.ts +4 -1
  17. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/duplicate-widget/use-duplicate-widget-menu-item.d.ts +1 -1
  18. package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/rename-widget/use-widget-renaming.d.ts +1 -1
  19. package/dist/packages/sdk-ui/src/domains/dashboarding/index.d.ts +2 -0
  20. package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/persistence-manager.d.ts +11 -0
  21. package/dist/packages/sdk-ui/src/domains/dashboarding/persistence/types.d.ts +52 -0
  22. package/dist/packages/sdk-ui/src/domains/dashboarding/types.d.ts +5 -28
  23. package/dist/packages/sdk-ui/src/domains/dashboarding/use-composed-dashboard.d.ts +4 -2
  24. package/dist/packages/sdk-ui/src/domains/narrative/components/narrative-collapsible.d.ts +13 -0
  25. package/dist/packages/sdk-ui/src/domains/narrative/components/narrative-top-slot-shell.d.ts +21 -0
  26. package/dist/packages/sdk-ui/src/domains/narrative/components/widget-narrative-interactive.d.ts +11 -0
  27. package/dist/packages/sdk-ui/src/domains/narrative/components/widget-narrative.d.ts +40 -0
  28. package/dist/packages/sdk-ui/src/domains/narrative/core/build-narrative-request.d.ts +36 -0
  29. package/dist/packages/sdk-ui/src/domains/narrative/core/get-narrative-dimensions-and-measures.d.ts +22 -0
  30. package/dist/packages/sdk-ui/src/domains/narrative/core/widget-narrative-options.d.ts +28 -0
  31. package/dist/packages/sdk-ui/src/domains/narrative/core/widget-props-to-narrative-params.d.ts +36 -0
  32. package/dist/packages/sdk-ui/src/domains/narrative/hooks/use-get-widget-narrative.d.ts +62 -0
  33. package/dist/packages/sdk-ui/src/domains/narrative/hooks/use-widget-narrative-state.d.ts +39 -0
  34. package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/apply-styled-options-to-query.d.ts +87 -0
  35. package/dist/packages/sdk-ui/src/domains/visualizations/core/chart-data-options/translate-data-options.d.ts +13 -1
  36. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/compose-code-to-readable.d.ts +12 -0
  37. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/index.d.ts +6 -0
  38. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-definition.d.ts +26 -0
  39. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-params-to-view-model.d.ts +12 -0
  40. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill-bubble-tooltip.d.ts +12 -0
  41. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/query-pill.d.ts +13 -0
  42. package/dist/packages/sdk-ui/src/domains/visualizations/core/query-definition/types.d.ts +51 -0
  43. package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-style-options/to-widget-dto-style.d.ts +50 -2
  44. package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/utils.d.ts +9 -0
  45. package/dist/packages/sdk-ui/src/domains/widgets/widget-model/widget-model-translator/widget-model-translator.d.ts +5 -2
  46. package/dist/packages/sdk-ui/src/infra/api/narrative/narrative-api-types.d.ts +32 -0
  47. package/dist/packages/sdk-ui/src/infra/api/narrative/narrative-constants.d.ts +6 -0
  48. package/dist/packages/sdk-ui/src/{modules/ai/api/narration-endpoints.d.ts → infra/api/narrative/narrative-endpoints.d.ts} +8 -7
  49. package/dist/packages/sdk-ui/src/infra/api/narrative/send-ai-feedback.d.ts +8 -0
  50. package/dist/packages/sdk-ui/src/infra/contexts/emotion-cache-provider/emotion-cache-provider.d.ts +31 -3
  51. package/dist/packages/sdk-ui/src/infra/contexts/emotion-cache-provider/stylis-plugins/css-selector-prefix-plugin.d.ts +18 -0
  52. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/de-de.d.ts +9 -0
  53. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/en-us.d.ts +9 -0
  54. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-ar.d.ts +9 -0
  55. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-es.d.ts +9 -0
  56. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/fr-fr.d.ts +9 -0
  57. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/it-it.d.ts +9 -0
  58. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ja-jp.d.ts +9 -0
  59. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ko-kr.d.ts +9 -0
  60. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/nl-nl.d.ts +9 -0
  61. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/pt-br.d.ts +9 -0
  62. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ru-ru.d.ts +9 -0
  63. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/tr-tr.d.ts +9 -0
  64. package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/zh-cn.d.ts +9 -0
  65. package/dist/packages/sdk-ui/src/infra/translation/resources/en.d.ts +9 -0
  66. package/dist/packages/sdk-ui/src/infra/translation/resources/index.d.ts +18 -0
  67. package/dist/packages/sdk-ui/src/modules/ai/api/chat-rest-api.d.ts +1 -1
  68. package/dist/packages/sdk-ui/src/modules/ai/api/types.d.ts +5 -18
  69. package/dist/packages/sdk-ui/src/modules/ai/chart/nlq-chart-widget.d.ts +2 -0
  70. package/dist/packages/sdk-ui/src/modules/ai/common/collapsible.d.ts +3 -0
  71. package/dist/packages/sdk-ui/src/modules/ai/get-nlg-insights-from-widget.d.ts +5 -13
  72. package/dist/packages/sdk-ui/src/modules/ai/index.d.ts +1 -1
  73. package/dist/packages/sdk-ui/src/modules/ai/use-get-nlg-insights.d.ts +4 -26
  74. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/types.d.ts +3 -7
  75. package/dist/packages/sdk-ui/src/props.d.ts +1 -1
  76. package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +7 -1
  77. package/dist/packages/sdk-ui/src/types.d.ts +1 -1
  78. package/dist/parse-compose-code-DfZskSng.js +352 -0
  79. package/dist/parse-compose-code-v4J9BrUg.cjs +1 -0
  80. package/dist/translations/de-de.cjs +1 -1
  81. package/dist/translations/de-de.js +10 -1
  82. package/dist/translations/en-us.cjs +1 -1
  83. package/dist/translations/en-us.js +1 -1
  84. package/dist/translations/es-ar.cjs +1 -1
  85. package/dist/translations/es-ar.js +10 -1
  86. package/dist/translations/es-es.cjs +1 -1
  87. package/dist/translations/es-es.js +10 -1
  88. package/dist/translations/fr-fr.cjs +1 -1
  89. package/dist/translations/fr-fr.js +10 -1
  90. package/dist/translations/it-it.cjs +1 -1
  91. package/dist/translations/it-it.js +12 -3
  92. package/dist/translations/ja-jp.cjs +1 -1
  93. package/dist/translations/ja-jp.js +12 -3
  94. package/dist/translations/ko-kr.cjs +1 -1
  95. package/dist/translations/ko-kr.js +12 -3
  96. package/dist/translations/nl-nl.cjs +1 -1
  97. package/dist/translations/nl-nl.js +12 -3
  98. package/dist/translations/pt-br.cjs +1 -1
  99. package/dist/translations/pt-br.js +10 -1
  100. package/dist/translations/ru-ru.cjs +1 -1
  101. package/dist/translations/ru-ru.js +12 -3
  102. package/dist/translations/tr-tr.cjs +1 -1
  103. package/dist/translations/tr-tr.js +10 -1
  104. package/dist/translations/zh-cn.cjs +1 -1
  105. package/dist/translations/zh-cn.js +12 -3
  106. package/dist/{types-DJtC8_5_.js → types-BBp2sp_s.js} +1 -1
  107. package/dist/types-GFLaiax5.cjs +1 -0
  108. package/dist/use-hover-DsnmY-p_.cjs +721 -0
  109. package/dist/{quota-notification-CeKnEyQG.js → use-hover-mptQLQ4S.js} +27603 -19263
  110. package/dist/{utils-D8O1_kl3.cjs → utils-BlNqPAG8.cjs} +45 -45
  111. package/dist/{utils-BCp2ISWh.js → utils-DTUC-wtI.js} +7724 -7512
  112. package/dist/{widget-composer-BkHZISs7.cjs → widget-composer-CDb2iOoS.cjs} +1 -1
  113. package/dist/{widget-composer-CDNL9_XF.js → widget-composer-D0BZrLna.js} +3 -3
  114. package/package.json +11 -10
  115. package/dist/dimensions-C1R5YRt-.js +0 -204
  116. package/dist/dimensions-C7yXAoZs.cjs +0 -1
  117. package/dist/execute-query-0Y9Fn9Pf.cjs +0 -1
  118. package/dist/packages/sdk-ui/src/infra/styled/index.d.ts +0 -4
  119. package/dist/packages/sdk-ui/src/infra/styled/with-css-selector-prefix.d.ts +0 -2
  120. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/query/constants.d.ts +0 -8
  121. package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/parse-compose-code.d.ts +0 -34
  122. package/dist/quota-notification-BqRYSJ7r.cjs +0 -713
  123. package/dist/types-C0QU2tsE.cjs +0 -1
@@ -76,7 +76,7 @@ export type DashboardId = string;
76
76
  */
77
77
  export type WidgetsOptions = Record<WidgetId, SpecificWidgetOptions>;
78
78
  /**
79
- * Options for a specific widget
79
+ * Dashboard-level options for a specific widget
80
80
  */
81
81
  export type SpecificWidgetOptions = {
82
82
  /**
@@ -1,13 +1,25 @@
1
1
  import { RestApi } from '../../../../../infra/api/rest-api';
2
+ import { AppSettings } from '../../../../../infra/app/settings/settings';
3
+ import { CompleteThemeSettings } from '../../../../../types';
2
4
  import { UseDashboardModelInternalAction } from './types.js';
5
+ export type PersistDashboardModelMiddlewareParams = {
6
+ /** Dashboard OID, or undefined if not initialized */
7
+ dashboardOid: string | undefined;
8
+ /** Internal dashboard model action to persist */
9
+ action: UseDashboardModelInternalAction;
10
+ /** Sisense REST API instance */
11
+ restApi: RestApi;
12
+ /** Whether the dashboard is in shared mode */
13
+ sharedMode: boolean;
14
+ /** Application settings forwarded to {@link toWidgetDto} (controls widget design feature flag) */
15
+ appSettings: AppSettings;
16
+ /** Theme settings forwarded to {@link toWidgetDto} (used as defaults for widget design) */
17
+ themeSettings: CompleteThemeSettings;
18
+ };
3
19
  /**
4
20
  * Middleware that persists the dashboard model changes to the Sisense server.
5
21
  *
6
- * @param dashboardOid - Dashboard OID, or undefined if not initialized
7
- * @param action - Internal dashboard model action to persist
8
- * @param restApi - Sisense REST API instance
9
- * @param sharedMode - Whether the dashboard is in shared mode
10
22
  * @returns Promise resolving to the action (possibly transformed, e.g. for ADD_WIDGET)
11
23
  * @internal
12
24
  */
13
- export declare function persistDashboardModelMiddleware(dashboardOid: string | undefined, action: UseDashboardModelInternalAction, restApi: RestApi, sharedMode: boolean): Promise<UseDashboardModelInternalAction>;
25
+ export declare function persistDashboardModelMiddleware({ dashboardOid, action, restApi, sharedMode, appSettings, themeSettings, }: PersistDashboardModelMiddlewareParams): Promise<UseDashboardModelInternalAction>;
@@ -27,9 +27,12 @@ export declare enum UseDashboardModelActionType {
27
27
  * Fields that can be safely patched on a widget without full DTO reconstruction.
28
28
  * Intentionally narrow — extend only when lossless roundtrip is guaranteed.
29
29
  *
30
- * @internal
30
+ * @sisenseInternal
31
31
  */
32
32
  export type WidgetPatch = {
33
+ /**
34
+ * The title of the widget.
35
+ */
33
36
  title?: string;
34
37
  };
35
38
  /**
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { WidgetsOptions, WidgetsPanelLayout } from '../../../../domains/dashboarding/dashboard-model/types.js';
3
3
  import { type WidgetProps } from '../../../../domains/widgets/components/widget/types.js';
4
- import type { DashboardPersistenceManager } from '../../types.js';
4
+ import type { DashboardPersistenceManager } from '../../persistence/types.js';
5
5
  /** Setter for widgets array (e.g. React setState or updater function). */
6
6
  export type SetWidgets = React.Dispatch<React.SetStateAction<WidgetProps[]>>;
7
7
  /** Setter for widgets options array (e.g. React setState or updater function). */
@@ -1,5 +1,5 @@
1
1
  import type { WidgetProps } from '../../../../domains/widgets/components/widget/types.js';
2
- import type { DashboardPersistenceManager } from '../../types.js';
2
+ import type { DashboardPersistenceManager } from '../../persistence/types.js';
3
3
  /** Options for the widget renaming middleware hook. */
4
4
  export type UseWidgetRenamingParams = {
5
5
  /** Current widgets. */
@@ -2,5 +2,7 @@ export { DashboardById } from './dashboard-by-id.js';
2
2
  export { Dashboard } from './dashboard.js';
3
3
  export { useComposedDashboard, useComposedDashboardInternal, type ComposableDashboardProps, type UseComposedDashboardOptions, type ComposedDashboardResult, } from './use-composed-dashboard.js';
4
4
  export { useDashboardTheme, type DashboardThemeParams } from './use-dashboard-theme.js';
5
+ export { createDashboardPersistenceManager } from './persistence/persistence-manager.js';
6
+ export type { DashboardPersistenceManager } from './persistence/types.js';
5
7
  export * from './hooks/index.js';
6
8
  export type { DashboardByIdProps, DashboardProps, DashboardLayoutOptions, DashboardStyleOptions, DashboardConfig, DashboardByIdConfig, WidgetsPanelConfig, EditModeConfig, DashboardFiltersPanelConfig, TabbersConfig, TabberConfig, TabberTabConfig, DashboardChangeEvent, DashboardFiltersUpdatedEvent, DashboardFiltersPanelCollapseChangedEvent, DashboardWidgetsPanelLayoutUpdatedEvent, DashboardWidgetsPanelIsEditingChangedEvent, DashboardWidgetsDeletedEvent, } from './types.js';
@@ -0,0 +1,11 @@
1
+ import type { UseDashboardModelResult } from '../../../domains/dashboarding/dashboard-model';
2
+ import type { DashboardPersistenceManager } from './types.js';
3
+ /**
4
+ * Creates a {@link DashboardPersistenceManager} that forwards add/patch operations through
5
+ * the same `dispatchChanges` function returned by {@link useDashboardModelInternal} /
6
+ *
7
+ * @param dispatchDashboardModelChanges - Dashboard model dispatch (e.g. `dispatchChanges` from `useDashboardModelInternal`)
8
+ * @returns Persistence manager for the composition layer
9
+ * @sisenseInternal
10
+ */
11
+ export declare function createDashboardPersistenceManager(dispatchDashboardModelChanges: UseDashboardModelResult['dispatchChanges']): DashboardPersistenceManager;
@@ -0,0 +1,52 @@
1
+ import type { SpecificWidgetOptions, WidgetPatch, WidgetsPanelLayout } from '../../../domains/dashboarding/dashboard-model';
2
+ import type { WidgetProps } from '../../../domains/widgets/components/widget/types';
3
+ /**
4
+ * Interface for persisting dashboard changes from the composition layer (e.g. add widget).
5
+ *
6
+ * @sisenseInternal
7
+ */
8
+ export type DashboardPersistenceManager = {
9
+ /**
10
+ * Adds a widget to the dashboard.
11
+ * @sisenseInternal
12
+ */
13
+ addWidget: (
14
+ /**
15
+ * The new widget to add.
16
+ */
17
+ widget: WidgetProps,
18
+ /**
19
+ * The layout with the new widget added to it.
20
+ */
21
+ widgetsPanelLayout: WidgetsPanelLayout,
22
+ /**
23
+ * The dashboard-level options for the new widget.
24
+ */
25
+ widgetOptions?: SpecificWidgetOptions) => Promise<{
26
+ /**
27
+ * The persisted widget (possibly modified by the server, e.g. new id).
28
+ */
29
+ widget: WidgetProps;
30
+ /**
31
+ * The layout with updated widget (after server modifications).
32
+ */
33
+ widgetsPanelLayout: WidgetsPanelLayout;
34
+ /**
35
+ * The options for the widget (after server modifications).
36
+ */
37
+ widgetOptions?: SpecificWidgetOptions;
38
+ }>;
39
+ /**
40
+ * Patch a single field (e.g. title) on an existing widget.
41
+ * @sisenseInternal
42
+ */
43
+ patchWidget: (
44
+ /**
45
+ * The oid of the widget to patch.
46
+ */
47
+ widgetOid: string,
48
+ /**
49
+ * The patch to apply to the widget.
50
+ */
51
+ patch: WidgetPatch) => Promise<void>;
52
+ };
@@ -1,9 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { DataSource, Filter, FilterRelations } from '@sisense/sdk-data';
3
- import { DashboardStyleOptions, SpecificWidgetOptions, WidgetPatch, WidgetsOptions, WidgetsPanelLayout } from '../../domains/dashboarding/dashboard-model';
3
+ import { DashboardStyleOptions, WidgetsOptions, WidgetsPanelLayout } from '../../domains/dashboarding/dashboard-model';
4
4
  import { TabbersConfig } from '../../domains/dashboarding/hooks/use-tabber';
5
5
  import { FiltersPanelConfig } from '../../domains/filters/components/filters-panel/types';
6
6
  import { WidgetProps } from '../../domains/widgets/components/widget/types';
7
+ import type { DashboardPersistenceManager } from './persistence/types.js';
7
8
  export type { DashboardStyleOptions, SpecificWidgetOptions, WidgetsPanelColumnLayout, WidgetsPanelLayout, WidgetsPanelCell, WidgetsPanelRow, WidgetsPanelColumn, } from '../../domains/dashboarding/dashboard-model';
8
9
  export type { TabbersConfig, TabberConfig, TabberTabConfig, } from '../../domains/dashboarding/hooks/use-tabber';
9
10
  /**
@@ -331,32 +332,7 @@ export interface DashboardLayoutOptions {
331
332
  */
332
333
  widgetsPanel?: WidgetsPanelLayout;
333
334
  }
334
- /**
335
- * Interface for persisting dashboard changes from the composition layer (e.g. add widget).
336
- *
337
- * @internal
338
- */
339
- export type DashboardPersistenceManager = {
340
- /**
341
- * Adds a widget to the dashboard.
342
- *
343
- * @param widget - The widget to add.
344
- * @param widgetsPanelLayout - The layout to add the widget to.
345
- * @param widgetOptions - The options for the widget.
346
- * @returns The persisted widget (possibly modified by the server, e.g. new id), the new widgets panel layout and the widget options.
347
- */
348
- addWidget: (widget: WidgetProps, widgetsPanelLayout: WidgetsPanelLayout, widgetOptions?: SpecificWidgetOptions) => Promise<{
349
- widget: WidgetProps;
350
- widgetsPanelLayout: WidgetsPanelLayout;
351
- widgetOptions?: SpecificWidgetOptions;
352
- }>;
353
- /**
354
- * Patch a single field (e.g. title) on an existing widget.
355
- *
356
- * @internal
357
- */
358
- patchWidget: (widgetOid: string, patch: WidgetPatch) => Promise<void>;
359
- };
335
+ export type { DashboardPersistenceManager };
360
336
  /**
361
337
  * Props for the Dashboard component
362
338
  */
@@ -397,7 +373,8 @@ export interface DashboardProps {
397
373
  */
398
374
  onChange?: (event: DashboardChangeEvent) => void;
399
375
  /**
400
- * @internal
376
+ * Persistence manager for the dashboard
377
+ * @sisenseInternal
401
378
  */
402
379
  persistence?: DashboardPersistenceManager;
403
380
  }
@@ -1,6 +1,7 @@
1
1
  import { Filter, FilterRelations } from '@sisense/sdk-data';
2
2
  import type { WidgetsPanelLayout } from '../../domains/dashboarding/dashboard-model';
3
- import { DashboardPersistenceManager, DashboardProps } from './types.js';
3
+ import type { DashboardPersistenceManager } from './persistence/types.js';
4
+ import { DashboardProps } from './types.js';
4
5
  export type ComposableDashboardProps = Pick<DashboardProps, 'filters' | 'widgets' | 'widgetsOptions' | 'layoutOptions' | 'config'>;
5
6
  export type UseComposedDashboardOptions = {
6
7
  /**
@@ -8,7 +9,8 @@ export type UseComposedDashboardOptions = {
8
9
  */
9
10
  onFiltersChange?: (filters: Filter[] | FilterRelations) => void;
10
11
  /**
11
- * @internal
12
+ * Persistence manager for the dashboard
13
+ * @sisenseInternal
12
14
  */
13
15
  persistence?: DashboardPersistenceManager;
14
16
  /**
@@ -0,0 +1,13 @@
1
+ type NarrativeCollapsibleProps = {
2
+ text: string;
3
+ };
4
+ /**
5
+ * Text container with an expand/collapse control for long narrative text.
6
+ *
7
+ * Uses `max-height` + `overflow: hidden` when collapsed (not `line-clamp`), because
8
+ * `white-space: pre-wrap` is incompatible with `-webkit-line-clamp` in browsers.
9
+ *
10
+ * @internal
11
+ */
12
+ export declare function NarrativeCollapsible({ text }: NarrativeCollapsibleProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { Themable } from '../../../infra/contexts/theme-provider/types.js';
3
+ /** Horizontal space before the AI icon in the default (interactive) narrative row. */
4
+ export declare const NARRATIVE_TOP_SLOT_LEADING_GUTTER_PX = 18;
5
+ /** Space after feedback controls (interactive) and plain narrative right inset. */
6
+ export declare const NARRATIVE_TOP_SLOT_TRAILING_GUTTER_PX = 12;
7
+ /**
8
+ * Full-bleed chart panel styling for narrative content in a widget top slot,
9
+ * so it visually continues into the chart content area (same colors, no gray gutters).
10
+ *
11
+ * Use `$horizontalInset` for plain narrative (no leading AI icon) so text aligns with the
12
+ * interactive variant and sits off the container edge.
13
+ *
14
+ * @internal
15
+ */
16
+ export declare const NarrativeTopSlotShell: import("@emotion/styled").StyledComponent<{
17
+ theme?: import("@emotion/react").Theme | undefined;
18
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
19
+ } & Themable & {
20
+ $horizontalInset?: boolean | undefined;
21
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,11 @@
1
+ import type { NarrativeRequest } from '../../../infra/api/narrative/narrative-api-types.js';
2
+ export type WidgetNarrativeInteractiveProps = {
3
+ summary: string;
4
+ narrativeRequest: NarrativeRequest;
5
+ };
6
+ /**
7
+ * Chart-area narrative text with optional thumbs feedback; mirrors legacy ChartInsights without `modules/ai`.
8
+ *
9
+ * @internal
10
+ */
11
+ export declare function WidgetNarrativeInteractive({ summary, narrativeRequest, }: WidgetNarrativeInteractiveProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,40 @@
1
+ /// <reference types="react" />
2
+ import { WidgetProps } from '../../../domains/widgets/components/widget/types';
3
+ import type { WidgetNarrativeOptions } from '../core/widget-narrative-options.js';
4
+ /**
5
+ * Props for {@link WidgetNarrative}.
6
+ *
7
+ * @sisenseInternal
8
+ */
9
+ export type WidgetNarrativeProps = {
10
+ /** Widget whose query drives the narrative (chart or pivot). */
11
+ widgetProps: WidgetProps;
12
+ /**
13
+ * `default` — collapsible narrative with AI feedback actions (same pattern as NLQ chart insights).
14
+ * `plain` — collapsible text only (similar to the `GetNlgInsights` component).
15
+ */
16
+ variant?: 'default' | 'plain';
17
+ /** When false, the narrative query does not run (see {@link useWidgetNarrativeState}). */
18
+ enabled?: boolean;
19
+ } & WidgetNarrativeOptions;
20
+ /**
21
+ * Renders a natural-language narrative for chart or pivot `WidgetProps`. The request uses the same
22
+ * JAQL as the widget query (chart or pivot)—compose it next to or above a `ChartWidget` or
23
+ * `PivotTableWidget` with the same props.
24
+ *
25
+ * @example Widget header slot
26
+ * ```tsx
27
+ * <ChartWidget
28
+ * {...chartWidgetProps}
29
+ * topSlot={<WidgetNarrative widgetProps={chartWidgetProps} />}
30
+ * />
31
+ * ```
32
+ * @example Modal or custom layout (headless)
33
+ * ```tsx
34
+ * const { data, isLoading, supported } = useGetWidgetNarrative({ widgetProps });
35
+ * if (!supported) return null;
36
+ * return <DialogContent>{isLoading ? '…' : data}</DialogContent>;
37
+ * ```
38
+ * @sisenseInternal
39
+ */
40
+ export declare const WidgetNarrative: import("react").FunctionComponent<WidgetNarrativeProps>;
@@ -0,0 +1,36 @@
1
+ import { Attribute, DataSource, Filter, FilterRelations, Measure } from '@sisense/sdk-data';
2
+ import type { NarrativeRequest } from '../../../infra/api/narrative/narrative-api-types.js';
3
+ /**
4
+ * Parameters for {@link useGetNlgInsights} hook.
5
+ */
6
+ export interface UseGetNlgInsightsParams {
7
+ /** The data source that the query targets - e.g. `Sample ECommerce` */
8
+ dataSource: DataSource;
9
+ /** Dimensions of the query */
10
+ dimensions?: Attribute[];
11
+ /** Measures of the query */
12
+ measures?: Measure[];
13
+ /** Filters of the query */
14
+ filters?: Filter[] | FilterRelations;
15
+ /**
16
+ * Boolean flag to enable/disable API call by default
17
+ *
18
+ * If not specified, the default value is `true`
19
+ */
20
+ enabled?: boolean;
21
+ /** The verbosity of the NLG summarization */
22
+ verbosity?: 'Low' | 'High';
23
+ }
24
+ /**
25
+ * Parameters for building a narration request (before JAQL payload expansion).
26
+ *
27
+ * @sisenseInternal
28
+ */
29
+ export interface NarrativeQueryParams extends UseGetNlgInsightsParams {
30
+ }
31
+ /** @internal */
32
+ export declare function prepareNarrativeRequest(params: NarrativeQueryParams | NarrativeRequest): NarrativeRequest;
33
+ /**
34
+ * @deprecated Use {@link prepareNarrativeRequest}. Same function; kept for legacy `modules/ai` and framework wrappers.
35
+ */
36
+ export declare const prepareGetNlgInsightsPayload: typeof prepareNarrativeRequest;
@@ -0,0 +1,22 @@
1
+ import { Attribute, Measure } from '@sisense/sdk-data';
2
+ import { type AdaptMeasuresForQueryOptions } from '../../../domains/visualizations/core/chart-data-options/apply-styled-options-to-query.js';
3
+ import type { TableDataOptions } from '../../../domains/visualizations/core/chart-data-options/types.js';
4
+ import { ChartDataOptions, ChartType } from '../../../types';
5
+ /**
6
+ * Dimensions and measures for narration / JAQL, including styled sort, trend, and forecast.
7
+ *
8
+ * @internal
9
+ */
10
+ export declare function getNarrativeDimensionsAndMeasures(chartDataOptions: ChartDataOptions, chartType: ChartType, adaptMeasureOptions?: AdaptMeasuresForQueryOptions): {
11
+ dimensions: Attribute[];
12
+ measures: Measure[];
13
+ };
14
+ /**
15
+ * Table dimensions and measures for narration / JAQL, including styled sort, trend, and forecast.
16
+ *
17
+ * @internal
18
+ */
19
+ export declare function getNarrativeDimensionsAndMeasuresFromTable(dataOptions: TableDataOptions, adaptMeasureOptions?: AdaptMeasuresForQueryOptions): {
20
+ dimensions: Attribute[];
21
+ measures: Measure[];
22
+ };
@@ -0,0 +1,28 @@
1
+ import type { DataSource } from '@sisense/sdk-data';
2
+ /**
3
+ * Options shared by {@link useGetWidgetNarrative} and imperative helpers such as
4
+ * {@link getNlgInsightsFromWidget}.
5
+ *
6
+ * @internal
7
+ */
8
+ export interface WidgetNarrativeOptions {
9
+ /** Optional default data source to use if WidgetProps.dataSource is undefined */
10
+ defaultDataSource?: DataSource;
11
+ /** The verbosity of the NLG summarization */
12
+ verbosity?: 'Low' | 'High';
13
+ /** When false, legacy narration endpoint only; when true or undefined, try unified then fallback. */
14
+ isUnifiedNarrationEnabled?: boolean;
15
+ isSisenseAiEnabled?: boolean;
16
+ /**
17
+ * When `true`, trend and forecast companion measures are omitted from the narrative JAQL so
18
+ * requests stay compatible with backends that do not yet support them.
19
+ *
20
+ * @default false
21
+ */
22
+ ignoreTrendAndForecast?: boolean;
23
+ }
24
+ /**
25
+ * @deprecated Use {@link WidgetNarrativeOptions}. Same shape; kept for legacy naming.
26
+ * @internal
27
+ */
28
+ export type WidgetNarrativeNlgOptions = WidgetNarrativeOptions;
@@ -0,0 +1,36 @@
1
+ import { DataSource } from '@sisense/sdk-data';
2
+ import { ChartWidgetProps } from '../../../domains/widgets/components/chart-widget/types';
3
+ import type { PivotTableWidgetProps } from '../../../domains/widgets/components/pivot-table-widget/types';
4
+ import type { WithCommonWidgetProps } from '../../../domains/widgets/components/widget/types';
5
+ import type { NarrativeRequest } from '../../../infra/api/narrative/narrative-api-types.js';
6
+ import type { NarrativeQueryParams } from './build-narrative-request.js';
7
+ /**
8
+ * Converts ChartWidgetProps to {@link NarrativeQueryParams} by extracting dimensions and measures
9
+ * from the chart data options.
10
+ *
11
+ * @param props - ChartWidgetProps to convert
12
+ * @param defaultDataSource - Optional default data source to use if props.dataSource is undefined
13
+ * @param verbosity - Optional verbosity for narrative text
14
+ * @param ignoreTrendAndForecast - When `true`, omits trend/forecast companion measures from the narrative JAQL
15
+ * @returns Params ready for {@link prepareNarrativeRequest}
16
+ * @throws If neither `props.dataSource` nor `defaultDataSource` is set
17
+ * @internal
18
+ */
19
+ export declare function convertChartWidgetPropsToNarrativeParams(props: ChartWidgetProps, defaultDataSource?: DataSource, verbosity?: 'Low' | 'High', ignoreTrendAndForecast?: boolean): NarrativeQueryParams;
20
+ /**
21
+ * Builds a narrative API request from pivot widget props using the same JAQL as pivot query
22
+ * execution ({@link getPivotJaqlQueryPayload}).
23
+ *
24
+ * @param props - Pivot widget props (`widgetType: 'pivot'`)
25
+ * @param defaultDataSource - Used when `props.dataSource` is undefined
26
+ * @param verbosity - Optional verbosity for narrative text
27
+ * @param ignoreTrendAndForecast - When `true`, omits trend/forecast from pivot value columns in the narrative JAQL
28
+ * @returns Request ready for `getNarrative`
29
+ * @throws If data source cannot be resolved, or pivot query description is invalid
30
+ * @internal
31
+ */
32
+ export declare function convertPivotWidgetPropsToNarrativeRequest(props: WithCommonWidgetProps<PivotTableWidgetProps, 'pivot'>, defaultDataSource?: DataSource, verbosity?: 'Low' | 'High', ignoreTrendAndForecast?: boolean): NarrativeRequest;
33
+ /**
34
+ * @deprecated Use {@link convertChartWidgetPropsToNarrativeParams}. Same function; kept for legacy `getNlgInsightsFromWidget`.
35
+ */
36
+ export declare const convertChartWidgetPropsToUseGetNlgInsightsParams: typeof convertChartWidgetPropsToNarrativeParams;
@@ -0,0 +1,62 @@
1
+ import type { WidgetProps } from '../../../domains/widgets/components/widget/types';
2
+ import type { WidgetNarrativeOptions } from '../core/widget-narrative-options.js';
3
+ import { type WidgetNarrativeQueryState } from './use-widget-narrative-state.js';
4
+ /**
5
+ * Options for {@link useGetWidgetNarrative}.
6
+ *
7
+ * @remarks
8
+ * Narration endpoints and flags default from `app.settings` on {@link useSisenseContext} when
9
+ * `isUnifiedNarrationEnabled` / `isSisenseAiEnabled` are omitted. Optional overrides match the
10
+ * imperative `getNlgInsightsFromWidget` helper for per-call behavior.
11
+ * @sisenseInternal
12
+ */
13
+ export type UseGetWidgetNarrativeOptions = WidgetNarrativeOptions & {
14
+ /**
15
+ * When `false`, skips the narrative request.
16
+ *
17
+ * @default true
18
+ */
19
+ enabled?: boolean;
20
+ };
21
+ /**
22
+ * @sisenseInternal
23
+ */
24
+ export type UseGetWidgetNarrativeParams = {
25
+ /** Widget configuration whose query drives the narrative (chart or pivot). */
26
+ widgetProps: WidgetProps;
27
+ } & UseGetWidgetNarrativeOptions;
28
+ /**
29
+ * @sisenseInternal
30
+ */
31
+ export type UseGetWidgetNarrativeResult = WidgetNarrativeQueryState & {
32
+ /**
33
+ * `true` when `widgetProps` is a chart or pivot widget and narrative params could be built
34
+ * (including resolving `dataSource` via `defaultDataSource`).
35
+ */
36
+ supported: boolean;
37
+ /**
38
+ * Mirrors {@link UseGetWidgetNarrativeOptions.enabled}. When `false`, narrative is opted out and
39
+ * `data` is not populated from cache.
40
+ */
41
+ enabled: boolean;
42
+ };
43
+ /**
44
+ * Fetches natural-language narrative for a widget {@link WidgetProps} using the same conversion
45
+ * path as {@link getNlgInsightsFromWidget}.
46
+ *
47
+ * Requires `useSisenseContext` with `app.httpClient` and a TanStack `QueryClientProvider` ancestor
48
+ * (typically provided by `SisenseContextProvider` in full apps).
49
+ *
50
+ * Text and custom widgets are unsupported: `supported` is false and no request runs.
51
+ *
52
+ * @example Headless usage
53
+ * ```tsx
54
+ * const { data, isLoading, supported } = useGetWidgetNarrative({
55
+ * widgetProps,
56
+ * defaultDataSource: DM.DataSource,
57
+ * verbosity: 'Low',
58
+ * });
59
+ * ```
60
+ * @sisenseInternal
61
+ */
62
+ export declare const useGetWidgetNarrative: (params: UseGetWidgetNarrativeParams) => UseGetWidgetNarrativeResult;
@@ -0,0 +1,39 @@
1
+ import { WidgetProps } from '../../../domains/widgets/components/widget/types';
2
+ import type { NarrativeRequest } from '../../../infra/api/narrative/narrative-api-types.js';
3
+ import type { WidgetNarrativeOptions } from '../core/widget-narrative-options.js';
4
+ /**
5
+ * Hook state aligned with legacy {@link UseGetNlgInsightsState}; used by {@link useGetWidgetNarrative}.
6
+ *
7
+ * @internal
8
+ */
9
+ export type WidgetNarrativeQueryState = {
10
+ isLoading: boolean;
11
+ isError: boolean;
12
+ isSuccess: boolean;
13
+ data: string | undefined;
14
+ error: unknown;
15
+ refetch: () => void;
16
+ };
17
+ export type UseWidgetNarrativeStateParams = {
18
+ widgetProps: WidgetProps;
19
+ enabled?: boolean;
20
+ } & WidgetNarrativeOptions;
21
+ export type UseWidgetNarrativeStateResult = WidgetNarrativeQueryState & {
22
+ supported: boolean;
23
+ /**
24
+ * Mirrors the `enabled` param. When `false`, the narrative is opted out: `data` is cleared (no
25
+ * cached fallback), `narrativeRequest` is undefined, and loading/error flags reflect a disabled
26
+ * query rather than “no insights.”
27
+ */
28
+ enabled: boolean;
29
+ /** Present when `supported` and `enabled`; used by {@link WidgetNarrative} for feedback payload only. */
30
+ narrativeRequest: NarrativeRequest | undefined;
31
+ };
32
+ /**
33
+ * Resolves chart or pivot widget props to a narration request and runs `getNarrative` via TanStack Query.
34
+ * Depends on {@link useSisenseContext} (`httpClient`, narration settings) and a `QueryClientProvider`.
35
+ * Not exported from `@sisenseInternal` public API.
36
+ *
37
+ * @internal
38
+ */
39
+ export declare function useWidgetNarrativeState({ widgetProps, defaultDataSource, verbosity, enabled, ignoreTrendAndForecast, isUnifiedNarrationEnabled: optionsUnified, isSisenseAiEnabled: optionsSisenseAi, }: UseWidgetNarrativeStateParams): UseWidgetNarrativeStateResult;
@@ -0,0 +1,87 @@
1
+ import { Attribute, CalculatedMeasureColumn, Column, Measure, MeasureColumn } from '@sisense/sdk-data';
2
+ import type { CategoryStyle, SeriesStyle, StyledColumn, StyledMeasureColumn, ValueStyle } from './types.js';
3
+ /**
4
+ * Name prefixes for trend and forecast measures in query payloads (aligned with NLQ JSON and chart).
5
+ *
6
+ * @internal
7
+ */
8
+ export declare const TREND_PREFIX = "$trend";
9
+ export declare const FORECAST_PREFIX = "$forecast";
10
+ /**
11
+ * Dimension + optional category style for {@link adaptDimensionsForQuery}.
12
+ * Structurally matches NLQ `DimensionTranslationItem`.
13
+ *
14
+ * @internal
15
+ */
16
+ export type DimensionQueryAdaptItem = {
17
+ attribute: Attribute;
18
+ style?: CategoryStyle;
19
+ };
20
+ /**
21
+ * Measure + optional value style for {@link adaptMeasuresForQuery}.
22
+ * Structurally matches NLQ `MeasureTranslationItem`.
23
+ *
24
+ * @internal
25
+ */
26
+ export type MeasureQueryAdaptItem = {
27
+ measure: Measure;
28
+ style?: ValueStyle & SeriesStyle;
29
+ };
30
+ /**
31
+ * Dimensional {@link Attribute} instances expose JAQL sort APIs; plain {@link Column} does not.
32
+ *
33
+ * @internal
34
+ */
35
+ export declare function isDimensionalAttribute(column: Column): column is Attribute;
36
+ /**
37
+ * Narrative / NLQ query measures are dimensional {@link Measure} instances (e.g. from `measureFactory`).
38
+ *
39
+ * @internal
40
+ */
41
+ export declare function isDimensionalMeasure(column: MeasureColumn | CalculatedMeasureColumn): column is Measure;
42
+ /**
43
+ * Builds a dimension adapt item using `StyledColumn`’s own shape (no `splitColumn` merge).
44
+ *
45
+ * @internal
46
+ */
47
+ export declare function toDimensionQueryAdaptItem(sc: StyledColumn): DimensionQueryAdaptItem;
48
+ /**
49
+ * Builds a measure adapt item using `StyledMeasureColumn`’s own shape (no `splitColumn` merge).
50
+ *
51
+ * @internal
52
+ */
53
+ export declare function toMeasureQueryAdaptItem(smc: StyledMeasureColumn): MeasureQueryAdaptItem;
54
+ /**
55
+ * Applies sort from styled dimensions to attributes (NLQ JSON → query semantics).
56
+ *
57
+ * @internal
58
+ */
59
+ export declare function adaptDimensionsForQuery(items: DimensionQueryAdaptItem[]): Attribute[];
60
+ /**
61
+ * @internal
62
+ */
63
+ export declare function isTrendMeasure(measure: Measure): boolean;
64
+ /**
65
+ * @internal
66
+ */
67
+ export declare function isForecastMeasure(measure: Measure): boolean;
68
+ /**
69
+ * Options for {@link adaptMeasuresForQuery}.
70
+ *
71
+ * @internal
72
+ */
73
+ export type AdaptMeasuresForQueryOptions = {
74
+ /**
75
+ * When `true`, trend and forecast companion measures are not appended (e.g. narrative when the
76
+ * backend does not yet support them).
77
+ *
78
+ * @default false
79
+ */
80
+ ignoreTrendAndForecast?: boolean;
81
+ };
82
+ /**
83
+ * Applies sort, trend, and forecast companion measures (NLQ JSON → query semantics).
84
+ *
85
+ * @internal
86
+ */
87
+ export declare function adaptMeasuresForQuery(items: MeasureQueryAdaptItem[], options?: AdaptMeasuresForQueryOptions): Measure[];