@gooddata/sdk-ui-gen-ai 11.53.0-alpha.3 → 11.53.0-alpha.5

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 (46) hide show
  1. package/esm/components/GenAIChat.d.ts.map +1 -1
  2. package/esm/components/GenAIChat.js +2 -2
  3. package/esm/components/GenAIChatAgentDropdown.d.ts.map +1 -1
  4. package/esm/components/GenAIChatAgentDropdown.js +1 -0
  5. package/esm/components/GenAIChatReasoningMenu.d.ts.map +1 -1
  6. package/esm/components/GenAIChatReasoningMenu.js +1 -0
  7. package/esm/components/GenAiChatContextChooser.d.ts.map +1 -1
  8. package/esm/components/GenAiChatContextChooser.js +2 -2
  9. package/esm/components/GenAiStore.d.ts +6 -1
  10. package/esm/components/GenAiStore.d.ts.map +1 -1
  11. package/esm/components/GenAiStore.js +2 -1
  12. package/esm/components/hooks/useContextItems.d.ts.map +1 -1
  13. package/esm/components/hooks/useContextItems.js +46 -20
  14. package/esm/context/addContextReference.d.ts.map +1 -1
  15. package/esm/context/addContextReference.js +5 -2
  16. package/esm/context/collectContextReferences.d.ts.map +1 -1
  17. package/esm/context/collectContextReferences.js +2 -0
  18. package/esm/context/removeContextReference.d.ts +8 -2
  19. package/esm/context/removeContextReference.d.ts.map +1 -1
  20. package/esm/context/removeContextReference.js +44 -4
  21. package/esm/hooks/useGenAIStore.d.ts +2 -1
  22. package/esm/hooks/useGenAIStore.d.ts.map +1 -1
  23. package/esm/hooks/useGenAIStore.js +17 -3
  24. package/esm/sdk-ui-gen-ai.d.ts +5 -0
  25. package/esm/store/chatWindow/chatWindowSelectors.d.ts +2 -2
  26. package/esm/store/chatWindow/chatWindowSelectors.d.ts.map +1 -1
  27. package/esm/store/chatWindow/chatWindowSelectors.js +1 -1
  28. package/esm/store/chatWindow/chatWindowSlice.d.ts +17 -9
  29. package/esm/store/chatWindow/chatWindowSlice.d.ts.map +1 -1
  30. package/esm/store/chatWindow/chatWindowSlice.js +32 -30
  31. package/esm/store/options.d.ts +4 -1
  32. package/esm/store/options.d.ts.map +1 -1
  33. package/esm/store/options.js +7 -0
  34. package/esm/store/sideEffects/index.js +4 -4
  35. package/esm/store/sideEffects/loadContextObjects.d.ts +15 -0
  36. package/esm/store/sideEffects/loadContextObjects.d.ts.map +1 -0
  37. package/esm/store/sideEffects/loadContextObjects.js +104 -0
  38. package/esm/types.d.ts +16 -5
  39. package/esm/types.d.ts.map +1 -1
  40. package/esm/utils.d.ts +3 -2
  41. package/esm/utils.d.ts.map +1 -1
  42. package/esm/utils.js +10 -0
  43. package/package.json +20 -20
  44. package/esm/store/sideEffects/loadContextDashboards.d.ts +0 -12
  45. package/esm/store/sideEffects/loadContextDashboards.d.ts.map +0 -1
  46. package/esm/store/sideEffects/loadContextDashboards.js +0 -57
@@ -1 +1 @@
1
- {"version":3,"file":"GenAIChat.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChat.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAQ3C,OAAO,EAEH,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAExB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG;IAClE;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,cAAc,EAAE,gBAAgB,KAAK,MAAM,GAAG,SAAS,CAAC;IAEvE;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE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H,8BAA8B,CAAC,EAAE,MAAM,aAAa,CAAC;IAErD;;OAEG;IACH,2BAA2B,CAAC,EAAE,MAAM,aAAa,GAAG,IAAI,CAAC;IAEzD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAE1B;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAyDxD;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,uBAAiB,CAAC"}
@@ -12,10 +12,10 @@ import { GenAiStore } from "./GenAiStore.js";
12
12
  * @public
13
13
  */
14
14
  export function GenAIAssistant(props) {
15
- const { backend, workspace, locale, colorPalette, eventHandlers, settings, objectTypes, catalogItems, dashboards, includeTags, excludeTags, isPreview, allowInteractionIntelligence, providedStore, onDispatcher, onLinkClick, mode, allowNativeLinks, } = props;
15
+ const { backend, workspace, locale, colorPalette, eventHandlers, settings, objectTypes, catalogItems, dashboards, visualizations, includeTags, excludeTags, isPreview, allowInteractionIntelligence, providedStore, onDispatcher, onLinkClick, mode, allowNativeLinks, } = props;
16
16
  const effectiveBackend = useBackendStrict(backend);
17
17
  const effectiveWorkspace = useWorkspaceStrict(workspace);
18
- return (_jsx(IntlWrapper, { locale: locale, children: _jsx(GenAiStore, { backend: effectiveBackend, workspace: effectiveWorkspace, onDispatcher: onDispatcher, colorPalette: colorPalette, mode: mode, eventHandlers: eventHandlers, allowNativeLinks: allowNativeLinks, onLinkClick: onLinkClick, settings: settings, objectTypes: objectTypes, includeTags: includeTags, excludeTags: excludeTags, catalogItems: catalogItems, dashboards: dashboards, isPreview: isPreview, allowInteractionIntelligence: allowInteractionIntelligence, providedStore: providedStore, children: _jsx(BackendProvider, { backend: effectiveBackend, children: _jsx(WorkspaceProvider, { workspace: effectiveWorkspace, children: _jsx(PermissionsProvider, { children: _jsx(GenAIContent, { ...props }) }) }) }) }) }));
18
+ return (_jsx(IntlWrapper, { locale: locale, children: _jsx(GenAiStore, { backend: effectiveBackend, workspace: effectiveWorkspace, onDispatcher: onDispatcher, colorPalette: colorPalette, mode: mode, eventHandlers: eventHandlers, allowNativeLinks: allowNativeLinks, onLinkClick: onLinkClick, settings: settings, objectTypes: objectTypes, includeTags: includeTags, excludeTags: excludeTags, catalogItems: catalogItems, dashboards: dashboards, visualizations: visualizations, isPreview: isPreview, allowInteractionIntelligence: allowInteractionIntelligence, providedStore: providedStore, children: _jsx(BackendProvider, { backend: effectiveBackend, children: _jsx(WorkspaceProvider, { workspace: effectiveWorkspace, children: _jsx(PermissionsProvider, { children: _jsx(GenAIContent, { ...props }) }) }) }) }) }));
19
19
  }
20
20
  /**
21
21
  * UI component that renders the Gen AI chat.
@@ -1 +1 @@
1
- {"version":3,"file":"GenAIChatAgentDropdown.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatAgentDropdown.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAgB3D,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAkC3E,MAAM,MAAM,2BAA2B,GAAG;IACtC,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,aAAa,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACzC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;K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AAU,EACV,SAAS,EACT,aAAa,EACb,gBAAwB,EACxB,cAA+B,EAC/B,cAAc,EACjB,EAAE,2BAA2B,2CA2L7B"}
@@ -77,6 +77,7 @@ export function GenAIChatAgentDropdown({ agents, conversations, conversationAgen
77
77
  isDisabled: false,
78
78
  data: { type: "agent", agent },
79
79
  tooltip: agent.description || undefined,
80
+ tooltipWidth: 230,
80
81
  iconRight: agent.description ? (_jsx(UiIcon, { type: "question", size: 12, color: "complementary-5", accessibilityConfig: { ariaHidden: true } })) : undefined,
81
82
  };
82
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"GenAIChatReasoningMenu.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatReasoningMenu.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAEH,KAAK,kCAAkC,EACvC,KAAK,WAAW,EAMnB,MAAM,sBAAsB,CAAC;AAkC9B;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,cAAc,EAAE,eAAe,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAElD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,CAAC;AAqBlD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACrC,cAAc,EAAE,eAAe,EAC/B,SAAS,EAAE,kBAAkB,GAC9B,MAAM,GAAG,SAAS,CAIpB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAClC,OAAO,EACP,cAAc,EACd,cAAc,EACjB,EAAE;IACC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,eAAe,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CACtD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pB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAClC,OAAO,EACP,cAAc,EACd,cAAc,EACjB,EAAE;IACC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,eAAe,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CACtD,GAAG,WAAW,CAAC;IAAE,WAAW,EAAE,qBAAqB,CAAA;CAAE,CAAC,EAAE,CAmBxD;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC7B,WAAW,EAAE;QAAE,MAAM,EAAE,eAAe,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,uBAAuB,CACnC,cAAc,EAAE,eAAe,EAC/B,SAAS,EAAE,kBAAkB,GAC9B,WAAW,CAAC,kBAAkB,CAAC,EAAE,CA+BnC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,2CAczE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,EACtC,IAAI,EACP,EAAE,kCAAkC,CAAC;IAAE,WAAW,EAAE,qBAAqB,CAAA;CAAE,CAAC,2CAiE5E"}
@@ -100,6 +100,7 @@ export function useReasoningOptionItems(selectedEffort, labelMode) {
100
100
  isDisabled: false,
101
101
  data: { effort },
102
102
  tooltip: descriptionText,
103
+ tooltipWidth: 230,
103
104
  iconRight: (_jsx(UiIcon, { type: "question", size: 12, color: "complementary-5", accessibilityConfig: { ariaHidden: true } })),
104
105
  };
105
106
  }), [intl, selectedEffort, labelMode]);
@@ -1 +1 @@
1
- {"version":3,"file":"GenAiChatContextChooser.d.ts","sourceRoot":"","sources":["../../src/components/GenAiChatContextChooser.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAWvD,KAAK,+BAA+B,GAAG;IACnC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACzD,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EAAE,YAAY,EAAE,EAAE,+BAA+B,kDAiExF"}
1
+ {"version":3,"file":"GenAiChatContextChooser.d.ts","sourceRoot":"","sources":["../../src/components/GenAiChatContextChooser.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAWvD,KAAK,+BAA+B,GAAG;IACnC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACzD,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EAAE,YAAY,EAAE,EAAE,+BAA+B,kDAiExF"}
@@ -5,7 +5,7 @@ import { defineMessages, useIntl } from "react-intl";
5
5
  import { useDispatch, useSelector } from "react-redux";
6
6
  import { Dropdown, UiIconButton, useIdPrefixed } from "@gooddata/sdk-ui-kit";
7
7
  import { ambientContextSelector, userContextSelector } from "../store/chatWindow/chatWindowSelectors.js";
8
- import { addContextReferenceAction, initContextDashboardsAction, } from "../store/chatWindow/chatWindowSlice.js";
8
+ import { addContextReferenceAction, initContextObjectsAction } from "../store/chatWindow/chatWindowSlice.js";
9
9
  import { GenAiChatContextChooserBody } from "./GenAiChatContextChooserBody.js";
10
10
  import { useContextItems } from "./hooks/useContextItems.js";
11
11
  const msgs = defineMessages({
@@ -23,7 +23,7 @@ export function GenAiChatContextChooser({ onAddContext }) {
23
23
  const addContextLabel = intl.formatMessage(msgs.add);
24
24
  const onOpenStateChanged = useCallback((isOpen) => {
25
25
  if (isOpen) {
26
- dispatch(initContextDashboardsAction());
26
+ dispatch(initContextObjectsAction());
27
27
  }
28
28
  }, [dispatch]);
29
29
  if (!ambient) {
@@ -1,7 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type EnhancedStore, type Store } from "@reduxjs/toolkit";
3
3
  import { type IAnalyticalBackend, type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
4
- import { type CatalogItem, type GenAIObjectType, type IColorPalette, type IListedDashboard } from "@gooddata/sdk-model";
4
+ import { type CatalogItem, type GenAIObjectType, type IColorPalette, type IInsight, type IListedDashboard } from "@gooddata/sdk-model";
5
5
  import { type ChatEventHandler } from "../store/events.js";
6
6
  import { type GenAIAssistantMode, type LinkHandlerEvent } from "./ConfigContext.js";
7
7
  /**
@@ -30,6 +30,11 @@ export type GenAiStoreProps = {
30
30
  * no dashboards are loaded from the backend.
31
31
  */
32
32
  dashboards?: IListedDashboard[];
33
+ /**
34
+ * Visualizations offered by the context chooser. When provided, the list is taken as complete
35
+ * and no visualizations are loaded from the backend.
36
+ */
37
+ visualizations?: IInsight[];
33
38
  /**
34
39
  * User settings to use for the chat UI.
35
40
  */
@@ -1 +1 @@
1
- {"version":3,"file":"GenAiStore.d.ts","sourceRoot":"","sources":["../../src/components/GenAiStore.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAmC,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGlE,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACxB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,OAAO,EAAkB,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEpG;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;I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Y,CAAC,EAAE,aAAa,CAAC;IAC7B;;;;OAIG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC7D;;OAEG;IACH,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,UAAU,EAAE,aAAa,KAAK,SAAS,CAAC,CAAC;IAEjE;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;OAOG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;CAC1C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,kDAmDhD"}
@@ -59,7 +59,7 @@ function InjectedStore({ onDispatcher, children, currentStore, }) {
59
59
  const content = typeof children === "function" ? children(currentStore) : children;
60
60
  return _jsx(StoreProvider, { store: currentStore, children: content });
61
61
  }
62
- function InternalStore({ backend, workspace, onDispatcher, children, eventHandlers, settings, catalogItems, dashboards, includeTags, excludeTags, objectTypes, allowNativeLinks, onLinkClick, mode, isPreview, allowInteractionIntelligence, colorPalette, }) {
62
+ function InternalStore({ backend, workspace, onDispatcher, children, eventHandlers, settings, catalogItems, dashboards, visualizations, includeTags, excludeTags, objectTypes, allowNativeLinks, onLinkClick, mode, isPreview, allowInteractionIntelligence, colorPalette, }) {
63
63
  const effectiveBackend = useBackendStrict(backend);
64
64
  const effectiveWorkspace = useWorkspaceStrict(workspace);
65
65
  const genAIStore = useGenAIStore(effectiveBackend, effectiveWorkspace, {
@@ -71,6 +71,7 @@ function InternalStore({ backend, workspace, onDispatcher, children, eventHandle
71
71
  excludeTags,
72
72
  catalogItems,
73
73
  dashboards,
74
+ visualizations,
74
75
  isPreview,
75
76
  allowInteractionIntelligence,
76
77
  allowNativeLinks,
@@ -1 +1 @@
1
- {"version":3,"file":"useContextItems.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useContextItems.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,qBAAqB,CAAC;AAQ9E,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,wBAAgB,eAAe,CAC3B,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,MAAM,EAAE,iBAAiB,GAAG,SAAS;;;;;EA4CxC"}
1
+ {"version":3,"file":"useContextItems.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useContextItems.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,iBAAiB,EAAmB,MAAM,qBAAqB,CAAC;AAQ9E,OAAO,EAAsD,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE9G,wBAAgB,eAAe,CAC3B,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,MAAM,EAAE,iBAAiB,GAAG,SAAS;;;;;EAoDxC"}
@@ -4,36 +4,62 @@ import { useIntl } from "react-intl";
4
4
  import { useDispatch, useSelector } from "react-redux";
5
5
  import { serializeObjRef } from "@gooddata/sdk-model";
6
6
  import { collectAvailableReferences, collectContextReferences, } from "../../context/collectContextReferences.js";
7
- import { contextDashboardsSelector } from "../../store/chatWindow/chatWindowSelectors.js";
8
- import { loadContextDashboardsNextPageAction } from "../../store/chatWindow/chatWindowSlice.js";
7
+ import { contextObjectsSelector } from "../../store/chatWindow/chatWindowSelectors.js";
8
+ import { loadContextObjectsNextPageAction } from "../../store/chatWindow/chatWindowSlice.js";
9
9
  export function useContextItems(ambient, active) {
10
10
  const intl = useIntl();
11
11
  const dispatch = useDispatch();
12
12
  const emptyReferenceLabel = intl.formatMessage({ id: "gd.gen-ai.context.untitled" });
13
- const dashboards = useSelector(contextDashboardsSelector);
13
+ const contextObjects = useSelector(contextObjectsSelector);
14
+ const dashboards = contextObjects.dashboard;
15
+ const visualizations = contextObjects.visualization;
14
16
  const items = useMemo(() => {
15
17
  const ambientReferences = collectAvailableReferences(ambient, emptyReferenceLabel);
16
18
  const selectedReferences = collectContextReferences(active, emptyReferenceLabel);
17
- const offered = new Set(ambientReferences.map((reference) => serializeObjRef(reference.ref)));
18
- const dashboardReferences = dashboards.items
19
- .filter((dashboard) => !offered.has(serializeObjRef(dashboard.ref)))
20
- .map((dashboard) => ({
21
- id: dashboard.id,
22
- ref: dashboard.ref,
23
- type: "dashboard",
24
- where: "referencedObjects",
25
- title: dashboard.title || emptyReferenceLabel || dashboard.id,
26
- nesting: 1,
27
- }));
28
- return [...ambientReferences, ...dashboardReferences].filter((reference) => !selectedReferences.some((selectedReference) => selectedReference.id === reference.id && selectedReference.type === reference.type));
29
- }, [active, ambient, dashboards.items, emptyReferenceLabel]);
19
+ const offered = new Set();
20
+ ambientReferences.forEach((reference) => {
21
+ offered.add(serializeObjRef(reference.ref));
22
+ if (reference.insightRef) {
23
+ offered.add(serializeObjRef(reference.insightRef));
24
+ }
25
+ });
26
+ const workspaceReferences = [
27
+ ...toContextObjects(dashboards.items, "dashboard", emptyReferenceLabel),
28
+ ...toContextObjects(visualizations.items, "visualization", emptyReferenceLabel),
29
+ ].filter((reference) => !offered.has(serializeObjRef(reference.ref)));
30
+ return [...ambientReferences, ...workspaceReferences].filter((reference) => !selectedReferences.some((selectedReference) => isSameObject(selectedReference, reference)));
31
+ }, [active, ambient, dashboards.items, visualizations.items, emptyReferenceLabel]);
32
+ const nextPageKind = dashboards.hasNextPage
33
+ ? "dashboard"
34
+ : visualizations.hasNextPage
35
+ ? "visualization"
36
+ : undefined;
30
37
  const loadNextPage = useCallback(() => {
31
- dispatch(loadContextDashboardsNextPageAction());
32
- }, [dispatch]);
38
+ if (!nextPageKind) {
39
+ return;
40
+ }
41
+ dispatch(loadContextObjectsNextPageAction({ kind: nextPageKind }));
42
+ }, [dispatch, nextPageKind]);
33
43
  return {
34
44
  items,
35
- isLoading: dashboards.isLoading,
36
- hasNextPage: dashboards.hasNextPage,
45
+ isLoading: dashboards.isLoading || visualizations.isLoading,
46
+ hasNextPage: nextPageKind !== undefined,
37
47
  loadNextPage,
38
48
  };
39
49
  }
50
+ function toContextObjects(items, type, emptyReferenceLabel) {
51
+ return items.map((item) => ({
52
+ id: item.id,
53
+ ref: item.ref,
54
+ type,
55
+ where: "referencedObjects",
56
+ title: item.title || emptyReferenceLabel || item.id,
57
+ nesting: 1,
58
+ }));
59
+ }
60
+ function isSameObject(a, b) {
61
+ return a.id === b.id && normalizeType(a.type) === normalizeType(b.type);
62
+ }
63
+ function normalizeType(type) {
64
+ return type === "widget" ? "visualization" : type;
65
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"addContextReference.d.ts","sourceRoot":"","sources":["../../src/context/addContextReference.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EAEzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAO1E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,mBAAmB,GAAG,YAAY,CA+DxG;AAED,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,YAAY,EACrB,WAAW,CAAC,EAAE,iBAAiB,GAChC,YAAY,CAkBd"}
1
+ {"version":3,"file":"addContextReference.d.ts","sourceRoot":"","sources":["../../src/context/addContextReference.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EAEzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAO1E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,mBAAmB,GAAG,YAAY,CA+DxG;AAUD,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,YAAY,EACrB,WAAW,CAAC,EAAE,iBAAiB,GAChC,YAAY,CAkBd"}
@@ -3,7 +3,7 @@ import { areObjRefsEqual, } from "@gooddata/sdk-model";
3
3
  import { convertGenAiTypeToReferenceType } from "../utils.js";
4
4
  import { mergeContexts } from "./build.js";
5
5
  import { isReferenceChanged } from "./isReferenceChanged.js";
6
- import { removeAmbientContribution } from "./removeContextReference.js";
6
+ import { removeAmbientContribution, removeReferencesCoveredByAmbient } from "./removeContextReference.js";
7
7
  export function addContextReference(context, reference) {
8
8
  const { ambient, active } = context;
9
9
  if (!reference) {
@@ -59,6 +59,9 @@ export function addContextReference(context, reference) {
59
59
  }
60
60
  return context;
61
61
  }
62
+ function pruneForNewAmbient(active, previousAmbient, newAmbient) {
63
+ return removeReferencesCoveredByAmbient(removeAmbientContribution(active, previousAmbient), newAmbient);
64
+ }
62
65
  export function addAmbientContextReferences(context, userContext) {
63
66
  const referenceChanged = isReferenceChanged(context.ambient, userContext);
64
67
  const updateActive = Boolean(!context.ambient || context.active?.view?.dashboard || referenceChanged);
@@ -68,7 +71,7 @@ export function addAmbientContextReferences(context, userContext) {
68
71
  ...(updateActive
69
72
  ? {
70
73
  active: mergeContexts(referenceChanged
71
- ? removeAmbientContribution(context.active, context.ambient)
74
+ ? pruneForNewAmbient(context.active, context.ambient, userContext)
72
75
  : context.active, userContext),
73
76
  }
74
77
  : {}),
@@ -1 +1 @@
1
- {"version":3,"file":"collectContextReferences.d.ts","sourceRoot":"","sources":["../../src/context/collectContextReferences.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EAGzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,gBAAgB,CAAC,EAAE,MAAM,GAC1B,mBAAmB,EAAE,CAwCvB;AAED,wBAAgB,0BAA0B,CACtC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,gBAAgB,CAAC,EAAE,MAAM,GAC1B,mBAAmB,EAAE,CAiFvB"}
1
+ {"version":3,"file":"collectContextReferences.d.ts","sourceRoot":"","sources":["../../src/context/collectContextReferences.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EAGzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,gBAAgB,CAAC,EAAE,MAAM,GAC1B,mBAAmB,EAAE,CAwCvB;AAED,wBAAgB,0BAA0B,CACtC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,gBAAgB,CAAC,EAAE,MAAM,GAC1B,mBAAmB,EAAE,CAmFvB"}
@@ -81,6 +81,7 @@ export function collectAvailableReferences(context, placeholderTitle) {
81
81
  title: widget.title || placeholderTitle || id,
82
82
  type: "widget",
83
83
  context,
84
+ insightRef: widget.insightRef,
84
85
  });
85
86
  }
86
87
  break;
@@ -103,6 +104,7 @@ export function collectAvailableReferences(context, placeholderTitle) {
103
104
  title: visualization.title || placeholderTitle || id,
104
105
  type: "widget",
105
106
  context,
107
+ insightRef: visualization.insightRef,
106
108
  });
107
109
  }
108
110
  });
@@ -2,10 +2,16 @@ import { type IGenAIUserContext } from "@gooddata/sdk-model";
2
2
  import { type IGenAIContextObject } from "../types.js";
3
3
  export declare function removeContextReference(context: IGenAIUserContext | undefined, reference?: IGenAIContextObject): IGenAIUserContext | undefined;
4
4
  /**
5
- * Removes from `context` everything that was contributed by `ambient` - the dashboard the user was
6
- * viewing, plus the objects they pinned from it.
5
+ * Removes what `ambient` put in `context` on its own - the viewed dashboard and its own references.
6
+ * The user's own picks stay, the objects pinned from that dashboard included.
7
7
  * @internal
8
8
  */
9
9
  export declare function removeAmbientContribution(context: IGenAIUserContext | undefined, ambient: IGenAIUserContext | undefined): IGenAIUserContext | undefined;
10
+ /**
11
+ * Removes the references the newly opened dashboard covers itself - its own ref and the
12
+ * visualizations it renders - so nothing added earlier sits in the context twice.
13
+ * @internal
14
+ */
15
+ export declare function removeReferencesCoveredByAmbient(context: IGenAIUserContext | undefined, ambient: IGenAIUserContext | undefined): IGenAIUserContext | undefined;
10
16
  export declare function removeUserContextReferences(context: IGenAIUserContext | undefined): IGenAIUserContext | undefined;
11
17
  //# sourceMappingURL=removeContextReference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"removeContextReference.d.ts","sourceRoot":"","sources":["../../src/context/removeContextReference.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EAEzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIvD,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,SAAS,CAAC,EAAE,mBAAmB,GAChC,iBAAiB,GAAG,SAAS,CAqC/B;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACrC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GACvC,iBAAiB,GAAG,SAAS,CAmB/B;AAeD,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GACvC,iBAAiB,GAAG,SAAS,CAS/B"}
1
+ {"version":3,"file":"removeContextReference.d.ts","sourceRoot":"","sources":["../../src/context/removeContextReference.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,KAAK,iBAAiB,EAGzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIvD,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,SAAS,CAAC,EAAE,mBAAmB,GAChC,iBAAiB,GAAG,SAAS,CAqC/B;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACrC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GACvC,iBAAiB,GAAG,SAAS,CAoB/B;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC5C,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GACvC,iBAAiB,GAAG,SAAS,CAuB/B;AAmCD,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GACvC,iBAAiB,GAAG,SAAS,CAS/B"}
@@ -1,5 +1,5 @@
1
1
  // (C) 2026 GoodData Corporation
2
- import { areObjRefsEqual, } from "@gooddata/sdk-model";
2
+ import { areObjRefsEqual, serializeObjRef, } from "@gooddata/sdk-model";
3
3
  import { undefinedIfEmpty } from "./build.js";
4
4
  export function removeContextReference(context, reference) {
5
5
  if (!context) {
@@ -33,8 +33,8 @@ export function removeContextReference(context, reference) {
33
33
  return normalizeContext(newContext);
34
34
  }
35
35
  /**
36
- * Removes from `context` everything that was contributed by `ambient` - the dashboard the user was
37
- * viewing, plus the objects they pinned from it.
36
+ * Removes what `ambient` put in `context` on its own - the viewed dashboard and its own references.
37
+ * The user's own picks stay, the objects pinned from that dashboard included.
38
38
  * @internal
39
39
  */
40
40
  export function removeAmbientContribution(context, ambient) {
@@ -47,9 +47,49 @@ export function removeAmbientContribution(context, ambient) {
47
47
  newContext.view = { ...newContext.view };
48
48
  delete newContext.view.dashboard;
49
49
  }
50
- newContext.referencedObjects = newContext.referencedObjects?.filter((group) => !areObjRefsEqual(group.context?.ref, ambientDashboardRef));
50
+ newContext.referencedObjects = withoutObjects(newContext.referencedObjects, collectRefKeys(ambient.referencedObjects?.flatMap((group) => group.objects)));
51
51
  return normalizeContext(newContext);
52
52
  }
53
+ /**
54
+ * Removes the references the newly opened dashboard covers itself - its own ref and the
55
+ * visualizations it renders - so nothing added earlier sits in the context twice.
56
+ * @internal
57
+ */
58
+ export function removeReferencesCoveredByAmbient(context, ambient) {
59
+ const dashboard = ambient?.view?.dashboard;
60
+ if (!context?.referencedObjects || !dashboard) {
61
+ return context;
62
+ }
63
+ const covered = new Set([serializeObjRef(dashboard.ref)]);
64
+ dashboard.widgets?.forEach((widget) => {
65
+ [widget, ...(widget.visualizations ?? [])].forEach(({ widgetRef, insightRef }) => {
66
+ if (widgetRef) {
67
+ covered.add(serializeObjRef(widgetRef));
68
+ }
69
+ if (insightRef) {
70
+ covered.add(serializeObjRef(insightRef));
71
+ }
72
+ });
73
+ });
74
+ return normalizeContext({
75
+ ...context,
76
+ referencedObjects: withoutObjects(context.referencedObjects, covered),
77
+ });
78
+ }
79
+ function collectRefKeys(objects) {
80
+ return new Set(objects?.map((object) => serializeObjRef(object.ref)));
81
+ }
82
+ function withoutObjects(groups, removedRefKeys) {
83
+ if (!groups || removedRefKeys.size === 0) {
84
+ return groups;
85
+ }
86
+ return groups
87
+ .map((group) => ({
88
+ ...group,
89
+ objects: group.objects.filter((object) => !removedRefKeys.has(serializeObjRef(object.ref))),
90
+ }))
91
+ .filter((group) => group.objects.length > 0);
92
+ }
53
93
  function normalizeContext(context) {
54
94
  const newContext = { ...context };
55
95
  if (newContext.view && Object.keys(newContext.view).length === 0) {
@@ -1,5 +1,5 @@
1
1
  import { type IAnalyticalBackend, type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
2
- import { type CatalogItem, type GenAIObjectType, type IColorPalette, type IListedDashboard } from "@gooddata/sdk-model";
2
+ import { type CatalogItem, type GenAIObjectType, type IColorPalette, type IInsight, type IListedDashboard } from "@gooddata/sdk-model";
3
3
  import type { GenAIAssistantMode, LinkHandlerEvent } from "../components/ConfigContext.js";
4
4
  import { type ChatEventHandler } from "../store/events.js";
5
5
  export declare const useGenAIStore: (backend: IAnalyticalBackend, workspace: string, opts: {
@@ -11,6 +11,7 @@ export declare const useGenAIStore: (backend: IAnalyticalBackend, workspace: str
11
11
  excludeTags?: string[] | undefined;
12
12
  catalogItems?: CatalogItem[] | undefined;
13
13
  dashboards?: IListedDashboard[] | undefined;
14
+ visualizations?: IInsight[] | undefined;
14
15
  isPreview?: boolean | undefined;
15
16
  allowInteractionIntelligence?: boolean | undefined;
16
17
  onLinkClick?: ((linkClickEvent: LinkHandlerEvent) => string | undefined) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useGenAIStore.d.ts","sourceRoot":"","sources":["../../src/hooks/useGenAIStore.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAW3F,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,oBAAoB,CAAC;AAI5E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;wEAyIzB,CAAC"}
1
+ {"version":3,"file":"useGenAIStore.d.ts","sourceRoot":"","sources":["../../src/hooks/useGenAIStore.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EAGxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAW3F,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,oBAAoB,CAAC;AAK5E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;wEA8JzB,CAAC"}
@@ -1,11 +1,13 @@
1
1
  // (C) 2024-2026 GoodData Corporation
2
2
  import { useEffect, useMemo } from "react";
3
- import { setCatalogItemsActions, setColorPaletteAction, setContextDashboardsAction, setFullscreenAction, setIsPreviewAction, setObjectTypesAction, setSettingsAction, setTagsAction, } from "../store/chatWindow/chatWindowSlice.js";
3
+ import { insightRef, insightTitle, } from "@gooddata/sdk-model";
4
+ import { setCatalogItemsActions, setColorPaletteAction, setContextObjectsAction, setFullscreenAction, setIsPreviewAction, setObjectTypesAction, setSettingsAction, setTagsAction, } from "../store/chatWindow/chatWindowSlice.js";
4
5
  import { EventDispatcher } from "../store/events.js";
5
6
  import { OptionsDispatcher } from "../store/options.js";
6
7
  import { getStore } from "../store/store.js";
8
+ import { toContextListItem } from "../utils.js";
7
9
  export const useGenAIStore = (backend, workspace, opts) => {
8
- const { eventHandlers, colorPalette, settings, objectTypes, includeTags, excludeTags, catalogItems, dashboards, isPreview, allowInteractionIntelligence, onLinkClick, allowNativeLinks, mode, } = opts;
10
+ const { eventHandlers, colorPalette, settings, objectTypes, includeTags, excludeTags, catalogItems, dashboards, visualizations, isPreview, allowInteractionIntelligence, onLinkClick, allowNativeLinks, mode, } = opts;
9
11
  // Instantiate EventDispatcher. It's a designed to hold a reference to the handlers, so that
10
12
  // we don't update the context every time a new array of handlers is passed.
11
13
  // Similar to how React handles event listeners.
@@ -66,9 +68,21 @@ export const useGenAIStore = (backend, workspace, opts) => {
66
68
  useEffect(() => {
67
69
  if (dashboards) {
68
70
  optionsDispatcher.setDashboards(dashboards);
69
- store.dispatch(setContextDashboardsAction({ items: dashboards }));
71
+ store.dispatch(setContextObjectsAction({
72
+ kind: "dashboard",
73
+ items: dashboards.map((dashboard) => toContextListItem(dashboard.ref, dashboard.title)),
74
+ }));
70
75
  }
71
76
  }, [dashboards, optionsDispatcher, store]);
77
+ useEffect(() => {
78
+ if (visualizations) {
79
+ optionsDispatcher.setVisualizations(visualizations);
80
+ store.dispatch(setContextObjectsAction({
81
+ kind: "visualization",
82
+ items: visualizations.map((insight) => toContextListItem(insightRef(insight), insightTitle(insight))),
83
+ }));
84
+ }
85
+ }, [visualizations, optionsDispatcher, store]);
72
86
  useEffect(() => {
73
87
  if (mode && mode !== optionsDispatcher.getMode()) {
74
88
  optionsDispatcher.setMode(mode);
@@ -548,6 +548,11 @@ export declare type GenAiStoreProps = {
548
548
  * no dashboards are loaded from the backend.
549
549
  */
550
550
  dashboards?: IListedDashboard[];
551
+ /**
552
+ * Visualizations offered by the context chooser. When provided, the list is taken as complete
553
+ * and no visualizations are loaded from the backend.
554
+ */
555
+ visualizations?: IInsight[];
551
556
  /**
552
557
  * User settings to use for the chat UI.
553
558
  */
@@ -1,7 +1,7 @@
1
1
  import { type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
2
2
  import { type CatalogItem, type GenAIObjectType, type IAllowedRelationshipType, type IColorPalette, type IGenAIUserContext } from "@gooddata/sdk-model";
3
3
  import type { IKdaDefinition } from "@gooddata/sdk-ui-dashboard";
4
- import { type ContextDashboardsState } from "../../types.js";
4
+ import { type ContextObjectsState } from "../../types.js";
5
5
  import { type RootState } from "../types.js";
6
6
  export declare const isOpenSelector: (state: RootState) => boolean;
7
7
  export declare const isFullscreenSelector: (state: RootState) => boolean;
@@ -22,7 +22,7 @@ export declare const tagsSelector: (state: RootState) => {
22
22
  excludeTags: string[] | undefined;
23
23
  };
24
24
  export declare const catalogItemsSelector: (state: RootState) => CatalogItem[];
25
- export declare const contextDashboardsSelector: (state: RootState) => ContextDashboardsState;
25
+ export declare const contextObjectsSelector: (state: RootState) => ContextObjectsState;
26
26
  export declare const keyDriverAnalysisSelector: (state: RootState) => IKdaDefinition | undefined;
27
27
  export declare const keyDriverAnalysisMinimizedSelector: (state: RootState) => boolean | undefined;
28
28
  export declare const userContextSelector: (state: RootState) => IGenAIUserContext | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"chatWindowSelectors.d.ts","sourceRoot":"","sources":["../../../src/store/chatWindow/chatWindowSelectors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EACH,KAAK,WAAW,EAChB,K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,EAAE,SAAS,KAAK,wBAAwB,EAAE,GAAG,SACZ,CAAC;AAEvF,eAAO,MAAM,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK;IAC7C,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAClC,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAMpC,CAAC;AAEH,eAAO,MAAM,oBAAoB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,WAAW,EAKnE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,mBAG1D,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,cAAc,GAAG,SAG9E,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,GAAG,SAGhF,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,iBAAiB,GAAG,SAG3E,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,iBAAiB,GAAG,SAG9E,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAe5D,CAAC"}
@@ -32,7 +32,7 @@ export const tagsSelector = createSelector(chatWindowSliceSelector, (state) => {
32
32
  export const catalogItemsSelector = createSelector(chatWindowSliceSelector, (state) => {
33
33
  return state.catalogItems ?? [];
34
34
  });
35
- export const contextDashboardsSelector = createSelector(chatWindowSliceSelector, (state) => state.contextDashboards);
35
+ export const contextObjectsSelector = createSelector(chatWindowSliceSelector, (state) => state.contextObjects);
36
36
  export const keyDriverAnalysisSelector = createSelector(chatWindowSliceSelector, (state) => state.keyDriverAnalysis);
37
37
  export const keyDriverAnalysisMinimizedSelector = createSelector(chatWindowSliceSelector, (state) => state.keyDriverAnalysisMinimized);
38
38
  export const userContextSelector = createSelector(chatWindowSliceSelector, (state) => state.context.active);
@@ -1,8 +1,8 @@
1
1
  import { type Reducer } from "@reduxjs/toolkit";
2
2
  import { type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
3
- import { type CatalogItem, type GenAIObjectType, type IAllowedRelationshipType, type IColorPalette, type IDashboard, type IGenAIUserContext, type IInsight, type IListedDashboard } from "@gooddata/sdk-model";
3
+ import { type CatalogItem, type GenAIObjectType, type IAllowedRelationshipType, type IColorPalette, type IDashboard, type IGenAIUserContext, type IInsight } from "@gooddata/sdk-model";
4
4
  import type { IKdaDefinition } from "@gooddata/sdk-ui-dashboard";
5
- import { type ContextDashboardsState, type IGenAIContextObject, type StoreContext } from "../../types.js";
5
+ import { type ContextObjectKind, type ContextObjectsState, type IGenAIContextListItem, type IGenAIContextObject, type StoreContext } from "../../types.js";
6
6
  type ChatWindowSliceState = {
7
7
  /**
8
8
  * Defines if the chat window is open.
@@ -41,9 +41,9 @@ type ChatWindowSliceState = {
41
41
  */
42
42
  catalogItems?: CatalogItem[];
43
43
  /**
44
- * Dashboards offered by the context chooser, on top of the one being viewed.
44
+ * Dashboards and visualizations offered by the context chooser, on top of the ambient ones.
45
45
  */
46
- contextDashboards: ContextDashboardsState;
46
+ contextObjects: ContextObjectsState;
47
47
  /**
48
48
  * Only objects with these tags will be included
49
49
  */
@@ -96,12 +96,20 @@ export declare const setOpenAction: import("@reduxjs/toolkit").ActionCreatorWith
96
96
  }, "chatWindow/setObjectTypesAction">, setTagsAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
97
97
  includeTags?: string[] | undefined;
98
98
  excludeTags?: string[] | undefined;
99
- }, "chatWindow/setTagsAction">, setCatalogItemsActions: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<CatalogItem[] | undefined, "chatWindow/setCatalogItemsActions">, initContextDashboardsAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chatWindow/initContextDashboardsAction">, loadContextDashboardsNextPageAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chatWindow/loadContextDashboardsNextPageAction">, setContextDashboardsAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
100
- items: IListedDashboard[];
101
- }, "chatWindow/setContextDashboardsAction">, contextDashboardsLoadingAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chatWindow/contextDashboardsLoadingAction">, contextDashboardsPageLoadedAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
102
- items: IListedDashboard[];
99
+ }, "chatWindow/setTagsAction">, setCatalogItemsActions: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<CatalogItem[] | undefined, "chatWindow/setCatalogItemsActions">, initContextObjectsAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chatWindow/initContextObjectsAction">, loadContextObjectsNextPageAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
100
+ kind: ContextObjectKind;
101
+ }, "chatWindow/loadContextObjectsNextPageAction">, setContextObjectsAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
102
+ kind: ContextObjectKind;
103
+ items: IGenAIContextListItem[];
104
+ }, "chatWindow/setContextObjectsAction">, contextObjectsLoadingAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
105
+ kind: ContextObjectKind;
106
+ }, "chatWindow/contextObjectsLoadingAction">, contextObjectsPageLoadedAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
107
+ kind: ContextObjectKind;
108
+ items: IGenAIContextListItem[];
103
109
  hasNextPage: boolean;
104
- }, "chatWindow/contextDashboardsPageLoadedAction">, contextDashboardsLoadFailedAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chatWindow/contextDashboardsLoadFailedAction">, setAllowedRelationshipTypesAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
110
+ }, "chatWindow/contextObjectsPageLoadedAction">, contextObjectsLoadFailedAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
111
+ kind: ContextObjectKind;
112
+ }, "chatWindow/contextObjectsLoadFailedAction">, setAllowedRelationshipTypesAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
105
113
  allowedRelationshipTypes?: IAllowedRelationshipType[] | undefined;
106
114
  }, "chatWindow/setAllowedRelationshipTypesAction">, onDefinitionReceivedAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
107
115
  definitionType: "dashboard" | "visualization";
@@ -1 +1 @@
1
- {"version":3,"file":"chatWindowSlice.d.ts","sourceRoot":"","sources":["../../../src/store/chatWindow/chatWindowSlice.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,OAAO,EAAe,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EAGxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAKjE,OAAO,EACH,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EAExB,KAAK,YAAY,EACpB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,oBAAoB,GAAG;IACxB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC;;OAEG;IACH,iBAAiB,CAAC,EAAE,cAAc,CAAC;IACnC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,wBAAwB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACtD;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAoChD,eAAO,MAAM,yBAAyB;;;0BAWpC,CAAC;AAoLH,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,oBAAoB,CAA2B,CAAC;AAC7F,eAAO,MACH,aAAa;;gCACb,gBAAgB;;mCAChB,qBAAqB;;wCACrB,iBAAiB;;oCACjB,qBAAqB;;wCACrB,0BAA0B;;6CAC1B,mCAAmC;;sDACnC,oBAAoB;;uCACpB,aAAa;;;gCACb,sBAAsB,+HACtB,2BAA2B,oGAC3B,mCAAmC,4GACnC,0BAA0B;;6CAC1B,8BAA8B,uGAC9B,iCAAiC;;;oDACjC,iCAAiC,0GACjC,iCAAiC;;oDACjC,0BAA0B;;;;;;;;6CAC1B,yBAAyB;;4CACzB,4BAA4B;;+CAC5B,kBAAkB;;;AAClB;;;GAGG;AACH,mBAAmB;;;AACnB;;GAEG;AACH,2BAA2B;;;AAC3B;;GAEG;AACH,oBAAoB;;;qCACG,CAAC"}
1
+ {"version":3,"file":"chatWindowSlice.d.ts","sourceRoot":"","sources":["../../../src/store/chatWindow/chatWindowSlice.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,OAAO,EAAe,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;A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e,CAAC;AAqChD,eAAO,MAAM,yBAAyB;;;0BAWpC,CAAC;AAkMH,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,oBAAoB,CAA2B,CAAC;AAC7F,eAAO,MACH,aAAa;;gCACb,gBAAgB;;mCAChB,qBAAqB;;wCACrB,iBAAiB;;oCACjB,qBAAqB;;wCACrB,0BAA0B;;6CAC1B,mCAAmC;;sDACnC,oBAAoB;;uCACpB,aAAa;;;gCACb,sBAAsB,+HACtB,wBAAwB,iGACxB,gCAAgC;;mDAChC,uBAAuB;;;0CACvB,2BAA2B;;8CAC3B,8BAA8B;;;;iDAC9B,8BAA8B;;iDAC9B,iCAAiC;;oDACjC,0BAA0B;;;;;;;;6CAC1B,yBAAyB;;4CACzB,4BAA4B;;+CAC5B,kBAAkB;;;AAClB;;;GAGG;AACH,mBAAmB;;;AACnB;;GAEG;AACH,2BAA2B;;;AAC3B;;GAEG;AACH,oBAAoB;;;qCACG,CAAC"}
@@ -1,17 +1,23 @@
1
1
  // (C) 2024-2026 GoodData Corporation
2
2
  import { createSlice } from "@reduxjs/toolkit";
3
- import { isIdentifierRef, serializeObjRef, } from "@gooddata/sdk-model";
3
+ import { serializeObjRef, } from "@gooddata/sdk-model";
4
4
  import { addAmbientContextReferences, addContextReference } from "../../context/addContextReference.js";
5
5
  import { mergeContexts } from "../../context/build.js";
6
6
  import { removeContextReference, removeUserContextReferences } from "../../context/removeContextReference.js";
7
7
  import { clearThreadAction, startNewConversationAction } from "../messages/messagesSlice.js";
8
8
  export const chatWindowSliceName = "chatWindow";
9
- function toDashboardListItem(dashboard) {
10
- const ref = dashboard.ref;
9
+ function emptyContextObjectList() {
11
10
  return {
12
- id: isIdentifierRef(ref) ? ref.identifier : ref.uri,
13
- ref,
14
- title: dashboard.title,
11
+ items: [],
12
+ loadedPages: 0,
13
+ hasNextPage: true,
14
+ isLoading: false,
15
+ };
16
+ }
17
+ function emptyContextObjects() {
18
+ return {
19
+ dashboard: emptyContextObjectList(),
20
+ visualization: emptyContextObjectList(),
15
21
  };
16
22
  }
17
23
  const initialState = {
@@ -24,12 +30,7 @@ const initialState = {
24
30
  includeTags: undefined,
25
31
  excludeTags: undefined,
26
32
  allowedRelationshipTypes: undefined,
27
- contextDashboards: {
28
- items: [],
29
- loadedPages: 0,
30
- hasNextPage: true,
31
- isLoading: false,
32
- },
33
+ contextObjects: emptyContextObjects(),
33
34
  context: {
34
35
  ambient: undefined,
35
36
  active: undefined,
@@ -39,7 +40,7 @@ const initialState = {
39
40
  };
40
41
  export const getInitialChatWindowState = ({ isPreview, allowInteractionIntelligence, } = {}) => ({
41
42
  ...initialState,
42
- contextDashboards: { ...initialState.contextDashboards, items: [] },
43
+ contextObjects: emptyContextObjects(),
43
44
  isPreview,
44
45
  allowInteractionIntelligence,
45
46
  });
@@ -81,22 +82,23 @@ const chatWindowSlice = createSlice({
81
82
  setCatalogItemsActions: (state, { payload }) => {
82
83
  state.catalogItems = payload;
83
84
  },
84
- initContextDashboardsAction: (state) => state,
85
- loadContextDashboardsNextPageAction: (state) => state,
86
- setContextDashboardsAction: (state, { payload: { items } }) => {
87
- state.contextDashboards = {
88
- items: items.map(toDashboardListItem),
85
+ initContextObjectsAction: (state) => state,
86
+ loadContextObjectsNextPageAction: (state, _action) => state,
87
+ setContextObjectsAction: (state, { payload: { kind, items }, }) => {
88
+ state.contextObjects[kind] = {
89
+ items,
89
90
  loadedPages: 1,
90
91
  hasNextPage: false,
91
92
  isLoading: false,
92
93
  };
93
94
  },
94
- contextDashboardsLoadingAction: (state) => {
95
- state.contextDashboards.isLoading = true;
95
+ contextObjectsLoadingAction: (state, { payload: { kind } }) => {
96
+ state.contextObjects[kind].isLoading = true;
96
97
  },
97
- contextDashboardsPageLoadedAction: (state, { payload: { items, hasNextPage }, }) => {
98
- const known = new Set(state.contextDashboards.items.map((item) => serializeObjRef(item.ref)));
99
- const newItems = items.map(toDashboardListItem).filter((item) => {
98
+ contextObjectsPageLoadedAction: (state, { payload: { kind, items, hasNextPage }, }) => {
99
+ const list = state.contextObjects[kind];
100
+ const known = new Set(list.items.map((item) => serializeObjRef(item.ref)));
101
+ const newItems = items.filter((item) => {
100
102
  const refKey = serializeObjRef(item.ref);
101
103
  if (known.has(refKey)) {
102
104
  return false;
@@ -104,13 +106,13 @@ const chatWindowSlice = createSlice({
104
106
  known.add(refKey);
105
107
  return true;
106
108
  });
107
- state.contextDashboards.items.push(...newItems);
108
- state.contextDashboards.loadedPages += 1;
109
- state.contextDashboards.hasNextPage = hasNextPage;
110
- state.contextDashboards.isLoading = false;
109
+ list.items.push(...newItems);
110
+ list.loadedPages += 1;
111
+ list.hasNextPage = hasNextPage;
112
+ list.isLoading = false;
111
113
  },
112
- contextDashboardsLoadFailedAction: (state) => {
113
- state.contextDashboards.isLoading = false;
114
+ contextObjectsLoadFailedAction: (state, { payload: { kind } }) => {
115
+ state.contextObjects[kind].isLoading = false;
114
116
  },
115
117
  setAllowedRelationshipTypesAction: (state, { payload: { allowedRelationshipTypes }, }) => {
116
118
  state.allowedRelationshipTypes = allowedRelationshipTypes;
@@ -154,7 +156,7 @@ const chatWindowSlice = createSlice({
154
156
  },
155
157
  });
156
158
  export const chatWindowSliceReducer = chatWindowSlice.reducer;
157
- export const { setOpenAction, setHistoryAction, setColorPaletteAction, setSettingsAction, copyToClipboardAction, setKeyDriverAnalysisAction, setKeyDriverAnalysisMinimizedAction, setObjectTypesAction, setTagsAction, setCatalogItemsActions, initContextDashboardsAction, loadContextDashboardsNextPageAction, setContextDashboardsAction, contextDashboardsLoadingAction, contextDashboardsPageLoadedAction, contextDashboardsLoadFailedAction, setAllowedRelationshipTypesAction, onDefinitionReceivedAction, addContextReferenceAction, removeContextReferenceAction, setIsPreviewAction,
159
+ export const { setOpenAction, setHistoryAction, setColorPaletteAction, setSettingsAction, copyToClipboardAction, setKeyDriverAnalysisAction, setKeyDriverAnalysisMinimizedAction, setObjectTypesAction, setTagsAction, setCatalogItemsActions, initContextObjectsAction, loadContextObjectsNextPageAction, setContextObjectsAction, contextObjectsLoadingAction, contextObjectsPageLoadedAction, contextObjectsLoadFailedAction, setAllowedRelationshipTypesAction, onDefinitionReceivedAction, addContextReferenceAction, removeContextReferenceAction, setIsPreviewAction,
158
160
  /**
159
161
  * Switches the assistant between the docked and the fullscreen layout.
160
162
  * @public
@@ -1,5 +1,5 @@
1
1
  import { type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
2
- import { type CatalogItem, type GenAIObjectType, type IColorPalette, type IListedDashboard } from "@gooddata/sdk-model";
2
+ import { type CatalogItem, type GenAIObjectType, type IColorPalette, type IInsight, type IListedDashboard } from "@gooddata/sdk-model";
3
3
  import type { GenAIAssistantMode, LinkHandlerEvent } from "../components/ConfigContext.js";
4
4
  /**
5
5
  * A dispatcher for chat events.
@@ -13,6 +13,7 @@ export declare class OptionsDispatcher {
13
13
  private excludeTags;
14
14
  private catalogItems;
15
15
  private dashboards;
16
+ private visualizations;
16
17
  private mode;
17
18
  private onLinkClick;
18
19
  private allowNativeLinks;
@@ -36,6 +37,8 @@ export declare class OptionsDispatcher {
36
37
  getCatalogItems(): CatalogItem[] | undefined;
37
38
  setDashboards(dashboards: IListedDashboard[] | undefined): void;
38
39
  getDashboards(): IListedDashboard[] | undefined;
40
+ setVisualizations(visualizations: IInsight[] | undefined): void;
41
+ getVisualizations(): IInsight[] | undefined;
39
42
  setMode(mode: GenAIAssistantMode | undefined): void;
40
43
  getMode(): GenAIAssistantMode | undefined;
41
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/store/options.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gCAAg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,SAAS,CAE/C;CACJ"}
@@ -11,6 +11,7 @@ export class OptionsDispatcher {
11
11
  excludeTags = undefined;
12
12
  catalogItems = undefined;
13
13
  dashboards = undefined;
14
+ visualizations = undefined;
14
15
  mode = undefined;
15
16
  onLinkClick = undefined;
16
17
  allowNativeLinks = undefined;
@@ -64,6 +65,12 @@ export class OptionsDispatcher {
64
65
  getDashboards() {
65
66
  return this.dashboards;
66
67
  }
68
+ setVisualizations(visualizations) {
69
+ this.visualizations = visualizations;
70
+ }
71
+ getVisualizations() {
72
+ return this.visualizations;
73
+ }
67
74
  setMode(mode) {
68
75
  this.mode = mode;
69
76
  }
@@ -1,11 +1,11 @@
1
1
  // (C) 2024-2026 GoodData Corporation
2
2
  import { call, fork, takeEvery, takeLatest, takeLeading } from "redux-saga/effects";
3
- import { initContextDashboardsAction, loadContextDashboardsNextPageAction, setOpenAction, } from "../chatWindow/chatWindowSlice.js";
3
+ import { initContextObjectsAction, loadContextObjectsNextPageAction, setOpenAction, } from "../chatWindow/chatWindowSlice.js";
4
4
  import { clearThreadAction, deleteConversationAction, evaluateMessageUpdateAction, loadThreadAction, newMessageAction, pinConversationAction, renameConversationAction, saveVisualisationRenderStatusAction, saveVisualizationAction, saveVisualizationSuccessAction, setUserFeedback, setVerboseAction, } from "../messages/messagesSlice.js";
5
5
  import { loadAgents } from "./loadAgents.js";
6
6
  import { loadCatalogItems } from "./loadCatalogItems.js";
7
7
  import { loadColorPalette } from "./loadColorPalette.js";
8
- import { initContextDashboards, loadContextDashboardsNextPage } from "./loadContextDashboards.js";
8
+ import { initContextObjects, loadContextObjectsNextPage } from "./loadContextObjects.js";
9
9
  import { loadSettings } from "./loadSettings.js";
10
10
  import { onChatOpenSync } from "./onChatOpenSync.js";
11
11
  import { onConversationDelete } from "./onConversationDelete.js";
@@ -43,8 +43,8 @@ export function* rootSaga() {
43
43
  yield takeEvery(deleteConversationAction.type, onConversationDelete);
44
44
  yield takeEvery(evaluateMessageUpdateAction.type, onUserMessageUpdate);
45
45
  //context chooser
46
- yield takeLeading(initContextDashboardsAction.type, initContextDashboards);
47
- yield takeLeading(loadContextDashboardsNextPageAction.type, loadContextDashboardsNextPage);
46
+ yield takeLeading(initContextObjectsAction.type, initContextObjects);
47
+ yield takeEvery(loadContextObjectsNextPageAction.type, loadContextObjectsNextPage);
48
48
  //others
49
49
  yield takeEvery(setVerboseAction.type, onVerboseStore);
50
50
  yield fork(onEvent);
@@ -0,0 +1,15 @@
1
+ import { type ContextObjectsState } from "../../types.js";
2
+ import { type loadContextObjectsNextPageAction } from "../chatWindow/chatWindowSlice.js";
3
+ /**
4
+ * Load the first page of the dashboards offered by the context chooser. Skips it when already
5
+ * loaded. Only the dashboards - the visualizations follow them in the list.
6
+ * @internal
7
+ */
8
+ export declare function initContextObjects(): Generator<import("redux-saga/effects").CallEffect<void>, void, unknown>;
9
+ /**
10
+ * Load the next page of one of the object lists offered by the context chooser. Each kind is
11
+ * paged on its own, so a load in flight for one kind does not block the other.
12
+ * @internal
13
+ */
14
+ export declare function loadContextObjectsNextPage({ payload: { kind } }: ReturnType<typeof loadContextObjectsNextPageAction>): Generator<import("redux-saga/effects").CallEffect<void> | import("redux-saga/effects").SelectEffect, void, ContextObjectsState>;
15
+ //# sourceMappingURL=loadContextObjects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadContextObjects.d.ts","sourceRoot":"","sources":["../../../src/store/sideEffects/loadContextObjects.ts"],"names":[],"mappings":"AAOA,OAAO,EAA0B,KAAK,mBAAmB,EAA8B,MAAM,gBAAgB,CAAC;AAG9G,OAAO,EAIH,KAAK,gCAAgC,EAExC,MAAM,kCAAkC,CAAC;AAU1C;;;;GAIG;AACH,wBAAiB,kBAAkB,4EAElC;AAED;;;;GAIG;AACH,wBAAiB,0BAA0B,CAAC,EACxC,OAAO,EAAE,EAAE,IAAI,EAAE,EACpB,EAAE,UAAU,CAAC,OAAO,gCAAgC,CAAC,mIASrD"}
@@ -0,0 +1,104 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { call, cancelled, getContext, put, select } from "redux-saga/effects";
3
+ import { insightRef, insightTitle } from "@gooddata/sdk-model";
4
+ import { toContextListItem } from "../../utils.js";
5
+ import { contextObjectsSelector } from "../chatWindow/chatWindowSelectors.js";
6
+ import { contextObjectsLoadFailedAction, contextObjectsLoadingAction, contextObjectsPageLoadedAction, setContextObjectsAction, } from "../chatWindow/chatWindowSlice.js";
7
+ const PAGE_SIZE = 100;
8
+ /**
9
+ * Load the first page of the dashboards offered by the context chooser. Skips it when already
10
+ * loaded. Only the dashboards - the visualizations follow them in the list.
11
+ * @internal
12
+ */
13
+ export function* initContextObjects() {
14
+ yield call(initContextObjectList, "dashboard");
15
+ }
16
+ /**
17
+ * Load the next page of one of the object lists offered by the context chooser. Each kind is
18
+ * paged on its own, so a load in flight for one kind does not block the other.
19
+ * @internal
20
+ */
21
+ export function* loadContextObjectsNextPage({ payload: { kind }, }) {
22
+ const state = yield select(contextObjectsSelector);
23
+ const list = state[kind];
24
+ if (list.isLoading || !list.hasNextPage) {
25
+ return;
26
+ }
27
+ yield call(loadContextObjectsPage, kind, list.loadedPages);
28
+ }
29
+ function* initContextObjectList(kind) {
30
+ const state = yield select(contextObjectsSelector);
31
+ const list = state[kind];
32
+ if (list.isLoading || list.loadedPages > 0) {
33
+ return;
34
+ }
35
+ yield call(loadContextObjectsPage, kind, 0);
36
+ }
37
+ function* loadContextObjectsPage(kind, page) {
38
+ const externalItems = yield call(getExternalItems, kind);
39
+ if (externalItems) {
40
+ yield put(setContextObjectsAction({ kind, items: externalItems }));
41
+ return;
42
+ }
43
+ yield put(contextObjectsLoadingAction({ kind }));
44
+ try {
45
+ const loaded = yield call(kind === "dashboard" ? queryDashboardsPage : queryVisualizationsPage, page);
46
+ yield put(contextObjectsPageLoadedAction({ kind, ...loaded }));
47
+ }
48
+ catch (e) {
49
+ console.error(`Failed to load ${kind}s for the context chooser`, e);
50
+ yield put(contextObjectsLoadFailedAction({ kind }));
51
+ }
52
+ finally {
53
+ const wasCancelled = yield cancelled();
54
+ if (wasCancelled) {
55
+ yield put(contextObjectsLoadFailedAction({ kind }));
56
+ }
57
+ }
58
+ }
59
+ function* getExternalItems(kind) {
60
+ const options = yield getContext("optionsDispatcher");
61
+ if (kind === "dashboard") {
62
+ return options.getDashboards()?.map((dashboard) => toContextListItem(dashboard.ref, dashboard.title));
63
+ }
64
+ return options
65
+ .getVisualizations()
66
+ ?.map((insight) => toContextListItem(insightRef(insight), insightTitle(insight)));
67
+ }
68
+ function* queryDashboardsPage(page) {
69
+ const backend = yield getContext("backend");
70
+ const workspace = yield getContext("workspace");
71
+ const query = backend
72
+ .workspace(workspace)
73
+ .dashboards()
74
+ .getDashboardsQuery()
75
+ .withPage(page)
76
+ .withSize(PAGE_SIZE)
77
+ .withSorting(["title,asc"]);
78
+ const queryCall = query.query.bind(query);
79
+ const result = yield call(queryCall);
80
+ return {
81
+ items: result.items.map((dashboard) => toContextListItem(dashboard.ref, dashboard.title)),
82
+ hasNextPage: hasNextPage(result),
83
+ };
84
+ }
85
+ function* queryVisualizationsPage(page) {
86
+ const backend = yield getContext("backend");
87
+ const workspace = yield getContext("workspace");
88
+ const query = backend
89
+ .workspace(workspace)
90
+ .insights()
91
+ .getInsightsQuery()
92
+ .withPage(page)
93
+ .withSize(PAGE_SIZE)
94
+ .withSorting(["title,asc"]);
95
+ const queryCall = query.query.bind(query);
96
+ const result = yield call(queryCall);
97
+ return {
98
+ items: result.items.map((insight) => toContextListItem(insightRef(insight), insightTitle(insight))),
99
+ hasNextPage: hasNextPage(result),
100
+ };
101
+ }
102
+ function hasNextPage(result) {
103
+ return result.offset + result.items.length < result.totalCount;
104
+ }
package/esm/types.d.ts CHANGED
@@ -101,24 +101,35 @@ export interface IGenAIContextObject {
101
101
  type: GenAIObjectType | "widget";
102
102
  where: "view.dashboard" | "referencedObjects";
103
103
  context?: IGenAIObjectReference;
104
+ insightRef?: ObjRef;
104
105
  }
105
106
  /**
106
- * A dashboard offered by the context chooser.
107
+ * Kind of the object lists offered by the context chooser, on top of the ambient ones.
107
108
  * @internal
108
109
  */
109
- export interface IGenAIDashboardListItem {
110
+ export type ContextObjectKind = "dashboard" | "visualization";
111
+ /**
112
+ * An object offered by the context chooser.
113
+ * @internal
114
+ */
115
+ export interface IGenAIContextListItem {
110
116
  id: string;
111
117
  ref: ObjRef;
112
118
  title: string;
113
119
  }
114
120
  /**
115
- * State of the dashboard list offered by the context chooser.
121
+ * State of a single object list offered by the context chooser.
116
122
  * @internal
117
123
  */
118
- export type ContextDashboardsState = {
119
- items: IGenAIDashboardListItem[];
124
+ export type ContextObjectListState = {
125
+ items: IGenAIContextListItem[];
120
126
  loadedPages: number;
121
127
  hasNextPage: boolean;
122
128
  isLoading: boolean;
123
129
  };
130
+ /**
131
+ * State of the object lists offered by the context chooser. Each kind is paged on its own.
132
+ * @internal
133
+ */
134
+ export type ContextObjectsState = Record<ContextObjectKind, ContextObjectListState>;
124
135
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,2BAA2B,EAChC,KAAK,qCAAqC,EAC7C,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,MAAM,EACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,MAAM,MAAM,GACZ,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,WAAW,CACP,qCAAqC,CAAC,eAAe,CAAC,CACzD,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC;AAE7C,MAAM,MAAM,kBAAkB,GAAG;IAC7B;;;;;;;OAO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AAqB,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,eAAe,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACjC,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC"}
package/esm/utils.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { type IntlShape } from "react-intl";
2
- import { type GenAIObjectReferenceType, type IAttributeOrMeasure } from "@gooddata/sdk-model";
2
+ import { type GenAIObjectReferenceType, type IAttributeOrMeasure, type ObjRef } from "@gooddata/sdk-model";
3
3
  import { type IChatConversationLocal } from "./model.js";
4
- import { type IGenAIContextObject } from "./types.js";
4
+ import { type IGenAIContextListItem, type IGenAIContextObject } from "./types.js";
5
+ export declare function toContextListItem(ref: ObjRef, title: string): IGenAIContextListItem;
5
6
  export declare function getVisualizationHref(wsId: string, visId: string, status: "draft" | "saved", useHostedAnalyticalDesigner?: boolean): string;
6
7
  export declare function getDashboardHref(wsId: string, dasId: string, status: "draft" | "saved", useHostedDashboards?: boolean): string;
7
8
  export declare function getAbsoluteVisualizationHref(wsId: string, visId: string, status: "draft" | "saved", useHostedAnalyticalDesigner?: boolean): string;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM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AI,EAAE,wBAAwB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAa3G;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG,wBAAwB,CAe3G"}
package/esm/utils.js CHANGED
@@ -1,5 +1,13 @@
1
1
  // (C) 2025-2026 GoodData Corporation
2
+ import { isIdentifierRef, } from "@gooddata/sdk-model";
2
3
  import { REFERENCE_REGEX } from "./components/completion/references.js";
4
+ export function toContextListItem(ref, title) {
5
+ return {
6
+ id: isIdentifierRef(ref) ? ref.identifier : ref.uri,
7
+ ref,
8
+ title,
9
+ };
10
+ }
3
11
  export function getVisualizationHref(wsId, visId, status, useHostedAnalyticalDesigner) {
4
12
  if (status === "draft") {
5
13
  return useHostedAnalyticalDesigner
@@ -125,6 +133,8 @@ export function convertGenAiTypeToReferenceType(type) {
125
133
  return "METRIC";
126
134
  case "widget":
127
135
  return "WIDGET";
136
+ case "visualization":
137
+ return "WIDGET";
128
138
  case "attribute":
129
139
  return "ATTRIBUTE";
130
140
  case "dashboard":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-gen-ai",
3
- "version": "11.53.0-alpha.3",
3
+ "version": "11.53.0-alpha.5",
4
4
  "description": "GoodData GenAI SDK",
5
5
  "license": "MIT",
6
6
  "author": "GoodData Corporation",
@@ -57,18 +57,18 @@
57
57
  "reselect": "5.1.1",
58
58
  "tslib": "2.8.1",
59
59
  "uuid": "11.1.1",
60
- "@gooddata/api-client-tiger": "11.53.0-alpha.3",
61
- "@gooddata/sdk-model": "11.53.0-alpha.3",
62
- "@gooddata/sdk-backend-spi": "11.53.0-alpha.3",
63
- "@gooddata/sdk-ui": "11.53.0-alpha.3",
64
- "@gooddata/sdk-ui-charts": "11.53.0-alpha.3",
65
- "@gooddata/sdk-ui-dashboard": "11.53.0-alpha.3",
66
- "@gooddata/sdk-ui-kit": "11.53.0-alpha.3",
67
- "@gooddata/sdk-ui-filters": "11.53.0-alpha.3",
68
- "@gooddata/sdk-ui-semantic-search": "11.53.0-alpha.3",
69
- "@gooddata/sdk-ui-pivot": "11.53.0-alpha.3",
70
- "@gooddata/sdk-ui-theme-provider": "11.53.0-alpha.3",
71
- "@gooddata/util": "11.53.0-alpha.3"
60
+ "@gooddata/api-client-tiger": "11.53.0-alpha.5",
61
+ "@gooddata/sdk-backend-spi": "11.53.0-alpha.5",
62
+ "@gooddata/sdk-ui": "11.53.0-alpha.5",
63
+ "@gooddata/sdk-model": "11.53.0-alpha.5",
64
+ "@gooddata/sdk-ui-charts": "11.53.0-alpha.5",
65
+ "@gooddata/sdk-ui-dashboard": "11.53.0-alpha.5",
66
+ "@gooddata/sdk-ui-filters": "11.53.0-alpha.5",
67
+ "@gooddata/sdk-ui-kit": "11.53.0-alpha.5",
68
+ "@gooddata/sdk-ui-pivot": "11.53.0-alpha.5",
69
+ "@gooddata/sdk-ui-semantic-search": "11.53.0-alpha.5",
70
+ "@gooddata/sdk-ui-theme-provider": "11.53.0-alpha.5",
71
+ "@gooddata/util": "11.53.0-alpha.5"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@microsoft/api-documenter": "^7.17.0",
@@ -111,13 +111,13 @@
111
111
  "typescript": "5.9.3",
112
112
  "vitest": "4.1.8",
113
113
  "vitest-dom": "0.1.1",
114
- "@gooddata/eslint-config": "11.53.0-alpha.3",
115
- "@gooddata/i18n-toolkit": "11.53.0-alpha.3",
116
- "@gooddata/oxlint-config": "11.53.0-alpha.3",
117
- "@gooddata/reference-workspace": "11.53.0-alpha.3",
118
- "@gooddata/sdk-ui-theme-provider": "11.53.0-alpha.3",
119
- "@gooddata/sdk-backend-mockingbird": "11.53.0-alpha.3",
120
- "@gooddata/stylelint-config": "11.53.0-alpha.3"
114
+ "@gooddata/eslint-config": "11.53.0-alpha.5",
115
+ "@gooddata/i18n-toolkit": "11.53.0-alpha.5",
116
+ "@gooddata/oxlint-config": "11.53.0-alpha.5",
117
+ "@gooddata/reference-workspace": "11.53.0-alpha.5",
118
+ "@gooddata/sdk-backend-mockingbird": "11.53.0-alpha.5",
119
+ "@gooddata/sdk-ui-theme-provider": "11.53.0-alpha.5",
120
+ "@gooddata/stylelint-config": "11.53.0-alpha.5"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "react": "^18.0.0 || ^19.0.0",
@@ -1,12 +0,0 @@
1
- import { type ContextDashboardsState } from "../../types.js";
2
- /**
3
- * Load the first page of dashboards for the context chooser. Skips when already loaded.
4
- * @internal
5
- */
6
- export declare function initContextDashboards(): Generator<import("redux-saga/effects").CallEffect<void> | import("redux-saga/effects").SelectEffect, void, ContextDashboardsState>;
7
- /**
8
- * Load the next page of dashboards for the context chooser.
9
- * @internal
10
- */
11
- export declare function loadContextDashboardsNextPage(): Generator<import("redux-saga/effects").CallEffect<void> | import("redux-saga/effects").SelectEffect, void, ContextDashboardsState>;
12
- //# sourceMappingURL=loadContextDashboards.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadContextDashboards.d.ts","sourceRoot":"","sources":["../../../src/store/sideEffects/loadContextDashboards.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAY7D;;;GAGG;AACH,wBAAiB,qBAAqB,uIAQrC;AAED;;;GAGG;AACH,wBAAiB,6BAA6B,uIAQ7C"}
@@ -1,57 +0,0 @@
1
- // (C) 2026 GoodData Corporation
2
- import { call, getContext, put, select } from "redux-saga/effects";
3
- import { contextDashboardsSelector } from "../chatWindow/chatWindowSelectors.js";
4
- import { contextDashboardsLoadFailedAction, contextDashboardsLoadingAction, contextDashboardsPageLoadedAction, setContextDashboardsAction, } from "../chatWindow/chatWindowSlice.js";
5
- const PAGE_SIZE = 100;
6
- /**
7
- * Load the first page of dashboards for the context chooser. Skips when already loaded.
8
- * @internal
9
- */
10
- export function* initContextDashboards() {
11
- const state = yield select(contextDashboardsSelector);
12
- if (state.isLoading || state.loadedPages > 0) {
13
- return;
14
- }
15
- yield call(loadContextDashboardsPage, 0);
16
- }
17
- /**
18
- * Load the next page of dashboards for the context chooser.
19
- * @internal
20
- */
21
- export function* loadContextDashboardsNextPage() {
22
- const state = yield select(contextDashboardsSelector);
23
- if (state.isLoading || !state.hasNextPage) {
24
- return;
25
- }
26
- yield call(loadContextDashboardsPage, state.loadedPages);
27
- }
28
- function* loadContextDashboardsPage(page) {
29
- const options = yield getContext("optionsDispatcher");
30
- const dashboards = options.getDashboards();
31
- if (dashboards) {
32
- yield put(setContextDashboardsAction({ items: dashboards }));
33
- return;
34
- }
35
- yield put(contextDashboardsLoadingAction());
36
- try {
37
- const backend = yield getContext("backend");
38
- const workspace = yield getContext("workspace");
39
- const query = backend
40
- .workspace(workspace)
41
- .dashboards()
42
- .getDashboardsQuery()
43
- .withPage(page)
44
- .withSize(PAGE_SIZE)
45
- .withSorting(["title,asc"]);
46
- const queryCall = query.query.bind(query);
47
- const result = yield call(queryCall);
48
- yield put(contextDashboardsPageLoadedAction({
49
- items: result.items,
50
- hasNextPage: result.offset + result.items.length < result.totalCount,
51
- }));
52
- }
53
- catch (e) {
54
- console.error("Failed to load dashboards for the context chooser", e);
55
- yield put(contextDashboardsLoadFailedAction());
56
- }
57
- }