@carbon/ai-chat 0.4.0-rc.2 → 0.4.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/dist/types/aiChatEntry.d.ts +4767 -0
- package/package.json +5 -4
- 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,496 +0,0 @@
|
|
|
1
|
-
import Attachment from "@carbon/icons-react/es/Attachment.js";
|
|
2
|
-
|
|
3
|
-
import React, { useRef, useMemo, useState } from "react";
|
|
4
|
-
|
|
5
|
-
import { useIntl } from "react-intl";
|
|
6
|
-
|
|
7
|
-
import { useSelector, shallowEqual } from "react-redux";
|
|
8
|
-
|
|
9
|
-
import { FeedbackInteractionType, BusEventType } from "../../../types/events/eventBusTypes.js";
|
|
10
|
-
|
|
11
|
-
import { FeedbackButtonsComponent } from "../../react/components/feedback/FeedbackButtonsComponent.js";
|
|
12
|
-
|
|
13
|
-
import { FeedbackComponent } from "../../react/components/feedback/FeedbackComponent.js";
|
|
14
|
-
|
|
15
|
-
import { CSS_CLASS_PREFIX } from "../../web-components/settings.js";
|
|
16
|
-
|
|
17
|
-
import { ResponseStopped } from "../components/ResponseStopped.js";
|
|
18
|
-
|
|
19
|
-
import { ConnectToAgent } from "../components/responseTypes/agent/ConnectToAgent.js";
|
|
20
|
-
|
|
21
|
-
import { AudioComponent as AudioComponentExport } from "../components/responseTypes/audio/AudioComponent.js";
|
|
22
|
-
|
|
23
|
-
import { ButtonItemComponent } from "../components/responseTypes/buttonItem/ButtonItemComponent.js";
|
|
24
|
-
|
|
25
|
-
import { CardItemComponent as CardComponentExport } from "../components/responseTypes/card/CardItemComponent.js";
|
|
26
|
-
|
|
27
|
-
import { CarouselItemComponent } from "../components/responseTypes/carousel/CarouselItemComponent.js";
|
|
28
|
-
|
|
29
|
-
import { ConversationalSearch } from "../components/responseTypes/conversationalSearch/ConversationalSearch.js";
|
|
30
|
-
|
|
31
|
-
import UserDefinedResponse from "../components/responseTypes/custom/UserDefinedResponse.js";
|
|
32
|
-
|
|
33
|
-
import { DatePickerComponent as DatePickerComponentExport } from "../components/responseTypes/datePicker/DatePickerComponent.js";
|
|
34
|
-
|
|
35
|
-
import { InlineError } from "../components/responseTypes/error/InlineError.js";
|
|
36
|
-
|
|
37
|
-
import { GridItemComponent as GridItemComponentExport } from "../components/responseTypes/grid/GridItemComponent.js";
|
|
38
|
-
|
|
39
|
-
import { IFrameMessage } from "../components/responseTypes/iframe/IFrameMessage.js";
|
|
40
|
-
|
|
41
|
-
import { Image as ImageExport } from "../components/responseTypes/image/Image.js";
|
|
42
|
-
|
|
43
|
-
import { OptionComponent } from "../components/responseTypes/options/OptionComponent.js";
|
|
44
|
-
|
|
45
|
-
import TableContainerExport from "../components/responseTypes/table/TableContainer.js";
|
|
46
|
-
|
|
47
|
-
import { TourCard as TourCardExport } from "../components/responseTypes/tour/TourCard.js";
|
|
48
|
-
|
|
49
|
-
import { StreamingRichText } from "../components/responseTypes/util/StreamingRichText.js";
|
|
50
|
-
|
|
51
|
-
import { VideoComponent as VideoComponentExport } from "../components/responseTypes/video/VideoComponent.js";
|
|
52
|
-
|
|
53
|
-
import { useLanguagePack } from "../hooks/useLanguagePack.js";
|
|
54
|
-
|
|
55
|
-
import { useUUID } from "../hooks/useUUID.js";
|
|
56
|
-
|
|
57
|
-
import actions from "../store/actions.js";
|
|
58
|
-
|
|
59
|
-
import { selectAgentDisplayState } from "../store/selectors.js";
|
|
60
|
-
|
|
61
|
-
import { isRequest, isResponse, isTextItem, renderAsTour, renderAsUserDefinedMessage, getMediaDimensions } from "../utils/messageUtils.js";
|
|
62
|
-
|
|
63
|
-
import { ChainOfThought } from "../../react/components/chainOfThought/ChainOfThought.js";
|
|
64
|
-
|
|
65
|
-
import { InternalMessageRequestType, MessageResponseTypes, IFrameItemDisplayOption } from "../../../types/messaging/Messages.js";
|
|
66
|
-
|
|
67
|
-
/*
|
|
68
|
-
* Copyright IBM Corp. 2025
|
|
69
|
-
*
|
|
70
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
71
|
-
* LICENSE file in the root directory of this source tree.
|
|
72
|
-
*
|
|
73
|
-
* @license
|
|
74
|
-
*/ function MessageTypeComponent(props) {
|
|
75
|
-
const {allowNewFeedback: allowNewFeedback, hideFeedback: hideFeedback, serviceManager: serviceManager, originalMessage: originalMessage, message: message} = props;
|
|
76
|
-
const intl = useIntl();
|
|
77
|
-
const languagePack = useLanguagePack();
|
|
78
|
-
const feedbackDetailsRef = useRef();
|
|
79
|
-
const agentDisplayState = useSelector(selectAgentDisplayState, shallowEqual);
|
|
80
|
-
const agentState = useSelector(state => state.agentState);
|
|
81
|
-
const persistedAgentState = useSelector(state => state.persistedToBrowserStorage.chatState.agentState);
|
|
82
|
-
const feedbackID = message.item.message_options?.feedback?.id;
|
|
83
|
-
const feedbackPanelID = useUUID();
|
|
84
|
-
const feedbackHistory = originalMessage.history?.feedback?.[feedbackID];
|
|
85
|
-
const feedbackInitialValues = useMemo(() => {
|
|
86
|
-
if (!feedbackHistory) {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
text: feedbackHistory.text,
|
|
91
|
-
selectedCategories: feedbackHistory.categories
|
|
92
|
-
};
|
|
93
|
-
}, [ feedbackHistory ]);
|
|
94
|
-
const [isFeedbackOpen, setIsFeedbackOpen] = useState(false);
|
|
95
|
-
const [isPositiveFeedbackSelected, setIsPositiveFeedbackSelected] = useState(feedbackHistory && feedbackHistory.is_positive);
|
|
96
|
-
const [isNegativeFeedbackSelected, setIsNegativeFeedbackSelected] = useState(feedbackHistory && !feedbackHistory.is_positive);
|
|
97
|
-
const [isFeedbackSubmitted, setIsFeedbackSubmitted] = useState(Boolean(feedbackHistory));
|
|
98
|
-
function renderSpecificMessage(localMessageItem, message) {
|
|
99
|
-
if (isRequest(message)) {
|
|
100
|
-
return renderRequest(localMessageItem, message);
|
|
101
|
-
}
|
|
102
|
-
if (isResponse(message)) {
|
|
103
|
-
const response = renderResponse(localMessageItem, message);
|
|
104
|
-
const isResponseStopped = localMessageItem.item.streaming_metadata?.stream_stopped;
|
|
105
|
-
return React.createElement(React.Fragment, null, response, isResponseStopped && React.createElement(ResponseStopped, null), renderChainOfThought(localMessageItem), renderFeedback(localMessageItem, message));
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
function renderRequest(localMessageItem, originalMessage) {
|
|
110
|
-
const messageItem = localMessageItem.item;
|
|
111
|
-
if (isTextItem(messageItem)) {
|
|
112
|
-
const text = originalMessage.history?.label || messageItem.text;
|
|
113
|
-
const userText = localMessageItem.ui_state.originalUserText || text;
|
|
114
|
-
return React.createElement("div", {
|
|
115
|
-
className: "WAC__sent--text"
|
|
116
|
-
}, originalMessage.input.message_type === InternalMessageRequestType.FILE && React.createElement(Attachment, {
|
|
117
|
-
className: "WAC__sent-fileIcon",
|
|
118
|
-
"aria-label": props.languagePack.fileSharing_fileIcon
|
|
119
|
-
}), React.createElement("span", {
|
|
120
|
-
role: "heading",
|
|
121
|
-
"aria-level": 2
|
|
122
|
-
}, userText));
|
|
123
|
-
}
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
function renderResponse(localMessageItem, message) {
|
|
127
|
-
if (renderAsTour(localMessageItem.item)) {
|
|
128
|
-
return renderTour(localMessageItem);
|
|
129
|
-
}
|
|
130
|
-
if (renderAsUserDefinedMessage(localMessageItem.item)) {
|
|
131
|
-
return renderUserDefinedResponse(localMessageItem, message);
|
|
132
|
-
}
|
|
133
|
-
const responseType = localMessageItem.item.response_type;
|
|
134
|
-
const withHumanAgent = Boolean(localMessageItem.item.agent_message_type);
|
|
135
|
-
switch (responseType) {
|
|
136
|
-
case MessageResponseTypes.TEXT:
|
|
137
|
-
return renderText(localMessageItem, message, withHumanAgent);
|
|
138
|
-
|
|
139
|
-
case MessageResponseTypes.IMAGE:
|
|
140
|
-
return renderImage(localMessageItem);
|
|
141
|
-
|
|
142
|
-
case MessageResponseTypes.OPTION:
|
|
143
|
-
return renderOption(localMessageItem, message);
|
|
144
|
-
|
|
145
|
-
case MessageResponseTypes.CONNECT_TO_AGENT:
|
|
146
|
-
return renderConnectToAgent(localMessageItem, message);
|
|
147
|
-
|
|
148
|
-
case MessageResponseTypes.INLINE_ERROR:
|
|
149
|
-
return renderInlineError(localMessageItem);
|
|
150
|
-
|
|
151
|
-
case MessageResponseTypes.IFRAME:
|
|
152
|
-
return renderIFrameMessage(localMessageItem);
|
|
153
|
-
|
|
154
|
-
case MessageResponseTypes.VIDEO:
|
|
155
|
-
return renderVideoMessage(localMessageItem);
|
|
156
|
-
|
|
157
|
-
case MessageResponseTypes.AUDIO:
|
|
158
|
-
return renderAudioMessage(localMessageItem);
|
|
159
|
-
|
|
160
|
-
case MessageResponseTypes.DATE:
|
|
161
|
-
return renderDateMessage(localMessageItem);
|
|
162
|
-
|
|
163
|
-
case MessageResponseTypes.CONVERSATIONAL_SEARCH:
|
|
164
|
-
return renderConversationalSearchMessage(localMessageItem, message);
|
|
165
|
-
|
|
166
|
-
case MessageResponseTypes.TABLE:
|
|
167
|
-
return renderTable(localMessageItem);
|
|
168
|
-
|
|
169
|
-
case MessageResponseTypes.CARD:
|
|
170
|
-
return renderCard(localMessageItem, message);
|
|
171
|
-
|
|
172
|
-
case MessageResponseTypes.CAROUSEL:
|
|
173
|
-
return renderCarouselMessage(localMessageItem, message);
|
|
174
|
-
|
|
175
|
-
case MessageResponseTypes.BUTTON:
|
|
176
|
-
return renderButtonItem(localMessageItem, message);
|
|
177
|
-
|
|
178
|
-
case MessageResponseTypes.GRID:
|
|
179
|
-
return renderGrid(localMessageItem, message);
|
|
180
|
-
|
|
181
|
-
default:
|
|
182
|
-
return renderUserDefinedResponse(localMessageItem, message);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
function renderText(message, originalMessage, removeHTML) {
|
|
186
|
-
if (props.isNestedMessageItem) {
|
|
187
|
-
return renderRichText(message, removeHTML, originalMessage);
|
|
188
|
-
}
|
|
189
|
-
return React.createElement("div", {
|
|
190
|
-
className: "WAC__received--textContent"
|
|
191
|
-
}, renderRichText(message, removeHTML, originalMessage));
|
|
192
|
-
}
|
|
193
|
-
function renderRichText(localMessageItem, removeHTML, originalMessage) {
|
|
194
|
-
return React.createElement(StreamingRichText, {
|
|
195
|
-
text: localMessageItem.item.text,
|
|
196
|
-
streamingState: localMessageItem.ui_state.streamingState,
|
|
197
|
-
isStreamingError: originalMessage?.history?.is_streaming_error,
|
|
198
|
-
removeHTML: removeHTML,
|
|
199
|
-
doAutoScroll: props.doAutoScroll
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
function renderOption(message, originalMessage) {
|
|
203
|
-
const {languagePack: languagePack, requestInputFocus: requestInputFocus, serviceManager: serviceManager, disableUserInputs: disableUserInputs, isMessageForInput: isMessageForInput} = props;
|
|
204
|
-
const withHumanAgent = Boolean(message.item.agent_message_type);
|
|
205
|
-
return React.createElement(OptionComponent, {
|
|
206
|
-
localMessage: message,
|
|
207
|
-
originalMessage: originalMessage,
|
|
208
|
-
languagePack: languagePack,
|
|
209
|
-
disableUserInputs: disableUserInputs || !isMessageForInput,
|
|
210
|
-
requestInputFocus: requestInputFocus,
|
|
211
|
-
serviceManager: serviceManager,
|
|
212
|
-
shouldRemoveHTMLBeforeMarkdownConversion: withHumanAgent
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
function renderImage(message) {
|
|
216
|
-
const {languagePack: languagePack, serviceManager: serviceManager} = props;
|
|
217
|
-
const {useAITheme: useAITheme} = serviceManager.store.getState().theme;
|
|
218
|
-
return React.createElement(ImageExport, {
|
|
219
|
-
imageError: languagePack.errors_imageSource,
|
|
220
|
-
source: message.item.source,
|
|
221
|
-
title: message.item.title,
|
|
222
|
-
description: message.item.description,
|
|
223
|
-
altText: message.item.alt_text,
|
|
224
|
-
needsAnnouncement: message.ui_state.needsAnnouncement,
|
|
225
|
-
useAITheme: useAITheme
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
function renderInlineError(message) {
|
|
229
|
-
return React.createElement(InlineError, {
|
|
230
|
-
text: message.item.text
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
function renderIFrameMessage(message) {
|
|
234
|
-
const {doAutoScroll: doAutoScroll, isNestedMessageItem: isNestedMessageItem} = props;
|
|
235
|
-
const display = isNestedMessageItem ? IFrameItemDisplayOption.INLINE : undefined;
|
|
236
|
-
return React.createElement(IFrameMessage, {
|
|
237
|
-
localMessage: message,
|
|
238
|
-
doAutoScroll: doAutoScroll,
|
|
239
|
-
displayOverride: display
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
function renderVideoMessage(message) {
|
|
243
|
-
const {doAutoScroll: doAutoScroll} = props;
|
|
244
|
-
const {item: item} = message;
|
|
245
|
-
const {source: source, title: title, description: description, alt_text: alt_text} = item;
|
|
246
|
-
return React.createElement(VideoComponentExport, {
|
|
247
|
-
source: source,
|
|
248
|
-
title: title,
|
|
249
|
-
description: description,
|
|
250
|
-
baseHeight: getMediaDimensions(item)?.base_height,
|
|
251
|
-
ariaLabel: alt_text,
|
|
252
|
-
doAutoScroll: doAutoScroll,
|
|
253
|
-
needsAnnouncement: message.ui_state.needsAnnouncement
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
function renderAudioMessage(message) {
|
|
257
|
-
const {doAutoScroll: doAutoScroll} = props;
|
|
258
|
-
const {source: source, title: title, description: description, alt_text: alt_text} = message.item;
|
|
259
|
-
return React.createElement(AudioComponentExport, {
|
|
260
|
-
source: source,
|
|
261
|
-
title: title,
|
|
262
|
-
description: description,
|
|
263
|
-
ariaLabel: alt_text,
|
|
264
|
-
doAutoScroll: doAutoScroll,
|
|
265
|
-
needsAnnouncement: message.ui_state.needsAnnouncement
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
function renderDateMessage(message) {
|
|
269
|
-
return React.createElement(DatePickerComponentExport, {
|
|
270
|
-
localMessage: message,
|
|
271
|
-
disabled: !props.isMessageForInput,
|
|
272
|
-
scrollElementIntoView: props.scrollElementIntoView
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
function renderUserDefinedResponse(message, originalMessage) {
|
|
276
|
-
const {serviceManager: serviceManager} = props;
|
|
277
|
-
return React.createElement(UserDefinedResponse, {
|
|
278
|
-
streamingState: message.ui_state.streamingState,
|
|
279
|
-
isStreamingError: originalMessage?.history?.is_streaming_error,
|
|
280
|
-
doAutoScroll: props.doAutoScroll,
|
|
281
|
-
localMessageID: message.ui_state.id,
|
|
282
|
-
serviceManager: serviceManager
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
function renderTour(message) {
|
|
286
|
-
const {serviceManager: serviceManager} = props;
|
|
287
|
-
return React.createElement(TourCardExport, {
|
|
288
|
-
message: message,
|
|
289
|
-
serviceManager: serviceManager
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
function renderConnectToAgent(message, originalMessage) {
|
|
293
|
-
const {languagePack: languagePack, config: config, serviceManager: serviceManager, disableUserInputs: disableUserInputs, isMessageForInput: isMessageForInput} = props;
|
|
294
|
-
return React.createElement(ConnectToAgent, {
|
|
295
|
-
localMessage: message,
|
|
296
|
-
originalMessage: originalMessage,
|
|
297
|
-
languagePack: languagePack,
|
|
298
|
-
config: config,
|
|
299
|
-
serviceManager: serviceManager,
|
|
300
|
-
agentState: agentState,
|
|
301
|
-
agentDisplayState: agentDisplayState,
|
|
302
|
-
persistedAgentState: persistedAgentState,
|
|
303
|
-
disableUserInputs: disableUserInputs || !isMessageForInput,
|
|
304
|
-
requestFocus: props.requestInputFocus
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
function renderCard(message, originalMessage) {
|
|
308
|
-
const {isMessageForInput: isMessageForInput, requestInputFocus: requestInputFocus} = props;
|
|
309
|
-
return React.createElement(CardComponentExport, {
|
|
310
|
-
localMessageItem: message,
|
|
311
|
-
fullMessage: originalMessage,
|
|
312
|
-
isMessageForInput: isMessageForInput,
|
|
313
|
-
requestFocus: requestInputFocus
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
function renderConversationalSearchMessage(localMessageItem, fullMessage) {
|
|
317
|
-
const {scrollElementIntoView: scrollElementIntoView, doAutoScroll: doAutoScroll} = props;
|
|
318
|
-
return React.createElement(ConversationalSearch, {
|
|
319
|
-
localMessageItem: localMessageItem,
|
|
320
|
-
scrollElementIntoView: scrollElementIntoView,
|
|
321
|
-
isStreamingError: fullMessage.history?.is_streaming_error,
|
|
322
|
-
doAutoScroll: doAutoScroll
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
function renderButtonItem(message, originalMessage) {
|
|
326
|
-
const {isMessageForInput: isMessageForInput, requestInputFocus: requestInputFocus} = props;
|
|
327
|
-
return React.createElement(ButtonItemComponent, {
|
|
328
|
-
localMessageItem: message,
|
|
329
|
-
fullMessage: originalMessage,
|
|
330
|
-
isMessageForInput: isMessageForInput,
|
|
331
|
-
requestFocus: requestInputFocus
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
function renderCarouselMessage(message, originalMessage) {
|
|
335
|
-
const {isMessageForInput: isMessageForInput, requestInputFocus: requestInputFocus} = props;
|
|
336
|
-
return React.createElement(CarouselItemComponent, {
|
|
337
|
-
localMessageItem: message,
|
|
338
|
-
fullMessage: originalMessage,
|
|
339
|
-
isMessageForInput: isMessageForInput,
|
|
340
|
-
requestFocus: requestInputFocus
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
function renderGrid(message, originalMessage) {
|
|
344
|
-
return React.createElement(GridItemComponentExport, {
|
|
345
|
-
localMessageItem: message,
|
|
346
|
-
originalMessage: originalMessage
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
function renderTable(message) {
|
|
350
|
-
return React.createElement(TableContainerExport, {
|
|
351
|
-
tableItem: message.item
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
function scrollChainOfThought(open, element) {
|
|
355
|
-
if (open) {
|
|
356
|
-
setTimeout(() => {
|
|
357
|
-
props.scrollElementIntoView(element, 64, 64);
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
function formatStepLabelText({stepNumber: stepNumber, stepTitle: stepTitle}) {
|
|
362
|
-
return intl.formatMessage({
|
|
363
|
-
id: "chainOfThought_stepTitle"
|
|
364
|
-
}, {
|
|
365
|
-
stepNumber: stepNumber,
|
|
366
|
-
stepTitle: stepTitle
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
function renderChainOfThought(localMessageItem) {
|
|
370
|
-
const chainOfThought = localMessageItem.item.message_options?.chain_of_thought;
|
|
371
|
-
if (!chainOfThought || props.isNestedMessageItem) {
|
|
372
|
-
return false;
|
|
373
|
-
}
|
|
374
|
-
return React.createElement(ChainOfThought, {
|
|
375
|
-
steps: chainOfThought,
|
|
376
|
-
onToggle: scrollChainOfThought,
|
|
377
|
-
onStepToggle: scrollChainOfThought,
|
|
378
|
-
formatStepLabelText: formatStepLabelText,
|
|
379
|
-
explainabilityText: languagePack.chainOfThought_explainabilityLabel,
|
|
380
|
-
inputLabelText: languagePack.chainOfThought_inputLabel,
|
|
381
|
-
outputLabelText: languagePack.chainOfThought_outputLabel,
|
|
382
|
-
toolLabelText: languagePack.chainOfThought_toolLabel
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
function renderFeedback(localMessageItem, message) {
|
|
386
|
-
const feedbackOptions = localMessageItem.item.message_options?.feedback || {};
|
|
387
|
-
const {id: feedbackID, is_on: is_on, show_positive_details: show_positive_details = true, show_negative_details: show_negative_details = true, show_text_area: show_text_area = true, show_prompt: show_prompt = true, title: title, prompt: prompt, categories: categories, placeholder: placeholder, disclaimer: disclaimer} = feedbackOptions;
|
|
388
|
-
if (props.isNestedMessageItem || hideFeedback || !allowNewFeedback && !feedbackHistory || !is_on) {
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
function updateHistory(data) {
|
|
392
|
-
if (feedbackID) {
|
|
393
|
-
const history = {
|
|
394
|
-
feedback: {
|
|
395
|
-
[feedbackID]: data
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
serviceManager.store.dispatch(actions.mergeMessageHistory(localMessageItem.fullMessageID, history));
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
function onFeedbackClicked(isPositive) {
|
|
402
|
-
const toggleToSelected = isPositive ? !isPositiveFeedbackSelected : !isNegativeFeedbackSelected;
|
|
403
|
-
const openDetails = (isPositive ? show_positive_details : show_negative_details) && toggleToSelected;
|
|
404
|
-
if (toggleToSelected && !openDetails) {
|
|
405
|
-
updateHistory({
|
|
406
|
-
is_positive: isPositive
|
|
407
|
-
});
|
|
408
|
-
setIsFeedbackSubmitted(true);
|
|
409
|
-
serviceManager.fire({
|
|
410
|
-
type: BusEventType.FEEDBACK,
|
|
411
|
-
messageItem: localMessageItem.item,
|
|
412
|
-
message: message,
|
|
413
|
-
interactionType: FeedbackInteractionType.SUBMITTED,
|
|
414
|
-
isPositive: isPositive
|
|
415
|
-
});
|
|
416
|
-
} else {
|
|
417
|
-
setIsFeedbackOpen(openDetails);
|
|
418
|
-
if (openDetails) {
|
|
419
|
-
setTimeout(() => {
|
|
420
|
-
props.scrollElementIntoView(feedbackDetailsRef.current, 48, 56);
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
serviceManager.fire({
|
|
424
|
-
type: BusEventType.FEEDBACK,
|
|
425
|
-
messageItem: localMessageItem.item,
|
|
426
|
-
message: message,
|
|
427
|
-
interactionType: openDetails ? FeedbackInteractionType.DETAILS_OPENED : FeedbackInteractionType.DETAILS_CLOSED,
|
|
428
|
-
isPositive: isPositive
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
setIsPositiveFeedbackSelected(isPositive ? toggleToSelected : false);
|
|
432
|
-
setIsNegativeFeedbackSelected(isPositive ? false : toggleToSelected);
|
|
433
|
-
}
|
|
434
|
-
function onSubmit(isPositive, details) {
|
|
435
|
-
setIsFeedbackSubmitted(true);
|
|
436
|
-
setIsFeedbackOpen(false);
|
|
437
|
-
const event = {
|
|
438
|
-
type: BusEventType.FEEDBACK,
|
|
439
|
-
messageItem: localMessageItem.item,
|
|
440
|
-
message: message,
|
|
441
|
-
interactionType: FeedbackInteractionType.SUBMITTED,
|
|
442
|
-
isPositive: isPositive,
|
|
443
|
-
text: details.text,
|
|
444
|
-
categories: details.selectedCategories
|
|
445
|
-
};
|
|
446
|
-
serviceManager.fire(event);
|
|
447
|
-
updateHistory({
|
|
448
|
-
is_positive: event.isPositive,
|
|
449
|
-
text: event.text,
|
|
450
|
-
categories: event.categories
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
function renderFeedbackPopup(isPositive) {
|
|
454
|
-
const isOpen = isFeedbackOpen && (isPositive ? isPositiveFeedbackSelected : isNegativeFeedbackSelected);
|
|
455
|
-
return React.createElement(FeedbackComponent, {
|
|
456
|
-
class: `${CSS_CLASS_PREFIX}-feedbackDetails-${isPositive ? "positive" : "negative"}`,
|
|
457
|
-
id: `${feedbackPanelID}-feedback-${isPositive ? "positive" : "negative"}`,
|
|
458
|
-
isOpen: isOpen,
|
|
459
|
-
isReadonly: isFeedbackSubmitted,
|
|
460
|
-
onClose: () => onFeedbackClicked(isPositive),
|
|
461
|
-
onSubmit: details => onSubmit(isPositive, details),
|
|
462
|
-
initialValues: feedbackHistory && feedbackHistory?.is_positive === isPositive ? feedbackInitialValues : null,
|
|
463
|
-
showTextArea: show_text_area,
|
|
464
|
-
showPrompt: show_prompt,
|
|
465
|
-
title: title || languagePack.feedback_defaultTitle,
|
|
466
|
-
prompt: prompt || languagePack.feedback_defaultPrompt,
|
|
467
|
-
categories: categories,
|
|
468
|
-
placeholder: placeholder || languagePack.feedback_defaultPlaceholder,
|
|
469
|
-
disclaimer: disclaimer,
|
|
470
|
-
submitLabel: languagePack.feedback_submitLabel,
|
|
471
|
-
cancelLabel: languagePack.feedback_cancelLabel
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
return React.createElement("div", {
|
|
475
|
-
className: "WAC__received--feedback"
|
|
476
|
-
}, React.createElement(FeedbackButtonsComponent, {
|
|
477
|
-
isPositiveOpen: isFeedbackOpen && isPositiveFeedbackSelected,
|
|
478
|
-
isNegativeOpen: isFeedbackOpen && isNegativeFeedbackSelected,
|
|
479
|
-
isPositiveSelected: isPositiveFeedbackSelected,
|
|
480
|
-
isNegativeSelected: isNegativeFeedbackSelected,
|
|
481
|
-
hasPositiveDetails: show_positive_details,
|
|
482
|
-
hasNegativeDetails: show_negative_details,
|
|
483
|
-
isPositiveDisabled: isNegativeFeedbackSelected || isFeedbackSubmitted,
|
|
484
|
-
isNegativeDisabled: isPositiveFeedbackSelected || isFeedbackSubmitted,
|
|
485
|
-
positiveLabel: languagePack.feedback_positiveLabel,
|
|
486
|
-
negativeLabel: languagePack.feedback_negativeLabel,
|
|
487
|
-
panelID: feedbackPanelID,
|
|
488
|
-
onClick: onFeedbackClicked
|
|
489
|
-
}), React.createElement("div", {
|
|
490
|
-
ref: feedbackDetailsRef
|
|
491
|
-
}, renderFeedbackPopup(true), renderFeedbackPopup(false)));
|
|
492
|
-
}
|
|
493
|
-
return renderSpecificMessage(props.message, props.originalMessage);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
export { MessageTypeComponent };
|