@gooddata/sdk-ui-pluggable-host 11.61.0-alpha.2 → 11.61.0-alpha.3
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/HostUiContainer.d.ts.map +1 -1
- package/esm/components/HostUiContainer.js +8 -2
- package/esm/ui/GenAIChat.d.ts +4 -1
- package/esm/ui/GenAIChat.d.ts.map +1 -1
- package/esm/ui/GenAIChat.js +8 -23
- package/esm/ui/HostChat.d.ts +4 -1
- package/esm/ui/HostChat.d.ts.map +1 -1
- package/esm/ui/HostChat.js +2 -1
- package/esm/ui/PluggableApplicationRenderer.d.ts +8 -1
- package/esm/ui/PluggableApplicationRenderer.d.ts.map +1 -1
- package/esm/ui/PluggableApplicationRenderer.js +13 -2
- package/esm/ui/chatLinks.d.ts +8 -0
- package/esm/ui/chatLinks.d.ts.map +1 -0
- package/esm/ui/chatLinks.js +17 -0
- package/esm/ui/useHostChromeChat.d.ts +4 -1
- package/esm/ui/useHostChromeChat.d.ts.map +1 -1
- package/esm/ui/useHostChromeChat.js +2 -2
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HostUiContainer.d.ts","sourceRoot":"","sources":["../../src/components/HostUiContainer.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAA0B,KAAK,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAGH,KAAK,gBAAgB,EAExB,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"HostUiContainer.d.ts","sourceRoot":"","sources":["../../src/components/HostUiContainer.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAA0B,KAAK,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAGH,KAAK,gBAAgB,EAExB,MAAM,2CAA2C,CAAC;AAkBnD,OAAO,wBAAwB,CAAC;AAOhC,MAAM,WAAW,qBAAqB;IAClC,GAAG,EAAE,gBAAgB,CAAC;IACtB,IAAI,EAAE,gCAAgC,EAAE,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,gBAAgB,CAAC;IACjC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,qBAAqB,2CA6WtG"}
|
|
@@ -70,6 +70,11 @@ export function HostUiContainer({ ctx, apps, pathname, routerNavigate, onError }
|
|
|
70
70
|
const [aiVisibility, setAiVisibility] = useState(null);
|
|
71
71
|
const [aiContext, setAiContext] = useState(null);
|
|
72
72
|
const aiVisibilitySeqRef = useRef(0);
|
|
73
|
+
const [aiReportSaved, setAiReportSaved] = useState(undefined);
|
|
74
|
+
const aiReportSavedSeqRef = useRef(0);
|
|
75
|
+
const reportAiAssistantReportSaved = useCallback((saved) => {
|
|
76
|
+
setAiReportSaved({ ...saved, seq: ++aiReportSavedSeqRef.current });
|
|
77
|
+
}, []);
|
|
73
78
|
const requestOpenAi = useCallback((question, agentId, userContext, appendToChat, replaceUserContext) => {
|
|
74
79
|
setAiVisibility({
|
|
75
80
|
kind: "open",
|
|
@@ -249,7 +254,7 @@ export function HostUiContainer({ ctx, apps, pathname, routerNavigate, onError }
|
|
|
249
254
|
return;
|
|
250
255
|
}
|
|
251
256
|
if (activeInternalApplication) {
|
|
252
|
-
appRootRef.current.render(_jsx(HostErrorBoundary, { resetKey: pathname, onError: reportError, locale: resolveLocale(ctx.preferredLocale), children: _jsx(HostIntlProvider, { locale: resolveLocale(ctx.preferredLocale), children: _jsx(PluggableApplicationRenderer, { app: activeInternalApplication, ctx: ctx, pathname: pathname, aiAssistantOpen: aiAssistantOpen, onOpenAiAssistant: requestOpenAi, onCloseAiAssistant: requestCloseAi, onAiAssistantContext: setAiAssistantContext, aiLinkClickHandlerRef: appAiLinkClickRef, navigationRequestRef: appNavigationRequestRef, aiEventReceiveRef: appEventReceiveRef, onHeaderChange: onHeaderChange, onDocumentTitleChange: onDocumentTitleChange }, activeInternalApplication.id) }) }, `${activeInternalApplication.id}:${appContextEpoch}`));
|
|
257
|
+
appRootRef.current.render(_jsx(HostErrorBoundary, { resetKey: pathname, onError: reportError, locale: resolveLocale(ctx.preferredLocale), children: _jsx(HostIntlProvider, { locale: resolveLocale(ctx.preferredLocale), children: _jsx(PluggableApplicationRenderer, { app: activeInternalApplication, ctx: ctx, pathname: pathname, aiAssistantOpen: aiAssistantOpen, onOpenAiAssistant: requestOpenAi, onCloseAiAssistant: requestCloseAi, onAiAssistantContext: setAiAssistantContext, onAiAssistantReportSaved: reportAiAssistantReportSaved, aiLinkClickHandlerRef: appAiLinkClickRef, navigationRequestRef: appNavigationRequestRef, aiEventReceiveRef: appEventReceiveRef, onHeaderChange: onHeaderChange, onDocumentTitleChange: onDocumentTitleChange }, activeInternalApplication.id) }) }, `${activeInternalApplication.id}:${appContextEpoch}`));
|
|
253
258
|
}
|
|
254
259
|
else {
|
|
255
260
|
appRootRef.current.render(null);
|
|
@@ -267,6 +272,7 @@ export function HostUiContainer({ ctx, apps, pathname, routerNavigate, onError }
|
|
|
267
272
|
requestOpenAi,
|
|
268
273
|
requestCloseAi,
|
|
269
274
|
setAiAssistantContext,
|
|
275
|
+
reportAiAssistantReportSaved,
|
|
270
276
|
]);
|
|
271
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: containerRef, className: "gd-host-ui-container" }), hostReady && !ctx.isExportMode ? (_jsx(HostChat, { ctx: ctx, resolvedApplications: apps, pathname: pathname, activeAppId: activeInternalApplication?.id, visibility: aiVisibility, context: aiContext, onOpenChange: setAiAssistantOpen, onChatStateChange: onChatStateChange, onAppLinkClick: onAppLinkClick, onAppEventReceive: onAppEventReceive })) : null] }));
|
|
277
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: containerRef, className: "gd-host-ui-container" }), hostReady && !ctx.isExportMode ? (_jsx(HostChat, { ctx: ctx, resolvedApplications: apps, pathname: pathname, activeAppId: activeInternalApplication?.id, visibility: aiVisibility, context: aiContext, reportSaved: aiReportSaved, onOpenChange: setAiAssistantOpen, onChatStateChange: onChatStateChange, onAppLinkClick: onAppLinkClick, onAppEventReceive: onAppEventReceive })) : null] }));
|
|
272
278
|
}
|
package/esm/ui/GenAIChat.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
|
|
2
2
|
import type { IGenAIUserContext } from "@gooddata/sdk-model";
|
|
3
3
|
import { type ChatDefinitionReceivedEvent, type ChatAssistantMessageEvent, type ChatClosedEvent, type ChatFeedbackEvent, type ChatOpenedEvent, type ChatResetEvent, type ChatUserMessageEvent, type ChatModeChangeEvent } from "@gooddata/sdk-ui-gen-ai";
|
|
4
|
+
import { type IReportSaved } from "@gooddata/sdk-ui-gen-ai/internal";
|
|
4
5
|
/**
|
|
5
6
|
* Discriminated union of GenAI chat events that are forwarded to the host
|
|
6
7
|
* caller via the `onEvent` callback.
|
|
@@ -73,6 +74,8 @@ export interface IGenAIChatProps {
|
|
|
73
74
|
* Whether the ambient user context is currently loading.
|
|
74
75
|
*/
|
|
75
76
|
ambientUserContextLoading?: boolean;
|
|
77
|
+
/** The latest report of the conversation that the active application saved. */
|
|
78
|
+
reportSaved: IReportSaved | undefined;
|
|
76
79
|
/**
|
|
77
80
|
* Tag identifiers the assistant's object search/autocomplete should be restricted to,
|
|
78
81
|
* reflecting the active hosted application's current view.
|
|
@@ -105,5 +108,5 @@ export interface IGenAIChatProps {
|
|
|
105
108
|
* (`@gooddata/sdk-ui-gen-ai/internal`); this adapter only supplies the host's data sources, renders the
|
|
106
109
|
* host's own save-visualization / copy toasts, and forwards telemetry events through `onEvent`.
|
|
107
110
|
*/
|
|
108
|
-
export declare function GenAIChat({ workspaceId, open, disabled, onOpen, onClose, askedQuestion, askSeq, appendToChat, agentId, userContext, replaceUserContext, ambientUserContext, ambientUserContextLoading, includeTags, excludeTags, canManageProject, canAnalyzeProject, canFullControl, settings, dialogPosition, embedded, onAppLinkClick, onEvent, }: IGenAIChatProps): import("react/jsx-runtime").JSX.Element;
|
|
111
|
+
export declare function GenAIChat({ workspaceId, open, disabled, onOpen, onClose, askedQuestion, askSeq, appendToChat, agentId, userContext, replaceUserContext, ambientUserContext, ambientUserContextLoading, reportSaved, includeTags, excludeTags, canManageProject, canAnalyzeProject, canFullControl, settings, dialogPosition, embedded, onAppLinkClick, onEvent, }: IGenAIChatProps): import("react/jsx-runtime").JSX.Element;
|
|
109
112
|
//# sourceMappingURL=GenAIChat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAIChat.d.ts","sourceRoot":"","sources":["../../src/ui/GenAIChat.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EACH,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAEzB,KAAK,mBAAmB,EAC3B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"GenAIChat.d.ts","sourceRoot":"","sources":["../../src/ui/GenAIChat.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EACH,KAAK,2BAA2B,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AAiB,EACjB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,cAAc,EACd,OAAO,GACV,EAAE,eAAe,2CAsGjB"}
|
package/esm/ui/GenAIChat.js
CHANGED
|
@@ -3,8 +3,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useCallback } from "react";
|
|
4
4
|
import { defineMessage, useIntl } from "react-intl";
|
|
5
5
|
import { useBackendStrict } from "@gooddata/sdk-ui";
|
|
6
|
-
import { GenAIChatDialogConnected } from "@gooddata/sdk-ui-gen-ai/internal";
|
|
6
|
+
import { GenAIChatDialogConnected, } from "@gooddata/sdk-ui-gen-ai/internal";
|
|
7
7
|
import { HEADER_CHAT_BUTTON_ID, useToastMessage } from "@gooddata/sdk-ui-kit";
|
|
8
|
+
import { handleChatLinkClick } from "./chatLinks.js";
|
|
8
9
|
import { useGenAiRightPanel } from "./useGenAiRightPanel.js";
|
|
9
10
|
// DOM id of the embedded dashboard's AI trigger button (defined in gdc-dashboards-runtime as
|
|
10
11
|
// EMBED_AI_TRIGGER_ID). Used as the chat's focus-return target when running embedded, where the host
|
|
@@ -17,30 +18,14 @@ const EMBEDDED_CHAT_CLASS = "gd-gen-ai-chat-embedded";
|
|
|
17
18
|
* (`@gooddata/sdk-ui-gen-ai/internal`); this adapter only supplies the host's data sources, renders the
|
|
18
19
|
* host's own save-visualization / copy toasts, and forwards telemetry events through `onEvent`.
|
|
19
20
|
*/
|
|
20
|
-
export function GenAIChat({ workspaceId, open, disabled, onOpen, onClose, askedQuestion, askSeq, appendToChat, agentId, userContext, replaceUserContext, ambientUserContext, ambientUserContextLoading, includeTags, excludeTags, canManageProject, canAnalyzeProject, canFullControl, settings, dialogPosition, embedded, onAppLinkClick, onEvent, }) {
|
|
21
|
+
export function GenAIChat({ workspaceId, open, disabled, onOpen, onClose, askedQuestion, askSeq, appendToChat, agentId, userContext, replaceUserContext, ambientUserContext, ambientUserContextLoading, reportSaved, includeTags, excludeTags, canManageProject, canAnalyzeProject, canFullControl, settings, dialogPosition, embedded, onAppLinkClick, onEvent, }) {
|
|
21
22
|
const { addSuccess, addError } = useToastMessage();
|
|
22
23
|
const intl = useIntl();
|
|
23
24
|
const backend = useBackendStrict();
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
// open/navigate handler instead.
|
|
29
|
-
const onLinkClick = useCallback((link) => {
|
|
30
|
-
if (!embedded && link.action === "open") {
|
|
31
|
-
const currentUrl = window.location.pathname + window.location.hash;
|
|
32
|
-
const areUrlsEqual = currentUrl === link.itemUrl;
|
|
33
|
-
if (link.newTab) {
|
|
34
|
-
window.open(link.itemUrl, "_blank");
|
|
35
|
-
}
|
|
36
|
-
else if (!areUrlsEqual) {
|
|
37
|
-
window.location.assign(link.itemUrl);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
onAppLinkClick?.(link);
|
|
41
|
-
link.preventDefault();
|
|
42
|
-
return link.itemUrl;
|
|
43
|
-
}, [onAppLinkClick, embedded]);
|
|
25
|
+
// The active app gets the click first (an embedded dashboard opens a visualization as an in-place
|
|
26
|
+
// overlay). An embedded chat never navigates its iframe away, whatever the link type; otherwise a
|
|
27
|
+
// click the app did not handle opens the link.
|
|
28
|
+
const onLinkClick = useCallback((link) => handleChatLinkClick(link, { embedded, onAppLinkClick }), [onAppLinkClick, embedded]);
|
|
44
29
|
const handleEvent = useCallback((event) => {
|
|
45
30
|
switch (event.name) {
|
|
46
31
|
case "opened":
|
|
@@ -89,5 +74,5 @@ export function GenAIChat({ workspaceId, open, disabled, onOpen, onClose, askedQ
|
|
|
89
74
|
}
|
|
90
75
|
}, [addError, addSuccess, intl, onEvent]);
|
|
91
76
|
const enableRightPanel = useGenAiRightPanel(settings?.["enableGenAiRightPanel"], embedded);
|
|
92
|
-
return (_jsx(GenAIChatDialogConnected, { backend: backend, workspace: workspaceId, locale: intl.locale, isOpen: open, isDisabled: disabled, onOpen: onOpen, onClose: onClose, askedQuestion: askedQuestion, askSeq: askSeq, userContext: userContext, appendToChat: appendToChat, agentId: agentId, replaceUserContext: replaceUserContext, ambientUserContext: ambientUserContext, ambientUserContextLoading: ambientUserContextLoading, includeTags: includeTags, excludeTags: excludeTags, canManage: canManageProject, canAnalyze: canAnalyzeProject, canFullControl: canFullControl, settings: settings, dialogPosition: dialogPosition, className: embedded ? EMBEDDED_CHAT_CLASS : undefined, allowNativeLinks: false, onLinkClick: onLinkClick, onEvent: handleEvent, displayMode: enableRightPanel ? "inline" : "modal", returnFocusTo: embedded ? EMBEDDED_AI_TRIGGER_ID : HEADER_CHAT_BUTTON_ID }));
|
|
77
|
+
return (_jsx(GenAIChatDialogConnected, { backend: backend, workspace: workspaceId, locale: intl.locale, isOpen: open, isDisabled: disabled, onOpen: onOpen, onClose: onClose, askedQuestion: askedQuestion, askSeq: askSeq, userContext: userContext, appendToChat: appendToChat, agentId: agentId, replaceUserContext: replaceUserContext, ambientUserContext: ambientUserContext, reportSaved: reportSaved, ambientUserContextLoading: ambientUserContextLoading, includeTags: includeTags, excludeTags: excludeTags, canManage: canManageProject, canAnalyze: canAnalyzeProject, canFullControl: canFullControl, settings: settings, dialogPosition: dialogPosition, className: embedded ? EMBEDDED_CHAT_CLASS : undefined, allowNativeLinks: false, onLinkClick: onLinkClick, onEvent: handleEvent, displayMode: enableRightPanel ? "inline" : "modal", returnFocusTo: embedded ? EMBEDDED_AI_TRIGGER_ID : HEADER_CHAT_BUTTON_ID }));
|
|
93
78
|
}
|
package/esm/ui/HostChat.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type IGenAIUserContext, type PluggableApplicationRegistryItem } from "@gooddata/sdk-model";
|
|
2
2
|
import { type IPlatformContext } from "@gooddata/sdk-pluggable-application-model";
|
|
3
3
|
import { GenAIAssistantMode } from "@gooddata/sdk-ui-gen-ai";
|
|
4
|
+
import { type IReportSaved } from "@gooddata/sdk-ui-gen-ai/internal";
|
|
4
5
|
import { GenAIChatEvent } from "./GenAIChat.js";
|
|
5
6
|
import "./HostChat.scss";
|
|
6
7
|
import "@gooddata/sdk-ui-gen-ai/styles/css/main.css";
|
|
@@ -68,6 +69,8 @@ export interface IHostChatProps {
|
|
|
68
69
|
* Delegates a chat event receive to the active application.
|
|
69
70
|
*/
|
|
70
71
|
onAppEventReceive?: (event: GenAIChatEvent) => void;
|
|
72
|
+
/** The latest report of the conversation that the active application saved. */
|
|
73
|
+
reportSaved: IReportSaved | undefined;
|
|
71
74
|
}
|
|
72
75
|
/**
|
|
73
76
|
* Owns and renders the host's single GenAI chat, decoupled from the host UI module.
|
|
@@ -78,5 +81,5 @@ export interface IHostChatProps {
|
|
|
78
81
|
* (embedded/export). The header chat button and app-side controls drive it through the `visibility`
|
|
79
82
|
* and `context` props; it reports its open-state and button state back via callbacks.
|
|
80
83
|
*/
|
|
81
|
-
export declare function HostChat({ ctx, resolvedApplications, pathname, activeAppId, visibility, context, onOpenChange, onChatStateChange, onAppLinkClick, onAppEventReceive, }: IHostChatProps): import("react/jsx-runtime").JSX.Element;
|
|
84
|
+
export declare function HostChat({ ctx, resolvedApplications, pathname, activeAppId, visibility, context, onOpenChange, onChatStateChange, onAppLinkClick, onAppEventReceive, reportSaved, }: IHostChatProps): import("react/jsx-runtime").JSX.Element;
|
|
82
85
|
//# sourceMappingURL=HostChat.d.ts.map
|
package/esm/ui/HostChat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HostChat.d.ts","sourceRoot":"","sources":["../../src/ui/HostChat.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAElF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"HostChat.d.ts","sourceRoot":"","sources":["../../src/ui/HostCh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MAAM,WAAW,cAAc;IAC3B,GAAG,EAAE,gBAAgB,CAAC;IACtB,oBAAoB,EAAE,gCAAgC,EAAE,CAAC;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+FAA+F;IAC/F,UAAU,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACxC,oFAAoF;IACpF,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,mFAAmF;IACnF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,6FAA6F;IAC7F,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,YAAY,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,kBAAkB,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1G;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC;IAClD;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACpD,+EAA+E;IAC/E,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,EACrB,GAAG,EACH,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,UAAiB,EACjB,OAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,WAAW,GACd,EAAE,cAAc,2CAmIhB"}
|
package/esm/ui/HostChat.js
CHANGED
|
@@ -21,7 +21,7 @@ import { useHostChromeWorkspaceFeatures } from "./useHostChromeWorkspaceFeatures
|
|
|
21
21
|
* (embedded/export). The header chat button and app-side controls drive it through the `visibility`
|
|
22
22
|
* and `context` props; it reports its open-state and button state back via callbacks.
|
|
23
23
|
*/
|
|
24
|
-
export function HostChat({ ctx, resolvedApplications, pathname, activeAppId, visibility = null, context = null, onOpenChange, onChatStateChange, onAppLinkClick, onAppEventReceive, }) {
|
|
24
|
+
export function HostChat({ ctx, resolvedApplications, pathname, activeAppId, visibility = null, context = null, onOpenChange, onChatStateChange, onAppLinkClick, onAppEventReceive, reportSaved, }) {
|
|
25
25
|
const features = useHostChromeWorkspaceFeatures(resolvedApplications, ctx, pathname);
|
|
26
26
|
const shellTelemetry = useMemo(() => getAppLifecycleCallbacks()?.createTelemetryCallbacks?.("host-ui"), []);
|
|
27
27
|
const chat = useHostChromeChat({
|
|
@@ -33,6 +33,7 @@ export function HostChat({ ctx, resolvedApplications, pathname, activeAppId, vis
|
|
|
33
33
|
disabled: context?.disabled,
|
|
34
34
|
onAppLinkClick,
|
|
35
35
|
onAppEventReceive,
|
|
36
|
+
reportSaved,
|
|
36
37
|
});
|
|
37
38
|
const { askAiAssistant: chatAskAiAssistant, openAiAssistant: chatOpenAiAssistant, open: chatOpen, close: chatClose, toggle: chatToggle, setTags: chatSetTags, setAmbientUserContext: chatSetAmbientUserContext, setAmbientUserContextLoading: chatSetAmbientUserContextLoading, isOpen: chatIsOpen, showChatItem, } = chat;
|
|
38
39
|
// Report the chat open-state outward so the runtime can forward it to the active pluggable
|
|
@@ -23,6 +23,13 @@ export interface IPluggableApplicationRendererProps {
|
|
|
23
23
|
userContext?: IGenAIUserContext;
|
|
24
24
|
userContextLoading?: boolean;
|
|
25
25
|
}) => void;
|
|
26
|
+
/** Tell the host-owned chat that the active app saved a report the chat had drafted. */
|
|
27
|
+
onAiAssistantReportSaved?: (saved: {
|
|
28
|
+
conversationId: string;
|
|
29
|
+
itemId: string;
|
|
30
|
+
reportRef?: string;
|
|
31
|
+
savedReportId: string;
|
|
32
|
+
}) => void;
|
|
26
33
|
/**
|
|
27
34
|
* Ref the renderer populates with a handler that delegates a host-chat link click to the active
|
|
28
35
|
* app's mount handle (`onAiAssistantLinkClicked`), so an embedded app can handle it in-app.
|
|
@@ -47,5 +54,5 @@ export interface IPluggableApplicationRendererProps {
|
|
|
47
54
|
onHeaderChange?: (appId: string, header: IAppHeaderOptions) => void;
|
|
48
55
|
onDocumentTitleChange?: (appId: string, pageTitle: string | undefined) => void;
|
|
49
56
|
}
|
|
50
|
-
export declare function PluggableApplicationRenderer({ app, ctx, pathname, aiAssistantOpen, onOpenAiAssistant, onCloseAiAssistant, onAiAssistantContext, aiLinkClickHandlerRef, aiEventReceiveRef, navigationRequestRef, onHeaderChange, onDocumentTitleChange, }: IPluggableApplicationRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export declare function PluggableApplicationRenderer({ app, ctx, pathname, aiAssistantOpen, onOpenAiAssistant, onCloseAiAssistant, onAiAssistantContext, onAiAssistantReportSaved, aiLinkClickHandlerRef, aiEventReceiveRef, navigationRequestRef, onHeaderChange, onDocumentTitleChange, }: IPluggableApplicationRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
51
58
|
//# sourceMappingURL=PluggableApplicationRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluggableApplicationRenderer.d.ts","sourceRoot":"","sources":["../../src/ui/PluggableApplicationRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAsE,MAAM,OAAO,CAAC;AAI3G,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"PluggableApplicationRenderer.d.ts","sourceRoot":"","sources":["../../src/ui/PluggableApplicationRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAsE,MAAM,OAAO,CAAC;AAI3G,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EACH,KAAK,iBAAiB,EACt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AAC,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,GAAG,SAAS,CACtG,CAAC;IACF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;IAC7E;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;IAC7F,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACpE,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAClF;AAED,wBAAgB,4BAA4B,CAAC,EACzC,GAAG,EACH,GAAG,EACH,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,qBAAqB,GACxB,EAAE,kCAAkC,2CAwUpC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// (C) 2026 GoodData Corporation
|
|
3
3
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { FormattedMessage, defineMessage, useIntl } from "react-intl";
|
|
5
|
-
import { isAiAssistantContextChangedEvent, isCloseAiAssistantRequestedEvent, isDocumentTitleChangedEvent, isOpenAiAssistantRequestedEvent, isReloadPlatformContextRequestedEvent, } from "@gooddata/sdk-pluggable-application-model";
|
|
5
|
+
import { isAiAssistantContextChangedEvent, isAiAssistantReportSavedEvent, isCloseAiAssistantRequestedEvent, isDocumentTitleChangedEvent, isOpenAiAssistantRequestedEvent, isReloadPlatformContextRequestedEvent, } from "@gooddata/sdk-pluggable-application-model";
|
|
6
6
|
import { LoadingComponent, useAutoupdateRef } from "@gooddata/sdk-ui";
|
|
7
7
|
import { bemFactory } from "@gooddata/sdk-ui-kit";
|
|
8
8
|
import { now } from "../debug.js";
|
|
@@ -22,7 +22,7 @@ const SECURITY_FAILURE_MESSAGES = {
|
|
|
22
22
|
"build-expired": defineMessage({ id: "gs.host.error.appBuildExpired" }),
|
|
23
23
|
"metadata-missing": defineMessage({ id: "gs.host.error.appSecurityMetadataMissing" }),
|
|
24
24
|
};
|
|
25
|
-
export function PluggableApplicationRenderer({ app, ctx, pathname, aiAssistantOpen, onOpenAiAssistant, onCloseAiAssistant, onAiAssistantContext, aiLinkClickHandlerRef, aiEventReceiveRef, navigationRequestRef, onHeaderChange, onDocumentTitleChange, }) {
|
|
25
|
+
export function PluggableApplicationRenderer({ app, ctx, pathname, aiAssistantOpen, onOpenAiAssistant, onCloseAiAssistant, onAiAssistantContext, onAiAssistantReportSaved, aiLinkClickHandlerRef, aiEventReceiveRef, navigationRequestRef, onHeaderChange, onDocumentTitleChange, }) {
|
|
26
26
|
const intl = useIntl();
|
|
27
27
|
const intlRef = useAutoupdateRef(intl);
|
|
28
28
|
const ctxRef = useAutoupdateRef(ctx);
|
|
@@ -31,6 +31,7 @@ export function PluggableApplicationRenderer({ app, ctx, pathname, aiAssistantOp
|
|
|
31
31
|
const onOpenAiAssistantRef = useAutoupdateRef(onOpenAiAssistant);
|
|
32
32
|
const onCloseAiAssistantRef = useAutoupdateRef(onCloseAiAssistant);
|
|
33
33
|
const onAiAssistantContextRef = useAutoupdateRef(onAiAssistantContext);
|
|
34
|
+
const onAiAssistantReportSavedRef = useAutoupdateRef(onAiAssistantReportSaved);
|
|
34
35
|
const containerRef = useRef(null);
|
|
35
36
|
const mountHandleRef = useRef(undefined);
|
|
36
37
|
// The app/module pair currently mounted. Held so the context-change effect can
|
|
@@ -73,6 +74,15 @@ export function PluggableApplicationRenderer({ app, ctx, pathname, aiAssistantOp
|
|
|
73
74
|
});
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
77
|
+
if (isAiAssistantReportSavedEvent(event)) {
|
|
78
|
+
onAiAssistantReportSavedRef.current?.({
|
|
79
|
+
conversationId: event.payload.conversationId,
|
|
80
|
+
itemId: event.payload.itemId,
|
|
81
|
+
reportRef: event.payload.reportRef,
|
|
82
|
+
savedReportId: event.payload.savedReportId,
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
76
86
|
if (isDocumentTitleChangedEvent(event)) {
|
|
77
87
|
onDocumentTitleChangeRef.current?.(app.id, event.payload.pageTitle);
|
|
78
88
|
}
|
|
@@ -82,6 +92,7 @@ export function PluggableApplicationRenderer({ app, ctx, pathname, aiAssistantOp
|
|
|
82
92
|
onOpenAiAssistantRef,
|
|
83
93
|
onCloseAiAssistantRef,
|
|
84
94
|
onAiAssistantContextRef,
|
|
95
|
+
onAiAssistantReportSavedRef,
|
|
85
96
|
]);
|
|
86
97
|
useEffect(() => {
|
|
87
98
|
let cancelled = false;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type LinkHandlerEvent } from "@gooddata/sdk-ui-gen-ai";
|
|
2
|
+
interface IChatLinkOptions {
|
|
3
|
+
embedded: boolean | undefined;
|
|
4
|
+
onAppLinkClick: ((link: LinkHandlerEvent) => boolean) | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function handleChatLinkClick(link: LinkHandlerEvent, { embedded, onAppLinkClick }: IChatLinkOptions): string | undefined;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=chatLinks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatLinks.d.ts","sourceRoot":"","sources":["../../src/ui/chatLinks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,UAAU,gBAAgB;IACtB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,cAAc,EAAE,CAAC,CAAC,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;CACrE;AAED,wBAAgB,mBAAmB,CAC/B,IAAI,EAAE,gBAAgB,EACtB,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,gBAAgB,GAC/C,MAAM,GAAG,SAAS,CAgBpB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
export function handleChatLinkClick(link, { embedded, onAppLinkClick }) {
|
|
3
|
+
// A full navigation unloads the app, so the app is asked first: only it can prompt before
|
|
4
|
+
// dropping unsaved work. A new tab leaves the app loaded, so it opens whatever the app did.
|
|
5
|
+
const isHandledByApp = onAppLinkClick?.(link) ?? false;
|
|
6
|
+
if (!embedded && link.action === "open") {
|
|
7
|
+
const currentUrl = window.location.pathname + window.location.hash;
|
|
8
|
+
if (link.newTab) {
|
|
9
|
+
window.open(link.itemUrl, "_blank");
|
|
10
|
+
}
|
|
11
|
+
else if (!isHandledByApp && currentUrl !== link.itemUrl) {
|
|
12
|
+
window.location.assign(link.itemUrl);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
link.preventDefault();
|
|
16
|
+
return link.itemUrl;
|
|
17
|
+
}
|
|
@@ -2,6 +2,7 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import { type IGenAIUserContext } from "@gooddata/sdk-model";
|
|
3
3
|
import { type IPlatformContext, type IPluggableAppTelemetryCallbacks } from "@gooddata/sdk-pluggable-application-model";
|
|
4
4
|
import { GenAIAssistantMode } from "@gooddata/sdk-ui-gen-ai";
|
|
5
|
+
import { type IReportSaved } from "@gooddata/sdk-ui-gen-ai/internal";
|
|
5
6
|
import { type GenAIChatEvent } from "./GenAIChat.js";
|
|
6
7
|
import { type IHostChromeWorkspaceFeatures } from "./useHostChromeWorkspaceFeatures.js";
|
|
7
8
|
export interface IHostChromeChat {
|
|
@@ -70,6 +71,8 @@ export interface IUseHostChromeChatArgs {
|
|
|
70
71
|
}) => boolean;
|
|
71
72
|
/** Delegates a chat event receive to the active app. */
|
|
72
73
|
onAppEventReceive?: (event: GenAIChatEvent) => void;
|
|
74
|
+
/** The latest report of the conversation that the active app saved. */
|
|
75
|
+
reportSaved: IReportSaved | undefined;
|
|
73
76
|
}
|
|
74
77
|
/**
|
|
75
78
|
* Owns the GenAI chat state and renders the `<GenAIChat>` element for the host chrome.
|
|
@@ -78,5 +81,5 @@ export interface IUseHostChromeChatArgs {
|
|
|
78
81
|
* points, the runtime availability probe (`useGenAiChatAvailability`) and forwarding chat
|
|
79
82
|
* events to the host telemetry callbacks.
|
|
80
83
|
*/
|
|
81
|
-
export declare function useHostChromeChat({ features, ctx, telemetry, dialogPosition, embedded, disabled, onAppLinkClick, onAppEventReceive, }: IUseHostChromeChatArgs): IHostChromeChat;
|
|
84
|
+
export declare function useHostChromeChat({ features, ctx, telemetry, dialogPosition, embedded, disabled, onAppLinkClick, onAppEventReceive, reportSaved, }: IUseHostChromeChatArgs): IHostChromeChat;
|
|
82
85
|
//# sourceMappingURL=useHostChromeChat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHostChromeChat.d.ts","sourceRoot":"","sources":["../../src/ui/useHostChromeChat.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAyB,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,+BAA+B,EACvC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAA4B,MAAM,yBAAyB,CAAC;
|
|
1
|
+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ding chat
|
|
12
12
|
* events to the host telemetry callbacks.
|
|
13
13
|
*/
|
|
14
|
-
export function useHostChromeChat({ features, ctx, telemetry, dialogPosition, embedded, disabled, onAppLinkClick, onAppEventReceive, }) {
|
|
14
|
+
export function useHostChromeChat({ features, ctx, telemetry, dialogPosition, embedded, disabled, onAppLinkClick, onAppEventReceive, reportSaved, }) {
|
|
15
15
|
const [isChatOpen, setIsChatOpen] = useState(false);
|
|
16
16
|
const [askedQuestion, setAskedQuestion] = useState(null);
|
|
17
17
|
const [appendToChat, setAppendToChat] = useState(false);
|
|
@@ -69,7 +69,7 @@ export function useHostChromeChat({ features, ctx, telemetry, dialogPosition, em
|
|
|
69
69
|
onAppEventReceive?.(event);
|
|
70
70
|
}, [telemetry, onAppEventReceive]);
|
|
71
71
|
const showChatItem = useGenAiChatAvailability(getBackend(), features.workspaceId, features.showChat, features.canManageProject);
|
|
72
|
-
const element = features.showChat && features.workspaceId ? (_jsx(GenAIChat, { workspaceId: features.workspaceId, open: isChatOpen, disabled: disabled, onOpen: open, onClose: close, askedQuestion: askedQuestion, appendToChat: appendToChat, agentId: agentId, replaceUserContext: replaceUserContext, askSeq: askSeq, userContext: userContext, ambientUserContext: ambientUserContext, ambientUserContextLoading: ambientUserContextLoading, includeTags: includeTags, excludeTags: excludeTags, canManageProject: features.canManageProject, canAnalyzeProject: features.canAnalyzeWorkspace, canFullControl: features.canFullControl, settings: ctx.workspaceSettings, dialogPosition: dialogPosition, embedded: embedded, onAppLinkClick: onAppLinkClick, onEvent: handleChatEvent })) : null;
|
|
72
|
+
const element = features.showChat && features.workspaceId ? (_jsx(GenAIChat, { workspaceId: features.workspaceId, open: isChatOpen, disabled: disabled, onOpen: open, onClose: close, askedQuestion: askedQuestion, appendToChat: appendToChat, agentId: agentId, replaceUserContext: replaceUserContext, askSeq: askSeq, userContext: userContext, ambientUserContext: ambientUserContext, ambientUserContextLoading: ambientUserContextLoading, reportSaved: reportSaved, includeTags: includeTags, excludeTags: excludeTags, canManageProject: features.canManageProject, canAnalyzeProject: features.canAnalyzeWorkspace, canFullControl: features.canFullControl, settings: ctx.workspaceSettings, dialogPosition: dialogPosition, embedded: embedded, onAppLinkClick: onAppLinkClick, onEvent: handleChatEvent })) : null;
|
|
73
73
|
return {
|
|
74
74
|
element,
|
|
75
75
|
isOpen: isChatOpen,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-pluggable-host",
|
|
3
|
-
"version": "11.61.0-alpha.
|
|
3
|
+
"version": "11.61.0-alpha.3",
|
|
4
4
|
"description": "GoodData SDK runtime for hosting pluggable applications — registry, loader, routing, platform context, default UI chrome",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData Corporation",
|
|
@@ -29,20 +29,20 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@module-federation/runtime": "2.6.0",
|
|
31
31
|
"lodash-es": "^4.17.23",
|
|
32
|
-
"@gooddata/sdk-backend-base": "11.61.0-alpha.
|
|
33
|
-
"@gooddata/sdk-backend-spi": "11.61.0-alpha.
|
|
34
|
-
"@gooddata/sdk-backend-tiger": "11.61.0-alpha.
|
|
35
|
-
"@gooddata/sdk-
|
|
36
|
-
"@gooddata/sdk-
|
|
37
|
-
"@gooddata/sdk-
|
|
38
|
-
"@gooddata/sdk-
|
|
39
|
-
"@gooddata/sdk-ui-
|
|
40
|
-
"@gooddata/sdk-ui-
|
|
41
|
-
"@gooddata/sdk-ui-
|
|
42
|
-
"@gooddata/sdk-ui-
|
|
43
|
-
"@gooddata/sdk-ui-
|
|
44
|
-
"@gooddata/sdk-ui-
|
|
45
|
-
"@gooddata/util": "11.61.0-alpha.
|
|
32
|
+
"@gooddata/sdk-backend-base": "11.61.0-alpha.3",
|
|
33
|
+
"@gooddata/sdk-backend-spi": "11.61.0-alpha.3",
|
|
34
|
+
"@gooddata/sdk-backend-tiger": "11.61.0-alpha.3",
|
|
35
|
+
"@gooddata/sdk-embedding": "11.61.0-alpha.3",
|
|
36
|
+
"@gooddata/sdk-model": "11.61.0-alpha.3",
|
|
37
|
+
"@gooddata/sdk-pluggable-application-model": "11.61.0-alpha.3",
|
|
38
|
+
"@gooddata/sdk-ui": "11.61.0-alpha.3",
|
|
39
|
+
"@gooddata/sdk-ui-ext": "11.61.0-alpha.3",
|
|
40
|
+
"@gooddata/sdk-ui-application-header": "11.61.0-alpha.3",
|
|
41
|
+
"@gooddata/sdk-ui-kit": "11.61.0-alpha.3",
|
|
42
|
+
"@gooddata/sdk-ui-gen-ai": "11.61.0-alpha.3",
|
|
43
|
+
"@gooddata/sdk-ui-theme-provider": "11.61.0-alpha.3",
|
|
44
|
+
"@gooddata/sdk-ui-semantic-search": "11.61.0-alpha.3",
|
|
45
|
+
"@gooddata/util": "11.61.0-alpha.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@microsoft/api-documenter": "7.30.16",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"vite": "8.0.16",
|
|
82
82
|
"vitest": "4.1.11",
|
|
83
83
|
"vitest-dom": "0.1.1",
|
|
84
|
-
"@gooddata/
|
|
85
|
-
"@gooddata/
|
|
84
|
+
"@gooddata/oxlint-config": "11.61.0-alpha.3",
|
|
85
|
+
"@gooddata/eslint-config": "11.61.0-alpha.3"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"react": ">=18.3.1",
|