@gooddata/sdk-ui-gen-ai 11.48.0-alpha.2 → 11.48.0-alpha.4

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 (54) hide show
  1. package/esm/components/GenAIChatContextIndicator.d.ts.map +1 -1
  2. package/esm/components/GenAIChatContextIndicator.js +11 -11
  3. package/esm/components/GenAIChatConversations.d.ts.map +1 -1
  4. package/esm/components/GenAIChatConversations.js +2 -3
  5. package/esm/components/GenAIChatDialogConnected.d.ts +3 -1
  6. package/esm/components/GenAIChatDialogConnected.d.ts.map +1 -1
  7. package/esm/components/GenAIChatDialogConnected.js +25 -11
  8. package/esm/components/GenAiChatContextChooser.d.ts +1 -1
  9. package/esm/components/GenAiChatContextChooser.d.ts.map +1 -1
  10. package/esm/components/GenAiChatContextChooser.js +8 -8
  11. package/esm/components/hooks/useContextItems.d.ts +2 -2
  12. package/esm/components/hooks/useContextItems.d.ts.map +1 -1
  13. package/esm/components/hooks/useContextItems.js +5 -5
  14. package/esm/components/messages/components/SemanticSearchTreeView.d.ts.map +1 -1
  15. package/esm/components/messages/components/SemanticSearchTreeView.js +2 -4
  16. package/esm/components/messages/contents/CustomHyperlink.d.ts.map +1 -1
  17. package/esm/components/messages/contents/CustomHyperlink.js +4 -12
  18. package/esm/components/utils/icons.d.ts +2 -2
  19. package/esm/components/utils/icons.d.ts.map +1 -1
  20. package/esm/components/utils/icons.js +1 -0
  21. package/esm/context/addContextReference.d.ts +3 -2
  22. package/esm/context/addContextReference.d.ts.map +1 -1
  23. package/esm/context/addContextReference.js +62 -7
  24. package/esm/context/build.d.ts +2 -2
  25. package/esm/context/build.d.ts.map +1 -1
  26. package/esm/context/build.js +35 -4
  27. package/esm/context/collectContextReferences.d.ts +4 -10
  28. package/esm/context/collectContextReferences.d.ts.map +1 -1
  29. package/esm/context/collectContextReferences.js +96 -8
  30. package/esm/context/dashboard.d.ts.map +1 -1
  31. package/esm/context/dashboard.js +10 -4
  32. package/esm/context/removeContextReference.d.ts +2 -1
  33. package/esm/context/removeContextReference.d.ts.map +1 -1
  34. package/esm/context/removeContextReference.js +31 -2
  35. package/esm/store/chatWindow/chatWindowSelectors.d.ts +1 -8
  36. package/esm/store/chatWindow/chatWindowSelectors.d.ts.map +1 -1
  37. package/esm/store/chatWindow/chatWindowSelectors.js +1 -13
  38. package/esm/store/chatWindow/chatWindowSlice.d.ts +5 -3
  39. package/esm/store/chatWindow/chatWindowSlice.d.ts.map +1 -1
  40. package/esm/store/chatWindow/chatWindowSlice.js +15 -17
  41. package/esm/store/sideEffects/onUserMessage.d.ts.map +1 -1
  42. package/esm/store/sideEffects/onUserMessage.js +3 -12
  43. package/esm/types.d.ts +15 -10
  44. package/esm/types.d.ts.map +1 -1
  45. package/esm/utils.d.ts +4 -1
  46. package/esm/utils.d.ts.map +1 -1
  47. package/esm/utils.js +28 -0
  48. package/package.json +20 -20
  49. package/styles/css/conversations.css +0 -6
  50. package/styles/css/conversations.css.map +1 -1
  51. package/styles/css/main.css +31 -15
  52. package/styles/css/main.css.map +1 -1
  53. package/styles/scss/conversations.scss +0 -7
  54. package/styles/scss/main.scss +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"GenAIChatContextIndicator.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatContextIndicator.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAe,MAAM,OAAO,CAAC;AAY7C,KAAK,iCAAiC,GAAG;IACrC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAoDF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,iCAAiC,CAG5C,CAAC"}
1
+ {"version":3,"file":"GenAIChatContextIndicator.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatContextIndicator.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAe,MAAM,OAAO,CAAC;AAa7C,KAAK,iCAAiC,GAAG;IACrC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAuDF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,iCAAiC,CAG5C,CAAC"}
@@ -4,8 +4,8 @@ import { useCallback } from "react";
4
4
  import { connect, useSelector } from "react-redux";
5
5
  import { UiChip } from "@gooddata/sdk-ui-kit";
6
6
  import { collectContextReferences } from "../context/collectContextReferences.js";
7
- import { effectiveContextSelector } from "../store/chatWindow/chatWindowSelectors.js";
8
- import { removeAmbientUserContextAction } from "../store/chatWindow/chatWindowSlice.js";
7
+ import { userContextSelector } from "../store/chatWindow/chatWindowSelectors.js";
8
+ import { removeContextReferenceAction } from "../store/chatWindow/chatWindowSlice.js";
9
9
  import { getIconByType } from "./utils/icons.js";
10
10
  /**
11
11
  * Shows what ambient context the assistant is answering about — the open dashboard and its live
@@ -15,21 +15,21 @@ import { getIconByType } from "./utils/icons.js";
15
15
  *
16
16
  * @internal
17
17
  */
18
- function GenAIChatContextIndicatorCore({ removeAmbientUserContext, onDelete, }) {
19
- const { ambient } = useSelector(effectiveContextSelector);
20
- const ambientReferences = collectContextReferences(ambient, "ambient");
21
- const onAmbientDelete = useCallback(() => {
18
+ function GenAIChatContextIndicatorCore({ removeContextReference, onDelete, }) {
19
+ const context = useSelector(userContextSelector);
20
+ const references = collectContextReferences(context);
21
+ const onDeleteHandler = useCallback((reference) => {
22
22
  return () => {
23
- removeAmbientUserContext();
23
+ removeContextReference({ object: reference });
24
24
  onDelete?.();
25
25
  };
26
- }, [removeAmbientUserContext, onDelete]);
27
- if (ambientReferences.length === 0) {
26
+ }, [removeContextReference, onDelete]);
27
+ if (references.length === 0) {
28
28
  return null;
29
29
  }
30
- return (_jsx("div", { className: "gd-gen-ai-chat__context-indicator", "aria-live": "polite", children: ambientReferences.map((reference, index) => (_jsx(UiChip, { ...getIconByType(reference.type), label: reference.title, isExpandable: false, isDeletable: true, onDelete: onAmbientDelete() }, index))) }));
30
+ return (_jsx("div", { className: "gd-gen-ai-chat__context-indicator", "aria-live": "polite", children: references.map((reference, index) => (_jsx(UiChip, { ...getIconByType(reference.type), label: reference.title, isExpandable: false, isDeletable: true, onDelete: onDeleteHandler(reference) }, index))) }));
31
31
  }
32
32
  const mapDispatchToProps = {
33
- removeAmbientUserContext: removeAmbientUserContextAction,
33
+ removeContextReference: removeContextReferenceAction,
34
34
  };
35
35
  export const GenAIChatContextIndicator = connect(null, mapDispatchToProps)(GenAIChatContextIndicatorCore);
@@ -1 +1 @@
1
- {"version":3,"file":"GenAIChatConversations.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatConversations.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,EAAE,EAGP,KAAK,YAAY,EASpB,MAAM,OAAO,CAAC;AAkBf,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EACH,oBAAoB,EAEpB,qBAAqB,EACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACH,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EAC3B,MAAM,oCAAoC,CAAC;AAY5C,KAAK,gCAAgC,GAAG;IACpC,YAAY,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;IACtD,aAAa,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;CAC3D,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACvC,kBAAkB,EAAE,OAAO,wBAAwB,CAAC;IACpD,eAAe,EAAE,OAAO,qBAAqB,CAAC;IAC9C,kBAAkB,EAAE,OAAO,wBAAwB,CAAC;CACvD,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACvC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,YAAY,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,gCAAgC,GACtE,mCAAmC,GACnC,mCAAmC,CAAC;AAkrBxC,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,mCAAmC,CAGzC,CAAC"}
1
+ {"version":3,"file":"GenAIChatConversations.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatConversations.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,EAAE,EAGP,KAAK,YAAY,EASpB,MAAM,OAAO,CAAC;AAkBf,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EACH,oBAAoB,EAEpB,qBAAqB,EACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACH,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EAC3B,MAAM,oCAAoC,CAAC;AAY5C,KAAK,gCAAgC,GAAG;IACpC,YAAY,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;IACtD,aAAa,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;CAC3D,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACvC,kBAAkB,EAAE,OAAO,wBAAwB,CAAC;IACpD,eAAe,EAAE,OAAO,qBAAqB,CAAC;IAC9C,kBAAkB,EAAE,OAAO,wBAAwB,CAAC;CACvD,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACvC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,YAAY,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,gCAAgC,GACtE,mCAAmC,GACnC,mCAAmC,CAAC;AA+qBxC,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,mCAAmC,CAGzC,CAAC"}
@@ -90,9 +90,8 @@ function GenAIChatConversationsComponent({ onClose, onSelect, wrapper, deleteCon
90
90
  data: conversation,
91
91
  },
92
92
  {
93
- type: "static",
93
+ type: "separator",
94
94
  id: "delete-separator",
95
- data: (_jsx("div", { className: "gd-gen-ai-chat__window__conversations__divider_menu" })),
96
95
  },
97
96
  {
98
97
  type: "interactive",
@@ -210,7 +209,7 @@ function GenAIChatConversationsComponent({ onClose, onSelect, wrapper, deleteCon
210
209
  setActiveDropZone(undefined);
211
210
  }, [draggedConversation, pinConversation]);
212
211
  const handleMenuUnhandledKeyDown = useCallback((event, { focusedItem }) => {
213
- if (event.key === "Delete" && focusedItem) {
212
+ if (event.key === "Delete" && focusedItem?.type === "interactive") {
214
213
  event.preventDefault();
215
214
  event.stopPropagation();
216
215
  setConversationToDelete(focusedItem.data);
@@ -81,6 +81,8 @@ export interface IGenAIChatDialogConnectedProps {
81
81
  ambientUserContext?: IGenAIUserContext;
82
82
  /** When true, the seeded question is appended to the existing thread instead of clearing it first. */
83
83
  appendToChat?: boolean;
84
+ /** When true, the user context is replaced instead of merged with the existing one. */
85
+ replaceUserContext?: boolean;
84
86
  /** Object-search tag scope reflecting the caller's current view. */
85
87
  includeTags?: string[];
86
88
  excludeTags?: string[];
@@ -111,5 +113,5 @@ export interface IGenAIChatDialogConnectedProps {
111
113
  *
112
114
  * @internal
113
115
  */
114
- export declare function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, isOpen, onOpen, onClose, askedQuestion, askSeq, userContext, ambientUserContext, appendToChat, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks, onLinkClick, returnFocusTo }: IGenAIChatDialogConnectedProps): import("react/jsx-runtime").JSX.Element;
116
+ export declare function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, isOpen, onOpen, onClose, askedQuestion, askSeq, userContext, ambientUserContext, appendToChat, replaceUserContext, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks, onLinkClick, returnFocusTo }: IGenAIChatDialogConnectedProps): import("react/jsx-runtime").JSX.Element;
115
117
  //# sourceMappingURL=GenAIChatDialogConnected.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GenAIChatDialogConnected.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatDialogConnected.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7F,OAAO,EACH,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,+BAA+B,EACpC,KAAK,iCAAiC,EACtC,KAAK,oBAAoB,EAW5B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D;;;;;;;;;GASG;AACH,MAAM,MAAM,uBAAuB,GAC7B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,oBAAoB,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,yBAAyB,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,OA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C;IACnD,sFAAsF;IACtF,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAExC,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,WAAW,CAAC,EAAE,CAAC,cAAc,EAAE,gBAAgB,KAAK,MAAM,GAAG,SAAS,CAAC;IACvE,iDAAiD;IACjD,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC;CAC1D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,EACrC,OAAO,EACP,SAAS,EACT,MAAM,EACN,SAAS,EACT,UAAU,EACV,cAAc,EACd,QAAQ,EACR,MAAM,EACN,MAAM,EACN,OAAO,EACP,aAAa,EACb,MAAM,EACN,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EAAE,mBAAmB,EAChC,OAAO,EACP,UAAU,EACV,cAAc,EACd,SAAS,EACT,YAAY,EACZ,gBAAuB,EACvB,WAAW,EACX,aAAa,EAChB,EAAE,8BAA8B,2CAoIhC"}
1
+ {"version":3,"file":"GenAIChatDialogConnected.d.ts","sourceRoot":"","sources":["../../src/components/GenAIChatDialogConnected.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7F,OAAO,EACH,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,wBAAwB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EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC;CAC1D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,EACrC,OAAO,EACP,SAAS,EACT,MAAM,EACN,SAAS,EACT,UAAU,EACV,cAAc,EACd,QAAQ,EACR,MAAM,EACN,MAAM,EACN,OAAO,EACP,aAAa,EACb,MAAM,EACN,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,WAAW,EAAE,mBAAmB,EAChC,OAAO,EACP,UAAU,EACV,cAAc,EACd,SAAS,EACT,YAAY,EACZ,gBAAuB,EACvB,WAAW,EACX,aAAa,EAChB,EAAE,8BAA8B,2CAmJhC"}
@@ -17,7 +17,7 @@ import { GenAIChatDialog } from "./GenAIChatDialog.js";
17
17
  *
18
18
  * @internal
19
19
  */
20
- export function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, isOpen, onOpen, onClose, askedQuestion, askSeq, userContext, ambientUserContext, appendToChat, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks = true, onLinkClick, returnFocusTo, }) {
20
+ export function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, isOpen, onOpen, onClose, askedQuestion, askSeq, userContext, ambientUserContext, appendToChat, replaceUserContext, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks = true, onLinkClick, returnFocusTo, }) {
21
21
  const defaultLinkClick = useCallback(({ itemUrl, newTab, preventDefault }) => {
22
22
  if (itemUrl) {
23
23
  preventDefault();
@@ -100,26 +100,40 @@ export function GenAIChatDialogConnected({ backend, workspace, locale, canManage
100
100
  const lastSeedTokenRef = useRef(null);
101
101
  useEffect(() => {
102
102
  // Only seed while the chat is open, and only once per ask (LX-2544).
103
- if (!isOpen || !chatDispatcher || !askedQuestion || !settings) {
103
+ if (!isOpen || !chatDispatcher || !settings) {
104
104
  return;
105
105
  }
106
- const seedToken = askSeq ?? askedQuestion;
106
+ const seedToken = askSeq ?? askedQuestion ?? JSON.stringify(userContext ?? {});
107
107
  if (lastSeedTokenRef.current === seedToken) {
108
108
  return;
109
109
  }
110
110
  lastSeedTokenRef.current = seedToken;
111
- if (!appendToChat) {
111
+ // Check clean
112
+ const clear = (askedQuestion || userContext) && !appendToChat;
113
+ if (clear) {
112
114
  chatDispatcher(clearThreadAction());
113
115
  }
114
116
  // Always set (and thereby clear when undefined) so a follow-up ask without context does not
115
117
  // inherit the previous ask's user context (LX-2544).
116
- chatDispatcher(setUserContextAction({ userContext }));
117
- if (settings.enableAiAgenticConversations) {
118
- chatDispatcher(newMessageAction(makeUserItem({ type: "text", text: askedQuestion })));
119
- }
120
- else {
121
- chatDispatcher(newMessageAction(makeUserMessage([makeTextContents(askedQuestion, [])])));
118
+ chatDispatcher(setUserContextAction({ userContext, replaceUserContext }));
119
+ // Ask question
120
+ if (askedQuestion) {
121
+ if (settings.enableAiAgenticConversations) {
122
+ chatDispatcher(newMessageAction(makeUserItem({ type: "text", text: askedQuestion })));
123
+ }
124
+ else {
125
+ chatDispatcher(newMessageAction(makeUserMessage([makeTextContents(askedQuestion, [])])));
126
+ }
122
127
  }
123
- }, [isOpen, chatDispatcher, askedQuestion, askSeq, userContext, appendToChat, settings]);
128
+ }, [
129
+ isOpen,
130
+ chatDispatcher,
131
+ askedQuestion,
132
+ askSeq,
133
+ userContext,
134
+ appendToChat,
135
+ settings,
136
+ replaceUserContext,
137
+ ]);
124
138
  return (_jsx(GenAIChatDialog, { isOpen: isOpen, locale: locale, backend: backend, workspace: workspace, canManage: canManage, canAnalyze: canAnalyze, canFullControl: canFullControl, settings: settings, objectTypes: objectTypes, includeTags: includeTags, excludeTags: excludeTags, className: className, dialogPosition: dialogPosition, colorPalette: colorPalette, allowNativeLinks: allowNativeLinks, onLinkClick: onLinkClick ?? defaultLinkClick, onOpen: onOpen, onClose: onClose, eventHandlers: eventHandlers, onDispatcher: onDispatcher, returnFocusTo: returnFocusTo }));
125
139
  }
@@ -1,5 +1,5 @@
1
1
  import { type FC } from "react";
2
- import { type IGenAIContextObject } from "../context/collectContextReferences.js";
2
+ import { type IGenAIContextObject } from "../types.js";
3
3
  type GenAiChatContextChooserOwnProps = {
4
4
  onAddContext?: (context: IGenAIContextObject) => void;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"GenAiChatContextChooser.d.ts","sourceRoot":"","sources":["../../src/components/GenAiChatContextChooser.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAQhC,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAOlF,KAAK,+BAA+B,GAAG;IACnC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACzD,CAAC;AA4FF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,+BAA+B,CAG1C,CAAC"}
1
+ {"version":3,"file":"GenAiChatContextChooser.d.ts","sourceRoot":"","sources":["../../src/components/GenAiChatContextChooser.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAWhC,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIvD,KAAK,+BAA+B,GAAG;IACnC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACzD,CAAC;AA4FF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,+BAA+B,CAG1C,CAAC"}
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { defineMessages, useIntl } from "react-intl";
3
3
  import { connect } from "react-redux";
4
4
  import { Dropdown, UiIconButton, UiMenu, UiSubmenuHeader } from "@gooddata/sdk-ui-kit";
5
- import { ambientContextSelector, effectiveContextSelector } from "../store/chatWindow/chatWindowSelectors.js";
5
+ import { ambientContextSelector, userContextSelector } from "../store/chatWindow/chatWindowSelectors.js";
6
6
  import { addContextReferenceAction } from "../store/chatWindow/chatWindowSlice.js";
7
7
  import { useContextItems } from "./hooks/useContextItems.js";
8
8
  const msgs = defineMessages({
@@ -10,10 +10,10 @@ const msgs = defineMessages({
10
10
  id: "gd.gen-ai.context.add_context",
11
11
  },
12
12
  });
13
- function GenAiChatContextChooserCore({ currentAmbient, selectedAmbient, addContextReference, onAddContext, }) {
13
+ function GenAiChatContextChooserCore({ active, ambient, addContextReference, onAddContext, }) {
14
14
  const intl = useIntl();
15
- const items = useContextItems(currentAmbient, selectedAmbient, "ambient");
16
- if (!currentAmbient) {
15
+ const items = useContextItems(ambient, active);
16
+ if (!ambient) {
17
17
  return null;
18
18
  }
19
19
  return (_jsx("div", { className: "gd-gen-ai-chat__input__context", children: _jsx(Dropdown, { alignPoints: [{ align: "tl bl", offset: { x: 0, y: 0 } }], closeOnEscape: true, fullscreenOnMobile: false, autofocusOnOpen: true, accessibilityConfig: {}, renderButton: ({ isOpen, toggleDropdown, accessibilityConfig }) => (_jsx(UiIconButton, { icon: "plus", variant: "tertiary", size: "small", dataTestId: "choose_context", isActive: isOpen, accessibilityConfig: {
@@ -26,11 +26,11 @@ function GenAiChatContextChooserCore({ currentAmbient, selectedAmbient, addConte
26
26
  } })) }) }));
27
27
  }
28
28
  const mapStateToProps = (state) => {
29
- const currentAmbient = ambientContextSelector(state);
30
- const { ambient } = effectiveContextSelector(state);
29
+ const ambient = ambientContextSelector(state);
30
+ const active = userContextSelector(state);
31
31
  return {
32
- currentAmbient,
33
- selectedAmbient: ambient,
32
+ active,
33
+ ambient,
34
34
  };
35
35
  };
36
36
  const mapDispatchToProps = {
@@ -1,7 +1,7 @@
1
1
  import { type IGenAIUserContext } from "@gooddata/sdk-model";
2
2
  import { type IUiMenuItem } from "@gooddata/sdk-ui-kit";
3
- import { type IGenAIContextObject } from "../../context/collectContextReferences.js";
4
- export declare function useContextItems(current: IGenAIUserContext | undefined, selected: IGenAIUserContext | undefined, type: "ambient" | "user"): IUiMenuItem<{
3
+ import { type IGenAIContextObject } from "../../types.js";
4
+ export declare function useContextItems(ambient: IGenAIUserContext | undefined, active: IGenAIUserContext | undefined): IUiMenuItem<{
5
5
  interactive: IGenAIContextObject;
6
6
  }>[];
7
7
  //# sourceMappingURL=useContextItems.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useContextItems.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useContextItems.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,KAAK,WAAW,EAAU,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EACH,KAAK,mBAAmB,EAE3B,MAAM,2CAA2C,CAAC;AAGnD,wBAAgB,eAAe,CAC3B,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,EACvC,IAAI,EAAE,SAAS,GAAG,MAAM,GACzB,WAAW,CAAC;IAAE,WAAW,EAAE,mBAAmB,CAAA;CAAE,CAAC,EAAE,CAgCrD"}
1
+ {"version":3,"file":"useContextItems.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useContextItems.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,KAAK,WAAW,EAAU,MAAM,sBAAsB,CAAC;AAMhE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,wBAAgB,eAAe,CAC3B,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,MAAM,EAAE,iBAAiB,GAAG,SAAS,GACtC,WAAW,CAAC;IAAE,WAAW,EAAE,mBAAmB,CAAA;CAAE,CAAC,EAAE,CAgCrD"}
@@ -2,13 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // (C) 2026 GoodData Corporation
3
3
  import { useMemo } from "react";
4
4
  import { UiIcon } from "@gooddata/sdk-ui-kit";
5
- import { collectContextReferences, } from "../../context/collectContextReferences.js";
5
+ import { collectAvailableReferences, collectContextReferences, } from "../../context/collectContextReferences.js";
6
6
  import { getIconByType } from "../utils/icons.js";
7
- export function useContextItems(current, selected, type) {
7
+ export function useContextItems(ambient, active) {
8
8
  return useMemo(() => {
9
9
  const items = [];
10
- const currentReferences = collectContextReferences(current, type);
11
- const selectedReferences = collectContextReferences(selected, type);
10
+ const currentReferences = collectAvailableReferences(ambient);
11
+ const selectedReferences = collectContextReferences(active);
12
12
  currentReferences.forEach((reference) => {
13
13
  const isSelected = selectedReferences.some((selectedReference) => selectedReference.id === reference.id && selectedReference.type === reference.type);
14
14
  if (!isSelected) {
@@ -27,5 +27,5 @@ export function useContextItems(current, selected, type) {
27
27
  }
28
28
  });
29
29
  return items;
30
- }, [current, selected, type]);
30
+ }, [active, ambient]);
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SemanticSearchTreeView.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/components/SemanticSearchTreeView.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAIhE,KAAK,2BAA2B,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,sBAAsB,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,2CAQxE;AAED,wBAAgB,0BAA0B,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,2BAA2B,kDA6ExG"}
1
+ {"version":3,"file":"SemanticSearchTreeView.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/components/SemanticSearchTreeView.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAIhE,KAAK,2BAA2B,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,sBAAsB,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,2CAQxE;AAED,wBAAgB,0BAA0B,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,2BAA2B,kDA2ExG"}
@@ -18,9 +18,7 @@ export function SemanticSearchTreeViewImpl({ workspace, content, maxHeight }) {
18
18
  const { canFullControl, canManage, canAnalyze, linkHandler } = useConfig();
19
19
  const settings = useSelector(settingsSelector);
20
20
  const canEdit = canFullControl || canManage || canAnalyze;
21
- const useHostMetricEditor = Boolean(settings?.enableShellApplication_metricEditor);
22
21
  const useHostAnalyticalDesigner = Boolean(settings?.enableShellApplication_analyticalDesigner);
23
- const useHostLdmModeler = Boolean(settings?.enableShellApplication_ldmModeler);
24
22
  const useHostDashboards = Boolean(settings?.enableShellApplication_dashboards);
25
23
  const items = buildSemanticSearchTreeViewItems({
26
24
  intl,
@@ -30,9 +28,9 @@ export function SemanticSearchTreeViewImpl({ workspace, content, maxHeight }) {
30
28
  threshold: 0, // Keep all items for now
31
29
  canEdit,
32
30
  uiPathOptions: {
33
- useHostedMetricEditor: useHostMetricEditor,
31
+ useHostedMetricEditor: true,
34
32
  useHostedAnalyticalDesigner: useHostAnalyticalDesigner,
35
- useHostedLdmModeler: useHostLdmModeler,
33
+ useHostedLdmModeler: true,
36
34
  useHostedDashboards: useHostDashboards,
37
35
  },
38
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"CustomHyperlink.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/contents/CustomHyperlink.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAMxE,MAAM,MAAM,uBAAuB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,oBAAoB,GAAG,uBAAuB,GAAG;IAClD,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CACrC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,oBAAoB,oDAkGtF;AA4BD,eAAO,MAAM,eAAe;;;;;EAEC,CAAC"}
1
+ {"version":3,"file":"CustomHyperlink.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/contents/CustomHyperlink.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAMxE,MAAM,MAAM,uBAAuB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,oBAAoB,GAAG,uBAAuB,GAAG;IAClD,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CACrC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,oBAAoB,oDA2FtF;AAyBD,eAAO,MAAM,eAAe;;;;;EAEC,CAAC"}
@@ -10,7 +10,6 @@ import { useConfig } from "../../ConfigContext.js";
10
10
  */
11
11
  export function CustomHyperlinkComponent({ href, text, settings }) {
12
12
  const { linkHandler, allowNativeLinks, canManage, canAnalyze } = useConfig();
13
- const enableShellApplication_metricEditor = Boolean(settings?.enableShellApplication_metricEditor);
14
13
  const enableShellApplication_analyticalDesigner = Boolean(settings?.enableShellApplication_analyticalDesigner);
15
14
  const enableShellApplication_dashboards = Boolean(settings?.enableShellApplication_dashboards);
16
15
  const canManageMetrics = canManage || canAnalyze;
@@ -29,7 +28,7 @@ export function CustomHyperlinkComponent({ href, text, settings }) {
29
28
  if (!workspaceId || !id) {
30
29
  return null;
31
30
  }
32
- const itemUrl = getItemUrl(workspaceId, id, type, enableShellApplication_metricEditor, enableShellApplication_analyticalDesigner, enableShellApplication_dashboards);
31
+ const itemUrl = getItemUrl(workspaceId, id, type, enableShellApplication_analyticalDesigner, enableShellApplication_dashboards);
33
32
  if (!itemUrl) {
34
33
  return null;
35
34
  }
@@ -39,12 +38,7 @@ export function CustomHyperlinkComponent({ href, text, settings }) {
39
38
  id,
40
39
  itemUrl,
41
40
  };
42
- }, [
43
- href,
44
- enableShellApplication_metricEditor,
45
- enableShellApplication_analyticalDesigner,
46
- enableShellApplication_dashboards,
47
- ]);
41
+ }, [href, enableShellApplication_analyticalDesigner, enableShellApplication_dashboards]);
48
42
  if (!parsedRef) {
49
43
  return text;
50
44
  }
@@ -76,7 +70,7 @@ export function CustomHyperlinkComponent({ href, text, settings }) {
76
70
  }
77
71
  return (_jsx("span", { className: "gd-hyperlink", onClick: handleLinkClick, children: _jsx("span", { className: "gd-hyperlink-text", children: text }) }));
78
72
  }
79
- const getItemUrl = (workspaceId, id, objectType, enableShellApplication_metricEditor, enableShellApplication_analyticalDesigner, enableShellApplication_dashboards) => {
73
+ const getItemUrl = (workspaceId, id, objectType, enableShellApplication_analyticalDesigner, enableShellApplication_dashboards) => {
80
74
  switch (objectType) {
81
75
  case "visualization":
82
76
  return enableShellApplication_analyticalDesigner
@@ -87,9 +81,7 @@ const getItemUrl = (workspaceId, id, objectType, enableShellApplication_metricEd
87
81
  ? `/workspace/${workspaceId}/dashboards/#/dashboard/${id}`
88
82
  : `/dashboards/#/workspace/${workspaceId}/dashboard/${id}`;
89
83
  case "metric":
90
- return enableShellApplication_metricEditor
91
- ? `/workspace/${workspaceId}/metrics/metric/${id}`
92
- : `/metrics/#/${workspaceId}/metric/${id}`;
84
+ return `/workspace/${workspaceId}/metrics/metric/${id}`;
93
85
  default:
94
86
  return null;
95
87
  }
@@ -1,6 +1,6 @@
1
- import { type GenAIObjectType } from "@gooddata/sdk-model";
2
1
  import { type IconType, type ThemeColor } from "@gooddata/sdk-ui-kit";
3
- export declare function getIconByType(type: GenAIObjectType): {
2
+ import { type IGenAIContextObject } from "../../types.js";
3
+ export declare function getIconByType(type: IGenAIContextObject["type"]): {
4
4
  iconBefore?: IconType;
5
5
  iconColor?: ThemeColor;
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/utils/icons.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEtE,wBAAgB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG;IAAE,UAAU,CAAC,EAAE,QAAQ,CAAC;IAAC,SAAS,CAAC,EAAE,UAAU,CAAA;CAAE,CActG"}
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/utils/icons.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,wBAAgB,aAAa,CAAC,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG;IAC9D,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,SAAS,CAAC,EAAE,UAAU,CAAC;CAC1B,CAeA"}
@@ -7,6 +7,7 @@ export function getIconByType(type) {
7
7
  iconColor: "complementary-6",
8
8
  };
9
9
  case "visualization":
10
+ case "widget":
10
11
  return {
11
12
  iconBefore: "visualization",
12
13
  };
@@ -1,4 +1,5 @@
1
- import { type StoreContext } from "../types.js";
2
- import type { IGenAIContextObject } from "./collectContextReferences.js";
1
+ import { type IGenAIUserContext } from "@gooddata/sdk-model";
2
+ import { type IGenAIContextObject, type StoreContext } from "../types.js";
3
3
  export declare function addContextReference(context: StoreContext, reference?: IGenAIContextObject): StoreContext;
4
+ export declare function addAmbientContextReferences(context: StoreContext, userContext?: IGenAIUserContext): StoreContext;
4
5
  //# sourceMappingURL=addContextReference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addContextReference.d.ts","sourceRoot":"","sources":["../../src/context/addContextReference.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,mBAAmB,GAAG,YAAY,CAoBxG"}
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;AAM1E,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,CAgBd"}
@@ -1,19 +1,74 @@
1
1
  // (C) 2026 GoodData Corporation
2
- import { areObjRefsEqual } from "@gooddata/sdk-model";
2
+ import { areObjRefsEqual, } from "@gooddata/sdk-model";
3
+ import { convertGenAiTypeToReferenceType } from "../utils.js";
4
+ import { mergeContexts } from "./build.js";
5
+ import { isReferenceChanged } from "./isReferenceChanged.js";
3
6
  export function addContextReference(context, reference) {
4
- const { ambient } = context;
7
+ const { ambient, active } = context;
5
8
  if (!reference) {
6
9
  return context;
7
10
  }
8
- if (reference.where === "view.dashboard") {
9
- const ambientRef = ambient?.view?.dashboard?.ref;
10
- const ref = reference.ref;
11
- if (areObjRefsEqual(ambientRef, ref)) {
11
+ if (reference.where === "view.dashboard" && ambient?.view?.dashboard) {
12
+ const ambientDashboard = ambient.view.dashboard;
13
+ if (areObjRefsEqual(ambientDashboard.ref, reference.ref)) {
12
14
  return {
13
15
  ...context,
14
- ambientMode: "enabled",
16
+ active: {
17
+ ...active,
18
+ view: {
19
+ dashboard: ambientDashboard,
20
+ },
21
+ },
15
22
  };
16
23
  }
17
24
  }
25
+ if (reference.where === "referencedObjects") {
26
+ const refContext = reference.context;
27
+ const referencedObjects = (active?.referencedObjects ?? []).slice();
28
+ const index = referencedObjects.findIndex((obj) => areObjRefsEqual(obj.context?.ref, refContext?.ref) || obj.context === refContext);
29
+ let group;
30
+ if (index === -1) {
31
+ group = {
32
+ context: refContext,
33
+ objects: [],
34
+ };
35
+ referencedObjects.push(group);
36
+ }
37
+ else {
38
+ const item = referencedObjects[index];
39
+ group = {
40
+ ...item,
41
+ context: item.context,
42
+ objects: item.objects.slice(),
43
+ };
44
+ referencedObjects[index] = group;
45
+ }
46
+ group.objects.push({
47
+ ref: reference.ref,
48
+ title: reference.title,
49
+ type: convertGenAiTypeToReferenceType(reference.type),
50
+ });
51
+ return {
52
+ ...context,
53
+ active: {
54
+ ...active,
55
+ referencedObjects,
56
+ },
57
+ };
58
+ }
18
59
  return context;
19
60
  }
61
+ export function addAmbientContextReferences(context, userContext) {
62
+ const updateActive = Boolean(!context.ambient ||
63
+ context.active?.view?.dashboard ||
64
+ isReferenceChanged(context.ambient, userContext));
65
+ return {
66
+ ...context,
67
+ ambient: userContext,
68
+ ...(updateActive
69
+ ? {
70
+ active: mergeContexts(context.active, userContext),
71
+ }
72
+ : {}),
73
+ };
74
+ }
@@ -1,7 +1,7 @@
1
- import type { IGenAIUserContext } from "@gooddata/sdk-model";
1
+ import { type IGenAIUserContext } from "@gooddata/sdk-model";
2
2
  export declare function buildContext(props: Partial<IGenAIUserContext>): IGenAIUserContext;
3
3
  /**
4
4
  * @internal
5
5
  */
6
- export declare function mergeContexts(...contexts: IGenAIUserContext[]): IGenAIUserContext;
6
+ export declare function mergeContexts(...contexts: (IGenAIUserContext | undefined)[]): IGenAIUserContext | undefined;
7
7
  //# sourceMappingURL=build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/context/build.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAIjF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,CAQjF"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/context/build.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,KAAK,iBAAiB,EAEzB,MAAM,qBAAqB,CAAC;AAE7B,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAIjF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,CAAC,iBAAiB,GAAG,SAAS,CAAC,EAAE,GAAG,iBAAiB,GAAG,SAAS,CAsB3G"}
@@ -1,4 +1,5 @@
1
1
  // (C) 2026 GoodData Corporation
2
+ import { areObjRefsEqual, } from "@gooddata/sdk-model";
2
3
  export function buildContext(props) {
3
4
  return {
4
5
  ...props,
@@ -8,11 +9,41 @@ export function buildContext(props) {
8
9
  * @internal
9
10
  */
10
11
  export function mergeContexts(...contexts) {
11
- return contexts.reduce((acc, context) => {
12
+ const merged = contexts.reduce((acc, context) => {
13
+ if (!context) {
14
+ return acc;
15
+ }
16
+ const dashboard = mergeDashboard(context.view?.dashboard, acc.view?.dashboard);
17
+ const view = {
18
+ ...(dashboard ? { dashboard } : {}),
19
+ };
20
+ const activeObject = mergeActiveObject(context.activeObject, acc.activeObject);
21
+ const referencedObjects = [...(acc?.referencedObjects ?? []), ...(context?.referencedObjects ?? [])];
12
22
  return {
13
- view: context.view ?? acc.view,
14
- activeObject: context.activeObject ?? acc.activeObject,
15
- referencedObjects: [...(acc?.referencedObjects ?? []), ...(context?.referencedObjects ?? [])],
23
+ ...(Object.keys(view).length > 0 ? { view } : {}),
24
+ ...(activeObject ? { activeObject } : {}),
25
+ ...(referencedObjects.length > 0 ? { referencedObjects } : {}),
16
26
  };
17
27
  }, {});
28
+ return Object.keys(merged).length > 0 ? merged : undefined;
29
+ }
30
+ function mergeDashboard(dashboard, existingDashboard) {
31
+ if (areObjRefsEqual(dashboard?.ref, existingDashboard?.ref)) {
32
+ const merged = {
33
+ ...existingDashboard,
34
+ ...dashboard,
35
+ };
36
+ return Object.keys(merged).length > 0 ? merged : undefined;
37
+ }
38
+ return dashboard ?? existingDashboard;
39
+ }
40
+ function mergeActiveObject(activeObject, existingActiveObject) {
41
+ if (areObjRefsEqual(activeObject?.ref, existingActiveObject?.ref)) {
42
+ const merged = {
43
+ ...existingActiveObject,
44
+ ...activeObject,
45
+ };
46
+ return Object.keys(merged).length > 0 ? merged : undefined;
47
+ }
48
+ return activeObject ?? existingActiveObject;
18
49
  }
@@ -1,11 +1,5 @@
1
- import { type GenAIObjectType, type IGenAIUserContext, type ObjRef } from "@gooddata/sdk-model";
2
- export interface IGenAIContextObject {
3
- id: string;
4
- ref: ObjRef;
5
- title: string;
6
- type: GenAIObjectType;
7
- where: "view.dashboard";
8
- nesting: number;
9
- }
10
- export declare function collectContextReferences(context: IGenAIUserContext | undefined, type: "ambient" | "user"): IGenAIContextObject[];
1
+ import { type IGenAIUserContext } from "@gooddata/sdk-model";
2
+ import { type IGenAIContextObject } from "../types.js";
3
+ export declare function collectContextReferences(context: IGenAIUserContext | undefined): IGenAIContextObject[];
4
+ export declare function collectAvailableReferences(context: IGenAIUserContext | undefined): IGenAIContextObject[];
11
5
  //# sourceMappingURL=collectContextReferences.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collectContextReferences.d.ts","sourceRoot":"","sources":["../../src/context/collectContextReferences.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,MAAM,EAEd,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,gBAAgB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,wBAAwB,CACpC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,IAAI,EAAE,SAAS,GAAG,MAAM,GACzB,mBAAmB,EAAE,CA6BvB"}
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,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,mBAAmB,EAAE,CAwCtG;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,mBAAmB,EAAE,CAiFxG"}