@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,114 +0,0 @@
|
|
|
1
|
-
import { BusEventType } from "../../../../types/events/eventBusTypes.js";
|
|
2
|
-
|
|
3
|
-
import { outputItemToLocalItem } from "../../schema/outputItemToLocalItem.js";
|
|
4
|
-
|
|
5
|
-
import actions from "../../store/actions.js";
|
|
6
|
-
|
|
7
|
-
import { conditionalSetTimeout } from "../../utils/browserUtils.js";
|
|
8
|
-
|
|
9
|
-
import { asyncForEach } from "../../utils/lang/arrayUtils.js";
|
|
10
|
-
|
|
11
|
-
import { deepFreeze } from "../../utils/lang/objectUtils.js";
|
|
12
|
-
|
|
13
|
-
import { createMessageResponseForItem } from "../../utils/messageUtils.js";
|
|
14
|
-
|
|
15
|
-
import { getAgentStatusMessageText } from "./agentStatusMessage.js";
|
|
16
|
-
|
|
17
|
-
import { MessageResponseTypes } from "../../../../types/messaging/Messages.js";
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
* Copyright IBM Corp. 2025
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*
|
|
25
|
-
* @license
|
|
26
|
-
*/ function toPair(localMessages, originalMessage) {
|
|
27
|
-
return {
|
|
28
|
-
localMessages: localMessages,
|
|
29
|
-
originalMessage: originalMessage
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function createAgentLocalMessage(agentMessageType, serviceManager, agentProfile, fireEvents = true) {
|
|
34
|
-
const text = getAgentStatusMessageText(agentMessageType, agentProfile, serviceManager.intl);
|
|
35
|
-
const result = createAgentLocalMessageForType(agentMessageType);
|
|
36
|
-
const {originalMessage: originalMessage, localMessage: localMessage} = result;
|
|
37
|
-
localMessage.item.text = text;
|
|
38
|
-
if (agentProfile) {
|
|
39
|
-
if (!originalMessage.history) {
|
|
40
|
-
originalMessage.history = {};
|
|
41
|
-
}
|
|
42
|
-
originalMessage.history.agent_profile = agentProfile;
|
|
43
|
-
}
|
|
44
|
-
if (fireEvents) {
|
|
45
|
-
await serviceManager.fire({
|
|
46
|
-
type: BusEventType.AGENT_PRE_RECEIVE,
|
|
47
|
-
data: originalMessage
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
deepFreeze(originalMessage);
|
|
51
|
-
if (fireEvents) {
|
|
52
|
-
await serviceManager.fire({
|
|
53
|
-
type: BusEventType.AGENT_RECEIVE,
|
|
54
|
-
data: originalMessage
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function createAgentLocalMessageForType(agentMessageType) {
|
|
61
|
-
const messageItem = {
|
|
62
|
-
response_type: MessageResponseTypes.TEXT,
|
|
63
|
-
agent_message_type: agentMessageType
|
|
64
|
-
};
|
|
65
|
-
const originalMessage = createMessageResponseForItem(messageItem);
|
|
66
|
-
const localMessage = outputItemToLocalItem(messageItem, originalMessage);
|
|
67
|
-
return {
|
|
68
|
-
localMessage: localMessage,
|
|
69
|
-
originalMessage: originalMessage
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function createBotReturnMessage(languagePack) {
|
|
74
|
-
const {agent_botReturned: agent_botReturned} = languagePack;
|
|
75
|
-
if (!agent_botReturned) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
const {originalMessage: originalMessage, localMessage: localMessage} = createAgentLocalMessageForType(null);
|
|
79
|
-
localMessage.item.text = agent_botReturned;
|
|
80
|
-
return {
|
|
81
|
-
originalMessage: originalMessage,
|
|
82
|
-
localMessage: localMessage
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async function addMessages(messagePairs, saveInHistory, fireHistoryEvent, showLiveMessages, serviceManager) {
|
|
87
|
-
if (showLiveMessages) {
|
|
88
|
-
await asyncForEach(messagePairs, async ({localMessages: localMessages, originalMessage: originalMessage}) => {
|
|
89
|
-
await asyncForEach(localMessages, async (localMessage, index) => {
|
|
90
|
-
await serviceManager.actions.handleUserDefinedResponseItems(localMessage, originalMessage);
|
|
91
|
-
serviceManager.store.dispatch(actions.addLocalMessageItem(localMessage, originalMessage, index === 0));
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async function addBotReturnMessage(botReturnDelay, wasSuspended, serviceManager) {
|
|
98
|
-
const botReturn = createBotReturnMessage(serviceManager.store.getState().languagePack);
|
|
99
|
-
if (botReturn) {
|
|
100
|
-
const initialRestartCount = serviceManager.restartCount;
|
|
101
|
-
conditionalSetTimeout(() => {
|
|
102
|
-
if (initialRestartCount === serviceManager.restartCount) {
|
|
103
|
-
addMessages([ toPair([ botReturn.localMessage ], botReturn.originalMessage) ], true, false, !wasSuspended, serviceManager);
|
|
104
|
-
}
|
|
105
|
-
}, botReturnDelay);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
async function addAgentEndChatMessage(agentMessageType, agentProfile, fireEvents, wasSuspended, serviceManager) {
|
|
110
|
-
const endChatMessage = await createAgentLocalMessage(agentMessageType, serviceManager, agentProfile, fireEvents);
|
|
111
|
-
await addMessages([ toPair([ endChatMessage.localMessage ], endChatMessage.originalMessage) ], true, false, !wasSuspended, serviceManager);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export { addAgentEndChatMessage, addBotReturnMessage, addMessages, createAgentLocalMessage, toPair };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright IBM Corp. 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @license
|
|
8
|
-
*/
|
|
9
|
-
let innerStorage = {};
|
|
10
|
-
|
|
11
|
-
const storage = {
|
|
12
|
-
getItem(key) {
|
|
13
|
-
return innerStorage[key];
|
|
14
|
-
},
|
|
15
|
-
setItem(key, value) {
|
|
16
|
-
innerStorage[key] = value;
|
|
17
|
-
},
|
|
18
|
-
removeItem(key) {
|
|
19
|
-
delete innerStorage[key];
|
|
20
|
-
},
|
|
21
|
-
length: Object.keys(innerStorage).length,
|
|
22
|
-
clear() {
|
|
23
|
-
innerStorage = {};
|
|
24
|
-
},
|
|
25
|
-
key(index) {
|
|
26
|
-
return Object.keys(innerStorage)[index];
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export { storage as default };
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright IBM Corp. 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @license
|
|
8
|
-
*/
|
|
9
|
-
const HA_SET_AGENT_AVAILABILITY = "HA_SET_AGENT_AVAILABILITY";
|
|
10
|
-
|
|
11
|
-
const HA_SET_IS_CONNECTING = "HA_SET_IS_CONNECTING";
|
|
12
|
-
|
|
13
|
-
const HA_SET_IS_RECONNECTING = "HA_SET_IS_RECONNECTING";
|
|
14
|
-
|
|
15
|
-
const HA_SET_AGENT_JOINED = "HA_SET_AGENT_JOINED";
|
|
16
|
-
|
|
17
|
-
const HA_SET_AGENT_LEFT_CHAT = "HA_SET_AGENT_LEFT_CHAT";
|
|
18
|
-
|
|
19
|
-
const HA_END_CHAT = "HA_END_CHAT";
|
|
20
|
-
|
|
21
|
-
const HA_UPDATE_CAPABILITIES = "HA_UPDATE_CAPABILITIES";
|
|
22
|
-
|
|
23
|
-
const HA_UPDATE_FILE_UPLOAD_IN_PROGRESS = "HA_UPDATE_FILE_UPLOAD_IN_PROGRESS";
|
|
24
|
-
|
|
25
|
-
const HA_SET_SHOW_SCREEN_SHARE_REQUEST = "HA_SET_SHOW_SCREEN_SHARE_REQUEST";
|
|
26
|
-
|
|
27
|
-
const HA_SET_IS_SCREEN_SHARING = "HA_SET_IS_SCREEN_SHARING";
|
|
28
|
-
|
|
29
|
-
const HA_SET_PERSISTED_STATE = "HA_SET_PERSISTED_STATE";
|
|
30
|
-
|
|
31
|
-
const HA_UPDATE_IS_SUSPENDED = "HA_UPDATE_IS_SUSPENDED";
|
|
32
|
-
|
|
33
|
-
const HA_UPDATE_IS_TYPING = "HA_UPDATE_IS_TYPING";
|
|
34
|
-
|
|
35
|
-
function setIsConnecting(isConnecting, localMessageID) {
|
|
36
|
-
return {
|
|
37
|
-
type: HA_SET_IS_CONNECTING,
|
|
38
|
-
isConnecting: isConnecting,
|
|
39
|
-
localMessageID: localMessageID
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function setIsReconnecting(isReconnecting) {
|
|
44
|
-
return {
|
|
45
|
-
type: HA_SET_IS_RECONNECTING,
|
|
46
|
-
isReconnecting: isReconnecting
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function setAgentLeftChat() {
|
|
51
|
-
return {
|
|
52
|
-
type: HA_SET_AGENT_LEFT_CHAT
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function endChat() {
|
|
57
|
-
return {
|
|
58
|
-
type: HA_END_CHAT
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function setAgentAvailability(availability) {
|
|
63
|
-
return {
|
|
64
|
-
type: HA_SET_AGENT_AVAILABILITY,
|
|
65
|
-
availability: availability
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function setAgentJoined(agentProfile) {
|
|
70
|
-
return {
|
|
71
|
-
type: HA_SET_AGENT_JOINED,
|
|
72
|
-
agentProfile: agentProfile
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function updateCapabilities(capabilities) {
|
|
77
|
-
return {
|
|
78
|
-
type: HA_UPDATE_CAPABILITIES,
|
|
79
|
-
capabilities: capabilities
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function updateFilesUploadInProgress(fileUploadInProgress) {
|
|
84
|
-
return {
|
|
85
|
-
type: HA_UPDATE_FILE_UPLOAD_IN_PROGRESS,
|
|
86
|
-
fileUploadInProgress: fileUploadInProgress
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function setShowScreenShareRequest(showRequest) {
|
|
91
|
-
return {
|
|
92
|
-
type: HA_SET_SHOW_SCREEN_SHARE_REQUEST,
|
|
93
|
-
showRequest: showRequest
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function setIsScreenSharing(isSharing) {
|
|
98
|
-
return {
|
|
99
|
-
type: HA_SET_IS_SCREEN_SHARING,
|
|
100
|
-
isSharing: isSharing
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function setPersistedServiceDeskState(state) {
|
|
105
|
-
return {
|
|
106
|
-
type: HA_SET_PERSISTED_STATE,
|
|
107
|
-
state: state
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function agentUpdateIsSuspended(isSuspended) {
|
|
112
|
-
return {
|
|
113
|
-
type: HA_UPDATE_IS_SUSPENDED,
|
|
114
|
-
isSuspended: isSuspended
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function agentUpdateIsTyping(isTyping) {
|
|
119
|
-
return {
|
|
120
|
-
type: HA_UPDATE_IS_TYPING,
|
|
121
|
-
isTyping: isTyping
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export { HA_END_CHAT, HA_SET_AGENT_AVAILABILITY, HA_SET_AGENT_JOINED, HA_SET_AGENT_LEFT_CHAT, HA_SET_IS_CONNECTING, HA_SET_IS_RECONNECTING, HA_SET_IS_SCREEN_SHARING, HA_SET_PERSISTED_STATE, HA_SET_SHOW_SCREEN_SHARE_REQUEST, HA_UPDATE_CAPABILITIES, HA_UPDATE_FILE_UPLOAD_IN_PROGRESS, HA_UPDATE_IS_SUSPENDED, HA_UPDATE_IS_TYPING, agentUpdateIsSuspended, agentUpdateIsTyping, endChat, setAgentAvailability, setAgentJoined, setAgentLeftChat, setIsConnecting, setIsReconnecting, setIsScreenSharing, setPersistedServiceDeskState, setShowScreenShareRequest, updateCapabilities, updateFilesUploadInProgress };
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { HA_END_CHAT, HA_UPDATE_FILE_UPLOAD_IN_PROGRESS, HA_SET_IS_SCREEN_SHARING, HA_UPDATE_CAPABILITIES, HA_SET_AGENT_LEFT_CHAT, HA_UPDATE_IS_TYPING, HA_UPDATE_IS_SUSPENDED, HA_SET_PERSISTED_STATE, HA_SET_AGENT_JOINED, HA_SET_SHOW_SCREEN_SHARE_REQUEST, HA_SET_AGENT_AVAILABILITY, HA_SET_IS_RECONNECTING, HA_SET_IS_CONNECTING } from "./agentActions.js";
|
|
2
|
-
|
|
3
|
-
import { applyLocalMessageUIState } from "./reducerUtils.js";
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright IBM Corp. 2025
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*
|
|
11
|
-
* @license
|
|
12
|
-
*/ const agentReducers = {
|
|
13
|
-
[HA_SET_IS_CONNECTING]: (state, action) => {
|
|
14
|
-
const {isConnecting: isConnecting, localMessageID: localMessageID} = action;
|
|
15
|
-
return {
|
|
16
|
-
...state,
|
|
17
|
-
agentState: {
|
|
18
|
-
...state.agentState,
|
|
19
|
-
isConnecting: isConnecting,
|
|
20
|
-
activeLocalMessageID: localMessageID,
|
|
21
|
-
numUnreadMessages: isConnecting ? 0 : state.agentState.numUnreadMessages
|
|
22
|
-
},
|
|
23
|
-
persistedToBrowserStorage: {
|
|
24
|
-
...state.persistedToBrowserStorage,
|
|
25
|
-
chatState: {
|
|
26
|
-
...state.persistedToBrowserStorage.chatState,
|
|
27
|
-
agentState: {
|
|
28
|
-
...state.persistedToBrowserStorage.chatState.agentState,
|
|
29
|
-
isSuspended: isConnecting ? state.persistedToBrowserStorage.chatState.agentState.isSuspended : false
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
[HA_SET_IS_RECONNECTING]: (state, action) => {
|
|
36
|
-
const {isReconnecting: isReconnecting} = action;
|
|
37
|
-
return {
|
|
38
|
-
...state,
|
|
39
|
-
agentState: {
|
|
40
|
-
...state.agentState,
|
|
41
|
-
isReconnecting: isReconnecting
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
[HA_SET_AGENT_AVAILABILITY]: (state, action) => {
|
|
46
|
-
if (!state.agentState.isConnecting) {
|
|
47
|
-
return state;
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
...state,
|
|
51
|
-
agentState: {
|
|
52
|
-
...state.agentState,
|
|
53
|
-
availability: state.agentState.isConnecting ? action.availability : null
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
[HA_SET_SHOW_SCREEN_SHARE_REQUEST]: (state, {showRequest: showRequest}) => ({
|
|
58
|
-
...state,
|
|
59
|
-
agentState: {
|
|
60
|
-
...state.agentState,
|
|
61
|
-
showScreenShareRequest: showRequest
|
|
62
|
-
}
|
|
63
|
-
}),
|
|
64
|
-
[HA_SET_AGENT_JOINED]: (state, action) => {
|
|
65
|
-
const agentProfiles = {
|
|
66
|
-
...state.persistedToBrowserStorage.chatState.agentState.agentProfiles
|
|
67
|
-
};
|
|
68
|
-
const {agentProfile: agentProfile} = action;
|
|
69
|
-
if (agentProfile) {
|
|
70
|
-
agentProfiles[agentProfile.id] = agentProfile;
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
...state,
|
|
74
|
-
agentState: {
|
|
75
|
-
...state.agentState,
|
|
76
|
-
isConnecting: false,
|
|
77
|
-
isReconnecting: false,
|
|
78
|
-
availability: null
|
|
79
|
-
},
|
|
80
|
-
persistedToBrowserStorage: {
|
|
81
|
-
...state.persistedToBrowserStorage,
|
|
82
|
-
chatState: {
|
|
83
|
-
...state.persistedToBrowserStorage.chatState,
|
|
84
|
-
agentState: {
|
|
85
|
-
...state.persistedToBrowserStorage.chatState.agentState,
|
|
86
|
-
isConnected: true,
|
|
87
|
-
agentProfile: agentProfile,
|
|
88
|
-
agentProfiles: agentProfiles
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
[HA_SET_PERSISTED_STATE]: (state, action) => ({
|
|
95
|
-
...state,
|
|
96
|
-
persistedToBrowserStorage: {
|
|
97
|
-
...state.persistedToBrowserStorage,
|
|
98
|
-
chatState: {
|
|
99
|
-
...state.persistedToBrowserStorage.chatState,
|
|
100
|
-
agentState: {
|
|
101
|
-
...state.persistedToBrowserStorage.chatState.agentState,
|
|
102
|
-
serviceDeskState: action.state
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}),
|
|
107
|
-
[HA_UPDATE_IS_SUSPENDED]: (state, action) => {
|
|
108
|
-
if (!state.agentState.isConnecting && !state.persistedToBrowserStorage.chatState.agentState.isConnected) {
|
|
109
|
-
return state;
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
...state,
|
|
113
|
-
persistedToBrowserStorage: {
|
|
114
|
-
...state.persistedToBrowserStorage,
|
|
115
|
-
chatState: {
|
|
116
|
-
...state.persistedToBrowserStorage.chatState,
|
|
117
|
-
agentState: {
|
|
118
|
-
...state.persistedToBrowserStorage.chatState.agentState,
|
|
119
|
-
isSuspended: action.isSuspended
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
},
|
|
125
|
-
[HA_UPDATE_IS_TYPING]: (state, action) => ({
|
|
126
|
-
...state,
|
|
127
|
-
agentState: {
|
|
128
|
-
...state.agentState,
|
|
129
|
-
isAgentTyping: action.isTyping
|
|
130
|
-
}
|
|
131
|
-
}),
|
|
132
|
-
[HA_SET_AGENT_LEFT_CHAT]: state => ({
|
|
133
|
-
...state,
|
|
134
|
-
botMessageState: {
|
|
135
|
-
...state.botMessageState
|
|
136
|
-
},
|
|
137
|
-
agentState: {
|
|
138
|
-
...state.agentState,
|
|
139
|
-
isAgentTyping: false
|
|
140
|
-
},
|
|
141
|
-
persistedToBrowserStorage: {
|
|
142
|
-
...state.persistedToBrowserStorage,
|
|
143
|
-
chatState: {
|
|
144
|
-
...state.persistedToBrowserStorage.chatState,
|
|
145
|
-
agentState: {
|
|
146
|
-
...state.persistedToBrowserStorage.chatState.agentState,
|
|
147
|
-
agentProfile: null
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}),
|
|
152
|
-
[HA_UPDATE_CAPABILITIES]: (state, action) => {
|
|
153
|
-
const newInputState = {
|
|
154
|
-
...state.agentState.inputState,
|
|
155
|
-
...action.capabilities
|
|
156
|
-
};
|
|
157
|
-
if (!newInputState.allowFileUploads) {
|
|
158
|
-
newInputState.files = [];
|
|
159
|
-
}
|
|
160
|
-
return {
|
|
161
|
-
...state,
|
|
162
|
-
agentState: {
|
|
163
|
-
...state.agentState,
|
|
164
|
-
inputState: newInputState
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
},
|
|
168
|
-
[HA_SET_IS_SCREEN_SHARING]: (state, {isSharing: isSharing}) => ({
|
|
169
|
-
...state,
|
|
170
|
-
agentState: {
|
|
171
|
-
...state.agentState,
|
|
172
|
-
isScreenSharing: isSharing
|
|
173
|
-
}
|
|
174
|
-
}),
|
|
175
|
-
[HA_UPDATE_FILE_UPLOAD_IN_PROGRESS]: (state, action) => ({
|
|
176
|
-
...state,
|
|
177
|
-
agentState: {
|
|
178
|
-
...state.agentState,
|
|
179
|
-
fileUploadInProgress: action.fileUploadInProgress
|
|
180
|
-
}
|
|
181
|
-
}),
|
|
182
|
-
[HA_END_CHAT]: state => {
|
|
183
|
-
let newState = applyLocalMessageUIState(state, state.agentState.activeLocalMessageID, "wasAgentChatEnded", true);
|
|
184
|
-
newState = {
|
|
185
|
-
...newState,
|
|
186
|
-
agentState: {
|
|
187
|
-
...newState.agentState,
|
|
188
|
-
isConnecting: false,
|
|
189
|
-
isReconnecting: false,
|
|
190
|
-
availability: null,
|
|
191
|
-
activeLocalMessageID: null,
|
|
192
|
-
isAgentTyping: false,
|
|
193
|
-
inputState: {
|
|
194
|
-
...newState.agentState.inputState,
|
|
195
|
-
isReadonly: false
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
persistedToBrowserStorage: {
|
|
199
|
-
...state.persistedToBrowserStorage,
|
|
200
|
-
chatState: {
|
|
201
|
-
...state.persistedToBrowserStorage.chatState,
|
|
202
|
-
agentState: {
|
|
203
|
-
...state.persistedToBrowserStorage.chatState.agentState,
|
|
204
|
-
isConnected: false,
|
|
205
|
-
isSuspended: false,
|
|
206
|
-
agentProfile: null
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
return newState;
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
export { agentReducers };
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import merge from "lodash-es/merge.js";
|
|
2
|
-
|
|
3
|
-
import { createStore } from "redux";
|
|
4
|
-
|
|
5
|
-
import { NODE_ENV } from "../environmentVariables.js";
|
|
6
|
-
|
|
7
|
-
import { IS_PHONE } from "../utils/browserUtils.js";
|
|
8
|
-
|
|
9
|
-
import "../utils/constants.js";
|
|
10
|
-
|
|
11
|
-
import { withoutEmptyStarters } from "../utils/homeScreenUtils.js";
|
|
12
|
-
|
|
13
|
-
import { getBotName } from "../utils/miscUtils.js";
|
|
14
|
-
|
|
15
|
-
import { mergeCSSVariables } from "../utils/styleUtils.js";
|
|
16
|
-
|
|
17
|
-
import { reducers } from "./reducers.js";
|
|
18
|
-
|
|
19
|
-
import { DEFAULT_THEME_STATE, VIEW_STATE_MAIN_WINDOW_OPEN, VIEW_STATE_LAUNCHER_OPEN, DEFAULT_LAUNCHER, DEFAULT_PERSISTED_TO_BROWSER, DEFAULT_INPUT_STATE, VIEW_STATE_ALL_CLOSED, DEFAULT_TOUR_STATE, DEFAULT_MESSAGE_PANEL_STATE, DEFAULT_CUSTOM_PANEL_STATE, DEFAULT_CITATION_PANEL_STATE, DEFAULT_IFRAME_PANEL_STATE, DEFAULT_AGENT_STATE, DEFAULT_MESSAGE_STATE, DEFAULT_LAYOUT_STATE } from "./reducerUtils.js";
|
|
20
|
-
|
|
21
|
-
import "../../../types/instance/apiTypes.js";
|
|
22
|
-
|
|
23
|
-
import enLanguagePack from "../../languages/en.json.js";
|
|
24
|
-
|
|
25
|
-
import { CornersType } from "../../../types/config/CornersType.js";
|
|
26
|
-
|
|
27
|
-
/*
|
|
28
|
-
* Copyright IBM Corp. 2025
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
31
|
-
* LICENSE file in the root directory of this source tree.
|
|
32
|
-
*
|
|
33
|
-
* @license
|
|
34
|
-
*/ function doCreateStore(config, serviceManager) {
|
|
35
|
-
let useAITheme;
|
|
36
|
-
if (config.public.themeConfig?.useAITheme !== undefined) {
|
|
37
|
-
useAITheme = config.public.themeConfig?.useAITheme;
|
|
38
|
-
} else {
|
|
39
|
-
useAITheme = DEFAULT_THEME_STATE.useAITheme;
|
|
40
|
-
}
|
|
41
|
-
const themeState = {
|
|
42
|
-
carbonTheme: config.public.themeConfig?.carbonTheme || DEFAULT_THEME_STATE.carbonTheme,
|
|
43
|
-
useAITheme: useAITheme,
|
|
44
|
-
corners: getThemeCornersType(config)
|
|
45
|
-
};
|
|
46
|
-
const botName = getBotName(themeState.useAITheme, config);
|
|
47
|
-
const initialState = {
|
|
48
|
-
...DEFAULT_MESSAGE_STATE,
|
|
49
|
-
notifications: [],
|
|
50
|
-
botInputState: {
|
|
51
|
-
...DEFAULT_INPUT_STATE(),
|
|
52
|
-
isReadonly: config.public.isReadonly,
|
|
53
|
-
fieldVisible: !config.public.isReadonly
|
|
54
|
-
},
|
|
55
|
-
agentState: {
|
|
56
|
-
...DEFAULT_AGENT_STATE
|
|
57
|
-
},
|
|
58
|
-
botName: botName,
|
|
59
|
-
headerDisplayName: null,
|
|
60
|
-
botAvatarURL: config.public.botAvatarURL || null,
|
|
61
|
-
headerAvatarConfig: null,
|
|
62
|
-
chatWidthBreakpoint: null,
|
|
63
|
-
chatWidth: null,
|
|
64
|
-
chatHeight: null,
|
|
65
|
-
cssVariableOverrides: mergeCSSVariables({}, {}, themeState.carbonTheme, themeState.useAITheme),
|
|
66
|
-
isHydrated: false,
|
|
67
|
-
languagePack: enLanguagePack,
|
|
68
|
-
locale: "en",
|
|
69
|
-
config: config,
|
|
70
|
-
originalConfig: config,
|
|
71
|
-
suspendScrollDetection: false,
|
|
72
|
-
homeScreenConfig: withoutEmptyStarters({}),
|
|
73
|
-
persistedToBrowserStorage: {
|
|
74
|
-
...DEFAULT_PERSISTED_TO_BROWSER,
|
|
75
|
-
chatState: {
|
|
76
|
-
...DEFAULT_PERSISTED_TO_BROWSER.chatState,
|
|
77
|
-
homeScreenState: {
|
|
78
|
-
...DEFAULT_PERSISTED_TO_BROWSER.chatState.homeScreenState
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
launcher: merge({}, DEFAULT_LAUNCHER, {
|
|
83
|
-
config: merge({}, {}, {
|
|
84
|
-
mobile: {}
|
|
85
|
-
}, {
|
|
86
|
-
is_on: config.public.showLauncher
|
|
87
|
-
})
|
|
88
|
-
}),
|
|
89
|
-
iFramePanelState: DEFAULT_IFRAME_PANEL_STATE,
|
|
90
|
-
viewSourcePanelState: DEFAULT_CITATION_PANEL_STATE,
|
|
91
|
-
isDestroyed: false,
|
|
92
|
-
customPanelState: DEFAULT_CUSTOM_PANEL_STATE,
|
|
93
|
-
viewChanging: false,
|
|
94
|
-
initialViewChangeComplete: false,
|
|
95
|
-
targetViewState: config.public.openChatByDefault ? VIEW_STATE_MAIN_WINDOW_OPEN : VIEW_STATE_LAUNCHER_OPEN,
|
|
96
|
-
responsePanelState: DEFAULT_MESSAGE_PANEL_STATE,
|
|
97
|
-
customMenuOptions: null,
|
|
98
|
-
tourState: DEFAULT_TOUR_STATE,
|
|
99
|
-
isBrowserPageVisible: true,
|
|
100
|
-
showNonHeaderBackgroundCover: false,
|
|
101
|
-
theme: themeState,
|
|
102
|
-
layout: getLayoutState(config),
|
|
103
|
-
chatHeaderState: {
|
|
104
|
-
config: null,
|
|
105
|
-
maxVisibleHeaderObjects: 0
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const sessionStorageLauncherState = serviceManager.userSessionStorageService?.loadLauncherSession();
|
|
109
|
-
if (sessionStorageLauncherState) {
|
|
110
|
-
initialState.targetViewState = sessionStorageLauncherState.viewState;
|
|
111
|
-
sessionStorageLauncherState.viewState = VIEW_STATE_ALL_CLOSED;
|
|
112
|
-
initialState.persistedToBrowserStorage.launcherState = sessionStorageLauncherState;
|
|
113
|
-
}
|
|
114
|
-
const enhancer = config.public.debug || NODE_ENV === "development" ? window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__({
|
|
115
|
-
name: "CarbonAIChat",
|
|
116
|
-
instanceId: `Chat${serviceManager.namespace.suffix}`
|
|
117
|
-
}) : undefined;
|
|
118
|
-
return createStore(reducerFunction, initialState, enhancer);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function getThemeCornersType(config) {
|
|
122
|
-
if (getLayoutState(config).showFrame === false || IS_PHONE || config.public.themeConfig?.corners === CornersType.SQUARE) {
|
|
123
|
-
return CornersType.SQUARE;
|
|
124
|
-
}
|
|
125
|
-
return DEFAULT_THEME_STATE.corners;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function getLayoutState(config) {
|
|
129
|
-
if (config.public.themeConfig?.useAITheme) {
|
|
130
|
-
return {
|
|
131
|
-
showFrame: config.public.layout?.showFrame ?? true,
|
|
132
|
-
hasContentMaxWidth: config.public.layout?.hasContentMaxWidth ?? true
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
return merge({}, DEFAULT_LAYOUT_STATE, config.public.layout);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function reducerFunction(state, action) {
|
|
139
|
-
return action && reducers[action.type] ? reducers[action.type](state, action) : state;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export { doCreateStore };
|