@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,708 +0,0 @@
|
|
|
1
|
-
import "intl-pluralrules";
|
|
2
|
-
|
|
3
|
-
import cx from "classnames";
|
|
4
|
-
|
|
5
|
-
import FocusTrap from "focus-trap-react";
|
|
6
|
-
|
|
7
|
-
import React, { Component, Suspense } from "react";
|
|
8
|
-
|
|
9
|
-
import { connect } from "react-redux";
|
|
10
|
-
|
|
11
|
-
import { HydrationPanel } from "../../components/HydrationPanel.js";
|
|
12
|
-
|
|
13
|
-
import { OverlayPanel, OverlayPanelName } from "../../components/OverlayPanel.js";
|
|
14
|
-
|
|
15
|
-
import { CustomPanel as CustomPanelExport } from "../../components/panels/CustomPanel.js";
|
|
16
|
-
|
|
17
|
-
import { HideComponent } from "../../components/util/HideComponent.js";
|
|
18
|
-
|
|
19
|
-
import VisuallyHidden from "../../components/util/VisuallyHidden.js";
|
|
20
|
-
|
|
21
|
-
import { ModalPortalRootContext } from "../../contexts/ModalPortalRootContext.js";
|
|
22
|
-
|
|
23
|
-
import actions from "../../store/actions.js";
|
|
24
|
-
|
|
25
|
-
import { selectIsInputToAgent, selectInputState, selectAgentDisplayState } from "../../store/selectors.js";
|
|
26
|
-
|
|
27
|
-
import { AnimationOutType, AnimationInType } from "../../../../types/utilities/Animation.js";
|
|
28
|
-
|
|
29
|
-
import { ChatWidthBreakpoint } from "../../../../types/state/AppState.js";
|
|
30
|
-
|
|
31
|
-
import { addClassNameToState, removeClassNameFromState } from "../../../../types/utilities/HasAddRemoveClassName.js";
|
|
32
|
-
|
|
33
|
-
import { IS_MOBILE, IS_IOS } from "../../utils/browserUtils.js";
|
|
34
|
-
|
|
35
|
-
import "../../utils/constants.js";
|
|
36
|
-
|
|
37
|
-
import { doFocusRef, SCROLLBAR_WIDTH } from "../../utils/domUtils.js";
|
|
38
|
-
|
|
39
|
-
import { arrayLastValue } from "../../utils/lang/arrayUtils.js";
|
|
40
|
-
|
|
41
|
-
import { createMessageRequestForText, createMessageRequestForChoice } from "../../utils/messageUtils.js";
|
|
42
|
-
|
|
43
|
-
import { consoleError, createDidCatchErrorData } from "../../utils/miscUtils.js";
|
|
44
|
-
|
|
45
|
-
import { MessageSendSource, MainWindowCloseReason } from "../../../../types/events/eventBusTypes.js";
|
|
46
|
-
|
|
47
|
-
import { lazyChat, lazyCatastrophicError, lazyDisclaimer, lazyHomeScreenContainer, lazyIFramePanel, lazyViewSourcePanel, lazyBodyAndFooterPanelComponent } from "../../../dynamic-imports/dynamic-imports.js";
|
|
48
|
-
|
|
49
|
-
import { ViewType } from "../../../../types/instance/apiTypes.js";
|
|
50
|
-
|
|
51
|
-
import { CornersType } from "../../../../types/config/CornersType.js";
|
|
52
|
-
|
|
53
|
-
/*
|
|
54
|
-
* Copyright IBM Corp. 2025
|
|
55
|
-
*
|
|
56
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
57
|
-
* LICENSE file in the root directory of this source tree.
|
|
58
|
-
*
|
|
59
|
-
* @license
|
|
60
|
-
*/ const Chat = lazyChat();
|
|
61
|
-
|
|
62
|
-
const CatastrophicError = lazyCatastrophicError();
|
|
63
|
-
|
|
64
|
-
const Disclaimer = lazyDisclaimer();
|
|
65
|
-
|
|
66
|
-
const HomeScreenContainer = lazyHomeScreenContainer();
|
|
67
|
-
|
|
68
|
-
const IFramePanel = lazyIFramePanel();
|
|
69
|
-
|
|
70
|
-
const ViewSourcePanel = lazyViewSourcePanel();
|
|
71
|
-
|
|
72
|
-
const BodyAndFooterPanelComponent = lazyBodyAndFooterPanelComponent();
|
|
73
|
-
|
|
74
|
-
const WIDTH_BREAKPOINT_STANDARD = "WAC--standardWidth";
|
|
75
|
-
|
|
76
|
-
const WIDTH_BREAKPOINT_NARROW = "WAC--narrowWidth";
|
|
77
|
-
|
|
78
|
-
const WIDTH_BREAKPOINT_WIDE = "WAC--wideWidth";
|
|
79
|
-
|
|
80
|
-
class MainWindow extends Component {
|
|
81
|
-
constructor() {
|
|
82
|
-
super(...arguments);
|
|
83
|
-
this.state = {
|
|
84
|
-
closing: false,
|
|
85
|
-
open: this.props.persistedToBrowserStorage.launcherState.viewState.mainWindow,
|
|
86
|
-
modalPortalHostElement: null,
|
|
87
|
-
numPanelsOpen: 0,
|
|
88
|
-
numPanelsAnimating: 0,
|
|
89
|
-
numPanelsCovering: 0,
|
|
90
|
-
isHydrationAnimationComplete: this.props.isHydrated,
|
|
91
|
-
shouldAutoFocus: this.props.config.public.shouldTakeFocusIfOpensAutomatically,
|
|
92
|
-
extraClassNames: [],
|
|
93
|
-
areModulesLoaded: false
|
|
94
|
-
};
|
|
95
|
-
this.mainWindowRef = React.createRef();
|
|
96
|
-
this.containerRef = React.createRef();
|
|
97
|
-
this.botChatRef = React.createRef();
|
|
98
|
-
this.homeScreenInputRef = React.createRef();
|
|
99
|
-
this.disclaimerRef = React.createRef();
|
|
100
|
-
this.brandingRef = React.createRef();
|
|
101
|
-
this.animationContainerRef = React.createRef();
|
|
102
|
-
this.iframePanelRef = React.createRef();
|
|
103
|
-
this.viewSourcePanelRef = React.createRef();
|
|
104
|
-
this.previousBodyVisibility = undefined;
|
|
105
|
-
this.previousBodyPosition = undefined;
|
|
106
|
-
this.onResize = () => {
|
|
107
|
-
let appChatWidthBreakpoint;
|
|
108
|
-
const height = this.containerRef?.current?.offsetHeight;
|
|
109
|
-
const width = this.containerRef?.current?.offsetWidth;
|
|
110
|
-
if (width >= 672 + 16 + 16) {
|
|
111
|
-
appChatWidthBreakpoint = ChatWidthBreakpoint.WIDE;
|
|
112
|
-
} else if (width >= 360) {
|
|
113
|
-
appChatWidthBreakpoint = ChatWidthBreakpoint.STANDARD;
|
|
114
|
-
} else {
|
|
115
|
-
appChatWidthBreakpoint = ChatWidthBreakpoint.NARROW;
|
|
116
|
-
}
|
|
117
|
-
this.props.serviceManager.store.dispatch(actions.setAppStateValue("chatWidth", width));
|
|
118
|
-
this.props.serviceManager.store.dispatch(actions.setAppStateValue("chatHeight", height));
|
|
119
|
-
this.props.serviceManager.store.dispatch(actions.setAppStateValue("chatWidthBreakpoint", appChatWidthBreakpoint));
|
|
120
|
-
};
|
|
121
|
-
this.onVisualViewportResize = () => {
|
|
122
|
-
this.updateFromVisualViewport();
|
|
123
|
-
};
|
|
124
|
-
this.updateFromVisualViewport = () => {
|
|
125
|
-
const element = this.props.serviceManager.container;
|
|
126
|
-
const {visualViewport: visualViewport} = window;
|
|
127
|
-
if (visualViewport) {
|
|
128
|
-
element.style.setProperty("--cds-chat-viewport-height", `${visualViewport.height}px`);
|
|
129
|
-
element.style.setProperty("--cds-chat-viewport-width", `${visualViewport.width}px`);
|
|
130
|
-
element.style.setProperty("--cds-chat-viewport-offsetTop", `${visualViewport.offsetTop}px`);
|
|
131
|
-
element.style.setProperty("--cds-chat-viewport-offsetLeft", `${visualViewport.offsetLeft}px`);
|
|
132
|
-
} else {
|
|
133
|
-
const height = "100vh";
|
|
134
|
-
element.style.setProperty("--cds-chat-viewport-height", height);
|
|
135
|
-
element.style.setProperty("--cds-chat-viewport-width", "100vw");
|
|
136
|
-
element.style.setProperty("--cds-chat-viewport-offsetTop", "0");
|
|
137
|
-
element.style.setProperty("--cds-chat-viewport-offsetLeft", "0");
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
this.setModalPortalHostElement = ref => {
|
|
141
|
-
if (this.state.modalPortalHostElement !== ref) {
|
|
142
|
-
this.setState({
|
|
143
|
-
modalPortalHostElement: ref
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
this.onSendInput = async (text, source, options) => {
|
|
148
|
-
const isInputToAgent = selectIsInputToAgent(this.props);
|
|
149
|
-
const {serviceManager: serviceManager} = this.props;
|
|
150
|
-
const state = serviceManager.store.getState();
|
|
151
|
-
const {files: files} = selectInputState(state);
|
|
152
|
-
if (isInputToAgent) {
|
|
153
|
-
serviceManager.humanAgentService.sendMessageToAgent(text, files);
|
|
154
|
-
} else {
|
|
155
|
-
const messageRequest = createMessageRequestForText(text);
|
|
156
|
-
serviceManager.actions.sendWithCatch(messageRequest, source, {
|
|
157
|
-
...options
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
if (files.length) {
|
|
161
|
-
serviceManager.store.dispatch(actions.clearInputFiles(isInputToAgent));
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
this.onSendHomeButtonInput = input => {
|
|
165
|
-
const messageRequest = createMessageRequestForChoice(input);
|
|
166
|
-
this.props.serviceManager.actions.sendWithCatch(messageRequest, MessageSendSource.HOME_SCREEN_STARTER);
|
|
167
|
-
};
|
|
168
|
-
this.removeChatFromDom = () => {
|
|
169
|
-
this.containerRef.current.removeEventListener("animationend", this.removeChatFromDom);
|
|
170
|
-
this.setState({
|
|
171
|
-
open: false,
|
|
172
|
-
closing: false
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
this.onRestart = async () => {
|
|
176
|
-
await this.props.serviceManager.actions.restartConversation();
|
|
177
|
-
this.requestFocus();
|
|
178
|
-
};
|
|
179
|
-
this.onClose = async () => this.doClose(false);
|
|
180
|
-
this.onCloseAndRestart = async () => this.doClose(true);
|
|
181
|
-
this.onToggleHomeScreen = () => {
|
|
182
|
-
this.props.serviceManager.store.dispatch(actions.toggleHomeScreen());
|
|
183
|
-
};
|
|
184
|
-
this.requestFocus = () => {
|
|
185
|
-
try {
|
|
186
|
-
if (this.state.shouldAutoFocus && !IS_MOBILE) {
|
|
187
|
-
if (this.getShowDisclaimer()) {
|
|
188
|
-
if (this.disclaimerRef.current) {
|
|
189
|
-
doFocusRef(this.disclaimerRef);
|
|
190
|
-
}
|
|
191
|
-
} else if (this.getShowHomeScreen()) {
|
|
192
|
-
if (this.homeScreenInputRef.current) {
|
|
193
|
-
this.homeScreenInputRef.current.takeFocus();
|
|
194
|
-
}
|
|
195
|
-
} else if (this.props.iFramePanelState.isOpen) {
|
|
196
|
-
if (this.iframePanelRef.current) {
|
|
197
|
-
this.iframePanelRef.current.requestFocus();
|
|
198
|
-
}
|
|
199
|
-
} else if (this.botChatRef.current) {
|
|
200
|
-
this.botChatRef.current.requestInputFocus();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
} catch (error) {
|
|
204
|
-
consoleError("An error occurred in MainWindow.requestFocus", error);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
this.onUserTyping = isTyping => {
|
|
208
|
-
if (this.props.serviceManager.store.getState().persistedToBrowserStorage.chatState.agentState.isConnected) {
|
|
209
|
-
this.props.serviceManager.humanAgentService.userTyping(isTyping);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
this.onAcceptDisclaimer = () => {
|
|
213
|
-
this.props.serviceManager.store.dispatch(actions.acceptDisclaimer());
|
|
214
|
-
};
|
|
215
|
-
this.onPanelOpenStart = coverBackground => {
|
|
216
|
-
this.setState(prevState => ({
|
|
217
|
-
numPanelsOpen: prevState.numPanelsOpen + 1,
|
|
218
|
-
numPanelsAnimating: prevState.numPanelsAnimating + 1,
|
|
219
|
-
numPanelsCovering: prevState.numPanelsCovering + (coverBackground ? 1 : 0)
|
|
220
|
-
}), this.requestFocus);
|
|
221
|
-
};
|
|
222
|
-
this.onPanelOpenEnd = () => {
|
|
223
|
-
this.setState(prevState => ({
|
|
224
|
-
numPanelsAnimating: prevState.numPanelsAnimating - 1
|
|
225
|
-
}));
|
|
226
|
-
};
|
|
227
|
-
this.onPanelCloseStart = () => {
|
|
228
|
-
this.setState(prevState => ({
|
|
229
|
-
numPanelsAnimating: prevState.numPanelsAnimating + 1
|
|
230
|
-
}), this.requestFocus);
|
|
231
|
-
};
|
|
232
|
-
this.onPanelCloseEnd = coverBackground => {
|
|
233
|
-
this.setState(prevState => ({
|
|
234
|
-
numPanelsOpen: prevState.numPanelsOpen - 1,
|
|
235
|
-
numPanelsAnimating: prevState.numPanelsAnimating - 1,
|
|
236
|
-
numPanelsCovering: prevState.numPanelsCovering - (coverBackground ? 1 : 0)
|
|
237
|
-
}));
|
|
238
|
-
};
|
|
239
|
-
this.onHydrationPanelClose = () => {
|
|
240
|
-
this.setState({
|
|
241
|
-
isHydrationAnimationComplete: true
|
|
242
|
-
}, this.requestFocus);
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
componentDidMount() {
|
|
246
|
-
const {persistedToBrowserStorage: persistedToBrowserStorage, config: config, serviceManager: serviceManager, mainWindowRef: mainWindowRef} = this.props;
|
|
247
|
-
const {viewState: viewState} = persistedToBrowserStorage.launcherState;
|
|
248
|
-
const {public: publicConfig} = config;
|
|
249
|
-
serviceManager.mainWindow = this;
|
|
250
|
-
mainWindowRef.current = this;
|
|
251
|
-
this.mainWindowObserver = new ResizeObserver(this.onResize);
|
|
252
|
-
this.mainWindowObserver.observe(this.containerRef.current);
|
|
253
|
-
if (IS_MOBILE && !publicConfig.disableCustomElementMobileEnhancements) {
|
|
254
|
-
const {visualViewport: visualViewport} = window;
|
|
255
|
-
if (visualViewport) {
|
|
256
|
-
visualViewport.addEventListener("resize", this.onVisualViewportResize);
|
|
257
|
-
visualViewport.addEventListener("scroll", this.updateFromVisualViewport);
|
|
258
|
-
}
|
|
259
|
-
this.updateFromVisualViewport();
|
|
260
|
-
this.updateBody(false);
|
|
261
|
-
}
|
|
262
|
-
this.containerRef.current.style.setProperty("--cds-chat-scrollbar-width", `${SCROLLBAR_WIDTH()}px`);
|
|
263
|
-
if (viewState.mainWindow) {
|
|
264
|
-
this.loadPanels();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
componentWillUnmount() {
|
|
268
|
-
this.mainWindowObserver.unobserve(this.containerRef.current);
|
|
269
|
-
}
|
|
270
|
-
destroy() {
|
|
271
|
-
if (IS_MOBILE && !this.props.config.public.disableCustomElementMobileEnhancements) {
|
|
272
|
-
const {visualViewport: visualViewport} = window;
|
|
273
|
-
if (visualViewport) {
|
|
274
|
-
visualViewport.removeEventListener("resize", this.onVisualViewportResize);
|
|
275
|
-
visualViewport.removeEventListener("scroll", this.updateFromVisualViewport);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
this.updateBody(true);
|
|
279
|
-
}
|
|
280
|
-
componentDidUpdate(oldProps, oldState) {
|
|
281
|
-
const newProps = this.props;
|
|
282
|
-
const newState = this.state;
|
|
283
|
-
const {persistedToBrowserStorage: persistedToBrowserStorage, useCustomHostElement: useCustomHostElement, isDestroyed: isDestroyed} = newProps;
|
|
284
|
-
const {viewState: viewState} = persistedToBrowserStorage.launcherState;
|
|
285
|
-
const {open: open} = newState;
|
|
286
|
-
const prevViewState = oldProps.persistedToBrowserStorage.launcherState.viewState;
|
|
287
|
-
if (viewState.mainWindow !== prevViewState.mainWindow) {
|
|
288
|
-
this.updateBody(false);
|
|
289
|
-
this.updateFromVisualViewport();
|
|
290
|
-
}
|
|
291
|
-
if (isDestroyed && !oldProps.isDestroyed) {
|
|
292
|
-
this.destroy();
|
|
293
|
-
}
|
|
294
|
-
if ((oldState.areModulesLoaded !== newState.areModulesLoaded || oldProps.isHydrated !== newProps.isHydrated) && newProps.isHydrated && newState.areModulesLoaded) {
|
|
295
|
-
this.setState({
|
|
296
|
-
isHydrationAnimationComplete: true
|
|
297
|
-
}, () => {
|
|
298
|
-
requestAnimationFrame(() => {
|
|
299
|
-
this.requestFocus();
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
if (viewState.mainWindow && (!prevViewState.mainWindow || !open)) {
|
|
304
|
-
this.setState({
|
|
305
|
-
open: true
|
|
306
|
-
}, () => {
|
|
307
|
-
this.requestFocus();
|
|
308
|
-
});
|
|
309
|
-
this.loadPanels();
|
|
310
|
-
} else if (!viewState.mainWindow && prevViewState.mainWindow && oldState.open && open) {
|
|
311
|
-
this.setState({
|
|
312
|
-
closing: true
|
|
313
|
-
});
|
|
314
|
-
if (useCustomHostElement) {
|
|
315
|
-
this.removeChatFromDom();
|
|
316
|
-
} else {
|
|
317
|
-
this.containerRef.current.addEventListener("animationend", this.removeChatFromDom);
|
|
318
|
-
this.requestFocus();
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
if (newProps.config.public.shouldTakeFocusIfOpensAutomatically) {
|
|
322
|
-
if (!oldProps.persistedToBrowserStorage.chatState.hasSentNonWelcomeMessage && newProps.persistedToBrowserStorage.chatState.hasSentNonWelcomeMessage && !this.state.shouldAutoFocus) {
|
|
323
|
-
this.setState({
|
|
324
|
-
shouldAutoFocus: true
|
|
325
|
-
});
|
|
326
|
-
} else if (oldProps.botMessageState.localMessageIDs.length > newProps.botMessageState.localMessageIDs.length && this.state.shouldAutoFocus) {
|
|
327
|
-
this.setState({
|
|
328
|
-
shouldAutoFocus: false
|
|
329
|
-
});
|
|
330
|
-
} else if (oldProps.botMessageState.localMessageIDs.length < newProps.botMessageState.localMessageIDs.length && !this.state.shouldAutoFocus) {
|
|
331
|
-
this.setState({
|
|
332
|
-
shouldAutoFocus: true
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
const newLastItemID = arrayLastValue(newProps.botMessageState.localMessageIDs);
|
|
337
|
-
const oldLastItemID = arrayLastValue(oldProps.botMessageState.localMessageIDs);
|
|
338
|
-
if (newLastItemID !== oldLastItemID && newState.shouldAutoFocus) {
|
|
339
|
-
const lastMessageItem = newProps.allMessageItemsByID[newLastItemID];
|
|
340
|
-
const lastMessage = newProps.allMessagesByID[lastMessageItem?.fullMessageID];
|
|
341
|
-
if (!lastMessage?.history?.from_history) {
|
|
342
|
-
this.requestFocus();
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
componentDidCatch(error, errorInfo) {
|
|
347
|
-
this.props.serviceManager.actions.errorOccurred(createDidCatchErrorData("MainWindow", error, errorInfo, true));
|
|
348
|
-
}
|
|
349
|
-
loadPanels() {
|
|
350
|
-
Promise.all([ Chat.preload(), CatastrophicError.preload(), Disclaimer.preload(), HomeScreenContainer.preload(), IFramePanel.preload(), ViewSourcePanel.preload(), BodyAndFooterPanelComponent.preload() ]).then(() => {
|
|
351
|
-
this.setState({
|
|
352
|
-
areModulesLoaded: true
|
|
353
|
-
});
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
updateBody(unmounting) {
|
|
357
|
-
if (IS_IOS && !this.props.config.public.disableCustomElementMobileEnhancements) {
|
|
358
|
-
if ((window.screen.width <= 500 || window.screen.height <= 500) && this.props.persistedToBrowserStorage.launcherState.viewState.mainWindow && !unmounting) {
|
|
359
|
-
this.previousBodyVisibility = document.body.style.getPropertyValue("visibility");
|
|
360
|
-
this.previousBodyPosition = document.body.style.getPropertyValue("position");
|
|
361
|
-
document.body.style.setProperty("visibility", "hidden", "important");
|
|
362
|
-
document.body.style.setProperty("position", "fixed", "important");
|
|
363
|
-
} else {
|
|
364
|
-
document.body.style.setProperty("visibility", this.previousBodyVisibility);
|
|
365
|
-
document.body.style.setProperty("position", this.previousBodyPosition);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
async doClose(fromCloseAndRestart) {
|
|
370
|
-
const {serviceManager: serviceManager} = this.props;
|
|
371
|
-
const {activeTour: activeTour} = serviceManager.store.getState().persistedToBrowserStorage.launcherState;
|
|
372
|
-
if (fromCloseAndRestart) {
|
|
373
|
-
const newViewState = await serviceManager.actions.changeView(ViewType.LAUNCHER, {
|
|
374
|
-
mainWindowCloseReason: MainWindowCloseReason.MAIN_WINDOW_CLOSED_AND_RESTARTED
|
|
375
|
-
});
|
|
376
|
-
if (!newViewState.mainWindow) {
|
|
377
|
-
await serviceManager.actions.restartConversation();
|
|
378
|
-
}
|
|
379
|
-
} else {
|
|
380
|
-
await serviceManager.actions.changeView(activeTour ? ViewType.TOUR : ViewType.LAUNCHER, {
|
|
381
|
-
mainWindowCloseReason: MainWindowCloseReason.DEFAULT_MINIMIZE
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
getShowHomeScreen() {
|
|
386
|
-
return this.props.homeScreenConfig.is_on && this.props.persistedToBrowserStorage.chatState.homeScreenState.isHomeScreenOpen && !this.getShowDisclaimer();
|
|
387
|
-
}
|
|
388
|
-
getShowDisclaimer() {
|
|
389
|
-
return this.props.config.public.disclaimer?.is_on && !this.props.persistedToBrowserStorage.chatState.disclaimersAccepted[window.location.hostname];
|
|
390
|
-
}
|
|
391
|
-
doAutoScroll(options) {
|
|
392
|
-
this.botChatRef?.current?.doAutoScroll(options);
|
|
393
|
-
}
|
|
394
|
-
getMessagesScrollBottom() {
|
|
395
|
-
return this.botChatRef?.current?.getMessagesScrollBottom();
|
|
396
|
-
}
|
|
397
|
-
doScrollToMessage(messageID, animate = true) {
|
|
398
|
-
this.botChatRef.current?.doScrollToMessage(messageID, animate);
|
|
399
|
-
}
|
|
400
|
-
getMessageInput() {
|
|
401
|
-
return this.botChatRef.current?.getMessageInput();
|
|
402
|
-
}
|
|
403
|
-
getHomeScreenInput() {
|
|
404
|
-
return this.homeScreenInputRef.current?.getMessageInput();
|
|
405
|
-
}
|
|
406
|
-
addClassName(name) {
|
|
407
|
-
this.setState(addClassNameToState(name));
|
|
408
|
-
}
|
|
409
|
-
removeClassName(name) {
|
|
410
|
-
this.setState(removeClassNameFromState(name));
|
|
411
|
-
}
|
|
412
|
-
renderChat() {
|
|
413
|
-
const {isHydrated: isHydrated, config: config, chatWidthBreakpoint: chatWidthBreakpoint} = this.props;
|
|
414
|
-
const {areModulesLoaded: areModulesLoaded} = this.state;
|
|
415
|
-
const showCovering = this.state.numPanelsCovering > 0 && config.public.layout?.hasContentMaxWidth && chatWidthBreakpoint === ChatWidthBreakpoint.WIDE;
|
|
416
|
-
return React.createElement("div", {
|
|
417
|
-
className: "WACWidget--content"
|
|
418
|
-
}, this.renderCustomPanel(), this.renderHydrationPanel(), isHydrated && areModulesLoaded && React.createElement(React.Fragment, null, this.renderDisclaimerPanel(), this.renderResponsePanel(), this.renderHomeScreenPanel(), this.renderIFramePanel(), this.renderViewSourcePanel(), showCovering && React.createElement("div", {
|
|
419
|
-
className: "WACBackgroundCover"
|
|
420
|
-
}), this.renderBotChat()));
|
|
421
|
-
}
|
|
422
|
-
renderBotChat() {
|
|
423
|
-
const {botName: botName, languagePack: languagePack, config: config, serviceManager: serviceManager, botMessageState: botMessageState, agentState: agentState, allMessageItemsByID: allMessageItemsByID, isHydrated: isHydrated, locale: locale, theme: theme, headerDisplayName: headerDisplayName, headerAvatarConfig: headerAvatar} = this.props;
|
|
424
|
-
const {numPanelsAnimating: numPanelsAnimating, numPanelsOpen: numPanelsOpen, isHydrationAnimationComplete: isHydrationAnimationComplete} = this.state;
|
|
425
|
-
const inputState = selectInputState(this.props);
|
|
426
|
-
const agentDisplayState = selectAgentDisplayState(this.props);
|
|
427
|
-
const showDisclaimer = this.getShowDisclaimer();
|
|
428
|
-
let hideBotContainer;
|
|
429
|
-
if (!isHydrationAnimationComplete) {
|
|
430
|
-
hideBotContainer = true;
|
|
431
|
-
} else if (numPanelsAnimating > 0) {
|
|
432
|
-
hideBotContainer = false;
|
|
433
|
-
} else if (numPanelsOpen > 0) {
|
|
434
|
-
hideBotContainer = true;
|
|
435
|
-
}
|
|
436
|
-
return React.createElement(HideComponent, {
|
|
437
|
-
className: "WACBotContainer",
|
|
438
|
-
hidden: hideBotContainer
|
|
439
|
-
}, React.createElement(Suspense, {
|
|
440
|
-
fallback: null
|
|
441
|
-
}, React.createElement(Chat, {
|
|
442
|
-
botName: botName,
|
|
443
|
-
headerDisplayName: headerDisplayName,
|
|
444
|
-
headerAvatarConfig: headerAvatar,
|
|
445
|
-
ref: this.botChatRef,
|
|
446
|
-
languagePack: languagePack,
|
|
447
|
-
config: config,
|
|
448
|
-
serviceManager: serviceManager,
|
|
449
|
-
onClose: this.onClose,
|
|
450
|
-
onCloseAndRestart: this.onCloseAndRestart,
|
|
451
|
-
messageState: botMessageState,
|
|
452
|
-
onSendInput: text => this.onSendInput(text, MessageSendSource.MESSAGE_INPUT),
|
|
453
|
-
agentState: agentState,
|
|
454
|
-
agentDisplayState: agentDisplayState,
|
|
455
|
-
allMessageItemsByID: allMessageItemsByID,
|
|
456
|
-
onRestart: this.onRestart,
|
|
457
|
-
isHydrated: isHydrated,
|
|
458
|
-
isHydrationAnimationComplete: isHydrationAnimationComplete && !showDisclaimer,
|
|
459
|
-
inputState: inputState,
|
|
460
|
-
onToggleHomeScreen: this.onToggleHomeScreen,
|
|
461
|
-
onUserTyping: this.onUserTyping,
|
|
462
|
-
locale: locale,
|
|
463
|
-
useAITheme: theme.useAITheme,
|
|
464
|
-
carbonTheme: theme.carbonTheme
|
|
465
|
-
})));
|
|
466
|
-
}
|
|
467
|
-
renderInnerHydrationPanel() {
|
|
468
|
-
const {botMessageState: botMessageState, serviceManager: serviceManager, languagePack: languagePack, headerDisplayName: headerDisplayName, persistedToBrowserStorage: persistedToBrowserStorage, homeScreenConfig: homeScreenConfig} = this.props;
|
|
469
|
-
const {areModulesLoaded: areModulesLoaded} = this.state;
|
|
470
|
-
const useHomeScreenVersion = homeScreenConfig.is_on && !persistedToBrowserStorage.launcherState.hasSentNonWelcomeMessage;
|
|
471
|
-
return React.createElement(HydrationPanel, {
|
|
472
|
-
headerDisplayName: headerDisplayName,
|
|
473
|
-
isHydrated: botMessageState.isHydratingCounter === 0 && areModulesLoaded,
|
|
474
|
-
serviceManager: serviceManager,
|
|
475
|
-
onClose: this.onClose,
|
|
476
|
-
languagePack: languagePack,
|
|
477
|
-
useHomeScreenVersion: useHomeScreenVersion
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
renderHydrationPanel() {
|
|
481
|
-
const {botMessageState: botMessageState, serviceManager: serviceManager, catastrophicErrorType: catastrophicErrorType, persistedToBrowserStorage: persistedToBrowserStorage} = this.props;
|
|
482
|
-
const {viewState: viewState} = persistedToBrowserStorage.launcherState;
|
|
483
|
-
const {areModulesLoaded: areModulesLoaded} = this.state;
|
|
484
|
-
return React.createElement(OverlayPanel, {
|
|
485
|
-
onOpenStart: () => this.onPanelOpenStart(false),
|
|
486
|
-
onCloseStart: this.onPanelCloseStart,
|
|
487
|
-
onOpenEnd: this.onPanelOpenEnd,
|
|
488
|
-
onCloseEnd: () => {
|
|
489
|
-
this.onHydrationPanelClose();
|
|
490
|
-
this.onPanelCloseEnd(false);
|
|
491
|
-
},
|
|
492
|
-
animationOnOpen: AnimationInType.NONE,
|
|
493
|
-
animationOnClose: AnimationOutType.NONE,
|
|
494
|
-
shouldOpen: (botMessageState.isHydratingCounter > 0 || !areModulesLoaded) && !catastrophicErrorType && viewState.mainWindow,
|
|
495
|
-
shouldHide: false,
|
|
496
|
-
serviceManager: serviceManager,
|
|
497
|
-
overlayPanelName: OverlayPanelName.HYDRATING
|
|
498
|
-
}, this.renderInnerHydrationPanel());
|
|
499
|
-
}
|
|
500
|
-
renderCatastrophicPanel() {
|
|
501
|
-
const {serviceManager: serviceManager, botName: botName, languagePack: languagePack, headerDisplayName: headerDisplayName} = this.props;
|
|
502
|
-
return React.createElement(OverlayPanel, {
|
|
503
|
-
animationOnOpen: AnimationInType.NONE,
|
|
504
|
-
animationOnClose: AnimationOutType.NONE,
|
|
505
|
-
shouldOpen: true,
|
|
506
|
-
serviceManager: serviceManager,
|
|
507
|
-
overlayPanelName: OverlayPanelName.CATASTROPHIC
|
|
508
|
-
}, React.createElement(Suspense, {
|
|
509
|
-
fallback: null
|
|
510
|
-
}, React.createElement(CatastrophicError, {
|
|
511
|
-
onClose: this.onClose,
|
|
512
|
-
headerDisplayName: headerDisplayName,
|
|
513
|
-
languagePack: languagePack,
|
|
514
|
-
onRestart: this.onRestart,
|
|
515
|
-
showHeader: true,
|
|
516
|
-
botName: botName
|
|
517
|
-
})));
|
|
518
|
-
}
|
|
519
|
-
renderDisclaimerPanel() {
|
|
520
|
-
const {serviceManager: serviceManager, config: config} = this.props;
|
|
521
|
-
const showDisclaimer = this.getShowDisclaimer();
|
|
522
|
-
return config.public.disclaimer?.is_on ? React.createElement(OverlayPanel, {
|
|
523
|
-
onOpenStart: () => this.onPanelOpenStart(false),
|
|
524
|
-
onCloseStart: this.onPanelCloseStart,
|
|
525
|
-
onOpenEnd: this.onPanelOpenEnd,
|
|
526
|
-
onCloseEnd: () => this.onPanelCloseEnd(false),
|
|
527
|
-
animationOnOpen: AnimationInType.FADE_IN,
|
|
528
|
-
animationOnClose: AnimationOutType.FADE_OUT,
|
|
529
|
-
shouldOpen: showDisclaimer,
|
|
530
|
-
serviceManager: serviceManager,
|
|
531
|
-
overlayPanelName: OverlayPanelName.DISCLAIMER
|
|
532
|
-
}, React.createElement(Suspense, {
|
|
533
|
-
fallback: null
|
|
534
|
-
}, React.createElement(Disclaimer, {
|
|
535
|
-
onAcceptDisclaimer: this.onAcceptDisclaimer,
|
|
536
|
-
onClose: this.onClose,
|
|
537
|
-
disclaimerHTML: config.public.disclaimer?.disclaimerHTML,
|
|
538
|
-
disclaimerAcceptButtonRef: this.disclaimerRef
|
|
539
|
-
}))) : null;
|
|
540
|
-
}
|
|
541
|
-
renderHomeScreenPanel() {
|
|
542
|
-
const {isHydrationAnimationComplete: isHydrationAnimationComplete} = this.state;
|
|
543
|
-
const showHomeScreen = this.getShowHomeScreen();
|
|
544
|
-
return React.createElement(Suspense, {
|
|
545
|
-
fallback: null
|
|
546
|
-
}, React.createElement(HomeScreenContainer, {
|
|
547
|
-
onPanelOpenStart: () => this.onPanelOpenStart(false),
|
|
548
|
-
onPanelOpenEnd: this.onPanelOpenEnd,
|
|
549
|
-
onPanelCloseStart: this.onPanelCloseStart,
|
|
550
|
-
onPanelCloseEnd: () => this.onPanelCloseEnd(false),
|
|
551
|
-
onClose: this.onClose,
|
|
552
|
-
onCloseAndRestart: this.onCloseAndRestart,
|
|
553
|
-
onSendBotInput: text => this.onSendInput(text, MessageSendSource.HOME_SCREEN_INPUT),
|
|
554
|
-
onSendButtonInput: this.onSendHomeButtonInput,
|
|
555
|
-
onRestart: this.onRestart,
|
|
556
|
-
showHomeScreen: showHomeScreen,
|
|
557
|
-
isHydrationAnimationComplete: isHydrationAnimationComplete,
|
|
558
|
-
homeScreenInputRef: this.homeScreenInputRef,
|
|
559
|
-
onToggleHomeScreen: this.onToggleHomeScreen,
|
|
560
|
-
requestFocus: this.requestFocus
|
|
561
|
-
}));
|
|
562
|
-
}
|
|
563
|
-
renderIFramePanel() {
|
|
564
|
-
const {serviceManager: serviceManager, iFramePanelState: iFramePanelState} = this.props;
|
|
565
|
-
return React.createElement(OverlayPanel, {
|
|
566
|
-
className: "WAC__overlay--covering",
|
|
567
|
-
onOpenStart: () => this.onPanelOpenStart(true),
|
|
568
|
-
onCloseStart: this.onPanelCloseStart,
|
|
569
|
-
onOpenEnd: this.onPanelOpenEnd,
|
|
570
|
-
onCloseEnd: () => this.onPanelCloseEnd(true),
|
|
571
|
-
animationOnOpen: AnimationInType.SLIDE_IN_FROM_BOTTOM,
|
|
572
|
-
animationOnClose: AnimationOutType.SLIDE_OUT_TO_BOTTOM,
|
|
573
|
-
shouldOpen: iFramePanelState.isOpen,
|
|
574
|
-
serviceManager: serviceManager,
|
|
575
|
-
overlayPanelName: OverlayPanelName.IFRAME
|
|
576
|
-
}, React.createElement(Suspense, {
|
|
577
|
-
fallback: null
|
|
578
|
-
}, React.createElement(IFramePanel, {
|
|
579
|
-
useAITheme: this.props.theme.useAITheme,
|
|
580
|
-
ref: this.iframePanelRef,
|
|
581
|
-
onClickClose: this.onClose,
|
|
582
|
-
onClickRestart: this.onRestart,
|
|
583
|
-
onClickCloseAndRestart: this.onCloseAndRestart
|
|
584
|
-
})));
|
|
585
|
-
}
|
|
586
|
-
renderViewSourcePanel() {
|
|
587
|
-
const {serviceManager: serviceManager, viewSourcePanelState: viewSourcePanelState} = this.props;
|
|
588
|
-
return React.createElement(OverlayPanel, {
|
|
589
|
-
className: "WAC__overlay--covering",
|
|
590
|
-
onOpenStart: () => this.onPanelOpenStart(true),
|
|
591
|
-
onCloseStart: this.onPanelCloseStart,
|
|
592
|
-
onOpenEnd: this.onPanelOpenEnd,
|
|
593
|
-
onCloseEnd: () => this.onPanelCloseEnd(true),
|
|
594
|
-
animationOnOpen: AnimationInType.SLIDE_IN_FROM_BOTTOM,
|
|
595
|
-
animationOnClose: AnimationOutType.SLIDE_OUT_TO_BOTTOM,
|
|
596
|
-
shouldOpen: viewSourcePanelState.isOpen,
|
|
597
|
-
serviceManager: serviceManager,
|
|
598
|
-
overlayPanelName: OverlayPanelName.CONVERSATIONAL_SEARCH_CITATION
|
|
599
|
-
}, React.createElement(Suspense, {
|
|
600
|
-
fallback: null
|
|
601
|
-
}, React.createElement(ViewSourcePanel, {
|
|
602
|
-
ref: this.viewSourcePanelRef,
|
|
603
|
-
onClickClose: this.onClose,
|
|
604
|
-
onClickRestart: this.onRestart,
|
|
605
|
-
onClickCloseAndRestart: this.onCloseAndRestart
|
|
606
|
-
})));
|
|
607
|
-
}
|
|
608
|
-
renderCustomPanel() {
|
|
609
|
-
return React.createElement(CustomPanelExport, {
|
|
610
|
-
useAITheme: this.props.theme.useAITheme,
|
|
611
|
-
onClose: this.onClose,
|
|
612
|
-
onClickRestart: this.onRestart,
|
|
613
|
-
onCloseAndRestart: this.onCloseAndRestart,
|
|
614
|
-
onPanelOpenStart: () => this.onPanelOpenStart(true),
|
|
615
|
-
onPanelOpenEnd: this.onPanelOpenEnd,
|
|
616
|
-
onPanelCloseStart: this.onPanelCloseStart,
|
|
617
|
-
onPanelCloseEnd: () => this.onPanelCloseEnd(true)
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
renderResponsePanel() {
|
|
621
|
-
if (!this.props.responsePanelState.localMessageItem) {
|
|
622
|
-
return null;
|
|
623
|
-
}
|
|
624
|
-
const {isOpen: isOpen, localMessageItem: localMessageItem, isMessageForInput: isMessageForInput} = this.props.responsePanelState;
|
|
625
|
-
const panelOptions = (localMessageItem?.item).panel;
|
|
626
|
-
const eventName = `"Show panel" opened`;
|
|
627
|
-
const eventDescription = "Panel opened through panel response type";
|
|
628
|
-
const overlayPanelName = OverlayPanelName.PANEL_RESPONSE;
|
|
629
|
-
return React.createElement(Suspense, {
|
|
630
|
-
fallback: null
|
|
631
|
-
}, React.createElement(BodyAndFooterPanelComponent, {
|
|
632
|
-
eventName: eventName,
|
|
633
|
-
eventDescription: eventDescription,
|
|
634
|
-
overlayPanelName: overlayPanelName,
|
|
635
|
-
testIdPrefix: overlayPanelName,
|
|
636
|
-
isOpen: isOpen,
|
|
637
|
-
isMessageForInput: isMessageForInput,
|
|
638
|
-
localMessageItem: localMessageItem,
|
|
639
|
-
title: panelOptions?.title,
|
|
640
|
-
showAnimations: panelOptions?.show_animations,
|
|
641
|
-
useAITheme: this.props.theme.useAITheme,
|
|
642
|
-
requestFocus: this.requestFocus,
|
|
643
|
-
onClose: this.onClose,
|
|
644
|
-
onClickRestart: this.onRestart,
|
|
645
|
-
onCloseAndRestart: this.onCloseAndRestart,
|
|
646
|
-
onClickBack: () => this.props.serviceManager.store.dispatch(actions.setResponsePanelIsOpen(false)),
|
|
647
|
-
onPanelOpenStart: () => this.onPanelOpenStart(true),
|
|
648
|
-
onPanelOpenEnd: this.onPanelOpenEnd,
|
|
649
|
-
onPanelCloseStart: this.onPanelCloseStart,
|
|
650
|
-
onPanelCloseEnd: () => {
|
|
651
|
-
this.onPanelCloseEnd(true);
|
|
652
|
-
this.props.serviceManager.store.dispatch(actions.setResponsePanelContent(null, false));
|
|
653
|
-
}
|
|
654
|
-
}));
|
|
655
|
-
}
|
|
656
|
-
renderWidget() {
|
|
657
|
-
const {serviceManager: serviceManager, useCustomHostElement: useCustomHostElement, locale: locale, catastrophicErrorType: catastrophicErrorType, config: config, isHydrated: isHydrated, theme: theme, chatWidthBreakpoint: chatWidthBreakpoint, layout: layout, languagePack: languagePack} = this.props;
|
|
658
|
-
const {closing: closing, open: open, extraClassNames: extraClassNames} = this.state;
|
|
659
|
-
const localeClassName = `WACLocale-${locale || "en"}`;
|
|
660
|
-
const showGlass = config.public.enableFocusTrap && open && !config.public.hideCloseButton && !config.public.headerConfig.hideMinimizeButton;
|
|
661
|
-
const trapActive = Boolean(showGlass && isHydrated);
|
|
662
|
-
const isWideWidth = chatWidthBreakpoint === ChatWidthBreakpoint.WIDE;
|
|
663
|
-
return React.createElement(FocusTrap, {
|
|
664
|
-
active: trapActive
|
|
665
|
-
}, React.createElement("div", {
|
|
666
|
-
className: cx("WACMainWindow", "WACWidget__FocusTrapContainer", ...extraClassNames),
|
|
667
|
-
ref: this.mainWindowRef
|
|
668
|
-
}, showGlass && React.createElement("div", {
|
|
669
|
-
className: "WACWidget__FocusTrapGlass"
|
|
670
|
-
}), React.createElement("div", {
|
|
671
|
-
id: `WACWidget${serviceManager.namespace.suffix}`,
|
|
672
|
-
className: cx(`WACWidget ${localeClassName}`, {
|
|
673
|
-
"WACWidget--rounded": theme.corners === CornersType.ROUND,
|
|
674
|
-
"WACWidget--defaultElement": !useCustomHostElement,
|
|
675
|
-
"WACWidget--launched": !closing,
|
|
676
|
-
"WACWidget--closing": closing,
|
|
677
|
-
"WACWidget--closed": !open,
|
|
678
|
-
"WACWidget--maxWidth": isWideWidth && layout.hasContentMaxWidth,
|
|
679
|
-
[WIDTH_BREAKPOINT_NARROW]: chatWidthBreakpoint === ChatWidthBreakpoint.NARROW,
|
|
680
|
-
[WIDTH_BREAKPOINT_STANDARD]: chatWidthBreakpoint === ChatWidthBreakpoint.STANDARD,
|
|
681
|
-
[WIDTH_BREAKPOINT_WIDE]: isWideWidth
|
|
682
|
-
}),
|
|
683
|
-
ref: this.containerRef
|
|
684
|
-
}, React.createElement(VisuallyHidden, null, React.createElement("h1", null, languagePack.window_title)), catastrophicErrorType && this.renderCatastrophicPanel(), !catastrophicErrorType && React.createElement("div", {
|
|
685
|
-
ref: this.animationContainerRef,
|
|
686
|
-
className: "WACWidget__animationContainer",
|
|
687
|
-
onScroll: () => {
|
|
688
|
-
if (this.animationContainerRef.current.scrollTop !== 0) {
|
|
689
|
-
this.animationContainerRef.current.scrollTop = 0;
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
}, this.renderChat()), React.createElement("div", {
|
|
693
|
-
className: "WACMainWindowModalHost",
|
|
694
|
-
ref: this.setModalPortalHostElement
|
|
695
|
-
}))));
|
|
696
|
-
}
|
|
697
|
-
render() {
|
|
698
|
-
return React.createElement(ModalPortalRootContext.Provider, {
|
|
699
|
-
value: this.state.modalPortalHostElement
|
|
700
|
-
}, this.renderWidget());
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
var MainWindow$1 = connect(state => state, null, null, {
|
|
705
|
-
forwardRef: true
|
|
706
|
-
})(MainWindow);
|
|
707
|
-
|
|
708
|
-
export { MainWindow$1 as default };
|