@gooddata/sdk-ui-pluggable-host 11.58.0-alpha.2 → 11.58.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/esm/components/HostUiContainer.d.ts.map +1 -1
- package/esm/components/HostUiContainer.js +11 -3
- package/esm/ui/DefaultHostUi.d.ts.map +1 -1
- package/esm/ui/DefaultHostUi.js +7 -3
- package/esm/ui/GenAIChat.d.ts +4 -1
- package/esm/ui/GenAIChat.d.ts.map +1 -1
- package/esm/ui/GenAIChat.js +3 -0
- package/esm/ui/HostChat.d.ts +2 -0
- package/esm/ui/HostChat.d.ts.map +1 -1
- package/esm/ui/HostChat.js +6 -5
- package/esm/ui/HostChat.scss +5 -0
- package/esm/ui/HostChrome.d.ts +4 -1
- package/esm/ui/HostChrome.d.ts.map +1 -1
- package/esm/ui/HostChrome.js +11 -8
- package/esm/ui/HostChrome.scss +4 -0
- package/esm/ui/chromeHelpers.d.ts +14 -1
- package/esm/ui/chromeHelpers.d.ts.map +1 -1
- package/esm/ui/chromeHelpers.js +19 -0
- package/esm/ui/useHostChromeChat.d.ts +5 -0
- package/esm/ui/useHostChromeChat.d.ts.map +1 -1
- package/esm/ui/useHostChromeChat.js +5 -0
- 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;AAiBnD,OAAO,wBAAwB,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;AAiBnD,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,2CAqWtG"}
|
|
@@ -10,8 +10,8 @@ import { getAppLifecycleCallbacks } from "../loader/pluggableApplicationsLoader.
|
|
|
10
10
|
import { getActiveInternalApplication } from "../loader/routing.js";
|
|
11
11
|
import { HostChat, } from "../ui/HostChat.js";
|
|
12
12
|
import { HostIntlProvider } from "../ui/HostIntlProvider.js";
|
|
13
|
-
import { PluggableApplicationRenderer } from "../ui/PluggableApplicationRenderer.js";
|
|
14
13
|
import "./HostUiContainer.scss";
|
|
14
|
+
import { PluggableApplicationRenderer } from "../ui/PluggableApplicationRenderer.js";
|
|
15
15
|
import { resolveHostUiModule } from "../ui/resolveHostUiModule.js";
|
|
16
16
|
import { HostErrorBoundary } from "./HostErrorBoundary.js";
|
|
17
17
|
import { runGuardedNavigation } from "./navigationGuard.js";
|
|
@@ -53,9 +53,17 @@ export function HostUiContainer({ ctx, apps, pathname, routerNavigate, onError }
|
|
|
53
53
|
const [aiAssistantOpen, setAiAssistantOpen] = useState(false);
|
|
54
54
|
// Header chat-button state (visibility + open) pushed down to the host UI module so it can render
|
|
55
55
|
// the header button to match the host-owned chat.
|
|
56
|
-
const [chatButtonState, setChatButtonState] = useState({
|
|
56
|
+
const [chatButtonState, setChatButtonState] = useState({
|
|
57
|
+
showChatItem: false,
|
|
58
|
+
isOpen: false,
|
|
59
|
+
mode: "docked",
|
|
60
|
+
});
|
|
57
61
|
const onChatStateChange = useCallback((state) => {
|
|
58
|
-
setChatButtonState((prev) => prev.showChatItem === state.showChatItem &&
|
|
62
|
+
setChatButtonState((prev) => prev.showChatItem === state.showChatItem &&
|
|
63
|
+
prev.isOpen === state.isOpen &&
|
|
64
|
+
prev.mode === state.mode
|
|
65
|
+
? prev
|
|
66
|
+
: state);
|
|
59
67
|
}, []);
|
|
60
68
|
// Open/close/toggle requests and tag scope driving the host's single chat (HostChat). Sources:
|
|
61
69
|
// app events (via PluggableApplicationRenderer), the header chat button, and the header search.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultHostUi.d.ts","sourceRoot":"","sources":["../../src/ui/DefaultHostUi.tsx"],"names":[],"mappings":"AAQA,OAAO,EAEH,KAAK,aAAa,EAKrB,MAAM,2CAA2C,CAAC;AAOnD,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"DefaultHostUi.d.ts","sourceRoot":"","sources":["../../src/ui/DefaultHostUi.tsx"],"names":[],"mappings":"AAQA,OAAO,EAEH,KAAK,aAAa,EAKrB,MAAM,2CAA2C,CAAC;AAOnD,OAAO,sBAAsB,CAAC;AAsO9B;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAEjC,CAAC"}
|
package/esm/ui/DefaultHostUi.js
CHANGED
|
@@ -6,8 +6,8 @@ import { createRoot } from "react-dom/client";
|
|
|
6
6
|
import { resolveLocale } from "@gooddata/sdk-ui";
|
|
7
7
|
import { HostErrorBoundary } from "../components/HostErrorBoundary.js";
|
|
8
8
|
import { HostChrome } from "./HostChrome.js";
|
|
9
|
-
import { e } from "./hostChromeBem.js";
|
|
10
9
|
import "./DefaultHostUi.scss";
|
|
10
|
+
import { e } from "./hostChromeBem.js";
|
|
11
11
|
function HostUiBridge({ initialCtx, initialApps, initialPathname, navigate, replace, onChatToggleRequested, onAskAiAssistant, onError, onAppContainerReady, onReady, }) {
|
|
12
12
|
const [ctx, setCtx] = useState(initialCtx);
|
|
13
13
|
const [apps, setApps] = useState(initialApps);
|
|
@@ -17,7 +17,11 @@ function HostUiBridge({ initialCtx, initialApps, initialPathname, navigate, repl
|
|
|
17
17
|
const [pageTitle, setPageTitle] = useState(undefined);
|
|
18
18
|
// The host runtime owns the single chat instance (outside this UI module); it pushes the chat
|
|
19
19
|
// button state here so the header button reflects the chat's availability and open-state.
|
|
20
|
-
const [chatState, setChatState] = useState({
|
|
20
|
+
const [chatState, setChatState] = useState({
|
|
21
|
+
showChatItem: false,
|
|
22
|
+
isOpen: false,
|
|
23
|
+
mode: "docked",
|
|
24
|
+
});
|
|
21
25
|
const appContainerRef = useRef(null);
|
|
22
26
|
// Layout effect runs in the same synchronous commit as flushSync.
|
|
23
27
|
useLayoutEffect(() => {
|
|
@@ -28,7 +32,7 @@ function HostUiBridge({ initialCtx, initialApps, initialPathname, navigate, repl
|
|
|
28
32
|
// Only call once on mount
|
|
29
33
|
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
|
30
34
|
}, []);
|
|
31
|
-
return (_jsx(HostErrorBoundary, { onError: onError, locale: resolveLocale(ctx.preferredLocale), children: _jsx(HostChrome, { ctx: ctx, resolvedApplications: apps, pathname: pathname, onNavigate: navigate, onReplace: replace, headerOptions: headerOptions, notification: notification, showChatItem: chatState.showChatItem, chatIsOpen: chatState.isOpen, onChatToggle: onChatToggleRequested, onAskAiAssistant: onAskAiAssistant, appPageTitle: pageTitle, children: _jsx("div", { ref: appContainerRef, className: e("app-container") }) }) }));
|
|
35
|
+
return (_jsx(HostErrorBoundary, { onError: onError, locale: resolveLocale(ctx.preferredLocale), children: _jsx(HostChrome, { ctx: ctx, resolvedApplications: apps, pathname: pathname, onNavigate: navigate, onReplace: replace, headerOptions: headerOptions, notification: notification, showChatItem: chatState.showChatItem, chatIsOpen: chatState.isOpen, chatMode: chatState.mode, onChatToggle: onChatToggleRequested, onAskAiAssistant: onAskAiAssistant, appPageTitle: pageTitle, children: _jsx("div", { ref: appContainerRef, className: e("app-container") }) }) }));
|
|
32
36
|
}
|
|
33
37
|
// ---------------------------------------------------------------------------
|
|
34
38
|
// Imperative mount function conforming to IHostUiModule
|
package/esm/ui/GenAIChat.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
|
|
2
2
|
import type { IGenAIUserContext } from "@gooddata/sdk-model";
|
|
3
|
-
import { type ChatDefinitionReceivedEvent, type ChatAssistantMessageEvent, type ChatClosedEvent, type ChatFeedbackEvent, type ChatOpenedEvent, type ChatResetEvent, type ChatUserMessageEvent } from "@gooddata/sdk-ui-gen-ai";
|
|
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
4
|
/**
|
|
5
5
|
* Discriminated union of GenAI chat events that are forwarded to the host
|
|
6
6
|
* caller via the `onEvent` callback.
|
|
@@ -25,6 +25,9 @@ export type GenAIChatEvent = {
|
|
|
25
25
|
} | {
|
|
26
26
|
name: "chat.user-message";
|
|
27
27
|
payload: ChatUserMessageEvent;
|
|
28
|
+
} | {
|
|
29
|
+
name: "chat.mode-changed";
|
|
30
|
+
payload: ChatModeChangeEvent;
|
|
28
31
|
} | {
|
|
29
32
|
name: "chat.definition-received";
|
|
30
33
|
payload: ChatDefinitionReceivedEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenAIChat.d.ts","sourceRoot":"","sources":["../../src/ui/GenAIChat.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KA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,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC;IACvG,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CAC7C;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACtB,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,aAAa,EACb,MAAM,EACN,YAAY,EACZ,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,cAAc,EACd,OAAO,GACV,EAAE,eAAe,2CAsHjB"}
|
package/esm/ui/GenAIChat.js
CHANGED
|
@@ -81,6 +81,9 @@ export function GenAIChat({ workspaceId, open, disabled, onOpen, onClose, askedQ
|
|
|
81
81
|
case "definition-received":
|
|
82
82
|
onEvent?.({ name: "chat.definition-received", payload: event.payload });
|
|
83
83
|
break;
|
|
84
|
+
case "mode-changed":
|
|
85
|
+
onEvent?.({ name: "chat.mode-changed", payload: event.payload });
|
|
86
|
+
break;
|
|
84
87
|
default:
|
|
85
88
|
break;
|
|
86
89
|
}
|
package/esm/ui/HostChat.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type IGenAIUserContext, type PluggableApplicationRegistryItem } from "@gooddata/sdk-model";
|
|
2
2
|
import { type IPlatformContext } from "@gooddata/sdk-pluggable-application-model";
|
|
3
|
+
import { GenAIAssistantMode } from "@gooddata/sdk-ui-gen-ai";
|
|
3
4
|
import { GenAIChatEvent } from "./GenAIChat.js";
|
|
4
5
|
import "./HostChat.scss";
|
|
5
6
|
import "@gooddata/sdk-ui-gen-ai/styles/css/main.css";
|
|
@@ -56,6 +57,7 @@ export interface IHostChatProps {
|
|
|
56
57
|
onChatStateChange?: (state: {
|
|
57
58
|
showChatItem: boolean;
|
|
58
59
|
isOpen: boolean;
|
|
60
|
+
mode: GenAIAssistantMode;
|
|
59
61
|
}) => void;
|
|
60
62
|
/**
|
|
61
63
|
* Delegates a chat link click to the active application (e.g. an embedded dashboard opening a
|
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;
|
|
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;AAM7D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,iBAAiB,CAAC;AACzB,OAAO,6CAA6C,CAAC;AAMrD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;CACf;AAED,+FAA+F;AAC/F,MAAM,WAAW,aAAa;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,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,EACX,UAAiB,EACjB,OAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,GACpB,EAAE,cAAc,2CAkIhB"}
|
package/esm/ui/HostChat.js
CHANGED
|
@@ -7,9 +7,9 @@ import { getAppLifecycleCallbacks } from "../loader/pluggableApplicationsLoader.
|
|
|
7
7
|
import { getBackend } from "../platformContext/backend.js";
|
|
8
8
|
import { e } from "./hostChromeBem.js";
|
|
9
9
|
import { HostIntlProvider } from "./HostIntlProvider.js";
|
|
10
|
-
import { useGenAiRightPanel } from "./useGenAiRightPanel.js";
|
|
11
10
|
import "./HostChat.scss";
|
|
12
11
|
import "@gooddata/sdk-ui-gen-ai/styles/css/main.css";
|
|
12
|
+
import { useGenAiRightPanel } from "./useGenAiRightPanel.js";
|
|
13
13
|
import { useHostChromeChat } from "./useHostChromeChat.js";
|
|
14
14
|
import { useHostChromeWorkspaceFeatures } from "./useHostChromeWorkspaceFeatures.js";
|
|
15
15
|
/**
|
|
@@ -42,8 +42,8 @@ export function HostChat({ ctx, resolvedApplications, pathname, activeAppId, vis
|
|
|
42
42
|
}, [chatIsOpen, onOpenChange]);
|
|
43
43
|
// Report the header chat-button state so the host UI module can render the button to match.
|
|
44
44
|
useEffect(() => {
|
|
45
|
-
onChatStateChange?.({ showChatItem, isOpen: chatIsOpen });
|
|
46
|
-
}, [showChatItem, chatIsOpen, onChatStateChange]);
|
|
45
|
+
onChatStateChange?.({ showChatItem, isOpen: chatIsOpen, mode: chat.mode });
|
|
46
|
+
}, [showChatItem, chatIsOpen, onChatStateChange, chat.mode]);
|
|
47
47
|
// Effect order matters: the tag-scope effects are declared before the open/ask effect so that,
|
|
48
48
|
// when a tag-scope change and an open/ask request land in the same commit, the host chat is
|
|
49
49
|
// already scoped before the seeded question is sent.
|
|
@@ -85,11 +85,12 @@ export function HostChat({ ctx, resolvedApplications, pathname, activeAppId, vis
|
|
|
85
85
|
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
|
86
86
|
}, [visibilitySeq, chatAskAiAssistant, chatOpenAiAssistant, chatOpen, chatClose, chatToggle]);
|
|
87
87
|
const enablePanel = useGenAiRightPanel(features.settings["enableGenAiRightPanel"], context?.embedded);
|
|
88
|
-
const Wrapper = useCallback(({ chatIsOpen, children, enablePanel, }) => {
|
|
88
|
+
const Wrapper = useCallback(({ chatIsOpen, children, mode, enablePanel, }) => {
|
|
89
89
|
return (_jsx("div", { className: e("ai-chat", {
|
|
90
90
|
chatIsOpen,
|
|
91
91
|
enablePanel,
|
|
92
|
+
mode,
|
|
92
93
|
}), children: children }));
|
|
93
94
|
}, []);
|
|
94
|
-
return (_jsx(HostIntlProvider, { locale: resolveLocale(ctx.preferredLocale), children: _jsx(BackendProvider, { backend: getBackend(), children: _jsx(ToastsCenterContextProvider, { children: _jsx(Wrapper, { chatIsOpen: chatIsOpen, enablePanel: enablePanel, children: chat.element }) }) }) }));
|
|
95
|
+
return (_jsx(HostIntlProvider, { locale: resolveLocale(ctx.preferredLocale), children: _jsx(BackendProvider, { backend: getBackend(), children: _jsx(ToastsCenterContextProvider, { children: _jsx(Wrapper, { chatIsOpen: chatIsOpen, mode: chat.mode, enablePanel: enablePanel, children: chat.element }) }) }) }));
|
|
95
96
|
}
|
package/esm/ui/HostChat.scss
CHANGED
package/esm/ui/HostChrome.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type IGenAIUserContext, type PluggableApplicationRegistryItem } from "@gooddata/sdk-model";
|
|
3
3
|
import { type IAppHeaderOptions, type IHostUiNotification, type IPlatformContext } from "@gooddata/sdk-pluggable-application-model";
|
|
4
|
+
import { GenAIAssistantMode } from "@gooddata/sdk-ui-gen-ai";
|
|
4
5
|
import "./HostChrome.scss";
|
|
5
6
|
import "@gooddata/sdk-ui-ext/styles/css/main.css";
|
|
6
7
|
import "@gooddata/sdk-ui-gen-ai/styles/css/main.css";
|
|
@@ -21,6 +22,8 @@ export interface IHostChromeProps {
|
|
|
21
22
|
showChatItem?: boolean;
|
|
22
23
|
/** Whether the host-owned chat is currently open (for the header button's active state). */
|
|
23
24
|
chatIsOpen?: boolean;
|
|
25
|
+
/** Chat mode for the host-owned chat. */
|
|
26
|
+
chatMode?: GenAIAssistantMode;
|
|
24
27
|
/** Toggles the host-owned chat; wired to the header chat button. */
|
|
25
28
|
onChatToggle?: () => void;
|
|
26
29
|
/** Hands a question to the host-owned chat; wired to the header search "ask AI" action. */
|
|
@@ -32,5 +35,5 @@ export interface IHostChromeProps {
|
|
|
32
35
|
appPageTitle?: string;
|
|
33
36
|
children?: ReactNode;
|
|
34
37
|
}
|
|
35
|
-
export declare function HostChrome({ ctx, resolvedApplications, pathname, onNavigate, onReplace: _onReplace, headerOptions, notification, showChatItem, chatIsOpen, onChatToggle, onAskAiAssistant, appPageTitle, children, }: IHostChromeProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function HostChrome({ ctx, resolvedApplications, pathname, onNavigate, onReplace: _onReplace, headerOptions, notification, showChatItem, chatIsOpen, chatMode, onChatToggle, onAskAiAssistant, appPageTitle, children, }: IHostChromeProps): import("react/jsx-runtime").JSX.Element;
|
|
36
39
|
//# sourceMappingURL=HostChrome.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HostChrome.d.ts","sourceRoot":"","sources":["../../src/ui/HostChrome.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuC,KAAK,SAAS,EAAwB,MAAM,OAAO,CAAC;AAElG,OAAO,EACH,KAAK,iBAAiB,EAEtB,KAAK,gCAAgC,EACxC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACxB,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"HostChrome.d.ts","sourceRoot":"","sources":["../../src/ui/HostChrome.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuC,KAAK,SAA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AAC,EAAE,SAAS,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,EACvB,GAAG,EACH,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,SAAS,EAAE,UAAU,EACrB,aAAa,EACb,YAAmB,EACnB,YAAoB,EACpB,UAAkB,EAClB,QAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,QAAQ,GACX,EAAE,gBAAgB,2CAiQlB"}
|
package/esm/ui/HostChrome.js
CHANGED
|
@@ -10,7 +10,7 @@ import { getAppLifecycleCallbacks } from "../loader/pluggableApplicationsLoader.
|
|
|
10
10
|
import { getActiveInternalApplication } from "../loader/routing.js";
|
|
11
11
|
import { getBackend } from "../platformContext/backend.js";
|
|
12
12
|
import { buildAppMenu, getLocalizedTitle } from "./appMenuItems.js";
|
|
13
|
-
import { getUserDisplayName,
|
|
13
|
+
import { getUserDisplayName, getWorkspaceSwitchPath, isPlainLeftClick } from "./chromeHelpers.js";
|
|
14
14
|
import { b, e } from "./hostChromeBem.js";
|
|
15
15
|
import { HostIntlProvider } from "./HostIntlProvider.js";
|
|
16
16
|
import { HostNotificationDispatcher } from "./HostNotificationDispatcher.js";
|
|
@@ -18,7 +18,6 @@ import { useAppPreloadOnHover } from "./useAppPreloadOnHover.js";
|
|
|
18
18
|
import { useGenAiRightPanel } from "./useGenAiRightPanel.js";
|
|
19
19
|
import { useHostChromePricing } from "./useHostChromePricing.js";
|
|
20
20
|
import { useHostChromeSearch } from "./useHostChromeSearch.js";
|
|
21
|
-
import { useHostChromeWorkspaceFeatures } from "./useHostChromeWorkspaceFeatures.js";
|
|
22
21
|
import "./HostChrome.scss";
|
|
23
22
|
// SDK packages with side-effecting CSS (declared in their own `sideEffects`)
|
|
24
23
|
// must be imported explicitly by consumers; tree-shakers won't grab them otherwise.
|
|
@@ -28,6 +27,7 @@ import "@gooddata/sdk-ui-ext/styles/css/main.css";
|
|
|
28
27
|
import "@gooddata/sdk-ui-gen-ai/styles/css/main.css";
|
|
29
28
|
import "@gooddata/sdk-ui-semantic-search/styles/css/main.css";
|
|
30
29
|
import "@gooddata/sdk-ui-semantic-search/styles/css/internal.css";
|
|
30
|
+
import { useHostChromeWorkspaceFeatures } from "./useHostChromeWorkspaceFeatures.js";
|
|
31
31
|
import { AppHeaderWorkspacePicker } from "./WorkspacePicker.js";
|
|
32
32
|
const LOGOUT_MENU_ITEM_KEY = "gs.header.logout";
|
|
33
33
|
// The favicon that index.html shipped — resolved to "<cdnurl>/organization/favicon.ico" on the live
|
|
@@ -38,7 +38,7 @@ const initialFaviconUrl = (typeof document !== "undefined" && document.querySele
|
|
|
38
38
|
"/favicon.ico";
|
|
39
39
|
// Switches the host scope to organization; the first organization app is then chosen by redirect logic.
|
|
40
40
|
const LOGO_HREF = "/organization";
|
|
41
|
-
export function HostChrome({ ctx, resolvedApplications, pathname, onNavigate, onReplace: _onReplace, headerOptions, notification = null, showChatItem = false, chatIsOpen = false, onChatToggle, onAskAiAssistant, appPageTitle, children, }) {
|
|
41
|
+
export function HostChrome({ ctx, resolvedApplications, pathname, onNavigate, onReplace: _onReplace, headerOptions, notification = null, showChatItem = false, chatIsOpen = false, chatMode = "docked", onChatToggle, onAskAiAssistant, appPageTitle, children, }) {
|
|
42
42
|
const locale = resolveLocale(ctx.preferredLocale);
|
|
43
43
|
const userName = getUserDisplayName(ctx.user);
|
|
44
44
|
const features = useHostChromeWorkspaceFeatures(resolvedApplications, ctx, pathname);
|
|
@@ -98,13 +98,15 @@ export function HostChrome({ ctx, resolvedApplications, pathname, onNavigate, on
|
|
|
98
98
|
}, [onNavigate]);
|
|
99
99
|
const handleWorkspaceSelect = useCallback((workspace) => {
|
|
100
100
|
const newId = workspace.id;
|
|
101
|
-
|
|
101
|
+
// The picker reports a click on the current workspace too; navigating would leave the
|
|
102
|
+
// application's own in-app route (which the host router does not observe) behind.
|
|
103
|
+
if (!newId || newId === features.workspaceId) {
|
|
102
104
|
return;
|
|
103
105
|
}
|
|
104
106
|
const search = typeof window === "undefined" ? "" : window.location.search;
|
|
105
|
-
const newPath =
|
|
107
|
+
const newPath = getWorkspaceSwitchPath(pathname, newId, resolvedApplications, ctx);
|
|
106
108
|
onNavigate(`${newPath}${search}`);
|
|
107
|
-
}, [pathname, onNavigate]);
|
|
109
|
+
}, [pathname, onNavigate, resolvedApplications, ctx, features.workspaceId]);
|
|
108
110
|
const organizationTitle = ctx.organization?.title ?? ctx.organization?.id;
|
|
109
111
|
const workspacePicker = features.isWorkspaceApp && features.workspaceId ? (_jsx(AppHeaderWorkspacePicker, { backend: getBackend(), userId: ctx.user.login, workspaceId: features.workspaceId, onWorkspaceSelect: handleWorkspaceSelect })) : organizationTitle ? (_jsx("div", { className: "gd-header-project", children: organizationTitle })) : null;
|
|
110
112
|
const hasTierEntitlement = ctx.entitlements?.some((e) => e.name === "Tier" && e.value);
|
|
@@ -143,10 +145,11 @@ export function HostChrome({ ctx, resolvedApplications, pathname, onNavigate, on
|
|
|
143
145
|
const activeColor = ctx.theme?.header?.activeColor ?? defaultHeaderTheme.activeColor;
|
|
144
146
|
const hideChrome = ctx.embeddingMode === "iframe" || ctx.isExportMode === true;
|
|
145
147
|
const enablePanel = useGenAiRightPanel(features.settings["enableGenAiRightPanel"], ctx.embeddingMode !== "none");
|
|
146
|
-
const Wrapper = useCallback(({ children, chatIsOpen }) => {
|
|
148
|
+
const Wrapper = useCallback(({ children, chatIsOpen, mode, }) => {
|
|
147
149
|
return (_jsx("main", { className: e("content", {
|
|
148
150
|
chatIsOpen,
|
|
151
|
+
mode,
|
|
149
152
|
}), children: children }));
|
|
150
153
|
}, []);
|
|
151
|
-
return (_jsx(HostIntlProvider, { locale: locale, additionalMessages: appMessages, children: _jsx(BackendProvider, { backend: getBackend(), children: _jsx(ToastsCenterContextProvider, { children: _jsxs("div", { className: b({ export: ctx.isExportMode === true }), children: [_jsx(DocumentHeader, { pageTitle: documentPageTitle, brandTitle: documentBrandTitle, faviconUrl: faviconUrl, appleTouchIconUrl: ctx.whiteLabeling?.appleTouchIconUrl }), hideChrome ? null : (_jsx("div", { className: e("header"), onMouseOver: appPreloadOnHover.onMouseOver, onMouseLeave: appPreloadOnHover.onMouseLeave, children: _jsx(AppHeader, { logoUrl: ctx.whiteLabeling?.logoUrl || defaultLogoUrl, logoHref: LOGO_HREF, onLogoClick: handleLogoClick, logoTitle: logoTitle, headerColor: headerColor, headerTextColor: headerTextColor, activeColor: activeColor, userName: userName, organizationName: ctx.organization?.title, isAccessibilityCompliant: true, workspacePicker: workspacePicker, menuItemsGroups: menuItemsGroups, helpMenuItems: helpMenuItems, accountMenuItems: accountMenuItems, onMenuItemClick: handleMenuItemClick, showUpsellButton: pricing.isTrial, onUpsellButtonClick: pricing.onUpsellButtonClick, expiredDate: pricing.isTrial ? pricing.expiredDate : undefined, search: search.element, showChatItem: showChatItem, isChatOpen: chatIsOpen, onChatItemClick: onChatToggle, notificationsPanel: ({ isMobile, closeNotificationsOverlay }) => (_jsx(AppHeaderNotifications, { locale: locale, isMobile: isMobile, closeNotificationsOverlay: closeNotificationsOverlay, useAsOfDateParam: true, enableExportToDocumentStorage: ctx.userSettings.enableExportToDocumentStorage ?? false })) }) })), _jsx(Wrapper, { chatIsOpen: Boolean(chatIsOpen && enablePanel), children: children }), pricing.element, _jsx(HostNotificationDispatcher, { notification: notification })] }) }) }) }));
|
|
154
|
+
return (_jsx(HostIntlProvider, { locale: locale, additionalMessages: appMessages, children: _jsx(BackendProvider, { backend: getBackend(), children: _jsx(ToastsCenterContextProvider, { children: _jsxs("div", { className: b({ export: ctx.isExportMode === true }), children: [_jsx(DocumentHeader, { pageTitle: documentPageTitle, brandTitle: documentBrandTitle, faviconUrl: faviconUrl, appleTouchIconUrl: ctx.whiteLabeling?.appleTouchIconUrl }), hideChrome ? null : (_jsx("div", { className: e("header"), onMouseOver: appPreloadOnHover.onMouseOver, onMouseLeave: appPreloadOnHover.onMouseLeave, children: _jsx(AppHeader, { logoUrl: ctx.whiteLabeling?.logoUrl || defaultLogoUrl, logoHref: LOGO_HREF, onLogoClick: handleLogoClick, logoTitle: logoTitle, headerColor: headerColor, headerTextColor: headerTextColor, activeColor: activeColor, userName: userName, organizationName: ctx.organization?.title, isAccessibilityCompliant: true, workspacePicker: workspacePicker, menuItemsGroups: menuItemsGroups, helpMenuItems: helpMenuItems, accountMenuItems: accountMenuItems, onMenuItemClick: handleMenuItemClick, showUpsellButton: pricing.isTrial, onUpsellButtonClick: pricing.onUpsellButtonClick, expiredDate: pricing.isTrial ? pricing.expiredDate : undefined, search: search.element, showChatItem: showChatItem, isChatOpen: chatIsOpen, onChatItemClick: onChatToggle, notificationsPanel: ({ isMobile, closeNotificationsOverlay }) => (_jsx(AppHeaderNotifications, { locale: locale, isMobile: isMobile, closeNotificationsOverlay: closeNotificationsOverlay, useAsOfDateParam: true, enableExportToDocumentStorage: ctx.userSettings.enableExportToDocumentStorage ?? false })) }) })), _jsx(Wrapper, { chatIsOpen: Boolean(chatIsOpen && enablePanel), mode: chatMode, children: children }), pricing.element, _jsx(HostNotificationDispatcher, { notification: notification })] }) }) }) }));
|
|
152
155
|
}
|
package/esm/ui/HostChrome.scss
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type MouseEvent } from "react";
|
|
2
|
-
import { type IUser } from "@gooddata/sdk-model";
|
|
2
|
+
import { type IUser, type PluggableApplicationRegistryItem } from "@gooddata/sdk-model";
|
|
3
|
+
import { type IPlatformContext } from "@gooddata/sdk-pluggable-application-model";
|
|
3
4
|
/**
|
|
4
5
|
* Builds the display name shown for the current user in the host header.
|
|
5
6
|
*
|
|
@@ -16,6 +17,18 @@ export declare function getUserDisplayName(user: IUser): string;
|
|
|
16
17
|
* an organization-scoped route).
|
|
17
18
|
*/
|
|
18
19
|
export declare function swapWorkspaceInPath(pathname: string, newWorkspaceId: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the path a workspace switch made from `pathname` should land on: the active
|
|
22
|
+
* application's landing route in the new workspace.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* The whole in-app remainder of the path is dropped, screens as well as object ids. The host
|
|
26
|
+
* cannot tell them apart — it knows an application only by its route base — and a remainder
|
|
27
|
+
* kept across the switch carries ids of objects that exist in the old workspace only, which
|
|
28
|
+
* lands the user on a "not found" page. A path no workspace-scoped application claims keeps
|
|
29
|
+
* the plain workspace swap.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getWorkspaceSwitchPath(pathname: string, newWorkspaceId: string, apps: PluggableApplicationRegistryItem[], ctx: IPlatformContext): string;
|
|
19
32
|
/**
|
|
20
33
|
* Whether a click on a link may be taken over with `preventDefault`, rather than left to the
|
|
21
34
|
* browser's own handling of the href.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chromeHelpers.d.ts","sourceRoot":"","sources":["../../src/ui/chromeHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"chromeHelpers.d.ts","sourceRoot":"","sources":["../../src/ui/chromeHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAIlF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,CAStD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAGpF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAClC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,gCAAgC,EAAE,EACxC,GAAG,EAAE,gBAAgB,GACtB,MAAM,CAMR;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,CASpE"}
|
package/esm/ui/chromeHelpers.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { getActiveInternalApplication, getApplicationHref } from "../loader/routing.js";
|
|
2
3
|
/**
|
|
3
4
|
* Builds the display name shown for the current user in the host header.
|
|
4
5
|
*
|
|
@@ -27,6 +28,24 @@ export function swapWorkspaceInPath(pathname, newWorkspaceId) {
|
|
|
27
28
|
const replaced = pathname.replace(/^\/workspace\/[^/]+/, `/workspace/${newWorkspaceId}`);
|
|
28
29
|
return replaced === pathname ? `/workspace/${newWorkspaceId}` : replaced;
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns the path a workspace switch made from `pathname` should land on: the active
|
|
33
|
+
* application's landing route in the new workspace.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* The whole in-app remainder of the path is dropped, screens as well as object ids. The host
|
|
37
|
+
* cannot tell them apart — it knows an application only by its route base — and a remainder
|
|
38
|
+
* kept across the switch carries ids of objects that exist in the old workspace only, which
|
|
39
|
+
* lands the user on a "not found" page. A path no workspace-scoped application claims keeps
|
|
40
|
+
* the plain workspace swap.
|
|
41
|
+
*/
|
|
42
|
+
export function getWorkspaceSwitchPath(pathname, newWorkspaceId, apps, ctx) {
|
|
43
|
+
const activeApp = getActiveInternalApplication(apps, ctx, pathname);
|
|
44
|
+
if (activeApp?.applicationScope === "workspace") {
|
|
45
|
+
return getApplicationHref(activeApp, { ...ctx, currentWorkspaceId: newWorkspaceId });
|
|
46
|
+
}
|
|
47
|
+
return swapWorkspaceInPath(pathname, newWorkspaceId);
|
|
48
|
+
}
|
|
30
49
|
/**
|
|
31
50
|
* Whether a click on a link may be taken over with `preventDefault`, rather than left to the
|
|
32
51
|
* browser's own handling of the href.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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
|
+
import { GenAIAssistantMode } from "@gooddata/sdk-ui-gen-ai";
|
|
4
5
|
import { type GenAIChatEvent } from "./GenAIChat.js";
|
|
5
6
|
import { type IHostChromeWorkspaceFeatures } from "./useHostChromeWorkspaceFeatures.js";
|
|
6
7
|
export interface IHostChromeChat {
|
|
@@ -8,6 +9,10 @@ export interface IHostChromeChat {
|
|
|
8
9
|
element: ReactNode;
|
|
9
10
|
/** Whether the chat dialog is currently open. */
|
|
10
11
|
isOpen: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The mode of the chat dialog.
|
|
14
|
+
*/
|
|
15
|
+
mode: GenAIAssistantMode;
|
|
11
16
|
/**
|
|
12
17
|
* Whether the chat entry point should be visible in the header. Reflects both the
|
|
13
18
|
* feature-flag/permission gate and the runtime LLM availability probe.
|
|
@@ -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;
|
|
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,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,CAAC;CAC5D;AAED,MAAM,WAAW,sBAAsB;IACnC,QAAQ,EAAE,4BAA4B,CAAC;IACvC,GAAG,EAAE,gBAAgB,CAAC;IACtB,SAAS,EAAE,+BAA+B,GAAG,SAAS,CAAC;IACvD,+FAA+F;IAC/F,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yFAAyF;IACzF,cAAc,CAAC,EAAE,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;IACvG,wDAAwD;IACxD,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CACvD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAC9B,QAAQ,EACR,GAAG,EACH,SAAS,EACT,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,iBAAiB,GACpB,EAAE,sBAAsB,GAAG,eAAe,CAkI1C"}
|
|
@@ -17,6 +17,7 @@ export function useHostChromeChat({ features, ctx, telemetry, dialogPosition, em
|
|
|
17
17
|
const [appendToChat, setAppendToChat] = useState(false);
|
|
18
18
|
const [agentId, setAgentId] = useState(undefined);
|
|
19
19
|
const [replaceUserContext, setReplaceUserContext] = useState(false);
|
|
20
|
+
const [mode, setMode] = useState("docked");
|
|
20
21
|
// Bumped on every ask so the chat re-seeds (clears the thread + sends the message) even when the
|
|
21
22
|
// same prompt is asked again — e.g. "Summarize" clicked twice, or repeated after a close (the
|
|
22
23
|
// seeding effect is otherwise keyed on the question text, which does not change on a repeat).
|
|
@@ -62,6 +63,9 @@ export function useHostChromeChat({ features, ctx, telemetry, dialogPosition, em
|
|
|
62
63
|
}, []);
|
|
63
64
|
const handleChatEvent = useCallback((event) => {
|
|
64
65
|
telemetry?.trackEvent(event.name, event.payload);
|
|
66
|
+
if (event.name === "chat.mode-changed") {
|
|
67
|
+
setMode(event.payload.mode);
|
|
68
|
+
}
|
|
65
69
|
onAppEventReceive?.(event);
|
|
66
70
|
}, [telemetry, onAppEventReceive]);
|
|
67
71
|
const showChatItem = useGenAiChatAvailability(getBackend(), features.workspaceId, features.showChat, features.canManageProject);
|
|
@@ -70,6 +74,7 @@ export function useHostChromeChat({ features, ctx, telemetry, dialogPosition, em
|
|
|
70
74
|
element,
|
|
71
75
|
isOpen: isChatOpen,
|
|
72
76
|
showChatItem,
|
|
77
|
+
mode,
|
|
73
78
|
open,
|
|
74
79
|
close,
|
|
75
80
|
toggle,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-pluggable-host",
|
|
3
|
-
"version": "11.58.0-alpha.
|
|
3
|
+
"version": "11.58.0-alpha.4",
|
|
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.58.0-alpha.
|
|
33
|
-
"@gooddata/sdk-
|
|
34
|
-
"@gooddata/sdk-
|
|
35
|
-
"@gooddata/sdk-backend-tiger": "11.58.0-alpha.
|
|
36
|
-
"@gooddata/sdk-model": "11.58.0-alpha.
|
|
37
|
-
"@gooddata/sdk-pluggable-application-model": "11.58.0-alpha.
|
|
38
|
-
"@gooddata/sdk-ui
|
|
39
|
-
"@gooddata/sdk-ui": "11.58.0-alpha.
|
|
40
|
-
"@gooddata/sdk-ui-
|
|
41
|
-
"@gooddata/sdk-ui-gen-ai": "11.58.0-alpha.
|
|
42
|
-
"@gooddata/sdk-ui-kit": "11.58.0-alpha.
|
|
43
|
-
"@gooddata/sdk-ui-semantic-search": "11.58.0-alpha.
|
|
44
|
-
"@gooddata/sdk-ui-theme-provider": "11.58.0-alpha.
|
|
45
|
-
"@gooddata/util": "11.58.0-alpha.
|
|
32
|
+
"@gooddata/sdk-backend-base": "11.58.0-alpha.4",
|
|
33
|
+
"@gooddata/sdk-embedding": "11.58.0-alpha.4",
|
|
34
|
+
"@gooddata/sdk-backend-spi": "11.58.0-alpha.4",
|
|
35
|
+
"@gooddata/sdk-backend-tiger": "11.58.0-alpha.4",
|
|
36
|
+
"@gooddata/sdk-model": "11.58.0-alpha.4",
|
|
37
|
+
"@gooddata/sdk-pluggable-application-model": "11.58.0-alpha.4",
|
|
38
|
+
"@gooddata/sdk-ui": "11.58.0-alpha.4",
|
|
39
|
+
"@gooddata/sdk-ui-application-header": "11.58.0-alpha.4",
|
|
40
|
+
"@gooddata/sdk-ui-ext": "11.58.0-alpha.4",
|
|
41
|
+
"@gooddata/sdk-ui-gen-ai": "11.58.0-alpha.4",
|
|
42
|
+
"@gooddata/sdk-ui-kit": "11.58.0-alpha.4",
|
|
43
|
+
"@gooddata/sdk-ui-semantic-search": "11.58.0-alpha.4",
|
|
44
|
+
"@gooddata/sdk-ui-theme-provider": "11.58.0-alpha.4",
|
|
45
|
+
"@gooddata/util": "11.58.0-alpha.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@microsoft/api-documenter": "7.30.10",
|
|
@@ -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.58.0-alpha.4",
|
|
85
|
+
"@gooddata/eslint-config": "11.58.0-alpha.4"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"react": ">=18.3.1",
|