@gooddata/sdk-ui-gen-ai 11.61.0 → 11.62.0-alpha.1
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.
- package/esm/components/ConfigContext.d.ts +1 -0
- package/esm/components/ConfigContext.d.ts.map +1 -1
- package/esm/components/GenAIChatContextIndicator.d.ts +1 -1
- package/esm/components/GenAIChatContextIndicator.js +3 -3
- package/esm/components/GenAIChatDialogConnected.d.ts +7 -4
- package/esm/components/GenAIChatDialogConnected.d.ts.map +1 -1
- package/esm/components/GenAIChatDialogConnected.js +5 -3
- package/esm/components/GenAiChatContextChooser.d.ts +1 -1
- package/esm/components/GenAiChatContextChooser.d.ts.map +1 -1
- package/esm/components/GenAiChatContextChooser.js +5 -1
- package/esm/components/hooks/useContextChangeAnnouncement.js +1 -1
- package/esm/components/hooks/useContextItems.d.ts +2 -2
- package/esm/components/hooks/useDashboardSavedSync.d.ts +13 -0
- package/esm/components/hooks/useDashboardSavedSync.d.ts.map +1 -0
- package/esm/components/hooks/useDashboardSavedSync.js +14 -0
- package/esm/components/hooks/usePublisherDocumentSavedSync.d.ts +18 -0
- package/esm/components/hooks/usePublisherDocumentSavedSync.d.ts.map +1 -0
- package/esm/components/hooks/usePublisherDocumentSavedSync.js +18 -0
- package/esm/components/intelligence/data/categoryDetailRows.js +1 -1
- package/esm/components/messages/components/SemanticSearchTreeView.d.ts.map +1 -1
- package/esm/components/messages/components/SemanticSearchTreeView.js +5 -1
- package/esm/components/messages/contents/CustomHyperlink.d.ts +3 -1
- package/esm/components/messages/contents/CustomHyperlink.d.ts.map +1 -1
- package/esm/components/messages/contents/CustomHyperlink.js +7 -4
- package/esm/components/messages/conversationContents/ConversationDashboardContent.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/ConversationDashboardContent.js +13 -4
- package/esm/components/messages/conversationContents/ConversationMultipartContent.js +3 -3
- package/esm/components/messages/conversationContents/ConversationPublisherDocumentContent.d.ts +11 -0
- package/esm/components/messages/conversationContents/ConversationPublisherDocumentContent.d.ts.map +1 -0
- package/esm/components/messages/conversationContents/ConversationPublisherDocumentContent.js +57 -0
- package/esm/components/messages/conversationContents/ConversationVisualizationContent.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/ConversationVisualizationContent.js +9 -5
- package/esm/components/messages/conversationContents/useSaveCheck.d.ts +6 -2
- package/esm/components/messages/conversationContents/useSaveCheck.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/useSaveCheck.js +26 -1
- package/esm/components/utils/icons.js +5 -5
- package/esm/context/addContextReference.js +2 -2
- package/esm/context/build.d.ts.map +1 -1
- package/esm/context/build.js +8 -6
- package/esm/context/collectContextReferences.js +9 -9
- package/esm/context/removeContextReference.d.ts.map +1 -1
- package/esm/context/removeContextReference.js +4 -3
- package/esm/context/selectContextReferences.js +11 -9
- package/esm/context/{viewReport.d.ts → viewedPublisherDocument.d.ts} +4 -4
- package/esm/context/viewedPublisherDocument.d.ts.map +1 -0
- package/esm/context/{viewReport.js → viewedPublisherDocument.js} +3 -3
- package/esm/index.d.ts +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/internal.d.ts +2 -1
- package/esm/internal.d.ts.map +1 -1
- package/esm/localization/bundles/de-DE.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/de-DE.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/de-DE.localization-bundle.js +1 -0
- package/esm/localization/bundles/en-AU.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/en-AU.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-AU.localization-bundle.js +1 -0
- package/esm/localization/bundles/en-GB.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/en-GB.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-GB.localization-bundle.js +1 -0
- package/esm/localization/bundles/en-US.localization-bundle.d.ts +10 -6
- package/esm/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-US.localization-bundle.js +19 -15
- package/esm/localization/bundles/es-419.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/es-419.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/es-419.localization-bundle.js +1 -0
- package/esm/localization/bundles/es-ES.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/es-ES.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/es-ES.localization-bundle.js +1 -0
- package/esm/localization/bundles/fi-FI.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/fi-FI.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/fi-FI.localization-bundle.js +1 -0
- package/esm/localization/bundles/fr-CA.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/fr-CA.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/fr-CA.localization-bundle.js +1 -0
- package/esm/localization/bundles/fr-FR.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/fr-FR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/fr-FR.localization-bundle.js +1 -0
- package/esm/localization/bundles/id-ID.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/id-ID.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/id-ID.localization-bundle.js +1 -0
- package/esm/localization/bundles/it-IT.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/it-IT.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/it-IT.localization-bundle.js +1 -0
- package/esm/localization/bundles/ja-JP.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/ja-JP.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/ja-JP.localization-bundle.js +1 -0
- package/esm/localization/bundles/ko-KR.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/ko-KR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/ko-KR.localization-bundle.js +1 -0
- package/esm/localization/bundles/nl-NL.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/nl-NL.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/nl-NL.localization-bundle.js +1 -0
- package/esm/localization/bundles/pl-PL.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/pl-PL.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/pl-PL.localization-bundle.js +1 -0
- package/esm/localization/bundles/pt-BR.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/pt-BR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/pt-BR.localization-bundle.js +1 -0
- package/esm/localization/bundles/pt-PT.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/pt-PT.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/pt-PT.localization-bundle.js +1 -0
- package/esm/localization/bundles/ru-RU.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/ru-RU.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/ru-RU.localization-bundle.js +1 -0
- package/esm/localization/bundles/sl-SI.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/sl-SI.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/sl-SI.localization-bundle.js +1 -0
- package/esm/localization/bundles/th-TH.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/th-TH.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/th-TH.localization-bundle.js +1 -0
- package/esm/localization/bundles/tr-TR.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/tr-TR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/tr-TR.localization-bundle.js +1 -0
- package/esm/localization/bundles/uk-UA.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/uk-UA.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/uk-UA.localization-bundle.js +1 -0
- package/esm/localization/bundles/vi-VN.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/vi-VN.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/vi-VN.localization-bundle.js +1 -0
- package/esm/localization/bundles/zh-HK.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/zh-HK.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/zh-HK.localization-bundle.js +1 -0
- package/esm/localization/bundles/zh-Hans.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/zh-Hans.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/zh-Hans.localization-bundle.js +1 -0
- package/esm/localization/bundles/zh-Hant.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/zh-Hant.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/zh-Hant.localization-bundle.js +1 -0
- package/esm/model.d.ts +1 -0
- package/esm/model.d.ts.map +1 -1
- package/esm/sdk-ui-gen-ai.d.ts +42 -11
- package/esm/store/chatWindow/chatWindowSelectors.d.ts.map +1 -1
- package/esm/store/chatWindow/chatWindowSelectors.js +4 -3
- package/esm/store/chatWindow/chatWindowSlice.d.ts +6 -6
- package/esm/store/chatWindow/chatWindowSlice.d.ts.map +1 -1
- package/esm/store/events.d.ts +11 -11
- package/esm/store/events.d.ts.map +1 -1
- package/esm/store/messages/messagesSelectors.d.ts +1 -0
- package/esm/store/messages/messagesSelectors.d.ts.map +1 -1
- package/esm/store/messages/messagesSelectors.js +1 -0
- package/esm/store/messages/messagesSlice.d.ts +22 -6
- package/esm/store/messages/messagesSlice.d.ts.map +1 -1
- package/esm/store/messages/messagesSlice.js +42 -8
- package/esm/store/sideEffects/index.d.ts.map +1 -1
- package/esm/store/sideEffects/index.js +5 -1
- package/esm/store/sideEffects/onDashboardSaved.d.ts +3 -0
- package/esm/store/sideEffects/onDashboardSaved.d.ts.map +1 -0
- package/esm/store/sideEffects/onDashboardSaved.js +31 -0
- package/esm/store/sideEffects/onDefinitionReceivedTrigger.d.ts.map +1 -1
- package/esm/store/sideEffects/onDefinitionReceivedTrigger.js +8 -7
- package/esm/store/sideEffects/onPublisherDocumentSaved.d.ts +3 -0
- package/esm/store/sideEffects/onPublisherDocumentSaved.d.ts.map +1 -0
- package/esm/store/sideEffects/onPublisherDocumentSaved.js +26 -0
- package/esm/store/sideEffects/onVisualizationSuccessSave.d.ts.map +1 -1
- package/esm/store/sideEffects/onVisualizationSuccessSave.js +1 -0
- package/esm/types.d.ts +4 -4
- package/esm/types.d.ts.map +1 -1
- package/esm/utils.d.ts +7 -7
- package/esm/utils.d.ts.map +1 -1
- package/esm/utils.js +15 -15
- package/package.json +20 -20
- package/styles/css/main.css +79 -86
- package/styles/css/main.css.map +1 -1
- package/styles/css/messages.css +73 -73
- package/styles/scss/messages.scss +5 -5
- package/esm/components/hooks/useReportSavedSync.d.ts +0 -18
- package/esm/components/hooks/useReportSavedSync.d.ts.map +0 -1
- package/esm/components/hooks/useReportSavedSync.js +0 -18
- package/esm/components/messages/conversationContents/ConversationReportContent.d.ts +0 -11
- package/esm/components/messages/conversationContents/ConversationReportContent.d.ts.map +0 -1
- package/esm/components/messages/conversationContents/ConversationReportContent.js +0 -56
- package/esm/context/viewReport.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigContext.d.ts","sourceRoot":"","sources":["../../src/components/ConfigContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAsC,MAAM,OAAO,CAAC;AAEnF,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE7G,MAAM,MAAM,aAAa,GAAG;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,cAAc,EAAE,gBAAgB,KAAK,MAAM,GAAG,SAAS,CAAC;IACvE,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;CAChC,CAAC;AAEF;;GAEG;A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wnProps = {
|
|
|
4
4
|
/**
|
|
5
5
|
* Shows what ambient context the assistant is answering about — the open dashboard and its live
|
|
6
6
|
* filters (e.g. "Answering about: Revenue Dashboard · Region: Europe · Q1 2026"), or the open
|
|
7
|
-
*
|
|
7
|
+
* document. Renders nothing when no ambient dashboard or document context is present. Re-renders whenever
|
|
8
8
|
* the host re-syncs the context, so filter changes on the dashboard are reflected immediately.
|
|
9
9
|
*
|
|
10
10
|
* @internal
|
|
@@ -37,7 +37,7 @@ const msgs = defineMessages({
|
|
|
37
37
|
/**
|
|
38
38
|
* Shows what ambient context the assistant is answering about — the open dashboard and its live
|
|
39
39
|
* filters (e.g. "Answering about: Revenue Dashboard · Region: Europe · Q1 2026"), or the open
|
|
40
|
-
*
|
|
40
|
+
* document. Renders nothing when no ambient dashboard or document context is present. Re-renders whenever
|
|
41
41
|
* the host re-syncs the context, so filter changes on the dashboard are reflected immediately.
|
|
42
42
|
*
|
|
43
43
|
* @internal
|
|
@@ -115,8 +115,8 @@ export function GenAIChatContextIndicator({ onUpdate }) {
|
|
|
115
115
|
activated: true,
|
|
116
116
|
}));
|
|
117
117
|
onUpdate?.();
|
|
118
|
-
} })) })) : selectedContext?.
|
|
119
|
-
iconBeforeAriaLabel: getTypeLabel(selectedContext.
|
|
118
|
+
} })) })) : selectedContext?.publisherDocument ? (_jsx(UiChip, { isActionable: true, isExpandable: false, ...getIconByObject(selectedContext.publisherDocument), label: selectedContext.publisherDocument.title || emptyReferenceLabel, iconAction: selectedContext.activated ? "visible" : "invisible", actionIconTooltip: ambientToggleLabel, tooltip: intl.formatMessage(msgs.context), variant: selectedContext.activated ? "normal" : "inactive", onClick: onAmbientToggleHandler(), onAction: onAmbientToggleHandler(), accessibilityConfig: {
|
|
119
|
+
iconBeforeAriaLabel: getTypeLabel(selectedContext.publisherDocument.type, intl),
|
|
120
120
|
actionAriaLabel: ambientToggleLabel,
|
|
121
121
|
} })) : null, references.length > 0
|
|
122
122
|
? references.map((reference, index) => (_jsx(UiChip, { isDisabled: true, isDeletable: true, ...getIconByObject(reference), label: reference.title, isExpandable: false, onDelete: onDeleteHandler(reference), accessibilityConfig: {
|
|
@@ -3,7 +3,8 @@ import { type IAnalyticalBackend, type IUserWorkspaceSettings } from "@gooddata/
|
|
|
3
3
|
import type { GenAIObjectType, IColorPalette, IGenAIUserContext } from "@gooddata/sdk-model";
|
|
4
4
|
import { type ChatAssistantMessageEvent, type ChatClosedEvent, type ChatCopyToClipboardEvent, type ChatDefinitionReceivedEvent, type ChatEvent, type ChatFeedbackErrorEvent, type ChatFeedbackEvent, type ChatModeChangeEvent, type ChatOpenedEvent, type ChatResetEvent, type ChatSaveVisualizationErrorEvent, type ChatSaveVisualizationSuccessEvent, type ChatUserMessageEvent } from "../store/events.js";
|
|
5
5
|
import { type GenAIAssistantDisplayMode, type LinkHandlerEvent } from "./ConfigContext.js";
|
|
6
|
-
import { type
|
|
6
|
+
import { type IDashboardSaved } from "./hooks/useDashboardSavedSync.js";
|
|
7
|
+
import { type IPublisherDocumentSaved } from "./hooks/usePublisherDocumentSavedSync.js";
|
|
7
8
|
/**
|
|
8
9
|
* Discriminated union of GenAI chat events surfaced to a caller via {@link IGenAIChatDialogConnectedProps.onEvent}.
|
|
9
10
|
*
|
|
@@ -107,10 +108,12 @@ export interface IGenAIChatDialogConnectedProps {
|
|
|
107
108
|
*/
|
|
108
109
|
ambientUserContextLoading?: boolean;
|
|
109
110
|
/**
|
|
110
|
-
* A
|
|
111
|
+
* A document of the conversation that an application saved. The document in the chat then reads as
|
|
111
112
|
* saved without the conversation being loaded again. Each save carries a new `seq`.
|
|
112
113
|
*/
|
|
113
|
-
|
|
114
|
+
publisherDocumentSaved?: IPublisherDocumentSaved;
|
|
115
|
+
/** A dashboard save reported by an application. Each save carries a new `seq`. */
|
|
116
|
+
dashboardSaved?: IDashboardSaved;
|
|
114
117
|
/**
|
|
115
118
|
* Agent ID to use for the seeded question. If not provided, the default agent will be used.
|
|
116
119
|
*/
|
|
@@ -148,5 +151,5 @@ export interface IGenAIChatDialogConnectedProps {
|
|
|
148
151
|
*
|
|
149
152
|
* @internal
|
|
150
153
|
*/
|
|
151
|
-
export declare function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, isOpen, isDisabled, displayMode, onOpen, onClose, askedQuestion, askSeq, userContext, ambientUserContext, ambientUserContextLoading,
|
|
154
|
+
export declare function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, isOpen, isDisabled, displayMode, onOpen, onClose, askedQuestion, askSeq, userContext, ambientUserContext, ambientUserContextLoading, publisherDocumentSaved, dashboardSaved, appendToChat, replaceUserContext, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks, onLinkClick, returnFocusTo, }: IGenAIChatDialogConnectedProps): import("react/jsx-runtime").JSX.Element;
|
|
152
155
|
//# 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,2BAA2B,EAChC,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,+BAA+B,EACpC,KAAK,iCAAiC,EACtC,KAAK,oBAAoB,EAa5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;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,EACrC,OAAO,EACP,SAAS,EACT,MAAM,EACN,SAAS,EACT,UAAU,EACV,cAAc,EACd,QAAQ,EACR,OAAO,EACP,MAAM,EACN,UAAiB,EACjB,WAAW,EACX,MAAM,EACN,OAAO,EACP,aAAa,EACb,MAAM,EACN,WAAW,EACX,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,cAAc,EACd,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,GAChB,EAAE,8BAA8B,2CA8KhC"}
|
|
@@ -6,7 +6,8 @@ import { setAmbientUserContextAction, setUserContextAction } from "../store/chat
|
|
|
6
6
|
import { isChatAssistantMessageEvent, isChatClosedEvent, isChatCopyToClipboardEvent, isChatDefinitionReceivedEvent, isChatFeedbackErrorEvent, isChatFeedbackEvent, isChatModeChangeEvent, isChatOpenedEvent, isChatResetEvent, isChatSaveVisualizationErrorEvent, isChatSaveVisualizationSuccessEvent, isChatUserMessageEvent, } from "../store/events.js";
|
|
7
7
|
import { clearThreadAction, newMessageAction, setSelectedAgentAction, } from "../store/messages/messagesSlice.js";
|
|
8
8
|
import { GenAIChatDialog } from "./GenAIChatDialog.js";
|
|
9
|
-
import {
|
|
9
|
+
import { useDashboardSavedSync } from "./hooks/useDashboardSavedSync.js";
|
|
10
|
+
import { usePublisherDocumentSavedSync, } from "./hooks/usePublisherDocumentSavedSync.js";
|
|
10
11
|
/**
|
|
11
12
|
* A "connected" wrapper over {@link GenAIChatDialog} that centralizes the wiring every consumer otherwise
|
|
12
13
|
* duplicates: object-type derivation, the dispatcher-based seeding flow (clear thread / set user context), default link handling, and normalizing
|
|
@@ -17,7 +18,7 @@ import { useReportSavedSync } from "./hooks/useReportSavedSync.js";
|
|
|
17
18
|
*
|
|
18
19
|
* @internal
|
|
19
20
|
*/
|
|
20
|
-
export function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, isOpen, isDisabled = true, displayMode, onOpen, onClose, askedQuestion, askSeq, userContext, ambientUserContext, ambientUserContextLoading,
|
|
21
|
+
export function GenAIChatDialogConnected({ backend, workspace, locale, canManage, canAnalyze, canFullControl, settings, agentId, isOpen, isDisabled = true, displayMode, onOpen, onClose, askedQuestion, askSeq, userContext, ambientUserContext, ambientUserContextLoading, publisherDocumentSaved, dashboardSaved, appendToChat, replaceUserContext, includeTags, excludeTags, objectTypes: objectTypesOverride, onEvent, onAnyEvent, dialogPosition, className, colorPalette, allowNativeLinks = true, onLinkClick, returnFocusTo, }) {
|
|
21
22
|
const defaultLinkClick = useCallback(({ itemUrl, newTab, preventDefault, type, dashboardStatus, }) => {
|
|
22
23
|
// NOTE: If dashboard is draft, do nothing for now
|
|
23
24
|
if (type === "dashboard" && dashboardStatus === "draft") {
|
|
@@ -107,7 +108,8 @@ export function GenAIChatDialogConnected({ backend, workspace, locale, canManage
|
|
|
107
108
|
loading: ambientUserContextLoading,
|
|
108
109
|
}));
|
|
109
110
|
}, [chatDispatcher, ambientUserContext, ambientUserContextLoading]);
|
|
110
|
-
|
|
111
|
+
usePublisherDocumentSavedSync(chatDispatcher, publisherDocumentSaved);
|
|
112
|
+
useDashboardSavedSync(chatDispatcher, dashboardSaved);
|
|
111
113
|
// The token of the last seed we applied. Each ask is identified by `askSeq` (bumped on every ask,
|
|
112
114
|
// so even a repeated identical question re-seeds); we seed once per token. Without this guard the
|
|
113
115
|
// effect would replay the question whenever `settings`/`userContext` merely change object identity.
|
|
@@ -2,6 +2,6 @@ import { type IGenAIContextObject } from "../types.js";
|
|
|
2
2
|
type GenAiChatContextChooserOwnProps = {
|
|
3
3
|
onAddContext?: (context: IGenAIContextObject) => void;
|
|
4
4
|
};
|
|
5
|
-
export declare function GenAiChatContextChooser({ onAddContext }: GenAiChatContextChooserOwnProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function GenAiChatContextChooser({ onAddContext }: GenAiChatContextChooserOwnProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=GenAiChatContextChooser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAiChatContextChooser.d.ts","sourceRoot":"","sources":["../../src/components/GenAiChatContextChooser.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GenAiChatContextChooser.d.ts","sourceRoot":"","sources":["../../src/components/GenAiChatContextChooser.tsx"],"names":[],"mappings":"AAiBA,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,kDA8ExF"}
|
|
@@ -4,7 +4,7 @@ import { useCallback } from "react";
|
|
|
4
4
|
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
|
-
import { ambientContextSelector, selectedContextSelector, userContextSelector, } from "../store/chatWindow/chatWindowSelectors.js";
|
|
7
|
+
import { ambientContextSelector, contextSetupEnabledSelector, selectedContextSelector, userContextSelector, } from "../store/chatWindow/chatWindowSelectors.js";
|
|
8
8
|
import { addContextReferenceAction, initContextObjectsAction } from "../store/chatWindow/chatWindowSlice.js";
|
|
9
9
|
import { GenAiChatContextChooserBody } from "./GenAiChatContextChooserBody.js";
|
|
10
10
|
import { useUserContextItems } from "./hooks/useContextItems.js";
|
|
@@ -17,6 +17,7 @@ export function GenAiChatContextChooser({ onAddContext }) {
|
|
|
17
17
|
const intl = useIntl();
|
|
18
18
|
const dispatch = useDispatch();
|
|
19
19
|
const titleId = useIdPrefixed("context-chooser-title");
|
|
20
|
+
const isContextSetupEnabled = useSelector(contextSetupEnabledSelector);
|
|
20
21
|
const ambient = useSelector((state) => ambientContextSelector(state));
|
|
21
22
|
const selected = useSelector((state) => selectedContextSelector(state));
|
|
22
23
|
const active = useSelector((state) => userContextSelector(state));
|
|
@@ -28,6 +29,9 @@ export function GenAiChatContextChooser({ onAddContext }) {
|
|
|
28
29
|
dispatch(initContextObjectsAction());
|
|
29
30
|
}
|
|
30
31
|
}, [dispatch, setSearch]);
|
|
32
|
+
if (!isContextSetupEnabled) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
31
35
|
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: { popupRole: "dialog" }, onOpenStateChanged: onOpenStateChanged, renderButton: ({ isOpen, toggleDropdown, accessibilityConfig }) => (_jsx(UiIconButton, { icon: "plus", variant: "tertiary", size: "small", dataTestId: "choose_context", isActive: isOpen, accessibilityConfig: {
|
|
32
36
|
...accessibilityConfig,
|
|
33
37
|
ariaLabel: addContextLabel,
|
|
@@ -30,7 +30,7 @@ export function useContextChangeAnnouncement(selected, references) {
|
|
|
30
30
|
const previous = previousReferences.current;
|
|
31
31
|
const all = [
|
|
32
32
|
...(selected?.activated && selected.dashboard ? [selected.dashboard] : []),
|
|
33
|
-
...(selected?.activated && selected.
|
|
33
|
+
...(selected?.activated && selected.publisherDocument ? [selected.publisherDocument] : []),
|
|
34
34
|
...(selected?.activated && selected.visualization ? [selected.visualization] : []),
|
|
35
35
|
...references,
|
|
36
36
|
];
|
|
@@ -14,8 +14,8 @@ export declare function useAmbientContextItems(ambientContext: IGenAIUserContext
|
|
|
14
14
|
ref?: ObjRef;
|
|
15
15
|
title: string;
|
|
16
16
|
nesting: number;
|
|
17
|
-
type: import("@gooddata/sdk-model").GenAIObjectType | "widget" | "
|
|
18
|
-
where: "view.dashboard" | "view.
|
|
17
|
+
type: import("@gooddata/sdk-model").GenAIObjectType | "widget" | "publisherDocument";
|
|
18
|
+
where: "view.dashboard" | "view.publisherDocument" | "referencedObjects";
|
|
19
19
|
context?: import("@gooddata/sdk-model").IGenAIObjectReference;
|
|
20
20
|
insightRef?: ObjRef;
|
|
21
21
|
visualizationUrl?: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { dashboardSavedAction } from "../../store/messages/messagesSlice.js";
|
|
2
|
+
export interface IDashboardSaved {
|
|
3
|
+
seq: number;
|
|
4
|
+
conversationId: string;
|
|
5
|
+
originalDashboardId: string;
|
|
6
|
+
savedDashboardId: string;
|
|
7
|
+
savedInsights: ReadonlyArray<{
|
|
8
|
+
originalInsightId: string;
|
|
9
|
+
savedInsightId: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export declare function useDashboardSavedSync(dispatch: ((action: ReturnType<typeof dashboardSavedAction>) => void) | null, dashboardSaved: IDashboardSaved | undefined): void;
|
|
13
|
+
//# sourceMappingURL=useDashboardSavedSync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDashboardSavedSync.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useDashboardSavedSync.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,cAAc,EAAE,MAAM,CAAC;KAC1B,CAAC,CAAC;CACN;AAED,wBAAgB,qBAAqB,CACjC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,EAC5E,cAAc,EAAE,eAAe,GAAG,SAAS,QAY9C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { dashboardSavedAction } from "../../store/messages/messagesSlice.js";
|
|
4
|
+
export function useDashboardSavedSync(dispatch, dashboardSaved) {
|
|
5
|
+
const lastSeq = useRef(undefined);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!dispatch || !dashboardSaved || lastSeq.current === dashboardSaved.seq) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
lastSeq.current = dashboardSaved.seq;
|
|
11
|
+
const { seq: _seq, ...payload } = dashboardSaved;
|
|
12
|
+
dispatch(dashboardSavedAction(payload));
|
|
13
|
+
}, [dashboardSaved, dispatch]);
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { publisherDocumentSavedAction } from "../../store/messages/messagesSlice.js";
|
|
2
|
+
/**
|
|
3
|
+
* A document of the chat that an application saved. `seq` tells one save from the next, so saving the
|
|
4
|
+
* same document again is reported again.
|
|
5
|
+
*/
|
|
6
|
+
export interface IPublisherDocumentSaved {
|
|
7
|
+
seq: number;
|
|
8
|
+
conversationId: string;
|
|
9
|
+
itemId: string;
|
|
10
|
+
documentRef?: string;
|
|
11
|
+
savedDocumentId: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Tells the chat store about a document an application saved, so the document in the chat reads as saved
|
|
15
|
+
* without the conversation being loaded again.
|
|
16
|
+
*/
|
|
17
|
+
export declare function usePublisherDocumentSavedSync(dispatch: ((action: ReturnType<typeof publisherDocumentSavedAction>) => void) | null, documentSaved: IPublisherDocumentSaved | undefined): void;
|
|
18
|
+
//# sourceMappingURL=usePublisherDocumentSavedSync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePublisherDocumentSavedSync.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/usePublisherDocumentSavedSync.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAErF;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CACzC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,4BAA4B,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,EACpF,aAAa,EAAE,uBAAuB,GAAG,SAAS,QAYrD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { publisherDocumentSavedAction } from "../../store/messages/messagesSlice.js";
|
|
4
|
+
/**
|
|
5
|
+
* Tells the chat store about a document an application saved, so the document in the chat reads as saved
|
|
6
|
+
* without the conversation being loaded again.
|
|
7
|
+
*/
|
|
8
|
+
export function usePublisherDocumentSavedSync(dispatch, documentSaved) {
|
|
9
|
+
const lastSeq = useRef(undefined);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!dispatch || !documentSaved || lastSeq.current === documentSaved.seq) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
lastSeq.current = documentSaved.seq;
|
|
15
|
+
const { seq: _seq, ...payload } = documentSaved;
|
|
16
|
+
dispatch(publisherDocumentSavedAction(payload));
|
|
17
|
+
}, [dispatch, documentSaved]);
|
|
18
|
+
}
|
|
@@ -6,7 +6,7 @@ const ANSWER_OUTPUT_LABEL_MESSAGES = defineMessages({
|
|
|
6
6
|
text: { id: "gd.gen-ai.interactionIntelligence.detail.output.text" },
|
|
7
7
|
visualization: { id: "gd.gen-ai.interactionIntelligence.detail.output.visualization" },
|
|
8
8
|
dashboard: { id: "gd.gen-ai.interactionIntelligence.detail.output.dashboard" },
|
|
9
|
-
report: { id: "gd.gen-ai.interactionIntelligence.detail.output.
|
|
9
|
+
report: { id: "gd.gen-ai.interactionIntelligence.detail.output.publisherDocument" },
|
|
10
10
|
keyDriverAnalysis: { id: "gd.gen-ai.interactionIntelligence.detail.output.keyDriverAnalysis" },
|
|
11
11
|
whatIf: { id: "gd.gen-ai.interactionIntelligence.detail.output.whatIf" },
|
|
12
12
|
searchResults: { id: "gd.gen-ai.interactionIntelligence.detail.output.searchResults" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SemanticSearchTreeView.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/components/SemanticSearchTreeView.tsx"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAGjC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"SemanticSearchTreeView.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/components/SemanticSearchTreeView.tsx"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAGjC,MAAM,qBAAqB,CAAC;AAc7B,KAAK,2BAA2B,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,yBAAyB,EAAE,CAAC;IAC3C,aAAa,EAAE,2BAA2B,EAAE,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,2CAQxE;AAED,wBAAgB,0BAA0B,CAAC,EACvC,SAAS,EACT,aAAa,EACb,aAAa,EACb,SAAS,GACZ,EAAE,2BAA2B,kDA8E7B"}
|
|
@@ -7,6 +7,7 @@ import { isSemanticSearchRelationship, isSemanticSearchResultItem, } from "@good
|
|
|
7
7
|
import { useBackendStrict } from "@gooddata/sdk-ui";
|
|
8
8
|
import { LeveledSearchTreeView, PermissionsProvider, SemanticSearchIntlProvider, buildSemanticSearchTreeViewItems, } from "@gooddata/sdk-ui-semantic-search/internal";
|
|
9
9
|
import { settingsSelector } from "../../../store/chatWindow/chatWindowSelectors.js";
|
|
10
|
+
import { conversationSelector } from "../../../store/messages/messagesSelectors.js";
|
|
10
11
|
import { useConfig } from "../../ConfigContext.js";
|
|
11
12
|
export function SemanticSearchTreeView(props) {
|
|
12
13
|
const intl = useIntl();
|
|
@@ -17,6 +18,7 @@ export function SemanticSearchTreeViewImpl({ workspace, searchResults, relations
|
|
|
17
18
|
const backend = useBackendStrict();
|
|
18
19
|
const { canFullControl, canManage, canAnalyze, linkHandler } = useConfig();
|
|
19
20
|
const settings = useSelector(settingsSelector);
|
|
21
|
+
const conversation = useSelector(conversationSelector);
|
|
20
22
|
const canEdit = canFullControl || canManage || canAnalyze;
|
|
21
23
|
const useHostDashboards = Boolean(settings?.enableShellApplication_dashboards);
|
|
22
24
|
const items = buildSemanticSearchTreeViewItems({
|
|
@@ -49,6 +51,7 @@ export function SemanticSearchTreeViewImpl({ workspace, searchResults, relations
|
|
|
49
51
|
newTab,
|
|
50
52
|
preventDefault,
|
|
51
53
|
action: "open",
|
|
54
|
+
conversationId: conversation?.localId,
|
|
52
55
|
});
|
|
53
56
|
}
|
|
54
57
|
if (isSemanticSearchRelationship(data)) {
|
|
@@ -60,10 +63,11 @@ export function SemanticSearchTreeViewImpl({ workspace, searchResults, relations
|
|
|
60
63
|
newTab,
|
|
61
64
|
preventDefault,
|
|
62
65
|
action: "open",
|
|
66
|
+
conversationId: conversation?.localId,
|
|
63
67
|
});
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
|
-
}, [linkHandler, workspace]);
|
|
70
|
+
}, [linkHandler, workspace, conversation]);
|
|
67
71
|
if (items.length === 0) {
|
|
68
72
|
return null;
|
|
69
73
|
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
|
|
2
|
+
import { type IChatConversationLocal } from "../../../model.js";
|
|
2
3
|
export type CustomHyperlinkOwnProps = {
|
|
3
4
|
href: string;
|
|
4
5
|
text: string;
|
|
5
6
|
};
|
|
6
7
|
type CustomHyperlinkProps = CustomHyperlinkOwnProps & {
|
|
7
8
|
settings?: IUserWorkspaceSettings;
|
|
9
|
+
conversation?: IChatConversationLocal;
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
10
12
|
* Similar to SDK Hyperlink, but can handle customer schemas
|
|
11
13
|
* used for links management
|
|
12
14
|
*/
|
|
13
|
-
export declare function CustomHyperlinkComponent({ href, text, settings }: CustomHyperlinkProps): string | import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function CustomHyperlinkComponent({ href, text, settings, conversation }: CustomHyperlinkProps): string | import("react/jsx-runtime").JSX.Element;
|
|
14
16
|
export declare function CustomHyperlink({ href, text }: CustomHyperlinkOwnProps): import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
export {};
|
|
16
18
|
//# sourceMappingURL=CustomHyperlink.d.ts.map
|
|
@@ -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;
|
|
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;AAExE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAOhE,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;IAClC,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACzC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,oBAAoB,oDA2FpG;AAwBD,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,uBAAuB,2CAOtE"}
|
|
@@ -3,14 +3,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { useSelector } from "react-redux";
|
|
5
5
|
import { settingsSelector } from "../../../store/chatWindow/chatWindowSelectors.js";
|
|
6
|
-
import {
|
|
6
|
+
import { conversationSelector } from "../../../store/messages/messagesSelectors.js";
|
|
7
|
+
import { getPublisherDocumentHref } from "../../../utils.js";
|
|
7
8
|
import { useConfig } from "../../ConfigContext.js";
|
|
8
9
|
import { removeMarkdown } from "../../utils/markdownUtils.js";
|
|
9
10
|
/**
|
|
10
11
|
* Similar to SDK Hyperlink, but can handle customer schemas
|
|
11
12
|
* used for links management
|
|
12
13
|
*/
|
|
13
|
-
export function CustomHyperlinkComponent({ href, text, settings }) {
|
|
14
|
+
export function CustomHyperlinkComponent({ href, text, settings, conversation }) {
|
|
14
15
|
const { linkHandler, allowNativeLinks, canManage, canAnalyze } = useConfig();
|
|
15
16
|
const enableShellApplication_dashboards = Boolean(settings?.enableShellApplication_dashboards);
|
|
16
17
|
const canManageMetrics = canManage || canAnalyze;
|
|
@@ -63,6 +64,7 @@ export function CustomHyperlinkComponent({ href, text, settings }) {
|
|
|
63
64
|
newTab: e.metaKey,
|
|
64
65
|
preventDefault: e.preventDefault.bind(e),
|
|
65
66
|
action: "open",
|
|
67
|
+
conversationId: conversation?.localId,
|
|
66
68
|
});
|
|
67
69
|
};
|
|
68
70
|
// If the link is for a metric and the user cannot manage metrics,
|
|
@@ -91,12 +93,13 @@ const getItemUrl = (workspaceId, id, objectType, enableShellApplication_dashboar
|
|
|
91
93
|
case "metric":
|
|
92
94
|
return `/workspace/${workspaceId}/metrics/metric/${id}`;
|
|
93
95
|
case "report":
|
|
94
|
-
return
|
|
96
|
+
return getPublisherDocumentHref(workspaceId, id);
|
|
95
97
|
default:
|
|
96
98
|
return null;
|
|
97
99
|
}
|
|
98
100
|
};
|
|
99
101
|
export function CustomHyperlink({ href, text }) {
|
|
100
102
|
const settings = useSelector(settingsSelector);
|
|
101
|
-
|
|
103
|
+
const conversation = useSelector(conversationSelector);
|
|
104
|
+
return (_jsx(CustomHyperlinkComponent, { href: href, text: text, settings: settings, conversation: conversation }));
|
|
102
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationDashboardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/conversationContents/ConversationDashboardContent.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIhE,OAAO,KAAK,EAAE,0BAA0B,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationDashboardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/conversationContents/ConversationDashboardContent.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIhE,OAAO,KAAK,EAAE,0BAA0B,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;AAQzG,MAAM,MAAM,iCAAiC,GAAG;IAC5C,OAAO,EAAE,0BAA0B,CAAC;IACpC,IAAI,EAAE,mCAAmC,CAAC;IAC1C,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,iCAAiC,kDAkGpF"}
|
|
@@ -7,20 +7,26 @@ import { useSelector } from "react-redux";
|
|
|
7
7
|
import { useWorkspaceStrict } from "@gooddata/sdk-ui";
|
|
8
8
|
import { UiButton, UiIcon } from "@gooddata/sdk-ui-kit";
|
|
9
9
|
import { settingsSelector } from "../../../store/chatWindow/chatWindowSelectors.js";
|
|
10
|
+
import { conversationSelector } from "../../../store/messages/messagesSelectors.js";
|
|
10
11
|
import { getDashboardHref } from "../../../utils.js";
|
|
11
12
|
import { useConfig } from "../../ConfigContext.js";
|
|
13
|
+
import { useDashboardSaveCheck } from "./useSaveCheck.js";
|
|
12
14
|
export function ConversationDashboardContent(props) {
|
|
13
|
-
const { className, dashboard, insights,
|
|
15
|
+
const { className, dashboard, insights, message, part } = props;
|
|
14
16
|
const intl = useIntl();
|
|
15
17
|
const config = useConfig();
|
|
16
18
|
const workspaceId = useWorkspaceStrict();
|
|
17
19
|
const useHostedDashboards = Boolean(useSelector(settingsSelector)?.enableShellApplication_dashboards);
|
|
20
|
+
const conversation = useSelector(conversationSelector);
|
|
21
|
+
const { dashboardCheckLoading, dashboardSaved } = useDashboardSaveCheck(part, dashboard, true);
|
|
22
|
+
const isDashboardSaved = dashboardSaved || part.saved;
|
|
18
23
|
const handleOpenDashboard = useMemo(() => {
|
|
19
24
|
if (!dashboard) {
|
|
20
25
|
return undefined;
|
|
21
26
|
}
|
|
22
27
|
return (e) => {
|
|
23
|
-
|
|
28
|
+
//NOTE: Dashboard click here is always in draft mode
|
|
29
|
+
const dashboardStatus = "draft";
|
|
24
30
|
if (config.allowNativeLinks) {
|
|
25
31
|
window.location.href = getDashboardHref(workspaceId, dashboard.identifier, dashboardStatus, useHostedDashboards);
|
|
26
32
|
}
|
|
@@ -36,10 +42,11 @@ export function ConversationDashboardContent(props) {
|
|
|
36
42
|
insights: insights ?? [],
|
|
37
43
|
dashboardStatus,
|
|
38
44
|
action: "open",
|
|
45
|
+
conversationId: conversation?.localId,
|
|
39
46
|
});
|
|
40
47
|
}
|
|
41
48
|
};
|
|
42
|
-
}, [dashboard, insights, config, workspaceId, useHostedDashboards,
|
|
49
|
+
}, [dashboard, insights, config, workspaceId, useHostedDashboards, conversation]);
|
|
43
50
|
const classNames = cx("gd-gen-ai-chat__conversation__item__content", "gd-gen-ai-chat__conversation__item__content--dashboard", className);
|
|
44
51
|
if (!dashboard) {
|
|
45
52
|
return null;
|
|
@@ -47,7 +54,9 @@ export function ConversationDashboardContent(props) {
|
|
|
47
54
|
return (_jsx("div", { className: classNames, children: _jsxs("div", { className: "gd-gen-ai-chat__conversation__item__content-dashboard-frame", children: [_jsx("div", { className: "gd-gen-ai-chat__conversation__item__content-dashboard-icon", children: _jsx(UiIcon, { type: "dashboard", size: 14, color: "complementary-6", backgroundSize: 26, backgroundColor: "complementary-2" }) }), _jsxs("div", { className: "gd-gen-ai-chat__conversation__item__content-dashboard-content", children: [_jsx("div", { className: "gd-gen-ai-chat__conversation__item__content-dashboard-content-title", children: dashboard.title }), _jsx("div", { className: "gd-gen-ai-chat__conversation__item__content-dashboard-content-date", children: Intl.DateTimeFormat(intl.locale, {
|
|
48
55
|
dateStyle: "medium",
|
|
49
56
|
timeStyle: "short",
|
|
50
|
-
}).format(showDate(dashboard.created, message.createdAt)) })] }), _jsx("div", { className: "gd-gen-ai-chat__conversation__item__content-dashboard-item-buttons", children: _jsx(UiButton, { label:
|
|
57
|
+
}).format(showDate(dashboard.created, message.createdAt)) })] }), _jsx("div", { className: "gd-gen-ai-chat__conversation__item__content-dashboard-item-buttons", children: _jsx(UiButton, { label: isDashboardSaved
|
|
58
|
+
? intl.formatMessage({ id: "gd.gen-ai.dashboard.edit-dashboard" })
|
|
59
|
+
: intl.formatMessage({ id: "gd.gen-ai.dashboard.open-dashboard" }), variant: "secondary", onClick: handleOpenDashboard, isLoading: dashboardCheckLoading, isDisabled: dashboardCheckLoading }) })] }) }));
|
|
51
60
|
}
|
|
52
61
|
function showDate(...args) {
|
|
53
62
|
const dates = args.map((arg) => {
|
|
@@ -7,7 +7,7 @@ import { ConversationAlertProposalContent } from "./ConversationAlertProposalCon
|
|
|
7
7
|
import { ConversationClarifyingQuestionsContent } from "./ConversationClarifyingQuestionsContent.js";
|
|
8
8
|
import { ConversationDashboardContent } from "./ConversationDashboardContent.js";
|
|
9
9
|
import { ConversationKdaContent } from "./ConversationKdaContent.js";
|
|
10
|
-
import {
|
|
10
|
+
import { ConversationPublisherDocumentContent } from "./ConversationPublisherDocumentContent.js";
|
|
11
11
|
import { ConversationSearchContent } from "./ConversationSearchContent.js";
|
|
12
12
|
import { ConversationTextContent } from "./ConversationTextContent.js";
|
|
13
13
|
import { ConversationWhatIfContent } from "./ConversationWhatIfContent.js";
|
|
@@ -40,8 +40,8 @@ export function ConversationMultipartContent({ message, parts, references, isLas
|
|
|
40
40
|
if (part.type === "dashboard") {
|
|
41
41
|
return (_jsx(ConversationDashboardContent, { message: message, part: part, dashboard: part.dashboard, insights: part.insights, saved: part.saved }, index));
|
|
42
42
|
}
|
|
43
|
-
if (part.type === "
|
|
44
|
-
return (_jsx(
|
|
43
|
+
if (part.type === "publisherDocument") {
|
|
44
|
+
return (_jsx(ConversationPublisherDocumentContent, { message: message, publisherDocument: part.publisherDocument, saved: part.saved, baseDocumentId: part.baseDocumentId }, index));
|
|
45
45
|
}
|
|
46
46
|
// Add more multipart types if needed
|
|
47
47
|
return null;
|
package/esm/components/messages/conversationContents/ConversationPublisherDocumentContent.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type IPublisherDocumentDefinition } from "@gooddata/sdk-model";
|
|
2
|
+
import type { IChatConversationLocalItem } from "../../../model.js";
|
|
3
|
+
export type ConversationPublisherDocumentContentProps = {
|
|
4
|
+
message: IChatConversationLocalItem;
|
|
5
|
+
publisherDocument: IPublisherDocumentDefinition | null;
|
|
6
|
+
saved?: string | null;
|
|
7
|
+
baseDocumentId?: string | null;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function ConversationPublisherDocumentContent({ message, publisherDocument, saved, baseDocumentId, className, }: ConversationPublisherDocumentContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
//# sourceMappingURL=ConversationPublisherDocumentContent.d.ts.map
|
package/esm/components/messages/conversationContents/ConversationPublisherDocumentContent.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationPublisherDocumentContent.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/conversationContents/ConversationPublisherDocumentContent.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAIxE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAMpE,MAAM,MAAM,yCAAyC,GAAG;IACpD,OAAO,EAAE,0BAA0B,CAAC;IACpC,iBAAiB,EAAE,4BAA4B,GAAG,IAAI,CAAC;IACvD,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,oCAAoC,CAAC,EACjD,OAAO,EACP,iBAAiB,EACjB,KAAK,EACL,cAAc,EACd,SAAS,GACZ,EAAE,yCAAyC,kDAgG3C"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import { useSelector } from "react-redux";
|
|
5
|
+
import { useWorkspaceStrict } from "@gooddata/sdk-ui";
|
|
6
|
+
import { UiButton, UiIcon } from "@gooddata/sdk-ui-kit";
|
|
7
|
+
import { isPreviewSelector, settingsSelector } from "../../../store/chatWindow/chatWindowSelectors.js";
|
|
8
|
+
import { conversationSelector } from "../../../store/messages/messagesSelectors.js";
|
|
9
|
+
import { formatPublisherDocumentPeriod, getPublisherDocumentItemUrl } from "../../../utils.js";
|
|
10
|
+
import { useConfig } from "../../ConfigContext.js";
|
|
11
|
+
export function ConversationPublisherDocumentContent({ message, publisherDocument, saved, baseDocumentId, className, }) {
|
|
12
|
+
const intl = useIntl();
|
|
13
|
+
const config = useConfig();
|
|
14
|
+
const workspaceId = useWorkspaceStrict();
|
|
15
|
+
const conversationId = useSelector(conversationSelector)?.id;
|
|
16
|
+
const isPublisherAppEnabled = Boolean(useSelector(settingsSelector)?.enableBusinessBriefingReportsApp);
|
|
17
|
+
const isPreview = useSelector(isPreviewSelector);
|
|
18
|
+
if (!isPublisherAppEnabled || isPreview) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
if (!publisherDocument) {
|
|
22
|
+
return (_jsx("div", { className: "gd-gen-ai-chat__conversation__item__content--error", children: intl.formatMessage({ id: "gd.gen-ai.publisherDocument.unavailable" }) }));
|
|
23
|
+
}
|
|
24
|
+
const itemUrl = getPublisherDocumentItemUrl({
|
|
25
|
+
workspaceId,
|
|
26
|
+
saved,
|
|
27
|
+
baseDocumentId,
|
|
28
|
+
conversationId,
|
|
29
|
+
itemId: message.id,
|
|
30
|
+
});
|
|
31
|
+
// The card only opens the version: a change to the document in the editor is applied there by the editor.
|
|
32
|
+
const buttonLabel = intl.formatMessage({ id: "gd.gen-ai.publisherDocument.open" });
|
|
33
|
+
const handleOpen = itemUrl
|
|
34
|
+
? (e) => {
|
|
35
|
+
if (config.allowNativeLinks) {
|
|
36
|
+
window.location.href = itemUrl;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
config.linkHandler?.({
|
|
40
|
+
type: "report",
|
|
41
|
+
id: saved ?? message.id,
|
|
42
|
+
workspaceId,
|
|
43
|
+
newTab: e.metaKey,
|
|
44
|
+
preventDefault: e.preventDefault.bind(e),
|
|
45
|
+
itemUrl,
|
|
46
|
+
action: "open",
|
|
47
|
+
conversationId,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
: undefined;
|
|
51
|
+
const period = formatPublisherDocumentPeriod(publisherDocument.periodStart, publisherDocument.periodEnd, intl);
|
|
52
|
+
const count = publisherDocument.content.pages.length;
|
|
53
|
+
const details = period
|
|
54
|
+
? intl.formatMessage({ id: "gd.gen-ai.publisherDocument.details" }, { period, count })
|
|
55
|
+
: intl.formatMessage({ id: "gd.gen-ai.publisherDocument.page-count" }, { count });
|
|
56
|
+
return (_jsx("div", { className: cx("gd-gen-ai-chat__conversation__item__content", "gd-gen-ai-chat__conversation__item__content--publisherDocument", className), children: _jsxs("div", { className: "gd-gen-ai-chat__conversation__item__content-publisherDocument-frame", children: [_jsx("div", { className: "gd-gen-ai-chat__conversation__item__content-publisherDocument-icon", children: _jsx(UiIcon, { type: "file", size: 14, color: "complementary-6", backgroundSize: 26, backgroundColor: "complementary-2" }) }), _jsxs("div", { className: "gd-gen-ai-chat__conversation__item__content-publisherDocument-content", children: [_jsx("div", { className: "gd-gen-ai-chat__conversation__item__content-publisherDocument-content-title", children: publisherDocument.title }), _jsx("div", { className: "gd-gen-ai-chat__conversation__item__content-publisherDocument-content-details", children: details })] }), _jsx("div", { className: "gd-gen-ai-chat__conversation__item__content-publisherDocument-item-buttons", children: _jsx(UiButton, { label: buttonLabel, variant: "secondary", isDisabled: !handleOpen, onClick: handleOpen }) })] }) }));
|
|
57
|
+
}
|
package/esm/components/messages/conversationContents/ConversationVisualizationContent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationVisualizationContent.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/conversationContents/ConversationVisualizationContent.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAE,KAAK,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;AAyBvF,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationVisualizationContent.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/conversationContents/ConversationVisualizationContent.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAE,KAAK,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;AAyBvF,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;AAc9G,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,KAAK,oDAAoD,EAAE,MAAM,2BAA2B,CAAC;AAuBtG,KAAK,wBAAwB,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,CAAC;AAE9E,wBAAgB,kCAAkC,CAAC,EAC/C,QAAQ,EACR,oBAAoB,EACpB,QAAQ,EACR,SAAS,GACZ,EAAE;IACC,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,SAAS,CAAC,EAAE,oDAAoD,CAAC,WAAW,CAAC,CAAC;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB,EAAE,OAAO,CAAC;CACjC,GAAG,wBAAwB,EAAE,CAyB7B;AAED,MAAM,MAAM,qCAAqC,GAAG;IAChD,OAAO,EAAE,0BAA0B,CAAC;IACpC,IAAI,EAAE,mCAAmC,CAAC;IAC1C,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,aAAa,EAAE,WAAW,CAAC,qCAAqC,CAAC,eAAe,CAAC,CAAC,CAAC;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,oDAAoD,CAAC,WAAW,CAAC,CAAC;IAC9E,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,EAC7C,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,SAAS,EACT,SAAS,EACT,uBAAuB,GAC1B,EAAE,qCAAqC,2CAyHvC"}
|