@carbon/ai-chat 0.4.0-rc.4 → 0.4.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/README.md +1 -1
- package/dist/es/aiChatEntry.js +184 -45
- package/dist/es/chat.AppContainer.js +16336 -4758
- package/dist/es/chat.customElement.js +13 -17
- package/dist/es/chat.markdown.js +15 -16
- package/dist/es/web-components/cds-aichat-container/index.js +186 -23
- package/dist/es/web-components/cds-aichat-custom-element/index.js +2 -11
- package/dist/types/aiChatEntry.d.ts +14 -2
- package/package.json +8 -19
- package/dist/es/chat.AppState.js +0 -40
- package/dist/es/chat.BasePanelComponent.js +0 -50
- package/dist/es/chat.BodyAndFooterPanelComponent.js +0 -151
- package/dist/es/chat.BodyWithFooterComponent.js +0 -140
- package/dist/es/chat.BotHeader.js +0 -87
- package/dist/es/chat.Carousel.js +0 -99
- package/dist/es/chat.CatastrophicError.js +0 -381
- package/dist/es/chat.Chat.js +0 -2009
- package/dist/es/chat.Disclaimer.js +0 -553
- package/dist/es/chat.Header.js +0 -1025
- package/dist/es/chat.HideComponent.js +0 -33
- package/dist/es/chat.HomeScreenConfig.js +0 -16
- package/dist/es/chat.HomeScreenContainer.js +0 -280
- package/dist/es/chat.HomeScreenHeader.js +0 -52
- package/dist/es/chat.HumanAgentServiceImpl.js +0 -872
- package/dist/es/chat.IFrameComponent.js +0 -73
- package/dist/es/chat.IFramePanel.js +0 -151
- package/dist/es/chat.Input.js +0 -462
- package/dist/es/chat.LocalMessageItem.js +0 -50
- package/dist/es/chat.MessageTypeComponent.js +0 -3580
- package/dist/es/chat.Messages.js +0 -116
- package/dist/es/chat.MountChildrenOnDelay.js +0 -97
- package/dist/es/chat.PageObjectId.js +0 -194
- package/dist/es/chat.RichText.js +0 -349
- package/dist/es/chat.TourContainer.js +0 -524
- package/dist/es/chat.VideoComponent.js +0 -1197
- package/dist/es/chat.ViewSourcePanel.js +0 -187
- package/dist/es/chat.actions.js +0 -572
- package/dist/es/chat.browserUtils.js +0 -67
- package/dist/es/chat.carbonTypes.js +0 -42
- package/dist/es/chat.cds-aichat-code.js +0 -66
- package/dist/es/chat.constants.js +0 -48
- package/dist/es/chat.dynamic-imports.js +0 -192
- package/dist/es/chat.htmlUtils.js +0 -45
- package/dist/es/chat.messageUtils.js +0 -372
- package/dist/es/chat.miscUtils.js +0 -133
- package/dist/es/chat.resolvablePromise.js +0 -315
- package/dist/es/chat.selectors.js +0 -54
- package/dist/es/chat.stringUtils.js +0 -59
- package/dist/es/chat.tokenTree.js +0 -78
- package/dist/es/chat.useCounter.js +0 -20
- package/dist/es/chat.useOnMount.js +0 -14
- package/dist/es/chat.usePrevious.js +0 -185
- package/dist/es/chat.uuid.js +0 -33
package/README.md
CHANGED
|
@@ -32,6 +32,6 @@ This will install the package that contains both the web component and React ver
|
|
|
32
32
|
|
|
33
33
|
## Documentation
|
|
34
34
|
|
|
35
|
-
- [See our documentation site](https://
|
|
35
|
+
- [See our documentation site](https://1.www.s81c.com/common/carbon/ai-chat/tag/latest/docs/documents/Overview.html).
|
|
36
36
|
- [See examples in React](https://github.com/carbon-design-system/carbon-ai-chat/tree/main/examples/react).
|
|
37
37
|
- [See examples as a web component](https://github.com/carbon-design-system/carbon-ai-chat/tree/main/examples/web-components).
|
package/dist/es/aiChatEntry.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as isBrowser, A as AppContainerExport } from "./chat.AppContainer.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export { l as AgentMessageType, e as AgentsOnlineStatus, B as ButtonItemKind, f as ButtonItemType, a as CSSVariable, c as CarbonTheme, m as ChainOfThoughtStepStatus, C as ChatHeaderObjectType, b as CornersType, E as ErrorType, F as FileStatusValue, H as HomeScreenBackgroundType, I as IFrameItemDisplayOption, L as LauncherType, n as MessageErrorState, g as MessageInputType, h as MessageResponseTypes, M as MinimizeButtonIconType, d as OnErrorType, j as OptionItemPreference, O as OverlayPanelName, P as PageObjectId, S as ScreenShareState, V as ViewType, k as WidthOptions, W as WriteableElementName, o as makeTestId } from "./chat.AppContainer.js";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { c as carbonElement, B as BusEventType } from "./chat.customElement.js";
|
|
5
|
+
import { _ as __decorate, c as carbonElement, B as BusEventType } from "./chat.customElement.js";
|
|
8
6
|
|
|
9
7
|
export { F as FeedbackInteractionType, M as MessageSendSource, T as TourEndReason, a as TourStartReason, V as ViewChangeReason } from "./chat.customElement.js";
|
|
10
8
|
|
|
11
|
-
export { H as HomeScreenBackgroundType } from "./chat.HomeScreenConfig.js";
|
|
12
|
-
|
|
13
|
-
export { A as AgentsOnlineStatus, E as ErrorType, M as MessageErrorState, S as ScreenShareState } from "./chat.LocalMessageItem.js";
|
|
14
|
-
|
|
15
|
-
export { A as AgentMessageType, B as ButtonItemKind, a as ButtonItemType, C as ChainOfThoughtStepStatus, I as IFrameItemDisplayOption, M as MessageInputType, b as MessageResponseTypes, O as OptionItemPreference, W as WidthOptions } from "./chat.Messages.js";
|
|
16
|
-
|
|
17
|
-
import { __decorate } from "tslib";
|
|
18
|
-
|
|
19
9
|
import { createComponent } from "@lit/react";
|
|
20
10
|
|
|
21
11
|
import { css, LitElement } from "lit";
|
|
@@ -24,26 +14,191 @@ import React, { useRef, useState, useEffect, useCallback } from "react";
|
|
|
24
14
|
|
|
25
15
|
import { createPortal } from "react-dom";
|
|
26
16
|
|
|
27
|
-
import
|
|
17
|
+
import "lodash-es/isEqual.js";
|
|
18
|
+
|
|
19
|
+
import "dayjs";
|
|
20
|
+
|
|
21
|
+
import "dayjs/plugin/localizedFormat.js";
|
|
22
|
+
|
|
23
|
+
import "lodash-es/merge.js";
|
|
24
|
+
|
|
25
|
+
import "lodash-es/cloneDeep.js";
|
|
26
|
+
|
|
27
|
+
import "dayjs/locale/en.js";
|
|
28
|
+
|
|
29
|
+
import "intl-messageformat";
|
|
30
|
+
|
|
31
|
+
import "react-intl";
|
|
32
|
+
|
|
33
|
+
import "redux";
|
|
34
|
+
|
|
35
|
+
import "lodash-es/mergeWith.js";
|
|
36
|
+
|
|
37
|
+
import "intl-pluralrules";
|
|
28
38
|
|
|
29
39
|
import "classnames";
|
|
30
40
|
|
|
31
|
-
import "
|
|
41
|
+
import "react-redux";
|
|
42
|
+
|
|
43
|
+
import "compute-scroll-into-view";
|
|
44
|
+
|
|
45
|
+
import "tabbable";
|
|
46
|
+
|
|
47
|
+
import "@carbon/icons-react/es/AiLaunch.js";
|
|
48
|
+
|
|
49
|
+
import "@carbon/icons-react/es/ArrowUpLeft.js";
|
|
50
|
+
|
|
51
|
+
import "@carbon/icons-react/es/ChatLaunch.js";
|
|
52
|
+
|
|
53
|
+
import "@carbon/react";
|
|
54
|
+
|
|
55
|
+
import "@carbon/icons-react/es/Close.js";
|
|
56
|
+
|
|
57
|
+
import "focus-trap-react";
|
|
58
|
+
|
|
59
|
+
import "lodash-es/throttle.js";
|
|
60
|
+
|
|
61
|
+
import "lit/decorators.js";
|
|
62
|
+
|
|
63
|
+
import "@carbon/icons-react/es/ScreenOff.js";
|
|
64
|
+
|
|
65
|
+
import "@carbon/icons-react/es/UserAvatar.js";
|
|
66
|
+
|
|
67
|
+
import "lit/directives/repeat.js";
|
|
68
|
+
|
|
69
|
+
import "lit/directives/unsafe-html.js";
|
|
70
|
+
|
|
71
|
+
import "@carbon/icons-react/es/ChatBot.js";
|
|
72
|
+
|
|
73
|
+
import "@carbon/icons-react/es/CheckmarkFilled.js";
|
|
74
|
+
|
|
75
|
+
import "@carbon/icons-react/es/Headset.js";
|
|
76
|
+
|
|
77
|
+
import "@carbon/icons-react/es/ErrorFilled.js";
|
|
78
|
+
|
|
79
|
+
import "@carbon/icons-react/es/Attachment.js";
|
|
80
|
+
|
|
81
|
+
import "@carbon/web-components/es-custom/components/textarea/index.js";
|
|
82
|
+
|
|
83
|
+
import "@carbon/web-components/es-custom/components/icon-button/index.js";
|
|
84
|
+
|
|
85
|
+
import "@carbon/icon-helpers";
|
|
86
|
+
|
|
87
|
+
import "@carbon/icons/es/thumbs-down/16.js";
|
|
88
|
+
|
|
89
|
+
import "@carbon/icons/es/thumbs-down--filled/16.js";
|
|
90
|
+
|
|
91
|
+
import "@carbon/icons/es/thumbs-up/16.js";
|
|
92
|
+
|
|
93
|
+
import "@carbon/icons/es/thumbs-up--filled/16.js";
|
|
94
|
+
|
|
95
|
+
import "lit/directives/unsafe-svg.js";
|
|
96
|
+
|
|
97
|
+
import "@carbon/web-components/es-custom/components/tag/index.js";
|
|
98
|
+
|
|
99
|
+
import "@carbon/web-components/es-custom/components/chat-button/index.js";
|
|
100
|
+
|
|
101
|
+
import "@carbon/web-components/es-custom/components/button/button.js";
|
|
102
|
+
|
|
103
|
+
import "@carbon/web-components/es-custom/components/button/index.js";
|
|
104
|
+
|
|
105
|
+
import "@carbon/web-components/es-custom/components/layer/index.js";
|
|
32
106
|
|
|
33
|
-
import "
|
|
107
|
+
import "@carbon/icons-react/es/Checkmark.js";
|
|
34
108
|
|
|
35
|
-
import "
|
|
109
|
+
import "@carbon/icons-react/es/HelpDesk.js";
|
|
36
110
|
|
|
37
|
-
import "
|
|
111
|
+
import "@carbon/icons-react/es/Logout.js";
|
|
38
112
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
113
|
+
import "@carbon/icons-react/es/Music.js";
|
|
114
|
+
|
|
115
|
+
import "@carbon/icons-react/es/TouchInteraction.js";
|
|
116
|
+
|
|
117
|
+
import "@carbon/icons-react/es/Send.js";
|
|
118
|
+
|
|
119
|
+
import "@carbon/icons-react/es/ArrowRight.js";
|
|
120
|
+
|
|
121
|
+
import "@carbon/icons-react/es/Launch.js";
|
|
122
|
+
|
|
123
|
+
import "@carbon/icons-react/es/ChevronLeft.js";
|
|
124
|
+
|
|
125
|
+
import "@carbon/icons-react/es/ChevronRight.js";
|
|
126
|
+
|
|
127
|
+
import "lodash-es/debounce.js";
|
|
128
|
+
|
|
129
|
+
import "@carbon/icons-react/es/Link.js";
|
|
130
|
+
|
|
131
|
+
import "@carbon/icons-react/es/Maximize.js";
|
|
132
|
+
|
|
133
|
+
import "@carbon/icons-react/es/ChevronDown.js";
|
|
134
|
+
|
|
135
|
+
import "@carbon/icons-react/es/ChevronUp.js";
|
|
136
|
+
|
|
137
|
+
import "csv-stringify/browser/esm/sync";
|
|
138
|
+
|
|
139
|
+
import "@carbon/web-components/es-custom/components/data-table/index.js";
|
|
140
|
+
|
|
141
|
+
import "@carbon/web-components/es-custom/components/checkbox/index.js";
|
|
142
|
+
|
|
143
|
+
import "@carbon/icons/es/download/16.js";
|
|
144
|
+
|
|
145
|
+
import "lit-html/directives/repeat.js";
|
|
146
|
+
|
|
147
|
+
import "@carbon/web-components/es-custom/components/pagination/index.js";
|
|
148
|
+
|
|
149
|
+
import "@carbon/web-components/es-custom/components/select/index.js";
|
|
150
|
+
|
|
151
|
+
import "@carbon/web-components/es-custom/components/data-table/table-skeleton.js";
|
|
152
|
+
|
|
153
|
+
import "@carbon/icons-react/es/Restart.js";
|
|
154
|
+
|
|
155
|
+
import "@carbon/web-components/es-custom/components/inline-loading/index.js";
|
|
156
|
+
|
|
157
|
+
import "@carbon/icons/es/checkmark--filled/16.js";
|
|
158
|
+
|
|
159
|
+
import "@carbon/icons/es/chevron--right/16.js";
|
|
160
|
+
|
|
161
|
+
import "@carbon/icons/es/error--filled/16.js";
|
|
162
|
+
|
|
163
|
+
import "@carbon/icons-react/es/Home.js";
|
|
164
|
+
|
|
165
|
+
import "@carbon/web-components/es-custom/components/slug/index.js";
|
|
166
|
+
|
|
167
|
+
import "@carbon/icons-react/es/CloseLarge.js";
|
|
168
|
+
|
|
169
|
+
import "@carbon/icons-react/es/DownToBottom.js";
|
|
170
|
+
|
|
171
|
+
import "@carbon/icons-react/es/Menu.js";
|
|
172
|
+
|
|
173
|
+
import "@carbon/icons-react/es/SidePanelClose.js";
|
|
174
|
+
|
|
175
|
+
import "@carbon/icons-react/es/SubtractLarge.js";
|
|
176
|
+
|
|
177
|
+
import "@carbon/web-components/es-custom/components/ai-label/defs.js";
|
|
178
|
+
|
|
179
|
+
import "@carbon/web-components/es-custom/components/popover/defs.js";
|
|
180
|
+
|
|
181
|
+
import "@carbon/web-components/es-custom/components/skeleton-icon/index.js";
|
|
182
|
+
|
|
183
|
+
import "@carbon/web-components/es-custom/components/overflow-menu/index.js";
|
|
184
|
+
|
|
185
|
+
import "@floating-ui/react";
|
|
186
|
+
|
|
187
|
+
import "@carbon/web-components/es-custom/components/ai-label/ai-label-action-button.js";
|
|
188
|
+
|
|
189
|
+
import "@carbon/web-components/es-custom/components/ai-label/ai-label.js";
|
|
190
|
+
|
|
191
|
+
import "@carbon/icons-react/es/SendFilled.js";
|
|
192
|
+
|
|
193
|
+
import "@carbon/icons/es/stop--filled/16.js";
|
|
194
|
+
|
|
195
|
+
import "@carbon/icons-react/es/Subtract.js";
|
|
196
|
+
|
|
197
|
+
import "@carbon/icons-react/es/ArrowLeft.js";
|
|
198
|
+
|
|
199
|
+
import "@carbon/icons-react/es/Chat.js";
|
|
200
|
+
|
|
201
|
+
let ChatContainerReact = class ChatContainerReact extends LitElement {
|
|
47
202
|
firstUpdated(changedProperties) {
|
|
48
203
|
super.firstUpdated(changedProperties);
|
|
49
204
|
this.dispatchEvent(new CustomEvent("shadow-ready", {
|
|
@@ -71,18 +226,9 @@ function ChatContainer({onBeforeRender: onBeforeRender, onAfterRender: onAfterRe
|
|
|
71
226
|
const wrapperRef = useRef(null);
|
|
72
227
|
const [wrapper, setWrapper] = useState(null);
|
|
73
228
|
const [container, setContainer] = useState(null);
|
|
74
|
-
const [AppContainerComponent, setAppContainerComponent] = useState(null);
|
|
75
229
|
const [userDefinedElements, setUserDefinedElements] = useState([]);
|
|
76
230
|
const [writeableElementSlots, setWriteableElementSlots] = useState([]);
|
|
77
231
|
const [currentInstance, setCurrentInstance] = useState(null);
|
|
78
|
-
useOnMount(() => {
|
|
79
|
-
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
DYNAMIC_IMPORTS.AppContainer().then(appContainer => {
|
|
83
|
-
setAppContainerComponent(() => appContainer.AppContainer);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
232
|
useEffect(() => {
|
|
87
233
|
if (!wrapperRef.current) {
|
|
88
234
|
return null;
|
|
@@ -160,12 +306,12 @@ function ChatContainer({onBeforeRender: onBeforeRender, onAfterRender: onAfterRe
|
|
|
160
306
|
onBeforeRender?.(instance);
|
|
161
307
|
}
|
|
162
308
|
}, [ onBeforeRender, userDefinedHandler ]);
|
|
163
|
-
if (
|
|
309
|
+
if (!isBrowser) {
|
|
164
310
|
return null;
|
|
165
311
|
}
|
|
166
312
|
return React.createElement(React.Fragment, null, React.createElement(ReactChatContainer, {
|
|
167
313
|
ref: wrapperRef
|
|
168
|
-
}), container &&
|
|
314
|
+
}), container && createPortal(React.createElement(AppContainerExport, {
|
|
169
315
|
config: config,
|
|
170
316
|
renderUserDefinedResponse: renderUserDefinedResponse,
|
|
171
317
|
renderWriteableElements: renderWriteableElements,
|
|
@@ -179,14 +325,7 @@ function ChatContainer({onBeforeRender: onBeforeRender, onAfterRender: onAfterRe
|
|
|
179
325
|
|
|
180
326
|
const ChatContainerExport = React.memo(ChatContainer);
|
|
181
327
|
|
|
182
|
-
|
|
183
|
-
* Copyright IBM Corp. 2025
|
|
184
|
-
*
|
|
185
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
186
|
-
* LICENSE file in the root directory of this source tree.
|
|
187
|
-
*
|
|
188
|
-
* @license
|
|
189
|
-
*/ function ChatCustomElement({config: config, onBeforeRender: onBeforeRender, onAfterRender: onAfterRender, renderUserDefinedResponse: renderUserDefinedResponse, renderWriteableElements: renderWriteableElements, className: className, id: id, onViewChange: onViewChange}) {
|
|
328
|
+
function ChatCustomElement({config: config, onBeforeRender: onBeforeRender, onAfterRender: onAfterRender, renderUserDefinedResponse: renderUserDefinedResponse, renderWriteableElements: renderWriteableElements, className: className, id: id, onViewChange: onViewChange}) {
|
|
190
329
|
const [customElement, setCustomElement] = useState();
|
|
191
330
|
const originalStyles = useRef({
|
|
192
331
|
width: undefined,
|