@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,10 +1,29 @@
|
|
|
1
|
-
import { WA_CONSOLE_PREFIX } from "./constants.js";
|
|
1
|
+
import { W as WA_CONSOLE_PREFIX } from "./chat.constants.js";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { O as OnErrorType, F as FileStatusValue } from "./chat.dynamic-imports.js";
|
|
4
4
|
|
|
5
|
-
|
|
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
|
+
*/ async function sleep(milliseconds) {
|
|
13
|
+
await new Promise(resolve => {
|
|
14
|
+
setTimeout(resolve, milliseconds);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
6
17
|
|
|
7
|
-
|
|
18
|
+
function resolveOrTimeout(promise, duration, errorMessage) {
|
|
19
|
+
const timeout = new Promise((resolve, reject) => {
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
const message = errorMessage || `The operation timed out after ${duration}ms`;
|
|
22
|
+
reject(message);
|
|
23
|
+
}, duration);
|
|
24
|
+
});
|
|
25
|
+
return Promise.race([ promise, timeout ]);
|
|
26
|
+
}
|
|
8
27
|
|
|
9
28
|
/*
|
|
10
29
|
* Copyright IBM Corp. 2025
|
|
@@ -111,4 +130,4 @@ function getBotName(useAITheme, config) {
|
|
|
111
130
|
return botName;
|
|
112
131
|
}
|
|
113
132
|
|
|
114
|
-
export {
|
|
133
|
+
export { createDidCatchErrorData as a, consoleError as b, consoleWarn as c, consoleDebug as d, debugLog as e, isEnableDebugLog as f, callOnError as g, debugStackTrace as h, isValidForUpload as i, consoleLog as j, safeFetchTextWithTimeout as k, getBotName as l, setEnableDebugLog as m, setEnableDebugStackTracesLog as n, getResponsiveElementPaddingValue as o, resolveOrTimeout as r, sleep as s };
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { b as MessageResponseTypes, a as ButtonItemType } from "./chat.Messages.js";
|
|
2
|
+
|
|
3
|
+
import { u as uuid, U as UUIDType } from "./chat.uuid.js";
|
|
4
|
+
|
|
5
|
+
import { s as streamItemID, I as createMessageResponseForItem, K as isGridResponseType, L as isCarouselResponseType, M as isShowPanelButtonType, p as isResponseWithNestedItems, N as isItemSupportedInResponseBody, O as isCardResponseType, P as isButtonResponseType } from "./chat.messageUtils.js";
|
|
6
|
+
|
|
7
|
+
import { b as consoleError } from "./chat.miscUtils.js";
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Copyright IBM Corp. 2025
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*
|
|
15
|
+
* @license
|
|
16
|
+
*/ function inputItemToLocalItem(message, originalUserText, id = uuid(UUIDType.LOCAL_MESSAGE)) {
|
|
17
|
+
const localMessage = {
|
|
18
|
+
item: {
|
|
19
|
+
response_type: MessageResponseTypes.TEXT,
|
|
20
|
+
...message.input
|
|
21
|
+
},
|
|
22
|
+
ui_state: {
|
|
23
|
+
id: id,
|
|
24
|
+
originalUserText: originalUserText,
|
|
25
|
+
needsAnnouncement: false
|
|
26
|
+
},
|
|
27
|
+
fullMessageID: message.id
|
|
28
|
+
};
|
|
29
|
+
return localMessage;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Copyright IBM Corp. 2025
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
36
|
+
* LICENSE file in the root directory of this source tree.
|
|
37
|
+
*
|
|
38
|
+
* @license
|
|
39
|
+
*/ function outputItemToLocalItem(messageItem, fullMessage, isLatestWelcomeNode = false, disableFadeAnimation = false) {
|
|
40
|
+
const id = streamItemID(fullMessage.id, messageItem) || uuid(UUIDType.LOCAL_MESSAGE);
|
|
41
|
+
const localMessage = {
|
|
42
|
+
ui_state: {
|
|
43
|
+
id: id,
|
|
44
|
+
needsAnnouncement: !fullMessage.history.from_history,
|
|
45
|
+
disableFadeAnimation: disableFadeAnimation
|
|
46
|
+
},
|
|
47
|
+
item: messageItem,
|
|
48
|
+
fullMessageID: fullMessage.id
|
|
49
|
+
};
|
|
50
|
+
if (isLatestWelcomeNode) {
|
|
51
|
+
localMessage.ui_state.isWelcomeResponse = true;
|
|
52
|
+
}
|
|
53
|
+
return localMessage;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function createLocalMessageForInlineError(text) {
|
|
57
|
+
const messageItem = {
|
|
58
|
+
response_type: MessageResponseTypes.INLINE_ERROR,
|
|
59
|
+
text: text
|
|
60
|
+
};
|
|
61
|
+
return createLocalMessageForItem(messageItem);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function createLocalMessageForItem(messageItem) {
|
|
65
|
+
const originalMessage = createMessageResponseForItem(messageItem);
|
|
66
|
+
const localMessage = outputItemToLocalItem(messageItem, originalMessage);
|
|
67
|
+
return {
|
|
68
|
+
originalMessage: originalMessage,
|
|
69
|
+
localMessage: localMessage
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function createLocalMessageItemsForNestedMessageItems(localMessageItem, originalMessage, fromHistory, nestedLocalMessageItems, allowFooter) {
|
|
74
|
+
const {item: item} = localMessageItem;
|
|
75
|
+
if (isGridResponseType(item)) {
|
|
76
|
+
localMessageItem.ui_state.gridLocalMessageItemIDs = item.rows.map(row => row.cells.map(cell => {
|
|
77
|
+
const cellLocalMessageItemIDs = [];
|
|
78
|
+
createLocalMessageItemsForNestedType("items", localMessageItem, cell.items, cellLocalMessageItemIDs, originalMessage, fromHistory, nestedLocalMessageItems, nestedMessageItem => isSupportedMessageItemInBody(localMessageItem.item, nestedMessageItem), false);
|
|
79
|
+
return cellLocalMessageItemIDs;
|
|
80
|
+
}));
|
|
81
|
+
} else if (isCarouselResponseType(item)) {
|
|
82
|
+
localMessageItem.ui_state.itemsLocalMessageItemIDs = [];
|
|
83
|
+
createLocalMessageItemsForNestedType("items", localMessageItem, item.items, localMessageItem.ui_state.itemsLocalMessageItemIDs, originalMessage, fromHistory, nestedLocalMessageItems, nestedMessageItem => isSupportedMessageItemInBody(item, nestedMessageItem), allowFooter);
|
|
84
|
+
} else {
|
|
85
|
+
const bodyItems = item.body || item.panel?.body;
|
|
86
|
+
if (bodyItems) {
|
|
87
|
+
localMessageItem.ui_state.bodyLocalMessageItemIDs = [];
|
|
88
|
+
createLocalMessageItemsForNestedType("body", localMessageItem, bodyItems, localMessageItem.ui_state.bodyLocalMessageItemIDs, originalMessage, fromHistory, nestedLocalMessageItems, nestedMessageItem => isSupportedMessageItemInBody(item, nestedMessageItem), !isShowPanelButtonType(item));
|
|
89
|
+
}
|
|
90
|
+
if (!allowFooter) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const footerItems = item.footer || item.panel?.footer;
|
|
94
|
+
if (footerItems) {
|
|
95
|
+
localMessageItem.ui_state.footerLocalMessageItemIDs = [];
|
|
96
|
+
createLocalMessageItemsForNestedType("footer", localMessageItem, footerItems, localMessageItem.ui_state.footerLocalMessageItemIDs, originalMessage, fromHistory, nestedLocalMessageItems, nestedMessageItem => isSupportedMessageItemInFooter(item, nestedMessageItem), !isShowPanelButtonType(item));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function createLocalMessageItemsForNestedType(type, localMessageItem, items, nestedMessageItemIDs, originalMessage, fromHistory, nestedLocalMessageItems, isSupported, allowFooter) {
|
|
102
|
+
items.forEach(nestedMessageItem => {
|
|
103
|
+
if (isSupported(nestedMessageItem)) {
|
|
104
|
+
const nestedLocalMessageItem = outputItemToLocalItem(nestedMessageItem, originalMessage, false, true);
|
|
105
|
+
nestedMessageItemIDs.push(nestedLocalMessageItem.ui_state.id);
|
|
106
|
+
nestedLocalMessageItems.push(nestedLocalMessageItem);
|
|
107
|
+
if (isResponseWithNestedItems(nestedLocalMessageItem.item)) {
|
|
108
|
+
createLocalMessageItemsForNestedMessageItems(nestedLocalMessageItem, originalMessage, fromHistory, nestedLocalMessageItems, allowFooter);
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
consoleError(`The "${localMessageItem.item.response_type}" response type does not support "${nestedMessageItem.response_type}" in "${type}" array.`);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function isSupportedMessageItemInBody(rootMessageItem, nestedMessageItem) {
|
|
117
|
+
switch (rootMessageItem.response_type) {
|
|
118
|
+
case MessageResponseTypes.CARD:
|
|
119
|
+
return !isCardResponseType(nestedMessageItem) && isItemSupportedInResponseBody(nestedMessageItem);
|
|
120
|
+
|
|
121
|
+
case MessageResponseTypes.CAROUSEL:
|
|
122
|
+
return isCardResponseType(nestedMessageItem);
|
|
123
|
+
|
|
124
|
+
case MessageResponseTypes.BUTTON:
|
|
125
|
+
return rootMessageItem.button_type === ButtonItemType.SHOW_PANEL && isItemSupportedInResponseBody(nestedMessageItem);
|
|
126
|
+
|
|
127
|
+
case MessageResponseTypes.GRID:
|
|
128
|
+
return !isCardResponseType(nestedMessageItem) && isItemSupportedInResponseBody(nestedMessageItem);
|
|
129
|
+
|
|
130
|
+
default:
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function isSupportedMessageItemInFooter(rootMessageItem, nestedMessageItem) {
|
|
136
|
+
if (isButtonResponseType(nestedMessageItem)) {
|
|
137
|
+
if (isShowPanelButtonType(rootMessageItem)) {
|
|
138
|
+
return !isShowPanelButtonType(nestedMessageItem);
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/*
|
|
146
|
+
* Copyright IBM Corp. 2025
|
|
147
|
+
*
|
|
148
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
149
|
+
* LICENSE file in the root directory of this source tree.
|
|
150
|
+
*
|
|
151
|
+
* @license
|
|
152
|
+
*/ const HA_SET_AGENT_AVAILABILITY = "HA_SET_AGENT_AVAILABILITY";
|
|
153
|
+
|
|
154
|
+
const HA_SET_IS_CONNECTING = "HA_SET_IS_CONNECTING";
|
|
155
|
+
|
|
156
|
+
const HA_SET_IS_RECONNECTING = "HA_SET_IS_RECONNECTING";
|
|
157
|
+
|
|
158
|
+
const HA_SET_AGENT_JOINED = "HA_SET_AGENT_JOINED";
|
|
159
|
+
|
|
160
|
+
const HA_SET_AGENT_LEFT_CHAT = "HA_SET_AGENT_LEFT_CHAT";
|
|
161
|
+
|
|
162
|
+
const HA_END_CHAT = "HA_END_CHAT";
|
|
163
|
+
|
|
164
|
+
const HA_UPDATE_CAPABILITIES = "HA_UPDATE_CAPABILITIES";
|
|
165
|
+
|
|
166
|
+
const HA_UPDATE_FILE_UPLOAD_IN_PROGRESS = "HA_UPDATE_FILE_UPLOAD_IN_PROGRESS";
|
|
167
|
+
|
|
168
|
+
const HA_SET_SHOW_SCREEN_SHARE_REQUEST = "HA_SET_SHOW_SCREEN_SHARE_REQUEST";
|
|
169
|
+
|
|
170
|
+
const HA_SET_IS_SCREEN_SHARING = "HA_SET_IS_SCREEN_SHARING";
|
|
171
|
+
|
|
172
|
+
const HA_SET_PERSISTED_STATE = "HA_SET_PERSISTED_STATE";
|
|
173
|
+
|
|
174
|
+
const HA_UPDATE_IS_SUSPENDED = "HA_UPDATE_IS_SUSPENDED";
|
|
175
|
+
|
|
176
|
+
const HA_UPDATE_IS_TYPING = "HA_UPDATE_IS_TYPING";
|
|
177
|
+
|
|
178
|
+
function setIsConnecting(isConnecting, localMessageID) {
|
|
179
|
+
return {
|
|
180
|
+
type: HA_SET_IS_CONNECTING,
|
|
181
|
+
isConnecting: isConnecting,
|
|
182
|
+
localMessageID: localMessageID
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function setIsReconnecting(isReconnecting) {
|
|
187
|
+
return {
|
|
188
|
+
type: HA_SET_IS_RECONNECTING,
|
|
189
|
+
isReconnecting: isReconnecting
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function setAgentLeftChat() {
|
|
194
|
+
return {
|
|
195
|
+
type: HA_SET_AGENT_LEFT_CHAT
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function endChat() {
|
|
200
|
+
return {
|
|
201
|
+
type: HA_END_CHAT
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function setAgentAvailability(availability) {
|
|
206
|
+
return {
|
|
207
|
+
type: HA_SET_AGENT_AVAILABILITY,
|
|
208
|
+
availability: availability
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function setAgentJoined(agentProfile) {
|
|
213
|
+
return {
|
|
214
|
+
type: HA_SET_AGENT_JOINED,
|
|
215
|
+
agentProfile: agentProfile
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function updateCapabilities(capabilities) {
|
|
220
|
+
return {
|
|
221
|
+
type: HA_UPDATE_CAPABILITIES,
|
|
222
|
+
capabilities: capabilities
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function updateFilesUploadInProgress(fileUploadInProgress) {
|
|
227
|
+
return {
|
|
228
|
+
type: HA_UPDATE_FILE_UPLOAD_IN_PROGRESS,
|
|
229
|
+
fileUploadInProgress: fileUploadInProgress
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function setShowScreenShareRequest(showRequest) {
|
|
234
|
+
return {
|
|
235
|
+
type: HA_SET_SHOW_SCREEN_SHARE_REQUEST,
|
|
236
|
+
showRequest: showRequest
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function setIsScreenSharing(isSharing) {
|
|
241
|
+
return {
|
|
242
|
+
type: HA_SET_IS_SCREEN_SHARING,
|
|
243
|
+
isSharing: isSharing
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function setPersistedServiceDeskState(state) {
|
|
248
|
+
return {
|
|
249
|
+
type: HA_SET_PERSISTED_STATE,
|
|
250
|
+
state: state
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function agentUpdateIsSuspended(isSuspended) {
|
|
255
|
+
return {
|
|
256
|
+
type: HA_UPDATE_IS_SUSPENDED,
|
|
257
|
+
isSuspended: isSuspended
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function agentUpdateIsTyping(isTyping) {
|
|
262
|
+
return {
|
|
263
|
+
type: HA_UPDATE_IS_TYPING,
|
|
264
|
+
isTyping: isTyping
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/*
|
|
269
|
+
* Copyright IBM Corp. 2025
|
|
270
|
+
*
|
|
271
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
272
|
+
* LICENSE file in the root directory of this source tree.
|
|
273
|
+
*
|
|
274
|
+
* @license
|
|
275
|
+
*/ function deepFreeze(object) {
|
|
276
|
+
Object.freeze(object);
|
|
277
|
+
Object.getOwnPropertyNames(object).forEach(prop => {
|
|
278
|
+
if (Object.prototype.hasOwnProperty.call(object, prop) && object[prop] !== null && (typeof object[prop] === "object" || typeof object[prop] === "function") && !Object.isFrozen(object[prop])) {
|
|
279
|
+
deepFreeze(object[prop]);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
return object;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/*
|
|
286
|
+
* Copyright IBM Corp. 2025
|
|
287
|
+
*
|
|
288
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
289
|
+
* LICENSE file in the root directory of this source tree.
|
|
290
|
+
*
|
|
291
|
+
* @license
|
|
292
|
+
*/ function resolvablePromise() {
|
|
293
|
+
let resolveFunction;
|
|
294
|
+
let rejectFunction;
|
|
295
|
+
const promise = new Promise((resolve, reject) => {
|
|
296
|
+
resolveFunction = resolve;
|
|
297
|
+
rejectFunction = reject;
|
|
298
|
+
});
|
|
299
|
+
promise.doResolve = resolveValue => {
|
|
300
|
+
promise.isResolved = true;
|
|
301
|
+
promise.isComplete = true;
|
|
302
|
+
resolveFunction(resolveValue);
|
|
303
|
+
};
|
|
304
|
+
promise.doReject = rejectValue => {
|
|
305
|
+
promise.isRejected = true;
|
|
306
|
+
promise.isComplete = true;
|
|
307
|
+
rejectFunction(rejectValue);
|
|
308
|
+
};
|
|
309
|
+
promise.isResolved = false;
|
|
310
|
+
promise.isRejected = false;
|
|
311
|
+
promise.isComplete = false;
|
|
312
|
+
return promise;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export { setAgentAvailability as A, setAgentJoined as B, agentUpdateIsTyping as C, setAgentLeftChat as D, setPersistedServiceDeskState as E, HA_END_CHAT as H, agentUpdateIsSuspended as a, createLocalMessageForInlineError as b, createLocalMessageItemsForNestedMessageItems as c, deepFreeze as d, HA_UPDATE_FILE_UPLOAD_IN_PROGRESS as e, HA_SET_IS_SCREEN_SHARING as f, HA_UPDATE_CAPABILITIES as g, HA_SET_AGENT_LEFT_CHAT as h, inputItemToLocalItem as i, HA_UPDATE_IS_TYPING as j, HA_UPDATE_IS_SUSPENDED as k, HA_SET_PERSISTED_STATE as l, HA_SET_AGENT_JOINED as m, HA_SET_SHOW_SCREEN_SHARE_REQUEST as n, outputItemToLocalItem as o, HA_SET_AGENT_AVAILABILITY as p, HA_SET_IS_RECONNECTING as q, resolvablePromise as r, HA_SET_IS_CONNECTING as s, setIsConnecting as t, updateFilesUploadInProgress as u, endChat as v, setIsScreenSharing as w, setIsReconnecting as x, setShowScreenShareRequest as y, updateCapabilities as z };
|
|
@@ -51,4 +51,4 @@ function selectInputState(state) {
|
|
|
51
51
|
return selectIsInputToAgent(state) ? getAgentInputState(state) : getBotInputState(state);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export {
|
|
54
|
+
export { selectInputState as a, selectIsInputToAgent as b, selectAgentDisplayState as s };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { consoleError } from "
|
|
1
|
+
import { b as consoleError } from "./chat.miscUtils.js";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright IBM Corp. 2025
|
|
@@ -56,4 +56,4 @@ function convertPossibleStringifiedArrayToFirstString(str) {
|
|
|
56
56
|
return str;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export {
|
|
59
|
+
export { convertToEmptyStringIfStringifiedNull as a, convertPossibleStringifiedArrayToFirstString as c, isEmptyString as i, parseUnknownDataToMarkdown as p };
|
|
@@ -1,9 +1,31 @@
|
|
|
1
|
+
import React, { useContext, useRef, useEffect } from "react";
|
|
2
|
+
|
|
1
3
|
import { compute } from "compute-scroll-into-view";
|
|
2
4
|
|
|
3
5
|
import memoizeOne from "memoize-one";
|
|
4
6
|
|
|
5
7
|
import { tabbable } from "tabbable";
|
|
6
8
|
|
|
9
|
+
/*
|
|
10
|
+
* Copyright IBM Corp. 2025
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*
|
|
15
|
+
* @license
|
|
16
|
+
*/ const ServiceManagerContext = React.createContext(null);
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* Copyright IBM Corp. 2025
|
|
20
|
+
*
|
|
21
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
22
|
+
* LICENSE file in the root directory of this source tree.
|
|
23
|
+
*
|
|
24
|
+
* @license
|
|
25
|
+
*/ function useServiceManager() {
|
|
26
|
+
return useContext(ServiceManagerContext);
|
|
27
|
+
}
|
|
28
|
+
|
|
7
29
|
/*
|
|
8
30
|
* Copyright IBM Corp. 2025
|
|
9
31
|
*
|
|
@@ -136,4 +158,28 @@ function getScrollBottom(element) {
|
|
|
136
158
|
return 0;
|
|
137
159
|
}
|
|
138
160
|
|
|
139
|
-
|
|
161
|
+
/*
|
|
162
|
+
* Copyright IBM Corp. 2025
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
165
|
+
* LICENSE file in the root directory of this source tree.
|
|
166
|
+
*
|
|
167
|
+
* @license
|
|
168
|
+
*/ const AriaAnnouncerContext = React.createContext(null);
|
|
169
|
+
|
|
170
|
+
/*
|
|
171
|
+
* Copyright IBM Corp. 2025
|
|
172
|
+
*
|
|
173
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
174
|
+
* LICENSE file in the root directory of this source tree.
|
|
175
|
+
*
|
|
176
|
+
* @license
|
|
177
|
+
*/ function usePrevious(value) {
|
|
178
|
+
const ref = useRef();
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
ref.current = value;
|
|
181
|
+
});
|
|
182
|
+
return ref.current;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { AriaAnnouncerContext as A, ServiceManagerContext as S, doScrollElement as a, usePrevious as b, SCROLLBAR_WIDTH as c, doFocusRef as d, isElement as e, focusOnFirstFocusableItemInArrayOfElements as f, getScrollBottom as g, isInputNode as h, isEnterKey as i, isTextAreaNode as j, isImageNode as k, isTextNode as l, doScrollElementIntoView as m, useServiceManager as u };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v4 } from "uuid";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright IBM Corp. 2025
|
|
3
5
|
*
|
|
@@ -5,8 +7,7 @@
|
|
|
5
7
|
* LICENSE file in the root directory of this source tree.
|
|
6
8
|
*
|
|
7
9
|
* @license
|
|
8
|
-
*/
|
|
9
|
-
var UUIDType;
|
|
10
|
+
*/ var UUIDType;
|
|
10
11
|
|
|
11
12
|
(function(UUIDType) {
|
|
12
13
|
UUIDType[UUIDType["MISCELLANEOUS"] = 1] = "MISCELLANEOUS";
|
|
@@ -18,4 +19,15 @@ var UUIDType;
|
|
|
18
19
|
UUIDType[UUIDType["FILE"] = 9] = "FILE";
|
|
19
20
|
})(UUIDType || (UUIDType = {}));
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
/*
|
|
23
|
+
* Copyright IBM Corp. 2025
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
26
|
+
* LICENSE file in the root directory of this source tree.
|
|
27
|
+
*
|
|
28
|
+
* @license
|
|
29
|
+
*/ function uuid(_type) {
|
|
30
|
+
return v4();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { UUIDType as U, uuid as u };
|
|
@@ -1,14 +1,83 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
|
|
3
|
-
import "../../chat/web-components/internal/cds-aichat-internal.js";
|
|
4
|
-
|
|
5
3
|
import { LitElement, html } from "lit";
|
|
6
4
|
|
|
7
5
|
import { property, state } from "lit/decorators.js";
|
|
8
6
|
|
|
9
|
-
import
|
|
7
|
+
import isEqual from "lodash-es/isEqual.js";
|
|
8
|
+
|
|
9
|
+
import React from "react";
|
|
10
|
+
|
|
11
|
+
import { createRoot } from "react-dom/client";
|
|
12
|
+
|
|
13
|
+
import { c as consoleWarn } from "../../chat.miscUtils.js";
|
|
14
|
+
|
|
15
|
+
import { c as carbonElement, B as BusEventType } from "../../chat.customElement.js";
|
|
16
|
+
|
|
17
|
+
import { D as DYNAMIC_IMPORTS } from "../../chat.dynamic-imports.js";
|
|
18
|
+
|
|
19
|
+
import "../../chat.constants.js";
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* Copyright IBM Corp. 2025
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*
|
|
27
|
+
* @license
|
|
28
|
+
*/ let ChatContainerInternal = class ChatContainerInternal extends LitElement {
|
|
29
|
+
firstUpdated() {
|
|
30
|
+
const style = document.createElement("style");
|
|
31
|
+
style.textContent = `\n :host {\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n ${this.element ? "" : "z-index: var(--cds-chat-BASE-z-index);"}\n }\n `;
|
|
32
|
+
this.appendChild(style);
|
|
33
|
+
if (this.config) {
|
|
34
|
+
this.renderReactApp();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
updated(changedProperties) {
|
|
38
|
+
if (changedProperties.has("config") && !isEqual(this.config, changedProperties.get("config"))) {
|
|
39
|
+
if (changedProperties.get("config")) {
|
|
40
|
+
consoleWarn("The config object you have passed to AI chat has updated. Tearing down and re-starting the chat.");
|
|
41
|
+
}
|
|
42
|
+
if (this.config) {
|
|
43
|
+
this.renderReactApp();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async renderReactApp() {
|
|
48
|
+
const {AppContainer: AppContainer} = await DYNAMIC_IMPORTS.AppContainer();
|
|
49
|
+
const previousContainer = this.shadowRoot.querySelector(".cds--aichat-react-app");
|
|
50
|
+
previousContainer?.remove();
|
|
51
|
+
const container = document.createElement("div");
|
|
52
|
+
container.classList.add("cds--aichat-react-app");
|
|
53
|
+
this.shadowRoot.appendChild(container);
|
|
54
|
+
if (this.root) {
|
|
55
|
+
this.root.unmount();
|
|
56
|
+
}
|
|
57
|
+
this.root = createRoot(container);
|
|
58
|
+
this.root.render(React.createElement(AppContainer, {
|
|
59
|
+
config: this.config,
|
|
60
|
+
onBeforeRender: this.onBeforeRender,
|
|
61
|
+
onAfterRender: this.onAfterRender,
|
|
62
|
+
container: container,
|
|
63
|
+
element: this.element
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
__decorate([ property({
|
|
69
|
+
type: Object
|
|
70
|
+
}) ], ChatContainerInternal.prototype, "config", void 0);
|
|
71
|
+
|
|
72
|
+
__decorate([ property({
|
|
73
|
+
type: HTMLElement
|
|
74
|
+
}) ], ChatContainerInternal.prototype, "element", void 0);
|
|
75
|
+
|
|
76
|
+
__decorate([ property() ], ChatContainerInternal.prototype, "onBeforeRender", void 0);
|
|
77
|
+
|
|
78
|
+
__decorate([ property() ], ChatContainerInternal.prototype, "onAfterRender", void 0);
|
|
10
79
|
|
|
11
|
-
|
|
80
|
+
ChatContainerInternal = __decorate([ carbonElement("cds-aichat-internal") ], ChatContainerInternal);
|
|
12
81
|
|
|
13
82
|
/*
|
|
14
83
|
* Copyright IBM Corp. 2025
|
|
@@ -4,9 +4,7 @@ import { LitElement, html } from "lit";
|
|
|
4
4
|
|
|
5
5
|
import { property, state } from "lit/decorators.js";
|
|
6
6
|
|
|
7
|
-
import { carbonElement } from "../../chat
|
|
8
|
-
|
|
9
|
-
import { BusEventType } from "../../types/events/eventBusTypes.js";
|
|
7
|
+
import { c as carbonElement, B as BusEventType } from "../../chat.customElement.js";
|
|
10
8
|
|
|
11
9
|
/*
|
|
12
10
|
* Copyright IBM Corp. 2025
|