@carbon/ai-chat 0.4.0-rc.2 → 0.4.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/aiChatEntry.js +220 -14
- package/dist/es/chat.AppContainer.js +6491 -0
- package/dist/es/chat.AppState.js +40 -0
- package/dist/es/{chat/shared/components/BasePanelComponent.js → chat.BasePanelComponent.js} +3 -3
- package/dist/es/{chat/shared/components/panels/BodyAndFooterPanelComponent.js → chat.BodyAndFooterPanelComponent.js} +92 -9
- package/dist/es/chat.BodyWithFooterComponent.js +140 -0
- package/dist/es/{chat/shared/components/header/BotHeader.js → chat.BotHeader.js} +7 -9
- package/dist/es/{chat/shared/components/responseTypes/carousel/Carousel.js → chat.Carousel.js} +3 -3
- package/dist/es/chat.CatastrophicError.js +381 -0
- package/dist/es/chat.Chat.js +2009 -0
- package/dist/es/chat.Disclaimer.js +553 -0
- package/dist/es/chat.Header.js +1025 -0
- package/dist/es/{chat/shared/components/util/HideComponent.js → chat.HideComponent.js} +9 -2
- package/dist/es/{types/config/HomeScreenConfig.js → chat.HomeScreenConfig.js} +1 -1
- package/dist/es/{chat/shared/components/homeScreen/HomeScreen.js → chat.HomeScreenContainer.js} +159 -14
- package/dist/es/{chat/shared/components/homeScreen/HomeScreenHeader.js → chat.HomeScreenHeader.js} +3 -3
- package/dist/es/{chat/shared/services/haa/HumanAgentServiceImpl.js → chat.HumanAgentServiceImpl.js} +215 -17
- package/dist/es/{chat/shared/components/responseTypes/iframe/IFrameComponent.js → chat.IFrameComponent.js} +4 -8
- package/dist/es/chat.IFramePanel.js +151 -0
- package/dist/es/{chat/shared/components/input/Input.js → chat.Input.js} +214 -18
- package/dist/es/{types/config/ServiceDeskConfig.js → chat.LocalMessageItem.js} +17 -1
- package/dist/es/chat.MessageTypeComponent.js +3580 -0
- package/dist/es/{types/messaging/Messages.js → chat.Messages.js} +1 -1
- package/dist/es/chat.MountChildrenOnDelay.js +97 -0
- package/dist/es/{chat/shared/components/OverlayPanel.js → chat.PageObjectId.js} +70 -4
- package/dist/es/{chat/web-components/components/markdownText/src/markdownText.scss.js → chat.RichText.js} +347 -1
- package/dist/es/chat.TourContainer.js +524 -0
- package/dist/es/{chat/languages/en.json.js → chat.VideoComponent.js} +561 -1
- package/dist/es/chat.ViewSourcePanel.js +187 -0
- package/dist/es/{chat/shared/store/actions.js → chat.actions.js} +2 -2
- package/dist/es/{chat/shared/utils/browserUtils.js → chat.browserUtils.js} +1 -1
- package/dist/es/{types/utilities/carbonTypes.js → chat.carbonTypes.js} +2 -2
- package/dist/es/{chat/web-components/components/codeElement/src/codeElement.scss.js → chat.cds-aichat-code.js} +64 -1
- package/dist/es/{chat/shared/utils/constants.js → chat.constants.js} +4 -7
- package/dist/es/{types/events/eventBusTypes.js → chat.customElement.js} +32 -1
- package/dist/es/chat.dynamic-imports.js +192 -0
- package/dist/es/{chat/shared/utils/htmlUtils.js → chat.htmlUtils.js} +16 -2
- package/dist/es/{chat/shared/utils/messageUtils.js → chat.messageUtils.js} +54 -7
- package/dist/es/{chat/shared/utils/miscUtils.js → chat.miscUtils.js} +24 -5
- package/dist/es/chat.resolvablePromise.js +315 -0
- package/dist/es/{chat/shared/store/selectors.js → chat.selectors.js} +1 -1
- package/dist/es/{chat/shared/utils/lang/stringUtils.js → chat.stringUtils.js} +2 -2
- package/dist/es/{chat/shared/hooks/useCounter.js → chat.useCounter.js} +1 -1
- package/dist/es/{chat/shared/hooks/useOnMount.js → chat.useOnMount.js} +1 -1
- package/dist/es/{chat/shared/utils/domUtils.js → chat.usePrevious.js} +47 -1
- package/dist/es/{chat/shared/utils/lang/UUIDType.js → chat.uuid.js} +15 -3
- package/dist/es/web-components/cds-aichat-container/index.js +73 -4
- package/dist/es/web-components/cds-aichat-custom-element/index.js +1 -3
- package/dist/types/aiChatEntry.d.ts +4767 -0
- package/package.json +5 -4
- package/dist/es/chat/dynamic-imports/dynamic-imports.js +0 -96
- package/dist/es/chat/react/components/AppContainer.js +0 -197
- package/dist/es/chat/react/components/UserDefinedResponsePortalsContainer.js +0 -31
- package/dist/es/chat/react/components/WriteableElementsPortalsContainer.js +0 -28
- package/dist/es/chat/react/components/chainOfThought/ChainOfThought.js +0 -20
- package/dist/es/chat/react/components/chatHeader/ChatHeaderAvatar.js +0 -20
- package/dist/es/chat/react/components/chatHeader/ChatHeaderLink.js +0 -22
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenu.js +0 -27
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuButton.js +0 -60
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuItem.js +0 -24
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuItemRadioGroup.js +0 -28
- package/dist/es/chat/react/components/chatHeader/ChatHeaderOverflowMenu.js +0 -69
- package/dist/es/chat/react/components/chatHeader/ChatHeaderTitle.js +0 -22
- package/dist/es/chat/react/components/feedback/FeedbackButtonsComponent.js +0 -20
- package/dist/es/chat/react/components/feedback/FeedbackComponent.js +0 -20
- package/dist/es/chat/react/components/inlineLoading/InlineLoadingComponent.js +0 -20
- package/dist/es/chat/react/components/markdownText/MarkdownText.js +0 -20
- package/dist/es/chat/react/components/stopStreamingButton/StopStreamingButton.js +0 -20
- package/dist/es/chat/react/components/table/Table.js +0 -20
- package/dist/es/chat/shared/Chat.js +0 -115
- package/dist/es/chat/shared/ChatInstanceImpl.js +0 -360
- package/dist/es/chat/shared/chatEntryFunctions.js +0 -46
- package/dist/es/chat/shared/components/Avatar.js +0 -286
- package/dist/es/chat/shared/components/BodyWithFooterComponent.js +0 -56
- package/dist/es/chat/shared/components/CatastrophicError.js +0 -77
- package/dist/es/chat/shared/components/Chat.js +0 -244
- package/dist/es/chat/shared/components/ChatBubbleDark.js +0 -124
- package/dist/es/chat/shared/components/ChatBubbleLight.js +0 -216
- package/dist/es/chat/shared/components/Disclaimer.js +0 -86
- package/dist/es/chat/shared/components/ErrorIcon.js +0 -20
- package/dist/es/chat/shared/components/ErrorMessageDark.js +0 -89
- package/dist/es/chat/shared/components/ErrorMessageLight.js +0 -135
- package/dist/es/chat/shared/components/HydrationPanel.js +0 -58
- package/dist/es/chat/shared/components/LatestWelcomeNodes.js +0 -26
- package/dist/es/chat/shared/components/ResponseStopped.js +0 -19
- package/dist/es/chat/shared/components/SkeletonPicker.js +0 -32
- package/dist/es/chat/shared/components/WriteableElement.js +0 -22
- package/dist/es/chat/shared/components/agent/AgentAvatar.js +0 -54
- package/dist/es/chat/shared/components/agent/AgentBanner.js +0 -109
- package/dist/es/chat/shared/components/agent/AgentBannerContainer.js +0 -28
- package/dist/es/chat/shared/components/agent/AvailabilityMessage.js +0 -49
- package/dist/es/chat/shared/components/aria/AriaAnnouncerComponent.js +0 -122
- package/dist/es/chat/shared/components/aria/AriaAnnouncerProvider.js +0 -48
- package/dist/es/chat/shared/components/aria/AriaLiveMessage.js +0 -22
- package/dist/es/chat/shared/components/header/AISlug.js +0 -22
- package/dist/es/chat/shared/components/header/Header.js +0 -460
- package/dist/es/chat/shared/components/header/SimpleHeader.js +0 -27
- package/dist/es/chat/shared/components/homeScreen/HomeScreenContainer.js +0 -68
- package/dist/es/chat/shared/components/launcher/Launcher.js +0 -88
- package/dist/es/chat/shared/components/launcher/LauncherComplex.js +0 -63
- package/dist/es/chat/shared/components/launcher/LauncherContainer.js +0 -73
- package/dist/es/chat/shared/components/launcher/LauncherDesktopContainer.js +0 -221
- package/dist/es/chat/shared/components/launcher/LauncherExtended.js +0 -244
- package/dist/es/chat/shared/components/launcher/LauncherMobileContainer.js +0 -175
- package/dist/es/chat/shared/components/launcher/launcherUtils.js +0 -16
- package/dist/es/chat/shared/components/modals/ConfirmModal.js +0 -67
- package/dist/es/chat/shared/components/modals/EndAgentChatModal.js +0 -46
- package/dist/es/chat/shared/components/modals/RequestScreenShareModal.js +0 -43
- package/dist/es/chat/shared/components/notifications/Notifications.js +0 -58
- package/dist/es/chat/shared/components/panels/CustomPanel.js +0 -136
- package/dist/es/chat/shared/components/responseTypes/agent/ConnectToAgent.js +0 -30
- package/dist/es/chat/shared/components/responseTypes/agent/RealConnectToAgent.js +0 -102
- package/dist/es/chat/shared/components/responseTypes/audio/AudioComponent.js +0 -26
- package/dist/es/chat/shared/components/responseTypes/buttonItem/BaseButtonItemComponent.js +0 -69
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemComponent.js +0 -48
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemCustomEventComponent.js +0 -42
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemPostBackComponent.js +0 -54
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemShowPanelComponent.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemURLComponent.js +0 -42
- package/dist/es/chat/shared/components/responseTypes/card/CardItemComponent.js +0 -34
- package/dist/es/chat/shared/components/responseTypes/carousel/CarouselItemComponent.js +0 -39
- package/dist/es/chat/shared/components/responseTypes/conversationalSearch/ConversationalSearch.js +0 -92
- package/dist/es/chat/shared/components/responseTypes/conversationalSearch/ConversationalSearchText.js +0 -158
- package/dist/es/chat/shared/components/responseTypes/custom/UserDefinedResponse.js +0 -33
- package/dist/es/chat/shared/components/responseTypes/datePicker/DatePickerComponent.js +0 -176
- package/dist/es/chat/shared/components/responseTypes/error/InlineError.js +0 -32
- package/dist/es/chat/shared/components/responseTypes/grid/GridItemComponent.js +0 -109
- package/dist/es/chat/shared/components/responseTypes/iframe/IFrameMessage.js +0 -32
- package/dist/es/chat/shared/components/responseTypes/iframe/IFramePanel.js +0 -51
- package/dist/es/chat/shared/components/responseTypes/iframe/IFramePreviewCard.js +0 -64
- package/dist/es/chat/shared/components/responseTypes/iframe/InlineIFrame.js +0 -55
- package/dist/es/chat/shared/components/responseTypes/image/Image.js +0 -120
- package/dist/es/chat/shared/components/responseTypes/options/OptionComponent.js +0 -83
- package/dist/es/chat/shared/components/responseTypes/options/SelectComponent.js +0 -84
- package/dist/es/chat/shared/components/responseTypes/table/TableContainer.js +0 -96
- package/dist/es/chat/shared/components/responseTypes/text/TextArea.js +0 -68
- package/dist/es/chat/shared/components/responseTypes/tour/TourCard.js +0 -73
- package/dist/es/chat/shared/components/responseTypes/util/BodyMessageComponents.js +0 -65
- package/dist/es/chat/shared/components/responseTypes/util/ClickableImage.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/util/Description.js +0 -21
- package/dist/es/chat/shared/components/responseTypes/util/FooterButtonComponents.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/util/MediaPlayer.js +0 -157
- package/dist/es/chat/shared/components/responseTypes/util/Metablock.js +0 -27
- package/dist/es/chat/shared/components/responseTypes/util/RichText.js +0 -31
- package/dist/es/chat/shared/components/responseTypes/util/SearchResultBody.js +0 -53
- package/dist/es/chat/shared/components/responseTypes/util/StreamingRichText.js +0 -38
- package/dist/es/chat/shared/components/responseTypes/util/TextHolderTile.js +0 -35
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationCard.js +0 -65
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationCardContent.js +0 -62
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationClickableCard.js +0 -23
- package/dist/es/chat/shared/components/responseTypes/util/citations/ExpandToPanelCard.js +0 -50
- package/dist/es/chat/shared/components/responseTypes/util/citations/ViewSourcePanel.js +0 -57
- package/dist/es/chat/shared/components/responseTypes/video/VideoComponent.js +0 -23
- package/dist/es/chat/shared/components/tour/TourCloseMinimizeComponent.js +0 -44
- package/dist/es/chat/shared/components/tour/TourContainer.js +0 -212
- package/dist/es/chat/shared/components/tour/TourControlsComponent.js +0 -98
- package/dist/es/chat/shared/components/tour/TourStepContentComponent.js +0 -156
- package/dist/es/chat/shared/components/tour/TourStepSkeletonComponent.js +0 -20
- package/dist/es/chat/shared/components/util/AnnounceOnMountComponent.js +0 -42
- package/dist/es/chat/shared/components/util/IconHolder.js +0 -16
- package/dist/es/chat/shared/components/util/ImageWithFallback.js +0 -31
- package/dist/es/chat/shared/components/util/MaybeDangerouslySetInnerHTML.js +0 -42
- package/dist/es/chat/shared/components/util/MountChildrenOnDelay.js +0 -40
- package/dist/es/chat/shared/components/util/VisuallyHidden.js +0 -18
- package/dist/es/chat/shared/containers/App.js +0 -181
- package/dist/es/chat/shared/containers/MessageComponent.js +0 -465
- package/dist/es/chat/shared/containers/MessageTypeComponent.js +0 -496
- package/dist/es/chat/shared/containers/MessagesComponent.js +0 -469
- package/dist/es/chat/shared/containers/ModalPortal.js +0 -53
- package/dist/es/chat/shared/containers/main/MainWindow.js +0 -708
- package/dist/es/chat/shared/contexts/AriaAnnouncerContext.js +0 -12
- package/dist/es/chat/shared/contexts/HideComponentContext.js +0 -12
- package/dist/es/chat/shared/contexts/LanguagePackContext.js +0 -12
- package/dist/es/chat/shared/contexts/ModalPortalRootContext.js +0 -12
- package/dist/es/chat/shared/contexts/ServiceManagerContext.js +0 -12
- package/dist/es/chat/shared/contexts/WindowSizeContext.js +0 -12
- package/dist/es/chat/shared/environmentVariables.js +0 -13
- package/dist/es/chat/shared/events/ChatActionsImpl.js +0 -783
- package/dist/es/chat/shared/events/EventBus.js +0 -161
- package/dist/es/chat/shared/hocs/withAriaAnnouncer.js +0 -25
- package/dist/es/chat/shared/hocs/withServiceManager.js +0 -25
- package/dist/es/chat/shared/hooks/useAriaAnnouncer.js +0 -16
- package/dist/es/chat/shared/hooks/useCSSCustomProperties.js +0 -21
- package/dist/es/chat/shared/hooks/useCallbackOnChange.js +0 -24
- package/dist/es/chat/shared/hooks/useEffectDidUpdate.js +0 -21
- package/dist/es/chat/shared/hooks/useLanguagePack.js +0 -16
- package/dist/es/chat/shared/hooks/usePrevious.js +0 -18
- package/dist/es/chat/shared/hooks/useServiceManager.js +0 -16
- package/dist/es/chat/shared/hooks/useShouldSanitizeHTML.js +0 -15
- package/dist/es/chat/shared/hooks/useUUID.js +0 -22
- package/dist/es/chat/shared/hooks/useWindowSize.js +0 -16
- package/dist/es/chat/shared/loadServices.js +0 -72
- package/dist/es/chat/shared/schema/historyToMessages.js +0 -231
- package/dist/es/chat/shared/schema/inputItemToLocalItem.js +0 -30
- package/dist/es/chat/shared/schema/outputItemToLocalItem.js +0 -124
- package/dist/es/chat/shared/services/CustomPanelInstance.js +0 -26
- package/dist/es/chat/shared/services/CustomPanelManager.js +0 -23
- package/dist/es/chat/shared/services/HistoryService.js +0 -59
- package/dist/es/chat/shared/services/MessageService.js +0 -351
- package/dist/es/chat/shared/services/NamespaceService.js +0 -26
- package/dist/es/chat/shared/services/ServiceManager.js +0 -19
- package/dist/es/chat/shared/services/UserSessionStorageService.js +0 -89
- package/dist/es/chat/shared/services/haa/agentStatusMessage.js +0 -108
- package/dist/es/chat/shared/services/haa/humanAgentUtils.js +0 -114
- package/dist/es/chat/shared/services/mockStorage.js +0 -30
- package/dist/es/chat/shared/store/agentActions.js +0 -125
- package/dist/es/chat/shared/store/agentReducers.js +0 -215
- package/dist/es/chat/shared/store/doCreateStore.js +0 -142
- package/dist/es/chat/shared/store/reducerUtils.js +0 -320
- package/dist/es/chat/shared/store/reducers.js +0 -871
- package/dist/es/chat/shared/store/subscriptions.js +0 -55
- package/dist/es/chat/shared/store/tourReducerUtils.js +0 -51
- package/dist/es/chat/shared/utils/ListenerList.js +0 -26
- package/dist/es/chat/shared/utils/PageObjectId.js +0 -25
- package/dist/es/chat/shared/utils/animationUtils.js +0 -77
- package/dist/es/chat/shared/utils/colors.js +0 -71
- package/dist/es/chat/shared/utils/customizers.js +0 -16
- package/dist/es/chat/shared/utils/dateUtils.js +0 -38
- package/dist/es/chat/shared/utils/homeScreenUtils.js +0 -27
- package/dist/es/chat/shared/utils/intlUtils.js +0 -21
- package/dist/es/chat/shared/utils/lang/arrayUtils.js +0 -53
- package/dist/es/chat/shared/utils/lang/langUtils.js +0 -13
- package/dist/es/chat/shared/utils/lang/objectUtils.js +0 -19
- package/dist/es/chat/shared/utils/lang/promiseUtils.js +0 -25
- package/dist/es/chat/shared/utils/lang/uuid.js +0 -16
- package/dist/es/chat/shared/utils/languages.js +0 -156
- package/dist/es/chat/shared/utils/memoizerUtils.js +0 -38
- package/dist/es/chat/shared/utils/messageServiceUtils.js +0 -36
- package/dist/es/chat/shared/utils/resolvablePromise.js +0 -32
- package/dist/es/chat/shared/utils/styleUtils.js +0 -231
- package/dist/es/chat/shared/utils/timeUtils.js +0 -14
- package/dist/es/chat/shared/utils/viewStateUtils.js +0 -38
- package/dist/es/chat/web-components/components/chainOfThought/cds-aichat-chain-of-thought.js +0 -26
- package/dist/es/chat/web-components/components/chainOfThought/src/ChainOfThoughtElement.js +0 -130
- package/dist/es/chat/web-components/components/chainOfThought/src/chainOfThoughtElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/chainOfThought/src/chainOfThoughtElement.template.js +0 -186
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/cds-aichat-chat-header-avatar.js +0 -26
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatar.template.js +0 -32
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatarElement.js +0 -52
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatarElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderLink/cds-aichat-chat-header-link.js +0 -44
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderLink/src/chatHeaderLinkElement.template.js +0 -28
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/cds-aichat-chat-header-title.js +0 -42
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/src/chatHeaderTitle.scss.js +0 -3
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/src/chatHeaderTitle.template.js +0 -20
- package/dist/es/chat/web-components/components/codeElement/cds-aichat-code.js +0 -66
- package/dist/es/chat/web-components/components/feedbackButtonsElement/cds-aichat-feedback-buttons.js +0 -26
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/FeedbackButtonsElement.js +0 -93
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/feedbackButtonsElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/feedbackButtonsElement.template.js +0 -84
- package/dist/es/chat/web-components/components/feedbackElement/cds-aichat-feedback.js +0 -30
- package/dist/es/chat/web-components/components/feedbackElement/src/FeedbackElement.js +0 -157
- package/dist/es/chat/web-components/components/feedbackElement/src/feedbackElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/feedbackElement/src/feedbackElement.template.js +0 -95
- package/dist/es/chat/web-components/components/inlineLoadingElement/cds-aichat-inline-loading.js +0 -85
- package/dist/es/chat/web-components/components/inlineLoadingElement/src/styles.scss.js +0 -3
- package/dist/es/chat/web-components/components/markdownText/cds-aichat-markdown-text.js +0 -32
- package/dist/es/chat/web-components/components/markdownText/markdown/markdownToHTML.js +0 -28
- package/dist/es/chat/web-components/components/markdownText/markdown/utils/renderTokenTree.js +0 -191
- package/dist/es/chat/web-components/components/markdownText/markdown/workers/workerManager.js +0 -16
- package/dist/es/chat/web-components/components/markdownText/src/MarkdownElement.js +0 -70
- package/dist/es/chat/web-components/components/markdownText/src/markdownElement.template.js +0 -19
- package/dist/es/chat/web-components/components/roundedButton/cds-aichat-rounded-button.js +0 -29
- package/dist/es/chat/web-components/components/stopStreamingButton/cds-aichat-stop-streaming-button.js +0 -26
- package/dist/es/chat/web-components/components/stopStreamingButton/src/StopStreamingButtonElement.js +0 -49
- package/dist/es/chat/web-components/components/stopStreamingButton/src/stopStreamingButton.scss.js +0 -3
- package/dist/es/chat/web-components/components/stopStreamingButton/src/stopStreamingButton.template.js +0 -44
- package/dist/es/chat/web-components/components/table/cds-aichat-table.js +0 -229
- package/dist/es/chat/web-components/components/table/src/table.scss.js +0 -3
- package/dist/es/chat/web-components/components/table/src/table.template.js +0 -81
- package/dist/es/chat/web-components/components/table/src/tablePagination.template.js +0 -43
- package/dist/es/chat/web-components/components/table/src/tableSkeleton.template.js +0 -17
- package/dist/es/chat/web-components/components/tagListElement/cds-aichat-tag-list.js +0 -28
- package/dist/es/chat/web-components/components/tagListElement/src/TagListElement.js +0 -70
- package/dist/es/chat/web-components/components/tagListElement/src/tagListElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/tagListElement/src/tagListElement.template.js +0 -40
- package/dist/es/chat/web-components/decorators/customElement.js +0 -33
- package/dist/es/chat/web-components/internal/cds-aichat-internal.js +0 -78
- package/dist/es/chat/web-components/settings.js +0 -13
- package/dist/es/node_modules/@carbon/colors/es/index.js +0 -11
- package/dist/es/react/ChatContainer.js +0 -162
- package/dist/es/react/ChatCustomElement.js +0 -58
- package/dist/es/types/config/ChatHeaderConfig.js +0 -18
- package/dist/es/types/config/CornersType.js +0 -16
- package/dist/es/types/config/LauncherConfig.js +0 -19
- package/dist/es/types/config/PublicConfig.js +0 -36
- package/dist/es/types/instance/ChatInstance.js +0 -31
- package/dist/es/types/instance/apiTypes.js +0 -33
- package/dist/es/types/messaging/LocalMessageItem.js +0 -18
- package/dist/es/types/state/AppState.js +0 -18
- package/dist/es/types/utilities/Animation.js +0 -31
- package/dist/es/types/utilities/HasAddRemoveClassName.js +0 -27
- /package/dist/es/{chat/shared/styles/export.carbon.scss.js → chat.export.carbon.js} +0 -0
- /package/dist/es/{chat/shared/styles/export.scss.js → chat.export.js} +0 -0
- /package/dist/es/{chat/web-components/components/markdownText/markdown/utils/markdown.js → chat.markdown.js} +0 -0
- /package/dist/es/{chat/web-components/components/markdownText/markdown/utils/tokenTree.js → chat.tokenTree.js} +0 -0
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createComponent } from "@lit/react";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
import CDSChatFeedbackButtonsElement, { FEEDBACK_BUTTONS_COMPONENT_TAG_NAME } from "../../../web-components/components/feedbackButtonsElement/cds-aichat-feedback-buttons.js";
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Copyright IBM Corp. 2025
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
* @license
|
|
14
|
-
*/ const FeedbackButtonsComponent = createComponent({
|
|
15
|
-
tagName: FEEDBACK_BUTTONS_COMPONENT_TAG_NAME,
|
|
16
|
-
elementClass: CDSChatFeedbackButtonsElement,
|
|
17
|
-
react: React
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { FeedbackButtonsComponent };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createComponent } from "@lit/react";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
import CDSChatFeedbackElement, { FEEDBACK_COMPONENT_TAG_NAME } from "../../../web-components/components/feedbackElement/cds-aichat-feedback.js";
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Copyright IBM Corp. 2025
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
* @license
|
|
14
|
-
*/ const FeedbackComponent = createComponent({
|
|
15
|
-
tagName: FEEDBACK_COMPONENT_TAG_NAME,
|
|
16
|
-
elementClass: CDSChatFeedbackElement,
|
|
17
|
-
react: React
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { FeedbackComponent };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createComponent } from "@lit/react";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
import { CDSInlineLoadingElement, INLINE_LOADING_TAG_NAME } from "../../../web-components/components/inlineLoadingElement/cds-aichat-inline-loading.js";
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Copyright IBM Corp. 2025
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
* @license
|
|
14
|
-
*/ const InlineLoadingComponent = createComponent({
|
|
15
|
-
tagName: INLINE_LOADING_TAG_NAME,
|
|
16
|
-
elementClass: CDSInlineLoadingElement,
|
|
17
|
-
react: React
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { InlineLoadingComponent };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createComponent } from "@lit/react";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
import CDSChatMarkdownTextElement from "../../../web-components/components/markdownText/cds-aichat-markdown-text.js";
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Copyright IBM Corp. 2025
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
* @license
|
|
14
|
-
*/ const MarkdownText = createComponent({
|
|
15
|
-
tagName: "cds-aichat-markdown-text",
|
|
16
|
-
elementClass: CDSChatMarkdownTextElement,
|
|
17
|
-
react: React
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { MarkdownText };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createComponent } from "@lit/react";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
import CDSChatStopStreamingButtonElement from "../../../web-components/components/stopStreamingButton/cds-aichat-stop-streaming-button.js";
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Copyright IBM Corp. 2025
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
* @license
|
|
14
|
-
*/ const StopStreamingButton = createComponent({
|
|
15
|
-
tagName: "cds-aichat-stop-streaming-button",
|
|
16
|
-
elementClass: CDSChatStopStreamingButtonElement,
|
|
17
|
-
react: React
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { StopStreamingButton };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createComponent } from "@lit/react";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
import { TableElement, TABLE_COMPONENT_TAG_NAME } from "../../../web-components/components/table/cds-aichat-table.js";
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Copyright IBM Corp. 2025
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
* @license
|
|
14
|
-
*/ const Table = createComponent({
|
|
15
|
-
tagName: TABLE_COMPONENT_TAG_NAME,
|
|
16
|
-
elementClass: TableElement,
|
|
17
|
-
react: React
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { Table };
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import dayjs from "dayjs";
|
|
2
|
-
|
|
3
|
-
import LocalizedFormat from "dayjs/plugin/localizedFormat.js";
|
|
4
|
-
|
|
5
|
-
import isEqual from "lodash-es/isEqual.js";
|
|
6
|
-
|
|
7
|
-
import merge from "lodash-es/merge.js";
|
|
8
|
-
|
|
9
|
-
import { createChatInstance } from "./ChatInstanceImpl.js";
|
|
10
|
-
|
|
11
|
-
import { createServiceManager } from "./loadServices.js";
|
|
12
|
-
|
|
13
|
-
import actions from "./store/actions.js";
|
|
14
|
-
|
|
15
|
-
import { VIEW_STATE_ALL_CLOSED } from "./store/reducerUtils.js";
|
|
16
|
-
|
|
17
|
-
import { loadLanguagePack, loadLocale } from "./utils/languages.js";
|
|
18
|
-
|
|
19
|
-
import { hasServiceDesk } from "./utils/messageUtils.js";
|
|
20
|
-
|
|
21
|
-
import { consoleDebug, consoleError } from "./utils/miscUtils.js";
|
|
22
|
-
|
|
23
|
-
import { DEFAULT_PUBLIC_CONFIG } from "./chatEntryFunctions.js";
|
|
24
|
-
|
|
25
|
-
import { MainWindowOpenReason, ViewChangeReason } from "../../types/events/eventBusTypes.js";
|
|
26
|
-
|
|
27
|
-
import { setIntl } from "./utils/intlUtils.js";
|
|
28
|
-
|
|
29
|
-
import { loadHAA } from "../dynamic-imports/dynamic-imports.js";
|
|
30
|
-
|
|
31
|
-
/*
|
|
32
|
-
* Copyright IBM Corp. 2025
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
35
|
-
* LICENSE file in the root directory of this source tree.
|
|
36
|
-
*
|
|
37
|
-
* @license
|
|
38
|
-
*/
|
|
39
|
-
dayjs.extend(LocalizedFormat);
|
|
40
|
-
|
|
41
|
-
class Chat {
|
|
42
|
-
constructor(publicConfigProvided, customHostElement, additionalChatParametersProvided) {
|
|
43
|
-
if (publicConfigProvided?.debug) {
|
|
44
|
-
consoleDebug("Constructed chat widget", publicConfigProvided);
|
|
45
|
-
}
|
|
46
|
-
const publicConfig = merge({}, DEFAULT_PUBLIC_CONFIG, publicConfigProvided);
|
|
47
|
-
this.additionalChatParameters = additionalChatParametersProvided || {};
|
|
48
|
-
this.appConfig = {
|
|
49
|
-
public: publicConfig
|
|
50
|
-
};
|
|
51
|
-
this.customHostElement = customHostElement;
|
|
52
|
-
}
|
|
53
|
-
async start() {
|
|
54
|
-
try {
|
|
55
|
-
const result = await this.startInternal();
|
|
56
|
-
return result.instance;
|
|
57
|
-
} catch (error) {
|
|
58
|
-
consoleError("There was an error starting your chat", error);
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async startInternal() {
|
|
63
|
-
const doesHaveServiceDesk = hasServiceDesk(this.appConfig);
|
|
64
|
-
this.serviceManager = await createServiceManager(this.appConfig, this.additionalChatParameters);
|
|
65
|
-
const [languagePack, localePack, render, createHumanAgentService] = await Promise.all([ loadLanguagePack(this.serviceManager.store.getState().languagePack), loadLocale(this.serviceManager.store.getState().locale), Promise.resolve(this.additionalChatParameters.render), doesHaveServiceDesk ? loadHAA() : Promise.resolve(null) ]);
|
|
66
|
-
this.serviceManager.customHostElement = this.customHostElement;
|
|
67
|
-
if (createHumanAgentService) {
|
|
68
|
-
this.serviceManager.humanAgentService = createHumanAgentService(this.serviceManager);
|
|
69
|
-
}
|
|
70
|
-
setIntl(this.serviceManager, localePack.name, languagePack);
|
|
71
|
-
dayjs.locale(localePack);
|
|
72
|
-
const reallyRenderAndReturnInstance = async () => {
|
|
73
|
-
await render({
|
|
74
|
-
serviceManager: this.serviceManager
|
|
75
|
-
});
|
|
76
|
-
const initialState = this.serviceManager.store.getState();
|
|
77
|
-
const {wasLoadedFromBrowser: wasLoadedFromBrowser} = initialState.persistedToBrowserStorage.launcherState;
|
|
78
|
-
const {targetViewState: targetViewState} = initialState;
|
|
79
|
-
const {openChatByDefault: openChatByDefault} = initialState.config.public;
|
|
80
|
-
if (targetViewState.mainWindow) {
|
|
81
|
-
let mainWindowOpenReason = MainWindowOpenReason.SESSION_HISTORY;
|
|
82
|
-
if (openChatByDefault && !wasLoadedFromBrowser) {
|
|
83
|
-
mainWindowOpenReason = MainWindowOpenReason.OPEN_BY_DEFAULT;
|
|
84
|
-
}
|
|
85
|
-
await this.serviceManager.actions.changeView(targetViewState, {
|
|
86
|
-
mainWindowOpenReason: mainWindowOpenReason
|
|
87
|
-
});
|
|
88
|
-
} else {
|
|
89
|
-
const viewChangeReason = ViewChangeReason.WEB_CHAT_LOADED;
|
|
90
|
-
const tryHydrating = targetViewState.tour;
|
|
91
|
-
const forceViewChange = isEqual(targetViewState, VIEW_STATE_ALL_CLOSED);
|
|
92
|
-
await this.serviceManager.actions.changeView(targetViewState, {
|
|
93
|
-
viewChangeReason: viewChangeReason
|
|
94
|
-
}, tryHydrating, forceViewChange);
|
|
95
|
-
}
|
|
96
|
-
this.serviceManager.store.dispatch(actions.setInitialViewChangeComplete(true));
|
|
97
|
-
return this.serviceManager.instance;
|
|
98
|
-
};
|
|
99
|
-
const renderAndReturnInstance = () => {
|
|
100
|
-
const promise = reallyRenderAndReturnInstance();
|
|
101
|
-
this.serviceManager.renderPromise = promise;
|
|
102
|
-
return promise;
|
|
103
|
-
};
|
|
104
|
-
this.serviceManager.instance = createChatInstance({
|
|
105
|
-
serviceManager: this.serviceManager,
|
|
106
|
-
callRender: renderAndReturnInstance
|
|
107
|
-
});
|
|
108
|
-
return {
|
|
109
|
-
instance: this.serviceManager.instance,
|
|
110
|
-
serviceManager: this.serviceManager
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export { Chat as default };
|
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
import dayjs from "dayjs";
|
|
2
|
-
|
|
3
|
-
import cloneDeep from "lodash-es/cloneDeep.js";
|
|
4
|
-
|
|
5
|
-
import actions from "./store/actions.js";
|
|
6
|
-
|
|
7
|
-
import { selectInputState } from "./store/selectors.js";
|
|
8
|
-
|
|
9
|
-
import "../../types/state/AppState.js";
|
|
10
|
-
|
|
11
|
-
import { withoutEmptyStarters } from "./utils/homeScreenUtils.js";
|
|
12
|
-
|
|
13
|
-
import { loadLocale, loadLanguagePack } from "./utils/languages.js";
|
|
14
|
-
|
|
15
|
-
import { consoleDebug, debugLog, consoleError, consoleWarn } from "./utils/miscUtils.js";
|
|
16
|
-
|
|
17
|
-
import { ViewChangeReason, MessageSendSource } from "../../types/events/eventBusTypes.js";
|
|
18
|
-
|
|
19
|
-
import { setIntl } from "./utils/intlUtils.js";
|
|
20
|
-
|
|
21
|
-
import { ViewType } from "../../types/instance/apiTypes.js";
|
|
22
|
-
|
|
23
|
-
/*
|
|
24
|
-
* Copyright IBM Corp. 2025
|
|
25
|
-
*
|
|
26
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
27
|
-
* LICENSE file in the root directory of this source tree.
|
|
28
|
-
*
|
|
29
|
-
* @license
|
|
30
|
-
*/ function createChatInstance({serviceManager: serviceManager, callRender: callRender}) {
|
|
31
|
-
let wasRendered = false;
|
|
32
|
-
function getMainWindow() {
|
|
33
|
-
return {
|
|
34
|
-
addClassName: name => serviceManager.mainWindow?.addClassName(name),
|
|
35
|
-
removeClassName: name => serviceManager.mainWindow?.removeClassName(name)
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function getMessageInput() {
|
|
39
|
-
return {
|
|
40
|
-
getHTMLElement: () => serviceManager.mainWindow?.getMessageInput()?.getHTMLElement(),
|
|
41
|
-
setValue: value => serviceManager.mainWindow?.getMessageInput()?.setValue(value),
|
|
42
|
-
setEnableEnterKey: value => serviceManager.mainWindow?.getMessageInput()?.setEnableEnterKey(value),
|
|
43
|
-
addChangeListener: listener => serviceManager.mainWindow?.getMessageInput()?.addChangeListener(listener),
|
|
44
|
-
removeChangeListener: listener => serviceManager.mainWindow?.getMessageInput()?.removeChangeListener(listener)
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function getHomeScreenInput() {
|
|
48
|
-
return {
|
|
49
|
-
getHTMLElement: () => serviceManager.mainWindow?.getHomeScreenInput()?.getHTMLElement(),
|
|
50
|
-
setValue: value => serviceManager.mainWindow?.getHomeScreenInput()?.setValue(value),
|
|
51
|
-
setEnableEnterKey: value => serviceManager.mainWindow?.getHomeScreenInput()?.setEnableEnterKey(value),
|
|
52
|
-
addChangeListener: listener => serviceManager.mainWindow?.getHomeScreenInput()?.addChangeListener(listener),
|
|
53
|
-
removeChangeListener: listener => serviceManager.mainWindow?.getHomeScreenInput()?.removeChangeListener(listener)
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
let instance = {
|
|
57
|
-
render: () => {
|
|
58
|
-
if (wasRendered) {
|
|
59
|
-
consoleError("The render function has already been called!");
|
|
60
|
-
return Promise.resolve(instance);
|
|
61
|
-
}
|
|
62
|
-
wasRendered = true;
|
|
63
|
-
return callRender();
|
|
64
|
-
},
|
|
65
|
-
on: handlers => {
|
|
66
|
-
serviceManager.eventBus.on(handlers);
|
|
67
|
-
return instance;
|
|
68
|
-
},
|
|
69
|
-
off: handlers => {
|
|
70
|
-
serviceManager.eventBus.off(handlers);
|
|
71
|
-
return instance;
|
|
72
|
-
},
|
|
73
|
-
once: handlers => {
|
|
74
|
-
serviceManager.eventBus.once(handlers);
|
|
75
|
-
return instance;
|
|
76
|
-
},
|
|
77
|
-
updateLanguagePack: newPack => {
|
|
78
|
-
debugLog("Called instance.updateLanguagePack", newPack);
|
|
79
|
-
return serviceManager.actions.updateLanguagePack(newPack);
|
|
80
|
-
},
|
|
81
|
-
updateLocale: newLocale => {
|
|
82
|
-
debugLog("Called instance.updateLocale", newLocale);
|
|
83
|
-
const localePromise = loadLocale(newLocale);
|
|
84
|
-
const languagePackPromise = loadLanguagePack(serviceManager.store.getState().languagePack);
|
|
85
|
-
return Promise.all([ localePromise, languagePackPromise ]).then(([localePack, languagePack]) => {
|
|
86
|
-
dayjs.locale(localePack);
|
|
87
|
-
setIntl(serviceManager, localePack.name, languagePack);
|
|
88
|
-
serviceManager.messageService.pendingLocale = true;
|
|
89
|
-
serviceManager.messageService.localeIsExplicit = true;
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
updateCSSVariables: (variables, whiteLabelVariables) => {
|
|
93
|
-
debugLog("Called instance.updateCSSVariables", variables);
|
|
94
|
-
return serviceManager.actions.updateCSSVariables(variables, whiteLabelVariables);
|
|
95
|
-
},
|
|
96
|
-
send: async (message, options) => {
|
|
97
|
-
debugLog("Called instance.send", message, options);
|
|
98
|
-
if (selectInputState(serviceManager.store.getState()).isReadonly) {
|
|
99
|
-
throw new Error("You are unable to send messages in read only mode.");
|
|
100
|
-
}
|
|
101
|
-
return serviceManager.actions.send(message, MessageSendSource.INSTANCE_SEND, options);
|
|
102
|
-
},
|
|
103
|
-
doAutoScroll: (options = {}) => {
|
|
104
|
-
debugLog("Called instance.doAutoScroll", options);
|
|
105
|
-
serviceManager.mainWindow?.doAutoScroll?.(options);
|
|
106
|
-
},
|
|
107
|
-
destroy: () => {
|
|
108
|
-
debugLog("Called instance.destroy");
|
|
109
|
-
serviceManager.store.dispatch(actions.setAppStateValue("isDestroyed", true));
|
|
110
|
-
serviceManager.container?.remove();
|
|
111
|
-
instance = undefined;
|
|
112
|
-
},
|
|
113
|
-
updateAssistantInputFieldVisibility: isVisible => {
|
|
114
|
-
debugLog("Called instance.updateAssistantInputFieldVisibility", isVisible);
|
|
115
|
-
serviceManager.store.dispatch(actions.updateInputState({
|
|
116
|
-
fieldVisible: isVisible
|
|
117
|
-
}, false));
|
|
118
|
-
},
|
|
119
|
-
updateInputIsDisabled: isDisabled => {
|
|
120
|
-
debugLog("Called instance.updateInputIsDisabled", isDisabled);
|
|
121
|
-
serviceManager.store.dispatch(actions.updateInputState({
|
|
122
|
-
isReadonly: isDisabled
|
|
123
|
-
}, false));
|
|
124
|
-
},
|
|
125
|
-
updateBotUnreadIndicatorVisibility: isVisible => {
|
|
126
|
-
debugLog("Called instance.updateBotUnreadIndicatorVisibility", isVisible);
|
|
127
|
-
serviceManager.store.dispatch(actions.setLauncherProperty("showUnreadIndicator", isVisible));
|
|
128
|
-
},
|
|
129
|
-
changeView: async newView => {
|
|
130
|
-
debugLog("Called instance.changeView", newView);
|
|
131
|
-
let issueWithNewView = false;
|
|
132
|
-
if (!wasRendered) {
|
|
133
|
-
consoleError(`You tried to call "changeView" without ever having called the "render" method. There is no view to change!`);
|
|
134
|
-
issueWithNewView = true;
|
|
135
|
-
}
|
|
136
|
-
const viewTypeValues = Object.values(ViewType);
|
|
137
|
-
if (typeof newView === "string") {
|
|
138
|
-
if (!viewTypeValues.includes(newView)) {
|
|
139
|
-
consoleError(`You tried to change the view but the view you specified is not a valid view name. Please use` + ` the valid view names; ${viewTypeValues.join(", ")}.`);
|
|
140
|
-
issueWithNewView = true;
|
|
141
|
-
}
|
|
142
|
-
} else if (typeof newView === "object") {
|
|
143
|
-
Object.keys(newView).forEach(key => {
|
|
144
|
-
if (!viewTypeValues.includes(key)) {
|
|
145
|
-
consoleError(`You tried to change the state of multiple views by providing an object, however you included the key` + ` "${key}" within the object which is not a valid view name. Please use the valid view names; ` + `${viewTypeValues.join(", ")}.`);
|
|
146
|
-
issueWithNewView = true;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
} else {
|
|
150
|
-
consoleError("You tried to change the view but the view you provided was not a string or an object. You can either change" + ' to one of the supported views by providing a string, ex. "launcher", "mainWindow", or "tour". Or you can' + ' change the state of multiple views by providing an object, ex. { "launcher": true, "mainWindow": false,' + ' "tour": true }. Please use one of these supported options.');
|
|
151
|
-
issueWithNewView = true;
|
|
152
|
-
}
|
|
153
|
-
if (!issueWithNewView) {
|
|
154
|
-
await serviceManager.actions.changeView(newView, {
|
|
155
|
-
viewChangeReason: ViewChangeReason.CALLED_CHANGE_VIEW
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
notifications: {
|
|
160
|
-
addNotification: notification => {
|
|
161
|
-
debugLog("Called instance.addNotification", notification);
|
|
162
|
-
serviceManager.actions.addNotification(notification);
|
|
163
|
-
},
|
|
164
|
-
removeNotifications: groupID => {
|
|
165
|
-
debugLog("Called instance.removeNotifications", groupID);
|
|
166
|
-
serviceManager.actions.removeNotification(groupID);
|
|
167
|
-
},
|
|
168
|
-
removeAllNotifications: () => {
|
|
169
|
-
debugLog("Called instance.removeAllNotifications");
|
|
170
|
-
serviceManager.actions.removeAllNotifications();
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
updateMainHeaderTitle: title => {
|
|
174
|
-
debugLog("Called instance.updateMainHeaderTitle", title);
|
|
175
|
-
if (!title) {
|
|
176
|
-
title = null;
|
|
177
|
-
}
|
|
178
|
-
serviceManager.actions.updateMainHeaderTitle(title);
|
|
179
|
-
},
|
|
180
|
-
updateHomeScreenConfig: homeScreenConfig => {
|
|
181
|
-
debugLog("Called instance.updateHomeScreenConfig", homeScreenConfig);
|
|
182
|
-
const homeScreenConfigClone = cloneDeep(homeScreenConfig);
|
|
183
|
-
const isAIThemeEnabled = serviceManager.store.getState().theme.useAITheme;
|
|
184
|
-
if (isAIThemeEnabled) {
|
|
185
|
-
if (homeScreenConfig?.background) {
|
|
186
|
-
consoleWarn("The home screen background can not be changed when the AI theme is enabled.");
|
|
187
|
-
delete homeScreenConfigClone.background;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
serviceManager.actions.updateHomeScreenConfig(withoutEmptyStarters(homeScreenConfigClone));
|
|
191
|
-
},
|
|
192
|
-
getState: () => serviceManager.actions.getPublicWebChatState(),
|
|
193
|
-
writeableElements: createWriteableElementsProxy(serviceManager),
|
|
194
|
-
scrollToMessage: (messageID, animate) => {
|
|
195
|
-
debugLog("Called instance.scrollToMessage", messageID, animate);
|
|
196
|
-
serviceManager.mainWindow?.doScrollToMessage(messageID, animate);
|
|
197
|
-
},
|
|
198
|
-
updateLauncherConfig: config => serviceManager.actions.updateLauncherConfig(config),
|
|
199
|
-
customPanels: serviceManager.customPanelManager,
|
|
200
|
-
updateCustomMenuOptions: options => {
|
|
201
|
-
debugLog("Called instance.updateCustomMenuOptions", options);
|
|
202
|
-
serviceManager.store.dispatch(actions.setAppStateValue("customMenuOptions", options));
|
|
203
|
-
},
|
|
204
|
-
restartConversation: async () => {
|
|
205
|
-
debugLog("Called instance.restartConversation");
|
|
206
|
-
return serviceManager.actions.restartConversation();
|
|
207
|
-
},
|
|
208
|
-
agentEndConversation: () => {
|
|
209
|
-
debugLog("Called instance.agentEndConversation");
|
|
210
|
-
consoleWarn(`The instance.agentEndConversation method is deprecated. Use instance.serviceDesk.endConversation instead.`);
|
|
211
|
-
return serviceManager.actions.agentEndConversation(false);
|
|
212
|
-
},
|
|
213
|
-
updateIsTypingCounter(direction) {
|
|
214
|
-
debugLog("Called instance.updateIsTypingCounter", direction);
|
|
215
|
-
const {store: store} = serviceManager;
|
|
216
|
-
if (direction === "increase") {
|
|
217
|
-
store.dispatch(actions.addIsTypingCounter(1));
|
|
218
|
-
} else if (direction === "decrease") {
|
|
219
|
-
if (store.getState().botMessageState.isTypingCounter <= 0) {
|
|
220
|
-
consoleError("You cannot decrease the typing counter when it is already <= 0");
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
store.dispatch(actions.addIsTypingCounter(-1));
|
|
224
|
-
} else {
|
|
225
|
-
consoleError(`[updateIsTypingCounter] Invalid direction: ${direction}. Valid values are "increase" and "decrease".`);
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
updateIsLoadingCounter(direction) {
|
|
229
|
-
debugLog("Called instance.updateIsLoadingCounter", direction);
|
|
230
|
-
const {store: store} = serviceManager;
|
|
231
|
-
if (direction === "increase") {
|
|
232
|
-
store.dispatch(actions.addIsLoadingCounter(1));
|
|
233
|
-
} else if (direction === "decrease") {
|
|
234
|
-
if (store.getState().botMessageState.isLoadingCounter <= 0) {
|
|
235
|
-
consoleError("You cannot decrease the loading counter when it is already <= 0");
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
store.dispatch(actions.addIsLoadingCounter(-1));
|
|
239
|
-
} else {
|
|
240
|
-
consoleError(`[updateIsLoadingCounter] Invalid direction: ${direction}. Valid values are "increase" and "decrease".`);
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
updateIsChatLoadingCounter(direction) {
|
|
244
|
-
debugLog("Called instance.updateIsChatLoadingCounter", direction);
|
|
245
|
-
const {store: store} = serviceManager;
|
|
246
|
-
if (direction === "increase") {
|
|
247
|
-
store.dispatch(actions.addIsHydratingCounter(1));
|
|
248
|
-
} else if (direction === "decrease") {
|
|
249
|
-
if (store.getState().botMessageState.isHydratingCounter <= 0) {
|
|
250
|
-
consoleError("You cannot decrease the hydrating counter when it is already <= 0");
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
store.dispatch(actions.addIsHydratingCounter(-1));
|
|
254
|
-
} else {
|
|
255
|
-
consoleError(`[updateIsChatLoadingCounter] Invalid direction: ${direction}. Valid values are "increase" and "decrease".`);
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
updateHeaderConfig: config => {
|
|
259
|
-
const configCopy = cloneDeep(config);
|
|
260
|
-
serviceManager.store.dispatch(actions.updateChatHeaderConfig(configCopy));
|
|
261
|
-
},
|
|
262
|
-
updateMainHeaderAvatar: config => {
|
|
263
|
-
serviceManager.store.dispatch(actions.updateMainHeaderAvatar(config));
|
|
264
|
-
},
|
|
265
|
-
updateBotName: name => serviceManager.actions.updateBotName(name),
|
|
266
|
-
updateBotAvatarURL: url => serviceManager.actions.updateBotAvatarURL(url),
|
|
267
|
-
elements: {
|
|
268
|
-
getMainWindow: getMainWindow,
|
|
269
|
-
getMessageInput: getMessageInput,
|
|
270
|
-
getHomeScreenInput: getHomeScreenInput
|
|
271
|
-
},
|
|
272
|
-
tours: {
|
|
273
|
-
startTour: async message => {
|
|
274
|
-
debugLog("Called instance.tours.startTour", message);
|
|
275
|
-
await serviceManager.actions.send(message, MessageSendSource.START_TOUR_METHOD, {
|
|
276
|
-
skipTourCard: true
|
|
277
|
-
});
|
|
278
|
-
},
|
|
279
|
-
endTour: async () => {
|
|
280
|
-
debugLog("Called instance.tours.endTour");
|
|
281
|
-
serviceManager.actions.endTour({
|
|
282
|
-
viewChangeReason: ViewChangeReason.CALLED_END_TOUR
|
|
283
|
-
});
|
|
284
|
-
},
|
|
285
|
-
goToNextStep: async () => {
|
|
286
|
-
debugLog("Called instance.tours.goToNextStep");
|
|
287
|
-
serviceManager.actions.changeStepInTour({
|
|
288
|
-
nextStep: true
|
|
289
|
-
});
|
|
290
|
-
},
|
|
291
|
-
goToStep: async stepId => {
|
|
292
|
-
debugLog("Called instance.tours.goToStep", stepId);
|
|
293
|
-
serviceManager.actions.goToSpecificTourStep(stepId);
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
messaging: {
|
|
297
|
-
addMessage: (message, options = {}) => {
|
|
298
|
-
debugLog("Called instance.messaging.addMessage", message, options);
|
|
299
|
-
serviceManager.messageService.messageLoadingManager.end();
|
|
300
|
-
return serviceManager.actions.receive(message, options?.isLatestWelcomeNode ?? false, null, {
|
|
301
|
-
disableFadeAnimation: options?.disableFadeAnimation
|
|
302
|
-
});
|
|
303
|
-
},
|
|
304
|
-
addMessageChunk: async (chunk, options = {}) => {
|
|
305
|
-
debugLog("Called instance.messaging.addMessageChunk", chunk, options);
|
|
306
|
-
serviceManager.messageService.messageLoadingManager.end();
|
|
307
|
-
await serviceManager.actions.receiveChunk(chunk, null, options);
|
|
308
|
-
},
|
|
309
|
-
removeMessages: async messageIDs => {
|
|
310
|
-
debugLog("Called instance.messaging.removeMessages", messageIDs);
|
|
311
|
-
return serviceManager.actions.removeMessages(messageIDs);
|
|
312
|
-
},
|
|
313
|
-
clearConversation: () => {
|
|
314
|
-
debugLog("Called instance.messaging.clearConversation");
|
|
315
|
-
return serviceManager.actions.restartConversation({
|
|
316
|
-
skipHydration: true,
|
|
317
|
-
endAgentConversation: false,
|
|
318
|
-
fireEvents: false
|
|
319
|
-
});
|
|
320
|
-
},
|
|
321
|
-
insertHistory: messages => {
|
|
322
|
-
debugLog("Called instance.messaging.insertHistory", messages);
|
|
323
|
-
return serviceManager.actions.insertHistory(messages);
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
requestFocus: () => {
|
|
327
|
-
debugLog("Called instance.requestFocus");
|
|
328
|
-
serviceManager.appWindow?.requestFocus();
|
|
329
|
-
},
|
|
330
|
-
serviceDesk: {
|
|
331
|
-
endConversation: () => {
|
|
332
|
-
debugLog("Called instance.serviceDesk.endConversation");
|
|
333
|
-
return serviceManager.actions.agentEndConversation(false);
|
|
334
|
-
},
|
|
335
|
-
updateIsSuspended: async isSuspended => {
|
|
336
|
-
debugLog("Called instance.serviceDesk.updateIsSuspended", isSuspended);
|
|
337
|
-
return serviceManager.actions.agentUpdateIsSuspended(isSuspended);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
if (serviceManager.store.getState().config.public.debug) {
|
|
342
|
-
consoleDebug("[ChatInstanceImpl] Created chat instance", instance);
|
|
343
|
-
}
|
|
344
|
-
return instance;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
function createWriteableElementsProxy(serviceManager) {
|
|
348
|
-
const elementSet = new Set;
|
|
349
|
-
const handler = {
|
|
350
|
-
get(target, element) {
|
|
351
|
-
if (!elementSet.has(element)) {
|
|
352
|
-
elementSet.add(element);
|
|
353
|
-
}
|
|
354
|
-
return target[element];
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
return new Proxy(serviceManager.writeableElements, handler);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
export { createChatInstance };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import cloneDeep from "lodash-es/cloneDeep.js";
|
|
2
|
-
|
|
3
|
-
import { consoleDebug, consoleWarn } from "./utils/miscUtils.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 DEFAULT_PUBLIC_CONFIG = {
|
|
13
|
-
openChatByDefault: false,
|
|
14
|
-
showLauncher: true,
|
|
15
|
-
shouldTakeFocusIfOpensAutomatically: true,
|
|
16
|
-
serviceDesk: {},
|
|
17
|
-
messaging: {},
|
|
18
|
-
themeConfig: {
|
|
19
|
-
useAITheme: true
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
async function instantiateWidget(pagePublicConfig, chatConstructorPromise, render, element) {
|
|
24
|
-
const config = cloneDeep(pagePublicConfig);
|
|
25
|
-
if (!config.messaging?.customSendMessage) {
|
|
26
|
-
throw new Error(`You must set messaging.customSendMessage in your configuration object.`);
|
|
27
|
-
}
|
|
28
|
-
if (config?.debug) {
|
|
29
|
-
consoleDebug("[ChatEntry] Called instantiateWidget", config);
|
|
30
|
-
}
|
|
31
|
-
if (document.location.protocol !== "https:") {
|
|
32
|
-
consoleWarn('Your page is not running with "https"; your data will not be sent securely.');
|
|
33
|
-
}
|
|
34
|
-
if (document.compatMode !== "CSS1Compat") {
|
|
35
|
-
consoleWarn('Your page is running in quirks mode; you may experience layout issues with the chat. Add "<!DOCTYPE html>" to the page to run in standards mode.');
|
|
36
|
-
}
|
|
37
|
-
const {onError: onError, ...publicConfig} = config;
|
|
38
|
-
const Chat = await chatConstructorPromise(publicConfig);
|
|
39
|
-
const additionalChatParameters = {
|
|
40
|
-
onError: onError,
|
|
41
|
-
render: render
|
|
42
|
-
};
|
|
43
|
-
return new Chat(publicConfig, element, additionalChatParameters);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { DEFAULT_PUBLIC_CONFIG, instantiateWidget };
|