@carbon/ai-chat 1.4.4 → 1.5.0-rc.0
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/dist/es/aiChatEntry.js +41 -23
- package/dist/es/aiChatEntry.js.map +1 -1
- package/dist/es/chat.ChatAppEntry.js +4589 -3950
- package/dist/es/chat.ChatAppEntry.js.map +1 -1
- package/dist/es/{chat.languages.js → chat.languageUtils.js} +15 -24
- package/dist/es/chat.languageUtils.js.map +1 -0
- package/dist/es/serverEntry.js +3 -5
- package/dist/es/serverEntry.js.map +1 -1
- package/dist/es/web-components/cds-aichat-container/index.js +41 -20
- package/dist/es/web-components/cds-aichat-container/index.js.map +1 -1
- package/dist/es/web-components/cds-aichat-custom-element/index.js +38 -17
- package/dist/es/web-components/cds-aichat-custom-element/index.js.map +1 -1
- package/dist/es-custom/aiChatEntry.js +41 -23
- package/dist/es-custom/aiChatEntry.js.map +1 -1
- package/dist/es-custom/chat.ChatAppEntry.js +4589 -3950
- package/dist/es-custom/chat.ChatAppEntry.js.map +1 -1
- package/dist/es-custom/{chat.languages.js → chat.languageUtils.js} +15 -24
- package/dist/es-custom/chat.languageUtils.js.map +1 -0
- package/dist/es-custom/serverEntry.js +3 -5
- package/dist/es-custom/serverEntry.js.map +1 -1
- package/dist/es-custom/web-components/cds-aichat-container/index.js +41 -20
- package/dist/es-custom/web-components/cds-aichat-container/index.js.map +1 -1
- package/dist/es-custom/web-components/cds-aichat-custom-element/index.js +38 -17
- package/dist/es-custom/web-components/cds-aichat-custom-element/index.js.map +1 -1
- package/dist/types/aiChatEntry.d.ts +3 -3
- package/dist/types/{serverEntry-BBTNDChc.d.ts → serverEntry-CwwZQCSX.d.ts} +241 -13
- package/dist/types/serverEntry.d.ts +2 -2
- package/package.json +5 -5
- package/dist/es/chat.languages.js.map +0 -1
- package/dist/es-custom/chat.languages.js.map +0 -1
package/dist/es/serverEntry.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { p as normalizeModuleInterop, q as localeLoaders } from "./chat.
|
|
1
|
+
import { p as normalizeModuleInterop, q as localeLoaders } from "./chat.languageUtils.js";
|
|
2
2
|
|
|
3
|
-
export { B as BusEventType, h as ButtonItemKind, i as ButtonItemType, c as CancellationReason, d as CarbonTheme, C as CornersType, E as ErrorType, F as FeedbackInteractionType, g as FileStatusValue, n as HumanAgentMessageType, H as HumanAgentsOnlineStatus, I as IFrameItemDisplayOption, o as MessageErrorState, j as MessageInputType, k as MessageResponseTypes, M as MessageSendSource, f as MinimizeButtonIconType, O as OnErrorType, l as OptionItemPreference, P as PageObjectId, a as PanelType, R as ReasoningStepOpenState, S as ScreenShareState, U as UserType, b as ViewChangeReason, V as ViewType, m as WidthOptions, W as WriteableElementName, e as enLanguagePack } from "./chat.
|
|
3
|
+
export { B as BusEventType, h as ButtonItemKind, i as ButtonItemType, c as CancellationReason, d as CarbonTheme, C as CornersType, E as ErrorType, F as FeedbackInteractionType, g as FileStatusValue, n as HumanAgentMessageType, H as HumanAgentsOnlineStatus, I as IFrameItemDisplayOption, o as MessageErrorState, j as MessageInputType, k as MessageResponseTypes, M as MessageSendSource, f as MinimizeButtonIconType, O as OnErrorType, l as OptionItemPreference, P as PageObjectId, a as PanelType, R as ReasoningStepOpenState, S as ScreenShareState, U as UserType, b as ViewChangeReason, V as ViewType, m as WidthOptions, W as WriteableElementName, e as enLanguagePack } from "./chat.languageUtils.js";
|
|
4
4
|
|
|
5
5
|
import { loadAllLazyDeps as loadAllLazyDeps$1 } from "@carbon/ai-chat-components/es/testing/load-all-lazy-deps.js";
|
|
6
6
|
|
|
7
7
|
export { L as LayoutCustomProperties } from "./chat.LayoutCustomProperties.js";
|
|
8
8
|
|
|
9
|
-
export { ChainOfThoughtStepStatus } from "@carbon/ai-chat-components/es/components/chain-of-thought/
|
|
9
|
+
export { ChainOfThoughtStepStatus } from "@carbon/ai-chat-components/es/components/chain-of-thought/defs.js";
|
|
10
10
|
|
|
11
11
|
import "dayjs";
|
|
12
12
|
|
|
13
13
|
import "dayjs/locale/en.js";
|
|
14
14
|
|
|
15
|
-
import "react";
|
|
16
|
-
|
|
17
15
|
async function preloadSwiper() {
|
|
18
16
|
await Promise.all([ import("swiper/react"), import("swiper/modules") ]);
|
|
19
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverEntry.js","sources":["../../../../src/testing/helpers.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Testing entry-point used by `@carbon/ai-chat/server` consumers to preload\n * every lazy dependency (components + chat package) before running Jest/Vitest\n * or server-rendered scenarios. Having a single central helper keeps component\n * loaders in sync and prevents duplicate preload logic from drifting.\n */\n\n// Reuse the component-level preload helper so CodeMirror/DataTable deps stay in sync.\nimport { loadAllLazyDeps as loadComponentLazyDeps } from \"@carbon/ai-chat-components/es/testing/load-all-lazy-deps.js\";\nimport { normalizeModuleInterop } from \"../chat/utils/moduleInterop.js\";\nimport { localeLoaders } from \"../chat/utils/
|
|
1
|
+
{"version":3,"file":"serverEntry.js","sources":["../../../../src/testing/helpers.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Testing entry-point used by `@carbon/ai-chat/server` consumers to preload\n * every lazy dependency (components + chat package) before running Jest/Vitest\n * or server-rendered scenarios. Having a single central helper keeps component\n * loaders in sync and prevents duplicate preload logic from drifting.\n */\n\n// Reuse the component-level preload helper so CodeMirror/DataTable deps stay in sync.\nimport { loadAllLazyDeps as loadComponentLazyDeps } from \"@carbon/ai-chat-components/es/testing/load-all-lazy-deps.js\";\nimport { normalizeModuleInterop } from \"../chat/utils/moduleInterop.js\";\nimport { localeLoaders } from \"../chat/utils/languageUtils.js\";\n\nasync function preloadSwiper() {\n await Promise.all([import(\"swiper/react\"), import(\"swiper/modules\")]);\n}\n\nasync function preloadReactPlayer() {\n // Node's dynamic import returns a namespace object for CommonJS modules; normalize it.\n const reactPlayerModule = await import(\"react-player/lazy/index.js\");\n normalizeModuleInterop(reactPlayerModule);\n}\n\nasync function preloadColor() {\n const colorModule = await import(\"color\");\n normalizeModuleInterop(colorModule);\n}\n\nasync function preloadDayjsLocales() {\n await Promise.all(Object.values(localeLoaders).map((loader) => loader()));\n}\n\n/**\n * Eagerly loads every lazily imported dependency across both\n * `@carbon/ai-chat-components` and `@carbon/ai-chat` so tests can preload\n * everything they need (Jest, Vitest, server rendering, etc.). Only available\n * from `@carbon/ai-chat/server`.\n *\n * @category Testing\n */\nasync function loadAllLazyDeps(): Promise<void> {\n await Promise.all([\n loadComponentLazyDeps(),\n preloadSwiper(),\n preloadReactPlayer(),\n preloadColor(),\n preloadDayjsLocales(),\n ]);\n}\n\nexport { loadAllLazyDeps };\n"],"names":["async","preloadSwiper","Promise","all","import","preloadReactPlayer","reactPlayerModule","normalizeModuleInterop","preloadColor","colorModule","preloadDayjsLocales","Object","values","localeLoaders","map","loader","loadAllLazyDeps","loadComponentLazyDeps"],"mappings":";;;;;;;;;;;;;;AAqBAA,eAAeC;QACPC,QAAQC,IAAI,EAACC,OAAO,iBAAiBA,OAAO;AACpD;;AAEAJ,eAAeK;EAEb,MAAMC,0BAA0BF,OAAO;EACvCG,uBAAuBD;AACzB;;AAEAN,eAAeQ;EACb,MAAMC,oBAAoBL,OAAO;EACjCG,uBAAuBE;AACzB;;AAEAT,eAAeU;QACPR,QAAQC,IAAIQ,OAAOC,OAAOC,eAAeC,IAAKC,UAAWA;AACjE;;AAUAf,eAAegB;QACPd,QAAQC,IAAI,EAChBc,qBACAhB,iBACAI,sBACAG,gBACAE;AAEJ;;"}
|
|
@@ -8,14 +8,22 @@ import React from "react";
|
|
|
8
8
|
|
|
9
9
|
import { createRoot } from "react-dom/client";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { C as ChatAppEntry } from "../../chat.ChatAppEntry.js";
|
|
12
12
|
|
|
13
13
|
import { carbonElement } from "@carbon/ai-chat-components/es/globals/decorators/index.js";
|
|
14
14
|
|
|
15
|
-
import { B as BusEventType } from "../../chat.
|
|
15
|
+
import { B as BusEventType } from "../../chat.languageUtils.js";
|
|
16
16
|
|
|
17
17
|
import "lodash-es/isEqual.js";
|
|
18
18
|
|
|
19
|
+
import "react-intl";
|
|
20
|
+
|
|
21
|
+
import "use-sync-external-store/shim";
|
|
22
|
+
|
|
23
|
+
import "compute-scroll-into-view";
|
|
24
|
+
|
|
25
|
+
import "tabbable";
|
|
26
|
+
|
|
19
27
|
import "dayjs";
|
|
20
28
|
|
|
21
29
|
import "dayjs/plugin/localizedFormat.js";
|
|
@@ -26,22 +34,16 @@ import "lodash-es/cloneDeep.js";
|
|
|
26
34
|
|
|
27
35
|
import "lodash-es/mergeWith.js";
|
|
28
36
|
|
|
29
|
-
import "react-intl";
|
|
30
|
-
|
|
31
37
|
import "react-dom";
|
|
32
38
|
|
|
33
39
|
import "classnames";
|
|
34
40
|
|
|
35
|
-
import "use-sync-external-store/shim";
|
|
36
|
-
|
|
37
|
-
import "compute-scroll-into-view";
|
|
38
|
-
|
|
39
|
-
import "tabbable";
|
|
40
|
-
|
|
41
41
|
import "focus-trap-react";
|
|
42
42
|
|
|
43
43
|
import "lodash-es/throttle.js";
|
|
44
44
|
|
|
45
|
+
import "lodash-es/debounce.js";
|
|
46
|
+
|
|
45
47
|
import "@carbon/icons/es/down-to-bottom/16.js";
|
|
46
48
|
|
|
47
49
|
import "@carbon/icons/es/screen--off/16.js";
|
|
@@ -62,12 +64,12 @@ import "@carbon/icons/es/checkmark--filled/16.js";
|
|
|
62
64
|
|
|
63
65
|
import "@carbon/icons/es/headset/32.js";
|
|
64
66
|
|
|
65
|
-
import "@carbon/icons/es/chevron--down/16.js";
|
|
66
|
-
|
|
67
67
|
import "@carbon/ai-chat-components/es/react/reasoning-steps.js";
|
|
68
68
|
|
|
69
69
|
import "@carbon/ai-chat-components/es/react/reasoning-step.js";
|
|
70
70
|
|
|
71
|
+
import "@carbon/ai-chat-components/es/react/reasoning-steps-toggle.js";
|
|
72
|
+
|
|
71
73
|
import "@carbon/web-components/es/components/loading/loading-icon.js";
|
|
72
74
|
|
|
73
75
|
import "@carbon/web-components/es/components/loading/loading.js";
|
|
@@ -102,6 +104,8 @@ import "@carbon/web-components/es/components/skeleton-text/skeleton-text.js";
|
|
|
102
104
|
|
|
103
105
|
import "@carbon/web-components/es/components/skeleton-placeholder/skeleton-placeholder.js";
|
|
104
106
|
|
|
107
|
+
import "@carbon/icons/es/chevron--down/16.js";
|
|
108
|
+
|
|
105
109
|
import "@carbon/icons/es/chevron--up/16.js";
|
|
106
110
|
|
|
107
111
|
import "@carbon/icons/es/touch--interaction/16.js";
|
|
@@ -118,16 +122,18 @@ import "@carbon/icons/es/launch/16.js";
|
|
|
118
122
|
|
|
119
123
|
import "@carbon/web-components/es/components/link/link.js";
|
|
120
124
|
|
|
125
|
+
import "@carbon/ai-chat-components/es/react/card.js";
|
|
126
|
+
|
|
127
|
+
import "@carbon/icons/es/maximize/16.js";
|
|
128
|
+
|
|
129
|
+
import "@carbon/icons/es/view/16.js";
|
|
130
|
+
|
|
121
131
|
import "@carbon/icons/es/chevron--left/16.js";
|
|
122
132
|
|
|
123
133
|
import "@carbon/icons/es/chevron--right/16.js";
|
|
124
134
|
|
|
125
|
-
import "lodash-es/debounce.js";
|
|
126
|
-
|
|
127
135
|
import "@carbon/icons/es/link/16.js";
|
|
128
136
|
|
|
129
|
-
import "@carbon/icons/es/maximize/16.js";
|
|
130
|
-
|
|
131
137
|
import "@carbon/web-components/es/components/tag/operational-tag.js";
|
|
132
138
|
|
|
133
139
|
import "@carbon/icons/es/checkmark/32.js";
|
|
@@ -144,6 +150,12 @@ import "@carbon/web-components/es/components/dropdown/dropdown-item.js";
|
|
|
144
150
|
|
|
145
151
|
import "@carbon/ai-chat-components/es/react/chain-of-thought.js";
|
|
146
152
|
|
|
153
|
+
import "@carbon/ai-chat-components/es/react/chain-of-thought-step.js";
|
|
154
|
+
|
|
155
|
+
import "@carbon/ai-chat-components/es/react/chain-of-thought-toggle.js";
|
|
156
|
+
|
|
157
|
+
import "@carbon/ai-chat-components/es/react/tool-call-data.js";
|
|
158
|
+
|
|
147
159
|
import "@carbon/ai-chat-components/es/react/processing.js";
|
|
148
160
|
|
|
149
161
|
import "@carbon/icons/es/restart/16.js";
|
|
@@ -186,7 +198,9 @@ import "@carbon/web-components/es/globals/internal/icon-loader.js";
|
|
|
186
198
|
|
|
187
199
|
import "@carbon/icons/es/stop--filled/16.js";
|
|
188
200
|
|
|
189
|
-
import "@carbon/web-components/es/components/
|
|
201
|
+
import "@carbon/web-components/es/components/modal/modal.js";
|
|
202
|
+
|
|
203
|
+
import "@carbon/web-components/es/components/modal/modal-body.js";
|
|
190
204
|
|
|
191
205
|
import "@carbon/icons/es/ai-launch/24.js";
|
|
192
206
|
|
|
@@ -194,14 +208,16 @@ import "@carbon/icons/es/chat--launch/24.js";
|
|
|
194
208
|
|
|
195
209
|
import "@carbon/icons/es/close/16.js";
|
|
196
210
|
|
|
197
|
-
import "@carbon/
|
|
211
|
+
import "@carbon/web-components/es/components/layer/layer.js";
|
|
212
|
+
|
|
213
|
+
import "@carbon/ai-chat-components/es/components/chain-of-thought/defs.js";
|
|
198
214
|
|
|
199
215
|
import "dayjs/locale/en.js";
|
|
200
216
|
|
|
201
217
|
let ChatContainerInternal = class ChatContainerInternal extends LitElement {
|
|
202
218
|
firstUpdated() {
|
|
203
219
|
const style = document.createElement("style");
|
|
204
|
-
style.textContent = `\n :host {\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n ${this.element ? "" : "z-index: var(--cds-aichat-z-index);"}\n }\n `;
|
|
220
|
+
style.textContent = `\n :host {\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n ${this.element ? "" : "z-index: var(--cds-aichat-z-index);"}\n }\n [slot="workspacePanelElement"] {\n block-size: 100%;\n }\n `;
|
|
205
221
|
this.appendChild(style);
|
|
206
222
|
if (this.config) {
|
|
207
223
|
this.renderReactApp();
|
|
@@ -214,7 +230,7 @@ let ChatContainerInternal = class ChatContainerInternal extends LitElement {
|
|
|
214
230
|
}
|
|
215
231
|
async renderReactApp() {
|
|
216
232
|
const container = this.ensureReactRoot();
|
|
217
|
-
this.root.render(React.createElement(
|
|
233
|
+
this.root.render(React.createElement(ChatAppEntry, {
|
|
218
234
|
config: this.config,
|
|
219
235
|
strings: this.strings,
|
|
220
236
|
serviceDeskFactory: this.serviceDeskFactory,
|
|
@@ -294,6 +310,11 @@ let ChatContainer = class ChatContainer extends LitElement {
|
|
|
294
310
|
await (this.onBeforeRender?.(instance));
|
|
295
311
|
};
|
|
296
312
|
}
|
|
313
|
+
firstUpdated() {
|
|
314
|
+
const style = document.createElement("style");
|
|
315
|
+
style.textContent = `\n [slot="workspacePanelElement"] {\n block-size: 100%;\n }\n `;
|
|
316
|
+
this.appendChild(style);
|
|
317
|
+
}
|
|
297
318
|
get resolvedConfig() {
|
|
298
319
|
const baseConfig = this.config ?? {};
|
|
299
320
|
const resolvedConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../src/web-components/cds-aichat-container/cds-aichat-internal.tsx","../../../../../../src/web-components/cds-aichat-container/index.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * This component is mostly a pass-through. Its takes any properties passed into the ChatContainer\n * custom element and then renders the React Carbon AI Chat application while passing in properties.\n */\n\nimport { LitElement, PropertyValues } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport React from \"react\";\nimport { createRoot, Root } from \"react-dom/client\";\n\nimport App from \"../../chat/ChatAppEntry\";\nimport { carbonElement } from \"@carbon/ai-chat-components/es/globals/decorators/index.js\";\nimport { PublicConfig } from \"../../types/config/PublicConfig\";\nimport { ChatInstance } from \"../../types/instance/ChatInstance\";\nimport { DeepPartial } from \"../../types/utilities/DeepPartial\";\nimport { LanguagePack } from \"../../types/config/PublicConfig\";\nimport type {\n ServiceDesk,\n ServiceDeskFactoryParameters,\n ServiceDeskPublicConfig,\n} from \"../../types/config/ServiceDeskConfig\";\n\n@carbonElement(\"cds-aichat-internal\")\nclass ChatContainerInternal extends LitElement {\n /**\n * The config to use to load Carbon AI Chat. Note that the \"onLoad\" property is overridden by this component. If you\n * need to perform any actions after Carbon AI Chat been loaded, use the \"onBeforeRender\" or \"onAfterRender\" props.\n */\n @property({ type: Object })\n config: PublicConfig;\n\n /** Optional partial language pack overrides */\n @property({ type: Object })\n strings?: DeepPartial<LanguagePack>;\n\n /** A factory for the {@link ServiceDesk} integration. */\n @property({ attribute: false })\n serviceDeskFactory?: (\n parameters: ServiceDeskFactoryParameters,\n ) => Promise<ServiceDesk>;\n\n /** Public configuration for the service desk integration. */\n @property({ type: Object })\n serviceDesk?: ServiceDeskPublicConfig;\n\n /**\n * The optional HTML element to mount the chat to.\n */\n @property({ type: HTMLElement })\n element?: HTMLElement;\n\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property()\n onBeforeRender: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property()\n onAfterRender: (instance: ChatInstance) => Promise<void> | void;\n\n firstUpdated() {\n // Render the React component with any updated properties if necessary\n const style = document.createElement(\"style\");\n style.textContent = `\n :host {\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n ${this.element ? \"\" : \"z-index: var(--cds-aichat-z-index);\"}\n }\n `;\n this.appendChild(style);\n if (this.config) {\n this.renderReactApp();\n }\n }\n\n updated(changedProperties: PropertyValues) {\n // Re-render React app when config or other properties change\n if (\n this.config &&\n (changedProperties.has(\"config\") ||\n changedProperties.has(\"strings\") ||\n changedProperties.has(\"serviceDeskFactory\") ||\n changedProperties.has(\"serviceDesk\") ||\n changedProperties.has(\"onBeforeRender\") ||\n changedProperties.has(\"onAfterRender\") ||\n changedProperties.has(\"element\"))\n ) {\n this.renderReactApp();\n }\n }\n\n /**\n * Track if a previous React 18+ root was already created so we don't create a memory leak on re-renders.\n */\n root: Root;\n\n /**\n * Cache the container we hand to React so we can reuse it between renders.\n */\n reactContainer?: HTMLDivElement;\n\n async renderReactApp() {\n const container = this.ensureReactRoot();\n\n this.root.render(\n <App\n config={this.config}\n strings={this.strings}\n serviceDeskFactory={this.serviceDeskFactory}\n serviceDesk={this.serviceDesk}\n onBeforeRender={this.onBeforeRender}\n onAfterRender={this.onAfterRender}\n container={container}\n element={this.element}\n />,\n );\n }\n\n private ensureReactRoot(): HTMLDivElement {\n if (!this.reactContainer) {\n const container = document.createElement(\"div\");\n container.classList.add(\"cds-aichat--react-app\");\n this.shadowRoot.appendChild(container);\n this.reactContainer = container;\n }\n\n // Make sure we only create one root and reuse it for prop updates.\n if (!this.root) {\n this.root = createRoot(this.reactContainer);\n }\n\n return this.reactContainer;\n }\n\n disconnectedCallback(): void {\n this.root?.unmount();\n super.disconnectedCallback();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"cds-aichat-internal\": ChatContainerInternal;\n }\n}\n\nexport default ChatContainerInternal;\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * This is the exposed web component for a basic floating chat.\n */\n\nimport \"./cds-aichat-internal\";\n\nimport { html, LitElement } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n\nimport { carbonElement } from \"@carbon/ai-chat-components/es/globals/decorators/index.js\";\nimport {\n PublicConfig,\n OnErrorData,\n DisclaimerPublicConfig,\n CarbonTheme,\n HeaderConfig,\n LayoutConfig,\n PublicConfigMessaging,\n InputConfig,\n} from \"../../types/config/PublicConfig\";\nimport { DeepPartial } from \"../../types/utilities/DeepPartial\";\nimport { LanguagePack } from \"../../types/config/PublicConfig\";\nimport { HomeScreenConfig } from \"../../types/config/HomeScreenConfig\";\nimport { LauncherConfig } from \"../../types/config/LauncherConfig\";\nimport type {\n ServiceDesk,\n ServiceDeskFactoryParameters,\n ServiceDeskPublicConfig,\n} from \"../../types/config/ServiceDeskConfig\";\nimport { ChatInstance } from \"../../types/instance/ChatInstance\";\nimport {\n BusEventChunkUserDefinedResponse,\n BusEventType,\n BusEventUserDefinedResponse,\n} from \"../../types/events/eventBusTypes\";\n\n/**\n * The cds-aichat-container managing creating slotted elements for user_defined responses and writable elements.\n * It then passes that slotted content into cds-aichat-internal. That component will boot up the full chat application\n * and pass the slotted elements into their slots.\n */\n@carbonElement(\"cds-aichat-container\")\nclass ChatContainer extends LitElement {\n @property({ attribute: false, type: Object })\n config?: PublicConfig;\n\n // Flattened PublicConfig properties\n @property({ attribute: false })\n onError?: (data: OnErrorData) => void;\n\n @property({ type: Boolean, attribute: \"open-chat-by-default\" })\n openChatByDefault?: boolean;\n\n @property({ type: Object })\n disclaimer?: DisclaimerPublicConfig;\n\n @property({\n type: Boolean,\n attribute: \"disable-custom-element-mobile-enhancements\",\n })\n disableCustomElementMobileEnhancements?: boolean;\n\n @property({ type: Boolean })\n debug?: boolean;\n\n @property({ type: Boolean, attribute: \"expose-service-manager-for-testing\" })\n exposeServiceManagerForTesting?: boolean;\n\n @property({ type: String, attribute: \"inject-carbon-theme\" })\n injectCarbonTheme?: CarbonTheme;\n\n @property({\n attribute: \"ai-enabled\",\n // Custom converter so HTML authors can write ai-enabled=\"false\" | \"0\" | \"off\" | \"no\"\n // and absence keeps it undefined (so defaults apply further down the stack).\n converter: {\n fromAttribute: (value: string | null) => {\n if (value === null) {\n return undefined; // attribute absent -> leave undefined to use defaults\n }\n const v = String(value).trim().toLowerCase();\n const falsey = v === \"false\" || v === \"0\" || v === \"off\" || v === \"no\";\n // Any presence that's not an explicit falsey string is treated as true\n return !falsey;\n },\n },\n })\n aiEnabled?: boolean;\n\n // Optional explicit opt-out attribute. If present, it wins over ai-enabled.\n @property({ type: Boolean, attribute: \"ai-disabled\" })\n aiDisabled?: boolean;\n\n @property({\n type: Boolean,\n attribute: \"should-take-focus-if-opens-automatically\",\n })\n shouldTakeFocusIfOpensAutomatically?: boolean;\n\n @property({ type: String })\n namespace?: string;\n\n @state()\n private enableFocusTrap?: boolean;\n\n @property({ type: Boolean, attribute: \"should-sanitize-html\" })\n shouldSanitizeHTML?: boolean;\n\n @property({ type: Object })\n header?: HeaderConfig;\n\n @property({ type: Object })\n input?: InputConfig;\n\n @property({ type: Object })\n layout?: LayoutConfig;\n\n @property({ type: Object })\n messaging?: PublicConfigMessaging;\n\n @property({ type: Boolean, attribute: \"is-readonly\" })\n isReadonly?: boolean;\n\n @property({ type: String, attribute: \"assistant-name\" })\n assistantName?: string;\n\n @property({ type: String })\n locale?: string;\n\n @property({ type: Object })\n homescreen?: HomeScreenConfig;\n\n @property({ type: Object })\n launcher?: LauncherConfig;\n\n /** Optional partial language pack overrides */\n @property({ type: Object })\n strings?: DeepPartial<LanguagePack>;\n\n /**\n * A factory to create a {@link ServiceDesk} integration instance.\n */\n @property({ attribute: false })\n serviceDeskFactory?: (\n parameters: ServiceDeskFactoryParameters,\n ) => Promise<ServiceDesk>;\n\n /**\n * Public configuration for the service desk integration.\n */\n @property({ type: Object, attribute: \"service-desk\" })\n serviceDesk?: ServiceDeskPublicConfig;\n\n /**\n * The element to render to instead of the default float element.\n *\n * @internal\n */\n @property({ type: HTMLElement })\n element?: HTMLElement;\n\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property({ attribute: false })\n onBeforeRender: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called.\n */\n @property({ attribute: false })\n onAfterRender: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * The existing array of slot names for all user_defined components.\n */\n @state()\n _userDefinedSlotNames: string[] = [];\n\n /**\n * The existing array of slot names for all writeable elements.\n */\n @state()\n _writeableElementSlots: string[] = [];\n\n /**\n * The chat instance.\n */\n @state()\n _instance: ChatInstance;\n\n /**\n * Adds the slot attribute to the element for the user_defined response type and then injects it into the component by\n * updating this._userDefinedSlotNames;\n */\n userDefinedHandler = (\n event: BusEventUserDefinedResponse | BusEventChunkUserDefinedResponse,\n ) => {\n // This element already has `slot` as an attribute.\n const { slot } = event.data;\n if (!this._userDefinedSlotNames.includes(slot)) {\n this._userDefinedSlotNames = [...this._userDefinedSlotNames, slot];\n }\n };\n\n private get resolvedConfig(): PublicConfig {\n const baseConfig = this.config ?? {};\n const resolvedConfig: PublicConfig = { ...baseConfig };\n\n if (this.onError !== undefined) {\n resolvedConfig.onError = this.onError;\n }\n if (this.openChatByDefault !== undefined) {\n resolvedConfig.openChatByDefault = this.openChatByDefault;\n }\n if (this.disclaimer !== undefined) {\n resolvedConfig.disclaimer = this.disclaimer;\n }\n if (this.disableCustomElementMobileEnhancements !== undefined) {\n resolvedConfig.disableCustomElementMobileEnhancements =\n this.disableCustomElementMobileEnhancements;\n }\n if (this.debug !== undefined) {\n resolvedConfig.debug = this.debug;\n }\n if (this.exposeServiceManagerForTesting !== undefined) {\n resolvedConfig.exposeServiceManagerForTesting =\n this.exposeServiceManagerForTesting;\n }\n if (this.injectCarbonTheme !== undefined) {\n resolvedConfig.injectCarbonTheme = this.injectCarbonTheme;\n }\n if (this.serviceDeskFactory !== undefined) {\n resolvedConfig.serviceDeskFactory = this.serviceDeskFactory;\n }\n if (this.serviceDesk !== undefined) {\n resolvedConfig.serviceDesk = this.serviceDesk;\n }\n if (this.shouldTakeFocusIfOpensAutomatically !== undefined) {\n resolvedConfig.shouldTakeFocusIfOpensAutomatically =\n this.shouldTakeFocusIfOpensAutomatically;\n }\n if (this.namespace !== undefined) {\n resolvedConfig.namespace = this.namespace;\n }\n if (this.enableFocusTrap !== undefined) {\n resolvedConfig.enableFocusTrap = this.enableFocusTrap;\n }\n if (this.shouldSanitizeHTML !== undefined) {\n resolvedConfig.shouldSanitizeHTML = this.shouldSanitizeHTML;\n }\n if (this.header !== undefined) {\n resolvedConfig.header = this.header;\n }\n if (this.input !== undefined) {\n resolvedConfig.input = this.input;\n }\n if (this.layout !== undefined) {\n resolvedConfig.layout = this.layout;\n }\n if (this.messaging !== undefined) {\n resolvedConfig.messaging = this.messaging;\n }\n if (this.isReadonly !== undefined) {\n resolvedConfig.isReadonly = this.isReadonly;\n }\n if (this.assistantName !== undefined) {\n resolvedConfig.assistantName = this.assistantName;\n }\n if (this.locale !== undefined) {\n resolvedConfig.locale = this.locale;\n }\n if (this.homescreen !== undefined) {\n resolvedConfig.homescreen = this.homescreen;\n }\n if (this.launcher !== undefined) {\n resolvedConfig.launcher = this.launcher;\n }\n if (this.strings !== undefined) {\n resolvedConfig.strings = this.strings;\n }\n\n if (this.aiDisabled === true) {\n resolvedConfig.aiEnabled = false;\n } else if (this.aiEnabled !== undefined) {\n resolvedConfig.aiEnabled = this.aiEnabled;\n }\n\n return resolvedConfig;\n }\n\n onBeforeRenderOverride = async (instance: ChatInstance) => {\n this._instance = instance;\n this._instance.on({\n type: BusEventType.USER_DEFINED_RESPONSE,\n handler: this.userDefinedHandler,\n });\n this._instance.on({\n type: BusEventType.CHUNK_USER_DEFINED_RESPONSE,\n handler: this.userDefinedHandler,\n });\n this.addWriteableElementSlots();\n await this.onBeforeRender?.(instance);\n };\n\n addWriteableElementSlots() {\n const writeableElementSlots: string[] = [];\n Object.keys(this._instance.writeableElements).forEach(\n (writeableElementKey) => {\n writeableElementSlots.push(writeableElementKey);\n },\n );\n this._writeableElementSlots = writeableElementSlots;\n }\n\n /**\n * Renders the template while passing in class functionality\n */\n render() {\n return html`<cds-aichat-internal\n .config=${this.resolvedConfig}\n .onAfterRender=${this.onAfterRender}\n .onBeforeRender=${this.onBeforeRenderOverride}\n .element=${this.element}\n >\n ${this._writeableElementSlots.map(\n (slot) => html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n ${this._userDefinedSlotNames.map(\n (slot) => html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n </cds-aichat-internal>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"cds-aichat-container\": ChatContainer;\n }\n}\n\n/**\n * Attributes interface for the cds-aichat-container web component.\n * This interface extends {@link PublicConfig} with additional component-specific props,\n * flattening all config properties as top-level properties for better TypeScript IntelliSense.\n *\n * @category Web component\n */\ninterface CdsAiChatContainerAttributes extends PublicConfig {\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n onBeforeRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called.\n */\n onAfterRender?: (instance: ChatInstance) => Promise<void> | void;\n}\n\nexport { CdsAiChatContainerAttributes };\nexport default ChatContainer;\n"],"names":["ChatContainerInternal","LitElement","firstUpdated","style","document","createElement","textContent","this","element","appendChild","config","renderReactApp","updated","changedProperties","has","container","ensureReactRoot","root","render","React","App","strings","serviceDeskFactory","serviceDesk","onBeforeRender","onAfterRender","reactContainer","classList","add","shadowRoot","createRoot","disconnectedCallback","unmount","super","__decorate","property","type","Object","prototype","attribute","HTMLElement","carbonElement","ChatContainer","constructor","_userDefinedSlotNames","_writeableElementSlots","userDefinedHandler","event","slot","data","includes","onBeforeRenderOverride","async","instance","_instance","on","BusEventType","USER_DEFINED_RESPONSE","handler","CHUNK_USER_DEFINED_RESPONSE","addWriteableElementSlots","resolvedConfig","baseConfig","onError","undefined","openChatByDefault","disclaimer","disableCustomElementMobileEnhancements","debug","exposeServiceManagerForTesting","injectCarbonTheme","shouldTakeFocusIfOpensAutomatically","namespace","enableFocusTrap","shouldSanitizeHTML","header","input","layout","messaging","isReadonly","assistantName","locale","homescreen","launcher","aiDisabled","aiEnabled","writeableElementSlots","keys","writeableElements","forEach","writeableElementKey","push","html","map","Boolean","String","converter","fromAttribute","value","v","trim","toLowerCase","falsey","state","ChatContainer_default"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAMA,wBAAN,MAAMA,8BAA8BC;EA0ClC,YAAAC;IAEE,MAAMC,QAAQC,SAASC,cAAc;IACrCF,MAAMG,cAAc,mIAMdC,KAAKC,UAAU,KAAK;IAG1BD,KAAKE,YAAYN;IACjB,IAAII,KAAKG,QAAQ;MACfH,KAAKI;AACP;AACF;EAEA,OAAAC,CAAQC;IAEN,IACEN,KAAKG,WACJG,kBAAkBC,IAAI,aACrBD,kBAAkBC,IAAI,cACtBD,kBAAkBC,IAAI,yBACtBD,kBAAkBC,IAAI,kBACtBD,kBAAkBC,IAAI,qBACtBD,kBAAkBC,IAAI,oBACtBD,kBAAkBC,IAAI,aACxB;MACAP,KAAKI;AACP;AACF;EAYA,oBAAMA;IACJ,MAAMI,YAAYR,KAAKS;IAEvBT,KAAKU,KAAKC,OACRC,oBAACC,KAAG;MACFV,QAAQH,KAAKG;MACbW,SAASd,KAAKc;MACdC,oBAAoBf,KAAKe;MACzBC,aAAahB,KAAKgB;MAClBC,gBAAgBjB,KAAKiB;MACrBC,eAAelB,KAAKkB;MACpBV;MACAP,SAASD,KAAKC;;AAGpB;EAEQ,eAAAQ;IACN,KAAKT,KAAKmB,gBAAgB;MACxB,MAAMX,YAAYX,SAASC,cAAc;MACzCU,UAAUY,UAAUC,IAAI;MACxBrB,KAAKsB,WAAWpB,YAAYM;MAC5BR,KAAKmB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cAAAJ,WAAA;;AAGtBJ,WAAA,EADCC,SAAS;EAAEC,MAAMC;MACgBK,cAAAJ,WAAA;;AAGlCJ,WAAA,EADCC,SAAS;EAAEC,MAAM0D;EAASvD,WAAW;MACjBG,cAAAJ,WAAA;;AAGrBJ,WAAA,EADCC,SAAS;EAAEC,MAAM2D;EAAQxD,WAAW;MACdG,cAAAJ,WAAA;;AAGvBJ,WAAA,EADCC,SAAS;EAAEC,MAAM2D;MACFrD,cAAAJ,WAAA;;AAGhBJ,WAAA,EADCC,SAAS;EAAEC,MAAMC;MACYK,cAAAJ,WAAA;;AAG9BJ,WAAA,EADCC,SAAS;EAAEC,MAAMC;MACQK,cAAAJ,WAAA;;AAI1BJ,WAAA,EADCC,SAAS;EAAEC,MAAMC;MACkBK,cAAAJ,WAAA;;AAMpCJ,WAAA,EADCC,SAAS;EAAEI,WAAW;MAGGG,cAAAJ,WAAA;;AAM1BJ,WAAA,EADCC,SAAS;EAAEC,MAAMC;EAAQE,WAAW;MACCG,cAAAJ,WAAA;;AAQtCJ,WAAA,EADCC,SAAS;EAAEC,MAAMI;MACIE,cAAAJ,WAAA;;AAOtBJ,WAAA,EADCC,SAAS;EAAEI,WAAW;MAC0CG,cAAAJ,WAAA;;AAMjEJ,WAAA,EADCC,SAAS;EAAEI,WAAW;MACyCG,cAAAJ,WAAA;;AAMhEJ,WAAA,EADCqE,WACoC7D,cAAAJ,WAAA;;AAMrCJ,WAAA,EADCqE,WACqC7D,cAAAJ,WAAA;;AAMtCJ,WAAA,EADCqE,WACuB7D,cAAAJ,WAAA;;AApJpBI,gBAAaR,WAAA,EADlBO,cAAc,2BACTC;;AAiUN,IAAA8D,wBAAe9D;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/web-components/cds-aichat-container/cds-aichat-internal.tsx","../../../../../../src/web-components/cds-aichat-container/index.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * This component is mostly a pass-through. Its takes any properties passed into the ChatContainer\n * custom element and then renders the React Carbon AI Chat application while passing in properties.\n */\n\nimport { LitElement, PropertyValues } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport React from \"react\";\nimport { createRoot, Root } from \"react-dom/client\";\n\nimport ChatAppEntry from \"../../chat/ChatAppEntry\";\nimport { carbonElement } from \"@carbon/ai-chat-components/es/globals/decorators/index.js\";\nimport { PublicConfig } from \"../../types/config/PublicConfig\";\nimport { ChatInstance } from \"../../types/instance/ChatInstance\";\nimport { DeepPartial } from \"../../types/utilities/DeepPartial\";\nimport { LanguagePack } from \"../../types/config/PublicConfig\";\nimport type {\n ServiceDesk,\n ServiceDeskFactoryParameters,\n ServiceDeskPublicConfig,\n} from \"../../types/config/ServiceDeskConfig\";\n\n@carbonElement(\"cds-aichat-internal\")\nclass ChatContainerInternal extends LitElement {\n /**\n * The config to use to load Carbon AI Chat. Note that the \"onLoad\" property is overridden by this component. If you\n * need to perform any actions after Carbon AI Chat been loaded, use the \"onBeforeRender\" or \"onAfterRender\" props.\n */\n @property({ type: Object })\n config: PublicConfig;\n\n /** Optional partial language pack overrides */\n @property({ type: Object })\n strings?: DeepPartial<LanguagePack>;\n\n /** A factory for the {@link ServiceDesk} integration. */\n @property({ attribute: false })\n serviceDeskFactory?: (\n parameters: ServiceDeskFactoryParameters,\n ) => Promise<ServiceDesk>;\n\n /** Public configuration for the service desk integration. */\n @property({ type: Object })\n serviceDesk?: ServiceDeskPublicConfig;\n\n /**\n * The optional HTML element to mount the chat to.\n */\n @property({ type: HTMLElement })\n element?: HTMLElement;\n\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property()\n onBeforeRender: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property()\n onAfterRender: (instance: ChatInstance) => Promise<void> | void;\n\n firstUpdated() {\n // Render the React component with any updated properties if necessary\n const style = document.createElement(\"style\");\n style.textContent = `\n :host {\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n ${this.element ? \"\" : \"z-index: var(--cds-aichat-z-index);\"}\n }\n [slot=\"workspacePanelElement\"] {\n block-size: 100%;\n }\n `;\n this.appendChild(style);\n if (this.config) {\n this.renderReactApp();\n }\n }\n\n updated(changedProperties: PropertyValues) {\n // Re-render React app when config or other properties change\n if (\n this.config &&\n (changedProperties.has(\"config\") ||\n changedProperties.has(\"strings\") ||\n changedProperties.has(\"serviceDeskFactory\") ||\n changedProperties.has(\"serviceDesk\") ||\n changedProperties.has(\"onBeforeRender\") ||\n changedProperties.has(\"onAfterRender\") ||\n changedProperties.has(\"element\"))\n ) {\n this.renderReactApp();\n }\n }\n\n /**\n * Track if a previous React 18+ root was already created so we don't create a memory leak on re-renders.\n */\n root: Root;\n\n /**\n * Cache the container we hand to React so we can reuse it between renders.\n */\n reactContainer?: HTMLDivElement;\n\n async renderReactApp() {\n const container = this.ensureReactRoot();\n\n this.root.render(\n <ChatAppEntry\n config={this.config}\n strings={this.strings}\n serviceDeskFactory={this.serviceDeskFactory}\n serviceDesk={this.serviceDesk}\n onBeforeRender={this.onBeforeRender}\n onAfterRender={this.onAfterRender}\n container={container}\n element={this.element}\n />,\n );\n }\n\n private ensureReactRoot(): HTMLDivElement {\n if (!this.reactContainer) {\n const container = document.createElement(\"div\");\n container.classList.add(\"cds-aichat--react-app\");\n this.shadowRoot.appendChild(container);\n this.reactContainer = container;\n }\n\n // Make sure we only create one root and reuse it for prop updates.\n if (!this.root) {\n this.root = createRoot(this.reactContainer);\n }\n\n return this.reactContainer;\n }\n\n disconnectedCallback(): void {\n this.root?.unmount();\n super.disconnectedCallback();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"cds-aichat-internal\": ChatContainerInternal;\n }\n}\n\nexport default ChatContainerInternal;\n","/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * This is the exposed web component for a basic floating chat.\n */\n\nimport \"./cds-aichat-internal\";\n\nimport { html, LitElement } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n\nimport { carbonElement } from \"@carbon/ai-chat-components/es/globals/decorators/index.js\";\nimport {\n PublicConfig,\n OnErrorData,\n DisclaimerPublicConfig,\n CarbonTheme,\n HeaderConfig,\n LayoutConfig,\n PublicConfigMessaging,\n InputConfig,\n} from \"../../types/config/PublicConfig\";\nimport { DeepPartial } from \"../../types/utilities/DeepPartial\";\nimport { LanguagePack } from \"../../types/config/PublicConfig\";\nimport { HomeScreenConfig } from \"../../types/config/HomeScreenConfig\";\nimport { LauncherConfig } from \"../../types/config/LauncherConfig\";\nimport type {\n ServiceDesk,\n ServiceDeskFactoryParameters,\n ServiceDeskPublicConfig,\n} from \"../../types/config/ServiceDeskConfig\";\nimport { ChatInstance } from \"../../types/instance/ChatInstance\";\nimport {\n BusEventChunkUserDefinedResponse,\n BusEventType,\n BusEventUserDefinedResponse,\n} from \"../../types/events/eventBusTypes\";\n\n/**\n * The cds-aichat-container managing creating slotted elements for user_defined responses and writable elements.\n * It then passes that slotted content into cds-aichat-internal. That component will boot up the full chat application\n * and pass the slotted elements into their slots.\n */\n@carbonElement(\"cds-aichat-container\")\nclass ChatContainer extends LitElement {\n @property({ attribute: false, type: Object })\n config?: PublicConfig;\n\n // Flattened PublicConfig properties\n @property({ attribute: false })\n onError?: (data: OnErrorData) => void;\n\n @property({ type: Boolean, attribute: \"open-chat-by-default\" })\n openChatByDefault?: boolean;\n\n @property({ type: Object })\n disclaimer?: DisclaimerPublicConfig;\n\n @property({\n type: Boolean,\n attribute: \"disable-custom-element-mobile-enhancements\",\n })\n disableCustomElementMobileEnhancements?: boolean;\n\n @property({ type: Boolean })\n debug?: boolean;\n\n @property({ type: Boolean, attribute: \"expose-service-manager-for-testing\" })\n exposeServiceManagerForTesting?: boolean;\n\n @property({ type: String, attribute: \"inject-carbon-theme\" })\n injectCarbonTheme?: CarbonTheme;\n\n @property({\n attribute: \"ai-enabled\",\n // Custom converter so HTML authors can write ai-enabled=\"false\" | \"0\" | \"off\" | \"no\"\n // and absence keeps it undefined (so defaults apply further down the stack).\n converter: {\n fromAttribute: (value: string | null) => {\n if (value === null) {\n return undefined; // attribute absent -> leave undefined to use defaults\n }\n const v = String(value).trim().toLowerCase();\n const falsey = v === \"false\" || v === \"0\" || v === \"off\" || v === \"no\";\n // Any presence that's not an explicit falsey string is treated as true\n return !falsey;\n },\n },\n })\n aiEnabled?: boolean;\n\n // Optional explicit opt-out attribute. If present, it wins over ai-enabled.\n @property({ type: Boolean, attribute: \"ai-disabled\" })\n aiDisabled?: boolean;\n\n @property({\n type: Boolean,\n attribute: \"should-take-focus-if-opens-automatically\",\n })\n shouldTakeFocusIfOpensAutomatically?: boolean;\n\n @property({ type: String })\n namespace?: string;\n\n @state()\n private enableFocusTrap?: boolean;\n\n @property({ type: Boolean, attribute: \"should-sanitize-html\" })\n shouldSanitizeHTML?: boolean;\n\n @property({ type: Object })\n header?: HeaderConfig;\n\n @property({ type: Object })\n input?: InputConfig;\n\n @property({ type: Object })\n layout?: LayoutConfig;\n\n @property({ type: Object })\n messaging?: PublicConfigMessaging;\n\n @property({ type: Boolean, attribute: \"is-readonly\" })\n isReadonly?: boolean;\n\n @property({ type: String, attribute: \"assistant-name\" })\n assistantName?: string;\n\n @property({ type: String })\n locale?: string;\n\n @property({ type: Object })\n homescreen?: HomeScreenConfig;\n\n @property({ type: Object })\n launcher?: LauncherConfig;\n\n /** Optional partial language pack overrides */\n @property({ type: Object })\n strings?: DeepPartial<LanguagePack>;\n\n /**\n * A factory to create a {@link ServiceDesk} integration instance.\n */\n @property({ attribute: false })\n serviceDeskFactory?: (\n parameters: ServiceDeskFactoryParameters,\n ) => Promise<ServiceDesk>;\n\n /**\n * Public configuration for the service desk integration.\n */\n @property({ type: Object, attribute: \"service-desk\" })\n serviceDesk?: ServiceDeskPublicConfig;\n\n /**\n * The element to render to instead of the default float element.\n *\n * @internal\n */\n @property({ type: HTMLElement })\n element?: HTMLElement;\n\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property({ attribute: false })\n onBeforeRender: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called.\n */\n @property({ attribute: false })\n onAfterRender: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * The existing array of slot names for all user_defined components.\n */\n @state()\n _userDefinedSlotNames: string[] = [];\n\n /**\n * The existing array of slot names for all writeable elements.\n */\n @state()\n _writeableElementSlots: string[] = [];\n\n /**\n * The chat instance.\n */\n @state()\n _instance: ChatInstance;\n\n firstUpdated() {\n const style = document.createElement(\"style\");\n style.textContent = `\n [slot=\"workspacePanelElement\"] {\n block-size: 100%;\n }\n `;\n this.appendChild(style);\n }\n\n /**\n * Adds the slot attribute to the element for the user_defined response type and then injects it into the component by\n * updating this._userDefinedSlotNames;\n */\n userDefinedHandler = (\n event: BusEventUserDefinedResponse | BusEventChunkUserDefinedResponse,\n ) => {\n // This element already has `slot` as an attribute.\n const { slot } = event.data;\n if (!this._userDefinedSlotNames.includes(slot)) {\n this._userDefinedSlotNames = [...this._userDefinedSlotNames, slot];\n }\n };\n\n private get resolvedConfig(): PublicConfig {\n const baseConfig = this.config ?? {};\n const resolvedConfig: PublicConfig = { ...baseConfig };\n\n if (this.onError !== undefined) {\n resolvedConfig.onError = this.onError;\n }\n if (this.openChatByDefault !== undefined) {\n resolvedConfig.openChatByDefault = this.openChatByDefault;\n }\n if (this.disclaimer !== undefined) {\n resolvedConfig.disclaimer = this.disclaimer;\n }\n if (this.disableCustomElementMobileEnhancements !== undefined) {\n resolvedConfig.disableCustomElementMobileEnhancements =\n this.disableCustomElementMobileEnhancements;\n }\n if (this.debug !== undefined) {\n resolvedConfig.debug = this.debug;\n }\n if (this.exposeServiceManagerForTesting !== undefined) {\n resolvedConfig.exposeServiceManagerForTesting =\n this.exposeServiceManagerForTesting;\n }\n if (this.injectCarbonTheme !== undefined) {\n resolvedConfig.injectCarbonTheme = this.injectCarbonTheme;\n }\n if (this.serviceDeskFactory !== undefined) {\n resolvedConfig.serviceDeskFactory = this.serviceDeskFactory;\n }\n if (this.serviceDesk !== undefined) {\n resolvedConfig.serviceDesk = this.serviceDesk;\n }\n if (this.shouldTakeFocusIfOpensAutomatically !== undefined) {\n resolvedConfig.shouldTakeFocusIfOpensAutomatically =\n this.shouldTakeFocusIfOpensAutomatically;\n }\n if (this.namespace !== undefined) {\n resolvedConfig.namespace = this.namespace;\n }\n if (this.enableFocusTrap !== undefined) {\n resolvedConfig.enableFocusTrap = this.enableFocusTrap;\n }\n if (this.shouldSanitizeHTML !== undefined) {\n resolvedConfig.shouldSanitizeHTML = this.shouldSanitizeHTML;\n }\n if (this.header !== undefined) {\n resolvedConfig.header = this.header;\n }\n if (this.input !== undefined) {\n resolvedConfig.input = this.input;\n }\n if (this.layout !== undefined) {\n resolvedConfig.layout = this.layout;\n }\n if (this.messaging !== undefined) {\n resolvedConfig.messaging = this.messaging;\n }\n if (this.isReadonly !== undefined) {\n resolvedConfig.isReadonly = this.isReadonly;\n }\n if (this.assistantName !== undefined) {\n resolvedConfig.assistantName = this.assistantName;\n }\n if (this.locale !== undefined) {\n resolvedConfig.locale = this.locale;\n }\n if (this.homescreen !== undefined) {\n resolvedConfig.homescreen = this.homescreen;\n }\n if (this.launcher !== undefined) {\n resolvedConfig.launcher = this.launcher;\n }\n if (this.strings !== undefined) {\n resolvedConfig.strings = this.strings;\n }\n\n if (this.aiDisabled === true) {\n resolvedConfig.aiEnabled = false;\n } else if (this.aiEnabled !== undefined) {\n resolvedConfig.aiEnabled = this.aiEnabled;\n }\n\n return resolvedConfig;\n }\n\n onBeforeRenderOverride = async (instance: ChatInstance) => {\n this._instance = instance;\n this._instance.on({\n type: BusEventType.USER_DEFINED_RESPONSE,\n handler: this.userDefinedHandler,\n });\n this._instance.on({\n type: BusEventType.CHUNK_USER_DEFINED_RESPONSE,\n handler: this.userDefinedHandler,\n });\n this.addWriteableElementSlots();\n await this.onBeforeRender?.(instance);\n };\n\n addWriteableElementSlots() {\n const writeableElementSlots: string[] = [];\n Object.keys(this._instance.writeableElements).forEach(\n (writeableElementKey) => {\n writeableElementSlots.push(writeableElementKey);\n },\n );\n this._writeableElementSlots = writeableElementSlots;\n }\n\n /**\n * Renders the template while passing in class functionality\n */\n render() {\n return html`<cds-aichat-internal\n .config=${this.resolvedConfig}\n .onAfterRender=${this.onAfterRender}\n .onBeforeRender=${this.onBeforeRenderOverride}\n .element=${this.element}\n >\n ${this._writeableElementSlots.map(\n (slot) => html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n ${this._userDefinedSlotNames.map(\n (slot) => html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n </cds-aichat-internal>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"cds-aichat-container\": ChatContainer;\n }\n}\n\n/**\n * Attributes interface for the cds-aichat-container web component.\n * This interface extends {@link PublicConfig} with additional component-specific props,\n * flattening all config properties as top-level properties for better TypeScript IntelliSense.\n *\n * @category Web component\n */\ninterface CdsAiChatContainerAttributes extends PublicConfig {\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n onBeforeRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called.\n */\n onAfterRender?: (instance: ChatInstance) => Promise<void> | void;\n}\n\nexport { CdsAiChatContainerAttributes };\nexport default ChatContainer;\n"],"names":["ChatContainerInternal","LitElement","firstUpdated","style","document","createElement","textContent","this","element","appendChild","config","renderReactApp","updated","changedProperties","has","container","ensureReactRoot","root","render","React","ChatAppEntry","strings","serviceDeskFactory","serviceDesk","onBeforeRender","onAfterRender","reactContainer","classList","add","shadowRoot","createRoot","disconnectedCallback","unmount","super","__decorate","property","type","Object","prototype","attribute","HTMLElement","carbonElement","ChatContainer","constructor","_userDefinedSlotNames","_writeableElementSlots","userDefinedHandler","event","slot","data","includes","onBeforeRenderOverride","async","instance","_instance","on","BusEventType","USER_DEFINED_RESPONSE","handler","CHUNK_USER_DEFINED_RESPONSE","addWriteableElementSlots","resolvedConfig","baseConfig","onError","undefined","openChatByDefault","disclaimer","disableCustomElementMobileEnhancements","debug","exposeServiceManagerForTesting","injectCarbonTheme","shouldTakeFocusIfOpensAutomatically","namespace","enableFocusTrap","shouldSanitizeHTML","header","input","layout","messaging","isReadonly","assistantName","locale","homescreen","launcher","aiDisabled","aiEnabled","writeableElementSlots","keys","writeableElements","forEach","writeableElementKey","push","html","map","Boolean","String","converter","fromAttribute","value","v","trim","toLowerCase","falsey","state","ChatContainer_default"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAMA,wBAAN,MAAMA,8BAA8BC;EA0ClC,YAAAC;IAEE,MAAMC,QAAQC,SAASC,cAAc;IACrCF,MAAMG,cAAc,mIAMdC,KAAKC,UAAU,KAAK;IAM1BD,KAAKE,YAAYN;IACjB,IAAII,KAAKG,QAAQ;MACfH,KAAKI;AACP;AACF;EAEA,OAAAC,CAAQC;IAEN,IACEN,KAAKG,WACJG,kBAAkBC,IAAI,aACrBD,kBAAkBC,IAAI,cACtBD,kBAAkBC,IAAI,yBACtBD,kBAAkBC,IAAI,kBACtBD,kBAAkBC,IAAI,qBACtBD,kBAA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AS;EAAEC,MAAMI;MACIE,cAAAJ,WAAA;;AAOtBJ,WAAA,EADCC,SAAS;EAAEI,WAAW;MAC0CG,cAAAJ,WAAA;;AAMjEJ,WAAA,EADCC,SAAS;EAAEI,WAAW;MACyCG,cAAAJ,WAAA;;AAMhEJ,WAAA,EADCqE,WACoC7D,cAAAJ,WAAA;;AAMrCJ,WAAA,EADCqE,WACqC7D,cAAAJ,WAAA;;AAMtCJ,WAAA,EADCqE,WACuB7D,cAAAJ,WAAA;;AApJpBI,gBAAaR,WAAA,EADlBO,cAAc,2BACTC;;AA2UN,IAAA8D,wBAAe9D;;"}
|
|
@@ -8,7 +8,7 @@ import { property, state } from "lit/decorators.js";
|
|
|
8
8
|
|
|
9
9
|
import { carbonElement } from "@carbon/ai-chat-components/es/globals/decorators/index.js";
|
|
10
10
|
|
|
11
|
-
import { B as BusEventType } from "../../chat.
|
|
11
|
+
import { B as BusEventType } from "../../chat.languageUtils.js";
|
|
12
12
|
|
|
13
13
|
import "react";
|
|
14
14
|
|
|
@@ -18,6 +18,14 @@ import "../../chat.ChatAppEntry.js";
|
|
|
18
18
|
|
|
19
19
|
import "lodash-es/isEqual.js";
|
|
20
20
|
|
|
21
|
+
import "react-intl";
|
|
22
|
+
|
|
23
|
+
import "use-sync-external-store/shim";
|
|
24
|
+
|
|
25
|
+
import "compute-scroll-into-view";
|
|
26
|
+
|
|
27
|
+
import "tabbable";
|
|
28
|
+
|
|
21
29
|
import "dayjs";
|
|
22
30
|
|
|
23
31
|
import "dayjs/plugin/localizedFormat.js";
|
|
@@ -28,22 +36,16 @@ import "lodash-es/cloneDeep.js";
|
|
|
28
36
|
|
|
29
37
|
import "lodash-es/mergeWith.js";
|
|
30
38
|
|
|
31
|
-
import "react-intl";
|
|
32
|
-
|
|
33
39
|
import "react-dom";
|
|
34
40
|
|
|
35
41
|
import "classnames";
|
|
36
42
|
|
|
37
|
-
import "use-sync-external-store/shim";
|
|
38
|
-
|
|
39
|
-
import "compute-scroll-into-view";
|
|
40
|
-
|
|
41
|
-
import "tabbable";
|
|
42
|
-
|
|
43
43
|
import "focus-trap-react";
|
|
44
44
|
|
|
45
45
|
import "lodash-es/throttle.js";
|
|
46
46
|
|
|
47
|
+
import "lodash-es/debounce.js";
|
|
48
|
+
|
|
47
49
|
import "@carbon/icons/es/down-to-bottom/16.js";
|
|
48
50
|
|
|
49
51
|
import "@carbon/icons/es/screen--off/16.js";
|
|
@@ -64,12 +66,12 @@ import "@carbon/icons/es/checkmark--filled/16.js";
|
|
|
64
66
|
|
|
65
67
|
import "@carbon/icons/es/headset/32.js";
|
|
66
68
|
|
|
67
|
-
import "@carbon/icons/es/chevron--down/16.js";
|
|
68
|
-
|
|
69
69
|
import "@carbon/ai-chat-components/es/react/reasoning-steps.js";
|
|
70
70
|
|
|
71
71
|
import "@carbon/ai-chat-components/es/react/reasoning-step.js";
|
|
72
72
|
|
|
73
|
+
import "@carbon/ai-chat-components/es/react/reasoning-steps-toggle.js";
|
|
74
|
+
|
|
73
75
|
import "@carbon/web-components/es/components/loading/loading-icon.js";
|
|
74
76
|
|
|
75
77
|
import "@carbon/web-components/es/components/loading/loading.js";
|
|
@@ -104,6 +106,8 @@ import "@carbon/web-components/es/components/skeleton-text/skeleton-text.js";
|
|
|
104
106
|
|
|
105
107
|
import "@carbon/web-components/es/components/skeleton-placeholder/skeleton-placeholder.js";
|
|
106
108
|
|
|
109
|
+
import "@carbon/icons/es/chevron--down/16.js";
|
|
110
|
+
|
|
107
111
|
import "@carbon/icons/es/chevron--up/16.js";
|
|
108
112
|
|
|
109
113
|
import "@carbon/icons/es/touch--interaction/16.js";
|
|
@@ -120,16 +124,18 @@ import "@carbon/icons/es/launch/16.js";
|
|
|
120
124
|
|
|
121
125
|
import "@carbon/web-components/es/components/link/link.js";
|
|
122
126
|
|
|
127
|
+
import "@carbon/ai-chat-components/es/react/card.js";
|
|
128
|
+
|
|
129
|
+
import "@carbon/icons/es/maximize/16.js";
|
|
130
|
+
|
|
131
|
+
import "@carbon/icons/es/view/16.js";
|
|
132
|
+
|
|
123
133
|
import "@carbon/icons/es/chevron--left/16.js";
|
|
124
134
|
|
|
125
135
|
import "@carbon/icons/es/chevron--right/16.js";
|
|
126
136
|
|
|
127
|
-
import "lodash-es/debounce.js";
|
|
128
|
-
|
|
129
137
|
import "@carbon/icons/es/link/16.js";
|
|
130
138
|
|
|
131
|
-
import "@carbon/icons/es/maximize/16.js";
|
|
132
|
-
|
|
133
139
|
import "@carbon/web-components/es/components/tag/operational-tag.js";
|
|
134
140
|
|
|
135
141
|
import "@carbon/icons/es/checkmark/32.js";
|
|
@@ -146,6 +152,12 @@ import "@carbon/web-components/es/components/dropdown/dropdown-item.js";
|
|
|
146
152
|
|
|
147
153
|
import "@carbon/ai-chat-components/es/react/chain-of-thought.js";
|
|
148
154
|
|
|
155
|
+
import "@carbon/ai-chat-components/es/react/chain-of-thought-step.js";
|
|
156
|
+
|
|
157
|
+
import "@carbon/ai-chat-components/es/react/chain-of-thought-toggle.js";
|
|
158
|
+
|
|
159
|
+
import "@carbon/ai-chat-components/es/react/tool-call-data.js";
|
|
160
|
+
|
|
149
161
|
import "@carbon/ai-chat-components/es/react/processing.js";
|
|
150
162
|
|
|
151
163
|
import "@carbon/icons/es/restart/16.js";
|
|
@@ -188,7 +200,9 @@ import "@carbon/web-components/es/globals/internal/icon-loader.js";
|
|
|
188
200
|
|
|
189
201
|
import "@carbon/icons/es/stop--filled/16.js";
|
|
190
202
|
|
|
191
|
-
import "@carbon/web-components/es/components/
|
|
203
|
+
import "@carbon/web-components/es/components/modal/modal.js";
|
|
204
|
+
|
|
205
|
+
import "@carbon/web-components/es/components/modal/modal-body.js";
|
|
192
206
|
|
|
193
207
|
import "@carbon/icons/es/ai-launch/24.js";
|
|
194
208
|
|
|
@@ -196,7 +210,9 @@ import "@carbon/icons/es/chat--launch/24.js";
|
|
|
196
210
|
|
|
197
211
|
import "@carbon/icons/es/close/16.js";
|
|
198
212
|
|
|
199
|
-
import "@carbon/
|
|
213
|
+
import "@carbon/web-components/es/components/layer/layer.js";
|
|
214
|
+
|
|
215
|
+
import "@carbon/ai-chat-components/es/components/chain-of-thought/defs.js";
|
|
200
216
|
|
|
201
217
|
import "dayjs/locale/en.js";
|
|
202
218
|
|
|
@@ -244,6 +260,11 @@ let ChatCustomElement = ChatCustomElement_1 = class ChatCustomElement extends Li
|
|
|
244
260
|
await (this.onBeforeRender?.(instance));
|
|
245
261
|
};
|
|
246
262
|
}
|
|
263
|
+
firstUpdated() {
|
|
264
|
+
const style = document.createElement("style");
|
|
265
|
+
style.textContent = `\n [slot="workspacePanelElement"] {\n block-size: 100%;\n }\n `;
|
|
266
|
+
this.appendChild(style);
|
|
267
|
+
}
|
|
247
268
|
createRenderRoot() {
|
|
248
269
|
const root = super.createRenderRoot();
|
|
249
270
|
root.adoptedStyleSheets = [ ...root.adoptedStyleSheets, ChatCustomElement_1.hideSheet ];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../src/web-components/cds-aichat-custom-element/index.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n// Ensure the container custom element is registered whenever the\n// custom element module is imported by re-exporting its exports.\n// This prevents bundlers (and our own multi-entry Rollup build)\n// from pruning the side-effect-only import.\nexport { default as __cds_aichat_container_register } from \"../cds-aichat-container\";\nimport \"../cds-aichat-container\";\n\nimport { html, LitElement } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n\nimport { carbonElement } from \"@carbon/ai-chat-components/es/globals/decorators/index.js\";\nimport {\n PublicConfig,\n OnErrorData,\n DisclaimerPublicConfig,\n CarbonTheme,\n HeaderConfig,\n LayoutConfig,\n PublicConfigMessaging,\n LanguagePack,\n InputConfig,\n} from \"../../types/config/PublicConfig\";\nimport { DeepPartial } from \"../../types/utilities/DeepPartial\";\nimport { HomeScreenConfig } from \"../../types/config/HomeScreenConfig\";\nimport { LauncherConfig } from \"../../types/config/LauncherConfig\";\nimport type {\n ServiceDesk,\n ServiceDeskFactoryParameters,\n ServiceDeskPublicConfig,\n} from \"../../types/config/ServiceDeskConfig\";\nimport { ChatInstance } from \"../../types/instance/ChatInstance\";\nimport {\n BusEventChunkUserDefinedResponse,\n BusEventType,\n BusEventUserDefinedResponse,\n BusEventViewChange,\n BusEventViewPreChange,\n} from \"../../types/events/eventBusTypes\";\n\n/**\n * cds-aichat-custom-element will is a pass through to cds-aichat-container. It takes any user_defined and writeable element\n * slotted content and forwards it to cds-aichat-container. It also will setup the custom element with a default viewChange\n * pattern (e.g. hiding and showing the custom element when the chat should be open/closed) if a onViewChange property is not\n * defined. Finally, it registers the custom element with cds-aichat-container so a default \"floating\" element will not be created.\n *\n * The custom element should be sized using external CSS. When hidden, the 'cds-aichat--hidden' class is added to set dimensions to 0x0.\n */\n@carbonElement(\"cds-aichat-custom-element\")\nclass ChatCustomElement extends LitElement {\n @property({ attribute: false, type: Object })\n config?: PublicConfig;\n\n /**\n * Shared stylesheet for hiding styles.\n */\n private static hideSheet = new CSSStyleSheet();\n static {\n // Hide styles that override any external sizing\n ChatCustomElement.hideSheet.replaceSync(`\n :host {\n display: block;\n }\n :host(.cds-aichat--hidden) {\n width: 0 !important;\n height: 0 !important;\n min-width: 0 !important;\n min-height: 0 !important;\n max-width: 0 !important;\n max-height: 0 !important;\n inline-size: 0 !important;\n block-size: 0 !important;\n min-inline-size: 0 !important;\n min-block-size: 0 !important;\n max-inline-size: 0 !important;\n max-block-size: 0 !important;\n overflow: hidden !important;\n display: block !important;\n }\n `);\n }\n\n /**\n * Adopt our stylesheet into every shadowRoot.\n */\n protected createRenderRoot(): ShadowRoot {\n // Lits default createRenderRoot actually returns a ShadowRoot\n const root = super.createRenderRoot() as ShadowRoot;\n\n // now TS knows root.adoptedStyleSheets exists\n root.adoptedStyleSheets = [\n ...root.adoptedStyleSheets,\n ChatCustomElement.hideSheet,\n ];\n return root;\n }\n\n // Flattened PublicConfig properties\n @property({ attribute: false })\n onError?: (data: OnErrorData) => void;\n\n @property({ type: Boolean, attribute: \"open-chat-by-default\" })\n openChatByDefault?: boolean;\n\n @property({ type: Object })\n disclaimer?: DisclaimerPublicConfig;\n\n @property({\n type: Boolean,\n attribute: \"disable-custom-element-mobile-enhancements\",\n })\n disableCustomElementMobileEnhancements?: boolean;\n\n @property({ type: Boolean })\n debug?: boolean;\n\n @property({ type: Boolean, attribute: \"expose-service-manager-for-testing\" })\n exposeServiceManagerForTesting?: boolean;\n\n @property({ type: String, attribute: \"inject-carbon-theme\" })\n injectCarbonTheme?: CarbonTheme;\n\n @property({\n attribute: \"ai-enabled\",\n converter: {\n fromAttribute: (value: string | null) => {\n if (value === null) {\n return undefined;\n }\n const v = String(value).trim().toLowerCase();\n const falsey = v === \"false\" || v === \"0\" || v === \"off\" || v === \"no\";\n return !falsey;\n },\n },\n })\n aiEnabled?: boolean;\n\n @property({ type: Boolean, attribute: \"ai-disabled\" })\n aiDisabled?: boolean;\n\n @property({\n type: Boolean,\n attribute: \"should-take-focus-if-opens-automatically\",\n })\n shouldTakeFocusIfOpensAutomatically?: boolean;\n\n @property({ type: String })\n namespace?: string;\n\n @state()\n private enableFocusTrap?: boolean;\n\n @property({ type: Boolean, attribute: \"should-sanitize-html\" })\n shouldSanitizeHTML?: boolean;\n\n @property({ type: Object })\n header?: HeaderConfig;\n\n @property({ type: Object })\n input?: InputConfig;\n\n @property({ type: Object })\n layout?: LayoutConfig;\n\n @property({ type: Object })\n messaging?: PublicConfigMessaging;\n\n @property({ type: Boolean, attribute: \"is-readonly\" })\n isReadonly?: boolean;\n\n @property({ type: String, attribute: \"assistant-name\" })\n assistantName?: string;\n\n @property({ type: String })\n locale?: string;\n\n @property({ type: Object })\n homescreen?: HomeScreenConfig;\n\n @property({ type: Object })\n launcher?: LauncherConfig;\n\n /** A factory for the {@link ServiceDesk} integration. */\n @property({ attribute: false })\n serviceDeskFactory?: (\n parameters: ServiceDeskFactoryParameters,\n ) => Promise<ServiceDesk>;\n\n /** Public configuration for the service desk integration. */\n @property({ type: Object, attribute: \"service-desk\" })\n serviceDesk?: ServiceDeskPublicConfig;\n\n /** Optional partial language pack overrides */\n @property({ type: Object })\n strings?: DeepPartial<LanguagePack>;\n\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property({ attribute: false })\n onBeforeRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called.\n */\n @property({ attribute: false })\n onAfterRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * Called before a view change (chat opening/closing). The chat will hide the chat shell inside your custom element\n * to prevent invisible keyboard stops when the view change is complete.\n *\n * Use this callback to update your CSS class name values on this element before the view change happens if you want to add any open/close\n * animations to your custom element before the chat shell inner contents are hidden. It is async and so you can\n * tie it to native the AnimationEvent and only return when your animations have completed.\n *\n * A common pattern is to use this for when the chat is closing and to use onViewChange for when the chat opens.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded as it is registered before the\n * chat renders. After Carbon AI Chat is loaded, the callback will not be updated.\n */\n @property()\n onViewPreChange?: (event: BusEventViewPreChange) => Promise<void> | void;\n\n /**\n * Called when the chat view change is complete. If no callback is provided here, the default behavior will be to set\n * the chat shell to 0x0 size and set all inner contents aside from the launcher, if you are using it, to display: none.\n * The inner contents of the chat shell (aside from the launcher if you are using it) are always set to display: none\n * regardless of what is configured with this callback to prevent invisible tab stops and screen reader issues.\n *\n * Use this callback to update your className value when the chat has finished being opened or closed.\n *\n * You can provide a different callback here if you want custom animation behavior when the chat is opened or closed.\n * The animation behavior defined here will run in concert with the chat inside your custom container being hidden.\n *\n * If you want to run animations before the inner contents of the chat shell is shrunk and the inner contents are hidden,\n * make use of onViewPreChange.\n *\n * A common pattern is to use this for when the chat is opening and to use onViewPreChange for when the chat closes.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded as it is registered before the\n * chat renders. After Carbon AI Chat is loaded, the callback will not be updated.\n */\n @property()\n onViewChange?: (event: BusEventViewChange, instance: ChatInstance) => void;\n\n @state()\n private _userDefinedSlotNames: string[] = [];\n\n @state()\n private _writeableElementSlots: string[] = [];\n\n @state()\n private _instance!: ChatInstance;\n\n private defaultViewChangeHandler = (event: BusEventViewChange) => {\n if (event.newViewState.mainWindow) {\n this.classList.remove(\"cds-aichat--hidden\");\n } else {\n this.classList.add(\"cds-aichat--hidden\");\n }\n };\n\n private userDefinedHandler = (\n event: BusEventUserDefinedResponse | BusEventChunkUserDefinedResponse,\n ) => {\n const { slot } = event.data;\n if (!this._userDefinedSlotNames.includes(slot)) {\n this._userDefinedSlotNames = [...this._userDefinedSlotNames, slot];\n }\n };\n\n private get resolvedConfig(): PublicConfig {\n const baseConfig = this.config ?? {};\n const resolvedConfig: PublicConfig = { ...baseConfig };\n\n if (this.onError !== undefined) {\n resolvedConfig.onError = this.onError;\n }\n if (this.openChatByDefault !== undefined) {\n resolvedConfig.openChatByDefault = this.openChatByDefault;\n }\n if (this.disclaimer !== undefined) {\n resolvedConfig.disclaimer = this.disclaimer;\n }\n if (this.disableCustomElementMobileEnhancements !== undefined) {\n resolvedConfig.disableCustomElementMobileEnhancements =\n this.disableCustomElementMobileEnhancements;\n }\n if (this.debug !== undefined) {\n resolvedConfig.debug = this.debug;\n }\n if (this.exposeServiceManagerForTesting !== undefined) {\n resolvedConfig.exposeServiceManagerForTesting =\n this.exposeServiceManagerForTesting;\n }\n if (this.injectCarbonTheme !== undefined) {\n resolvedConfig.injectCarbonTheme = this.injectCarbonTheme;\n }\n if (this.serviceDeskFactory !== undefined) {\n resolvedConfig.serviceDeskFactory = this.serviceDeskFactory;\n }\n if (this.serviceDesk !== undefined) {\n resolvedConfig.serviceDesk = this.serviceDesk;\n }\n if (this.shouldTakeFocusIfOpensAutomatically !== undefined) {\n resolvedConfig.shouldTakeFocusIfOpensAutomatically =\n this.shouldTakeFocusIfOpensAutomatically;\n }\n if (this.namespace !== undefined) {\n resolvedConfig.namespace = this.namespace;\n }\n if (this.enableFocusTrap !== undefined) {\n resolvedConfig.enableFocusTrap = this.enableFocusTrap;\n }\n if (this.shouldSanitizeHTML !== undefined) {\n resolvedConfig.shouldSanitizeHTML = this.shouldSanitizeHTML;\n }\n if (this.header !== undefined) {\n resolvedConfig.header = this.header;\n }\n if (this.input !== undefined) {\n resolvedConfig.input = this.input;\n }\n if (this.layout !== undefined) {\n resolvedConfig.layout = this.layout;\n }\n if (this.messaging !== undefined) {\n resolvedConfig.messaging = this.messaging;\n }\n if (this.isReadonly !== undefined) {\n resolvedConfig.isReadonly = this.isReadonly;\n }\n if (this.assistantName !== undefined) {\n resolvedConfig.assistantName = this.assistantName;\n }\n if (this.locale !== undefined) {\n resolvedConfig.locale = this.locale;\n }\n if (this.homescreen !== undefined) {\n resolvedConfig.homescreen = this.homescreen;\n }\n if (this.launcher !== undefined) {\n resolvedConfig.launcher = this.launcher;\n }\n if (this.strings !== undefined) {\n resolvedConfig.strings = this.strings;\n }\n\n if (this.aiDisabled === true) {\n resolvedConfig.aiEnabled = false;\n } else if (this.aiEnabled !== undefined) {\n resolvedConfig.aiEnabled = this.aiEnabled;\n }\n\n return resolvedConfig;\n }\n\n private onBeforeRenderOverride = async (instance: ChatInstance) => {\n this._instance = instance;\n if (this.onViewPreChange) {\n this._instance.on({\n type: BusEventType.VIEW_PRE_CHANGE,\n handler: this.onViewPreChange,\n });\n }\n this._instance.on({\n type: BusEventType.VIEW_CHANGE,\n handler: this.onViewChange || this.defaultViewChangeHandler,\n });\n this._instance.on({\n type: BusEventType.USER_DEFINED_RESPONSE,\n handler: this.userDefinedHandler,\n });\n this._instance.on({\n type: BusEventType.CHUNK_USER_DEFINED_RESPONSE,\n handler: this.userDefinedHandler,\n });\n this.addWriteableElementSlots();\n await this.onBeforeRender?.(instance);\n };\n\n private addWriteableElementSlots() {\n this._writeableElementSlots = Object.keys(this._instance.writeableElements);\n }\n\n render() {\n return html`\n <cds-aichat-container\n .config=${this.resolvedConfig}\n .onAfterRender=${this.onAfterRender}\n .onBeforeRender=${this.onBeforeRenderOverride}\n .element=${this}\n >\n ${this._writeableElementSlots.map(\n (slot) => html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n ${this._userDefinedSlotNames.map(\n (slot) => html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n </cds-aichat-container>\n `;\n }\n}\n\n/**\n * Attributes interface for the cds-aichat-custom-element web component.\n * This interface extends {@link CdsAiChatContainerAttributes} and {@link PublicConfig} with additional component-specific props,\n * flattening all config properties as top-level properties for better TypeScript IntelliSense.\n *\n * @category Web component\n */\ninterface CdsAiChatCustomElementAttributes extends PublicConfig {\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n onBeforeRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called.\n */\n onAfterRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * An optional listener for \"view:change\" events. Such a listener is required when using a custom element in order\n * to control the visibility of the Carbon AI Chat main window. If no callback is provided here, a default one will be\n * used that injects styling into the app that will show and hide the Carbon AI Chat main window and also change the\n * size of the custom element so it doesn't take up space when the main window is closed.\n *\n * You can provide a different callback here if you want custom behavior such as an animation when the main window\n * is opened or closed.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded. After Carbon AI Chat is loaded, the event\n * handler will not be updated.\n */\n onViewChange?: (event: BusEventViewChange, instance: ChatInstance) => void;\n}\n\nexport { CdsAiChatCustomElementAttributes };\n\nexport default ChatCustomElement;\n"],"names":["ChatCustomElement","ChatCustomElement_1","LitElement","constructor","this","_userDefinedSlotNames","_writeableElementSlots","defaultViewChangeHandler","event","newViewState","mainWindow","classList","remove","add","userDefinedHandler","slot","data","includes","onBeforeRenderOverride","async","instance","_instance","onViewPreChange","on","type","BusEventType","VIEW_PRE_CHANGE","handler","VIEW_CHANGE","onViewChange","USER_DEFINED_RESPONSE","CHUNK_USER_DEFINED_RESPONSE","addWriteableElementSlots","onBeforeRender","createRenderRoot","root","super","adoptedStyleSheets","hideSheet","resolvedConfig","baseConfig","config","onError","undefined","openChatByDefault","disclaimer","disableCustomElementMobileEnhancements","debug","exposeServiceManagerForTesting","injectCarbonTheme","serviceDeskFactory","serviceDesk","shouldTakeFocusIfOpensAutomatically","namespace","enableFocusTrap","shouldSanitizeHTML","header","input","layout","messaging","isReadonly","assistantName","locale","homescreen","launcher","strings","aiDisabled","aiEnabled","Object","keys","writeableElements","render","html","onAfterRender","map","CSSStyleSheet","replaceSync","__decorate","property","attribute","prototype","Boolean","String","converter","fromAttribute","value","v","trim","toLowerCase","falsey","state","carbonElement","ChatCustomElement_default"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,IAAMA,oBAAiBC,sBAAvB,MAAMD,0BAA0BE;EAAhC,WAAAC;;IAuMUC,KAAAC,wBAAkC;IAGlCD,KAAAE,yBAAmC;IAKnCF,KAAAG,2BAA4BC;MAClC,IAAIA,MAAMC,aAAaC,YAAY;QACjCN,KAAKO,UAAUC,OAAO;AACxB,aAAO;QACLR,KAAKO,UAAUE,IAAI;AACrB;;IAGMT,KAAAU,qBACNN;MAEA,OAAMO,QAAWP,MAAMQ;MACvB,KAAKZ,KAAKC,sBAAsBY,SAASF,OAAO;QAC9CX,KAAKC,wBAAwB,KAAID,KAAKC,uBAAuBU;AAC/D;;IAyFMX,KAAAc,yBAAyBC,MAAOC;MACtChB,KAAKiB,YAAYD;MACjB,IAAIhB,KAAKkB,iBAAiB;QACxBlB,KA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E,kBAAAgF,WAAA;;AAOpCH,WAAA,EADCC,SAAS;EAAEC,WAAW;MAC2C/E,kBAAAgF,WAAA;;AAMlEH,WAAA,EADCC,SAAS;EAAEC,WAAW;MAC0C/E,kBAAAgF,WAAA;;AAgBjEH,WAAA,EADCC,cACwE9E,kBAAAgF,WAAA;;AAsBzEH,WAAA,EADCC,cAC0E9E,kBAAAgF,WAAA;;AAGnEH,WAAA,EADPa,WAC4C1F,kBAAAgF,WAAA;;AAGrCH,WAAA,EADPa,WAC6C1F,kBAAAgF,WAAA;;AAGtCH,WAAA,EADPa,WACgC1F,kBAAAgF,WAAA;;AA7M7BhF,oBAAiBC,sBAAA4E,WAAA,EADtBc,cAAc,gCACT3F;;AAyYN,IAAA4F,4BAAe5F;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/web-components/cds-aichat-custom-element/index.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n// Ensure the container custom element is registered whenever the\n// custom element module is imported by re-exporting its exports.\n// This prevents bundlers (and our own multi-entry Rollup build)\n// from pruning the side-effect-only import.\nexport { default as __cds_aichat_container_register } from \"../cds-aichat-container\";\nimport \"../cds-aichat-container\";\n\nimport { html, LitElement } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n\nimport { carbonElement } from \"@carbon/ai-chat-components/es/globals/decorators/index.js\";\nimport {\n PublicConfig,\n OnErrorData,\n DisclaimerPublicConfig,\n CarbonTheme,\n HeaderConfig,\n LayoutConfig,\n PublicConfigMessaging,\n LanguagePack,\n InputConfig,\n} from \"../../types/config/PublicConfig\";\nimport { DeepPartial } from \"../../types/utilities/DeepPartial\";\nimport { HomeScreenConfig } from \"../../types/config/HomeScreenConfig\";\nimport { LauncherConfig } from \"../../types/config/LauncherConfig\";\nimport type {\n ServiceDesk,\n ServiceDeskFactoryParameters,\n ServiceDeskPublicConfig,\n} from \"../../types/config/ServiceDeskConfig\";\nimport { ChatInstance } from \"../../types/instance/ChatInstance\";\nimport {\n BusEventChunkUserDefinedResponse,\n BusEventType,\n BusEventUserDefinedResponse,\n BusEventViewChange,\n BusEventViewPreChange,\n} from \"../../types/events/eventBusTypes\";\n\n/**\n * cds-aichat-custom-element will is a pass through to cds-aichat-container. It takes any user_defined and writeable element\n * slotted content and forwards it to cds-aichat-container. It also will setup the custom element with a default viewChange\n * pattern (e.g. hiding and showing the custom element when the chat should be open/closed) if a onViewChange property is not\n * defined. Finally, it registers the custom element with cds-aichat-container so a default \"floating\" element will not be created.\n *\n * The custom element should be sized using external CSS. When hidden, the 'cds-aichat--hidden' class is added to set dimensions to 0x0.\n */\n@carbonElement(\"cds-aichat-custom-element\")\nclass ChatCustomElement extends LitElement {\n @property({ attribute: false, type: Object })\n config?: PublicConfig;\n\n /**\n * Shared stylesheet for hiding styles.\n */\n private static hideSheet = new CSSStyleSheet();\n static {\n // Hide styles that override any external sizing\n ChatCustomElement.hideSheet.replaceSync(`\n :host {\n display: block;\n }\n :host(.cds-aichat--hidden) {\n width: 0 !important;\n height: 0 !important;\n min-width: 0 !important;\n min-height: 0 !important;\n max-width: 0 !important;\n max-height: 0 !important;\n inline-size: 0 !important;\n block-size: 0 !important;\n min-inline-size: 0 !important;\n min-block-size: 0 !important;\n max-inline-size: 0 !important;\n max-block-size: 0 !important;\n overflow: hidden !important;\n display: block !important;\n }\n `);\n }\n\n firstUpdated() {\n const style = document.createElement(\"style\");\n style.textContent = `\n [slot=\"workspacePanelElement\"] {\n block-size: 100%;\n }\n `;\n this.appendChild(style);\n }\n\n /**\n * Adopt our stylesheet into every shadowRoot.\n */\n protected createRenderRoot(): ShadowRoot {\n // Lits default createRenderRoot actually returns a ShadowRoot\n const root = super.createRenderRoot() as ShadowRoot;\n\n // now TS knows root.adoptedStyleSheets exists\n root.adoptedStyleSheets = [\n ...root.adoptedStyleSheets,\n ChatCustomElement.hideSheet,\n ];\n return root;\n }\n\n // Flattened PublicConfig properties\n @property({ attribute: false })\n onError?: (data: OnErrorData) => void;\n\n @property({ type: Boolean, attribute: \"open-chat-by-default\" })\n openChatByDefault?: boolean;\n\n @property({ type: Object })\n disclaimer?: DisclaimerPublicConfig;\n\n @property({\n type: Boolean,\n attribute: \"disable-custom-element-mobile-enhancements\",\n })\n disableCustomElementMobileEnhancements?: boolean;\n\n @property({ type: Boolean })\n debug?: boolean;\n\n @property({ type: Boolean, attribute: \"expose-service-manager-for-testing\" })\n exposeServiceManagerForTesting?: boolean;\n\n @property({ type: String, attribute: \"inject-carbon-theme\" })\n injectCarbonTheme?: CarbonTheme;\n\n @property({\n attribute: \"ai-enabled\",\n converter: {\n fromAttribute: (value: string | null) => {\n if (value === null) {\n return undefined;\n }\n const v = String(value).trim().toLowerCase();\n const falsey = v === \"false\" || v === \"0\" || v === \"off\" || v === \"no\";\n return !falsey;\n },\n },\n })\n aiEnabled?: boolean;\n\n @property({ type: Boolean, attribute: \"ai-disabled\" })\n aiDisabled?: boolean;\n\n @property({\n type: Boolean,\n attribute: \"should-take-focus-if-opens-automatically\",\n })\n shouldTakeFocusIfOpensAutomatically?: boolean;\n\n @property({ type: String })\n namespace?: string;\n\n @state()\n private enableFocusTrap?: boolean;\n\n @property({ type: Boolean, attribute: \"should-sanitize-html\" })\n shouldSanitizeHTML?: boolean;\n\n @property({ type: Object })\n header?: HeaderConfig;\n\n @property({ type: Object })\n input?: InputConfig;\n\n @property({ type: Object })\n layout?: LayoutConfig;\n\n @property({ type: Object })\n messaging?: PublicConfigMessaging;\n\n @property({ type: Boolean, attribute: \"is-readonly\" })\n isReadonly?: boolean;\n\n @property({ type: String, attribute: \"assistant-name\" })\n assistantName?: string;\n\n @property({ type: String })\n locale?: string;\n\n @property({ type: Object })\n homescreen?: HomeScreenConfig;\n\n @property({ type: Object })\n launcher?: LauncherConfig;\n\n /** A factory for the {@link ServiceDesk} integration. */\n @property({ attribute: false })\n serviceDeskFactory?: (\n parameters: ServiceDeskFactoryParameters,\n ) => Promise<ServiceDesk>;\n\n /** Public configuration for the service desk integration. */\n @property({ type: Object, attribute: \"service-desk\" })\n serviceDesk?: ServiceDeskPublicConfig;\n\n /** Optional partial language pack overrides */\n @property({ type: Object })\n strings?: DeepPartial<LanguagePack>;\n\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n @property({ attribute: false })\n onBeforeRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called.\n */\n @property({ attribute: false })\n onAfterRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * Called before a view change (chat opening/closing). The chat will hide the chat shell inside your custom element\n * to prevent invisible keyboard stops when the view change is complete.\n *\n * Use this callback to update your CSS class name values on this element before the view change happens if you want to add any open/close\n * animations to your custom element before the chat shell inner contents are hidden. It is async and so you can\n * tie it to native the AnimationEvent and only return when your animations have completed.\n *\n * A common pattern is to use this for when the chat is closing and to use onViewChange for when the chat opens.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded as it is registered before the\n * chat renders. After Carbon AI Chat is loaded, the callback will not be updated.\n */\n @property()\n onViewPreChange?: (event: BusEventViewPreChange) => Promise<void> | void;\n\n /**\n * Called when the chat view change is complete. If no callback is provided here, the default behavior will be to set\n * the chat shell to 0x0 size and set all inner contents aside from the launcher, if you are using it, to display: none.\n * The inner contents of the chat shell (aside from the launcher if you are using it) are always set to display: none\n * regardless of what is configured with this callback to prevent invisible tab stops and screen reader issues.\n *\n * Use this callback to update your className value when the chat has finished being opened or closed.\n *\n * You can provide a different callback here if you want custom animation behavior when the chat is opened or closed.\n * The animation behavior defined here will run in concert with the chat inside your custom container being hidden.\n *\n * If you want to run animations before the inner contents of the chat shell is shrunk and the inner contents are hidden,\n * make use of onViewPreChange.\n *\n * A common pattern is to use this for when the chat is opening and to use onViewPreChange for when the chat closes.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded as it is registered before the\n * chat renders. After Carbon AI Chat is loaded, the callback will not be updated.\n */\n @property()\n onViewChange?: (event: BusEventViewChange, instance: ChatInstance) => void;\n\n @state()\n private _userDefinedSlotNames: string[] = [];\n\n @state()\n private _writeableElementSlots: string[] = [];\n\n @state()\n private _instance!: ChatInstance;\n\n private defaultViewChangeHandler = (event: BusEventViewChange) => {\n if (event.newViewState.mainWindow) {\n this.classList.remove(\"cds-aichat--hidden\");\n } else {\n this.classList.add(\"cds-aichat--hidden\");\n }\n };\n\n private userDefinedHandler = (\n event: BusEventUserDefinedResponse | BusEventChunkUserDefinedResponse,\n ) => {\n const { slot } = event.data;\n if (!this._userDefinedSlotNames.includes(slot)) {\n this._userDefinedSlotNames = [...this._userDefinedSlotNames, slot];\n }\n };\n\n private get resolvedConfig(): PublicConfig {\n const baseConfig = this.config ?? {};\n const resolvedConfig: PublicConfig = { ...baseConfig };\n\n if (this.onError !== undefined) {\n resolvedConfig.onError = this.onError;\n }\n if (this.openChatByDefault !== undefined) {\n resolvedConfig.openChatByDefault = this.openChatByDefault;\n }\n if (this.disclaimer !== undefined) {\n resolvedConfig.disclaimer = this.disclaimer;\n }\n if (this.disableCustomElementMobileEnhancements !== undefined) {\n resolvedConfig.disableCustomElementMobileEnhancements =\n this.disableCustomElementMobileEnhancements;\n }\n if (this.debug !== undefined) {\n resolvedConfig.debug = this.debug;\n }\n if (this.exposeServiceManagerForTesting !== undefined) {\n resolvedConfig.exposeServiceManagerForTesting =\n this.exposeServiceManagerForTesting;\n }\n if (this.injectCarbonTheme !== undefined) {\n resolvedConfig.injectCarbonTheme = this.injectCarbonTheme;\n }\n if (this.serviceDeskFactory !== undefined) {\n resolvedConfig.serviceDeskFactory = this.serviceDeskFactory;\n }\n if (this.serviceDesk !== undefined) {\n resolvedConfig.serviceDesk = this.serviceDesk;\n }\n if (this.shouldTakeFocusIfOpensAutomatically !== undefined) {\n resolvedConfig.shouldTakeFocusIfOpensAutomatically =\n this.shouldTakeFocusIfOpensAutomatically;\n }\n if (this.namespace !== undefined) {\n resolvedConfig.namespace = this.namespace;\n }\n if (this.enableFocusTrap !== undefined) {\n resolvedConfig.enableFocusTrap = this.enableFocusTrap;\n }\n if (this.shouldSanitizeHTML !== undefined) {\n resolvedConfig.shouldSanitizeHTML = this.shouldSanitizeHTML;\n }\n if (this.header !== undefined) {\n resolvedConfig.header = this.header;\n }\n if (this.input !== undefined) {\n resolvedConfig.input = this.input;\n }\n if (this.layout !== undefined) {\n resolvedConfig.layout = this.layout;\n }\n if (this.messaging !== undefined) {\n resolvedConfig.messaging = this.messaging;\n }\n if (this.isReadonly !== undefined) {\n resolvedConfig.isReadonly = this.isReadonly;\n }\n if (this.assistantName !== undefined) {\n resolvedConfig.assistantName = this.assistantName;\n }\n if (this.locale !== undefined) {\n resolvedConfig.locale = this.locale;\n }\n if (this.homescreen !== undefined) {\n resolvedConfig.homescreen = this.homescreen;\n }\n if (this.launcher !== undefined) {\n resolvedConfig.launcher = this.launcher;\n }\n if (this.strings !== undefined) {\n resolvedConfig.strings = this.strings;\n }\n\n if (this.aiDisabled === true) {\n resolvedConfig.aiEnabled = false;\n } else if (this.aiEnabled !== undefined) {\n resolvedConfig.aiEnabled = this.aiEnabled;\n }\n\n return resolvedConfig;\n }\n\n private onBeforeRenderOverride = async (instance: ChatInstance) => {\n this._instance = instance;\n if (this.onViewPreChange) {\n this._instance.on({\n type: BusEventType.VIEW_PRE_CHANGE,\n handler: this.onViewPreChange,\n });\n }\n this._instance.on({\n type: BusEventType.VIEW_CHANGE,\n handler: this.onViewChange || this.defaultViewChangeHandler,\n });\n this._instance.on({\n type: BusEventType.USER_DEFINED_RESPONSE,\n handler: this.userDefinedHandler,\n });\n this._instance.on({\n type: BusEventType.CHUNK_USER_DEFINED_RESPONSE,\n handler: this.userDefinedHandler,\n });\n this.addWriteableElementSlots();\n await this.onBeforeRender?.(instance);\n };\n\n private addWriteableElementSlots() {\n this._writeableElementSlots = Object.keys(this._instance.writeableElements);\n }\n\n render() {\n return html`\n <cds-aichat-container\n .config=${this.resolvedConfig}\n .onAfterRender=${this.onAfterRender}\n .onBeforeRender=${this.onBeforeRenderOverride}\n .element=${this}\n >\n ${this._writeableElementSlots.map(\n (slot) => html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n ${this._userDefinedSlotNames.map(\n (slot) => html`<div slot=${slot}><slot name=${slot}></slot></div>`,\n )}\n </cds-aichat-container>\n `;\n }\n}\n\n/**\n * Attributes interface for the cds-aichat-custom-element web component.\n * This interface extends {@link CdsAiChatContainerAttributes} and {@link PublicConfig} with additional component-specific props,\n * flattening all config properties as top-level properties for better TypeScript IntelliSense.\n *\n * @category Web component\n */\ninterface CdsAiChatCustomElementAttributes extends PublicConfig {\n /**\n * This function is called before the render function of Carbon AI Chat is called. This function can return a Promise\n * which will cause Carbon AI Chat to wait for it before rendering.\n */\n onBeforeRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * This function is called after the render function of Carbon AI Chat is called.\n */\n onAfterRender?: (instance: ChatInstance) => Promise<void> | void;\n\n /**\n * An optional listener for \"view:change\" events. Such a listener is required when using a custom element in order\n * to control the visibility of the Carbon AI Chat main window. If no callback is provided here, a default one will be\n * used that injects styling into the app that will show and hide the Carbon AI Chat main window and also change the\n * size of the custom element so it doesn't take up space when the main window is closed.\n *\n * You can provide a different callback here if you want custom behavior such as an animation when the main window\n * is opened or closed.\n *\n * Note that this function can only be provided before Carbon AI Chat is loaded. After Carbon AI Chat is loaded, the event\n * handler will not be updated.\n */\n onViewChange?: (event: BusEventViewChange, instance: ChatInstance) => void;\n}\n\nexport { CdsAiChatCustomElementAttributes };\n\nexport default ChatCustomElement;\n"],"names":["ChatCustomElement","ChatCustomElement_1","LitElement","constructor","this","_userDefinedSlotNames","_writeableElementSlots","defaultViewChangeHandler","event","newViewState","mainWindow","classList","remove","add","userDefinedHandler","slot","data","includes","onBeforeRenderOverride","async","instance","_instance","onViewPreChange","on","type","BusEventType","VIEW_PRE_CHANGE","handler","VIEW_CHANGE","onViewChange","USER_DEFINED_RESPONSE","CHUNK_USER_DEFINED_RESPONSE","addWriteableElementSlots","onBeforeRender","firstUpdated","style","document","createElement","textContent","appendChild","createRenderRoot","root","super","adoptedStyleSheets","hideSheet","resolvedConfig","baseConfig","config","onError","undefined","openChatByDefault","disclaimer","disableCustomElementMobileEnhancements","debug","exposeServiceManagerForTesting","injectCarbonTheme","serviceDeskFactory","serviceDesk","shouldTakeFocusIfOpensAutomatically","namespace","enableFocusTrap","shouldSanitizeHTML","header","input","layout","messaging","isReadonly","assistantName","locale","homescreen","launcher","strings","aiDisabled","aiEnabled","Object","keys","writeableElements","render","html","onAfterRender","map","CSSStyleSheet","replaceSync","__decorate","property","attribute","prototype","Boolean","String","converter","fromAttribute","value","v","trim","toLowerCase","falsey","state","carbonElement","ChatCustomElement_default"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,IAAMA,oBAAiBC,sBAAvB,MAAMD,0BAA0BE;EAAhC,WAAAC;;IAiNUC,KAAAC,wBAAkC;IAGlCD,KAAAE,yBAAmC;IAKnCF,KAAAG,2BAA4BC;MAClC,IAAIA,MAAMC,aAAaC,YAAY;QACjCN,KAAKO,UAAUC,OAAO;AACxB,aAAO;QACLR,KAAKO,UAAUE,IAAI;AACrB;;IAGMT,KAAAU,qBACNN;MAEA,OAAMO,QAAWP,MAAMQ;MACvB,KAAKZ,KAAKC,sBAAsBY,SAASF,OAAO;QAC9CX,KAAKC,wBAAwB,KAAID,KAAKC,uBAAuBU;AAC/D;;IAyFMX,KAAAc,yBAAyBC,MAAOC;MACtChB,KAAKiB,YAAYD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