@gooddata/sdk-ui-gen-ai 11.67.0-alpha.2 → 11.67.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +798 -2473
- package/README.md +58 -1
- package/esm/components/ConfigContext.d.ts +3 -1
- package/esm/components/ConfigContext.d.ts.map +1 -1
- package/esm/components/ConfigContext.js +14 -2
- package/esm/components/GenAIChat.d.ts +5 -0
- package/esm/components/GenAIChat.d.ts.map +1 -1
- package/esm/components/GenAIChat.js +2 -1
- package/esm/components/GenAIChatDialog.d.ts +2 -1
- package/esm/components/GenAIChatDialog.d.ts.map +1 -1
- package/esm/components/GenAIChatDialog.js +4 -4
- package/esm/components/GenAIChatDialogConnected.d.ts +6 -8
- package/esm/components/GenAIChatDialogConnected.d.ts.map +1 -1
- package/esm/components/GenAIChatDialogConnected.js +5 -6
- package/esm/components/GenAIChatWrapper.js +1 -1
- package/esm/components/GenAIStandaloneInput.d.ts +6 -1
- package/esm/components/GenAIStandaloneInput.d.ts.map +1 -1
- package/esm/components/GenAIStandaloneInput.js +2 -2
- package/esm/components/GenAiConversations.js +1 -1
- package/esm/components/Input.d.ts.map +1 -1
- package/esm/components/Input.js +3 -1
- package/esm/components/customized/types.d.ts +22 -0
- package/esm/components/customized/types.d.ts.map +1 -1
- package/esm/components/hooks/useAppEventSync.d.ts +18 -0
- package/esm/components/hooks/useAppEventSync.d.ts.map +1 -0
- package/esm/components/hooks/useAppEventSync.js +35 -0
- package/esm/components/hooks/useSettingsClick.d.ts +1 -2
- package/esm/components/hooks/useSettingsClick.d.ts.map +1 -1
- package/esm/components/hooks/useSettingsClick.js +7 -20
- package/esm/components/intelligence/data/constants.d.ts +1 -1
- package/esm/components/intelligence/data/constants.js +1 -1
- package/esm/components/intelligence/detail/IntelligenceStepCarousel.d.ts +1 -1
- package/esm/components/intelligence/detail/IntelligenceStepCarousel.js +1 -1
- package/esm/components/intelligence/panel/IntelligenceDurationTokens.d.ts +1 -1
- package/esm/components/intelligence/panel/IntelligenceDurationTokens.js +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 +10 -1
- package/esm/components/messages/ItemsGroup.d.ts.map +1 -1
- package/esm/components/messages/ItemsGroup.js +4 -11
- package/esm/components/messages/contents/CustomHyperlink.js +2 -2
- package/esm/components/messages/conversationContents/ConversationErrorContent.d.ts.map +1 -1
- package/esm/components/messages/conversationContents/ConversationErrorContent.js +1 -4
- package/esm/components/messages/conversationContents/ConversationPublisherDocumentContent.js +2 -2
- package/esm/components/messages/conversationContents/utils/errors.d.ts +4 -4
- package/esm/components/messages/conversationContents/utils/errors.js +4 -4
- package/esm/components/utils/groupUtility.d.ts +1 -0
- package/esm/components/utils/groupUtility.d.ts.map +1 -1
- package/esm/components/utils/groupUtility.js +11 -0
- package/esm/copilot/CopilotComposingOverlay.d.ts +4 -0
- package/esm/copilot/CopilotComposingOverlay.d.ts.map +1 -0
- package/esm/copilot/CopilotComposingOverlay.js +151 -0
- package/esm/copilot/CopilotInteractionComposing.d.ts +29 -0
- package/esm/copilot/CopilotInteractionComposing.d.ts.map +1 -0
- package/esm/copilot/CopilotInteractionComposing.js +39 -0
- package/esm/copilot/CopilotInteractionComposingWithHandler.d.ts +15 -0
- package/esm/copilot/CopilotInteractionComposingWithHandler.d.ts.map +1 -0
- package/esm/copilot/CopilotInteractionComposingWithHandler.js +11 -0
- package/esm/copilot/selectors.d.ts +4 -2
- package/esm/copilot/selectors.d.ts.map +1 -1
- package/esm/copilot/selectors.js +73 -14
- package/esm/copilot/transitions.d.ts.map +1 -1
- package/esm/copilot/transitions.js +264 -81
- package/esm/copilot/types.d.ts +10 -4
- package/esm/copilot/types.d.ts.map +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -0
- package/esm/internal.d.ts +1 -2
- package/esm/internal.d.ts.map +1 -1
- package/esm/localization/bundles/de-DE.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/de-DE.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/de-DE.localization-bundle.js +4 -2
- package/esm/localization/bundles/en-AU.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/en-AU.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-AU.localization-bundle.js +4 -2
- package/esm/localization/bundles/en-GB.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/en-GB.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-GB.localization-bundle.js +4 -2
- package/esm/localization/bundles/en-US.localization-bundle.d.ts +8 -0
- package/esm/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-US.localization-bundle.js +12 -4
- package/esm/localization/bundles/es-419.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/es-419.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/es-419.localization-bundle.js +4 -2
- package/esm/localization/bundles/es-ES.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/es-ES.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/es-ES.localization-bundle.js +4 -2
- package/esm/localization/bundles/fi-FI.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/fi-FI.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/fi-FI.localization-bundle.js +4 -2
- package/esm/localization/bundles/fr-CA.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/fr-CA.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/fr-CA.localization-bundle.js +4 -2
- package/esm/localization/bundles/fr-FR.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/fr-FR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/fr-FR.localization-bundle.js +4 -2
- package/esm/localization/bundles/id-ID.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/id-ID.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/id-ID.localization-bundle.js +4 -2
- package/esm/localization/bundles/it-IT.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/it-IT.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/it-IT.localization-bundle.js +4 -2
- package/esm/localization/bundles/ja-JP.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/ja-JP.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/ja-JP.localization-bundle.js +4 -2
- package/esm/localization/bundles/ko-KR.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/ko-KR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/ko-KR.localization-bundle.js +4 -2
- package/esm/localization/bundles/nl-NL.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/nl-NL.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/nl-NL.localization-bundle.js +4 -2
- package/esm/localization/bundles/pl-PL.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/pl-PL.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/pl-PL.localization-bundle.js +4 -2
- package/esm/localization/bundles/pt-BR.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/pt-BR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/pt-BR.localization-bundle.js +4 -2
- package/esm/localization/bundles/pt-PT.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/pt-PT.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/pt-PT.localization-bundle.js +4 -2
- package/esm/localization/bundles/ru-RU.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/ru-RU.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/ru-RU.localization-bundle.js +4 -2
- package/esm/localization/bundles/sl-SI.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/sl-SI.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/sl-SI.localization-bundle.js +4 -2
- package/esm/localization/bundles/th-TH.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/th-TH.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/th-TH.localization-bundle.js +4 -2
- package/esm/localization/bundles/tr-TR.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/tr-TR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/tr-TR.localization-bundle.js +4 -2
- package/esm/localization/bundles/uk-UA.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/uk-UA.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/uk-UA.localization-bundle.js +4 -2
- package/esm/localization/bundles/vi-VN.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/vi-VN.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/vi-VN.localization-bundle.js +4 -2
- package/esm/localization/bundles/zh-HK.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/zh-HK.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/zh-HK.localization-bundle.js +4 -2
- package/esm/localization/bundles/zh-Hans.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/zh-Hans.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/zh-Hans.localization-bundle.js +4 -2
- package/esm/localization/bundles/zh-Hant.localization-bundle.d.ts +2 -0
- package/esm/localization/bundles/zh-Hant.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/zh-Hant.localization-bundle.js +4 -2
- package/esm/sdk-ui-gen-ai.d.ts +85 -51
- package/esm/store/events.d.ts +6 -45
- package/esm/store/events.d.ts.map +1 -1
- package/esm/store/messages/messagesSlice.d.ts.map +1 -1
- package/esm/store/messages/messagesSlice.js +2 -0
- package/esm/store/sideEffects/onEvent.d.ts +11 -3
- package/esm/store/sideEffects/onEvent.d.ts.map +1 -1
- package/esm/store/sideEffects/onEvent.js +32 -25
- package/esm/utils.d.ts +0 -4
- package/esm/utils.d.ts.map +1 -1
- package/esm/utils.js +3 -23
- package/package.json +28 -29
- package/styles/css/copilotInteractionComposing.css +94 -0
- package/styles/css/copilotInteractionComposing.css.map +1 -0
- package/styles/css/input.css +4 -4
- package/styles/css/main.css +97 -4
- package/styles/css/main.css.map +1 -1
- package/styles/scss/copilotInteractionComposing.scss +106 -0
- package/styles/scss/input.scss +1 -1
- package/styles/scss/main.scss +1 -0
- package/esm/components/hooks/useDashboardSavedSync.d.ts +0 -13
- package/esm/components/hooks/useDashboardSavedSync.d.ts.map +0 -1
- package/esm/components/hooks/useDashboardSavedSync.js +0 -14
- package/esm/components/hooks/usePublisherDocumentSavedSync.d.ts +0 -20
- package/esm/components/hooks/usePublisherDocumentSavedSync.d.ts.map +0 -1
- package/esm/components/hooks/usePublisherDocumentSavedSync.js +0 -18
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { useWorkspaceStrict } from "@gooddata/sdk-ui";
|
|
4
|
-
import {
|
|
4
|
+
import { getAbsoluteShellAppOrgSettingHref, getAbsoluteShellAppWorkspaceSettingHref, getShellAppOrgSettingHref, getShellAppWorkspaceSettingHref, } from "../../utils.js";
|
|
5
5
|
import { useConfig } from "../ConfigContext.js";
|
|
6
6
|
const GEN_AI_SECTION = "ai";
|
|
7
7
|
const CREATE_LLM_PROVIDER_ACTION = "create-llm-provider";
|
|
8
8
|
const CHANGE_LLM_MODEL_ACTION = "change-llm-model";
|
|
9
|
-
export function useSettingsClick(
|
|
9
|
+
export function useSettingsClick() {
|
|
10
10
|
const workspaceId = useWorkspaceStrict();
|
|
11
11
|
const { linkHandler, allowNativeLinks } = useConfig();
|
|
12
|
-
// When the shell host is enabled, the standalone home-ui at `/settings` or
|
|
13
|
-
// `/workspaces/{id}/settings` is bounced to the host base path, dropping the
|
|
14
|
-
// workspaceId and hash. Switch to host-shaped URLs so the deep-link
|
|
15
|
-
// (e.g. `#/ai/change-llm-model`) reaches the settings page intact.
|
|
16
|
-
const useShellAppUrls = Boolean(settings?.enableShellApplication);
|
|
17
12
|
return useCallback((type) => (e) => {
|
|
18
13
|
switch (type) {
|
|
19
14
|
case "change-model":
|
|
20
15
|
if (allowNativeLinks) {
|
|
21
|
-
window.location.href =
|
|
22
|
-
? getAbsoluteShellAppWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION)
|
|
23
|
-
: getAbsoluteWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION);
|
|
16
|
+
window.location.href = getAbsoluteShellAppWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION);
|
|
24
17
|
}
|
|
25
18
|
else {
|
|
26
19
|
linkHandler?.({
|
|
@@ -31,18 +24,14 @@ export function useSettingsClick(settings) {
|
|
|
31
24
|
newTab: e.metaKey,
|
|
32
25
|
section: GEN_AI_SECTION,
|
|
33
26
|
preventDefault: e.preventDefault.bind(e),
|
|
34
|
-
itemUrl:
|
|
35
|
-
? getShellAppWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION)
|
|
36
|
-
: getWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION),
|
|
27
|
+
itemUrl: getShellAppWorkspaceSettingHref(workspaceId, GEN_AI_SECTION, CHANGE_LLM_MODEL_ACTION),
|
|
37
28
|
});
|
|
38
29
|
e.stopPropagation();
|
|
39
30
|
}
|
|
40
31
|
break;
|
|
41
32
|
case "create":
|
|
42
33
|
if (allowNativeLinks) {
|
|
43
|
-
window.location.href =
|
|
44
|
-
? getAbsoluteShellAppOrgSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION)
|
|
45
|
-
: getAbsoluteSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION);
|
|
34
|
+
window.location.href = getAbsoluteShellAppOrgSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION);
|
|
46
35
|
}
|
|
47
36
|
else {
|
|
48
37
|
linkHandler?.({
|
|
@@ -53,13 +42,11 @@ export function useSettingsClick(settings) {
|
|
|
53
42
|
newTab: e.metaKey,
|
|
54
43
|
section: GEN_AI_SECTION,
|
|
55
44
|
preventDefault: e.preventDefault.bind(e),
|
|
56
|
-
itemUrl:
|
|
57
|
-
? getShellAppOrgSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION)
|
|
58
|
-
: getSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION),
|
|
45
|
+
itemUrl: getShellAppOrgSettingHref(GEN_AI_SECTION, CREATE_LLM_PROVIDER_ACTION),
|
|
59
46
|
});
|
|
60
47
|
e.stopPropagation();
|
|
61
48
|
}
|
|
62
49
|
break;
|
|
63
50
|
}
|
|
64
|
-
}, [allowNativeLinks, linkHandler, workspaceId
|
|
51
|
+
}, [allowNativeLinks, linkHandler, workspaceId]);
|
|
65
52
|
}
|
|
@@ -12,7 +12,7 @@ export declare const DEFAULT_STEP_ICON: IconType;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const MAX_DETAIL_LIST_ITEMS = 5;
|
|
14
14
|
/**
|
|
15
|
-
* Category
|
|
15
|
+
* Category -\> icon mapping. Typed by {@link GenAIInteractionStepCategory}, so adding a category to
|
|
16
16
|
* the backend's vocabulary fails to compile until its icon is chosen here. A category still
|
|
17
17
|
* missing at runtime (an older client meeting a newer backend) falls back to
|
|
18
18
|
* {@link DEFAULT_STEP_ICON}.
|
|
@@ -11,7 +11,7 @@ export const DEFAULT_STEP_ICON = "questionMark";
|
|
|
11
11
|
*/
|
|
12
12
|
export const MAX_DETAIL_LIST_ITEMS = 5;
|
|
13
13
|
/**
|
|
14
|
-
* Category
|
|
14
|
+
* Category -\> icon mapping. Typed by {@link GenAIInteractionStepCategory}, so adding a category to
|
|
15
15
|
* the backend's vocabulary fails to compile until its icon is chosen here. A category still
|
|
16
16
|
* missing at runtime (an older client meeting a newer backend) falls back to
|
|
17
17
|
* {@link DEFAULT_STEP_ICON}.
|
|
@@ -5,7 +5,7 @@ export interface IIntelligenceStepCarouselProps {
|
|
|
5
5
|
onSelectCategory: (index: number) => void;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* The detail view's footer pager, e.g. "
|
|
8
|
+
* The detail view's footer pager, e.g. "\< 2 of 7 \>", for moving between categories without
|
|
9
9
|
* returning to the list. The current position is shown in bold.
|
|
10
10
|
*/
|
|
11
11
|
export declare function IntelligenceStepCarousel({ currentIndex, totalCount, onSelectCategory, }: IIntelligenceStepCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { FormattedMessage, useIntl } from "react-intl";
|
|
|
4
4
|
import { UiPaginationButton } from "@gooddata/sdk-ui-kit";
|
|
5
5
|
import { e } from "../intelligenceBem.js";
|
|
6
6
|
/**
|
|
7
|
-
* The detail view's footer pager, e.g. "
|
|
7
|
+
* The detail view's footer pager, e.g. "\< 2 of 7 \>", for moving between categories without
|
|
8
8
|
* returning to the list. The current position is shown in bold.
|
|
9
9
|
*/
|
|
10
10
|
export function IntelligenceStepCarousel({ currentIndex, totalCount, onSelectCategory, }) {
|
|
@@ -5,7 +5,7 @@ export interface IIntelligenceDurationTokensProps {
|
|
|
5
5
|
showSlash?: boolean;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* The
|
|
8
|
+
* The `{duration} / {tokens}` fragment shown by the inline Interaction Intelligence trigger,
|
|
9
9
|
* omitting the tokens segment when `tokens` is unknown.
|
|
10
10
|
*/
|
|
11
11
|
export declare function IntelligenceDurationTokens({ totals, showSlash }: IIntelligenceDurationTokensProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { formatDuration } from "../format/formatDuration.js";
|
|
|
5
5
|
import { formatTokens } from "../format/formatTokens.js";
|
|
6
6
|
import { e } from "../intelligenceBem.js";
|
|
7
7
|
/**
|
|
8
|
-
* The
|
|
8
|
+
* The `{duration} / {tokens}` fragment shown by the inline Interaction Intelligence trigger,
|
|
9
9
|
* omitting the tokens segment when `tokens` is unknown.
|
|
10
10
|
*/
|
|
11
11
|
export function IntelligenceDurationTokens({ totals, showSlash = true }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IChatConversationLocalItem, type TextContentObject } from "../../model.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type IChatMessagesGroup } from "../utils/groupUtility.js";
|
|
3
3
|
type ConversationItemContentsProps = {
|
|
4
4
|
message: IChatConversationLocalItem;
|
|
5
5
|
groups: IChatMessagesGroup[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationItemContents.d.ts","sourceRoot":"","sources":["../../../src/components/messages/ConversationItemContents.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConversationItemContents.d.ts","sourceRoot":"","sources":["../../../src/components/messages/ConversationItemContents.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGH,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACzB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,0BAA0B,CAAC;AAO3F,KAAK,6BAA6B,GAAG;IACjC,OAAO,EAAE,0BAA0B,CAAC;IACpC,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EACrC,OAAO,EACP,MAAM,EACN,UAAU,EACV,SAAS,EACT,MAAM,GACT,EAAE,6BAA6B,kDAuF/B"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2024-2026 GoodData Corporation
|
|
3
|
+
import { useSelector } from "react-redux";
|
|
4
|
+
import { agentsSelector } from "../../store/messages/messagesSelectors.js";
|
|
2
5
|
import { useCustomization } from "../CustomizationContext.js";
|
|
6
|
+
import { getReasoningDurationMs } from "../utils/groupUtility.js";
|
|
3
7
|
import { ConversationClarifyingAnswersContent } from "./conversationContents/ConversationClarifyingAnswersContent.js";
|
|
4
8
|
import { ConversationSkillActivatedContent } from "./conversationContents/ConversationSkillActivatedContent.js";
|
|
5
9
|
import { ConversationToolCallContent } from "./conversationContents/ConversationToolCallContent.js";
|
|
6
10
|
import { ConversationToolResultContent } from "./conversationContents/ConversationToolResultContent.js";
|
|
7
11
|
export function ConversationItemContents({ message, groups, references, isLoading, isLast, }) {
|
|
8
12
|
const { MessageTextContentComponent, MessageErrorContentComponent, MessageReasoningContentComponent, MessageMultipartContentComponent, } = useCustomization();
|
|
13
|
+
const agents = useSelector(agentsSelector);
|
|
9
14
|
const content = message.content;
|
|
10
15
|
if (content.type === "error") {
|
|
11
16
|
return _jsx(MessageErrorContentComponent, { ...content, isLoading: isLoading });
|
|
@@ -14,7 +19,11 @@ export function ConversationItemContents({ message, groups, references, isLoadin
|
|
|
14
19
|
return (_jsx(MessageTextContentComponent, { text: content.text, objects: [...(content.objects ?? []), ...references], isLoading: isLoading }));
|
|
15
20
|
}
|
|
16
21
|
if (content.type === "reasoning") {
|
|
17
|
-
|
|
22
|
+
const groupIndex = groups.findIndex((group) => group.messages.some((m) => m.localId === message.localId));
|
|
23
|
+
const durationMs = getReasoningDurationMs(groups[groupIndex - 1], groups[groupIndex]);
|
|
24
|
+
const foundAgent = agents?.find((a) => a.id === message.agentId);
|
|
25
|
+
const agent = message.agentId ? { id: message.agentId, name: foundAgent?.title } : undefined;
|
|
26
|
+
return (_jsx(MessageReasoningContentComponent, { summary: content.summary, objects: [...(content.objects ?? []), ...references], durationMs: durationMs, agent: agent, isLoading: isLoading }));
|
|
18
27
|
}
|
|
19
28
|
if (content.type === "multipart") {
|
|
20
29
|
return (_jsx(MessageMultipartContentComponent, { message: message, parts: content.parts ?? [], references: references, isLast: isLast }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemsGroup.d.ts","sourceRoot":"","sources":["../../../src/components/messages/ItemsGroup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAG1D,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,YAAY,CAAC;AAKrE,OAAO,EAAE,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ItemsGroup.d.ts","sourceRoot":"","sources":["../../../src/components/messages/ItemsGroup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAG1D,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,YAAY,CAAC;AAKrE,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,0BAA0B,CAAC;AAG3F,UAAU,gBAAgB;IACtB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAsB9E;AAuID,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAqBlE"}
|
|
@@ -5,6 +5,7 @@ import cx from "classnames";
|
|
|
5
5
|
import { defineMessages, useIntl } from "react-intl";
|
|
6
6
|
import { UiButton } from "@gooddata/sdk-ui-kit";
|
|
7
7
|
import { AIThinkingLoader, AIThinkingSummary } from "../utils/animation.js";
|
|
8
|
+
import { getReasoningDurationMs } from "../utils/groupUtility.js";
|
|
8
9
|
import { extractHeading } from "../utils/markdownUtils.js";
|
|
9
10
|
export function ItemsGroup({ group, previousGroup, children }) {
|
|
10
11
|
const classNames = cx("gd-gen-ai-chat__messages__conversation-group", {
|
|
@@ -70,17 +71,9 @@ function useReasoningGroup(previousGroup, group) {
|
|
|
70
71
|
return headings;
|
|
71
72
|
}, [group.messages, intl]);
|
|
72
73
|
const duration = useMemo(() => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const previousLastMessage = previousGroup.messages[previousGroup.messages.length - 1];
|
|
77
|
-
const lastMessage = group.messages[group.messages.length - 1];
|
|
78
|
-
if (!previousLastMessage || !lastMessage) {
|
|
79
|
-
return undefined;
|
|
80
|
-
}
|
|
81
|
-
const duration = Math.abs(lastMessage.createdAt - previousLastMessage.createdAt);
|
|
82
|
-
return formatDuration(intl, duration);
|
|
83
|
-
}, [group.messages, intl, previousGroup]);
|
|
74
|
+
const durationMs = getReasoningDurationMs(previousGroup, group);
|
|
75
|
+
return durationMs === undefined ? undefined : formatDuration(intl, durationMs);
|
|
76
|
+
}, [group, intl, previousGroup]);
|
|
84
77
|
return {
|
|
85
78
|
headings,
|
|
86
79
|
duration,
|
|
@@ -11,7 +11,7 @@ import { removeMarkdown } from "../../utils/markdownUtils.js";
|
|
|
11
11
|
* used for links management
|
|
12
12
|
*/
|
|
13
13
|
export function CustomHyperlinkComponent({ href, text, conversation }) {
|
|
14
|
-
const { linkHandler, allowNativeLinks, canManage, canAnalyze } = useConfig();
|
|
14
|
+
const { linkHandler, allowNativeLinks, canManage, canAnalyze, canCreateDocument } = useConfig();
|
|
15
15
|
const canManageMetrics = canManage || canAnalyze;
|
|
16
16
|
const canManageVisualisations = canManage || canAnalyze;
|
|
17
17
|
const plainText = removeMarkdown(text);
|
|
@@ -75,7 +75,7 @@ export function CustomHyperlinkComponent({ href, text, conversation }) {
|
|
|
75
75
|
if (parsedRef.type === "visualization" && !canManageVisualisations) {
|
|
76
76
|
return plainText;
|
|
77
77
|
}
|
|
78
|
-
if (parsedRef.type === "report" && !
|
|
78
|
+
if (parsedRef.type === "report" && !canCreateDocument) {
|
|
79
79
|
return plainText;
|
|
80
80
|
}
|
|
81
81
|
if (allowNativeLinks) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationErrorContent.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/conversationContents/ConversationErrorContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConversationErrorContent.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/conversationContents/ConversationErrorContent.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAIvE,MAAM,MAAM,6BAA6B,GAAG;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EACrC,IAAI,EACJ,OAAO,EACP,OAAO,EACP,WAAmB,EACnB,SAAS,EACT,MAAM,GACT,EAAE,6BAA6B,2CAwE/B"}
|
|
@@ -3,16 +3,13 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import cx from "classnames";
|
|
5
5
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
|
-
import { useSelector } from "react-redux";
|
|
7
6
|
import { UiButton } from "@gooddata/sdk-ui-kit";
|
|
8
|
-
import { settingsSelector } from "../../../store/chatWindow/chatWindowSelectors.js";
|
|
9
7
|
import { useSettingsClick } from "../../hooks/useSettingsClick.js";
|
|
10
8
|
import { MarkdownComponent } from "../contents/Markdown.js";
|
|
11
9
|
export function ConversationErrorContent({ code, traceId, message, useMarkdown = false, className, reason, }) {
|
|
12
|
-
const settings = useSelector(settingsSelector);
|
|
13
10
|
const [showMore, setShowMore] = useState(false);
|
|
14
11
|
const { formatMessage } = useIntl();
|
|
15
|
-
const onSettings = useSettingsClick(
|
|
12
|
+
const onSettings = useSettingsClick();
|
|
16
13
|
const components = useMemo(() => ({
|
|
17
14
|
b: (parts) => _jsx("strong", { children: parts }),
|
|
18
15
|
}), []);
|
package/esm/components/messages/conversationContents/ConversationPublisherDocumentContent.js
CHANGED
|
@@ -31,8 +31,8 @@ export function ConversationPublisherDocumentContent({ message, part, className,
|
|
|
31
31
|
: intl.formatMessage({ id: "gd.gen-ai.publisherDocument.newerVersion" }) }));
|
|
32
32
|
}
|
|
33
33
|
const { saved, baseDocumentId } = part;
|
|
34
|
-
//
|
|
35
|
-
const itemUrl = config.
|
|
34
|
+
// Opening a drafted document needs the create-document permission; without it the Open button is disabled.
|
|
35
|
+
const itemUrl = config.canCreateDocument
|
|
36
36
|
? getPublisherDocumentItemUrl({
|
|
37
37
|
workspaceId,
|
|
38
38
|
saved,
|
|
@@ -6,15 +6,15 @@ import { type GoodDataSdkError } from "@gooddata/sdk-ui";
|
|
|
6
6
|
* non-fatal error types, such as negative values, no data, data too large to display,
|
|
7
7
|
* data too large to compute, forecast not received, or clustering not received.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @
|
|
9
|
+
* @param error - The error to evaluate.
|
|
10
|
+
* @returns Returns true if the error is considered fatal, otherwise false.
|
|
11
11
|
*/
|
|
12
12
|
export declare function isFatalError(error?: Error | GoodDataSdkError | null): boolean;
|
|
13
13
|
/**
|
|
14
14
|
* Determines if the provided error is viewable, based on specific error conditions.
|
|
15
15
|
*
|
|
16
|
-
* @param
|
|
17
|
-
* @
|
|
16
|
+
* @param error - The error object to evaluate. It can be an instance of Error, GoodDataSdkError, null, or undefined.
|
|
17
|
+
* @returns Returns true if the error is viewable, otherwise false.
|
|
18
18
|
*/
|
|
19
19
|
export declare function isViewableError(error?: Error | GoodDataSdkError | null): error is import("@gooddata/sdk-ui").ClusteringNotReceivedSdkError | import("@gooddata/sdk-ui").ForecastNotReceivedSdkError | GoodDataSdkError;
|
|
20
20
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -7,8 +7,8 @@ import { isClusteringNotReceived, isDataTooLargeToCompute, isDataTooLargeToDispl
|
|
|
7
7
|
* non-fatal error types, such as negative values, no data, data too large to display,
|
|
8
8
|
* data too large to compute, forecast not received, or clustering not received.
|
|
9
9
|
*
|
|
10
|
-
* @param
|
|
11
|
-
* @
|
|
10
|
+
* @param error - The error to evaluate.
|
|
11
|
+
* @returns Returns true if the error is considered fatal, otherwise false.
|
|
12
12
|
*/
|
|
13
13
|
export function isFatalError(error) {
|
|
14
14
|
return !(isNegativeValues(error) ||
|
|
@@ -21,8 +21,8 @@ export function isFatalError(error) {
|
|
|
21
21
|
/**
|
|
22
22
|
* Determines if the provided error is viewable, based on specific error conditions.
|
|
23
23
|
*
|
|
24
|
-
* @param
|
|
25
|
-
* @
|
|
24
|
+
* @param error - The error object to evaluate. It can be an instance of Error, GoodDataSdkError, null, or undefined.
|
|
25
|
+
* @returns Returns true if the error is viewable, otherwise false.
|
|
26
26
|
*/
|
|
27
27
|
export function isViewableError(error) {
|
|
28
28
|
return isForecastNotReceived(error) || isClusteringNotReceived(error);
|
|
@@ -6,5 +6,6 @@ export interface IChatMessagesGroup {
|
|
|
6
6
|
type: "reasoning" | "user" | "assistant" | "error" | "system";
|
|
7
7
|
messages: IChatConversationLocalItem[];
|
|
8
8
|
}
|
|
9
|
+
export declare function getReasoningDurationMs(previousGroup: IChatMessagesGroup | undefined, group: IChatMessagesGroup | undefined): number | undefined;
|
|
9
10
|
export declare function groupMessages(messages: IChatConversationLocalItem[]): IChatMessagesGroup[];
|
|
10
11
|
//# sourceMappingURL=groupUtility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupUtility.d.ts","sourceRoot":"","sources":["../../../src/components/utils/groupUtility.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC9D,QAAQ,EAAE,0BAA0B,EAAE,CAAC;CAC1C;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,0BAA0B,EAAE,GAAG,kBAAkB,EAAE,CAmD1F"}
|
|
1
|
+
{"version":3,"file":"groupUtility.d.ts","sourceRoot":"","sources":["../../../src/components/utils/groupUtility.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC9D,QAAQ,EAAE,0BAA0B,EAAE,CAAC;CAC1C;AAED,wBAAgB,sBAAsB,CAClC,aAAa,EAAE,kBAAkB,GAAG,SAAS,EAC7C,KAAK,EAAE,kBAAkB,GAAG,SAAS,GACtC,MAAM,GAAG,SAAS,CAWpB;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,0BAA0B,EAAE,GAAG,kBAAkB,EAAE,CAmD1F"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
// (C) 2024-2026 GoodData Corporation
|
|
2
|
+
export function getReasoningDurationMs(previousGroup, group) {
|
|
3
|
+
if (!previousGroup || group?.type !== "reasoning") {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
const previousLastMessage = previousGroup.messages[previousGroup.messages.length - 1];
|
|
7
|
+
const lastMessage = group.messages[group.messages.length - 1];
|
|
8
|
+
if (!previousLastMessage || !lastMessage) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return Math.abs(lastMessage.createdAt - previousLastMessage.createdAt);
|
|
12
|
+
}
|
|
2
13
|
export function groupMessages(messages) {
|
|
3
14
|
if (messages.length === 0) {
|
|
4
15
|
return [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotComposingOverlay.d.ts","sourceRoot":"","sources":["../../src/copilot/CopilotComposingOverlay.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,2BAA2B,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,2CAuKhF"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// (C) 2026 GoodData Corporation
|
|
3
|
+
import { useLayoutEffect, useRef } from "react";
|
|
4
|
+
const speed = 1 / 3.6;
|
|
5
|
+
const springAt = 0.05;
|
|
6
|
+
const stiffness = 7;
|
|
7
|
+
const damping = 0.55;
|
|
8
|
+
export function DashboardAiComposingOverlay({ isWaiting }) {
|
|
9
|
+
const overlayRef = useRef(null);
|
|
10
|
+
const stateRef = useRef(null);
|
|
11
|
+
useLayoutEffect(() => {
|
|
12
|
+
const overlay = overlayRef.current;
|
|
13
|
+
if (!overlay) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const rects = Array.from(overlay.querySelectorAll("rect"));
|
|
17
|
+
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
18
|
+
let state = stateRef.current;
|
|
19
|
+
let width = 0;
|
|
20
|
+
let perimeter = 0;
|
|
21
|
+
let previousTime;
|
|
22
|
+
let frame;
|
|
23
|
+
const segment = (rect, start, length) => {
|
|
24
|
+
rect.style.strokeDasharray = `${length} ${Math.max(0, perimeter - length)}`;
|
|
25
|
+
rect.style.strokeDashoffset = String(-(((start % perimeter) + perimeter) % perimeter));
|
|
26
|
+
};
|
|
27
|
+
const animate = (time) => {
|
|
28
|
+
frame = undefined;
|
|
29
|
+
if (!state || !perimeter) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const dt = Math.min(0.05, (time - (previousTime ?? time)) / 1000);
|
|
33
|
+
previousTime = time;
|
|
34
|
+
const top = width / 2 / perimeter;
|
|
35
|
+
const runningLength = Math.min(600, perimeter * 0.25);
|
|
36
|
+
const waitingLength = Math.min(120, runningLength);
|
|
37
|
+
let settled = false;
|
|
38
|
+
if (isWaiting && state.mode === "run") {
|
|
39
|
+
state.mode = "cruise";
|
|
40
|
+
state.lap = Math.ceil(state.center + springAt - top);
|
|
41
|
+
}
|
|
42
|
+
else if (!isWaiting && state.mode !== "run") {
|
|
43
|
+
state.mode = "run";
|
|
44
|
+
state.speed = 0;
|
|
45
|
+
}
|
|
46
|
+
if (reducedMotion.matches) {
|
|
47
|
+
state.center = top;
|
|
48
|
+
state.length = isWaiting ? waitingLength : runningLength;
|
|
49
|
+
state.head = isWaiting ? 0 : 1;
|
|
50
|
+
state.lap = 0;
|
|
51
|
+
state.velocity = 0;
|
|
52
|
+
state.speed = 0;
|
|
53
|
+
state.mode = isWaiting ? "spring" : "run";
|
|
54
|
+
settled = true;
|
|
55
|
+
}
|
|
56
|
+
else if (state.mode === "cruise") {
|
|
57
|
+
state.center += speed * dt;
|
|
58
|
+
if (state.lap + top - state.center <= springAt) {
|
|
59
|
+
state.mode = "spring";
|
|
60
|
+
state.velocity = speed;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (state.mode === "spring") {
|
|
64
|
+
// Keep the spring target aligned with the top center while the container resizes.
|
|
65
|
+
const target = state.lap + top;
|
|
66
|
+
const steps = Math.max(1, Math.ceil(dt * 240));
|
|
67
|
+
const step = dt / steps;
|
|
68
|
+
for (let i = 0; i < steps; i++) {
|
|
69
|
+
const acceleration = -stiffness * stiffness * (state.center - target) -
|
|
70
|
+
2 * damping * stiffness * state.velocity;
|
|
71
|
+
state.velocity += acceleration * step;
|
|
72
|
+
state.center += state.velocity * step;
|
|
73
|
+
}
|
|
74
|
+
const easing = 1 - Math.exp(-dt * 3.2);
|
|
75
|
+
state.length += (waitingLength - state.length) * easing;
|
|
76
|
+
state.head += -state.head * easing;
|
|
77
|
+
settled =
|
|
78
|
+
Math.abs(state.center - target) < 0.00001 &&
|
|
79
|
+
Math.abs(state.velocity) < 0.00001 &&
|
|
80
|
+
Math.abs(state.length - waitingLength) < 0.01 &&
|
|
81
|
+
state.head < 0.0001;
|
|
82
|
+
if (settled) {
|
|
83
|
+
state.center = target;
|
|
84
|
+
state.length = waitingLength;
|
|
85
|
+
state.head = 0;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
state.speed = Math.min(1, state.speed + dt / 0.9);
|
|
90
|
+
state.center += speed * dt * state.speed * state.speed;
|
|
91
|
+
const easing = 1 - Math.exp(-dt * 2.5);
|
|
92
|
+
state.length += (runningLength - state.length) * easing;
|
|
93
|
+
state.head += (1 - state.head) * easing;
|
|
94
|
+
}
|
|
95
|
+
const start = state.center * perimeter - state.length / 2;
|
|
96
|
+
const coreLength = state.length * 0.55;
|
|
97
|
+
const coreStart = start + (state.length - coreLength) * (0.5 + 0.5 * state.head);
|
|
98
|
+
const [bloom, glow, tail, core] = rects;
|
|
99
|
+
segment(tail, start, state.length);
|
|
100
|
+
for (const rect of [bloom, glow, core]) {
|
|
101
|
+
segment(rect, coreStart, coreLength);
|
|
102
|
+
}
|
|
103
|
+
if (!settled) {
|
|
104
|
+
frame = requestAnimationFrame(animate);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const refresh = () => {
|
|
108
|
+
if (frame !== undefined) {
|
|
109
|
+
cancelAnimationFrame(frame);
|
|
110
|
+
}
|
|
111
|
+
previousTime = undefined;
|
|
112
|
+
animate(performance.now());
|
|
113
|
+
};
|
|
114
|
+
const fit = () => {
|
|
115
|
+
width = Math.max(0, overlay.clientWidth - 2);
|
|
116
|
+
const height = Math.max(0, overlay.clientHeight - 2);
|
|
117
|
+
perimeter = width && height ? 2 * (width + height) : 0;
|
|
118
|
+
for (const rect of rects) {
|
|
119
|
+
rect.setAttribute("width", String(width));
|
|
120
|
+
rect.setAttribute("height", String(height));
|
|
121
|
+
}
|
|
122
|
+
if (!state && perimeter) {
|
|
123
|
+
state = {
|
|
124
|
+
center: isWaiting ? width / 2 / perimeter : 0.62,
|
|
125
|
+
length: isWaiting ? Math.min(120, perimeter * 0.25) : Math.min(600, perimeter * 0.25),
|
|
126
|
+
head: isWaiting ? 0 : 1,
|
|
127
|
+
speed: 1,
|
|
128
|
+
mode: isWaiting ? "spring" : "run",
|
|
129
|
+
lap: 0,
|
|
130
|
+
velocity: 0,
|
|
131
|
+
};
|
|
132
|
+
stateRef.current = state;
|
|
133
|
+
}
|
|
134
|
+
refresh();
|
|
135
|
+
};
|
|
136
|
+
const observer = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(fit);
|
|
137
|
+
observer?.observe(overlay);
|
|
138
|
+
window.addEventListener("resize", fit);
|
|
139
|
+
reducedMotion.addEventListener("change", refresh);
|
|
140
|
+
fit();
|
|
141
|
+
return () => {
|
|
142
|
+
if (frame !== undefined) {
|
|
143
|
+
cancelAnimationFrame(frame);
|
|
144
|
+
}
|
|
145
|
+
observer?.disconnect();
|
|
146
|
+
window.removeEventListener("resize", fit);
|
|
147
|
+
reducedMotion.removeEventListener("change", refresh);
|
|
148
|
+
};
|
|
149
|
+
}, [isWaiting]);
|
|
150
|
+
return (_jsx("div", { "data-testid": "gd-copilot-composing-overlay", className: "gd-copilot-composing-overlay", ref: overlayRef, "aria-hidden": "true", children: ["bloom", "glow", "tail", "core"].map((layer) => (_jsx("svg", { className: `gd-copilot-composing-overlay__${layer}`, focusable: "false", children: _jsx("rect", { x: "1", y: "1", width: "0", height: "0" }) }, layer))) }));
|
|
151
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ILocale } from "@gooddata/sdk-ui";
|
|
3
|
+
import { type CopilotStatus } from "./types.js";
|
|
4
|
+
/** Configuration of the workflow-independent composing presentation. @alpha */
|
|
5
|
+
export interface ICopilotInteractionComposingProps {
|
|
6
|
+
/** Content that remains mounted and visible regardless of composing progress. */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Loading, building, waiting for a reply, or idle. */
|
|
9
|
+
status: CopilotStatus;
|
|
10
|
+
/** Optional reasoning heading displayed while generating or building. */
|
|
11
|
+
reasoningTitle?: string;
|
|
12
|
+
/** Pure host visibility predicate, evaluated on each render. Only composing UI is hidden. */
|
|
13
|
+
isVisible?: () => boolean;
|
|
14
|
+
/** Open the originating chat when the user chooses to reply. */
|
|
15
|
+
onReplyInChat?: () => void;
|
|
16
|
+
/** Locale for the waiting message and reply button. Defaults to en-US. */
|
|
17
|
+
locale?: ILocale;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Wrap content with a composing animation and optional reasoning or reply banner.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* This controlled component has no workflow state or store dependency. Its container fills its
|
|
24
|
+
* host; give the host a size and import `@gooddata/sdk-ui-gen-ai/styles/css/copilotInteractionComposing.css`.
|
|
25
|
+
* A visibility predicate is not a subscription; rerender when external visibility facts change.
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export declare function CopilotInteractionComposing({ children, status, reasoningTitle, isVisible, onReplyInChat, locale, }: ICopilotInteractionComposingProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=CopilotInteractionComposing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotInteractionComposing.d.ts","sourceRoot":"","sources":["../../src/copilot/CopilotInteractionComposing.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAMhD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAahD,+EAA+E;AAC/E,MAAM,WAAW,iCAAiC;IAC9C,iFAAiF;IACjF,QAAQ,EAAE,SAAS,CAAC;IACpB,uDAAuD;IACvD,MAAM,EAAE,aAAa,CAAC;IACtB,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6FAA6F;IAC7F,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;IAC1B,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,EACxC,QAAQ,EACR,MAAM,EACN,cAAc,EACd,SAAS,EACT,aAAa,EACb,MAAM,GACT,EAAE,iCAAiC,2CAmBnC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { FormattedMessage, defineMessages, useIntl } from "react-intl";
|
|
4
|
+
import { UiButton } from "@gooddata/sdk-ui-kit";
|
|
5
|
+
import { IntlWrapper } from "../localization/IntlWrapper.js";
|
|
6
|
+
import { DashboardAiComposingOverlay as CopilotComposingOverlay } from "./CopilotComposingOverlay.js";
|
|
7
|
+
const messages = defineMessages({
|
|
8
|
+
waiting: {
|
|
9
|
+
id: "gd.gen-ai.copilot.composing.waiting",
|
|
10
|
+
defaultMessage: "Waiting for your reply",
|
|
11
|
+
},
|
|
12
|
+
replyNow: {
|
|
13
|
+
id: "gd.gen-ai.copilot.composing.replyNow",
|
|
14
|
+
defaultMessage: "Reply now",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Wrap content with a composing animation and optional reasoning or reply banner.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This controlled component has no workflow state or store dependency. Its container fills its
|
|
22
|
+
* host; give the host a size and import `@gooddata/sdk-ui-gen-ai/styles/css/copilotInteractionComposing.css`.
|
|
23
|
+
* A visibility predicate is not a subscription; rerender when external visibility facts change.
|
|
24
|
+
* @alpha
|
|
25
|
+
*/
|
|
26
|
+
export function CopilotInteractionComposing({ children, status, reasoningTitle, isVisible, onReplyInChat, locale, }) {
|
|
27
|
+
const visible = isVisible?.() ?? true;
|
|
28
|
+
const active = visible && status !== "idle";
|
|
29
|
+
return (_jsxs("div", { className: "gd-copilot-interaction-composing", children: [_jsx("div", { className: "gd-copilot-interaction-composing__content", children: children }), active ? _jsx(CopilotComposingOverlay, { isWaiting: status === "waiting" }) : null, visible ? (_jsx(IntlWrapper, { locale: locale, children: _jsx(ComposingStatus, { status: status, reasoningTitle: reasoningTitle, onReplyInChat: onReplyInChat }) })) : null] }));
|
|
30
|
+
}
|
|
31
|
+
function ComposingStatus({ status, reasoningTitle, onReplyInChat, }) {
|
|
32
|
+
const intl = useIntl();
|
|
33
|
+
const isWaiting = status === "waiting";
|
|
34
|
+
const showReasoning = (status === "generating" || status === "building") && !!reasoningTitle;
|
|
35
|
+
const showStatus = isWaiting || showReasoning;
|
|
36
|
+
return (_jsxs("div", { className: cx("gd-copilot-interaction-composing__status", {
|
|
37
|
+
"gd-copilot-interaction-composing__status--hidden": !showStatus,
|
|
38
|
+
}), "aria-hidden": !showStatus, children: [_jsx("div", { className: "gd-copilot-interaction-composing__message", role: showStatus ? "status" : undefined, children: isWaiting ? (_jsx(FormattedMessage, { ...messages.waiting })) : showReasoning ? (reasoningTitle) : null }), isWaiting && onReplyInChat ? (_jsx(UiButton, { variant: "tertiary", label: intl.formatMessage(messages.replyNow), onClick: onReplyInChat })) : null] }));
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CopilotHandler } from "./CopilotHandler.js";
|
|
2
|
+
import { type ICopilotInteractionComposingProps } from "./CopilotInteractionComposing.js";
|
|
3
|
+
import { type CopilotBuildType, type ICopilotScope } from "./types.js";
|
|
4
|
+
/** Composing presentation driven directly by an existing copilot instance. @alpha */
|
|
5
|
+
export interface ICopilotInteractionComposingWithHandlerProps<TBuild extends string = CopilotBuildType> extends Omit<ICopilotInteractionComposingProps, "status" | "reasoningTitle" | "onReplyInChat"> {
|
|
6
|
+
/** Runtime-owned handler. This component never disposes it. */
|
|
7
|
+
copilot: CopilotHandler<TBuild>;
|
|
8
|
+
/** Workflow and optional target whose progress should be displayed. */
|
|
9
|
+
scope: ICopilotScope<TBuild>;
|
|
10
|
+
/** Open the waiting workflow's originating thread; falls back to the foreground thread. */
|
|
11
|
+
onReplyInChat?: (threadId?: string) => void;
|
|
12
|
+
}
|
|
13
|
+
/** Subscribe to a copilot instance without introducing another workflow state owner. @alpha */
|
|
14
|
+
export declare function CopilotInteractionComposingWithHandler<TBuild extends string = CopilotBuildType>({ copilot, scope, onReplyInChat, ...props }: ICopilotInteractionComposingWithHandlerProps<TBuild>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=CopilotInteractionComposingWithHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopilotInteractionComposingWithHandler.d.ts","sourceRoot":"","sources":["../../src/copilot/CopilotInteractionComposingWithHandler.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAEH,KAAK,iCAAiC,EACzC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAGvE,qFAAqF;AACrF,MAAM,WAAW,4CAA4C,CACzD,MAAM,SAAS,MAAM,GAAG,gBAAgB,CAC1C,SAAQ,IAAI,CAAC,iCAAiC,EAAE,QAAQ,GAAG,gBAAgB,GAAG,eAAe,CAAC;IAC5F,+DAA+D;IAC/D,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAChC,uEAAuE;IACvE,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,2FAA2F;IAC3F,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED,+FAA+F;AAC/F,wBAAgB,sCAAsC,CAAC,MAAM,SAAS,MAAM,GAAG,gBAAgB,EAAE,EAC7F,OAAO,EACP,KAAK,EACL,aAAa,EACb,GAAG,KAAK,EACX,EAAE,4CAA4C,CAAC,MAAM,CAAC,2CAetD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CopilotInteractionComposing, } from "./CopilotInteractionComposing.js";
|
|
3
|
+
import { selectCopilotReasoningTitle, selectCopilotReplyThreadId, selectCopilotStatus } from "./selectors.js";
|
|
4
|
+
import { useCopilotSnapshot } from "./useCopilotSnapshot.js";
|
|
5
|
+
/** Subscribe to a copilot instance without introducing another workflow state owner. @alpha */
|
|
6
|
+
export function CopilotInteractionComposingWithHandler({ copilot, scope, onReplyInChat, ...props }) {
|
|
7
|
+
const snapshot = useCopilotSnapshot(copilot);
|
|
8
|
+
return (_jsx(CopilotInteractionComposing, { ...props, status: selectCopilotStatus(snapshot, scope), reasoningTitle: selectCopilotReasoningTitle(snapshot, scope), onReplyInChat: onReplyInChat
|
|
9
|
+
? () => onReplyInChat(selectCopilotReplyThreadId(copilot.getSnapshot(), scope))
|
|
10
|
+
: undefined }));
|
|
11
|
+
}
|