@carbon/ai-chat 1.13.0 → 1.14.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/css/chat-explainability-popover.css +161 -0
- package/dist/es/aiChatEntry.js +14 -2
- package/dist/es/aiChatEntry.js.map +1 -1
- package/dist/es/chat.ChatAppEntry.js +112 -20
- package/dist/es/chat.ChatAppEntry.js.map +1 -1
- package/dist/es/chat.index.js +581 -0
- package/dist/es/chat.index.js.map +1 -0
- package/dist/es/chat.languageUtils.js +2 -0
- package/dist/es/chat.languageUtils.js.map +1 -1
- package/dist/es/web-components/cds-aichat-container/index.js +10 -500
- package/dist/es/web-components/cds-aichat-container/index.js.map +1 -1
- package/dist/es/web-components/cds-aichat-custom-element/index.js +19 -227
- package/dist/es/web-components/cds-aichat-custom-element/index.js.map +1 -1
- package/dist/es-custom/aiChatEntry.js +14 -2
- package/dist/es-custom/aiChatEntry.js.map +1 -1
- package/dist/es-custom/chat.ChatAppEntry.js +112 -20
- package/dist/es-custom/chat.ChatAppEntry.js.map +1 -1
- package/dist/es-custom/chat.index.js +581 -0
- package/dist/es-custom/chat.index.js.map +1 -0
- package/dist/es-custom/chat.languageUtils.js +2 -0
- package/dist/es-custom/chat.languageUtils.js.map +1 -1
- package/dist/es-custom/web-components/cds-aichat-container/index.js +10 -500
- 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 +19 -227
- package/dist/es-custom/web-components/cds-aichat-custom-element/index.js.map +1 -1
- package/dist/scss/_chat-explainability-popover.scss +154 -0
- package/dist/types/aiChatEntry.d.ts +2 -2
- package/dist/types/{serverEntry-CU81SMOz.d.ts → serverEntry-mONw-M8N.d.ts} +206 -47
- package/dist/types/serverEntry.d.ts +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright IBM Corp. 2026, 2026
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* AI Explainability Popover content styles for Carbon AI Chat.
|
|
10
|
+
* Following @carbon/styles component patterns where styles are wrapped in mixins.
|
|
11
|
+
*
|
|
12
|
+
* These styles provide consistent typography and spacing for AI explainability
|
|
13
|
+
* popover content used in AI Chat.
|
|
14
|
+
*
|
|
15
|
+
* Usage (Sass — mixin, for composing into your own stylesheet):
|
|
16
|
+
* @use "@carbon/ai-chat/scss/chat-explainability-popover";
|
|
17
|
+
* @include chat-explainability-popover.explainability-popover-content;
|
|
18
|
+
*
|
|
19
|
+
* Usage (CSS — pre-compiled, no Sass pipeline needed):
|
|
20
|
+
* @import "@carbon/ai-chat/css/chat-explainability-popover.css";
|
|
21
|
+
*
|
|
22
|
+
* Classes generated:
|
|
23
|
+
* - .cds-aichat-explainability-popover--content — container wrapper
|
|
24
|
+
* - .cds-aichat-explainability-popover--content__header — header section
|
|
25
|
+
* - .cds-aichat-explainability-popover--content__eyebrow-row — top header row with label and tag
|
|
26
|
+
* - .cds-aichat-explainability-popover--content__label — eyebrow label text
|
|
27
|
+
* - .cds-aichat-explainability-popover--content__title — main heading
|
|
28
|
+
* - .cds-aichat-explainability-popover--content__description — description text below title
|
|
29
|
+
* - .cds-aichat-explainability-popover--content__section — content section with spacing
|
|
30
|
+
*/
|
|
31
|
+
/*
|
|
32
|
+
* Copyright IBM Corp. 2025
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/
|
|
37
|
+
/*
|
|
38
|
+
* Copyright IBM Corp. 2025
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/
|
|
43
|
+
/*
|
|
44
|
+
* Copyright IBM Corp. 2025
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/
|
|
49
|
+
/* ============================================================================
|
|
50
|
+
EXPLAINABILITY POPOVER - CONTENT WRAPPER
|
|
51
|
+
Container for all explainability popover content
|
|
52
|
+
============================================================================ */
|
|
53
|
+
.cds-aichat-explainability-popover--content {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
gap: 1.5rem;
|
|
57
|
+
padding-block-start: 0.5rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* ============================================================================
|
|
61
|
+
EXPLAINABILITY POPOVER - HEADER
|
|
62
|
+
Header containing eyebrow label, confidence score, title, and description
|
|
63
|
+
============================================================================ */
|
|
64
|
+
.cds-aichat-explainability-popover--content__header {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
gap: 0.5rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ============================================================================
|
|
71
|
+
EXPLAINABILITY POPOVER - EYEBROW ROW
|
|
72
|
+
Top row containing label and optional tag/badge
|
|
73
|
+
============================================================================ */
|
|
74
|
+
.cds-aichat-explainability-popover--content__eyebrow-row {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: space-between;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ============================================================================
|
|
81
|
+
EXPLAINABILITY POPOVER - LABEL
|
|
82
|
+
Secondary text label (eyebrow text)
|
|
83
|
+
============================================================================ */
|
|
84
|
+
.cds-aichat-explainability-popover--content__label {
|
|
85
|
+
font-size: var(--cds-label-02-font-size, 0.875rem);
|
|
86
|
+
font-weight: var(--cds-label-02-font-weight, 400);
|
|
87
|
+
line-height: var(--cds-label-02-line-height, 1.28572);
|
|
88
|
+
letter-spacing: var(--cds-label-02-letter-spacing, 0.16px);
|
|
89
|
+
color: var(--cds-text-secondary, #525252);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* ============================================================================
|
|
93
|
+
EXPLAINABILITY POPOVER - TITLE
|
|
94
|
+
Main heading for the explainability content
|
|
95
|
+
============================================================================ */
|
|
96
|
+
.cds-aichat-explainability-popover--content__title {
|
|
97
|
+
font-size: var(--cds-heading-04-font-size, 1.75rem);
|
|
98
|
+
font-weight: var(--cds-heading-04-font-weight, 400);
|
|
99
|
+
line-height: var(--cds-heading-04-line-height, 1.28572);
|
|
100
|
+
letter-spacing: var(--cds-heading-04-letter-spacing, 0);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* ============================================================================
|
|
104
|
+
EXPLAINABILITY POPOVER - DESCRIPTION
|
|
105
|
+
Text description below header title
|
|
106
|
+
============================================================================ */
|
|
107
|
+
.cds-aichat-explainability-popover--content__description {
|
|
108
|
+
font-size: var(--cds-body-01-font-size, 0.875rem);
|
|
109
|
+
font-weight: var(--cds-body-01-font-weight, 400);
|
|
110
|
+
line-height: var(--cds-body-01-line-height, 1.42857);
|
|
111
|
+
letter-spacing: var(--cds-body-01-letter-spacing, 0.16px);
|
|
112
|
+
color: var(--cds-text-secondary, #525252);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* ============================================================================
|
|
116
|
+
EXPLAINABILITY POPOVER - CONTENT SECTION
|
|
117
|
+
Reusable section container for markdown or other content blocks
|
|
118
|
+
============================================================================ */
|
|
119
|
+
.cds-aichat-explainability-popover--content__section {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
border-block-start: 1px solid var(--cds-border-subtle-00, #e0e0e0);
|
|
123
|
+
gap: 1.5rem;
|
|
124
|
+
padding-block-start: 1.5rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.cds-aichat-explainability-popover--content__section:last-of-type {
|
|
128
|
+
padding-block-end: 1.5rem;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.cds-aichat-explainability-popover--content__section h3,
|
|
132
|
+
.cds-aichat-explainability-popover--content__section h4,
|
|
133
|
+
.cds-aichat-explainability-popover--content__section h5,
|
|
134
|
+
.cds-aichat-explainability-popover--content__section h6 {
|
|
135
|
+
font-size: var(--cds-body-01-font-size, 0.875rem);
|
|
136
|
+
font-weight: var(--cds-body-01-font-weight, 400);
|
|
137
|
+
line-height: var(--cds-body-01-line-height, 1.42857);
|
|
138
|
+
letter-spacing: var(--cds-body-01-letter-spacing, 0.16px);
|
|
139
|
+
color: var(--cds-text-secondary, #525252);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.cds-aichat-explainability-popover--content__section p {
|
|
143
|
+
font-size: var(--cds-body-01-font-size, 0.875rem);
|
|
144
|
+
font-weight: var(--cds-body-01-font-weight, 400);
|
|
145
|
+
line-height: var(--cds-body-01-line-height, 1.42857);
|
|
146
|
+
letter-spacing: var(--cds-body-01-letter-spacing, 0.16px);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.cds-aichat-explainability-popover--content__section .cds--list--ordered .cds--list__item::before {
|
|
150
|
+
position: static;
|
|
151
|
+
display: inline-block;
|
|
152
|
+
margin-inline-end: 0.5rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* ============================================================================
|
|
156
|
+
EXPLAINABILITY POPOVER - ACTIONS
|
|
157
|
+
Container for action buttons in the popover
|
|
158
|
+
============================================================================ */
|
|
159
|
+
.cds-aichat-explainability-popover--actions {
|
|
160
|
+
display: flex;
|
|
161
|
+
}
|
package/dist/es/aiChatEntry.js
CHANGED
|
@@ -271,7 +271,7 @@ const ReactChatContainer = React.memo(createComponent({
|
|
|
271
271
|
}));
|
|
272
272
|
|
|
273
273
|
function ChatContainer(props) {
|
|
274
|
-
const {onBeforeRender, onAfterRender, strings, serviceDeskFactory, serviceDesk, renderUserDefinedResponse, renderCustomMessageFooter, renderWriteableElements, element, onError, openChatByDefault, disclaimer, disableCustomElementMobileEnhancements, debug, exposeServiceManagerForTesting, injectCarbonTheme, aiEnabled, shouldTakeFocusIfOpensAutomatically, namespace, shouldSanitizeHTML, header, history, layout, messaging, isReadonly, persistFeedback, assistantName, assistantAvatarUrl, locale, homescreen, launcher, input, keyboardShortcuts, upload, ...domProps} = props;
|
|
274
|
+
const {onBeforeRender, onAfterRender, onViewChange, onViewPreChange, strings, serviceDeskFactory, serviceDesk, renderUserDefinedResponse, renderCustomMessageFooter, renderWriteableElements, element, onError, openChatByDefault, disclaimer, disableCustomElementMobileEnhancements, debug, exposeServiceManagerForTesting, injectCarbonTheme, aiEnabled, shouldTakeFocusIfOpensAutomatically, namespace, shouldSanitizeHTML, header, history, layout, messaging, isReadonly, persistFeedback, assistantName, assistantAvatarUrl, locale, homescreen, launcher, input, keyboardShortcuts, upload, ...domProps} = props;
|
|
275
275
|
const config = useMemo(() => ({
|
|
276
276
|
onError,
|
|
277
277
|
openChatByDefault,
|
|
@@ -360,9 +360,21 @@ function ChatContainer(props) {
|
|
|
360
360
|
setWriteableElementSlots(slots);
|
|
361
361
|
};
|
|
362
362
|
addWriteableElementSlots();
|
|
363
|
+
if (onViewPreChange) {
|
|
364
|
+
instance.on({
|
|
365
|
+
type: BusEventType.VIEW_PRE_CHANGE,
|
|
366
|
+
handler: onViewPreChange
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
if (onViewChange) {
|
|
370
|
+
instance.on({
|
|
371
|
+
type: BusEventType.VIEW_CHANGE,
|
|
372
|
+
handler: onViewChange
|
|
373
|
+
});
|
|
374
|
+
}
|
|
363
375
|
onBeforeRender?.(instance);
|
|
364
376
|
}
|
|
365
|
-
}, [ onBeforeRender ]);
|
|
377
|
+
}, [ onBeforeRender, onViewChange, onViewPreChange ]);
|
|
366
378
|
if (!isBrowser()) {
|
|
367
379
|
return null;
|
|
368
380
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiChatEntry.js","sources":["../../../../src/globals/utils/readCarbonChatSession.ts","../../../../src/react/ChatContainer.tsx","../../../../src/react/ChatCustomElement.tsx"],"sourcesContent":["/*\n * Copyright IBM Corp. 2026\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\nimport { VERSION } from \"../../chat/utils/environmentVariables\";\nimport { PersistedState } from \"../../types/state/AppState\";\nimport { IS_SESSION_STORAGE } from \"../../chat/utils/browserUtils\";\nimport { getSuffix } from \"../../chat/services/NamespaceService\";\n\n/**\n * Reads and validates the Carbon AI Chat session from sessionStorage.\n * Returns null if no session exists, if the data is corrupt, or if the\n * session was written by a different version of the library (version mismatch).\n *\n * Pass the same namespace value as {@link PublicConfig.namespace} (if any).\n *\n * @category Utilities\n *\n * @example\n * const session = readCarbonChatSession();\n * const wasOpen = session?.viewState.mainWindow === true;\n *\n * @example\n * // With a namespace matching PublicConfig.namespace\n * const session = readCarbonChatSession(\"myapp\");\n * const wasOpen = session?.viewState.mainWindow === true;\n */\nfunction readCarbonChatSession(namespace?: string): PersistedState | null {\n try {\n if (!IS_SESSION_STORAGE()) {\n return null;\n }\n const key = `CARBON_CHAT_SESSION${getSuffix(namespace)}`;\n const raw = window.sessionStorage.getItem(key);\n if (!raw) {\n return null;\n }\n const session = JSON.parse(raw) as PersistedState;\n if (session?.version !== VERSION) {\n return null;\n }\n return session;\n } catch {\n return null;\n }\n}\n\nexport { readCarbonChatSession };\n","/*\n * Copyright IBM Corp. 2025, 2026\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\nimport { createComponent } from \"@lit/react\";\nimport { css, LitElement, PropertyValues } from \"lit\";\nimport React, {\n type HTMLAttributes,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport ChatAppEntry from \"../chat/ChatAppEntry\";\nimport { carbonElement } from \"@carbon/ai-chat-components/es/globals/decorators/index.js\";\nimport { ChatContainerProps } from \"../types/component/ChatContainer\";\nimport { ChatInstance } from \"../types/instance/ChatInstance\";\nimport { PublicConfig } from \"../types/config/PublicConfig\";\nimport { isBrowser } from \"../chat/utils/browserUtils\";\n\n/**\n * This component creates a custom element protected by a shadow DOM to render the React application into. It creates\n * slotted elements for user_defined responses and for writable elements.\n *\n * The corresponding slots are defined within the React application and are rendered in place.\n */\n\n/**\n * Create a web component to host the React application. We do this so we can provide custom elements and user_defined responses as\n * slotted content so they maintain their own styling in a safe way.\n */\n@carbonElement(\"cds-aichat-react\")\nclass ChatContainerReact extends LitElement {\n static styles = css`\n :host {\n width: 100%;\n height: 100%;\n }\n `;\n\n /**\n * Dispatch a custom event when the shadow DOM is ready\n * This ensures React can safely access shadowRoot\n */\n firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n this.dispatchEvent(new CustomEvent(\"shadow-ready\", { bubbles: true }));\n }\n}\n\n// Wrap the custom element as a React component\nconst ReactChatContainer = React.memo(\n createComponent({\n tagName: \"cds-aichat-react\",\n elementClass: ChatContainerReact,\n react: React,\n }),\n);\n\n/**\n * The ChatContainer controls rendering the React application into the shadow DOM of the cds-aichat-react web component.\n * It also injects the writeable element and user_defined response slots into said web component.\n *\n * @category React\n */\nfunction ChatContainer(\n props: ChatContainerProps &\n Omit<HTMLAttributes<HTMLElement>, keyof ChatContainerProps>,\n) {\n const {\n onBeforeRender,\n onAfterRender,\n strings,\n serviceDeskFactory,\n serviceDesk,\n renderUserDefinedResponse,\n renderCustomMessageFooter,\n renderWriteableElements,\n element,\n // Flattened PublicConfig properties\n onError,\n openChatByDefault,\n disclaimer,\n disableCustomElementMobileEnhancements,\n debug,\n exposeServiceManagerForTesting,\n injectCarbonTheme,\n aiEnabled,\n shouldTakeFocusIfOpensAutomatically,\n namespace,\n shouldSanitizeHTML,\n header,\n history,\n layout,\n messaging,\n isReadonly,\n persistFeedback,\n assistantName,\n assistantAvatarUrl,\n locale,\n homescreen,\n launcher,\n input,\n keyboardShortcuts,\n upload,\n ...domProps\n } = props;\n // Reconstruct PublicConfig from flattened props\n const config = useMemo(\n (): PublicConfig => ({\n onError,\n openChatByDefault,\n disclaimer,\n disableCustomElementMobileEnhancements,\n debug,\n exposeServiceManagerForTesting,\n injectCarbonTheme,\n aiEnabled,\n shouldTakeFocusIfOpensAutomatically,\n namespace,\n shouldSanitizeHTML,\n header,\n history,\n layout,\n messaging,\n isReadonly,\n persistFeedback,\n assistantName,\n assistantAvatarUrl,\n locale,\n homescreen,\n launcher,\n input,\n keyboardShortcuts,\n upload,\n }),\n [\n onError,\n openChatByDefault,\n disclaimer,\n disableCustomElementMobileEnhancements,\n debug,\n exposeServiceManagerForTesting,\n injectCarbonTheme,\n aiEnabled,\n shouldTakeFocusIfOpensAutomatically,\n namespace,\n shouldSanitizeHTML,\n header,\n history,\n layout,\n messaging,\n isReadonly,\n persistFeedback,\n assistantName,\n assistantAvatarUrl,\n locale,\n homescreen,\n launcher,\n input,\n keyboardShortcuts,\n upload,\n ],\n );\n\n const wrapperRef = useRef(null); // Ref for the React wrapper component\n const [wrapper, setWrapper] = useState(null);\n const [container, setContainer] = useState<HTMLElement | null>(null); // Actual element we render the React Portal to in the Shadowroot.\n\n const [writeableElementSlots, setWriteableElementSlots] = useState<\n HTMLElement[]\n >([]);\n const [currentInstance, setCurrentInstance] = useState<ChatInstance>(null);\n\n /**\n * Setup the DOM nodes of both the web component to be able to inject slotted content into it, and the element inside the\n * shadow DOM we will inject our React application into.\n */\n useEffect(() => {\n if (!wrapperRef.current) {\n return null; // Early return when there's nothing to set up because the element isn't ready.\n }\n\n let eventListenerAdded = false;\n\n const wrapperElement = wrapperRef.current as unknown as ChatContainerReact;\n\n // We need to check if the element in the shadow DOM we are render the React application to exists.\n // If it doesn't, we need to create and append it.\n\n const handleShadowReady = () => {\n // Now we know shadowRoot is definitely available\n let reactElement = wrapperElement.shadowRoot.querySelector(\n \".cds-aichat--react-app\",\n ) as HTMLElement;\n\n if (!reactElement) {\n reactElement = document.createElement(\"div\");\n reactElement.classList.add(\"cds-aichat--react-app\");\n wrapperElement.shadowRoot.appendChild(reactElement);\n }\n\n if (wrapperElement !== wrapper) {\n setWrapper(wrapperElement);\n }\n if (reactElement !== container) {\n setContainer(reactElement);\n }\n };\n\n if (wrapperElement.shadowRoot) {\n // Already ready\n handleShadowReady();\n } else {\n // Wait for ready event\n eventListenerAdded = true;\n wrapperElement.addEventListener(\"shadow-ready\", handleShadowReady, {\n once: true,\n });\n }\n\n return () => {\n if (eventListenerAdded) {\n wrapperElement.removeEventListener(\"shadow-ready\", handleShadowReady);\n }\n };\n }, [container, wrapper, currentInstance]);\n\n /**\n * Here we write the slotted elements into the wrapper so they are passed into the application to be rendered in their slot.\n */\n useEffect(() => {\n if (wrapper) {\n const combinedNodes: HTMLElement[] = [...writeableElementSlots];\n const currentNodes: HTMLElement[] = Array.from(\n wrapper.childNodes,\n ) as HTMLElement[];\n\n // Append new nodes that aren't already in the container\n combinedNodes.forEach((node) => {\n if (!currentNodes.includes(node)) {\n wrapper.appendChild(node);\n }\n });\n }\n }, [writeableElementSlots, wrapper]);\n\n const onBeforeRenderOverride = useCallback(\n (instance: ChatInstance) => {\n if (instance) {\n const addWriteableElementSlots = () => {\n const slots: HTMLElement[] = Object.entries(\n instance.writeableElements,\n ).map((writeableElement) => {\n const [key, element] = writeableElement;\n element.setAttribute(\"slot\", key); // Assign slot attributes dynamically\n return element;\n });\n setWriteableElementSlots(slots);\n };\n\n addWriteableElementSlots();\n onBeforeRender?.(instance);\n }\n },\n [onBeforeRender],\n );\n\n // If we are in SSR mode, just short circuit here. This prevents all of our window.* and document.* stuff from trying\n // to run and erroring out.\n if (!isBrowser()) {\n return null;\n }\n\n return (\n <>\n <ReactChatContainer ref={wrapperRef} {...domProps} />\n {container &&\n createPortal(\n <ChatAppEntry\n key=\"stable-chat-instance\"\n config={config}\n strings={strings}\n serviceDeskFactory={serviceDeskFactory}\n serviceDesk={serviceDesk}\n renderUserDefinedResponse={renderUserDefinedResponse}\n renderCustomMessageFooter={renderCustomMessageFooter}\n renderWriteableElements={renderWriteableElements}\n onBeforeRender={onBeforeRenderOverride}\n onAfterRender={onAfterRender}\n container={container}\n setParentInstance={setCurrentInstance}\n element={element}\n chatWrapper={wrapper}\n />,\n container,\n )}\n </>\n );\n}\n\nexport { ChatContainer, ChatContainerProps };\n","/*\n * Copyright IBM Corp. 2025, 2026\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\nimport React, {\n type HTMLAttributes,\n useCallback,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport { ChatInstance } from \"../types/instance/ChatInstance\";\nimport {\n BusEventType,\n BusEventViewChange,\n BusEventViewPreChange,\n} from \"../types/events/eventBusTypes\";\nimport { ChatContainer, ChatContainerProps } from \"./ChatContainer\";\nimport { isBrowser } from \"../chat/utils/browserUtils\";\n\n/**\n * Properties for the ChatContainer React component. This interface extends\n * {@link ChatContainerProps} and {@link PublicConfig} with additional component-specific props, flattening all\n * config properties as top-level props for better TypeScript IntelliSense.\n *\n * @category React\n */\ninterface ChatCustomElementProps extends ChatContainerProps {\n /**\n * A CSS class name that will be added to the custom element. This class must define the size of the\n * your custom element (width and height or using logical inline-size/block-size).\n *\n * You can make use of onViewPreChange and/or onViewChange to mutate this className value so have open/close animations.\n *\n * By default, the chat will just set the chat shell to a 0x0 size and mark everything but the launcher (is you are using it)\n * as display: none; if the chat is set to closed.\n */\n className: string;\n\n /**\n * An optional id that will be added to the custom element.\n */\n id?: string;\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 className value *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 onViewPreChange?: (\n event: BusEventViewPreChange,\n instance: ChatInstance,\n ) => 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 onViewChange?: (event: BusEventViewChange, instance: ChatInstance) => void;\n}\n\nconst customElementStylesheet =\n isBrowser() && typeof CSSStyleSheet !== \"undefined\"\n ? new CSSStyleSheet()\n : null;\n\nconst hideStyles = `\n .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 }\n`;\n\n// Inject styles using adopted stylesheets when available, fallback to style element\nif (\n isBrowser() &&\n !document.getElementById(\"cds-aichat-custom-element-styles\")\n) {\n if (customElementStylesheet && \"replaceSync\" in customElementStylesheet) {\n customElementStylesheet.replaceSync(hideStyles);\n document.adoptedStyleSheets = [\n ...document.adoptedStyleSheets,\n customElementStylesheet,\n ];\n } else {\n // Fallback for when adoptedStyleSheets are not supported\n const style = document.createElement(\"style\");\n style.id = \"cds-aichat-custom-element-styles\";\n style.textContent = hideStyles;\n document.head.appendChild(style);\n }\n}\n\n/**\n * This is the React component for people injecting a Carbon AI Chat with a custom element.\n *\n * It provides said element any class or id defined on itself for styling. It then calls ChatContainer with the custom\n * element passed in as a property to be used instead of generating an element with the default properties for a\n * floating chat.\n *\n * @category React\n */\nfunction ChatCustomElement(\n props: ChatCustomElementProps &\n Omit<HTMLAttributes<HTMLDivElement>, keyof ChatCustomElementProps>,\n) {\n const {\n strings,\n serviceDeskFactory,\n serviceDesk,\n onBeforeRender,\n onAfterRender,\n renderUserDefinedResponse,\n renderCustomMessageFooter,\n renderWriteableElements,\n className,\n id,\n onViewChange,\n onViewPreChange,\n // Flattened PublicConfig properties\n onError,\n openChatByDefault,\n disclaimer,\n disableCustomElementMobileEnhancements,\n debug,\n exposeServiceManagerForTesting,\n injectCarbonTheme,\n aiEnabled,\n shouldTakeFocusIfOpensAutomatically,\n namespace,\n shouldSanitizeHTML,\n header,\n history,\n layout,\n messaging,\n isReadonly,\n persistFeedback,\n assistantName,\n assistantAvatarUrl,\n locale,\n homescreen,\n launcher,\n input,\n keyboardShortcuts,\n upload,\n ...domProps\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const [elementReady, setElementReady] = useState(false);\n\n useLayoutEffect(() => {\n setElementReady(true);\n }, []);\n\n const onBeforeRenderOverride = useCallback(\n async (instance: ChatInstance) => {\n /**\n * A default handler for the \"view:change\" event. This will be used to show or hide the Carbon AI Chat main window\n * by adding/removing a CSS class that sets the element size to 0x0 when hidden.\n */\n function defaultViewChangeHandler(event: BusEventViewChange) {\n const el = containerRef.current;\n if (el) {\n if (event.newViewState.mainWindow) {\n // Show: remove the hidden class, let the provided className handle sizing\n el.classList.remove(\"cds-aichat--hidden\");\n } else {\n // Hide: add the hidden class to set size to 0x0\n el.classList.add(\"cds-aichat--hidden\");\n }\n }\n }\n\n if (onViewPreChange) {\n instance.on({\n type: BusEventType.VIEW_PRE_CHANGE,\n handler: onViewPreChange,\n });\n }\n\n instance.on({\n type: BusEventType.VIEW_CHANGE,\n handler: onViewChange || defaultViewChangeHandler,\n });\n\n return onBeforeRender?.(instance);\n },\n [onViewPreChange, onViewChange, onBeforeRender],\n );\n\n return (\n <div className={className} id={id} ref={containerRef} {...domProps}>\n {elementReady && containerRef.current && (\n <ChatContainer\n // Flattened PublicConfig properties\n onError={onError}\n openChatByDefault={openChatByDefault}\n disclaimer={disclaimer}\n disableCustomElementMobileEnhancements={\n disableCustomElementMobileEnhancements\n }\n debug={debug}\n exposeServiceManagerForTesting={exposeServiceManagerForTesting}\n injectCarbonTheme={injectCarbonTheme}\n aiEnabled={aiEnabled}\n shouldTakeFocusIfOpensAutomatically={\n shouldTakeFocusIfOpensAutomatically\n }\n namespace={namespace}\n shouldSanitizeHTML={shouldSanitizeHTML}\n header={header}\n history={history}\n layout={layout}\n messaging={messaging}\n isReadonly={isReadonly}\n persistFeedback={persistFeedback}\n assistantName={assistantName}\n assistantAvatarUrl={assistantAvatarUrl}\n locale={locale}\n homescreen={homescreen}\n launcher={launcher}\n input={input}\n keyboardShortcuts={keyboardShortcuts}\n upload={upload}\n // Other ChatContainer props\n strings={strings}\n serviceDeskFactory={serviceDeskFactory}\n serviceDesk={serviceDesk}\n onBeforeRender={onBeforeRenderOverride}\n onAfterRender={onAfterRender}\n renderUserDefinedResponse={renderUserDefinedResponse}\n renderCustomMessageFooter={renderCustomMessageFooter}\n renderWriteableElements={renderWriteableElements}\n element={containerRef.current}\n />\n )}\n </div>\n );\n}\n\nexport { ChatCustomElement, ChatCustomElementProps };\n"],"names":["readCarbonChatSession","namespace","IS_SESSION_STORAGE","key","getSuffix","raw","window","sessionStorage","getItem","session","JSON","parse","version","VERSION","ChatContainerReact","LitElement","firstUpdated","changedProperties","super","this","dispatchEvent","CustomEvent","bubbles","styles","css","__decorate","carbonElement","ReactChatContainer","React","memo","createComponent","tagName","elementClass","react","ChatContainer","props","onBeforeRender","onAfterRender","strings","serviceDeskFactory","serviceDesk","renderUserDefinedResponse","renderCustomMessageFooter","renderWriteableElements","element","onError","openChatByDefault","disclaimer","disableCustomElementMobileEnhancements","debug","exposeServiceManagerForTesting","injectCarbonTheme","aiEnabled","shouldTakeFocusIfOpensAutomatically","shouldSanitizeHTML","header","history","layout","messaging","isReadonly","persistFeedback","assistantName","assistantAvatarUrl","locale","homescreen","launcher","input","keyboardShortcuts","upload","domProps","config","useMemo","wrapperRef","useRef","wrapper","setWrapper","useState","container","setContainer","writeableElementSlots","setWriteableElementSlots","currentInstance","setCurrentInstance","useEffect","current","eventListenerAdded","wrapperElement","handleShadowReady","reactElement","shadowRoot","querySelector","document","createElement","classList","add","appendChild","addEventListener","once","removeEventListener","combinedNodes","currentNodes","Array","from","childNodes","forEach","node","includes","onBeforeRenderOverride","useCallback","instance","addWriteableElementSlots","slots","Object","entries","writeableElements","map","writeableElement","setAttribute","isBrowser","Fragment","ref","createPortal","ChatAppEntry","setParentInstance","chatWrapper","customElementStylesheet","CSSStyleSheet","hideStyles","getElementById","replaceSync","adoptedStyleSheets","style","id","textContent","head","ChatCustomElement","className","onViewChange","onViewPreChange","containerRef","elementReady","setElementReady","useLayoutEffect","async","defaultViewChangeHandler","event","el","newViewState","mainWindow","remove","on","type","BusEventType","VIEW_PRE_CHANGE","handler","VIEW_CHANGE"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAASA,sBAAsBC;EAC7B;IACE,KAAKC,sBAAsB;MACzB,OAAO;AACT;IACA,MAAMC,MAAM,sBAAsBC,UAAUH;IAC5C,MAAMI,MAAMC,OAAOC,eAAeC,QAAQL;IAC1C,KAAKE,KAAK;MACR,OAAO;AACT;IACA,MAAMI,UAAUC,KAAKC,MAAMN;IAC3B,IAAII,SAASG,YAAYC,SAAS;MAChC,OAAO;AACT;IACA,OAAOJ;AACT,IAAE;IACA,OAAO;AACT;AACF;;ACVA,IAAMK,qBAAN,MAAMA,2BAA2BC;EAY/B,YAAAC,CAAaC;IACXC,MAAMF,aAAaC;IACnBE,KAAKC,cAAc,IAAIC,YAAY,gBAAgB;MAAEC,SAAS;;AAChE;;;AAdOR,mBAAAS,SAASC,GAAG;;;;;;;AADfV,qBAAkBW,WAAA,EADvBC,cAAc,uBACTZ;;AAmBN,MAAMa,qBAAqBC,MAAMC,KAC/BC,gBAAgB;EACdC,SAAS;EACTC,cAAclB;EACdmB,OAAOL;;;AAUX,SAASM,cACPC;EAGA,OAAMC,gBACUC,eACDC,SACNC,oBACWC,aACPC,2BACcC,2BACAC,yBACFC,SAChBC,SAEAC,mBACUC,YACPC,wCAC4BC,OACjCC,gCACyBC,mBACbC,WACRC,qCAC0BpD,WAC1BqD,oBACSC,QACZC,SACCC,QACDC,WACGC,YACCC,iBACKC,eACFC,oBACKC,QACZC,YACIC,UACFC,OACHC,mBACYC,WAEdC,YACDlC;EAEJ,MAAMmC,SAASC,QACb,OAAA;IACE1B;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACApD;IACAqD;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;MAEF,EACEvB,SACAC,mBACAC,YACAC,wCACAC,OACAC,gCACAC,mBACAC,WACAC,qCACApD,WACAqD,oBACAC,QACAC,SACAC,QACAC,WACAC,YACAC,iBACAC,eACAC,oBACAC,QACAC,YACAC,UACAC,OACAC,mBACAC;EAIJ,MAAMI,aAAaC,OAAO;EAC1B,OAAOC,SAASC,cAAcC,SAAS;EACvC,OAAOC,WAAWC,gBAAgBF,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D,OAAO;AACtB,eAAO;UAELH,GAAGrD,UAAUC,IAAI;AACnB;AACF;AACF;IAEA,IAAI4C,iBAAiB;MACnB7B,SAASyC,GAAG;QACVC,MAAMC,aAAaC;QACnBC,SAAShB;;AAEb;IAEA7B,SAASyC,GAAG;MACVC,MAAMC,aAAaG;MACnBD,SAASjB,gBAAgBO;;IAG3B,OAAO5G,iBAAiByE;KAE1B,EAAC6B,iBAAiBD,cAAcrG;EAGlC,OACER,MAAAgE,cAAA,OAAA;IAAK4C;IAAsBJ;IAAQZ,KAAKmB;OAAkBtE;KACvDuE,gBAAgBD,aAAavD,WAC5BxD,MAAAgE,cAAC1D;IAECW;IACAC;IACAC;IACAC;IAGAC;IACAC;IACAC;IACAC;IACAC;IAGApD;IACAqD;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IAEA9B;IACAC;IACAC;IACAJ,gBAAgBuE;IAChBtE;IACAI;IACAC;IACAC;IACAC,SAAS+F,aAAavD;;AAKhC;;"}
|
|
1
|
+
{"version":3,"file":"aiChatEntry.js","sources":["../../../../src/globals/utils/readCarbonChatSession.ts","../../../../src/react/ChatContainer.tsx","../../../../src/react/ChatCustomElement.tsx"],"sourcesContent":["/*\n * Copyright IBM Corp. 2026\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\nimport { VERSION } from \"../../chat/utils/environmentVariables\";\nimport { PersistedState } from \"../../types/state/AppState\";\nimport { IS_SESSION_STORAGE } from \"../../chat/utils/browserUtils\";\nimport { getSuffix } from \"../../chat/services/NamespaceService\";\n\n/**\n * Reads and validates the Carbon AI Chat session from sessionStorage.\n * Returns null if no session exists, if the data is corrupt, or if the\n * session was written by a different version of the library (version mismatch).\n *\n * Pass the same namespace value as {@link PublicConfig.namespace} (if any).\n *\n * @category Utilities\n *\n * @example\n * const session = readCarbonChatSession();\n * const wasOpen = session?.viewState.mainWindow === true;\n *\n * @example\n * // With a namespace matching PublicConfig.namespace\n * const session = readCarbonChatSession(\"myapp\");\n * const wasOpen = session?.viewState.mainWindow === true;\n */\nfunction readCarbonChatSession(namespace?: string): PersistedState | null {\n try {\n if (!IS_SESSION_STORAGE()) {\n return null;\n }\n const key = `CARBON_CHAT_SESSION${getSuffix(namespace)}`;\n const raw = window.sessionStorage.getItem(key);\n if (!raw) {\n return null;\n }\n const session = JSON.parse(raw) as PersistedState;\n if (session?.version !== VERSION) {\n return null;\n }\n return session;\n } catch {\n return null;\n }\n}\n\nexport { readCarbonChatSession };\n","/*\n * Copyright IBM Corp. 2025, 2026\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\nimport { createComponent } from \"@lit/react\";\nimport { css, LitElement, PropertyValues } from \"lit\";\nimport React, {\n type HTMLAttributes,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport ChatAppEntry from \"../chat/ChatAppEntry\";\nimport { carbonElement } from \"@carbon/ai-chat-components/es/globals/decorators/index.js\";\nimport { ChatContainerProps } from \"../types/component/ChatContainer\";\nimport { ChatInstance } from \"../types/instance/ChatInstance\";\nimport { BusEventType } from \"../types/events/eventBusTypes\";\nimport { PublicConfig } from \"../types/config/PublicConfig\";\nimport { isBrowser } from \"../chat/utils/browserUtils\";\n\n/**\n * This component creates a custom element protected by a shadow DOM to render the React application into. It creates\n * slotted elements for user_defined responses and for writable elements.\n *\n * The corresponding slots are defined within the React application and are rendered in place.\n */\n\n/**\n * Create a web component to host the React application. We do this so we can provide custom elements and user_defined responses as\n * slotted content so they maintain their own styling in a safe way.\n */\n@carbonElement(\"cds-aichat-react\")\nclass ChatContainerReact extends LitElement {\n static styles = css`\n :host {\n width: 100%;\n height: 100%;\n }\n `;\n\n /**\n * Dispatch a custom event when the shadow DOM is ready\n * This ensures React can safely access shadowRoot\n */\n firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n this.dispatchEvent(new CustomEvent(\"shadow-ready\", { bubbles: true }));\n }\n}\n\n// Wrap the custom element as a React component\nconst ReactChatContainer = React.memo(\n createComponent({\n tagName: \"cds-aichat-react\",\n elementClass: ChatContainerReact,\n react: React,\n }),\n);\n\n/**\n * The ChatContainer controls rendering the React application into the shadow DOM of the cds-aichat-react web component.\n * It also injects the writeable element and user_defined response slots into said web component.\n *\n * @category React\n */\nfunction ChatContainer(\n props: ChatContainerProps &\n Omit<HTMLAttributes<HTMLElement>, keyof ChatContainerProps>,\n) {\n const {\n onBeforeRender,\n onAfterRender,\n onViewChange,\n onViewPreChange,\n strings,\n serviceDeskFactory,\n serviceDesk,\n renderUserDefinedResponse,\n renderCustomMessageFooter,\n renderWriteableElements,\n element,\n // Flattened PublicConfig properties\n onError,\n openChatByDefault,\n disclaimer,\n disableCustomElementMobileEnhancements,\n debug,\n exposeServiceManagerForTesting,\n injectCarbonTheme,\n aiEnabled,\n shouldTakeFocusIfOpensAutomatically,\n namespace,\n shouldSanitizeHTML,\n header,\n history,\n layout,\n messaging,\n isReadonly,\n persistFeedback,\n assistantName,\n assistantAvatarUrl,\n locale,\n homescreen,\n launcher,\n input,\n keyboardShortcuts,\n upload,\n ...domProps\n } = props;\n // Reconstruct PublicConfig from flattened props\n const config = useMemo(\n (): PublicConfig => ({\n onError,\n openChatByDefault,\n disclaimer,\n disableCustomElementMobileEnhancements,\n debug,\n exposeServiceManagerForTesting,\n injectCarbonTheme,\n aiEnabled,\n shouldTakeFocusIfOpensAutomatically,\n namespace,\n shouldSanitizeHTML,\n header,\n history,\n layout,\n messaging,\n isReadonly,\n persistFeedback,\n assistantName,\n assistantAvatarUrl,\n locale,\n homescreen,\n launcher,\n input,\n keyboardShortcuts,\n upload,\n }),\n [\n onError,\n openChatByDefault,\n disclaimer,\n disableCustomElementMobileEnhancements,\n debug,\n exposeServiceManagerForTesting,\n injectCarbonTheme,\n aiEnabled,\n shouldTakeFocusIfOpensAutomatically,\n namespace,\n shouldSanitizeHTML,\n header,\n history,\n layout,\n messaging,\n isReadonly,\n persistFeedback,\n assistantName,\n assistantAvatarUrl,\n locale,\n homescreen,\n launcher,\n input,\n keyboardShortcuts,\n upload,\n ],\n );\n\n const wrapperRef = useRef(null); // Ref for the React wrapper component\n const [wrapper, setWrapper] = useState(null);\n const [container, setContainer] = useState<HTMLElement | null>(null); // Actual element we render the React Portal to in the Shadowroot.\n\n const [writeableElementSlots, setWriteableElementSlots] = useState<\n HTMLElement[]\n >([]);\n const [currentInstance, setCurrentInstance] = useState<ChatInstance>(null);\n\n /**\n * Setup the DOM nodes of both the web component to be able to inject slotted content into it, and the element inside the\n * shadow DOM we will inject our React application into.\n */\n useEffect(() => {\n if (!wrapperRef.current) {\n return null; // Early return when there's nothing to set up because the element isn't ready.\n }\n\n let eventListenerAdded = false;\n\n const wrapperElement = wrapperRef.current as unknown as ChatContainerReact;\n\n // We need to check if the element in the shadow DOM we are render the React application to exists.\n // If it doesn't, we need to create and append it.\n\n const handleShadowReady = () => {\n // Now we know shadowRoot is definitely available\n let reactElement = wrapperElement.shadowRoot.querySelector(\n \".cds-aichat--react-app\",\n ) as HTMLElement;\n\n if (!reactElement) {\n reactElement = document.createElement(\"div\");\n reactElement.classList.add(\"cds-aichat--react-app\");\n wrapperElement.shadowRoot.appendChild(reactElement);\n }\n\n if (wrapperElement !== wrapper) {\n setWrapper(wrapperElement);\n }\n if (reactElement !== container) {\n setContainer(reactElement);\n }\n };\n\n if (wrapperElement.shadowRoot) {\n // Already ready\n handleShadowReady();\n } else {\n // Wait for ready event\n eventListenerAdded = true;\n wrapperElement.addEventListener(\"shadow-ready\", handleShadowReady, {\n once: true,\n });\n }\n\n return () => {\n if (eventListenerAdded) {\n wrapperElement.removeEventListener(\"shadow-ready\", handleShadowReady);\n }\n };\n }, [container, wrapper, currentInstance]);\n\n /**\n * Here we write the slotted elements into the wrapper so they are passed into the application to be rendered in their slot.\n */\n useEffect(() => {\n if (wrapper) {\n const combinedNodes: HTMLElement[] = [...writeableElementSlots];\n const currentNodes: HTMLElement[] = Array.from(\n wrapper.childNodes,\n ) as HTMLElement[];\n\n // Append new nodes that aren't already in the container\n combinedNodes.forEach((node) => {\n if (!currentNodes.includes(node)) {\n wrapper.appendChild(node);\n }\n });\n }\n }, [writeableElementSlots, wrapper]);\n\n const onBeforeRenderOverride = useCallback(\n (instance: ChatInstance) => {\n if (instance) {\n const addWriteableElementSlots = () => {\n const slots: HTMLElement[] = Object.entries(\n instance.writeableElements,\n ).map((writeableElement) => {\n const [key, element] = writeableElement;\n element.setAttribute(\"slot\", key); // Assign slot attributes dynamically\n return element;\n });\n setWriteableElementSlots(slots);\n };\n\n addWriteableElementSlots();\n\n // Opt-in view-change observation hooks. The float container manages\n // its own visibility, so there is no default handler — a prop is only\n // subscribed when the consumer provides it.\n if (onViewPreChange) {\n instance.on({\n type: BusEventType.VIEW_PRE_CHANGE,\n handler: onViewPreChange,\n });\n }\n if (onViewChange) {\n instance.on({\n type: BusEventType.VIEW_CHANGE,\n handler: onViewChange,\n });\n }\n\n onBeforeRender?.(instance);\n }\n },\n [onBeforeRender, onViewChange, onViewPreChange],\n );\n\n // If we are in SSR mode, just short circuit here. This prevents all of our window.* and document.* stuff from trying\n // to run and erroring out.\n if (!isBrowser()) {\n return null;\n }\n\n return (\n <>\n <ReactChatContainer ref={wrapperRef} {...domProps} />\n {container &&\n createPortal(\n <ChatAppEntry\n key=\"stable-chat-instance\"\n config={config}\n strings={strings}\n serviceDeskFactory={serviceDeskFactory}\n serviceDesk={serviceDesk}\n renderUserDefinedResponse={renderUserDefinedResponse}\n renderCustomMessageFooter={renderCustomMessageFooter}\n renderWriteableElements={renderWriteableElements}\n onBeforeRender={onBeforeRenderOverride}\n onAfterRender={onAfterRender}\n container={container}\n setParentInstance={setCurrentInstance}\n element={element}\n chatWrapper={wrapper}\n />,\n container,\n )}\n </>\n );\n}\n\nexport { ChatContainer, ChatContainerProps };\n","/*\n * Copyright IBM Corp. 2025, 2026\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\nimport React, {\n type HTMLAttributes,\n useCallback,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport { ChatInstance } from \"../types/instance/ChatInstance\";\nimport {\n BusEventType,\n BusEventViewChange,\n BusEventViewPreChange,\n} from \"../types/events/eventBusTypes\";\nimport { ChatContainer, ChatContainerProps } from \"./ChatContainer\";\nimport { isBrowser } from \"../chat/utils/browserUtils\";\n\n/**\n * Properties for the ChatContainer React component. This interface extends\n * {@link ChatContainerProps} and {@link PublicConfig} with additional component-specific props, flattening all\n * config properties as top-level props for better TypeScript IntelliSense.\n *\n * @category React\n */\ninterface ChatCustomElementProps extends ChatContainerProps {\n /**\n * A CSS class name that will be added to the custom element. This class must define the size of the\n * your custom element (width and height or using logical inline-size/block-size).\n *\n * You can make use of onViewPreChange and/or onViewChange to mutate this className value so have open/close animations.\n *\n * By default, the chat will just set the chat shell to a 0x0 size and mark everything but the launcher (is you are using it)\n * as display: none; if the chat is set to closed.\n */\n className: string;\n\n /**\n * An optional id that will be added to the custom element.\n */\n id?: string;\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 className value *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 onViewPreChange?: (\n event: BusEventViewPreChange,\n instance: ChatInstance,\n ) => 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 onViewChange?: (event: BusEventViewChange, instance: ChatInstance) => void;\n}\n\nconst customElementStylesheet =\n isBrowser() && typeof CSSStyleSheet !== \"undefined\"\n ? new CSSStyleSheet()\n : null;\n\nconst hideStyles = `\n .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 }\n`;\n\n// Inject styles using adopted stylesheets when available, fallback to style element\nif (\n isBrowser() &&\n !document.getElementById(\"cds-aichat-custom-element-styles\")\n) {\n if (customElementStylesheet && \"replaceSync\" in customElementStylesheet) {\n customElementStylesheet.replaceSync(hideStyles);\n document.adoptedStyleSheets = [\n ...document.adoptedStyleSheets,\n customElementStylesheet,\n ];\n } else {\n // Fallback for when adoptedStyleSheets are not supported\n const style = document.createElement(\"style\");\n style.id = \"cds-aichat-custom-element-styles\";\n style.textContent = hideStyles;\n document.head.appendChild(style);\n }\n}\n\n/**\n * This is the React component for people injecting a Carbon AI Chat with a custom element.\n *\n * It provides said element any class or id defined on itself for styling. It then calls ChatContainer with the custom\n * element passed in as a property to be used instead of generating an element with the default properties for a\n * floating chat.\n *\n * @category React\n */\nfunction ChatCustomElement(\n props: ChatCustomElementProps &\n Omit<HTMLAttributes<HTMLDivElement>, keyof ChatCustomElementProps>,\n) {\n const {\n strings,\n serviceDeskFactory,\n serviceDesk,\n onBeforeRender,\n onAfterRender,\n renderUserDefinedResponse,\n renderCustomMessageFooter,\n renderWriteableElements,\n className,\n id,\n onViewChange,\n onViewPreChange,\n // Flattened PublicConfig properties\n onError,\n openChatByDefault,\n disclaimer,\n disableCustomElementMobileEnhancements,\n debug,\n exposeServiceManagerForTesting,\n injectCarbonTheme,\n aiEnabled,\n shouldTakeFocusIfOpensAutomatically,\n namespace,\n shouldSanitizeHTML,\n header,\n history,\n layout,\n messaging,\n isReadonly,\n persistFeedback,\n assistantName,\n assistantAvatarUrl,\n locale,\n homescreen,\n launcher,\n input,\n keyboardShortcuts,\n upload,\n ...domProps\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const [elementReady, setElementReady] = useState(false);\n\n useLayoutEffect(() => {\n setElementReady(true);\n }, []);\n\n const onBeforeRenderOverride = useCallback(\n async (instance: ChatInstance) => {\n /**\n * A default handler for the \"view:change\" event. This will be used to show or hide the Carbon AI Chat main window\n * by adding/removing a CSS class that sets the element size to 0x0 when hidden.\n */\n function defaultViewChangeHandler(event: BusEventViewChange) {\n const el = containerRef.current;\n if (el) {\n if (event.newViewState.mainWindow) {\n // Show: remove the hidden class, let the provided className handle sizing\n el.classList.remove(\"cds-aichat--hidden\");\n } else {\n // Hide: add the hidden class to set size to 0x0\n el.classList.add(\"cds-aichat--hidden\");\n }\n }\n }\n\n if (onViewPreChange) {\n instance.on({\n type: BusEventType.VIEW_PRE_CHANGE,\n handler: onViewPreChange,\n });\n }\n\n instance.on({\n type: BusEventType.VIEW_CHANGE,\n handler: onViewChange || defaultViewChangeHandler,\n });\n\n return onBeforeRender?.(instance);\n },\n [onViewPreChange, onViewChange, onBeforeRender],\n );\n\n return (\n <div className={className} id={id} ref={containerRef} {...domProps}>\n {elementReady && containerRef.current && (\n <ChatContainer\n // Flattened PublicConfig properties\n onError={onError}\n openChatByDefault={openChatByDefault}\n disclaimer={disclaimer}\n disableCustomElementMobileEnhancements={\n disableCustomElementMobileEnhancements\n }\n debug={debug}\n exposeServiceManagerForTesting={exposeServiceManagerForTesting}\n injectCarbonTheme={injectCarbonTheme}\n aiEnabled={aiEnabled}\n shouldTakeFocusIfOpensAutomatically={\n shouldTakeFocusIfOpensAutomatically\n }\n namespace={namespace}\n shouldSanitizeHTML={shouldSanitizeHTML}\n header={header}\n history={history}\n layout={layout}\n messaging={messaging}\n isReadonly={isReadonly}\n persistFeedback={persistFeedback}\n assistantName={assistantName}\n assistantAvatarUrl={assistantAvatarUrl}\n locale={locale}\n homescreen={homescreen}\n launcher={launcher}\n input={input}\n keyboardShortcuts={keyboardShortcuts}\n upload={upload}\n // Other ChatContainer props\n strings={strings}\n serviceDeskFactory={serviceDeskFactory}\n serviceDesk={serviceDesk}\n onBeforeRender={onBeforeRenderOverride}\n onAfterRender={onAfterRender}\n renderUserDefinedResponse={renderUserDefinedResponse}\n renderCustomMessageFooter={renderCustomMessageFooter}\n renderWriteableElements={renderWriteableElements}\n element={containerRef.current}\n />\n )}\n </div>\n );\n}\n\nexport { ChatCustomElement, ChatCustomElementProps };\n"],"names":["readCarbonChatSession","namespace","IS_SESSION_STORAGE","key","getSuffix","raw","window","sessionStorage","getItem","session","JSON","parse","version","VERSION","ChatContainerReact","LitElement","firstUpdated","changedProperties","super","this","dispatchEvent","CustomEvent","bubbles","styles","css","__decorate","carbonElement","ReactChatContainer","React","memo","createComponent","tagName","elementClass","react","ChatContainer","props","onBeforeRender","onAfterRender","onViewChange","onViewPreChange","strings","serviceDeskFactory","serviceDesk","renderUserDefinedResponse","renderCustomMessageFooter","renderWriteableElements","element","onError","openChatByDefault","disclaimer","disableCustomElementMobileEnhancements","debug","exposeServiceManagerForTesting","injectCarbonTheme","aiEnabled","shouldTakeFocusIfOpensAutomatically","shouldSanitizeHTML","header","history","layout","messaging","isReadonly","persistFeedback","assistantName","assistantAvatarUrl","locale","homescreen","launcher","input","keyboardShortcuts","upload","domProps","config","useMemo","wrapperRef","useRef","wrapper","setWrapper","useState","container","setContainer","writeableElementSlots","setWriteableElementSlots","currentInstance","setCurrentInstance","useEffect","current","eventListenerAdded","wrapperElement","handleShadowReady","reactElement","shadowRoot","querySelector","document","createElement","classList","add","appendChild","addEventListener","once","removeEventListener","combinedNodes","currentNodes","Array","from","childNodes","forEach","node","includes","onBeforeRenderOverride","useCallback","instance","addWriteableElementSlots","slots","Object","entries","writeableElements","map","writeableElement","setAttribute","on","type","BusEventType","VIEW_PRE_CHANGE","handler","VIEW_CHANGE","isBrowser","Fragment","ref","createPortal","ChatAppEntry","setParentInstance","chatWrapper","customElementStylesheet","CSSStyleSheet","hideStyles","getElementById","replaceSync","adoptedStyleSheets","style","id","textContent","head","ChatCustomElement","className","containerRef","elementReady","setElementReady","useLayoutEffect","async","defaultViewChangeHandler","event","el","newViewState","mainWindow","remove"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAASA,sBAAsBC;EAC7B;IACE,KAAKC,sBAAsB;MACzB,OAAO;AACT;IACA,MAAMC,MAAM,sBAAsBC,UAAUH;IAC5C,MAAMI,MAAMC,OAAOC,eAAeC,QAAQL;IAC1C,KAAKE,KAAK;MACR,OAAO;AACT;IACA,MAAMI,UAAUC,KAAKC,MAAMN;IAC3B,IAAII,SAASG,YAAYC,SAAS;MAChC,OAAO;AACT;IACA,OAAOJ;AACT,IAAE;IACA,OAAO;AACT;AACF;;ACTA,IAAMK,qBAAN,M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