@carbon/ai-chat 0.4.0-rc.2 → 0.4.0-rc.3
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 +220 -14
- package/dist/es/chat.AppContainer.js +6491 -0
- package/dist/es/chat.AppState.js +40 -0
- package/dist/es/{chat/shared/components/BasePanelComponent.js → chat.BasePanelComponent.js} +3 -3
- package/dist/es/{chat/shared/components/panels/BodyAndFooterPanelComponent.js → chat.BodyAndFooterPanelComponent.js} +92 -9
- package/dist/es/chat.BodyWithFooterComponent.js +140 -0
- package/dist/es/{chat/shared/components/header/BotHeader.js → chat.BotHeader.js} +7 -9
- package/dist/es/{chat/shared/components/responseTypes/carousel/Carousel.js → chat.Carousel.js} +3 -3
- package/dist/es/chat.CatastrophicError.js +381 -0
- package/dist/es/chat.Chat.js +2009 -0
- package/dist/es/chat.Disclaimer.js +553 -0
- package/dist/es/chat.Header.js +1025 -0
- package/dist/es/{chat/shared/components/util/HideComponent.js → chat.HideComponent.js} +9 -2
- package/dist/es/{types/config/HomeScreenConfig.js → chat.HomeScreenConfig.js} +1 -1
- package/dist/es/{chat/shared/components/homeScreen/HomeScreen.js → chat.HomeScreenContainer.js} +159 -14
- package/dist/es/{chat/shared/components/homeScreen/HomeScreenHeader.js → chat.HomeScreenHeader.js} +3 -3
- package/dist/es/{chat/shared/services/haa/HumanAgentServiceImpl.js → chat.HumanAgentServiceImpl.js} +215 -17
- package/dist/es/{chat/shared/components/responseTypes/iframe/IFrameComponent.js → chat.IFrameComponent.js} +4 -8
- package/dist/es/chat.IFramePanel.js +151 -0
- package/dist/es/{chat/shared/components/input/Input.js → chat.Input.js} +214 -18
- package/dist/es/{types/config/ServiceDeskConfig.js → chat.LocalMessageItem.js} +17 -1
- package/dist/es/chat.MessageTypeComponent.js +3580 -0
- package/dist/es/{types/messaging/Messages.js → chat.Messages.js} +1 -1
- package/dist/es/chat.MountChildrenOnDelay.js +97 -0
- package/dist/es/{chat/shared/components/OverlayPanel.js → chat.PageObjectId.js} +70 -4
- package/dist/es/{chat/web-components/components/markdownText/src/markdownText.scss.js → chat.RichText.js} +347 -1
- package/dist/es/chat.TourContainer.js +524 -0
- package/dist/es/{chat/languages/en.json.js → chat.VideoComponent.js} +561 -1
- package/dist/es/chat.ViewSourcePanel.js +187 -0
- package/dist/es/{chat/shared/store/actions.js → chat.actions.js} +2 -2
- package/dist/es/{chat/shared/utils/browserUtils.js → chat.browserUtils.js} +1 -1
- package/dist/es/{types/utilities/carbonTypes.js → chat.carbonTypes.js} +2 -2
- package/dist/es/{chat/web-components/components/codeElement/src/codeElement.scss.js → chat.cds-aichat-code.js} +64 -1
- package/dist/es/{chat/shared/utils/constants.js → chat.constants.js} +4 -7
- package/dist/es/{types/events/eventBusTypes.js → chat.customElement.js} +32 -1
- package/dist/es/chat.dynamic-imports.js +192 -0
- package/dist/es/{chat/shared/utils/htmlUtils.js → chat.htmlUtils.js} +16 -2
- package/dist/es/{chat/shared/utils/messageUtils.js → chat.messageUtils.js} +54 -7
- package/dist/es/{chat/shared/utils/miscUtils.js → chat.miscUtils.js} +24 -5
- package/dist/es/chat.resolvablePromise.js +315 -0
- package/dist/es/{chat/shared/store/selectors.js → chat.selectors.js} +1 -1
- package/dist/es/{chat/shared/utils/lang/stringUtils.js → chat.stringUtils.js} +2 -2
- package/dist/es/{chat/shared/hooks/useCounter.js → chat.useCounter.js} +1 -1
- package/dist/es/{chat/shared/hooks/useOnMount.js → chat.useOnMount.js} +1 -1
- package/dist/es/{chat/shared/utils/domUtils.js → chat.usePrevious.js} +47 -1
- package/dist/es/{chat/shared/utils/lang/UUIDType.js → chat.uuid.js} +15 -3
- package/dist/es/web-components/cds-aichat-container/index.js +73 -4
- package/dist/es/web-components/cds-aichat-custom-element/index.js +1 -3
- package/package.json +2 -2
- package/dist/es/chat/dynamic-imports/dynamic-imports.js +0 -96
- package/dist/es/chat/react/components/AppContainer.js +0 -197
- package/dist/es/chat/react/components/UserDefinedResponsePortalsContainer.js +0 -31
- package/dist/es/chat/react/components/WriteableElementsPortalsContainer.js +0 -28
- package/dist/es/chat/react/components/chainOfThought/ChainOfThought.js +0 -20
- package/dist/es/chat/react/components/chatHeader/ChatHeaderAvatar.js +0 -20
- package/dist/es/chat/react/components/chatHeader/ChatHeaderLink.js +0 -22
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenu.js +0 -27
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuButton.js +0 -60
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuItem.js +0 -24
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuItemRadioGroup.js +0 -28
- package/dist/es/chat/react/components/chatHeader/ChatHeaderOverflowMenu.js +0 -69
- package/dist/es/chat/react/components/chatHeader/ChatHeaderTitle.js +0 -22
- package/dist/es/chat/react/components/feedback/FeedbackButtonsComponent.js +0 -20
- package/dist/es/chat/react/components/feedback/FeedbackComponent.js +0 -20
- package/dist/es/chat/react/components/inlineLoading/InlineLoadingComponent.js +0 -20
- package/dist/es/chat/react/components/markdownText/MarkdownText.js +0 -20
- package/dist/es/chat/react/components/stopStreamingButton/StopStreamingButton.js +0 -20
- package/dist/es/chat/react/components/table/Table.js +0 -20
- package/dist/es/chat/shared/Chat.js +0 -115
- package/dist/es/chat/shared/ChatInstanceImpl.js +0 -360
- package/dist/es/chat/shared/chatEntryFunctions.js +0 -46
- package/dist/es/chat/shared/components/Avatar.js +0 -286
- package/dist/es/chat/shared/components/BodyWithFooterComponent.js +0 -56
- package/dist/es/chat/shared/components/CatastrophicError.js +0 -77
- package/dist/es/chat/shared/components/Chat.js +0 -244
- package/dist/es/chat/shared/components/ChatBubbleDark.js +0 -124
- package/dist/es/chat/shared/components/ChatBubbleLight.js +0 -216
- package/dist/es/chat/shared/components/Disclaimer.js +0 -86
- package/dist/es/chat/shared/components/ErrorIcon.js +0 -20
- package/dist/es/chat/shared/components/ErrorMessageDark.js +0 -89
- package/dist/es/chat/shared/components/ErrorMessageLight.js +0 -135
- package/dist/es/chat/shared/components/HydrationPanel.js +0 -58
- package/dist/es/chat/shared/components/LatestWelcomeNodes.js +0 -26
- package/dist/es/chat/shared/components/ResponseStopped.js +0 -19
- package/dist/es/chat/shared/components/SkeletonPicker.js +0 -32
- package/dist/es/chat/shared/components/WriteableElement.js +0 -22
- package/dist/es/chat/shared/components/agent/AgentAvatar.js +0 -54
- package/dist/es/chat/shared/components/agent/AgentBanner.js +0 -109
- package/dist/es/chat/shared/components/agent/AgentBannerContainer.js +0 -28
- package/dist/es/chat/shared/components/agent/AvailabilityMessage.js +0 -49
- package/dist/es/chat/shared/components/aria/AriaAnnouncerComponent.js +0 -122
- package/dist/es/chat/shared/components/aria/AriaAnnouncerProvider.js +0 -48
- package/dist/es/chat/shared/components/aria/AriaLiveMessage.js +0 -22
- package/dist/es/chat/shared/components/header/AISlug.js +0 -22
- package/dist/es/chat/shared/components/header/Header.js +0 -460
- package/dist/es/chat/shared/components/header/SimpleHeader.js +0 -27
- package/dist/es/chat/shared/components/homeScreen/HomeScreenContainer.js +0 -68
- package/dist/es/chat/shared/components/launcher/Launcher.js +0 -88
- package/dist/es/chat/shared/components/launcher/LauncherComplex.js +0 -63
- package/dist/es/chat/shared/components/launcher/LauncherContainer.js +0 -73
- package/dist/es/chat/shared/components/launcher/LauncherDesktopContainer.js +0 -221
- package/dist/es/chat/shared/components/launcher/LauncherExtended.js +0 -244
- package/dist/es/chat/shared/components/launcher/LauncherMobileContainer.js +0 -175
- package/dist/es/chat/shared/components/launcher/launcherUtils.js +0 -16
- package/dist/es/chat/shared/components/modals/ConfirmModal.js +0 -67
- package/dist/es/chat/shared/components/modals/EndAgentChatModal.js +0 -46
- package/dist/es/chat/shared/components/modals/RequestScreenShareModal.js +0 -43
- package/dist/es/chat/shared/components/notifications/Notifications.js +0 -58
- package/dist/es/chat/shared/components/panels/CustomPanel.js +0 -136
- package/dist/es/chat/shared/components/responseTypes/agent/ConnectToAgent.js +0 -30
- package/dist/es/chat/shared/components/responseTypes/agent/RealConnectToAgent.js +0 -102
- package/dist/es/chat/shared/components/responseTypes/audio/AudioComponent.js +0 -26
- package/dist/es/chat/shared/components/responseTypes/buttonItem/BaseButtonItemComponent.js +0 -69
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemComponent.js +0 -48
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemCustomEventComponent.js +0 -42
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemPostBackComponent.js +0 -54
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemShowPanelComponent.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemURLComponent.js +0 -42
- package/dist/es/chat/shared/components/responseTypes/card/CardItemComponent.js +0 -34
- package/dist/es/chat/shared/components/responseTypes/carousel/CarouselItemComponent.js +0 -39
- package/dist/es/chat/shared/components/responseTypes/conversationalSearch/ConversationalSearch.js +0 -92
- package/dist/es/chat/shared/components/responseTypes/conversationalSearch/ConversationalSearchText.js +0 -158
- package/dist/es/chat/shared/components/responseTypes/custom/UserDefinedResponse.js +0 -33
- package/dist/es/chat/shared/components/responseTypes/datePicker/DatePickerComponent.js +0 -176
- package/dist/es/chat/shared/components/responseTypes/error/InlineError.js +0 -32
- package/dist/es/chat/shared/components/responseTypes/grid/GridItemComponent.js +0 -109
- package/dist/es/chat/shared/components/responseTypes/iframe/IFrameMessage.js +0 -32
- package/dist/es/chat/shared/components/responseTypes/iframe/IFramePanel.js +0 -51
- package/dist/es/chat/shared/components/responseTypes/iframe/IFramePreviewCard.js +0 -64
- package/dist/es/chat/shared/components/responseTypes/iframe/InlineIFrame.js +0 -55
- package/dist/es/chat/shared/components/responseTypes/image/Image.js +0 -120
- package/dist/es/chat/shared/components/responseTypes/options/OptionComponent.js +0 -83
- package/dist/es/chat/shared/components/responseTypes/options/SelectComponent.js +0 -84
- package/dist/es/chat/shared/components/responseTypes/table/TableContainer.js +0 -96
- package/dist/es/chat/shared/components/responseTypes/text/TextArea.js +0 -68
- package/dist/es/chat/shared/components/responseTypes/tour/TourCard.js +0 -73
- package/dist/es/chat/shared/components/responseTypes/util/BodyMessageComponents.js +0 -65
- package/dist/es/chat/shared/components/responseTypes/util/ClickableImage.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/util/Description.js +0 -21
- package/dist/es/chat/shared/components/responseTypes/util/FooterButtonComponents.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/util/MediaPlayer.js +0 -157
- package/dist/es/chat/shared/components/responseTypes/util/Metablock.js +0 -27
- package/dist/es/chat/shared/components/responseTypes/util/RichText.js +0 -31
- package/dist/es/chat/shared/components/responseTypes/util/SearchResultBody.js +0 -53
- package/dist/es/chat/shared/components/responseTypes/util/StreamingRichText.js +0 -38
- package/dist/es/chat/shared/components/responseTypes/util/TextHolderTile.js +0 -35
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationCard.js +0 -65
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationCardContent.js +0 -62
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationClickableCard.js +0 -23
- package/dist/es/chat/shared/components/responseTypes/util/citations/ExpandToPanelCard.js +0 -50
- package/dist/es/chat/shared/components/responseTypes/util/citations/ViewSourcePanel.js +0 -57
- package/dist/es/chat/shared/components/responseTypes/video/VideoComponent.js +0 -23
- package/dist/es/chat/shared/components/tour/TourCloseMinimizeComponent.js +0 -44
- package/dist/es/chat/shared/components/tour/TourContainer.js +0 -212
- package/dist/es/chat/shared/components/tour/TourControlsComponent.js +0 -98
- package/dist/es/chat/shared/components/tour/TourStepContentComponent.js +0 -156
- package/dist/es/chat/shared/components/tour/TourStepSkeletonComponent.js +0 -20
- package/dist/es/chat/shared/components/util/AnnounceOnMountComponent.js +0 -42
- package/dist/es/chat/shared/components/util/IconHolder.js +0 -16
- package/dist/es/chat/shared/components/util/ImageWithFallback.js +0 -31
- package/dist/es/chat/shared/components/util/MaybeDangerouslySetInnerHTML.js +0 -42
- package/dist/es/chat/shared/components/util/MountChildrenOnDelay.js +0 -40
- package/dist/es/chat/shared/components/util/VisuallyHidden.js +0 -18
- package/dist/es/chat/shared/containers/App.js +0 -181
- package/dist/es/chat/shared/containers/MessageComponent.js +0 -465
- package/dist/es/chat/shared/containers/MessageTypeComponent.js +0 -496
- package/dist/es/chat/shared/containers/MessagesComponent.js +0 -469
- package/dist/es/chat/shared/containers/ModalPortal.js +0 -53
- package/dist/es/chat/shared/containers/main/MainWindow.js +0 -708
- package/dist/es/chat/shared/contexts/AriaAnnouncerContext.js +0 -12
- package/dist/es/chat/shared/contexts/HideComponentContext.js +0 -12
- package/dist/es/chat/shared/contexts/LanguagePackContext.js +0 -12
- package/dist/es/chat/shared/contexts/ModalPortalRootContext.js +0 -12
- package/dist/es/chat/shared/contexts/ServiceManagerContext.js +0 -12
- package/dist/es/chat/shared/contexts/WindowSizeContext.js +0 -12
- package/dist/es/chat/shared/environmentVariables.js +0 -13
- package/dist/es/chat/shared/events/ChatActionsImpl.js +0 -783
- package/dist/es/chat/shared/events/EventBus.js +0 -161
- package/dist/es/chat/shared/hocs/withAriaAnnouncer.js +0 -25
- package/dist/es/chat/shared/hocs/withServiceManager.js +0 -25
- package/dist/es/chat/shared/hooks/useAriaAnnouncer.js +0 -16
- package/dist/es/chat/shared/hooks/useCSSCustomProperties.js +0 -21
- package/dist/es/chat/shared/hooks/useCallbackOnChange.js +0 -24
- package/dist/es/chat/shared/hooks/useEffectDidUpdate.js +0 -21
- package/dist/es/chat/shared/hooks/useLanguagePack.js +0 -16
- package/dist/es/chat/shared/hooks/usePrevious.js +0 -18
- package/dist/es/chat/shared/hooks/useServiceManager.js +0 -16
- package/dist/es/chat/shared/hooks/useShouldSanitizeHTML.js +0 -15
- package/dist/es/chat/shared/hooks/useUUID.js +0 -22
- package/dist/es/chat/shared/hooks/useWindowSize.js +0 -16
- package/dist/es/chat/shared/loadServices.js +0 -72
- package/dist/es/chat/shared/schema/historyToMessages.js +0 -231
- package/dist/es/chat/shared/schema/inputItemToLocalItem.js +0 -30
- package/dist/es/chat/shared/schema/outputItemToLocalItem.js +0 -124
- package/dist/es/chat/shared/services/CustomPanelInstance.js +0 -26
- package/dist/es/chat/shared/services/CustomPanelManager.js +0 -23
- package/dist/es/chat/shared/services/HistoryService.js +0 -59
- package/dist/es/chat/shared/services/MessageService.js +0 -351
- package/dist/es/chat/shared/services/NamespaceService.js +0 -26
- package/dist/es/chat/shared/services/ServiceManager.js +0 -19
- package/dist/es/chat/shared/services/UserSessionStorageService.js +0 -89
- package/dist/es/chat/shared/services/haa/agentStatusMessage.js +0 -108
- package/dist/es/chat/shared/services/haa/humanAgentUtils.js +0 -114
- package/dist/es/chat/shared/services/mockStorage.js +0 -30
- package/dist/es/chat/shared/store/agentActions.js +0 -125
- package/dist/es/chat/shared/store/agentReducers.js +0 -215
- package/dist/es/chat/shared/store/doCreateStore.js +0 -142
- package/dist/es/chat/shared/store/reducerUtils.js +0 -320
- package/dist/es/chat/shared/store/reducers.js +0 -871
- package/dist/es/chat/shared/store/subscriptions.js +0 -55
- package/dist/es/chat/shared/store/tourReducerUtils.js +0 -51
- package/dist/es/chat/shared/utils/ListenerList.js +0 -26
- package/dist/es/chat/shared/utils/PageObjectId.js +0 -25
- package/dist/es/chat/shared/utils/animationUtils.js +0 -77
- package/dist/es/chat/shared/utils/colors.js +0 -71
- package/dist/es/chat/shared/utils/customizers.js +0 -16
- package/dist/es/chat/shared/utils/dateUtils.js +0 -38
- package/dist/es/chat/shared/utils/homeScreenUtils.js +0 -27
- package/dist/es/chat/shared/utils/intlUtils.js +0 -21
- package/dist/es/chat/shared/utils/lang/arrayUtils.js +0 -53
- package/dist/es/chat/shared/utils/lang/langUtils.js +0 -13
- package/dist/es/chat/shared/utils/lang/objectUtils.js +0 -19
- package/dist/es/chat/shared/utils/lang/promiseUtils.js +0 -25
- package/dist/es/chat/shared/utils/lang/uuid.js +0 -16
- package/dist/es/chat/shared/utils/languages.js +0 -156
- package/dist/es/chat/shared/utils/memoizerUtils.js +0 -38
- package/dist/es/chat/shared/utils/messageServiceUtils.js +0 -36
- package/dist/es/chat/shared/utils/resolvablePromise.js +0 -32
- package/dist/es/chat/shared/utils/styleUtils.js +0 -231
- package/dist/es/chat/shared/utils/timeUtils.js +0 -14
- package/dist/es/chat/shared/utils/viewStateUtils.js +0 -38
- package/dist/es/chat/web-components/components/chainOfThought/cds-aichat-chain-of-thought.js +0 -26
- package/dist/es/chat/web-components/components/chainOfThought/src/ChainOfThoughtElement.js +0 -130
- package/dist/es/chat/web-components/components/chainOfThought/src/chainOfThoughtElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/chainOfThought/src/chainOfThoughtElement.template.js +0 -186
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/cds-aichat-chat-header-avatar.js +0 -26
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatar.template.js +0 -32
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatarElement.js +0 -52
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatarElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderLink/cds-aichat-chat-header-link.js +0 -44
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderLink/src/chatHeaderLinkElement.template.js +0 -28
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/cds-aichat-chat-header-title.js +0 -42
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/src/chatHeaderTitle.scss.js +0 -3
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/src/chatHeaderTitle.template.js +0 -20
- package/dist/es/chat/web-components/components/codeElement/cds-aichat-code.js +0 -66
- package/dist/es/chat/web-components/components/feedbackButtonsElement/cds-aichat-feedback-buttons.js +0 -26
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/FeedbackButtonsElement.js +0 -93
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/feedbackButtonsElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/feedbackButtonsElement.template.js +0 -84
- package/dist/es/chat/web-components/components/feedbackElement/cds-aichat-feedback.js +0 -30
- package/dist/es/chat/web-components/components/feedbackElement/src/FeedbackElement.js +0 -157
- package/dist/es/chat/web-components/components/feedbackElement/src/feedbackElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/feedbackElement/src/feedbackElement.template.js +0 -95
- package/dist/es/chat/web-components/components/inlineLoadingElement/cds-aichat-inline-loading.js +0 -85
- package/dist/es/chat/web-components/components/inlineLoadingElement/src/styles.scss.js +0 -3
- package/dist/es/chat/web-components/components/markdownText/cds-aichat-markdown-text.js +0 -32
- package/dist/es/chat/web-components/components/markdownText/markdown/markdownToHTML.js +0 -28
- package/dist/es/chat/web-components/components/markdownText/markdown/utils/renderTokenTree.js +0 -191
- package/dist/es/chat/web-components/components/markdownText/markdown/workers/workerManager.js +0 -16
- package/dist/es/chat/web-components/components/markdownText/src/MarkdownElement.js +0 -70
- package/dist/es/chat/web-components/components/markdownText/src/markdownElement.template.js +0 -19
- package/dist/es/chat/web-components/components/roundedButton/cds-aichat-rounded-button.js +0 -29
- package/dist/es/chat/web-components/components/stopStreamingButton/cds-aichat-stop-streaming-button.js +0 -26
- package/dist/es/chat/web-components/components/stopStreamingButton/src/StopStreamingButtonElement.js +0 -49
- package/dist/es/chat/web-components/components/stopStreamingButton/src/stopStreamingButton.scss.js +0 -3
- package/dist/es/chat/web-components/components/stopStreamingButton/src/stopStreamingButton.template.js +0 -44
- package/dist/es/chat/web-components/components/table/cds-aichat-table.js +0 -229
- package/dist/es/chat/web-components/components/table/src/table.scss.js +0 -3
- package/dist/es/chat/web-components/components/table/src/table.template.js +0 -81
- package/dist/es/chat/web-components/components/table/src/tablePagination.template.js +0 -43
- package/dist/es/chat/web-components/components/table/src/tableSkeleton.template.js +0 -17
- package/dist/es/chat/web-components/components/tagListElement/cds-aichat-tag-list.js +0 -28
- package/dist/es/chat/web-components/components/tagListElement/src/TagListElement.js +0 -70
- package/dist/es/chat/web-components/components/tagListElement/src/tagListElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/tagListElement/src/tagListElement.template.js +0 -40
- package/dist/es/chat/web-components/decorators/customElement.js +0 -33
- package/dist/es/chat/web-components/internal/cds-aichat-internal.js +0 -78
- package/dist/es/chat/web-components/settings.js +0 -13
- package/dist/es/node_modules/@carbon/colors/es/index.js +0 -11
- package/dist/es/react/ChatContainer.js +0 -162
- package/dist/es/react/ChatCustomElement.js +0 -58
- package/dist/es/types/config/ChatHeaderConfig.js +0 -18
- package/dist/es/types/config/CornersType.js +0 -16
- package/dist/es/types/config/LauncherConfig.js +0 -19
- package/dist/es/types/config/PublicConfig.js +0 -36
- package/dist/es/types/instance/ChatInstance.js +0 -31
- package/dist/es/types/instance/apiTypes.js +0 -33
- package/dist/es/types/messaging/LocalMessageItem.js +0 -18
- package/dist/es/types/state/AppState.js +0 -18
- package/dist/es/types/utilities/Animation.js +0 -31
- package/dist/es/types/utilities/HasAddRemoveClassName.js +0 -27
- /package/dist/es/{chat/shared/styles/export.carbon.scss.js → chat.export.carbon.js} +0 -0
- /package/dist/es/{chat/shared/styles/export.scss.js → chat.export.js} +0 -0
- /package/dist/es/{chat/web-components/components/markdownText/markdown/utils/markdown.js → chat.markdown.js} +0 -0
- /package/dist/es/{chat/web-components/components/markdownText/markdown/utils/tokenTree.js → chat.tokenTree.js} +0 -0
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import "intl-pluralrules";
|
|
2
|
-
|
|
3
|
-
import cx from "classnames";
|
|
4
|
-
|
|
5
|
-
import React, { useState, useMemo, useRef, Suspense } from "react";
|
|
6
|
-
|
|
7
|
-
import { RawIntlProvider, useIntl } from "react-intl";
|
|
8
|
-
|
|
9
|
-
import { Provider, useSelector, useDispatch } from "react-redux";
|
|
10
|
-
|
|
11
|
-
import { AriaAnnouncerProvider } from "../components/aria/AriaAnnouncerProvider.js";
|
|
12
|
-
|
|
13
|
-
import { LauncherContainer } from "../components/launcher/LauncherContainer.js";
|
|
14
|
-
|
|
15
|
-
import { LanguagePackContext } from "../contexts/LanguagePackContext.js";
|
|
16
|
-
|
|
17
|
-
import { WindowSizeContext } from "../contexts/WindowSizeContext.js";
|
|
18
|
-
|
|
19
|
-
import { ServiceManagerContext } from "../contexts/ServiceManagerContext.js";
|
|
20
|
-
|
|
21
|
-
import { useOnMount } from "../hooks/useOnMount.js";
|
|
22
|
-
|
|
23
|
-
import actions from "../store/actions.js";
|
|
24
|
-
|
|
25
|
-
import { IS_PHONE_IN_PORTRAIT_MODE, IS_PHONE } from "../utils/browserUtils.js";
|
|
26
|
-
|
|
27
|
-
import { consoleDebug, consoleError } from "../utils/miscUtils.js";
|
|
28
|
-
|
|
29
|
-
import { convertCSSVariablesToString, getThemeClassNames } from "../utils/styleUtils.js";
|
|
30
|
-
|
|
31
|
-
import MainWindow from "./main/MainWindow.js";
|
|
32
|
-
|
|
33
|
-
import { lazyTourComponent } from "../../dynamic-imports/dynamic-imports.js";
|
|
34
|
-
|
|
35
|
-
/*
|
|
36
|
-
* Copyright IBM Corp. 2025
|
|
37
|
-
*
|
|
38
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
39
|
-
* LICENSE file in the root directory of this source tree.
|
|
40
|
-
*
|
|
41
|
-
* @license
|
|
42
|
-
*/ const TourContainerLazy = lazyTourComponent();
|
|
43
|
-
|
|
44
|
-
function App({serviceManager: serviceManager, hostElement: hostElement, applicationStyles: applicationStyles, fontStyles: fontStyles}) {
|
|
45
|
-
const {store: store} = serviceManager;
|
|
46
|
-
const {config: config} = store.getState();
|
|
47
|
-
if (config.public.debug) {
|
|
48
|
-
consoleDebug("[render] Called render");
|
|
49
|
-
}
|
|
50
|
-
const combinedStyles = `${fontStyles ? `${fontStyles} ` : ""}${applicationStyles}`;
|
|
51
|
-
return React.createElement(Provider, {
|
|
52
|
-
store: store
|
|
53
|
-
}, React.createElement(AppContainer, {
|
|
54
|
-
serviceManager: serviceManager,
|
|
55
|
-
hostElement: hostElement,
|
|
56
|
-
applicationStyles: combinedStyles
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function AppContainer({serviceManager: serviceManager, hostElement: hostElement, applicationStyles: applicationStyles}) {
|
|
61
|
-
const languagePack = useSelector(state => state.languagePack);
|
|
62
|
-
const cssVariableOverrides = useSelector(state => state.cssVariableOverrides);
|
|
63
|
-
const theme = useSelector(state => state.theme);
|
|
64
|
-
const config = useSelector(state => state.config);
|
|
65
|
-
const layout = useSelector(state => state.layout);
|
|
66
|
-
const {namespace: namespace} = serviceManager;
|
|
67
|
-
const {originalName: originalName} = namespace;
|
|
68
|
-
const dispatch = useDispatch();
|
|
69
|
-
const [windowSize, setWindowSize] = useState({
|
|
70
|
-
width: window.innerWidth,
|
|
71
|
-
height: window.innerHeight
|
|
72
|
-
});
|
|
73
|
-
const cssVariableOverrideString = useMemo(() => convertCSSVariablesToString(cssVariableOverrides), [ cssVariableOverrides ]);
|
|
74
|
-
const dir = document.dir || "auto";
|
|
75
|
-
useOnMount(() => {
|
|
76
|
-
const windowListener = () => {
|
|
77
|
-
setWindowSize({
|
|
78
|
-
width: window.innerWidth,
|
|
79
|
-
height: window.innerHeight
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
window.addEventListener("resize", windowListener);
|
|
83
|
-
const visibilityListener = () => {
|
|
84
|
-
dispatch(actions.setIsBrowserPageVisible(document.visibilityState === "visible"));
|
|
85
|
-
};
|
|
86
|
-
document.addEventListener("visibilitychange", visibilityListener);
|
|
87
|
-
return () => {
|
|
88
|
-
window.removeEventListener("resize", windowListener);
|
|
89
|
-
document.removeEventListener("visibilitychange", visibilityListener);
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
return React.createElement("div", {
|
|
93
|
-
className: "WACContainer",
|
|
94
|
-
"data-namespace": originalName,
|
|
95
|
-
ref: node => {
|
|
96
|
-
if (node && hostElement) {
|
|
97
|
-
node.style.setProperty("height", "100%", "important");
|
|
98
|
-
node.style.setProperty("width", "100%", "important");
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}, React.createElement("div", {
|
|
102
|
-
className: "WACContainer--styles"
|
|
103
|
-
}, React.createElement("style", {
|
|
104
|
-
"data-base-styles": "true",
|
|
105
|
-
nonce: config.public.cspNonce
|
|
106
|
-
}, applicationStyles || `.WACContainer { visibility: hidden; }`), React.createElement("style", {
|
|
107
|
-
"data-variables-custom": "true",
|
|
108
|
-
nonce: config.public.cspNonce
|
|
109
|
-
}, cssVariableOverrideString)), React.createElement("div", {
|
|
110
|
-
className: cx(`WACContainer--render`, getThemeClassNames(theme), {
|
|
111
|
-
"WACContainer-disableMobileEnhancements": hostElement && config.public.disableCustomElementMobileEnhancements,
|
|
112
|
-
"WAC-isPhone": IS_PHONE && !config.public.disableCustomElementMobileEnhancements,
|
|
113
|
-
"WAC-isPhonePortraitMode": IS_PHONE_IN_PORTRAIT_MODE && !config.public.disableCustomElementMobileEnhancements,
|
|
114
|
-
"WAC--frameless": !layout?.showFrame
|
|
115
|
-
}),
|
|
116
|
-
dir: dir
|
|
117
|
-
}, React.createElement(WindowSizeContext.Provider, {
|
|
118
|
-
value: windowSize
|
|
119
|
-
}, React.createElement(ServiceManagerContext.Provider, {
|
|
120
|
-
value: serviceManager
|
|
121
|
-
}, React.createElement(RawIntlProvider, {
|
|
122
|
-
value: serviceManager.intl
|
|
123
|
-
}, React.createElement(LanguagePackContext.Provider, {
|
|
124
|
-
value: languagePack
|
|
125
|
-
}, React.createElement(AriaAnnouncerProvider, null, React.createElement(MainContainer, {
|
|
126
|
-
serviceManager: serviceManager,
|
|
127
|
-
hostElement: hostElement
|
|
128
|
-
}))))))));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function MainContainer(props) {
|
|
132
|
-
const {hostElement: hostElement, serviceManager: serviceManager} = props;
|
|
133
|
-
const showLauncher = useSelector(state => state.launcher.config.is_on);
|
|
134
|
-
const {viewState: viewState} = useSelector(state => state.persistedToBrowserStorage.launcherState);
|
|
135
|
-
const tourContainerRef = useRef();
|
|
136
|
-
const mainWindowRef = useRef();
|
|
137
|
-
const showTour = viewState.tour;
|
|
138
|
-
const showedTourOnce = useRef(showTour);
|
|
139
|
-
showedTourOnce.current = showTour || showedTourOnce.current;
|
|
140
|
-
const intl = useIntl();
|
|
141
|
-
const namespace = serviceManager.namespace.originalName;
|
|
142
|
-
const languageKey = namespace ? "window_ariaChatRegionNamespace" : "window_ariaChatRegion";
|
|
143
|
-
const regionLabel = intl.formatMessage({
|
|
144
|
-
id: languageKey
|
|
145
|
-
}, {
|
|
146
|
-
namespace: namespace
|
|
147
|
-
});
|
|
148
|
-
useOnMount(() => {
|
|
149
|
-
function requestFocus() {
|
|
150
|
-
try {
|
|
151
|
-
const {persistedToBrowserStorage: persistedToBrowserStorage} = serviceManager.store.getState();
|
|
152
|
-
const {viewState: viewState} = persistedToBrowserStorage.launcherState;
|
|
153
|
-
if (viewState.tour) {
|
|
154
|
-
tourContainerRef.current?.requestFocus();
|
|
155
|
-
} else if (viewState.mainWindow) {
|
|
156
|
-
mainWindowRef.current?.requestFocus();
|
|
157
|
-
}
|
|
158
|
-
} catch (error) {
|
|
159
|
-
consoleError("An error occurred in App.requestFocus", error);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
serviceManager.appWindow = {
|
|
163
|
-
requestFocus: requestFocus
|
|
164
|
-
};
|
|
165
|
-
});
|
|
166
|
-
return React.createElement("div", {
|
|
167
|
-
className: "WACWidget__regionContainer",
|
|
168
|
-
role: "region",
|
|
169
|
-
"aria-label": regionLabel
|
|
170
|
-
}, React.createElement(MainWindow, {
|
|
171
|
-
mainWindowRef: mainWindowRef,
|
|
172
|
-
useCustomHostElement: Boolean(hostElement),
|
|
173
|
-
serviceManager: serviceManager
|
|
174
|
-
}), showedTourOnce.current && React.createElement(Suspense, {
|
|
175
|
-
fallback: null
|
|
176
|
-
}, React.createElement(TourContainerLazy, {
|
|
177
|
-
ref: tourContainerRef
|
|
178
|
-
})), showLauncher && React.createElement(LauncherContainer, null));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export { App as default };
|
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
import ChatBot from "@carbon/icons-react/es/ChatBot.js";
|
|
2
|
-
|
|
3
|
-
import CheckmarkFilled from "@carbon/icons-react/es/CheckmarkFilled.js";
|
|
4
|
-
|
|
5
|
-
import Headset from "@carbon/icons-react/es/Headset.js";
|
|
6
|
-
|
|
7
|
-
import { Loading } from "@carbon/react";
|
|
8
|
-
|
|
9
|
-
import cx from "classnames";
|
|
10
|
-
|
|
11
|
-
import React, { PureComponent } from "react";
|
|
12
|
-
|
|
13
|
-
import { injectIntl, FormattedMessage } from "react-intl";
|
|
14
|
-
|
|
15
|
-
import { nodeToText } from "../components/aria/AriaAnnouncerComponent.js";
|
|
16
|
-
|
|
17
|
-
import { Avatar as AvatarExport } from "../components/Avatar.js";
|
|
18
|
-
|
|
19
|
-
import { InlineError } from "../components/responseTypes/error/InlineError.js";
|
|
20
|
-
|
|
21
|
-
import { IconHolder } from "../components/util/IconHolder.js";
|
|
22
|
-
|
|
23
|
-
import { ImageWithFallback } from "../components/util/ImageWithFallback.js";
|
|
24
|
-
|
|
25
|
-
import VisuallyHidden from "../components/util/VisuallyHidden.js";
|
|
26
|
-
|
|
27
|
-
import { withAriaAnnouncer } from "../hocs/withAriaAnnouncer.js";
|
|
28
|
-
|
|
29
|
-
import actions from "../store/actions.js";
|
|
30
|
-
|
|
31
|
-
import { MessageErrorState } from "../../../types/messaging/LocalMessageItem.js";
|
|
32
|
-
|
|
33
|
-
import "../utils/constants.js";
|
|
34
|
-
|
|
35
|
-
import { doFocusRef } from "../utils/domUtils.js";
|
|
36
|
-
|
|
37
|
-
import { isConnectToAgent, isRequest, isResponse, renderAsUserDefinedMessage, isOptionItem, isSingleItemCarousel } from "../utils/messageUtils.js";
|
|
38
|
-
|
|
39
|
-
import { createDidCatchErrorData } from "../utils/miscUtils.js";
|
|
40
|
-
|
|
41
|
-
import { timestampToTimeString } from "../utils/timeUtils.js";
|
|
42
|
-
|
|
43
|
-
import { MessageTypeComponent } from "./MessageTypeComponent.js";
|
|
44
|
-
|
|
45
|
-
import { MessageResponseTypes, AgentMessageType } from "../../../types/messaging/Messages.js";
|
|
46
|
-
|
|
47
|
-
import { FileStatusValue } from "../../../types/instance/apiTypes.js";
|
|
48
|
-
|
|
49
|
-
/*
|
|
50
|
-
* Copyright IBM Corp. 2025
|
|
51
|
-
*
|
|
52
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
53
|
-
* LICENSE file in the root directory of this source tree.
|
|
54
|
-
*
|
|
55
|
-
* @license
|
|
56
|
-
*/ var MoveFocusType;
|
|
57
|
-
|
|
58
|
-
(function(MoveFocusType) {
|
|
59
|
-
MoveFocusType[MoveFocusType["FIRST"] = 1] = "FIRST";
|
|
60
|
-
MoveFocusType[MoveFocusType["LAST"] = 2] = "LAST";
|
|
61
|
-
MoveFocusType[MoveFocusType["NEXT"] = 3] = "NEXT";
|
|
62
|
-
MoveFocusType[MoveFocusType["PREVIOUS"] = 4] = "PREVIOUS";
|
|
63
|
-
MoveFocusType[MoveFocusType["INPUT"] = 5] = "INPUT";
|
|
64
|
-
})(MoveFocusType || (MoveFocusType = {}));
|
|
65
|
-
|
|
66
|
-
class MessageComponent extends PureComponent {
|
|
67
|
-
constructor() {
|
|
68
|
-
super(...arguments);
|
|
69
|
-
this.state = {
|
|
70
|
-
didRenderErrorOccur: false,
|
|
71
|
-
focusHandleHasFocus: false
|
|
72
|
-
};
|
|
73
|
-
this.ref = React.createRef();
|
|
74
|
-
this.messageRef = React.createRef();
|
|
75
|
-
this.focusHandleRef = React.createRef();
|
|
76
|
-
this.getLocalMessage = () => this.props.localMessageItem;
|
|
77
|
-
this.onHandleFocus = () => {
|
|
78
|
-
this.setState({
|
|
79
|
-
focusHandleHasFocus: true
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
this.onHandleBlur = () => {
|
|
83
|
-
this.setState({
|
|
84
|
-
focusHandleHasFocus: false
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
this.onHandleKeyDown = event => {
|
|
88
|
-
if (event.altKey || event.metaKey || event.ctrlKey || event.shiftKey) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
let moveFocus;
|
|
92
|
-
if (event.key === "ArrowUp") {
|
|
93
|
-
moveFocus = MoveFocusType.PREVIOUS;
|
|
94
|
-
} else if (event.key === "ArrowDown") {
|
|
95
|
-
moveFocus = MoveFocusType.NEXT;
|
|
96
|
-
} else if (event.key === "Home") {
|
|
97
|
-
moveFocus = MoveFocusType.FIRST;
|
|
98
|
-
} else if (event.key === "End") {
|
|
99
|
-
moveFocus = MoveFocusType.LAST;
|
|
100
|
-
} else if (event.key === "Escape") {
|
|
101
|
-
moveFocus = MoveFocusType.INPUT;
|
|
102
|
-
} else if (event.key === "Enter" || event.key === " ") {
|
|
103
|
-
event.preventDefault();
|
|
104
|
-
this.reAnnounceFocusHandle();
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (moveFocus) {
|
|
108
|
-
event.preventDefault();
|
|
109
|
-
this.props.requestMoveFocus(moveFocus, this.props.messagesIndex);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
getWidgetSaidMessage() {
|
|
114
|
-
const {intl: intl, botName: botName, localMessageItem: localMessageItem} = this.props;
|
|
115
|
-
let messageId;
|
|
116
|
-
if (localMessageItem.item.agent_message_type) {
|
|
117
|
-
if (localMessageItem.item.response_type === MessageResponseTypes.TEXT) {
|
|
118
|
-
messageId = "messages_agentSaid";
|
|
119
|
-
}
|
|
120
|
-
} else {
|
|
121
|
-
messageId = "messages_botSaid";
|
|
122
|
-
}
|
|
123
|
-
return messageId ? intl.formatMessage({
|
|
124
|
-
id: messageId
|
|
125
|
-
}, {
|
|
126
|
-
botName: botName
|
|
127
|
-
}) : null;
|
|
128
|
-
}
|
|
129
|
-
componentDidCatch(error, errorInfo) {
|
|
130
|
-
this.props.serviceManager.actions.errorOccurred(createDidCatchErrorData("Message", error, errorInfo));
|
|
131
|
-
this.setState({
|
|
132
|
-
didRenderErrorOccur: true
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
componentDidMount() {
|
|
136
|
-
const uiState = this.props.localMessageItem.ui_state;
|
|
137
|
-
if (uiState.needsAnnouncement) {
|
|
138
|
-
this.props.ariaAnnouncer(this.ref.current);
|
|
139
|
-
this.props.serviceManager.store.dispatch(actions.setMessageWasAnnounced(uiState.id));
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
componentDidUpdate() {
|
|
143
|
-
const uiState = this.props.localMessageItem.ui_state;
|
|
144
|
-
if (uiState.needsAnnouncement) {
|
|
145
|
-
this.props.ariaAnnouncer(this.ref.current);
|
|
146
|
-
this.props.serviceManager.store.dispatch(actions.setMessageWasAnnounced(uiState.id));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
shouldRenderFailedMessage() {
|
|
150
|
-
if (this.state.didRenderErrorOccur) {
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
const {localMessageItem: localMessageItem, message: message} = this.props;
|
|
154
|
-
return isConnectToAgent(localMessageItem.item) && message.history?.agent_no_service_desk;
|
|
155
|
-
}
|
|
156
|
-
reAnnounceFocusHandle() {
|
|
157
|
-
const handle = this.focusHandleRef.current;
|
|
158
|
-
if (!handle) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
this.props.ariaAnnouncer(handle.getAttribute("aria-label"));
|
|
162
|
-
}
|
|
163
|
-
requestHandleFocus() {
|
|
164
|
-
const {languagePack: languagePack, intl: intl, message: message, botName: botName} = this.props;
|
|
165
|
-
const whoAnnouncement = isRequest(message) ? languagePack.messages_youSaid : intl.formatMessage({
|
|
166
|
-
id: "messages_botSaid"
|
|
167
|
-
}, {
|
|
168
|
-
botName: botName
|
|
169
|
-
});
|
|
170
|
-
const strings = [ whoAnnouncement ];
|
|
171
|
-
nodeToText(this.messageRef.current, strings);
|
|
172
|
-
this.focusHandleRef.current.setAttribute("aria-label", strings.join(" "));
|
|
173
|
-
doFocusRef(this.focusHandleRef, true);
|
|
174
|
-
}
|
|
175
|
-
renderFailedRenderMessage() {
|
|
176
|
-
const {messagesIndex: messagesIndex} = this.props;
|
|
177
|
-
return React.createElement("div", {
|
|
178
|
-
className: `WAC__message WAC__message--inlineError WAC__message-${messagesIndex} ${this.props.className || ""}`,
|
|
179
|
-
ref: this.ref
|
|
180
|
-
}, React.createElement("div", {
|
|
181
|
-
className: "WAC__message--padding"
|
|
182
|
-
}, React.createElement("div", {
|
|
183
|
-
className: "WAC__bot-message"
|
|
184
|
-
}, React.createElement(VisuallyHidden, null, this.getWidgetSaidMessage()), React.createElement("div", {
|
|
185
|
-
className: "WAC__received WAC__message-vertical-padding WAC__received--text"
|
|
186
|
-
}, React.createElement(InlineError, {
|
|
187
|
-
text: this.props.languagePack.errors_singleMessage
|
|
188
|
-
})))));
|
|
189
|
-
}
|
|
190
|
-
renderAvatarLine(localMessageItem, message) {
|
|
191
|
-
let avatar;
|
|
192
|
-
const {languagePack: languagePack, botAvatarURL: botAvatarURL, useAITheme: useAITheme, carbonTheme: carbonTheme} = this.props;
|
|
193
|
-
const timestamp = timestampToTimeString(message.history.timestamp);
|
|
194
|
-
let label;
|
|
195
|
-
let actorName;
|
|
196
|
-
let iconClassName = "";
|
|
197
|
-
if (isResponse(message)) {
|
|
198
|
-
const agentMessageType = localMessageItem.item.agent_message_type;
|
|
199
|
-
const agentProfile = message.history.agent_profile;
|
|
200
|
-
if (isAgentStatusMessage(agentMessageType)) {
|
|
201
|
-
return null;
|
|
202
|
-
}
|
|
203
|
-
const fromAgent = agentMessageType === AgentMessageType.FROM_AGENT;
|
|
204
|
-
if (fromAgent || agentProfile?.profile_picture_url) {
|
|
205
|
-
avatar = React.createElement(ImageWithFallback, {
|
|
206
|
-
url: agentProfile?.profile_picture_url,
|
|
207
|
-
alt: fromAgent ? languagePack.agent_ariaAgentAvatar : languagePack.agent_ariaGenericAvatar,
|
|
208
|
-
fallback: React.createElement(IconHolder, {
|
|
209
|
-
icon: React.createElement(Headset, null)
|
|
210
|
-
})
|
|
211
|
-
});
|
|
212
|
-
iconClassName = "WACMessage__Avatar--agent";
|
|
213
|
-
} else {
|
|
214
|
-
const icon = useAITheme ? React.createElement(AvatarExport, {
|
|
215
|
-
theme: carbonTheme
|
|
216
|
-
}) : React.createElement(IconHolder, {
|
|
217
|
-
icon: React.createElement(ChatBot, null)
|
|
218
|
-
});
|
|
219
|
-
const imageUrl = useAITheme ? undefined : botAvatarURL;
|
|
220
|
-
avatar = React.createElement(ImageWithFallback, {
|
|
221
|
-
url: imageUrl,
|
|
222
|
-
alt: languagePack.agent_ariaGenericBotAvatar,
|
|
223
|
-
fallback: icon
|
|
224
|
-
});
|
|
225
|
-
iconClassName = "WACMessage__Avatar--bot";
|
|
226
|
-
}
|
|
227
|
-
if (fromAgent || agentProfile?.nickname) {
|
|
228
|
-
actorName = agentProfile?.nickname || languagePack.agent_agentNoNameTitle;
|
|
229
|
-
} else if (useAITheme) {
|
|
230
|
-
actorName = "watsonx";
|
|
231
|
-
}
|
|
232
|
-
label = React.createElement("span", {
|
|
233
|
-
"data-wac-exclude-node-read": true
|
|
234
|
-
}, React.createElement(FormattedMessage, {
|
|
235
|
-
id: "message_labelBot",
|
|
236
|
-
values: {
|
|
237
|
-
timestamp: timestamp,
|
|
238
|
-
actorName: actorName
|
|
239
|
-
}
|
|
240
|
-
}));
|
|
241
|
-
} else {
|
|
242
|
-
label = React.createElement(FormattedMessage, {
|
|
243
|
-
id: "message_labelYou",
|
|
244
|
-
values: {
|
|
245
|
-
timestamp: timestamp
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
return React.createElement("div", {
|
|
250
|
-
className: "WACMessage__AvatarLine",
|
|
251
|
-
key: `${message.id}-avatar-line`
|
|
252
|
-
}, avatar && React.createElement("div", {
|
|
253
|
-
className: `WACMessage__Avatar ${iconClassName}`
|
|
254
|
-
}, avatar), React.createElement("div", {
|
|
255
|
-
className: "WACMessage__Label"
|
|
256
|
-
}, label));
|
|
257
|
-
}
|
|
258
|
-
renderMessageState(message) {
|
|
259
|
-
const {languagePack: languagePack} = this.props;
|
|
260
|
-
let element;
|
|
261
|
-
let className;
|
|
262
|
-
let showBelowMessage = false;
|
|
263
|
-
const errorState = message.history?.error_state;
|
|
264
|
-
const fileStatus = message.history?.file_upload_status;
|
|
265
|
-
if (errorState === MessageErrorState.FAILED) {
|
|
266
|
-
element = React.createElement(InlineError, {
|
|
267
|
-
text: languagePack.errors_singleMessage
|
|
268
|
-
});
|
|
269
|
-
className = "WAC__message-error-failed";
|
|
270
|
-
showBelowMessage = true;
|
|
271
|
-
} else if (fileStatus === FileStatusValue.UPLOADING) {
|
|
272
|
-
element = React.createElement(Loading, {
|
|
273
|
-
withOverlay: false,
|
|
274
|
-
small: true,
|
|
275
|
-
"aria-label": languagePack.fileSharing_statusUploading
|
|
276
|
-
});
|
|
277
|
-
className = "WAC__message-status-file-uploading";
|
|
278
|
-
} else if (fileStatus === "success") {
|
|
279
|
-
element = React.createElement(CheckmarkFilled, {
|
|
280
|
-
"aria-label": languagePack.fileSharing_statusUploading
|
|
281
|
-
});
|
|
282
|
-
className = "WAC__message-status-file-success";
|
|
283
|
-
}
|
|
284
|
-
return element && {
|
|
285
|
-
element: React.createElement("div", {
|
|
286
|
-
className: `WAC__message-status ${className}`
|
|
287
|
-
}, element),
|
|
288
|
-
showBelowMessage: showBelowMessage
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
renderFocusHandle() {
|
|
292
|
-
return React.createElement("div", {
|
|
293
|
-
className: "WACMessage--focusHandle",
|
|
294
|
-
ref: this.focusHandleRef,
|
|
295
|
-
tabIndex: -1,
|
|
296
|
-
onFocus: this.onHandleFocus,
|
|
297
|
-
onBlur: this.onHandleBlur,
|
|
298
|
-
onKeyDown: event => this.onHandleKeyDown(event),
|
|
299
|
-
onClick: () => this.reAnnounceFocusHandle(),
|
|
300
|
-
role: "button"
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
render() {
|
|
304
|
-
if (this.shouldRenderFailedMessage()) {
|
|
305
|
-
return this.renderFailedRenderMessage();
|
|
306
|
-
}
|
|
307
|
-
const {serviceManager: serviceManager, config: config, localMessageItem: localMessageItem, message: message, languagePack: languagePack, requestInputFocus: requestInputFocus, messagesIndex: messagesIndex, disableUserInputs: disableUserInputs, showAvatarLine: showAvatarLine, className: className, doAutoScroll: doAutoScroll, isMessageForInput: isMessageForInput, scrollElementIntoView: scrollElementIntoView, isFirstMessageItem: isFirstMessageItem, hideFeedback: hideFeedback, allowNewFeedback: allowNewFeedback} = this.props;
|
|
308
|
-
const {isIntermediateStreaming: isIntermediateStreaming, isWelcomeResponse: isWelcomeResponse, disableFadeAnimation: disableFadeAnimation} = localMessageItem.ui_state;
|
|
309
|
-
const messageItem = localMessageItem.item;
|
|
310
|
-
const responseType = messageItem.response_type;
|
|
311
|
-
const agentMessageType = messageItem.agent_message_type;
|
|
312
|
-
const fromHistory = message.history.from_history;
|
|
313
|
-
const readWidgetSaid = isFirstMessageItem;
|
|
314
|
-
if (isIntermediateStreaming && !canRenderIntermediateStreaming(messageItem.response_type)) {
|
|
315
|
-
return false;
|
|
316
|
-
}
|
|
317
|
-
const messageComponent = React.createElement(MessageTypeComponent, {
|
|
318
|
-
serviceManager: serviceManager,
|
|
319
|
-
languagePack: languagePack,
|
|
320
|
-
requestInputFocus: requestInputFocus,
|
|
321
|
-
message: localMessageItem,
|
|
322
|
-
originalMessage: message,
|
|
323
|
-
disableUserInputs: disableUserInputs,
|
|
324
|
-
isMessageForInput: isMessageForInput,
|
|
325
|
-
config: config,
|
|
326
|
-
doAutoScroll: doAutoScroll,
|
|
327
|
-
scrollElementIntoView: scrollElementIntoView,
|
|
328
|
-
hideFeedback: hideFeedback,
|
|
329
|
-
allowNewFeedback: allowNewFeedback
|
|
330
|
-
});
|
|
331
|
-
const isCustomMessage = renderAsUserDefinedMessage(localMessageItem.item);
|
|
332
|
-
const noAnimation = isWelcomeResponse || disableFadeAnimation;
|
|
333
|
-
const agentClassName = getAgentMessageClassName(agentMessageType, responseType, isCustomMessage);
|
|
334
|
-
const messageIsRequest = isRequest(message);
|
|
335
|
-
const isSystemMessage = isAgentStatusMessage(localMessageItem.item.agent_message_type);
|
|
336
|
-
let isOptionResponseWithoutTitleOrDescription = false;
|
|
337
|
-
if (isOptionItem(localMessageItem.item)) {
|
|
338
|
-
if (!localMessageItem.item.title && !localMessageItem.item.description) {
|
|
339
|
-
isOptionResponseWithoutTitleOrDescription = true;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
let messageState;
|
|
343
|
-
if (messageIsRequest) {
|
|
344
|
-
messageState = this.renderMessageState(message);
|
|
345
|
-
}
|
|
346
|
-
return React.createElement("div", {
|
|
347
|
-
id: `WAC__message-${messagesIndex}${serviceManager.namespace.suffix}`,
|
|
348
|
-
className: cx(`WAC__message WAC__message-${messagesIndex}`, className, agentMessageType && "WAC__message--agentMessage", {
|
|
349
|
-
"WAC__message--withAvatarLine": showAvatarLine,
|
|
350
|
-
"WAC__message--request": messageIsRequest,
|
|
351
|
-
"WAC__message--systemMessage": isSystemMessage,
|
|
352
|
-
"WAC__message--response": !messageIsRequest,
|
|
353
|
-
"WAC__message--no-animation": noAnimation,
|
|
354
|
-
"WAC__message--custom": isCustomMessage,
|
|
355
|
-
"WAC__message--disabled-inputs": disableUserInputs,
|
|
356
|
-
"WAC__message--has-focus": this.state.focusHandleHasFocus,
|
|
357
|
-
"WAC__message--option-response-without-title-or-description": isOptionResponseWithoutTitleOrDescription
|
|
358
|
-
}),
|
|
359
|
-
ref: this.ref
|
|
360
|
-
}, this.renderFocusHandle(), showAvatarLine && this.renderAvatarLine(localMessageItem, message), React.createElement("div", {
|
|
361
|
-
className: "WAC__message--padding"
|
|
362
|
-
}, isResponse(message) && React.createElement("div", {
|
|
363
|
-
className: "WAC__bot-message"
|
|
364
|
-
}, readWidgetSaid && React.createElement(VisuallyHidden, null, this.getWidgetSaidMessage()), React.createElement("div", {
|
|
365
|
-
className: cx("WAC__received", "WAC__message-vertical-padding", agentClassName, {
|
|
366
|
-
"WAC__received--text": responseType === MessageResponseTypes.TEXT,
|
|
367
|
-
"WAC__received--image": responseType === MessageResponseTypes.IMAGE,
|
|
368
|
-
"WAC__received--options": responseType === MessageResponseTypes.OPTION,
|
|
369
|
-
"WAC__received--inlineError": responseType === MessageResponseTypes.INLINE_ERROR,
|
|
370
|
-
"WAC__received--iframePreviewCard": responseType === MessageResponseTypes.IFRAME,
|
|
371
|
-
"WAC__received--video": responseType === MessageResponseTypes.VIDEO,
|
|
372
|
-
"WAC__received--audio": responseType === MessageResponseTypes.AUDIO,
|
|
373
|
-
"WAC__received--date": responseType === MessageResponseTypes.DATE,
|
|
374
|
-
"WAC__received--card": responseType === MessageResponseTypes.CARD,
|
|
375
|
-
"WAC__received--carousel": responseType === MessageResponseTypes.CAROUSEL,
|
|
376
|
-
"WAC__received--conversationalSearch": responseType === MessageResponseTypes.CONVERSATIONAL_SEARCH,
|
|
377
|
-
"WAC__received--carouselSingle": isSingleItemCarousel(localMessageItem.item),
|
|
378
|
-
"WAC__received--button": responseType === MessageResponseTypes.BUTTON,
|
|
379
|
-
"WAC__received--grid": responseType === MessageResponseTypes.GRID,
|
|
380
|
-
"WAC__received--fullWidth": localMessageItem.ui_state.fullWidth,
|
|
381
|
-
"WAC__message--historical": fromHistory
|
|
382
|
-
}),
|
|
383
|
-
ref: this.messageRef
|
|
384
|
-
}, React.createElement("div", {
|
|
385
|
-
className: "WAC__received--inner"
|
|
386
|
-
}, messageComponent))), messageIsRequest && React.createElement("div", {
|
|
387
|
-
className: "WAC__sent-container"
|
|
388
|
-
}, React.createElement("div", {
|
|
389
|
-
className: cx("WAC__sentAndMessageState-container", "WAC__message-vertical-padding", {
|
|
390
|
-
"WAC__sentAndMessageState--belowMessage": messageState?.showBelowMessage
|
|
391
|
-
})
|
|
392
|
-
}, !messageState?.showBelowMessage && messageState?.element, React.createElement("div", {
|
|
393
|
-
className: "WAC__sent"
|
|
394
|
-
}, React.createElement(VisuallyHidden, null, languagePack.messages_youSaid), React.createElement("div", {
|
|
395
|
-
className: "WAC__sent--bubble"
|
|
396
|
-
}, React.createElement("div", {
|
|
397
|
-
ref: this.messageRef
|
|
398
|
-
}, messageComponent))), messageState?.showBelowMessage && messageState?.element))));
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
function getAgentMessageClassName(agentMessageType, messageResponseType, isUserDefinedResponse) {
|
|
403
|
-
if (isUserDefinedResponse) {
|
|
404
|
-
return "WAC__received--agentCustom";
|
|
405
|
-
}
|
|
406
|
-
if (!messageResponseType || messageResponseType !== MessageResponseTypes.TEXT && messageResponseType !== MessageResponseTypes.BUTTON) {
|
|
407
|
-
return "";
|
|
408
|
-
}
|
|
409
|
-
switch (agentMessageType) {
|
|
410
|
-
case null:
|
|
411
|
-
case undefined:
|
|
412
|
-
case AgentMessageType.FROM_USER:
|
|
413
|
-
return null;
|
|
414
|
-
|
|
415
|
-
case AgentMessageType.RELOAD_WARNING:
|
|
416
|
-
case AgentMessageType.DISCONNECTED:
|
|
417
|
-
return "WAC__received--chatStatusMessage";
|
|
418
|
-
|
|
419
|
-
case AgentMessageType.FROM_AGENT:
|
|
420
|
-
return "WAC__received--fromAgent";
|
|
421
|
-
|
|
422
|
-
default:
|
|
423
|
-
return "WAC__received--agentStatusMessage";
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
function isAgentStatusMessage(agentMessageType) {
|
|
428
|
-
switch (agentMessageType) {
|
|
429
|
-
case null:
|
|
430
|
-
case undefined:
|
|
431
|
-
case AgentMessageType.FROM_USER:
|
|
432
|
-
case AgentMessageType.RELOAD_WARNING:
|
|
433
|
-
case AgentMessageType.DISCONNECTED:
|
|
434
|
-
case AgentMessageType.FROM_AGENT:
|
|
435
|
-
case AgentMessageType.INLINE_ERROR:
|
|
436
|
-
return false;
|
|
437
|
-
|
|
438
|
-
default:
|
|
439
|
-
return true;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
function canRenderIntermediateStreaming(type) {
|
|
444
|
-
switch (type) {
|
|
445
|
-
case MessageResponseTypes.IMAGE:
|
|
446
|
-
case MessageResponseTypes.VIDEO:
|
|
447
|
-
case MessageResponseTypes.AUDIO:
|
|
448
|
-
case MessageResponseTypes.OPTION:
|
|
449
|
-
case MessageResponseTypes.IFRAME:
|
|
450
|
-
case MessageResponseTypes.INLINE_ERROR:
|
|
451
|
-
case MessageResponseTypes.CONVERSATIONAL_SEARCH:
|
|
452
|
-
case MessageResponseTypes.USER_DEFINED:
|
|
453
|
-
case MessageResponseTypes.TEXT:
|
|
454
|
-
return true;
|
|
455
|
-
|
|
456
|
-
default:
|
|
457
|
-
return false;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
var MessageComponent$1 = withAriaAnnouncer(injectIntl(MessageComponent, {
|
|
462
|
-
forwardRef: true
|
|
463
|
-
}));
|
|
464
|
-
|
|
465
|
-
export { MessageComponent as MessageClass, MoveFocusType, MessageComponent$1 as default };
|