@gooddata/sdk-ui-gen-ai 11.69.0-alpha.3 → 11.69.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +250 -51
- package/esm/components/GenAIChatOverlay.js +4 -4
- package/esm/components/Input.d.ts.map +1 -1
- package/esm/components/Input.js +1 -2
- package/esm/components/customized/LandingQuestion.js +1 -1
- package/esm/components/customized/MessageTextContent.js +1 -1
- package/esm/components/customized/types.d.ts +5 -0
- package/esm/components/customized/types.d.ts.map +1 -1
- package/esm/components/messages/ConversationItemContents.d.ts +1 -1
- package/esm/components/messages/ConversationItemContents.d.ts.map +1 -1
- package/esm/components/messages/ConversationItemContents.js +2 -2
- package/esm/components/messages/contents/Markdown.d.ts.map +1 -1
- package/esm/components/messages/contents/Markdown.js +22 -4
- package/esm/components/messages/conversationContents/ConversationVisualisation.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/ConversationVisualisation.js +19 -4
- package/esm/components/messages/conversationContents/ConversationVisualizationContent.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/ConversationVisualizationContent.js +12 -2
- package/esm/components/utils/animation.d.ts +3 -0
- package/esm/components/utils/animation.d.ts.map +1 -1
- package/esm/components/utils/animation.js +6 -56
- package/esm/components/utils/markdownUtils.js +2 -2
- package/esm/copilot/CopilotHandler.d.ts +1 -0
- package/esm/copilot/CopilotHandler.d.ts.map +1 -1
- package/esm/copilot/CopilotHandler.js +12 -2
- package/esm/copilot/useDashboardCopilot.d.ts +56 -0
- package/esm/copilot/useDashboardCopilot.d.ts.map +1 -0
- package/esm/copilot/useDashboardCopilot.js +268 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/sdk-ui-gen-ai.d.ts +59 -0
- package/package.json +22 -23
- package/styles/css/animation.css +3 -31
- package/styles/css/animation.css.map +1 -1
- package/styles/css/main.css +28 -50
- package/styles/css/main.css.map +1 -1
- package/styles/css/messages.css +1 -1
- package/styles/css/window.css +0 -6
- package/styles/css/window.css.map +1 -1
- package/styles/scss/animation.scss +3 -36
- package/styles/scss/messages.scss +1 -1
- package/styles/scss/window.scss +0 -8
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { anyDashboardEventHandler, changeDashboardDefinition, isDashboardCommandFailed, isDashboardCommandRejected, isDashboardDefinitionChanged, isDashboardDeinitialized, isDashboardSaved, selectDashboardId, selectDashboardLoading, selectIsInEditMode, } from "@gooddata/sdk-ui-dashboard";
|
|
4
|
+
import { makeUserItem } from "../model.js";
|
|
5
|
+
import { activateConversationAction, dashboardSavedAction, newMessageAction, startNewConversationAction, } from "../store/messages/messagesSlice.js";
|
|
6
|
+
import { CopilotHandler } from "./CopilotHandler.js";
|
|
7
|
+
import { selectCopilotReplyThreadId } from "./selectors.js";
|
|
8
|
+
import { CopilotBuildType } from "./types.js";
|
|
9
|
+
import { useCopilotSnapshot } from "./useCopilotSnapshot.js";
|
|
10
|
+
/**
|
|
11
|
+
* Connect a dashboard and assistant using one CopilotHandler and one outer GenAiStore.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Call once per dashboard/assistant pair. Call `dashboardProps`, `genAiStoreProps`, and `assistantProps` with optional
|
|
15
|
+
* application props, then spread their results onto the respective components. These getters compose
|
|
16
|
+
* event handlers and connection callbacks so application customizations do not replace internal wiring.
|
|
17
|
+
* Spread `composingProps` directly;
|
|
18
|
+
* keep the assistant beside the dashboard and wrap only the dashboard in the composing presentation.
|
|
19
|
+
* Definitions are applied only to an initialized dashboard in edit mode. To generate a new dashboard,
|
|
20
|
+
* mount an empty Dashboard in edit mode before calling `generateDashboard`; this hook does not navigate
|
|
21
|
+
* or replace an existing saved dashboard. Remount the pair when changing backend or workspace.
|
|
22
|
+
*
|
|
23
|
+
* @returns Component props and actions for the connected dashboard and assistant.
|
|
24
|
+
* @alpha
|
|
25
|
+
*/
|
|
26
|
+
export function useDashboardCopilot() {
|
|
27
|
+
const [dashboardSelector, setDashboardSelector] = useState(null);
|
|
28
|
+
const connection = useMemo(() => createDashboardConnection(setDashboardSelector), []);
|
|
29
|
+
const getDashboardEventHandlers = useMemo(() => createEventHandlersGetter(connection.dashboardProps.eventHandlers), [connection]);
|
|
30
|
+
const getChatEventHandlers = useMemo(() => createEventHandlersGetter(connection.genAiStoreProps.eventHandlers), [connection]);
|
|
31
|
+
const { copilot } = connection;
|
|
32
|
+
const snapshot = useCopilotSnapshot(copilot);
|
|
33
|
+
const scope = {
|
|
34
|
+
type: CopilotBuildType.Dashboard,
|
|
35
|
+
objectId: snapshot.context.objectId,
|
|
36
|
+
isEditing: snapshot.context.isEditing,
|
|
37
|
+
};
|
|
38
|
+
const status = copilot.getStatus(scope);
|
|
39
|
+
const genAiStoreProps = useCallback((props = {}) => ({
|
|
40
|
+
...props,
|
|
41
|
+
eventHandlers: getChatEventHandlers(props.eventHandlers),
|
|
42
|
+
onDispatcher: props.onDispatcher
|
|
43
|
+
? (dispatch) => {
|
|
44
|
+
connection.genAiStoreProps.onDispatcher(dispatch);
|
|
45
|
+
props.onDispatcher?.(dispatch);
|
|
46
|
+
}
|
|
47
|
+
: connection.genAiStoreProps.onDispatcher,
|
|
48
|
+
}), [connection, getChatEventHandlers]);
|
|
49
|
+
const dashboardProps = useCallback((props = {}) => ({
|
|
50
|
+
...props,
|
|
51
|
+
eventHandlers: getDashboardEventHandlers(props.eventHandlers),
|
|
52
|
+
onStateChange: props.onStateChange
|
|
53
|
+
? (state, dispatch) => {
|
|
54
|
+
connection.dashboardProps.onStateChange(state, dispatch);
|
|
55
|
+
props.onStateChange?.(state, dispatch);
|
|
56
|
+
}
|
|
57
|
+
: connection.dashboardProps.onStateChange,
|
|
58
|
+
config: { ...props.config, aiMode: status === "idle" ? undefined : status },
|
|
59
|
+
}), [connection, getDashboardEventHandlers, status]);
|
|
60
|
+
const assistantProps = useCallback((props = {}) => ({ ...props, dashboardSelector }), [dashboardSelector]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
connection.activate();
|
|
63
|
+
return connection.deactivate;
|
|
64
|
+
}, [connection]);
|
|
65
|
+
return {
|
|
66
|
+
copilot,
|
|
67
|
+
genAiStoreProps,
|
|
68
|
+
dashboardProps,
|
|
69
|
+
assistantProps,
|
|
70
|
+
composingProps: { copilot, scope, onReplyInChat: connection.replyInChat },
|
|
71
|
+
sendMessage: connection.sendMessage,
|
|
72
|
+
generateDashboard: connection.generateDashboard,
|
|
73
|
+
cancelGeneration: connection.cancelGeneration,
|
|
74
|
+
replyInChat: connection.replyInChat,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function createEventHandlersGetter(internalHandlers) {
|
|
78
|
+
const cache = new WeakMap();
|
|
79
|
+
return (handlers) => {
|
|
80
|
+
if (!handlers) {
|
|
81
|
+
return internalHandlers;
|
|
82
|
+
}
|
|
83
|
+
let combined = cache.get(handlers);
|
|
84
|
+
if (!combined) {
|
|
85
|
+
combined = [...internalHandlers, ...handlers];
|
|
86
|
+
cache.set(handlers, combined);
|
|
87
|
+
}
|
|
88
|
+
return combined;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function createDashboardConnection(onSelectorChange) {
|
|
92
|
+
const type = CopilotBuildType.Dashboard;
|
|
93
|
+
let active = true;
|
|
94
|
+
let dashboardDispatch;
|
|
95
|
+
let chatDispatch;
|
|
96
|
+
const applications = new Map();
|
|
97
|
+
const copilot = new CopilotHandler({
|
|
98
|
+
registrations: [
|
|
99
|
+
{
|
|
100
|
+
type,
|
|
101
|
+
skills: ["dashboard_builder", "dashboard_editor"],
|
|
102
|
+
resolveDefinition: (event, context, snapshot) => {
|
|
103
|
+
if (!dashboardDispatch ||
|
|
104
|
+
!context.isEditing ||
|
|
105
|
+
event.definitionType !== "dashboard" ||
|
|
106
|
+
!event.dashboard) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
const ownsGeneration = snapshot.requests.some((request) => !request.superseded &&
|
|
110
|
+
request.revision > (snapshot.generationRevision ?? 0) &&
|
|
111
|
+
request.conversationId === event.conversationId &&
|
|
112
|
+
(request.generation === type ||
|
|
113
|
+
(request.type === type && request.intent === "create")));
|
|
114
|
+
return event.dashboard.identifier === context.objectId || ownsGeneration
|
|
115
|
+
? { type, objectId: event.dashboard.identifier }
|
|
116
|
+
: undefined;
|
|
117
|
+
},
|
|
118
|
+
onApplyDefinition: (event, applicationId, target) => {
|
|
119
|
+
applications.set(applicationId, target);
|
|
120
|
+
try {
|
|
121
|
+
dashboardDispatch(changeDashboardDefinition(event.dashboard, { insights: event.insights ?? [] }, applicationId));
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
applications.delete(applicationId);
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
onClarificationQuestions: () => replyInChat(),
|
|
131
|
+
});
|
|
132
|
+
function interruptApplications() {
|
|
133
|
+
for (const id of applications.keys()) {
|
|
134
|
+
copilot.definitionApplicationInterrupted(id);
|
|
135
|
+
}
|
|
136
|
+
applications.clear();
|
|
137
|
+
}
|
|
138
|
+
function disconnectDashboard() {
|
|
139
|
+
dashboardDispatch = undefined;
|
|
140
|
+
interruptApplications();
|
|
141
|
+
copilot.resetInteraction();
|
|
142
|
+
copilot.cancelGeneration(type);
|
|
143
|
+
copilot.setContext({});
|
|
144
|
+
onSelectorChange(() => null);
|
|
145
|
+
}
|
|
146
|
+
function replyInChat() {
|
|
147
|
+
if (!active) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const snapshot = copilot.getSnapshot();
|
|
151
|
+
const conversationId = selectCopilotReplyThreadId(snapshot, { type, ...snapshot.context });
|
|
152
|
+
if (conversationId) {
|
|
153
|
+
chatDispatch?.(activateConversationAction({ conversationId }));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function sendMessage(message) {
|
|
157
|
+
if (active && message.trim()) {
|
|
158
|
+
chatDispatch?.(newMessageAction(makeUserItem({ type: "text", text: message })));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const chatEventHandler = {
|
|
162
|
+
eval: (event) => event !== undefined,
|
|
163
|
+
handler: (event) => {
|
|
164
|
+
if (active) {
|
|
165
|
+
copilot.handleEvent(event);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
return {
|
|
170
|
+
copilot,
|
|
171
|
+
genAiStoreProps: {
|
|
172
|
+
eventHandlers: [chatEventHandler],
|
|
173
|
+
onDispatcher: (dispatch) => {
|
|
174
|
+
chatDispatch = dispatch;
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
dashboardProps: {
|
|
178
|
+
onStateChange: (state, dispatch) => {
|
|
179
|
+
if (!active) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const loading = selectDashboardLoading(state);
|
|
183
|
+
if (loading.loading || !loading.result) {
|
|
184
|
+
if (dashboardDispatch) {
|
|
185
|
+
disconnectDashboard();
|
|
186
|
+
}
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (dashboardDispatch && dashboardDispatch !== dispatch) {
|
|
190
|
+
disconnectDashboard();
|
|
191
|
+
}
|
|
192
|
+
dashboardDispatch = dispatch;
|
|
193
|
+
const selector = (select) => select(state);
|
|
194
|
+
copilot.setContext({
|
|
195
|
+
type,
|
|
196
|
+
objectId: selectDashboardId(state),
|
|
197
|
+
isEditing: selectIsInEditMode(state),
|
|
198
|
+
});
|
|
199
|
+
onSelectorChange(() => selector);
|
|
200
|
+
},
|
|
201
|
+
eventHandlers: [
|
|
202
|
+
anyDashboardEventHandler((event) => {
|
|
203
|
+
if (!active) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (isDashboardDeinitialized(event)) {
|
|
207
|
+
disconnectDashboard();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const target = event.correlationId ? applications.get(event.correlationId) : undefined;
|
|
211
|
+
if (target && event.correlationId) {
|
|
212
|
+
if (isDashboardDefinitionChanged(event)) {
|
|
213
|
+
applications.delete(event.correlationId);
|
|
214
|
+
copilot.definitionApplied(event.correlationId, target);
|
|
215
|
+
}
|
|
216
|
+
else if (isDashboardCommandFailed(event) || isDashboardCommandRejected(event)) {
|
|
217
|
+
applications.delete(event.correlationId);
|
|
218
|
+
copilot.definitionApplicationInterrupted(event.correlationId);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (isDashboardSaved(event)) {
|
|
222
|
+
const { dashboard, originalDashboardId, savedInsights } = event.payload;
|
|
223
|
+
const source = copilot.getAppliedSource({
|
|
224
|
+
type,
|
|
225
|
+
objectId: originalDashboardId ?? dashboard.identifier,
|
|
226
|
+
});
|
|
227
|
+
if (source) {
|
|
228
|
+
chatDispatch?.(dashboardSavedAction({
|
|
229
|
+
conversationId: source.conversationId,
|
|
230
|
+
originalDashboardId: originalDashboardId ?? dashboard.identifier,
|
|
231
|
+
savedDashboardId: dashboard.identifier,
|
|
232
|
+
savedInsights: savedInsights ?? [],
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}),
|
|
237
|
+
],
|
|
238
|
+
},
|
|
239
|
+
sendMessage,
|
|
240
|
+
generateDashboard: (message) => {
|
|
241
|
+
if (!active || !chatDispatch || !dashboardDispatch || !message.trim()) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const { context } = copilot.getSnapshot();
|
|
245
|
+
if (!context.isEditing || context.objectId) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
copilot.startGeneration(type);
|
|
249
|
+
chatDispatch(startNewConversationAction());
|
|
250
|
+
sendMessage(message);
|
|
251
|
+
},
|
|
252
|
+
cancelGeneration: () => copilot.cancelGeneration(type),
|
|
253
|
+
replyInChat,
|
|
254
|
+
activate: () => {
|
|
255
|
+
active = true;
|
|
256
|
+
},
|
|
257
|
+
deactivate: () => {
|
|
258
|
+
active = false;
|
|
259
|
+
interruptApplications();
|
|
260
|
+
// React StrictMode replays effects before this microtask; do not dispose a reactivated instance.
|
|
261
|
+
queueMicrotask(() => {
|
|
262
|
+
if (!active) {
|
|
263
|
+
copilot.dispose();
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export { CopilotHandler, useCopilotSnapshot, createCopilotState, transitionCopilot, selectCopilotGenerationPending, selectCopilotStatus, selectCopilotReasoningTitle, selectCopilotSource, CopilotBuildType, type CopilotStatus, type CopilotInput, type ICopilotTarget, type ICopilotContext, type ICopilotScope, type ICopilotSource, type ICopilotApplicationSource, type ICopilotInteraction, type ICopilotRequest, type ICopilotApplication, type ICopilotSnapshot, type ICopilotRegistration, type ICopilotConfiguration, } from "./copilot.js";
|
|
7
7
|
export { CopilotInteractionComposing, type ICopilotInteractionComposingProps, } from "./copilot/CopilotInteractionComposing.js";
|
|
8
8
|
export { CopilotInteractionComposingWithHandler, type ICopilotInteractionComposingWithHandlerProps, } from "./copilot/CopilotInteractionComposingWithHandler.js";
|
|
9
|
+
export { useDashboardCopilot, type IUseDashboardCopilotResult } from "./copilot/useDashboardCopilot.js";
|
|
9
10
|
export { GenAIChat, GenAIAssistant, type GenAIChatProps, type GenAIAssistantProps, } from "./components/GenAIChat.js";
|
|
10
11
|
export { GenAIConversations, type GenAIConversationsProps } from "./components/GenAiConversations.js";
|
|
11
12
|
export { GenAiStore, type GenAiStoreProps } from "./components/GenAiStore.js";
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,OAAO,EACH,cAAc,EACd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AO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAClG,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
export { CopilotHandler, useCopilotSnapshot, createCopilotState, transitionCopilot, selectCopilotGenerationPending, selectCopilotStatus, selectCopilotReasoningTitle, selectCopilotSource, CopilotBuildType, } from "./copilot.js";
|
|
9
9
|
export { CopilotInteractionComposing, } from "./copilot/CopilotInteractionComposing.js";
|
|
10
10
|
export { CopilotInteractionComposingWithHandler, } from "./copilot/CopilotInteractionComposingWithHandler.js";
|
|
11
|
+
export { useDashboardCopilot } from "./copilot/useDashboardCopilot.js";
|
|
11
12
|
export { GenAIChat, GenAIAssistant, } from "./components/GenAIChat.js";
|
|
12
13
|
export { GenAIConversations } from "./components/GenAiConversations.js";
|
|
13
14
|
export { GenAiStore } from "./components/GenAiStore.js";
|
package/esm/sdk-ui-gen-ai.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { IChatSuggestion } from '@gooddata/sdk-backend-spi';
|
|
|
29
29
|
import { IChatSuggestions } from '@gooddata/sdk-backend-spi';
|
|
30
30
|
import { IColorPalette } from '@gooddata/sdk-model';
|
|
31
31
|
import { IDashboard } from '@gooddata/sdk-model';
|
|
32
|
+
import { IDashboardProps } from '@gooddata/sdk-ui-dashboard';
|
|
32
33
|
import { IExecutionConfig } from '@gooddata/sdk-model';
|
|
33
34
|
import { IGenAIUserContext } from '@gooddata/sdk-model';
|
|
34
35
|
import { IInsight } from '@gooddata/sdk-model';
|
|
@@ -529,6 +530,7 @@ export declare class CopilotHandler<TBuild extends string = CopilotBuildType> {
|
|
|
529
530
|
hasDefinition: (target: ICopilotTarget<TBuild>) => boolean;
|
|
530
531
|
/** Permanently stop processing and release all listeners. Idempotent. */
|
|
531
532
|
dispose: () => void;
|
|
533
|
+
private hasPendingClarification;
|
|
532
534
|
private shouldApplyDefinition;
|
|
533
535
|
private update;
|
|
534
536
|
}
|
|
@@ -1836,6 +1838,11 @@ export declare type IGenAIAssistantMessageTextContentProps = {
|
|
|
1836
1838
|
* The text to render.
|
|
1837
1839
|
*/
|
|
1838
1840
|
text: string;
|
|
1841
|
+
/**
|
|
1842
|
+
* Whether to render Markdown formatting. False for user messages, true for assistant messages.
|
|
1843
|
+
* Reference chips are rendered in both modes. Defaults to true.
|
|
1844
|
+
*/
|
|
1845
|
+
useMarkdown?: boolean;
|
|
1839
1846
|
/**
|
|
1840
1847
|
* The objects to render as links in the text.
|
|
1841
1848
|
*/
|
|
@@ -2291,6 +2298,40 @@ export declare const isChatUserMessageEvent: (event: ChatEvent) => event is Chat
|
|
|
2291
2298
|
*/
|
|
2292
2299
|
export declare const isChatVisualizationErrorEvent: (event: ChatEvent) => event is ChatVisualizationErrorEvent;
|
|
2293
2300
|
|
|
2301
|
+
/** Props and actions connecting one dashboard to a shared assistant store. @alpha */
|
|
2302
|
+
export declare interface IUseDashboardCopilotResult {
|
|
2303
|
+
/** Hook-owned workflow handler, also usable by custom progress presentations. */
|
|
2304
|
+
copilot: CopilotHandler;
|
|
2305
|
+
/**
|
|
2306
|
+
* Get props for the outer GenAiStore, not the nested assistant. Appends application event handlers
|
|
2307
|
+
* after internal handlers and calls the internal onDispatcher before the application callback.
|
|
2308
|
+
* Other props pass through unchanged. Call without arguments for the default connection.
|
|
2309
|
+
*/
|
|
2310
|
+
genAiStoreProps: (props?: Omit<GenAiStoreProps, "children">) => Omit<GenAiStoreProps, "children">;
|
|
2311
|
+
/**
|
|
2312
|
+
* Get props for Dashboard. Appends application event handlers after internal handlers and calls
|
|
2313
|
+
* the internal onStateChange before the application callback. Merges config while keeping aiMode
|
|
2314
|
+
* controlled by the copilot; other props pass through unchanged. Call without arguments for defaults.
|
|
2315
|
+
*/
|
|
2316
|
+
dashboardProps: (props?: IDashboardProps) => IDashboardProps;
|
|
2317
|
+
/**
|
|
2318
|
+
* Get props for the assistant inside the shared GenAiStore. Keeps dashboardSelector controlled by
|
|
2319
|
+
* the hook to maintain ambient context; other props pass through unchanged. Attach chat event
|
|
2320
|
+
* handlers to the outer store using genAiStoreProps. Call without arguments for defaults.
|
|
2321
|
+
*/
|
|
2322
|
+
assistantProps: (props?: GenAIAssistantProps) => GenAIAssistantProps;
|
|
2323
|
+
/** Pass to CopilotInteractionComposingWithHandler around the dashboard. */
|
|
2324
|
+
composingProps: Omit<ICopilotInteractionComposingWithHandlerProps, "children">;
|
|
2325
|
+
/** Send a message in the current conversation. Ignored until the shared store is ready. */
|
|
2326
|
+
sendMessage: (message: string) => void;
|
|
2327
|
+
/** Start a new conversation and generate into a new, empty dashboard in edit mode. */
|
|
2328
|
+
generateDashboard: (message: string) => void;
|
|
2329
|
+
/** Clear creation intent; this does not cancel an assistant response already streaming. */
|
|
2330
|
+
cancelGeneration: () => void;
|
|
2331
|
+
/** Select the waiting workflow's originating conversation in the shared assistant. */
|
|
2332
|
+
replyInChat: () => void;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2294
2335
|
/**
|
|
2295
2336
|
* A renderable what-if scenario with optional execution config overrides.
|
|
2296
2337
|
* @alpha
|
|
@@ -2551,6 +2592,24 @@ export declare function transitionCopilot<TBuild extends string = CopilotBuildTy
|
|
|
2551
2592
|
*/
|
|
2552
2593
|
export declare function useCopilotSnapshot<TBuild extends string = CopilotBuildType>(handler: CopilotHandler<TBuild>): ICopilotSnapshot<TBuild>;
|
|
2553
2594
|
|
|
2595
|
+
/**
|
|
2596
|
+
* Connect a dashboard and assistant using one CopilotHandler and one outer GenAiStore.
|
|
2597
|
+
*
|
|
2598
|
+
* @remarks
|
|
2599
|
+
* Call once per dashboard/assistant pair. Call `dashboardProps`, `genAiStoreProps`, and `assistantProps` with optional
|
|
2600
|
+
* application props, then spread their results onto the respective components. These getters compose
|
|
2601
|
+
* event handlers and connection callbacks so application customizations do not replace internal wiring.
|
|
2602
|
+
* Spread `composingProps` directly;
|
|
2603
|
+
* keep the assistant beside the dashboard and wrap only the dashboard in the composing presentation.
|
|
2604
|
+
* Definitions are applied only to an initialized dashboard in edit mode. To generate a new dashboard,
|
|
2605
|
+
* mount an empty Dashboard in edit mode before calling `generateDashboard`; this hook does not navigate
|
|
2606
|
+
* or replace an existing saved dashboard. Remount the pair when changing backend or workspace.
|
|
2607
|
+
*
|
|
2608
|
+
* @returns Component props and actions for the connected dashboard and assistant.
|
|
2609
|
+
* @alpha
|
|
2610
|
+
*/
|
|
2611
|
+
export declare function useDashboardCopilot(): IUseDashboardCopilotResult;
|
|
2612
|
+
|
|
2554
2613
|
/**
|
|
2555
2614
|
* @internal
|
|
2556
2615
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-gen-ai",
|
|
3
|
-
"version": "11.69.0-alpha.
|
|
3
|
+
"version": "11.69.0-alpha.5",
|
|
4
4
|
"description": "GoodData GenAI SDK",
|
|
5
5
|
"license": "LicenseRef-LICENSE",
|
|
6
6
|
"author": "GoodData Corporation",
|
|
@@ -57,21 +57,21 @@
|
|
|
57
57
|
"reselect": "5.1.1",
|
|
58
58
|
"tslib": "2.8.1",
|
|
59
59
|
"uuid": "11.1.1",
|
|
60
|
-
"@gooddata/api-client-tiger": "11.69.0-alpha.
|
|
61
|
-
"@gooddata/sdk-backend-spi": "11.69.0-alpha.
|
|
62
|
-
"@gooddata/sdk-
|
|
63
|
-
"@gooddata/sdk-
|
|
64
|
-
"@gooddata/sdk-ui": "11.69.0-alpha.
|
|
65
|
-
"@gooddata/sdk-
|
|
66
|
-
"@gooddata/sdk-ui-dashboard": "11.69.0-alpha.
|
|
67
|
-
"@gooddata/sdk-ui-ext": "11.69.0-alpha.
|
|
68
|
-
"@gooddata/sdk-ui-filters": "11.69.0-alpha.
|
|
69
|
-
"@gooddata/sdk-ui-geo": "11.69.0-alpha.
|
|
70
|
-
"@gooddata/sdk-ui-kit": "11.69.0-alpha.
|
|
71
|
-
"@gooddata/sdk-ui-pivot": "11.69.0-alpha.
|
|
72
|
-
"@gooddata/sdk-ui-semantic-search": "11.69.0-alpha.
|
|
73
|
-
"@gooddata/sdk-ui-theme-provider": "11.69.0-alpha.
|
|
74
|
-
"@gooddata/util": "11.69.0-alpha.
|
|
60
|
+
"@gooddata/api-client-tiger": "11.69.0-alpha.5",
|
|
61
|
+
"@gooddata/sdk-backend-spi": "11.69.0-alpha.5",
|
|
62
|
+
"@gooddata/sdk-model": "11.69.0-alpha.5",
|
|
63
|
+
"@gooddata/sdk-ui": "11.69.0-alpha.5",
|
|
64
|
+
"@gooddata/sdk-ui-charts": "11.69.0-alpha.5",
|
|
65
|
+
"@gooddata/sdk-pluggable-application-model": "11.69.0-alpha.5",
|
|
66
|
+
"@gooddata/sdk-ui-dashboard": "11.69.0-alpha.5",
|
|
67
|
+
"@gooddata/sdk-ui-ext": "11.69.0-alpha.5",
|
|
68
|
+
"@gooddata/sdk-ui-filters": "11.69.0-alpha.5",
|
|
69
|
+
"@gooddata/sdk-ui-geo": "11.69.0-alpha.5",
|
|
70
|
+
"@gooddata/sdk-ui-kit": "11.69.0-alpha.5",
|
|
71
|
+
"@gooddata/sdk-ui-pivot": "11.69.0-alpha.5",
|
|
72
|
+
"@gooddata/sdk-ui-semantic-search": "11.69.0-alpha.5",
|
|
73
|
+
"@gooddata/sdk-ui-theme-provider": "11.69.0-alpha.5",
|
|
74
|
+
"@gooddata/util": "11.69.0-alpha.5"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@microsoft/api-documenter": "7.30.20",
|
|
@@ -91,7 +91,6 @@
|
|
|
91
91
|
"eslint": "^10.14.0",
|
|
92
92
|
"eslint-plugin-headers": "1.3.3",
|
|
93
93
|
"eslint-plugin-import-esm": "3.0.1",
|
|
94
|
-
"eslint-plugin-jsdoc": "65.4.2",
|
|
95
94
|
"eslint-plugin-no-barrel-files": "1.2.2",
|
|
96
95
|
"eslint-plugin-no-only-tests": "3.3.0",
|
|
97
96
|
"eslint-plugin-regexp": "3.3.3",
|
|
@@ -111,12 +110,12 @@
|
|
|
111
110
|
"svgo": "2.8.4",
|
|
112
111
|
"typescript": "7.0.2",
|
|
113
112
|
"vitest": "5.0.4",
|
|
114
|
-
"@gooddata/
|
|
115
|
-
"@gooddata/
|
|
116
|
-
"@gooddata/oxlint-config": "11.69.0-alpha.
|
|
117
|
-
"@gooddata/reference-workspace": "11.69.0-alpha.
|
|
118
|
-
"@gooddata/sdk-backend-mockingbird": "11.69.0-alpha.
|
|
119
|
-
"@gooddata/stylelint-config": "11.69.0-alpha.
|
|
113
|
+
"@gooddata/eslint-config": "11.69.0-alpha.5",
|
|
114
|
+
"@gooddata/i18n-toolkit": "11.69.0-alpha.5",
|
|
115
|
+
"@gooddata/oxlint-config": "11.69.0-alpha.5",
|
|
116
|
+
"@gooddata/reference-workspace": "11.69.0-alpha.5",
|
|
117
|
+
"@gooddata/sdk-backend-mockingbird": "11.69.0-alpha.5",
|
|
118
|
+
"@gooddata/stylelint-config": "11.69.0-alpha.5"
|
|
120
119
|
},
|
|
121
120
|
"peerDependencies": {
|
|
122
121
|
"react": "^18.0.0 || ^19.0.0",
|
package/styles/css/animation.css
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
@keyframes ai-flip-y {
|
|
2
|
-
0% {
|
|
3
|
-
transform: rotateY(0deg);
|
|
4
|
-
animation-timing-function: cubic-bezier(0.55, 0, 0.2, 1);
|
|
5
|
-
}
|
|
6
|
-
14% {
|
|
7
|
-
transform: rotateY(180deg);
|
|
8
|
-
}
|
|
9
|
-
100% {
|
|
10
|
-
transform: rotateY(180deg);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
1
|
@keyframes gd-gen-ai-heading-old {
|
|
14
2
|
0% {
|
|
15
3
|
opacity: 1;
|
|
@@ -31,26 +19,10 @@
|
|
|
31
19
|
}
|
|
32
20
|
}
|
|
33
21
|
.gd-gen-ai-chat__animations--loader {
|
|
34
|
-
|
|
22
|
+
display: flex;
|
|
35
23
|
flex-shrink: 0;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
position: absolute;
|
|
39
|
-
left: 50%;
|
|
40
|
-
top: 50%;
|
|
41
|
-
transform: translate(-50%, -50%);
|
|
42
|
-
}
|
|
43
|
-
.gd-gen-ai-chat__animations--loader--flip {
|
|
44
|
-
transform-origin: center center;
|
|
45
|
-
animation: ai-flip-y 4s linear infinite;
|
|
46
|
-
}
|
|
47
|
-
.gd-gen-ai-chat__animations--loader--svg {
|
|
48
|
-
display: block;
|
|
49
|
-
}
|
|
50
|
-
.gd-gen-ai-chat__animations--loader--sparkle {
|
|
51
|
-
position: absolute;
|
|
52
|
-
transform-origin: center center;
|
|
53
|
-
transform: translate(-50%, -50%);
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
54
26
|
}
|
|
55
27
|
|
|
56
28
|
.gd-gen-ai-chat__animations--headings {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../scss/animation.scss"],"names":[],"mappings":"AAAA;EACI;IACI;IACA;;EAEJ;IACI
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../scss/animation.scss"],"names":[],"mappings":"AAAA;EACI;IACI;IACA;;EAEJ;IACI;IACA;;;AAIR;EACI;IACI;IACA;;EAEJ;IACI;IACA;;;AAIR;EACI;EACA;EACA;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;;AAGJ;EACI","file":"animation.css"}
|